]> sourceware.org Git - glibc.git/blame - locale/localeinfo.h
Fri Jan 17 14:16:28 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
[glibc.git] / locale / localeinfo.h
CommitLineData
933e73fa 1/* localeinfo.h -- declarations for internal libc locale interfaces
19bc17a9 2Copyright (C) 1995, 1996 Free Software Foundation, Inc.
28f540f4
RM
3This file is part of the GNU C Library.
4
5The GNU C Library is free software; you can redistribute it and/or
6modify it under the terms of the GNU Library General Public License as
7published by the Free Software Foundation; either version 2 of the
8License, or (at your option) any later version.
9
10The GNU C Library is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13Library General Public License for more details.
14
15You should have received a copy of the GNU Library General Public
16License along with the GNU C Library; see the file COPYING.LIB. If
933e73fa 17not, write to the Free Software Foundation, Inc., 675 Mass Ave,
28f540f4
RM
18Cambridge, MA 02139, USA. */
19
933e73fa
RM
20#ifndef _LOCALEINFO_H
21#define _LOCALEINFO_H 1
28f540f4 22
933e73fa
RM
23#include <stddef.h>
24#include <langinfo.h>
c4029823 25#include <time.h>
933e73fa 26#include <sys/types.h>
28f540f4 27
7a12c6bb
RM
28#include "../intl/loadinfo.h" /* For loaded_l10nfile definition. */
29
933e73fa 30/* Magic number at the beginning of a locale data file for CATEGORY. */
6990326c 31#define LIMAGIC(category) (0x960617de ^ (category))
19bc17a9
RM
32
33/* Two special weight constants for the collation data. */
7a12c6bb
RM
34#define FORWARD_CHAR ((wchar_t) 0xfffffffd)
35#define ELLIPSIS_CHAR ((wchar_t) 0xfffffffe)
36#define IGNORE_CHAR ((wchar_t) 0xffffffff)
28f540f4 37
933e73fa
RM
38/* Structure describing locale data in core for a category. */
39struct locale_data
19bc17a9 40{
7a12c6bb 41 const char *name;
19bc17a9
RM
42 const char *filedata; /* Region mapping the file data. */
43 off_t filesize; /* Size of the file (and the region). */
933e73fa 44
19bc17a9
RM
45 unsigned int nstrings; /* Number of strings below. */
46 union locale_data_value
47 {
ce7a5ef4 48 const wchar_t *wstr;
19bc17a9
RM
49 const char *string;
50 unsigned int word;
51 }
52 values[0]; /* Items, usually pointers into `filedata'. */
53};
54
55/* We know three kinds of collation sorting rules. */
56enum coll_sort_rule
57{
58 illegal_0__,
59 sort_forward,
60 sort_backward,
61 illegal_3__,
62 sort_position,
63 sort_forward_position,
64 sort_backward_position,
65 sort_mask
66};
67
ec4b0518 68/* We can map the types of the entries into a few categories. */
19bc17a9
RM
69enum value_type
70{
71 none,
72 string,
73 stringarray,
74 byte,
75 bytearray,
76 word
77};
933e73fa
RM
78
79
c4029823
UD
80/* Structure to access `era' information from LC_TIME. */
81struct era_entry
82{
83 u_int32_t direction; /* Contains '+' or '-'. */
84 int32_t offset;
85 int32_t start_date[3];
86 int32_t stop_date[3];
87 const char name_fmt[0];
88};
89
90
933e73fa
RM
91/* For each category declare the variable for the current locale data. */
92#define DEFINE_CATEGORY(category, category_name, items, a, b, c, d) \
93extern const struct locale_data *_nl_current_##category;
94#include "categories.def"
95#undef DEFINE_CATEGORY
96
7a12c6bb
RM
97extern const char *const _nl_category_names[LC_ALL + 1];
98extern const size_t _nl_category_name_sizes[LC_ALL + 1];
40deae08 99extern const struct locale_data * *const _nl_current[LC_ALL];
933e73fa 100
7a12c6bb
RM
101/* Name of the standard locale. */
102extern const char _nl_C_name[];
103
933e73fa
RM
104/* Extract the current CATEGORY locale's string for ITEM. */
105#define _NL_CURRENT(category, item) \
19bc17a9
RM
106 (_nl_current_##category->values[_NL_ITEM_INDEX (item)].string)
107
108/* Extract the current CATEGORY locale's word for ITEM. */
109#define _NL_CURRENT_WORD(category, item) \
110 (_nl_current_##category->values[_NL_ITEM_INDEX (item)].word)
933e73fa
RM
111
112/* This is used in lc-CATEGORY.c to define _nl_current_CATEGORY. */
113#define _NL_CURRENT_DEFINE(category) \
114 extern const struct locale_data _nl_C_##category; \
40deae08 115 const struct locale_data *_nl_current_##category = &_nl_C_##category
933e73fa
RM
116
117/* Load the locale data for CATEGORY from the file specified by *NAME.
118 If *NAME is "", use environment variables as specified by POSIX,
7a12c6bb
RM
119 and fill in *NAME with the actual name used. The directories
120 listed in LOCALE_PATH are searched for the locale files. */
121extern const struct locale_data *_nl_find_locale (const char *locale_path,
122 size_t locale_path_len,
123 int category, char **name);
933e73fa 124
7a12c6bb
RM
125/* Try to load the file described by FILE. */
126extern void _nl_load_locale (struct loaded_l10nfile *file, int category);
28f540f4 127
19bc17a9 128
c4029823
UD
129/* Return `era' entry which corresponds to TP. Used in strftime. */
130struct era_entry *_nl_get_era_entry (const struct tm *tp);
131
132/* Return `alt_digit' which corresponds to NUMBER. Used in strftime. */
133const char *_nl_get_alt_digit (unsigned int number);
134
135
19bc17a9 136/* Global variables for LC_COLLATE category data. */
7a12c6bb
RM
137extern const u_int32_t *__collate_table;
138extern const u_int32_t *__collate_extra;
ce7a5ef4
RM
139extern const u_int32_t *__collate_element_hash;
140extern const char *__collate_element_strings;
141extern const wchar_t *__collate_element_values;
142extern const u_int32_t *__collate_symbol_hash;
143extern const char *__collate_symbol_strings;
144extern const u_int32_t *__collate_symbol_classes;
19bc17a9 145
933e73fa 146#endif /* localeinfo.h */
This page took 0.069489 seconds and 5 git commands to generate.