diff options
| -rw-r--r-- | ChangeLog | 33 | ||||
| -rw-r--r-- | locale/programs/ld-address.c | 77 | ||||
| -rw-r--r-- | locale/programs/ld-collate.c | 122 | ||||
| -rw-r--r-- | locale/programs/ld-ctype.c | 126 | ||||
| -rw-r--r-- | locale/programs/ld-identification.c | 106 | ||||
| -rw-r--r-- | locale/programs/ld-measurement.c | 57 | ||||
| -rw-r--r-- | locale/programs/ld-messages.c | 57 | ||||
| -rw-r--r-- | locale/programs/ld-monetary.c | 93 | ||||
| -rw-r--r-- | locale/programs/ld-name.c | 55 | ||||
| -rw-r--r-- | locale/programs/ld-numeric.c | 66 | ||||
| -rw-r--r-- | locale/programs/ld-paper.c | 58 | ||||
| -rw-r--r-- | locale/programs/ld-telephone.c | 60 | ||||
| -rw-r--r-- | locale/programs/ld-time.c | 99 | ||||
| -rw-r--r-- | locale/programs/localedef.c | 27 | ||||
| -rw-r--r-- | locale/programs/localedef.h | 9 | ||||
| -rw-r--r-- | locale/programs/locales.h | 229 | ||||
| -rw-r--r-- | locale/programs/locfile.c | 19 | ||||
| -rw-r--r-- | locale/programs/locfile.h | 31 |
18 files changed, 982 insertions, 342 deletions
@@ -1,3 +1,36 @@ +1999-09-12 Ulrich Drepper <drepper@cygnus.com> + + * locale/programs/ld-address.c: Fix handling of non-existing + definitions for this category. Correctly ignore content of this + category is this is necessary. + * locale/programs/ld-collate.c: Likewise. + * locale/programs/ld-ctype.c: Likewise. + * locale/programs/ld-identification.c: Likewise. + * locale/programs/ld-measurement.c: Likewise. + * locale/programs/ld-messages.c: Likewise. + * locale/programs/ld-monetary.c: Likewise. + * locale/programs/ld-name.c: Likewise. + * locale/programs/ld-numeric.c: Likewise. + * locale/programs/ld-paper.c: Likewise. + * locale/programs/ld-telephone.c: Likewise. + * locale/programs/ld-time.c: Likewise. + * locale/programs/locfile.h (handle_copy): Take extra parameter + with result pointer. Fill in name of locale from which to copy. + Correctly read token after `END'. + + * locale/programs/localedef.c (main): Correct handling copy. + (add_to_readlist): Take extra parameter which says whether we + are supposed to read the file or not. + (find_locale): Call add_to_readlist with extra parameter set to 0. + + * locale/programs/localedef.h (struct localedef_t): Use __LC_LAST + instead of wrong number in array definitions. + (add_to_readlist): Update prototype. + + * locale/programs/locfile.c (locfile_read): Mark categories not + available in source file as read. + (write_all_categories): Fix typo. + 1999-09-10 Ulrich Drepper <drepper@cygnus.com> * elf/elf.h (SHF_MASKOS): Added. diff --git a/locale/programs/ld-address.c b/locale/programs/ld-address.c index 805330cfaf..49900bd471 100644 --- a/locale/programs/ld-address.c +++ b/locale/programs/ld-address.c @@ -87,8 +87,11 @@ address_startup (struct linereader *lr, struct localedef_t *locale, (struct locale_address_t *) xcalloc (1, sizeof (struct locale_address_t)); - lr->translate_strings = 1; - lr->return_widestr = 0; + if (lr != NULL) + { + lr->translate_strings = 1; + lr->return_widestr = 0; + } } @@ -98,11 +101,45 @@ address_finish (struct localedef_t *locale, struct charmap_t *charmap) struct locale_address_t *address = locale->categories[LC_ADDRESS].address; size_t cnt; int helper; + int nothing = 0; + + /* Now resolve copying and also handle completely missing definitions. */ + if (address == NULL) + { + /* First see whether we were supposed to copy. If yes, find the + actual definition. */ + if (locale->copy_name[LC_ADDRESS] != NULL) + { + /* Find the copying locale. This has to happen transitively since + the locale we are copying from might also copying another one. */ + struct localedef_t *from = locale; + + do + from = find_locale (LC_ADDRESS, from->copy_name[LC_ADDRESS], + from->repertoire_name, charmap); + while (from->categories[LC_ADDRESS].address == NULL + && from->copy_name[LC_ADDRESS] != NULL); + + address = locale->categories[LC_ADDRESS].address + = from->categories[LC_ADDRESS].address; + } + + /* If there is still no definition issue an warning and create an + empty one. */ + if (address == NULL) + { + error (0, 0, _("No definition for %s category found"), "LC_ADDRESS"); + address_startup (NULL, locale, 0); + address = locale->categories[LC_ADDRESS].address; + nothing = 1; + } + } if (address->postal_fmt == NULL) { - error (0, 0, _("%s: field `%s' not defined"), - "LC_ADDRESS", "postal_fmt"); + if (! nothing) + error (0, 0, _("%s: field `%s' not defined"), + "LC_ADDRESS", "postal_fmt"); /* Use as the default value the value of the i18n locale. */ address->postal_fmt = "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N"; } @@ -138,7 +175,7 @@ address_finish (struct localedef_t *locale, struct charmap_t *charmap) #define TEST_ELEM(cat) \ if (address->cat == NULL) \ { \ - if (verbose) \ + if (verbose && ! nothing) \ error (0, 0, _("%s: field `%s' not defined"), "LC_ADDRESS", #cat); \ address->cat = ""; \ } @@ -155,7 +192,7 @@ address_finish (struct localedef_t *locale, struct charmap_t *charmap) helper = 1; if (address->lang_term == NULL) { - if (verbose) + if (verbose && ! nothing) error (0, 0, _("%s: field `%s' not defined"), "LC_ADDRESS", "lang_term"); address->lang_term = ""; @@ -182,7 +219,7 @@ address_finish (struct localedef_t *locale, struct charmap_t *charmap) if (address->lang_ab == NULL) { - if (verbose) + if (verbose && ! nothing) error (0, 0, _("%s: field `%s' not defined"), "LC_ADDRESS", "lang_ab"); address->lang_ab = ""; } @@ -242,7 +279,7 @@ address_finish (struct localedef_t *locale, struct charmap_t *charmap) if (address->country_num == 0) { - if (verbose) + if (verbose && ! nothing) error (0, 0, _("%s: field `%s' not defined"), "LC_ADDRESS", "country_num"); cnt = sizeof (iso3166) / sizeof (iso3166[0]); @@ -262,7 +299,7 @@ address_finish (struct localedef_t *locale, struct charmap_t *charmap) if (address->country_ab2 == NULL) { - if (verbose) + if (verbose && ! nothing) error (0, 0, _("%s: field `%s' not defined"), "LC_ADDRESS", "country_ab2"); address->country_ab2 = " "; @@ -274,7 +311,7 @@ address_finish (struct localedef_t *locale, struct charmap_t *charmap) if (address->country_ab3 == NULL) { - if (verbose) + if (verbose && ! nothing) error (0, 0, _("%s: field `%s' not defined"), "LC_ADDRESS", "country_ab3"); address->country_ab3 = " "; @@ -416,8 +453,8 @@ address_read (struct linereader *ldfile, struct localedef_t *result, /* If we see `copy' now we are almost done. */ if (nowtok == tok_copy) { - handle_copy (ldfile, charmap, repertoire, tok_lc_address, LC_ADDRESS, - "LC_ADDRESS", ignore_content); + handle_copy (ldfile, charmap, repertoire, result, tok_lc_address, + LC_ADDRESS, "LC_ADDRESS", ignore_content); return; } @@ -443,6 +480,14 @@ address_read (struct linereader *ldfile, struct localedef_t *result, { #define STR_ELEM(cat) \ case tok_##cat: \ + /* Ignore the rest of the line if we don't need the input of \ + this line. */ \ + if (ignore_content) \ + { \ + lr_ignore_rest (ldfile, 0); \ + break; \ + } \ + \ arg = lr_token (ldfile, charmap, NULL); \ if (arg->tok != tok_string) \ goto err_label; \ @@ -473,6 +518,14 @@ address_read (struct linereader *ldfile, struct localedef_t *result, #define INT_ELEM(cat) \ case tok_##cat: \ + /* Ignore the rest of the line if we don't need the input of \ + this line. */ \ + if (ignore_content) \ + { \ + lr_ignore_rest (ldfile, 0); \ + break; \ + } \ + \ arg = lr_token (ldfile, charmap, NULL); \ if (arg->tok != tok_number) \ goto err_label; \ diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c index 3c1267420c..20a8776f93 100644 --- a/locale/programs/ld-collate.c +++ b/locale/programs/ld-collate.c @@ -601,6 +601,14 @@ collate_read (struct linereader *ldfile, struct localedef_t *result, switch (nowtok) { case tok_coll_weight_max: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + if (state != 0) goto err_label; @@ -616,6 +624,14 @@ collate_read (struct linereader *ldfile, struct localedef_t *result, break; case tok_section_symbol: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + if (state != 0) goto err_label; @@ -652,6 +668,14 @@ collate_read (struct linereader *ldfile, struct localedef_t *result, break; case tok_collating_element: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + if (state != 0) goto err_label; @@ -732,6 +756,14 @@ error while adding collating element")); break; case tok_collating_symbol: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + if (state != 0) goto err_label; @@ -774,6 +806,14 @@ error while adding collating symbol")); break; case tok_symbol_equivalence: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + if (state != 0) goto err_label; @@ -853,6 +893,14 @@ error while adding equivalent collating symbol")); break; case tok_order_start: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + if (state != 0 && state != 1) goto err_label; state = 1; @@ -933,6 +981,14 @@ error while adding equivalent collating symbol")); break; case tok_order_end: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + if (state != 1) goto err_label; state = 2; @@ -940,6 +996,14 @@ error while adding equivalent collating symbol")); break; case tok_reorder_after: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + if (state != 2 && state != 3) goto err_label; state = 3; @@ -947,6 +1011,11 @@ error while adding equivalent collating symbol")); break; case tok_reorder_end: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + break; + if (state != 3) goto err_label; state = 4; @@ -954,6 +1023,14 @@ error while adding equivalent collating symbol")); break; case tok_bsymbol: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + if (state != 1 && state != 3) goto err_label; @@ -996,12 +1073,28 @@ error while adding equivalent collating symbol")); break; case tok_undefined: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + if (state != 1) goto err_label; /* XXX handle UNDEFINED weight */ break; case tok_ellipsis3: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + if (state != 1 && state != 3) goto err_label; @@ -1012,16 +1105,21 @@ error while adding equivalent collating symbol")); case tok_end: /* Next we assume `LC_COLLATE'. */ - if (state == 0) - /* We must either see a copy statement or have ordering values. */ - lr_error (ldfile, _("%s: empty category description not allowed"), - "LC_COLLATE"); - else if (state == 1) - lr_error (ldfile, _("%s: missing `order_end' keyword"), - "LC_COLLATE"); - else if (state == 3) - error (0, 0, _("%s: missing `reorder-end' keyword"), - "LC_COLLATE"); + if (!ignore_content) + { + if (state == 0) + /* We must either see a copy statement or have + ordering values. */ + lr_error (ldfile, + _("%s: empty category description not allowed"), + "LC_COLLATE"); + else if (state == 1) + lr_error (ldfile, _("%s: missing `order_end' keyword"), + "LC_COLLATE"); + else if (state == 3) + error (0, 0, _("%s: missing `reorder-end' keyword"), + "LC_COLLATE"); + } arg = lr_token (ldfile, charmap, NULL); if (arg->tok == tok_eof) break; @@ -3007,8 +3105,8 @@ read_lc_collate (struct linereader *ldfile, struct localedef_t *result, /* If we see `copy' now we are almost done. */ if (nowtok == tok_copy) { - handle_copy (ldfile, charmap, tok_lc_collate, LC_COLLATE, "LC_COLLATE", - ignore_content); + handle_copy (ldfile, charmap, repertoire, result, tok_lc_collate, + LC_COLLATE, "LC_COLLATE", ignore_content); did_copy = 1; } diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index 6743c1837c..6dea9d0dd8 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -322,6 +322,37 @@ ctype_finish (struct localedef_t *locale, struct charmap_t *charmap) struct locale_ctype_t *ctype = locale->categories[LC_CTYPE].ctype; int warned; + /* Now resolve copying and also handle completely missing definitions. */ + if (ctype == NULL) + { + /* First see whether we were supposed to copy. If yes, find the + actual definition. */ + if (locale->copy_name[LC_CTYPE] != NULL) + { + /* Find the copying locale. This has to happen transitively since + the locale we are copying from might also copying another one. */ + struct localedef_t *from = locale; + + do + from = find_locale (LC_CTYPE, from->copy_name[LC_CTYPE], + from->repertoire_name, charmap); + while (from->categories[LC_CTYPE].ctype == NULL + && from->copy_name[LC_CTYPE] != NULL); + + ctype = locale->categories[LC_CTYPE].ctype + = from->categories[LC_CTYPE].ctype; + } + + /* If there is still no definition issue an warning and create an + empty one. */ + if (ctype == NULL) + { + error (0, 0, _("No definition for %s category found"), "LC_CTYPE"); + ctype_startup (NULL, locale, charmap, 0); + ctype = locale->categories[LC_CTYPE].ctype; + } + } + /* Set default value for classes not specified. */ set_class_defaults (ctype, charmap, ctype->repertoire); @@ -1732,7 +1763,7 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result, /* If we see `copy' now we are almost done. */ if (nowtok == tok_copy) { - handle_copy (ldfile, charmap, repertoire, tok_lc_ctype, LC_CTYPE, + handle_copy (ldfile, charmap, repertoire, result, tok_lc_ctype, LC_CTYPE, "LC_CTYPE", ignore_content); return; } @@ -1766,6 +1797,14 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result, switch (nowtok) { case tok_class: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + /* We simply forget the `class' keyword and use the following operand to determine the bit. */ now = lr_token (ldfile, charmap, NULL); @@ -1829,6 +1868,14 @@ unknown character class `%s' in category `LC_CTYPE'"), case tok_print: case tok_xdigit: case tok_blank: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + class_bit = BITw (now->tok); class256_bit = BIT (now->tok); handle_digits = 0; @@ -1871,11 +1918,11 @@ unknown character class `%s' in category `LC_CTYPE'"), /* We must store the digit values. */ if (ctype->mbdigits_act == ctype->mbdigits_max) { - ctype->mbdigits_max *= 2; + ctype->mbdigits_max += 10; ctype->mbdigits = xrealloc (ctype->mbdigits, (ctype->mbdigits_max * sizeof (char *))); - ctype->wcdigits_max *= 2; + ctype->wcdigits_max += 10; ctype->wcdigits = xrealloc (ctype->wcdigits, (ctype->wcdigits_max * sizeof (uint32_t))); @@ -1987,6 +2034,11 @@ with character code range values one must use the absolute ellipsis `...'")); break; case tok_digit: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + break; + handle_tok_digit: class_bit = _ISwdigit; class256_bit = _ISdigit; @@ -1994,6 +2046,14 @@ with character code range values one must use the absolute ellipsis `...'")); goto read_charclass; case tok_outdigit: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + if (ctype->outdigits_act != 0) lr_error (ldfile, _("\ %s: field `%s' declared more than once"), @@ -2004,14 +2064,38 @@ with character code range values one must use the absolute ellipsis `...'")); goto read_charclass; case tok_toupper: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + mapidx = 0; goto read_mapping; case tok_tolower: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + mapidx = 1; goto read_mapping; case tok_map: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + /* We simply forget the `map' keyword and use the following operand to determine the mapping. */ now = lr_token (ldfile, charmap, NULL); @@ -2113,6 +2197,14 @@ with character code range values one must use the absolute ellipsis `...'")); break; case tok_translit_start: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + /* The rest of the line better should be empty. */ lr_ignore_rest (ldfile, 1); @@ -2186,6 +2278,14 @@ with character code range values one must use the absolute ellipsis `...'")); break; case tok_ident: + /* Ignore the rest of the line if we don't need the input of + this line. */ + if (ignore_content) + { + lr_ignore_rest (ldfile, 0); + break; + } + /* This could mean one of several things. First test whether it's a character class name. */ for (cnt = 0; cnt < ctype->nr_charclass; ++cnt) @@ -2787,6 +2887,26 @@ no output digits defined and none of the standard names in the charmap")); ctype->mboutdigits[cnt]->nbytes = 1; } } + + ctype->wcoutdigits[cnt] = repertoire_find_value (repertoire, + digits + cnt, 1); + + if (ctype->w |
