2 locale/programs/ld-collate.c | 265 -------------------------------------------
3 1 file changed, 265 deletions(-)
5 --- a/locale/programs/ld-collate.c
6 +++ b/locale/programs/ld-collate.c
11 -/* Simple name list for the preprocessor. */
14 - struct name_list *next;
19 /* The real definition of the struct for the LC_COLLATE locale. */
20 struct locale_collate_t
23 /* The arrays with the collation sequence order. */
24 unsigned char mbseqorder[256];
25 struct collseq_table wcseqorder;
27 - /* State of the preprocessor. */
39 LC_COLLATE category descriptions in all files. */
40 static uint32_t nrules;
42 -/* List of defined preprocessor symbols. */
43 -static struct name_list *defined;
46 /* We need UTF-8 encoding of numbers. */
48 @@ -2511,46 +2491,6 @@
53 -skip_to (struct linereader *ldfile, struct locale_collate_t *collate,
54 - const struct charmap_t *charmap, int to_endif)
58 - struct token *now = lr_token (ldfile, charmap, NULL, NULL, 0);
59 - enum token_t nowtok = now->tok;
61 - if (nowtok == tok_eof || nowtok == tok_end)
64 - if (nowtok == tok_ifdef || nowtok == tok_ifndef)
66 - lr_error (ldfile, _("%s: nested conditionals not supported"),
68 - nowtok = skip_to (ldfile, collate, charmap, tok_endif);
69 - if (nowtok == tok_eof || nowtok == tok_end)
72 - else if (nowtok == tok_endif || (!to_endif && nowtok == tok_else))
74 - lr_ignore_rest (ldfile, 1);
77 - else if (!to_endif && (nowtok == tok_elifdef || nowtok == tok_elifndef))
79 - /* Do not read the rest of the line. */
82 - else if (nowtok == tok_else)
84 - lr_error (ldfile, _("%s: more then one 'else'"), "LC_COLLATE");
87 - lr_ignore_rest (ldfile, 0);
93 collate_read (struct linereader *ldfile, struct localedef_t *result,
94 const struct charmap_t *charmap, const char *repertoire_name,
96 /* The rest of the line containing `LC_COLLATE' must be free. */
97 lr_ignore_rest (ldfile, 1);
103 now = lr_token (ldfile, charmap, result, NULL, verbose);
104 @@ -2590,31 +2528,6 @@
106 while (nowtok == tok_eol);
108 - if (nowtok != tok_define)
111 - if (ignore_content)
112 - lr_ignore_rest (ldfile, 0);
115 - arg = lr_token (ldfile, charmap, result, NULL, verbose);
116 - if (arg->tok != tok_ident)
117 - SYNTAX_ERROR (_("%s: syntax error"), "LC_COLLATE");
120 - /* Simply add the new symbol. */
121 - struct name_list *newsym = xmalloc (sizeof (*newsym)
122 - + arg->val.str.lenmb + 1);
123 - memcpy (newsym->str, arg->val.str.startmb, arg->val.str.lenmb);
124 - newsym->str[arg->val.str.lenmb] = '\0';
125 - newsym->next = defined;
128 - lr_ignore_rest (ldfile, 1);
133 if (nowtok == tok_copy)
135 now = lr_token (ldfile, charmap, result, NULL, verbose);
136 @@ -3770,7 +3683,6 @@
141 /* Next we assume `LC_COLLATE'. */
144 @@ -3811,182 +3723,6 @@
145 lr_ignore_rest (ldfile, arg->tok == tok_lc_collate);
149 - if (ignore_content)
151 - lr_ignore_rest (ldfile, 0);
155 - arg = lr_token (ldfile, charmap, result, NULL, verbose);
156 - if (arg->tok != tok_ident)
159 - /* Simply add the new symbol. */
160 - struct name_list *newsym = xmalloc (sizeof (*newsym)
161 - + arg->val.str.lenmb + 1);
162 - memcpy (newsym->str, arg->val.str.startmb, arg->val.str.lenmb);
163 - newsym->str[arg->val.str.lenmb] = '\0';
164 - newsym->next = defined;
167 - lr_ignore_rest (ldfile, 1);
171 - if (ignore_content)
173 - lr_ignore_rest (ldfile, 0);
177 - arg = lr_token (ldfile, charmap, result, NULL, verbose);
178 - if (arg->tok != tok_ident)
181 - /* Remove _all_ occurrences of the symbol from the list. */
182 - struct name_list *prevdef = NULL;
183 - struct name_list *curdef = defined;
184 - while (curdef != NULL)
185 - if (strncmp (arg->val.str.startmb, curdef->str,
186 - arg->val.str.lenmb) == 0
187 - && curdef->str[arg->val.str.lenmb] == '\0')
189 - if (prevdef == NULL)
190 - defined = curdef->next;
192 - prevdef->next = curdef->next;
194 - struct name_list *olddef = curdef;
195 - curdef = curdef->next;
202 - curdef = curdef->next;
205 - lr_ignore_rest (ldfile, 1);
210 - if (ignore_content)
212 - lr_ignore_rest (ldfile, 0);
217 - arg = lr_token (ldfile, charmap, result, NULL, verbose);
218 - if (arg->tok != tok_ident)
220 - lr_ignore_rest (ldfile, 1);
222 - if (collate->else_action == else_none)
225 - while (curdef != NULL)
226 - if (strncmp (arg->val.str.startmb, curdef->str,
227 - arg->val.str.lenmb) == 0
228 - && curdef->str[arg->val.str.lenmb] == '\0')
231 - curdef = curdef->next;
233 - if ((nowtok == tok_ifdef && curdef != NULL)
234 - || (nowtok == tok_ifndef && curdef == NULL))
236 - /* We have to use the if-branch. */
237 - collate->else_action = else_ignore;
241 - /* We have to use the else-branch, if there is one. */
242 - nowtok = skip_to (ldfile, collate, charmap, 0);
243 - if (nowtok == tok_else)
244 - collate->else_action = else_seen;
245 - else if (nowtok == tok_elifdef)
247 - nowtok = tok_ifdef;
250 - else if (nowtok == tok_elifndef)
252 - nowtok = tok_ifndef;
255 - else if (nowtok == tok_eof)
257 - else if (nowtok == tok_end)
263 - /* XXX Should it really become necessary to support nested
264 - preprocessor handling we will push the state here. */
265 - lr_error (ldfile, _("%s: nested conditionals not supported"),
267 - nowtok = skip_to (ldfile, collate, charmap, 1);
268 - if (nowtok == tok_eof)
270 - else if (nowtok == tok_end)
278 - if (ignore_content)
280 - lr_ignore_rest (ldfile, 0);
284 - lr_ignore_rest (ldfile, 1);
286 - if (collate->else_action == else_ignore)
288 - /* Ignore everything until the endif. */
289 - nowtok = skip_to (ldfile, collate, charmap, 1);
290 - if (nowtok == tok_eof)
292 - else if (nowtok == tok_end)
297 - assert (collate->else_action == else_none);
298 - lr_error (ldfile, _("\
299 -%s: '%s' without matching 'ifdef' or 'ifndef'"), "LC_COLLATE",
300 - nowtok == tok_else ? "else"
301 - : nowtok == tok_elifdef ? "elifdef" : "elifndef");
306 - if (ignore_content)
308 - lr_ignore_rest (ldfile, 0);
312 - lr_ignore_rest (ldfile, 1);
314 - if (collate->else_action != else_ignore
315 - && collate->else_action != else_seen)
316 - lr_error (ldfile, _("\
317 -%s: 'endif' without matching 'ifdef' or 'ifndef'"), "LC_COLLATE");
319 - /* XXX If we support nested preprocessor directives we pop
321 - collate->else_action = else_none;
326 SYNTAX_ERROR (_("%s: syntax error"), "LC_COLLATE");
327 @@ -3997,7 +3733,6 @@
332 /* When we come here we reached the end of the file. */
333 lr_error (ldfile, _("%s: premature end of file"), "LC_COLLATE");