File: | src/usr.bin/mklocale/obj/yacc.c |
Warning: | line 471, column 11 Access to field 'next' results in a dereference of a null pointer (loaded from variable 'lr') |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | #include <stdlib.h> | |||
2 | #include <string.h> | |||
3 | #define YYBYACC1 1 | |||
4 | #define YYMAJOR1 1 | |||
5 | #define YYMINOR9 9 | |||
6 | #define YYLEXyylex() yylex() | |||
7 | #define YYEMPTY-1 -1 | |||
8 | #define yyclearin(yychar=(-1)) (yychar=(YYEMPTY-1)) | |||
9 | #define yyerrok(yyerrflag=0) (yyerrflag=0) | |||
10 | #define YYRECOVERING()(yyerrflag!=0) (yyerrflag!=0) | |||
11 | #define YYPREFIX"yy" "yy" | |||
12 | #line 5 "/usr/src/usr.bin/mklocale/yacc.y" | |||
13 | /*- | |||
14 | * Copyright (c) 1993 | |||
15 | * The Regents of the University of California. All rights reserved. | |||
16 | * | |||
17 | * This code is derived from software contributed to Berkeley by | |||
18 | * Paul Borman at Krystal Technologies. | |||
19 | * | |||
20 | * Redistribution and use in source and binary forms, with or without | |||
21 | * modification, are permitted provided that the following conditions | |||
22 | * are met: | |||
23 | * 1. Redistributions of source code must retain the above copyright | |||
24 | * notice, this list of conditions and the following disclaimer. | |||
25 | * 2. Redistributions in binary form must reproduce the above copyright | |||
26 | * notice, this list of conditions and the following disclaimer in the | |||
27 | * documentation and/or other materials provided with the distribution. | |||
28 | * 3. Neither the name of the University nor the names of its contributors | |||
29 | * may be used to endorse or promote products derived from this software | |||
30 | * without specific prior written permission. | |||
31 | * | |||
32 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |||
33 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
34 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |||
35 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |||
36 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |||
38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |||
39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |||
40 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |||
41 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||
42 | * SUCH DAMAGE. | |||
43 | */ | |||
44 | ||||
45 | #include <sys/types.h> | |||
46 | #include <netinet/in.h> /* Needed by <arpa/inet.h> on NetBSD 1.5. */ | |||
47 | #include <arpa/inet.h> /* Needed for htonl on POSIX systems. */ | |||
48 | ||||
49 | #include <err.h> | |||
50 | #include "locale/runetype.h" | |||
51 | #include <stddef.h> | |||
52 | #include <stdio.h> | |||
53 | #include <stdlib.h> | |||
54 | #include <string.h> | |||
55 | #include <unistd.h> | |||
56 | #include <ctype.h> | |||
57 | ||||
58 | #include "ldef.h" | |||
59 | ||||
60 | const char *locale_file = "<stdout>"; | |||
61 | ||||
62 | rune_map maplower = { { 0, }, }; | |||
63 | rune_map mapupper = { { 0, }, }; | |||
64 | rune_map types = { { 0, }, }; | |||
65 | ||||
66 | _RuneLocale new_locale = { { 0, }, }; | |||
67 | ||||
68 | rune_t charsetbits = (rune_t)0x00000000; | |||
69 | #if 0 | |||
70 | rune_t charsetmask = (rune_t)0x0000007f; | |||
71 | #endif | |||
72 | rune_t charsetmask = (rune_t)0xffffffff; | |||
73 | ||||
74 | void set_map(rune_map *, rune_list *, u_int32_t); | |||
75 | void add_map(rune_map *, rune_list *, u_int32_t); | |||
76 | ||||
77 | int main(int, char *[]); | |||
78 | int yyerror(const char *s); | |||
79 | void *xmalloc(size_t sz); | |||
80 | u_int32_t *xlalloc(size_t sz); | |||
81 | u_int32_t *xrelalloc(u_int32_t *old, size_t sz); | |||
82 | void dump_tables(void); | |||
83 | int yyparse(void); | |||
84 | extern int yylex(void); | |||
85 | #line 79 "/usr/src/usr.bin/mklocale/yacc.y" | |||
86 | #ifndef YYSTYPE_DEFINED | |||
87 | #define YYSTYPE_DEFINED | |||
88 | typedef union { | |||
89 | rune_t rune; | |||
90 | int i; | |||
91 | char *str; | |||
92 | ||||
93 | rune_list *list; | |||
94 | } YYSTYPE; | |||
95 | #endif /* YYSTYPE_DEFINED */ | |||
96 | #line 97 "yacc.c" | |||
97 | #define RUNE257 257 | |||
98 | #define LBRK258 258 | |||
99 | #define RBRK259 259 | |||
100 | #define THRU260 260 | |||
101 | #define MAPLOWER261 261 | |||
102 | #define MAPUPPER262 262 | |||
103 | #define DIGITMAP263 263 | |||
104 | #define LIST264 264 | |||
105 | #define VARIABLE265 265 | |||
106 | #define CHARSET266 266 | |||
107 | #define ENCODING267 267 | |||
108 | #define INVALID268 268 | |||
109 | #define STRING269 269 | |||
110 | #define YYERRCODE256 256 | |||
111 | const short yylhs[] = | |||
112 | { -1, | |||
113 | 0, 0, 3, 3, 4, 4, 4, 4, 4, 4, | |||
114 | 4, 4, 4, 4, 1, 1, 1, 1, 2, 2, | |||
115 | 2, 2, 5, 5, 5, 5, | |||
116 | }; | |||
117 | const short yylen[] = | |||
118 | { 2, | |||
119 | 0, 1, 1, 2, 2, 1, 2, 3, 2, 2, | |||
120 | 2, 2, 2, 2, 1, 3, 2, 4, 4, 5, | |||
121 | 7, 8, 4, 5, 7, 8, | |||
122 | }; | |||
123 | const short yydefred[] = | |||
124 | { 0, | |||
125 | 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, | |||
126 | 3, 0, 0, 0, 0, 0, 14, 0, 0, 0, | |||
127 | 9, 5, 10, 4, 0, 0, 0, 0, 0, 0, | |||
128 | 8, 0, 0, 0, 0, 0, 0, 16, 0, 19, | |||
129 | 0, 0, 0, 0, 0, 0, 0, 18, 0, 20, | |||
130 | 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, | |||
131 | 0, 0, 22, 0, | |||
132 | }; | |||
133 | const short yydgoto[] = | |||
134 | { 9, | |||
135 | 19, 13, 10, 11, 17, | |||
136 | }; | |||
137 | const short yysindex[] = | |||
138 | { -259, | |||
139 | -248, -248, -235, -232, 0, -257, -243, -230, 0, -259, | |||
140 | 0, -229, -228, -228, -226, -225, 0, -231, -223, -221, | |||
141 | 0, 0, 0, 0, -246, -220, -242, -219, -218, -217, | |||
142 | 0, -227, -216, -241, -215, -212, -240, 0, -210, 0, | |||
143 | -18, -211, -208, 0, -16, -209, -206, 0, -205, 0, | |||
144 | -5, -203, 0, -3, -201, -198, -199, -196, 0, -197, | |||
145 | 0, -195, 0, 0,}; | |||
146 | const short yyrindex[] = | |||
147 | { 56, | |||
148 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, | |||
149 | 0, 0, 65, 73, 0, 0, 0, 1, 81, 89, | |||
150 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, | |||
151 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
152 | 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, | |||
153 | 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, | |||
154 | 46, 0, 0, 57,}; | |||
155 | const short yygindex[] = | |||
156 | { 0, | |||
157 | 0, 19, 0, 58, 0, | |||
158 | }; | |||
159 | #define YYTABLESIZE357 357 | |||
160 | const short yytable[] = | |||
161 | { 20, | |||
162 | 15, 1, 2, 3, 4, 5, 6, 7, 8, 12, | |||
163 | 32, 21, 17, 33, 35, 42, 46, 36, 43, 47, | |||
164 | 14, 16, 15, 23, 18, 22, 23, 25, 29, 26, | |||
165 | 27, 40, 28, 30, 24, 31, 34, 37, 38, 49, | |||
166 | 41, 52, 39, 44, 45, 25, 48, 50, 51, 53, | |||
167 | 54, 55, 56, 57, 58, 1, 26, 59, 60, 61, | |||
168 | 62, 63, 2, 64, 12, 0, 0, 24, 0, 0, | |||
169 | 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, | |||
170 | 11, 0, 0, 0, 0, 0, 0, 0, 7, 0, | |||
171 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
172 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
173 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
174 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
175 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
176 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
177 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
178 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
179 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
180 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
181 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
182 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
183 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
184 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
185 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
186 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
187 | 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, | |||
188 | 0, 15, 15, 15, 15, 15, 15, 15, 15, 17, | |||
189 | 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, | |||
190 | 17, 19, 0, 0, 23, 23, 23, 23, 23, 23, | |||
191 | 23, 23, 20, 0, 0, 24, 24, 24, 24, 24, | |||
192 | 24, 24, 24, 21, 0, 0, 25, 25, 25, 25, | |||
193 | 25, 25, 25, 25, 22, 0, 0, 26, 26, 26, | |||
194 | 26, 26, 26, 26, 26, 12, 12, 12, 12, 12, | |||
195 | 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, | |||
196 | 13, 11, 11, 11, 11, 11, 11, 11, 11, 7, | |||
197 | 7, 7, 7, 7, 7, 7, 7, | |||
198 | }; | |||
199 | const short yycheck[] = | |||
200 | { 257, | |||
201 | 0, 261, 262, 263, 264, 265, 266, 267, 268, 258, | |||
202 | 257, 269, 0, 260, 257, 257, 257, 260, 260, 260, | |||
203 | 2, 3, 258, 0, 257, 269, 257, 257, 260, 258, | |||
204 | 257, 259, 258, 257, 0, 257, 257, 257, 257, 58, | |||
205 | 257, 58, 260, 259, 257, 0, 257, 259, 257, 259, | |||
206 | 257, 257, 58, 257, 58, 0, 0, 259, 257, 259, | |||
207 | 257, 259, 0, 259, 0, -1, -1, 10, -1, -1, | |||
208 | -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, | |||
209 | 0, -1, -1, -1, -1, -1, -1, -1, 0, -1, | |||
210 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
211 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
212 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
213 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
214 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
215 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
216 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
217 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
218 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
219 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
220 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
221 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
222 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
223 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
224 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
225 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
226 | -1, -1, -1, -1, -1, -1, -1, 257, -1, -1, | |||
227 | -1, 261, 262, 263, 264, 265, 266, 267, 268, 257, | |||
228 | -1, -1, -1, 261, 262, 263, 264, 265, 266, 267, | |||
229 | 268, 258, -1, -1, 261, 262, 263, 264, 265, 266, | |||
230 | 267, 268, 258, -1, -1, 261, 262, 263, 264, 265, | |||
231 | 266, 267, 268, 258, -1, -1, 261, 262, 263, 264, | |||
232 | 265, 266, 267, 268, 258, -1, -1, 261, 262, 263, | |||
233 | 264, 265, 266, 267, 268, 261, 262, 263, 264, 265, | |||
234 | 266, 267, 268, 261, 262, 263, 264, 265, 266, 267, | |||
235 | 268, 261, 262, 263, 264, 265, 266, 267, 268, 261, | |||
236 | 262, 263, 264, 265, 266, 267, 268, | |||
237 | }; | |||
238 | #define YYFINAL9 9 | |||
239 | #ifndef YYDEBUG0 | |||
240 | #define YYDEBUG0 0 | |||
241 | #endif | |||
242 | #define YYMAXTOKEN269 269 | |||
243 | #if YYDEBUG0 | |||
244 | const char * const yyname[] = | |||
245 | { | |||
246 | "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |||
247 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"':'",0,0,0,0,0,0,0,0,0,0,0,0,0, | |||
248 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |||
249 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |||
250 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |||
251 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |||
252 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"RUNE","LBRK","RBRK","THRU", | |||
253 | "MAPLOWER","MAPUPPER","DIGITMAP","LIST","VARIABLE","CHARSET","ENCODING", | |||
254 | "INVALID","STRING", | |||
255 | }; | |||
256 | const char * const yyrule[] = | |||
257 | {"$accept : locale", | |||
258 | "locale :", | |||
259 | "locale : table", | |||
260 | "table : entry", | |||
261 | "table : table entry", | |||
262 | "entry : ENCODING STRING", | |||
263 | "entry : VARIABLE", | |||
264 | "entry : CHARSET RUNE", | |||
265 | "entry : CHARSET RUNE RUNE", | |||
266 | "entry : CHARSET STRING", | |||
267 | "entry : INVALID RUNE", | |||
268 | "entry : LIST list", | |||
269 | "entry : MAPLOWER map", | |||
270 | "entry : MAPUPPER map", | |||
271 | "entry : DIGITMAP mapignore", | |||
272 | "list : RUNE", | |||
273 | "list : RUNE THRU RUNE", | |||
274 | "list : list RUNE", | |||
275 | "list : list RUNE THRU RUNE", | |||
276 | "map : LBRK RUNE RUNE RBRK", | |||
277 | "map : map LBRK RUNE RUNE RBRK", | |||
278 | "map : LBRK RUNE THRU RUNE ':' RUNE RBRK", | |||
279 | "map : map LBRK RUNE THRU RUNE ':' RUNE RBRK", | |||
280 | "mapignore : LBRK RUNE RUNE RBRK", | |||
281 | "mapignore : map LBRK RUNE RUNE RBRK", | |||
282 | "mapignore : LBRK RUNE THRU RUNE ':' RUNE RBRK", | |||
283 | "mapignore : map LBRK RUNE THRU RUNE ':' RUNE RBRK", | |||
284 | }; | |||
285 | #endif | |||
286 | #ifdef YYSTACKSIZE10000 | |||
287 | #undef YYMAXDEPTH10000 | |||
288 | #define YYMAXDEPTH10000 YYSTACKSIZE10000 | |||
289 | #else | |||
290 | #ifdef YYMAXDEPTH10000 | |||
291 | #define YYSTACKSIZE10000 YYMAXDEPTH10000 | |||
292 | #else | |||
293 | #define YYSTACKSIZE10000 10000 | |||
294 | #define YYMAXDEPTH10000 10000 | |||
295 | #endif | |||
296 | #endif | |||
297 | #define YYINITSTACKSIZE200 200 | |||
298 | /* LINTUSED */ | |||
299 | int yydebug; | |||
300 | int yynerrs; | |||
301 | int yyerrflag; | |||
302 | int yychar; | |||
303 | short *yyssp; | |||
304 | YYSTYPE *yyvsp; | |||
305 | YYSTYPE yyval; | |||
306 | YYSTYPE yylval; | |||
307 | short *yyss; | |||
308 | short *yysslim; | |||
309 | YYSTYPE *yyvs; | |||
310 | unsigned int yystacksize; | |||
311 | int yyparse(void); | |||
312 | #line 244 "/usr/src/usr.bin/mklocale/yacc.y" | |||
313 | ||||
314 | int debug = 0; | |||
315 | FILE *ofile; | |||
316 | ||||
317 | int | |||
318 | main(int ac, char *av[]) | |||
319 | { | |||
320 | int x; | |||
321 | ||||
322 | extern char *optarg; | |||
323 | extern int optind; | |||
324 | ||||
325 | if (pledge("stdio rpath wpath cpath", NULL((void *)0)) == -1) { | |||
326 | perror("pledge"); | |||
327 | exit(1); | |||
328 | } | |||
329 | ||||
330 | while ((x = getopt(ac, av, "do:")) != -1) { | |||
331 | switch(x) { | |||
332 | case 'd': | |||
333 | debug = 1; | |||
334 | break; | |||
335 | case 'o': | |||
336 | locale_file = optarg; | |||
337 | if ((ofile = fopen(locale_file, "w")) == 0) | |||
338 | err(1, "unable to open output file %s", locale_file); | |||
339 | break; | |||
340 | default: | |||
341 | usage: | |||
342 | fprintf(stderr(&__sF[2]), | |||
343 | "usage: mklocale [-d] [src-file] language/LC_CTYPE\n" | |||
344 | " mklocale [-d] -o language/LC_CTYPE src-file\n"); | |||
345 | exit(1); | |||
346 | } | |||
347 | } | |||
348 | ||||
349 | switch (ac - optind) { | |||
350 | case 0: | |||
351 | break; | |||
352 | case 1: | |||
353 | if (freopen(av[optind], "r", stdin(&__sF[0])) == 0) | |||
354 | err(1, "unable to open input file %s", av[optind]); | |||
355 | break; | |||
356 | default: | |||
357 | goto usage; | |||
358 | } | |||
359 | for (x = 0; x < _CACHED_RUNES(1 << 8); ++x) { | |||
360 | mapupper.map[x] = x; | |||
361 | maplower.map[x] = x; | |||
362 | } | |||
363 | new_locale.rl_invalid_rune = _DEFAULT_INVALID_RUNE((rune_t)-3); | |||
364 | memcpy(new_locale.rl_magic, _RUNE_MAGIC_1"RuneCT10", sizeof(new_locale.rl_magic)); | |||
365 | ||||
366 | yyparse(); | |||
367 | ||||
368 | return 0; | |||
369 | } | |||
370 | ||||
371 | int | |||
372 | yyerror(const char *s) | |||
373 | { | |||
374 | fprintf(stderr(&__sF[2]), "%s\n", s); | |||
375 | ||||
376 | return 0; | |||
377 | } | |||
378 | ||||
379 | void * | |||
380 | xmalloc(size_t sz) | |||
381 | { | |||
382 | void *r = malloc(sz); | |||
383 | if (!r) { | |||
384 | perror("xmalloc"); | |||
385 | abort(); | |||
386 | } | |||
387 | return(r); | |||
388 | } | |||
389 | ||||
390 | u_int32_t * | |||
391 | xlalloc(size_t sz) | |||
392 | { | |||
393 | u_int32_t *r = reallocarray(NULL((void *)0), sz, sizeof(u_int32_t)); | |||
394 | if (!r) { | |||
395 | perror("xlalloc"); | |||
396 | abort(); | |||
397 | } | |||
398 | return(r); | |||
399 | } | |||
400 | ||||
401 | u_int32_t * | |||
402 | xrelalloc(u_int32_t *old, size_t sz) | |||
403 | { | |||
404 | u_int32_t *r = reallocarray(old, sz, sizeof(u_int32_t)); | |||
405 | if (!r) { | |||
406 | perror("xrelalloc"); | |||
407 | abort(); | |||
408 | } | |||
409 | return(r); | |||
410 | } | |||
411 | ||||
412 | void | |||
413 | set_map(rune_map *map, rune_list *list, u_int32_t flag) | |||
414 | { | |||
415 | list->map &= charsetmask; | |||
416 | list->map |= charsetbits; | |||
417 | while (list) { | |||
418 | rune_list *nlist = list->next; | |||
419 | add_map(map, list, flag); | |||
420 | list = nlist; | |||
421 | } | |||
422 | } | |||
423 | ||||
424 | void | |||
425 | add_map(rune_map *map, rune_list *list, u_int32_t flag) | |||
426 | { | |||
427 | rune_t i; | |||
428 | rune_list *lr = 0; | |||
| ||||
429 | rune_list *r; | |||
430 | rune_t run; | |||
431 | ||||
432 | while (list->min < _CACHED_RUNES(1 << 8) && list->min <= list->max) { | |||
433 | if (flag) | |||
434 | map->map[list->min++] |= flag; | |||
435 | else | |||
436 | map->map[list->min++] = list->map++; | |||
437 | } | |||
438 | ||||
439 | if (list->min > list->max) { | |||
440 | free(list); | |||
441 | return; | |||
442 | } | |||
443 | ||||
444 | run = list->max - list->min + 1; | |||
445 | ||||
446 | if (!(r = map->root) || (list->max < r->min - 1) | |||
447 | || (!flag
| |||
448 | if (flag) { | |||
449 | list->types = xlalloc(run); | |||
450 | for (i = 0; i < run; ++i) | |||
451 | list->types[i] = flag; | |||
452 | } | |||
453 | list->next = map->root; | |||
454 | map->root = list; | |||
455 | return; | |||
456 | } | |||
457 | ||||
458 | for (r = map->root; r && r->max + 1 < list->min; r = r->next) | |||
459 | lr = r; | |||
460 | ||||
461 | if (!r
| |||
462 | /* | |||
463 | * We are off the end. | |||
464 | */ | |||
465 | if (flag
| |||
466 | list->types = xlalloc(run); | |||
467 | for (i = 0; i < run; ++i) | |||
468 | list->types[i] = flag; | |||
469 | } | |||
470 | list->next = 0; | |||
471 | lr->next = list; | |||
| ||||
472 | return; | |||
473 | } | |||
474 | ||||
475 | if (list->max < r->min - 1) { | |||
476 | /* | |||
477 | * We come before this range and we do not intersect it. | |||
478 | * We are not before the root node, it was checked before the loop | |||
479 | */ | |||
480 | if (flag) { | |||
481 | list->types = xlalloc(run); | |||
482 | for (i = 0; i < run; ++i) | |||
483 | list->types[i] = flag; | |||
484 | } | |||
485 | list->next = lr->next; | |||
486 | lr->next = list; | |||
487 | return; | |||
488 | } | |||
489 | ||||
490 | /* | |||
491 | * At this point we have found that we at least intersect with | |||
492 | * the range pointed to by `r', we might intersect with one or | |||
493 | * more ranges beyond `r' as well. | |||
494 | */ | |||
495 | ||||
496 | if (!flag && list->map - list->min != r->map - r->min) { | |||
497 | /* | |||
498 | * There are only two cases when we are doing case maps and | |||
499 | * our maps needn't have the same offset. When we are adjoining | |||
500 | * but not intersecting. | |||
501 | */ | |||
502 | if (list->max + 1 == r->min) { | |||
503 | lr->next = list; | |||
504 | list->next = r; | |||
505 | return; | |||
506 | } | |||
507 | if (list->min - 1 == r->max) { | |||
508 | list->next = r->next; | |||
509 | r->next = list; | |||
510 | return; | |||
511 | } | |||
512 | fprintf(stderr(&__sF[2]), "Error: conflicting map entries\n"); | |||
513 | exit(1); | |||
514 | } | |||
515 | ||||
516 | if (list->min >= r->min && list->max <= r->max) { | |||
517 | /* | |||
518 | * Subset case. | |||
519 | */ | |||
520 | ||||
521 | if (flag) { | |||
522 | for (i = list->min; i <= list->max; ++i) | |||
523 | r->types[i - r->min] |= flag; | |||
524 | } | |||
525 | free(list); | |||
526 | return; | |||
527 | } | |||
528 | if (list->min <= r->min && list->max >= r->max) { | |||
529 | /* | |||
530 | * Superset case. Make him big enough to hold us. | |||
531 | * We might need to merge with the guy after him. | |||
532 | */ | |||
533 | if (flag) { | |||
534 | list->types = xlalloc(list->max - list->min + 1); | |||
535 | ||||
536 | for (i = list->min; i <= list->max; ++i) | |||
537 | list->types[i - list->min] = flag; | |||
538 | ||||
539 | for (i = r->min; i <= r->max; ++i) | |||
540 | list->types[i - list->min] |= r->types[i - r->min]; | |||
541 | ||||
542 | free(r->types); | |||
543 | r->types = list->types; | |||
544 | } else { | |||
545 | r->map = list->map; | |||
546 | } | |||
547 | r->min = list->min; | |||
548 | r->max = list->max; | |||
549 | free(list); | |||
550 | } else if (list->min < r->min) { | |||
551 | /* | |||
552 | * Our tail intersects his head. | |||
553 | */ | |||
554 | if (flag) { | |||
555 | list->types = xlalloc(r->max - list->min + 1); | |||
556 | ||||
557 | for (i = r->min; i <= r->max; ++i) | |||
558 | list->types[i - list->min] = r->types[i - r->min]; | |||
559 | ||||
560 | for (i = list->min; i < r->min; ++i) | |||
561 | list->types[i - list->min] = flag; | |||
562 | ||||
563 | for (i = r->min; i <= list->max; ++i) | |||
564 | list->types[i - list->min] |= flag; | |||
565 | ||||
566 | free(r->types); | |||
567 | r->types = list->types; | |||
568 | } else { | |||
569 | r->map = list->map; | |||
570 | } | |||
571 | r->min = list->min; | |||
572 | free(list); | |||
573 | return; | |||
574 | } else { | |||
575 | /* | |||
576 | * Our head intersects his tail. | |||
577 | * We might need to merge with the guy after him. | |||
578 | */ | |||
579 | if (flag) { | |||
580 | r->types = xrelalloc(r->types, list->max - r->min + 1); | |||
581 | ||||
582 | for (i = list->min; i <= r->max; ++i) | |||
583 | r->types[i - r->min] |= flag; | |||
584 | ||||
585 | for (i = r->max+1; i <= list->max; ++i) | |||
586 | r->types[i - r->min] = flag; | |||
587 | } | |||
588 | r->max = list->max; | |||
589 | free(list); | |||
590 | } | |||
591 | ||||
592 | /* | |||
593 | * Okay, check to see if we grew into the next guy(s) | |||
594 | */ | |||
595 | while ((lr = r->next) && r->max >= lr->min) { | |||
596 | if (flag) { | |||
597 | if (r->max >= lr->max) { | |||
598 | /* | |||
599 | * Good, we consumed all of him. | |||
600 | */ | |||
601 | for (i = lr->min; i <= lr->max; ++i) | |||
602 | r->types[i - r->min] |= lr->types[i - lr->min]; | |||
603 | } else { | |||
604 | /* | |||
605 | * "append" him on to the end of us. | |||
606 | */ | |||
607 | r->types = xrelalloc(r->types, lr->max - r->min + 1); | |||
608 | ||||
609 | for (i = lr->min; i <= r->max; ++i) | |||
610 | r->types[i - r->min] |= lr->types[i - lr->min]; | |||
611 | ||||
612 | for (i = r->max+1; i <= lr->max; ++i) | |||
613 | r->types[i - r->min] = lr->types[i - lr->min]; | |||
614 | ||||
615 | r->max = lr->max; | |||
616 | } | |||
617 | } else { | |||
618 | if (lr->max > r->max) | |||
619 | r->max = lr->max; | |||
620 | } | |||
621 | ||||
622 | r->next = lr->next; | |||
623 | ||||
624 | if (flag) | |||
625 | free(lr->types); | |||
626 | free(lr); | |||
627 | } | |||
628 | } | |||
629 | ||||
630 | void | |||
631 | dump_tables() | |||
632 | { | |||
633 | int x, n; | |||
634 | rune_list *list; | |||
635 | _FileRuneLocale file_new_locale; | |||
636 | FILE *fp = (ofile ? ofile : stdout(&__sF[1])); | |||
637 | ||||
638 | memset(&file_new_locale, 0, sizeof(file_new_locale)); | |||
639 | ||||
640 | /* | |||
641 | * See if we can compress some of the istype arrays | |||
642 | */ | |||
643 | for(list = types.root; list; list = list->next) { | |||
644 | list->map = list->types[0]; | |||
645 | for (x = 1; x < list->max - list->min + 1; ++x) { | |||
646 | if (list->types[x] != list->map) { | |||
647 | list->map = 0; | |||
648 | break; | |||
649 | } | |||
650 | } | |||
651 | } | |||
652 | ||||
653 | memcpy(&file_new_locale.frl_magic, new_locale.rl_magic, | |||
654 | sizeof(file_new_locale.frl_magic)); | |||
655 | memcpy(&file_new_locale.frl_encoding, new_locale.rl_encoding, | |||
656 | sizeof(file_new_locale.frl_encoding)); | |||
657 | ||||
658 | file_new_locale.frl_invalid_rune = htonl(new_locale.rl_invalid_rune)(__uint32_t)(__builtin_constant_p(new_locale.rl_invalid_rune) ? (__uint32_t)(((__uint32_t)(new_locale.rl_invalid_rune) & 0xff) << 24 | ((__uint32_t)(new_locale.rl_invalid_rune ) & 0xff00) << 8 | ((__uint32_t)(new_locale.rl_invalid_rune ) & 0xff0000) >> 8 | ((__uint32_t)(new_locale.rl_invalid_rune ) & 0xff000000) >> 24) : __swap32md(new_locale.rl_invalid_rune )); | |||
659 | ||||
660 | /* | |||
661 | * Fill in our tables. Do this in network order so that | |||
662 | * diverse machines have a chance of sharing data. | |||
663 | * (Machines like Crays cannot share with little machines due to | |||
664 | * word size. Sigh. We tried.) | |||
665 | */ | |||
666 | for (x = 0; x < _CACHED_RUNES(1 << 8); ++x) { | |||
667 | file_new_locale.frl_runetype[x] = htonl(types.map[x])(__uint32_t)(__builtin_constant_p(types.map[x]) ? (__uint32_t )(((__uint32_t)(types.map[x]) & 0xff) << 24 | ((__uint32_t )(types.map[x]) & 0xff00) << 8 | ((__uint32_t)(types .map[x]) & 0xff0000) >> 8 | ((__uint32_t)(types.map [x]) & 0xff000000) >> 24) : __swap32md(types.map[x] )); | |||
668 | file_new_locale.frl_maplower[x] = htonl(maplower.map[x])(__uint32_t)(__builtin_constant_p(maplower.map[x]) ? (__uint32_t )(((__uint32_t)(maplower.map[x]) & 0xff) << 24 | (( __uint32_t)(maplower.map[x]) & 0xff00) << 8 | ((__uint32_t )(maplower.map[x]) & 0xff0000) >> 8 | ((__uint32_t) (maplower.map[x]) & 0xff000000) >> 24) : __swap32md (maplower.map[x])); | |||
669 | file_new_locale.frl_mapupper[x] = htonl(mapupper.map[x])(__uint32_t)(__builtin_constant_p(mapupper.map[x]) ? (__uint32_t )(((__uint32_t)(mapupper.map[x]) & 0xff) << 24 | (( __uint32_t)(mapupper.map[x]) & 0xff00) << 8 | ((__uint32_t )(mapupper.map[x]) & 0xff0000) >> 8 | ((__uint32_t) (mapupper.map[x]) & 0xff000000) >> 24) : __swap32md (mapupper.map[x])); | |||
670 | } | |||
671 | ||||
672 | /* | |||
673 | * Count up how many ranges we will need for each of the extents. | |||
674 | */ | |||
675 | list = types.root; | |||
676 | ||||
677 | while (list) { | |||
678 | new_locale.rl_runetype_ext.rr_nranges++; | |||
679 | list = list->next; | |||
680 | } | |||
681 | file_new_locale.frl_runetype_ext.frr_nranges = | |||
682 | htonl(new_locale.rl_runetype_ext.rr_nranges)(__uint32_t)(__builtin_constant_p(new_locale.rl_runetype_ext. rr_nranges) ? (__uint32_t)(((__uint32_t)(new_locale.rl_runetype_ext .rr_nranges) & 0xff) << 24 | ((__uint32_t)(new_locale .rl_runetype_ext.rr_nranges) & 0xff00) << 8 | ((__uint32_t )(new_locale.rl_runetype_ext.rr_nranges) & 0xff0000) >> 8 | ((__uint32_t)(new_locale.rl_runetype_ext.rr_nranges) & 0xff000000) >> 24) : __swap32md(new_locale.rl_runetype_ext .rr_nranges)); | |||
683 | ||||
684 | list = maplower.root; | |||
685 | ||||
686 | while (list) { | |||
687 | new_locale.rl_maplower_ext.rr_nranges++; | |||
688 | list = list->next; | |||
689 | } | |||
690 | file_new_locale.frl_maplower_ext.frr_nranges = | |||
691 | htonl(new_locale.rl_maplower_ext.rr_nranges)(__uint32_t)(__builtin_constant_p(new_locale.rl_maplower_ext. rr_nranges) ? (__uint32_t)(((__uint32_t)(new_locale.rl_maplower_ext .rr_nranges) & 0xff) << 24 | ((__uint32_t)(new_locale .rl_maplower_ext.rr_nranges) & 0xff00) << 8 | ((__uint32_t )(new_locale.rl_maplower_ext.rr_nranges) & 0xff0000) >> 8 | ((__uint32_t)(new_locale.rl_maplower_ext.rr_nranges) & 0xff000000) >> 24) : __swap32md(new_locale.rl_maplower_ext .rr_nranges)); | |||
692 | ||||
693 | list = mapupper.root; | |||
694 | ||||
695 | while (list) { | |||
696 | new_locale.rl_mapupper_ext.rr_nranges++; | |||
697 | list = list->next; | |||
698 | } | |||
699 | file_new_locale.frl_mapupper_ext.frr_nranges = | |||
700 | htonl(new_locale.rl_mapupper_ext.rr_nranges)(__uint32_t)(__builtin_constant_p(new_locale.rl_mapupper_ext. rr_nranges) ? (__uint32_t)(((__uint32_t)(new_locale.rl_mapupper_ext .rr_nranges) & 0xff) << 24 | ((__uint32_t)(new_locale .rl_mapupper_ext.rr_nranges) & 0xff00) << 8 | ((__uint32_t )(new_locale.rl_mapupper_ext.rr_nranges) & 0xff0000) >> 8 | ((__uint32_t)(new_locale.rl_mapupper_ext.rr_nranges) & 0xff000000) >> 24) : __swap32md(new_locale.rl_mapupper_ext .rr_nranges)); | |||
701 | ||||
702 | file_new_locale.frl_variable_len = htonl(new_locale.rl_variable_len)(__uint32_t)(__builtin_constant_p(new_locale.rl_variable_len) ? (__uint32_t)(((__uint32_t)(new_locale.rl_variable_len) & 0xff) << 24 | ((__uint32_t)(new_locale.rl_variable_len ) & 0xff00) << 8 | ((__uint32_t)(new_locale.rl_variable_len ) & 0xff0000) >> 8 | ((__uint32_t)(new_locale.rl_variable_len ) & 0xff000000) >> 24) : __swap32md(new_locale.rl_variable_len )); | |||
703 | ||||
704 | /* | |||
705 | * Okay, we are now ready to write the new locale file. | |||
706 | */ | |||
707 | ||||
708 | /* | |||
709 | * PART 1: The _RuneLocale structure | |||
710 | */ | |||
711 | if (fwrite((char *)&file_new_locale, sizeof(file_new_locale), 1, fp) != 1) | |||
712 | err(1, "writing _RuneLocale to %s", locale_file); | |||
713 | /* | |||
714 | * PART 2: The runetype_ext structures (not the actual tables) | |||
715 | */ | |||
716 | for (list = types.root, n = 0; list != NULL((void *)0); list = list->next, n++) { | |||
717 | _FileRuneEntry re; | |||
718 | ||||
719 | memset(&re, 0, sizeof(re)); | |||
720 | re.fre_min = htonl(list->min)(__uint32_t)(__builtin_constant_p(list->min) ? (__uint32_t )(((__uint32_t)(list->min) & 0xff) << 24 | ((__uint32_t )(list->min) & 0xff00) << 8 | ((__uint32_t)(list ->min) & 0xff0000) >> 8 | ((__uint32_t)(list-> min) & 0xff000000) >> 24) : __swap32md(list->min )); | |||
721 | re.fre_max = htonl(list->max)(__uint32_t)(__builtin_constant_p(list->max) ? (__uint32_t )(((__uint32_t)(list->max) & 0xff) << 24 | ((__uint32_t )(list->max) & 0xff00) << 8 | ((__uint32_t)(list ->max) & 0xff0000) >> 8 | ((__uint32_t)(list-> max) & 0xff000000) >> 24) : __swap32md(list->max )); | |||
722 | re.fre_map = htonl(list->map)(__uint32_t)(__builtin_constant_p(list->map) ? (__uint32_t )(((__uint32_t)(list->map) & 0xff) << 24 | ((__uint32_t )(list->map) & 0xff00) << 8 | ((__uint32_t)(list ->map) & 0xff0000) >> 8 | ((__uint32_t)(list-> map) & 0xff000000) >> 24) : __swap32md(list->map )); | |||
723 | ||||
724 | if (fwrite((char *)&re, sizeof(re), 1, fp) != 1) | |||
725 | err(1, "writing runetype_ext #%d to %s", n, locale_file); | |||
726 | } | |||
727 | /* | |||
728 | * PART 3: The maplower_ext structures | |||
729 | */ | |||
730 | for (list = maplower.root, n = 0; list != NULL((void *)0); list = list->next, n++) { | |||
731 | _FileRuneEntry re; | |||
732 | ||||
733 | memset(&re, 0, sizeof(re)); | |||
734 | re.fre_min = htonl(list->min)(__uint32_t)(__builtin_constant_p(list->min) ? (__uint32_t )(((__uint32_t)(list->min) & 0xff) << 24 | ((__uint32_t )(list->min) & 0xff00) << 8 | ((__uint32_t)(list ->min) & 0xff0000) >> 8 | ((__uint32_t)(list-> min) & 0xff000000) >> 24) : __swap32md(list->min )); | |||
735 | re.fre_max = htonl(list->max)(__uint32_t)(__builtin_constant_p(list->max) ? (__uint32_t )(((__uint32_t)(list->max) & 0xff) << 24 | ((__uint32_t )(list->max) & 0xff00) << 8 | ((__uint32_t)(list ->max) & 0xff0000) >> 8 | ((__uint32_t)(list-> max) & 0xff000000) >> 24) : __swap32md(list->max )); | |||
736 | re.fre_map = htonl(list->map)(__uint32_t)(__builtin_constant_p(list->map) ? (__uint32_t )(((__uint32_t)(list->map) & 0xff) << 24 | ((__uint32_t )(list->map) & 0xff00) << 8 | ((__uint32_t)(list ->map) & 0xff0000) >> 8 | ((__uint32_t)(list-> map) & 0xff000000) >> 24) : __swap32md(list->map )); | |||
737 | ||||
738 | if (fwrite((char *)&re, sizeof(re), 1, fp) != 1) | |||
739 | err(1, "writing maplower_ext #%d to %s", n, locale_file); | |||
740 | } | |||
741 | /* | |||
742 | * PART 4: The mapupper_ext structures | |||
743 | */ | |||
744 | for (list = mapupper.root, n = 0; list != NULL((void *)0); list = list->next, n++) { | |||
745 | _FileRuneEntry re; | |||
746 | ||||
747 | memset(&re, 0, sizeof(re)); | |||
748 | re.fre_min = htonl(list->min)(__uint32_t)(__builtin_constant_p(list->min) ? (__uint32_t )(((__uint32_t)(list->min) & 0xff) << 24 | ((__uint32_t )(list->min) & 0xff00) << 8 | ((__uint32_t)(list ->min) & 0xff0000) >> 8 | ((__uint32_t)(list-> min) & 0xff000000) >> 24) : __swap32md(list->min )); | |||
749 | re.fre_max = htonl(list->max)(__uint32_t)(__builtin_constant_p(list->max) ? (__uint32_t )(((__uint32_t)(list->max) & 0xff) << 24 | ((__uint32_t )(list->max) & 0xff00) << 8 | ((__uint32_t)(list ->max) & 0xff0000) >> 8 | ((__uint32_t)(list-> max) & 0xff000000) >> 24) : __swap32md(list->max )); | |||
750 | re.fre_map = htonl(list->map)(__uint32_t)(__builtin_constant_p(list->map) ? (__uint32_t )(((__uint32_t)(list->map) & 0xff) << 24 | ((__uint32_t )(list->map) & 0xff00) << 8 | ((__uint32_t)(list ->map) & 0xff0000) >> 8 | ((__uint32_t)(list-> map) & 0xff000000) >> 24) : __swap32md(list->map )); | |||
751 | ||||
752 | if (fwrite((char *)&re, sizeof(re), 1, fp) != 1) | |||
753 | err(1, "writing mapupper_ext #%d to %s", n, locale_file); | |||
754 | } | |||
755 | /* | |||
756 | * PART 5: The runetype_ext tables | |||
757 | */ | |||
758 | for (list = types.root, n = 0; list != NULL((void *)0); list = list->next, n++) { | |||
759 | for (x = 0; x < list->max - list->min + 1; ++x) | |||
760 | list->types[x] = htonl(list->types[x])(__uint32_t)(__builtin_constant_p(list->types[x]) ? (__uint32_t )(((__uint32_t)(list->types[x]) & 0xff) << 24 | ( (__uint32_t)(list->types[x]) & 0xff00) << 8 | (( __uint32_t)(list->types[x]) & 0xff0000) >> 8 | ( (__uint32_t)(list->types[x]) & 0xff000000) >> 24 ) : __swap32md(list->types[x])); | |||
761 | ||||
762 | if (!list->map) { | |||
763 | if (fwrite((char *)list->types, | |||
764 | (list->max - list->min + 1) * sizeof(u_int32_t), | |||
765 | 1, fp) != 1) | |||
766 | err(1, "writing runetype_ext table #%d to %s", n, locale_file); | |||
767 | } | |||
768 | } | |||
769 | /* | |||
770 | * PART 5: And finally the variable data | |||
771 | */ | |||
772 | if (new_locale.rl_variable_len != 0 && | |||
773 | fwrite((char *)new_locale.rl_variable, | |||
774 | new_locale.rl_variable_len, 1, fp) != 1) | |||
775 | err(1, "writing variable data to %s", locale_file); | |||
776 | fclose(fp); | |||
777 | ||||
778 | if (!debug) | |||
779 | return; | |||
780 | ||||
781 | if (new_locale.rl_encoding[0]) | |||
782 | fprintf(stderr(&__sF[2]), "ENCODING %s\n", new_locale.rl_encoding); | |||
783 | if (new_locale.rl_variable) | |||
784 | fprintf(stderr(&__sF[2]), "VARIABLE %s\n", | |||
785 | (char *)new_locale.rl_variable); | |||
786 | ||||
787 | fprintf(stderr(&__sF[2]), "\nMAPLOWER:\n\n"); | |||
788 | ||||
789 | for (x = 0; x < _CACHED_RUNES(1 << 8); ++x) { | |||
790 | if (isprint(maplower.map[x])) | |||
791 | fprintf(stderr(&__sF[2]), " '%c'", (int)maplower.map[x]); | |||
792 | else if (maplower.map[x]) | |||
793 | fprintf(stderr(&__sF[2]), "%04x", maplower.map[x]); | |||
794 | else | |||
795 | fprintf(stderr(&__sF[2]), "%4x", 0); | |||
796 | if ((x & 0xf) == 0xf) | |||
797 | fprintf(stderr(&__sF[2]), "\n"); | |||
798 | else | |||
799 | fprintf(stderr(&__sF[2]), " "); | |||
800 | } | |||
801 | fprintf(stderr(&__sF[2]), "\n"); | |||
802 | ||||
803 | for (list = maplower.root; list; list = list->next) | |||
804 | fprintf(stderr(&__sF[2]), "\t%04x - %04x : %04x\n", list->min, list->max, list->map); | |||
805 | ||||
806 | fprintf(stderr(&__sF[2]), "\nMAPUPPER:\n\n"); | |||
807 | ||||
808 | for (x = 0; x < _CACHED_RUNES(1 << 8); ++x) { | |||
809 | if (isprint(mapupper.map[x])) | |||
810 | fprintf(stderr(&__sF[2]), " '%c'", (int)mapupper.map[x]); | |||
811 | else if (mapupper.map[x]) | |||
812 | fprintf(stderr(&__sF[2]), "%04x", mapupper.map[x]); | |||
813 | else | |||
814 | fprintf(stderr(&__sF[2]), "%4x", 0); | |||
815 | if ((x & 0xf) == 0xf) | |||
816 | fprintf(stderr(&__sF[2]), "\n"); | |||
817 | else | |||
818 | fprintf(stderr(&__sF[2]), " "); | |||
819 | } | |||
820 | fprintf(stderr(&__sF[2]), "\n"); | |||
821 | ||||
822 | for (list = mapupper.root; list; list = list->next) | |||
823 | fprintf(stderr(&__sF[2]), "\t%04x - %04x : %04x\n", list->min, list->max, list->map); | |||
824 | ||||
825 | ||||
826 | fprintf(stderr(&__sF[2]), "\nTYPES:\n\n"); | |||
827 | ||||
828 | for (x = 0; x < _CACHED_RUNES(1 << 8); ++x) { | |||
829 | u_int32_t r = types.map[x]; | |||
830 | ||||
831 | if (r) { | |||
832 | if (isprint(x)) | |||
833 | fprintf(stderr(&__sF[2]), " '%c':%2d", x, (int)(r & 0xff)); | |||
834 | else | |||
835 | fprintf(stderr(&__sF[2]), "%04x:%2d", x, (int)(r & 0xff)); | |||
836 | ||||
837 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_A0x00000100U) ? "alph" : ""); | |||
838 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_C0x00000200U) ? "ctrl" : ""); | |||
839 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_D0x00000400U) ? "dig" : ""); | |||
840 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_G0x00000800U) ? "graf" : ""); | |||
841 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_L0x00001000U) ? "low" : ""); | |||
842 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_P0x00002000U) ? "punc" : ""); | |||
843 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_S0x00004000U) ? "spac" : ""); | |||
844 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_U0x00008000U) ? "upp" : ""); | |||
845 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_X0x00010000U) ? "xdig" : ""); | |||
846 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_B0x00020000U) ? "blnk" : ""); | |||
847 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_R0x00040000U) ? "prnt" : ""); | |||
848 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_I0x00080000U) ? "ideo" : ""); | |||
849 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_T0x00100000U) ? "spec" : ""); | |||
850 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_Q0x00200000U) ? "phon" : ""); | |||
851 | fprintf(stderr(&__sF[2]), "\n"); | |||
852 | } | |||
853 | } | |||
854 | ||||
855 | for (list = types.root; list; list = list->next) { | |||
856 | if (list->map && list->min + 3 < list->max) { | |||
857 | u_int32_t r = list->map; | |||
858 | ||||
859 | fprintf(stderr(&__sF[2]), "%04x:%2d", list->min, r & 0xff); | |||
860 | ||||
861 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_A0x00000100U) ? "alph" : ""); | |||
862 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_C0x00000200U) ? "ctrl" : ""); | |||
863 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_D0x00000400U) ? "dig" : ""); | |||
864 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_G0x00000800U) ? "graf" : ""); | |||
865 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_L0x00001000U) ? "low" : ""); | |||
866 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_P0x00002000U) ? "punc" : ""); | |||
867 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_S0x00004000U) ? "spac" : ""); | |||
868 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_U0x00008000U) ? "upp" : ""); | |||
869 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_X0x00010000U) ? "xdig" : ""); | |||
870 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_B0x00020000U) ? "blnk" : ""); | |||
871 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_R0x00040000U) ? "prnt" : ""); | |||
872 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_I0x00080000U) ? "ideo" : ""); | |||
873 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_T0x00100000U) ? "spec" : ""); | |||
874 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_Q0x00200000U) ? "phon" : ""); | |||
875 | fprintf(stderr(&__sF[2]), "\n...\n"); | |||
876 | ||||
877 | fprintf(stderr(&__sF[2]), "%04x:%2d", list->max, r & 0xff); | |||
878 | ||||
879 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_A0x00000100U) ? "alph" : ""); | |||
880 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_C0x00000200U) ? "ctrl" : ""); | |||
881 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_D0x00000400U) ? "dig" : ""); | |||
882 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_G0x00000800U) ? "graf" : ""); | |||
883 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_L0x00001000U) ? "low" : ""); | |||
884 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_P0x00002000U) ? "punc" : ""); | |||
885 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_S0x00004000U) ? "spac" : ""); | |||
886 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_U0x00008000U) ? "upp" : ""); | |||
887 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_X0x00010000U) ? "xdig" : ""); | |||
888 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_B0x00020000U) ? "blnk" : ""); | |||
889 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_R0x00040000U) ? "prnt" : ""); | |||
890 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_I0x00080000U) ? "ideo" : ""); | |||
891 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_T0x00100000U) ? "spec" : ""); | |||
892 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_Q0x00200000U) ? "phon" : ""); | |||
893 | fprintf(stderr(&__sF[2]), " %1u", (unsigned)((r & _RUNETYPE_SWM0xe0000000U)>>_RUNETYPE_SWS30)); | |||
894 | fprintf(stderr(&__sF[2]), "\n"); | |||
895 | } else | |||
896 | for (x = list->min; x <= list->max; ++x) { | |||
897 | u_int32_t r = ntohl(list->types[x - list->min])(__uint32_t)(__builtin_constant_p(list->types[x - list-> min]) ? (__uint32_t)(((__uint32_t)(list->types[x - list-> min]) & 0xff) << 24 | ((__uint32_t)(list->types[ x - list->min]) & 0xff00) << 8 | ((__uint32_t)(list ->types[x - list->min]) & 0xff0000) >> 8 | (( __uint32_t)(list->types[x - list->min]) & 0xff000000 ) >> 24) : __swap32md(list->types[x - list->min]) ); | |||
898 | ||||
899 | if (r) { | |||
900 | fprintf(stderr(&__sF[2]), "%04x:%2d", x, (int)(r & 0xff)); | |||
901 | ||||
902 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_A0x00000100U) ? "alph" : ""); | |||
903 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_C0x00000200U) ? "ctrl" : ""); | |||
904 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_D0x00000400U) ? "dig" : ""); | |||
905 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_G0x00000800U) ? "graf" : ""); | |||
906 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_L0x00001000U) ? "low" : ""); | |||
907 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_P0x00002000U) ? "punc" : ""); | |||
908 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_S0x00004000U) ? "spac" : ""); | |||
909 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_U0x00008000U) ? "upp" : ""); | |||
910 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_X0x00010000U) ? "xdig" : ""); | |||
911 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_B0x00020000U) ? "blnk" : ""); | |||
912 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_R0x00040000U) ? "prnt" : ""); | |||
913 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_I0x00080000U) ? "ideo" : ""); | |||
914 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_T0x00100000U) ? "spec" : ""); | |||
915 | fprintf(stderr(&__sF[2]), " %4s", (r & _RUNETYPE_Q0x00200000U) ? "phon" : ""); | |||
916 | fprintf(stderr(&__sF[2]), " %1u", (unsigned)((r & _RUNETYPE_SWM0xe0000000U)>>_RUNETYPE_SWS30)); | |||
917 | fprintf(stderr(&__sF[2]), "\n"); | |||
918 | } | |||
919 | } | |||
920 | } | |||
921 | } | |||
922 | #line 915 "yacc.c" | |||
923 | /* allocate initial stack or double stack size, up to YYMAXDEPTH */ | |||
924 | static int yygrowstack(void) | |||
925 | { | |||
926 | unsigned int newsize; | |||
927 | long sslen; | |||
928 | short *newss; | |||
929 | YYSTYPE *newvs; | |||
930 | ||||
931 | if ((newsize = yystacksize) == 0) | |||
932 | newsize = YYINITSTACKSIZE200; | |||
933 | else if (newsize >= YYMAXDEPTH10000) | |||
934 | return -1; | |||
935 | else if ((newsize *= 2) > YYMAXDEPTH10000) | |||
936 | newsize = YYMAXDEPTH10000; | |||
937 | sslen = yyssp - yyss; | |||
938 | #ifdef SIZE_MAX | |||
939 | #define YY_SIZE_MAX0xffffffffU SIZE_MAX | |||
940 | #else | |||
941 | #define YY_SIZE_MAX0xffffffffU 0xffffffffU | |||
942 | #endif | |||
943 | if (newsize && YY_SIZE_MAX0xffffffffU / newsize < sizeof *newss) | |||
944 | goto bail; | |||
945 | newss = (short *)realloc(yyss, newsize * sizeof *newss); | |||
946 | if (newss == NULL((void *)0)) | |||
947 | goto bail; | |||
948 | yyss = newss; | |||
949 | yyssp = newss + sslen; | |||
950 | if (newsize && YY_SIZE_MAX0xffffffffU / newsize < sizeof *newvs) | |||
951 | goto bail; | |||
952 | newvs = (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs); | |||
953 | if (newvs == NULL((void *)0)) | |||
954 | goto bail; | |||
955 | yyvs = newvs; | |||
956 | yyvsp = newvs + sslen; | |||
957 | yystacksize = newsize; | |||
958 | yysslim = yyss + newsize - 1; | |||
959 | return 0; | |||
960 | bail: | |||
961 | if (yyss) | |||
962 | free(yyss); | |||
963 | if (yyvs) | |||
964 | free(yyvs); | |||
965 | yyss = yyssp = NULL((void *)0); | |||
966 | yyvs = yyvsp = NULL((void *)0); | |||
967 | yystacksize = 0; | |||
968 | return -1; | |||
969 | } | |||
970 | ||||
971 | #define YYABORTgoto yyabort goto yyabort | |||
972 | #define YYREJECTgoto yyabort goto yyabort | |||
973 | #define YYACCEPTgoto yyaccept goto yyaccept | |||
974 | #define YYERRORgoto yyerrlab goto yyerrlab | |||
975 | int | |||
976 | yyparse(void) | |||
977 | { | |||
978 | int yym, yyn, yystate; | |||
979 | #if YYDEBUG0 | |||
980 | const char *yys; | |||
981 | ||||
982 | if ((yys = getenv("YYDEBUG"))) | |||
983 | { | |||
984 | yyn = *yys; | |||
985 | if (yyn >= '0' && yyn <= '9') | |||
986 | yydebug = yyn - '0'; | |||
987 | } | |||
988 | #endif /* YYDEBUG */ | |||
989 | ||||
990 | yynerrs = 0; | |||
991 | yyerrflag = 0; | |||
992 | yychar = (-1); | |||
993 | ||||
994 | if (yyss == NULL((void *)0) && yygrowstack()) goto yyoverflow; | |||
995 | yyssp = yyss; | |||
996 | yyvsp = yyvs; | |||
997 | *yyssp = yystate = 0; | |||
998 | ||||
999 | yyloop: | |||
1000 | if ((yyn = yydefred[yystate]) != 0) goto yyreduce; | |||
1001 | if (yychar < 0) | |||
1002 | { | |||
1003 | if ((yychar = yylex()) < 0) yychar = 0; | |||
1004 | #if YYDEBUG0 | |||
1005 | if (yydebug) | |||
1006 | { | |||
1007 | yys = 0; | |||
1008 | if (yychar <= YYMAXTOKEN269) yys = yyname[yychar]; | |||
1009 | if (!yys) yys = "illegal-symbol"; | |||
1010 | printf("%sdebug: state %d, reading %d (%s)\n", | |||
1011 | YYPREFIX"yy", yystate, yychar, yys); | |||
1012 | } | |||
1013 | #endif | |||
1014 | } | |||
1015 | if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && | |||
1016 | yyn <= YYTABLESIZE357 && yycheck[yyn] == yychar) | |||
1017 | { | |||
1018 | #if YYDEBUG0 | |||
1019 | if (yydebug) | |||
1020 | printf("%sdebug: state %d, shifting to state %d\n", | |||
1021 | YYPREFIX"yy", yystate, yytable[yyn]); | |||
1022 | #endif | |||
1023 | if (yyssp >= yysslim && yygrowstack()) | |||
1024 | { | |||
1025 | goto yyoverflow; | |||
1026 | } | |||
1027 | *++yyssp = yystate = yytable[yyn]; | |||
1028 | *++yyvsp = yylval; | |||
1029 | yychar = (-1); | |||
1030 | if (yyerrflag > 0) --yyerrflag; | |||
1031 | goto yyloop; | |||
1032 | } | |||
1033 | if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && | |||
1034 | yyn <= YYTABLESIZE357 && yycheck[yyn] == yychar) | |||
1035 | { | |||
1036 | yyn = yytable[yyn]; | |||
1037 | goto yyreduce; | |||
1038 | } | |||
1039 | if (yyerrflag) goto yyinrecovery; | |||
1040 | #if defined(__GNUC__4) | |||
1041 | goto yynewerror; | |||
1042 | #endif | |||
1043 | yynewerror: | |||
1044 | yyerror("syntax error"); | |||
1045 | #if defined(__GNUC__4) | |||
1046 | goto yyerrlab; | |||
1047 | #endif | |||
1048 | yyerrlab: | |||
1049 | ++yynerrs; | |||
1050 | yyinrecovery: | |||
1051 | if (yyerrflag < 3) | |||
1052 | { | |||
1053 | yyerrflag = 3; | |||
1054 | for (;;) | |||
1055 | { | |||
1056 | if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE256) >= 0 && | |||
1057 | yyn <= YYTABLESIZE357 && yycheck[yyn] == YYERRCODE256) | |||
1058 | { | |||
1059 | #if YYDEBUG0 | |||
1060 | if (yydebug) | |||
1061 | printf("%sdebug: state %d, error recovery shifting\ | |||
1062 | to state %d\n", YYPREFIX"yy", *yyssp, yytable[yyn]); | |||
1063 | #endif | |||
1064 | if (yyssp >= yysslim && yygrowstack()) | |||
1065 | { | |||
1066 | goto yyoverflow; | |||
1067 | } | |||
1068 | *++yyssp = yystate = yytable[yyn]; | |||
1069 | *++yyvsp = yylval; | |||
1070 | goto yyloop; | |||
1071 | } | |||
1072 | else | |||
1073 | { | |||
1074 | #if YYDEBUG0 | |||
1075 | if (yydebug) | |||
1076 | printf("%sdebug: error recovery discarding state %d\n", | |||
1077 | YYPREFIX"yy", *yyssp); | |||
1078 | #endif | |||
1079 | if (yyssp <= yyss) goto yyabort; | |||
1080 | --yyssp; | |||
1081 | --yyvsp; | |||
1082 | } | |||
1083 | } | |||
1084 | } | |||
1085 | else | |||
1086 | { | |||
1087 | if (yychar == 0) goto yyabort; | |||
1088 | #if YYDEBUG0 | |||
1089 | if (yydebug) | |||
1090 | { | |||
1091 | yys = 0; | |||
1092 | if (yychar <= YYMAXTOKEN269) yys = yyname[yychar]; | |||
1093 | if (!yys) yys = "illegal-symbol"; | |||
1094 | printf("%sdebug: state %d, error recovery discards token %d (%s)\n", | |||
1095 | YYPREFIX"yy", yystate, yychar, yys); | |||
1096 | } | |||
1097 | #endif | |||
1098 | yychar = (-1); | |||
1099 | goto yyloop; | |||
1100 | } | |||
1101 | yyreduce: | |||
1102 | #if YYDEBUG0 | |||
1103 | if (yydebug) | |||
1104 | printf("%sdebug: state %d, reducing by rule %d (%s)\n", | |||
1105 | YYPREFIX"yy", yystate, yyn, yyrule[yyn]); | |||
1106 | #endif | |||
1107 | yym = yylen[yyn]; | |||
1108 | if (yym) | |||
1109 | yyval = yyvsp[1-yym]; | |||
1110 | else | |||
1111 | memset(&yyval, 0, sizeof yyval); | |||
1112 | switch (yyn) | |||
1113 | { | |||
1114 | case 2: | |||
1115 | #line 109 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1116 | { dump_tables(); } | |||
1117 | break; | |||
1118 | case 5: | |||
1119 | #line 117 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1120 | { strncpy(new_locale.rl_encoding, yyvsp[0].str, sizeof(new_locale.rl_encoding)); } | |||
1121 | break; | |||
1122 | case 6: | |||
1123 | #line 119 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1124 | { new_locale.rl_variable_len = strlen(yyvsp[0].str) + 1; | |||
1125 | new_locale.rl_variable = strdup(yyvsp[0].str); | |||
1126 | } | |||
1127 | break; | |||
1128 | case 7: | |||
1129 | #line 123 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1130 | { charsetbits = yyvsp[0].rune; charsetmask = 0x0000007f; } | |||
1131 | break; | |||
1132 | case 8: | |||
1133 | #line 125 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1134 | { charsetbits = yyvsp[-1].rune; charsetmask = yyvsp[0].rune; } | |||
1135 | break; | |||
1136 | case 9: | |||
1137 | #line 127 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1138 | { int final = yyvsp[0].str[strlen(yyvsp[0].str) - 1] & 0x7f; | |||
1139 | charsetbits = final << 24; | |||
1140 | if (yyvsp[0].str[0] == '$') { | |||
1141 | charsetmask = 0x00007f7f; | |||
1142 | if (strchr(",-./", yyvsp[0].str[1])) | |||
1143 | charsetbits |= 0x80; | |||
1144 | if (0xd0 <= final && final <= 0xdf) | |||
1145 | charsetmask |= 0x007f0000; | |||
1146 | } else { | |||
1147 | charsetmask = 0x0000007f; | |||
1148 | if (strchr(",-./", yyvsp[0].str[0])) | |||
1149 | charsetbits |= 0x80; | |||
1150 | if (strlen(yyvsp[0].str) == 2 && yyvsp[0].str[0] == '!') | |||
1151 | charsetbits |= ((0x80 | yyvsp[0].str[0]) << 16); | |||
1152 | } | |||
1153 | ||||
1154 | /* | |||
1155 | * special rules | |||
1156 | */ | |||
1157 | if (charsetbits == ('B' << 24) | |||
1158 | && charsetmask == 0x0000007f) { | |||
1159 | /*ASCII: 94B*/ | |||
1160 | charsetbits = 0; | |||
1161 | charsetmask = 0x0000007f; | |||
1162 | } else if (charsetbits == (('A' << 24) | 0x80) | |||
1163 | && charsetmask == 0x0000007f) { | |||
1164 | /*Latin1: 96A*/ | |||
1165 | charsetbits = 0x80; | |||
1166 | charsetmask = 0x0000007f; | |||
1167 | } | |||
1168 | } | |||
1169 | break; | |||
1170 | case 10: | |||
1171 | #line 159 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1172 | { new_locale.rl_invalid_rune = yyvsp[0].rune; } | |||
1173 | break; | |||
1174 | case 11: | |||
1175 | #line 161 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1176 | { set_map(&types, yyvsp[0].list, yyvsp[-1].i); } | |||
1177 | break; | |||
1178 | case 12: | |||
1179 | #line 163 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1180 | { set_map(&maplower, yyvsp[0].list, 0); } | |||
1181 | break; | |||
1182 | case 13: | |||
1183 | #line 165 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1184 | { set_map(&mapupper, yyvsp[0].list, 0); } | |||
1185 | break; | |||
1186 | case 14: | |||
1187 | #line 167 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1188 | { } | |||
1189 | break; | |||
1190 | case 15: | |||
1191 | #line 171 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1192 | { | |||
1193 | yyval.list = xmalloc(sizeof(rune_list)); | |||
1194 | yyval.list->min = (yyvsp[0].rune & charsetmask) | charsetbits; | |||
1195 | yyval.list->max = (yyvsp[0].rune & charsetmask) | charsetbits; | |||
1196 | yyval.list->map = 0; | |||
1197 | yyval.list->next = 0; | |||
1198 | } | |||
1199 | break; | |||
1200 | case 16: | |||
1201 | #line 179 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1202 | { | |||
1203 | yyval.list = xmalloc(sizeof(rune_list)); | |||
1204 | yyval.list->min = (yyvsp[-2].rune & charsetmask) | charsetbits; | |||
1205 | yyval.list->max = (yyvsp[0].rune & charsetmask) | charsetbits; | |||
1206 | yyval.list->map = 0; | |||
1207 | yyval.list->next = 0; | |||
1208 | } | |||
1209 | break; | |||
1210 | case 17: | |||
1211 | #line 187 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1212 | { | |||
1213 | yyval.list = xmalloc(sizeof(rune_list)); | |||
1214 | yyval.list->min = (yyvsp[0].rune & charsetmask) | charsetbits; | |||
1215 | yyval.list->max = (yyvsp[0].rune & charsetmask) | charsetbits; | |||
1216 | yyval.list->map = 0; | |||
1217 | yyval.list->next = yyvsp[-1].list; | |||
1218 | } | |||
1219 | break; | |||
1220 | case 18: | |||
1221 | #line 195 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1222 | { | |||
1223 | yyval.list = xmalloc(sizeof(rune_list)); | |||
1224 | yyval.list->min = (yyvsp[-2].rune & charsetmask) | charsetbits; | |||
1225 | yyval.list->max = (yyvsp[0].rune & charsetmask) | charsetbits; | |||
1226 | yyval.list->map = 0; | |||
1227 | yyval.list->next = yyvsp[-3].list; | |||
1228 | } | |||
1229 | break; | |||
1230 | case 19: | |||
1231 | #line 205 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1232 | { | |||
1233 | yyval.list = xmalloc(sizeof(rune_list)); | |||
1234 | yyval.list->min = (yyvsp[-2].rune & charsetmask) | charsetbits; | |||
1235 | yyval.list->max = (yyvsp[-2].rune & charsetmask) | charsetbits; | |||
1236 | yyval.list->map = yyvsp[-1].rune; | |||
1237 | yyval.list->next = 0; | |||
1238 | } | |||
1239 | break; | |||
1240 | case 20: | |||
1241 | #line 213 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1242 | { | |||
1243 | yyval.list = xmalloc(sizeof(rune_list)); | |||
1244 | yyval.list->min = (yyvsp[-2].rune & charsetmask) | charsetbits; | |||
1245 | yyval.list->max = (yyvsp[-2].rune & charsetmask) | charsetbits; | |||
1246 | yyval.list->map = yyvsp[-1].rune; | |||
1247 | yyval.list->next = yyvsp[-4].list; | |||
1248 | } | |||
1249 | break; | |||
1250 | case 21: | |||
1251 | #line 221 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1252 | { | |||
1253 | yyval.list = xmalloc(sizeof(rune_list)); | |||
1254 | yyval.list->min = (yyvsp[-5].rune & charsetmask) | charsetbits; | |||
1255 | yyval.list->max = (yyvsp[-3].rune & charsetmask) | charsetbits; | |||
1256 | yyval.list->map = yyvsp[-1].rune; | |||
1257 | yyval.list->next = 0; | |||
1258 | } | |||
1259 | break; | |||
1260 | case 22: | |||
1261 | #line 229 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1262 | { | |||
1263 | yyval.list = xmalloc(sizeof(rune_list)); | |||
1264 | yyval.list->min = (yyvsp[-5].rune & charsetmask) | charsetbits; | |||
1265 | yyval.list->max = (yyvsp[-3].rune & charsetmask) | charsetbits; | |||
1266 | yyval.list->map = yyvsp[-1].rune; | |||
1267 | yyval.list->next = yyvsp[-7].list; | |||
1268 | } | |||
1269 | break; | |||
1270 | case 23: | |||
1271 | #line 238 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1272 | { } | |||
1273 | break; | |||
1274 | case 24: | |||
1275 | #line 239 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1276 | { } | |||
1277 | break; | |||
1278 | case 25: | |||
1279 | #line 240 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1280 | { } | |||
1281 | break; | |||
1282 | case 26: | |||
1283 | #line 241 "/usr/src/usr.bin/mklocale/yacc.y" | |||
1284 | { } | |||
1285 | break; | |||
1286 | #line 1279 "yacc.c" | |||
1287 | } | |||
1288 | yyssp -= yym; | |||
1289 | yystate = *yyssp; | |||
1290 | yyvsp -= yym; | |||
1291 | yym = yylhs[yyn]; | |||
1292 | if (yystate == 0 && yym == 0) | |||
1293 | { | |||
1294 | #if YYDEBUG0 | |||
1295 | if (yydebug) | |||
1296 | printf("%sdebug: after reduction, shifting from state 0 to\ | |||
1297 | state %d\n", YYPREFIX"yy", YYFINAL9); | |||
1298 | #endif | |||
1299 | yystate = YYFINAL9; | |||
1300 | *++yyssp = YYFINAL9; | |||
1301 | *++yyvsp = yyval; | |||
1302 | if (yychar < 0) | |||
1303 | { | |||
1304 | if ((yychar = yylex()) < 0) yychar = 0; | |||
1305 | #if YYDEBUG0 | |||
1306 | if (yydebug) | |||
1307 | { | |||
1308 | yys = 0; | |||
1309 | if (yychar <= YYMAXTOKEN269) yys = yyname[yychar]; | |||
1310 | if (!yys) yys = "illegal-symbol"; | |||
1311 | printf("%sdebug: state %d, reading %d (%s)\n", | |||
1312 | YYPREFIX"yy", YYFINAL9, yychar, yys); | |||
1313 | } | |||
1314 | #endif | |||
1315 | } | |||
1316 | if (yychar == 0) goto yyaccept; | |||
1317 | goto yyloop; | |||
1318 | } | |||
1319 | if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && | |||
1320 | yyn <= YYTABLESIZE357 && yycheck[yyn] == yystate) | |||
1321 | yystate = yytable[yyn]; | |||
1322 | else | |||
1323 | yystate = yydgoto[yym]; | |||
1324 | #if YYDEBUG0 | |||
1325 | if (yydebug) | |||
1326 | printf("%sdebug: after reduction, shifting from state %d \ | |||
1327 | to state %d\n", YYPREFIX"yy", *yyssp, yystate); | |||
1328 | #endif | |||
1329 | if (yyssp >= yysslim && yygrowstack()) | |||
1330 | { | |||
1331 | goto yyoverflow; | |||
1332 | } | |||
1333 | *++yyssp = yystate; | |||
1334 | *++yyvsp = yyval; | |||
1335 | goto yyloop; | |||
1336 | yyoverflow: | |||
1337 | yyerror("yacc stack overflow"); | |||
1338 | yyabort: | |||
1339 | if (yyss) | |||
1340 | free(yyss); | |||
1341 | if (yyvs) | |||
1342 | free(yyvs); | |||
1343 | yyss = yyssp = NULL((void *)0); | |||
1344 | yyvs = yyvsp = NULL((void *)0); | |||
1345 | yystacksize = 0; | |||
1346 | return (1); | |||
1347 | yyaccept: | |||
1348 | if (yyss) | |||
1349 | free(yyss); | |||
1350 | if (yyvs) | |||
1351 | free(yyvs); | |||
1352 | yyss = yyssp = NULL((void *)0); | |||
1353 | yyvs = yyvsp = NULL((void *)0); | |||
1354 | yystacksize = 0; | |||
1355 | return (0); | |||
1356 | } |