diff options
Diffstat (limited to 'locale/programs/ld-ctype.c')
-rw-r--r-- | locale/programs/ld-ctype.c | 264 |
1 files changed, 118 insertions, 146 deletions
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index 0fd141ca7e..f791e6b7e9 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2016 Free Software Foundation, Inc. +/* Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.org>, 1995. @@ -427,9 +427,8 @@ ctype_finish (struct localedef_t *locale, const struct charmap_t *charmap) empty one. */ if (ctype == NULL) { - if (! be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ -No definition for %s category found"), "LC_CTYPE")); + record_warning (_("\ +No definition for %s category found"), "LC_CTYPE"); ctype_startup (NULL, locale, charmap, NULL, 0); ctype = locale->categories[LC_CTYPE].ctype; } @@ -446,9 +445,8 @@ No definition for %s category found"), "LC_CTYPE")); ctype->codeset_name = charmap->code_set_name; if (ctype->codeset_name == NULL) { - if (! be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ -No character set name specified in charmap"))); + record_error (0, 0, _("\ +No character set name specified in charmap")); ctype->codeset_name = "//UNKNOWN//"; } @@ -475,13 +473,12 @@ No character set name specified in charmap"))); { uint32_t value = ctype->charnames[cnt]; - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ character L'\\u%0*x' in class `%s' must be in class `%s'"), - value > 0xffff ? 8 : 4, - value, - valid_table[cls1].name, - valid_table[cls2].name)); + value > 0xffff ? 8 : 4, + value, + valid_table[cls1].name, + valid_table[cls2].name); } break; @@ -490,13 +487,12 @@ character L'\\u%0*x' in class `%s' must be in class `%s'"), { uint32_t value = ctype->charnames[cnt]; - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ character L'\\u%0*x' in class `%s' must not be in class `%s'"), - value > 0xffff ? 8 : 4, - value, - valid_table[cls1].name, - valid_table[cls2].name)); + value > 0xffff ? 8 : 4, + value, + valid_table[cls1].name, + valid_table[cls2].name); } break; @@ -505,8 +501,8 @@ character L'\\u%0*x' in class `%s' must not be in class `%s'"), break; default: - WITH_CUR_LOCALE (error (5, 0, _("\ -internal error in %s, line %u"), __FUNCTION__, __LINE__)); + record_error (5, 0, _("\ +internal error in %s, line %u"), __FUNCTION__, __LINE__); } } } @@ -533,12 +529,11 @@ internal error in %s, line %u"), __FUNCTION__, __LINE__)); snprintf (buf, sizeof buf, "\\%Zo", cnt); - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ character '%s' in class `%s' must be in class `%s'"), - buf, - valid_table[cls1].name, - valid_table[cls2].name)); + buf, + valid_table[cls1].name, + valid_table[cls2].name); } break; @@ -549,12 +544,11 @@ character '%s' in class `%s' must be in class `%s'"), snprintf (buf, sizeof buf, "\\%Zo", cnt); - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ character '%s' in class `%s' must not be in class `%s'"), - buf, - valid_table[cls1].name, - valid_table[cls2].name)); + buf, + valid_table[cls1].name, + valid_table[cls2].name); } break; @@ -563,8 +557,8 @@ character '%s' in class `%s' must not be in class `%s'"), break; default: - WITH_CUR_LOCALE (error (5, 0, _("\ -internal error in %s, line %u"), __FUNCTION__, __LINE__)); + record_error (5, 0, _("\ +internal error in %s, line %u"), __FUNCTION__, __LINE__); } } } @@ -579,9 +573,8 @@ internal error in %s, line %u"), __FUNCTION__, __LINE__)); (ELEM (ctype, class_collection, , space_value) & BITw (tok_blank)) == 0))) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("<SP> character not in class `%s'"), - valid_table[cnt].name)); + record_error (0, 0, _("<SP> character not in class `%s'"), + valid_table[cnt].name); } else if (((cnt = BITPOS (tok_punct), (ELEM (ctype, class_collection, , space_value) @@ -591,10 +584,9 @@ internal error in %s, line %u"), __FUNCTION__, __LINE__)); & BITw (tok_graph)) != 0))) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ <SP> character must not be in class `%s'"), - valid_table[cnt].name)); + valid_table[cnt].name); } else ELEM (ctype, class_collection, , space_value) |= BITw (tok_print); @@ -606,9 +598,8 @@ internal error in %s, line %u"), __FUNCTION__, __LINE__)); space_seq = charmap_find_value (charmap, "U00000020", 9); if (space_seq == NULL || space_seq->nbytes != 1) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ -character <SP> not defined in character map"))); + record_error (0, 0, _("\ +character <SP> not defined in character map")); } else if (((cnt = BITPOS (tok_space), (ctype->class256_collection[space_seq->bytes[0]] @@ -617,9 +608,8 @@ character <SP> not defined in character map"))); (ctype->class256_collection[space_seq->bytes[0]] & BIT (tok_blank)) == 0))) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("<SP> character not in class `%s'"), - valid_table[cnt].name)); + record_error (0, 0, _("<SP> character not in class `%s'"), + valid_table[cnt].name); } else if (((cnt = BITPOS (tok_punct), (ctype->class256_collection[space_seq->bytes[0]] @@ -628,10 +618,9 @@ character <SP> not defined in character map"))); (ctype->class256_collection[space_seq->bytes[0]] & BIT (tok_graph)) != 0))) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ <SP> character must not be in class `%s'"), - valid_table[cnt].name)); + valid_table[cnt].name); } else ctype->class256_collection[space_seq->bytes[0]] |= BIT (tok_print); @@ -743,8 +732,8 @@ character <SP> not defined in character map"))); assert (ctype->mbdigits_act == ctype->wcdigits_act); ctype->wcdigits_act -= ctype->mbdigits_act % 10; ctype->mbdigits_act -= ctype->mbdigits_act % 10; - WITH_CUR_LOCALE (error (0, 0, _("\ -`digit' category has not entries in groups of ten"))); + record_error (0, 0, _("\ +`digit' category has not entries in groups of ten")); } /* Check the input digits. There must be a multiple of ten available. @@ -792,8 +781,8 @@ character <SP> not defined in character map"))); if (ctype->mbdigits[cnt] == NULL) { /* Hum, this ain't good. */ - WITH_CUR_LOCALE (error (0, 0, _("\ -no input digits defined and none of the standard names in the charmap"))); + record_error (0, 0, _("\ +no input digits defined and none of the standard names in the charmap")); ctype->mbdigits[cnt] = obstack_alloc (&((struct charmap_t *) charmap)->mem_pool, sizeof (struct charseq) + 1); @@ -857,8 +846,8 @@ no input digits defined and none of the standard names in the charmap"))); if (!warned) { - WITH_CUR_LOCALE (error (0, 0, _("\ -not all characters used in `outdigit' are available in the charmap"))); + record_error (0, 0, _("\ +not all characters used in `outdigit' are available in the charmap")); warned = 1; } @@ -874,8 +863,8 @@ not all characters used in `outdigit' are available in the charmap"))); { if (!warned) { - WITH_CUR_LOCALE (error (0, 0, _("\ -not all characters used in `outdigit' are available in the repertoire"))); + record_error (0, 0, _("\ +not all characters used in `outdigit' are available in the repertoire")); warned = 1; } @@ -1145,9 +1134,9 @@ ctype_class_new (struct linereader *lr, struct locale_ctype_t *ctype, if (ctype->nr_charclass == MAX_NR_CHARCLASS) /* Exit code 2 is prescribed in P1003.2b. */ - WITH_CUR_LOCALE (error (2, 0, _("\ + record_error (2, 0, _("\ implementation limit: no more than %Zd character classes allowed"), - MAX_NR_CHARCLASS)); + MAX_NR_CHARCLASS); ctype->classnames[ctype->nr_charclass++] = name; } @@ -1177,9 +1166,9 @@ ctype_map_new (struct linereader *lr, struct locale_ctype_t *ctype, if (ctype->map_collection_nr == MAX_NR_CHARMAP) /* Exit code 2 is prescribed in P1003.2b. */ - WITH_CUR_LOCALE (error (2, 0, _("\ + record_error (2, 0, _("\ implementation limit: no more than %d character maps allowed"), - MAX_NR_CHARMAP)); + MAX_NR_CHARMAP); ctype->mapnames[cnt] = name; @@ -2743,11 +2732,11 @@ with character code range values one must use the absolute ellipsis `...'")); { lr_error (ldfile, _("\ %s: duplicate `default_missing' definition"), "LC_CTYPE"); - WITH_CUR_LOCALE (error_at_line (0, 0, - ctype->default_missing_file, - ctype->default_missing_lineno, - _("\ -previous definition was here"))); + record_error_at_line (0, 0, + ctype->default_missing_file, + ctype->default_missing_lineno, + _("\ +previous definition was here")); } else { @@ -2885,15 +2874,14 @@ set_one_default (struct locale_ctype_t *ctype, } if (seq == NULL) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' not defined while needed as default value"), - "LC_CTYPE", tmp)); + "LC_CTYPE", tmp); } else if (seq->nbytes != 1) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' in charmap not representable with one byte"), - "LC_CTYPE", tmp)); + "LC_CTYPE", tmp); else ctype->class256_collection[seq->bytes[0]] |= bit; @@ -2982,15 +2970,14 @@ set_class_defaults (struct locale_ctype_t *ctype, seq = charmap_find_value (charmap, "U00000020", 9); if (seq == NULL) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' not defined while needed as default value"), - "LC_CTYPE", "<space>")); + "LC_CTYPE", "<space>"); } else if (seq->nbytes != 1) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' in charmap not representable with one byte"), - "LC_CTYPE", "<space>")); + "LC_CTYPE", "<space>"); else ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space); @@ -3002,15 +2989,14 @@ set_class_defaults (struct locale_ctype_t *ctype, seq = charmap_find_value (charmap, "U0000000C", 9); if (seq == NULL) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' not defined while needed as default value"), - "LC_CTYPE", "<form-feed>")); + "LC_CTYPE", "<form-feed>"); } else if (seq->nbytes != 1) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' in charmap not representable with one byte"), - "LC_CTYPE", "<form-feed>")); + "LC_CTYPE", "<form-feed>"); else ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space); @@ -3023,15 +3009,14 @@ set_class_defaults (struct locale_ctype_t *ctype, seq = charmap_find_value (charmap, "U0000000A", 9); if (seq == NULL) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' not defined while needed as default value"), - "LC_CTYPE", "<newline>")); + "LC_CTYPE", "<newline>"); } else if (seq->nbytes != 1) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' in charmap not representable with one byte"), - "LC_CTYPE", "<newline>")); + "LC_CTYPE", "<newline>"); else ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space); @@ -3044,15 +3029,14 @@ set_class_defaults (struct locale_ctype_t *ctype, seq = charmap_find_value (charmap, "U0000000D", 9); if (seq == NULL) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' not defined while needed as default value"), - "LC_CTYPE", "<carriage-return>")); + "LC_CTYPE", "<carriage-return>"); } else if (seq->nbytes != 1) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' in charmap not representable with one byte"), - "LC_CTYPE", "<carriage-return>")); + "LC_CTYPE", "<carriage-return>"); else ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space); @@ -3065,15 +3049,14 @@ set_class_defaults (struct locale_ctype_t *ctype, seq = charmap_find_value (charmap, "U00000009", 9); if (seq == NULL) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' not defined while needed as default value"), - "LC_CTYPE", "<tab>")); + "LC_CTYPE", "<tab>"); } else if (seq->nbytes != 1) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' in charmap not representable with one byte"), - "LC_CTYPE", "<tab>")); + "LC_CTYPE", "<tab>"); else ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space); @@ -3086,15 +3069,14 @@ set_class_defaults (struct locale_ctype_t *ctype, seq = charmap_find_value (charmap, "U0000000B", 9); if (seq == NULL) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' not defined while needed as default value"), - "LC_CTYPE", "<vertical-tab>")); + "LC_CTYPE", "<vertical-tab>"); } else if (seq->nbytes != 1) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' in charmap not representable with one byte"), - "LC_CTYPE", "<vertical-tab>")); + "LC_CTYPE", "<vertical-tab>"); else ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space); @@ -3126,15 +3108,14 @@ set_class_defaults (struct locale_ctype_t *ctype, seq = charmap_find_value (charmap, "U00000020", 9); if (seq == NULL) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' not defined while needed as default value"), - "LC_CTYPE", "<space>")); + "LC_CTYPE", "<space>"); } else if (seq->nbytes != 1) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' in charmap not representable with one byte"), - "LC_CTYPE", "<space>")); + "LC_CTYPE", "<space>"); else ctype->class256_collection[seq->bytes[0]] |= BIT (tok_blank); @@ -3147,15 +3128,14 @@ set_class_defaults (struct locale_ctype_t *ctype, seq = charmap_find_value (charmap, "U00000009", 9); if (seq == NULL) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' not defined while needed as default value"), - "LC_CTYPE", "<tab>")); + "LC_CTYPE", "<tab>"); } else if (seq->nbytes != 1) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' in charmap not representable with one byte"), - "LC_CTYPE", "<tab>")); + "LC_CTYPE", "<tab>"); else ctype->class256_collection[seq->bytes[0]] |= BIT (tok_blank); @@ -3212,15 +3192,14 @@ set_class_defaults (struct locale_ctype_t *ctype, seq = charmap_find_value (charmap, "U00000020", 9); if (seq == NULL) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' not defined while needed as default value"), - "LC_CTYPE", "<space>")); + "LC_CTYPE", "<space>"); } else if (seq->nbytes != 1) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' in charmap not representable with one byte"), - "LC_CTYPE", "<space>")); + "LC_CTYPE", "<space>"); else ctype->class256_collection[seq->bytes[0]] |= BIT (tok_print); @@ -3254,17 +3233,15 @@ set_class_defaults (struct locale_ctype_t *ctype, } if (seq_from == NULL) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' not defined while needed as default value"), - "LC_CTYPE", tmp)); + "LC_CTYPE", tmp); } else if (seq_from->nbytes != 1) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' needed as default value not representable with one byte"), - "LC_CTYPE", tmp)); + "LC_CTYPE", tmp); } else { @@ -3279,17 +3256,15 @@ set_class_defaults (struct locale_ctype_t *ctype, } if (seq_to == NULL) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' not defined while needed as default value"), - "LC_CTYPE", tmp)); + "LC_CTYPE", tmp); } else if (seq_to->nbytes != 1) { - if (!be_quiet) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: character `%s' needed as default value not representable with one byte"), - "LC_CTYPE", tmp)); + "LC_CTYPE", tmp); } else /* The index [0] is determined by the order of the @@ -3321,9 +3296,9 @@ set_class_defaults (struct locale_ctype_t *ctype, if (ctype->outdigits_act != 10) { if (ctype->outdigits_act != 0) - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: field `%s' does not contain exactly ten entries"), - "LC_CTYPE", "outdigit")); + "LC_CTYPE", "outdigit"); for (size_t cnt = ctype->outdigits_act; cnt < 10; ++cnt) { @@ -3343,8 +3318,8 @@ set_class_defaults (struct locale_ctype_t *ctype, if (ctype->mboutdigits[cnt] == NULL) { /* Provide a replacement. */ - WITH_CUR_LOCALE (error (0, 0, _("\ -no output digits defined and none of the standard names in the charmap"))); + record_error (0, 0, _("\ +no output digits defined and none of the standard names in the charmap")); ctype->mboutdigits[cnt] = obstack_alloc (&((struct charmap_t *) charmap)->mem_pool, sizeof (struct charseq) @@ -3592,9 +3567,9 @@ translit_flatten (struct locale_ctype_t *ctype, if (other == NULL || other->categories[LC_CTYPE].ctype == NULL) { - WITH_CUR_LOCALE (error (0, 0, _("\ + record_error (0, 0, _("\ %s: transliteration data from locale `%s' not available"), - "LC_CTYPE", copy_locale)); + "LC_CTYPE", copy_locale); } else { @@ -3691,11 +3666,10 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, if (ctype->class_collection[idx] & _ISwbit (nr)) wctype_table_add (t, ctype->charnames[idx]); - if (verbose) - WITH_CUR_LOCALE (fprintf (stderr, _("\ -%s: table for class \"%s\": %lu bytes\n"), - "LC_CTYPE", ctype->classnames[nr], - (unsigned long int) t->result_size)); + record_verbose (stderr, _("\ +%s: table for class \"%s\": %lu bytes"), + "LC_CTYPE", ctype->classnames[nr], + (unsigned long int) t->result_size); } /* Room for table of mappings. */ @@ -3756,11 +3730,10 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, wctrans_table_add (t, ctype->charnames[idx], ctype->map_collection[nr][idx]); - if (verbose) - WITH_CUR_LOCALE (fprintf (stderr, _("\ -%s: table for map \"%s\": %lu bytes\n"), - "LC_CTYPE", ctype->mapnames[nr], - (unsigned long int) t->result_size)); + record_verbose (stderr, _("\ +%s: table for map \"%s\": %lu bytes"), + "LC_CTYPE", ctype->mapnames[nr], + (unsigned long int) t->result_size); } /* Extra array for class and map names. */ @@ -3881,9 +3854,8 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, /* Set the width of L'\0' to 0. */ wcwidth_table_add (t, 0, 0); - if (verbose) - WITH_CUR_LOCALE (fprintf (stderr, _("%s: table for width: %lu bytes\n"), - "LC_CTYPE", (unsigned long int) t->result_size)); + record_verbose (stderr, _("%s: table for width: %lu bytes"), + "LC_CTYPE", (unsigned long int) t->result_size); } /* Set MB_CUR_MAX. */ |