Use POSIX version of version.c.
[glibc.git] / locale / programs / locales.h
blob95e166e3ef7e30f52043b5348ef14b30932ff1ed
1 /* Copyright (C) 1996 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
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
17 not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 #ifndef _LOCALES_H
21 #define _LOCALES_H
23 #include <ctype.h>
25 /* Undefine following line in production version. */
26 /* #define NDEBUG 1 */
27 #include <assert.h>
29 #include "linereader.h"
30 #include "locfile-token.h"
31 #include "charset.h"
32 #include "locfile.h"
33 #include "localeinfo.h"
36 /* Header of the locale data files. */
37 struct locale_file
39 int magic;
40 int n;
44 /* Handle LC_CTYPE category. */
46 static inline unsigned int
47 charclass_to_bit (enum token_t tok)
49 static unsigned int lastbit = _ISalnum;
51 switch (tok)
53 #define CLASS(name) case tok_##name: return _IS##name
54 CLASS (upper);
55 CLASS (lower);
56 CLASS (alpha);
57 CLASS (digit);
58 CLASS (alnum);
59 CLASS (space);
60 CLASS (cntrl);
61 CLASS (punct);
62 CLASS (graph);
63 CLASS (print);
64 CLASS (xdigit);
65 CLASS (blank);
66 #undef CLASS
67 case tok_string:
68 lastbit <<= 1;
69 if (lastbit == 0ul)
70 /* Exit status 2 means a limitation in the implementation is
71 exceeded. */
72 error (2, 0, _("too many character classes defined"));
73 return lastbit;
74 default:
75 assert (1 == 0);
77 return 0;
80 /* Remember name of newly created charclass. */
81 void ctype_startup (struct linereader *lr, struct localedef_t *locale,
82 struct charset_t *charset);
83 void ctype_finish (struct localedef_t *locale, struct charset_t *charset);
85 void ctype_output (struct localedef_t *locale, struct charset_t *charset,
86 const char *output_path);
88 int ctype_is_charclass (struct linereader *lr, struct localedef_t *locale,
89 const char *name);
90 void ctype_class_new (struct linereader *lr, struct localedef_t *locale,
91 enum token_t tok, struct token *code,
92 struct charset_t *charset);
93 void ctype_class_start (struct linereader *lr, struct localedef_t *locale,
94 enum token_t tok, const char *name,
95 struct charset_t *charset);
96 void ctype_class_from (struct linereader *lr, struct localedef_t *locale,
97 struct token *code, struct charset_t *charset);
98 void ctype_class_to (struct linereader *lr, struct localedef_t *locale,
99 struct token *code, struct charset_t *charset);
100 void ctype_class_end (struct linereader *lr, struct localedef_t *locale);
102 int ctype_is_charconv (struct linereader *lr, struct localedef_t *locale,
103 const char *name);
104 void ctype_map_new (struct linereader *lr, struct localedef_t *locale,
105 enum token_t tok, struct token *code,
106 struct charset_t *charset);
107 void ctype_map_start (struct linereader *lr, struct localedef_t *locale,
108 enum token_t tok, const char *name,
109 struct charset_t *charset);
110 void ctype_map_from (struct linereader *lr, struct localedef_t *locale,
111 struct token *code, struct charset_t *charset);
112 void ctype_map_to (struct linereader *lr, struct localedef_t *locale,
113 struct token *code, struct charset_t *charset);
114 void ctype_map_end (struct linereader *lr, struct localedef_t *locale);
117 /* Handle LC_COLLATE category. */
119 void collate_startup (struct linereader *lr, struct localedef_t *locale,
120 struct charset_t *charset);
122 void collate_finish (struct localedef_t *locale,
123 struct charset_t *charset);
125 void collate_output (struct localedef_t *locale, struct charset_t *charset,
126 const char *output_path);
128 void collate_element_to (struct linereader *lr, struct localedef_t *locale,
129 struct token *code, struct charset_t *charset);
130 void collate_element_from (struct linereader *lr,
131 struct localedef_t *locale, struct token *code,
132 struct charset_t *charset);
133 void collate_symbol (struct linereader *lr, struct localedef_t *locale,
134 struct token *code, struct charset_t *charset);
135 void collate_new_order (struct linereader *lr, struct localedef_t *locale,
136 enum coll_sort_rule sort_rule);
137 void collate_build_arrays (struct linereader *lr,
138 struct localedef_t *locale);
139 int collate_order_elem (struct linereader *lr, struct localedef_t *locale,
140 struct token *code, struct charset_t *charset);
141 int collate_weight_bsymbol (struct linereader *lr,
142 struct localedef_t *locale,
143 struct token *code, struct charset_t *charset);
144 int collate_next_weight (struct linereader *lr,
145 struct localedef_t *locale);
146 int collate_simple_weight (struct linereader *lr,
147 struct localedef_t *locale,
148 struct token *code, struct charset_t *charset);
149 void collate_end_weight (struct linereader *lr,
150 struct localedef_t *locale);
153 /* Handle LC_MONETARY category. */
155 void monetary_startup (struct linereader *lr, struct localedef_t *locale,
156 struct charset_t *charset);
158 void monetary_finish (struct localedef_t *locale);
160 void monetary_output (struct localedef_t *locale, const char *output_path);
162 void monetary_add (struct linereader *lr, struct localedef_t *locale,
163 enum token_t tok, struct token *code,
164 struct charset_t *charset);
167 /* Handle LC_NUMERIC category. */
169 void numeric_startup (struct linereader *lr, struct localedef_t *locale,
170 struct charset_t *charset);
172 void numeric_finish (struct localedef_t *locale);
174 void numeric_output (struct localedef_t *locale, const char *output_path);
176 void numeric_add (struct linereader *lr, struct localedef_t *locale,
177 enum token_t tok, struct token *code,
178 struct charset_t *charset);
181 /* Handle LC_TIME category. */
183 void time_startup (struct linereader *lr, struct localedef_t *locale,
184 struct charset_t *charset);
186 void time_finish (struct localedef_t *locale);
188 void time_output (struct localedef_t *locale, const char *output_path);
190 void time_add (struct linereader *lr, struct localedef_t *locale,
191 enum token_t tok, struct token *code,
192 struct charset_t *charset);
195 /* Handle LC_MESSAGES category. */
197 void messages_startup (struct linereader *lr, struct localedef_t *locale,
198 struct charset_t *charset);
200 void messages_finish (struct localedef_t *locale);
202 void messages_output (struct localedef_t *locale, const char *output_path);
204 void messages_add (struct linereader *lr, struct localedef_t *locale,
205 enum token_t tok, struct token *code,
206 struct charset_t *charset);
209 #endif /* locales.h */