1 /* localeinfo.h -- declarations for internal libc locale interfaces
2 Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
21 #define _LOCALEINFO_H 1
26 #include <sys/types.h>
29 /* stuff from loadinfo.h */
33 # define PARAMS(args) args
35 # define PARAMS(args) ()
39 /* Encoding of locale name parts. */
40 #define CEN_REVISION 1
43 #define XPG_NORM_CODESET 8
44 #define XPG_CODESET 16
46 #define CEN_AUDIENCE 64
47 #define XPG_MODIFIER 128
49 #define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE)
50 #define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER)
53 struct loaded_l10nfile
60 struct loaded_l10nfile *next;
61 struct loaded_l10nfile *successor[1];
65 extern const char *_nl_normalize_codeset PARAMS ((const char *codeset,
68 extern struct loaded_l10nfile *
69 _nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list,
70 const char *dirlist, size_t dirlist_len, int mask,
71 const char *language, const char *territory,
73 const char *normalized_codeset,
74 const char *modifier, const char *special,
75 const char *sponsor, const char *revision,
76 const char *filename, int do_allocate));
79 extern const char *_nl_expand_alias PARAMS ((const char *name));
81 extern int _nl_explode_name PARAMS ((char *name, const char **language,
82 const char **modifier,
83 const char **territory,
85 const char **normalized_codeset,
88 const char **revision));
92 /* Magic number at the beginning of a locale data file for CATEGORY. */
93 #define LIMAGIC(category) (0x960617de ^ (category))
95 /* Two special weight constants for the collation data. */
96 #define FORWARD_CHAR ((wchar_t) 0xfffffffd)
97 #define ELLIPSIS_CHAR ((wchar_t) 0xfffffffe)
98 #define IGNORE_CHAR ((wchar_t) 0xffffffff)
100 #define MAX_USAGE_COUNT (UINT_MAX - 1)
101 #define UNDELETABLE UINT_MAX
103 /* Structure describing locale data in core for a category. */
107 const char *filedata; /* Region mapping the file data. */
108 off_t filesize; /* Size of the file (and the region). */
110 /* unsigned int usage_count; */
113 unsigned int nstrings; /* Number of strings below. */
114 union locale_data_value
120 values[0]; /* Items, usually pointers into `filedata'. */
123 /* We know three kinds of collation sorting rules. */
131 sort_forward_position,
132 sort_backward_position,
136 /* We can map the types of the entries into a few categories. */
148 /* Structure to access `era' information from LC_TIME. */
151 u_int32_t direction; /* Contains '+' or '-'. */
153 int32_t start_date[3];
154 int32_t stop_date[3];
155 const char name_fmt[0];
158 extern const char *const _nl_category_names[LC_ALL + 1];
159 extern const size_t _nl_category_name_sizes[LC_ALL + 1];
160 extern const struct locale_data * *const _nl_current[LC_ALL];
162 /* Name of the standard locale. */
163 extern const char _nl_C_name[];
165 /* Extract the current CATEGORY locale's string for ITEM. */
166 #define _NL_CURRENT(category, item) \
167 (_nl_current_##category->values[_NL_ITEM_INDEX (item)].string)
169 /* Extract the current CATEGORY locale's word for ITEM. */
170 #define _NL_CURRENT_WORD(category, item) \
171 (_nl_current_##category->values[_NL_ITEM_INDEX (item)].word)
173 /* This is used in lc-CATEGORY.c to define _nl_current_CATEGORY. */
174 #define _NL_CURRENT_DEFINE(category) \
175 extern const struct locale_data _nl_C_##category; \
176 const struct locale_data *_nl_current_##category = &_nl_C_##category
178 /* Load the locale data for CATEGORY from the file specified by *NAME.
179 If *NAME is "", use environment variables as specified by POSIX,
180 and fill in *NAME with the actual name used. The directories
181 listed in LOCALE_PATH are searched for the locale files. */
182 extern const struct locale_data *_nl_find_locale (const char *locale_path,
183 size_t locale_path_len,
184 int category, char **name);
186 /* Try to load the file described by FILE. */
187 extern void _nl_load_locale (struct loaded_l10nfile *file, int category);
190 /* Return `era' entry which corresponds to TP. Used in strftime. */
191 struct era_entry *_nl_get_era_entry (const struct tm *tp);
193 /* Return `alt_digit' which corresponds to NUMBER. Used in strftime. */
194 const char *_nl_get_alt_digit (unsigned int number);
197 /* Global variables for LC_COLLATE category data. */
198 extern const u_int32_t *__collate_table;
199 extern const u_int32_t *__collate_extra;
200 extern const u_int32_t *__collate_element_hash;
201 extern const char *__collate_element_strings;
202 extern const wchar_t *__collate_element_values;
203 extern const u_int32_t *__collate_symbol_hash;
204 extern const char *__collate_symbol_strings;
205 extern const u_int32_t *__collate_symbol_classes;
207 #endif /* localeinfo.h */