diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-12-27 05:05:12 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-12-27 05:05:12 +0000 |
commit | 70e51ab9f37ec84b23ff5e090e0d9a322baf523d (patch) | |
tree | 1891740b82b92c022c072834b979196199ae0b93 /locale | |
parent | c392db7c4be39bf2ad8668f6e75a1ec219da6b0e (diff) | |
download | glibc-70e51ab9f37ec84b23ff5e090e0d9a322baf523d.tar.gz glibc-70e51ab9f37ec84b23ff5e090e0d9a322baf523d.tar.xz glibc-70e51ab9f37ec84b23ff5e090e0d9a322baf523d.zip |
Update.
* locale/programs/ld-collate.c (collate_output): Don't start with empty extrapool and indirectpool obstacks since we need the offsets to be nonzero. (collate_read): Call load_locale, not find_locale. * locale/programs/ld-ctype.c (ctype_finish): If LC_CTYPE category wasn't defined in the file also initialize repertoire if possible. * locale/programs/ld-time.c (time_finish): Fix message string. * locale/programs/linereader.c: Cast parameters of lr_error to correct type to prevnet warning. * locale/programs/localedef.c (load_locale): New file. * locale/programs/localedef.h: Add its prototype. * locale/programs/repertoire.c (repertoire_new_char): Add missing parameters to lr_error call. * localedata/Makefile: Enable running tests again. * localedata/tests/test2.def: Adjust syntax to new specification. * localedata/tests/test3.def: Likewise. * localedata/tst-trans.sh: Redirect output of program into file. * string/strcoll.c: Fix many error in new implementation to make it pass (at least) the test suite. * locale/Makefile: Don't link localedef statically anymore. * locale/ld-collate.c (struct element_t): Add field is_character and use it to distinguish real character from collating elements and symbols. * locale/programs/ld-time.c: Likewise.
Diffstat (limited to 'locale')
-rw-r--r-- | locale/Makefile | 3 | ||||
-rw-r--r-- | locale/programs/ld-collate.c | 17 | ||||
-rw-r--r-- | locale/programs/ld-ctype.c | 7 | ||||
-rw-r--r-- | locale/programs/ld-time.c | 5 | ||||
-rw-r--r-- | locale/programs/linereader.c | 4 | ||||
-rw-r--r-- | locale/programs/localedef.c | 20 | ||||
-rw-r--r-- | locale/programs/localedef.h | 5 | ||||
-rw-r--r-- | locale/programs/repertoire.c | 3 |
8 files changed, 56 insertions, 8 deletions
diff --git a/locale/Makefile b/locale/Makefile index 8bcc015219..d99f53511a 100644 --- a/locale/Makefile +++ b/locale/Makefile @@ -40,9 +40,8 @@ routines = setlocale findlocale loadlocale localeconv nl_langinfo \ categories = ctype messages monetary numeric time paper name \ address telephone measurement identification collate aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name -# XXX For testing this is now others-static instead of others. others = localedef locale -others-static = localedef locale +#others-static = localedef locale install-bin = localedef locale extra-objs = $(localedef-modules:=.o) $(locale-modules:=.o) \ $(lib-modules:=.o) diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c index a716494796..a7eb8083a4 100644 --- a/locale/programs/ld-collate.c +++ b/locale/programs/ld-collate.c @@ -1677,6 +1677,21 @@ collate_output (struct localedef_t *locale, struct charmap_t *charmap, obstack_init (&extrapool); obstack_init (&indirectpool); + /* Since we are using the sign of an integer to mark indirection the + offsets in the arrays we are indirectly referring to must not be + zero since -0 == 0. Therefore we add a bit of dummy content. */ + if (sizeof (int) == sizeof (int32_t)) + { + obstack_int_grow (&extrapool, 0); + obstack_int_grow (&indirectpool, 0); + } + else + { + int32_t zero = 0; + obstack_grow (&extrapool, &zero, sizeof (zero)); + obstack_grow (&indirectpool, &zero, sizeof (zero)); + } + /* Prepare the ruleset table. */ for (sect = collate->sections, i = 0; sect != NULL; sect = sect->next) if (sect->ruleidx == i) @@ -1978,7 +1993,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result, } /* Get the locale definition. */ - copy_locale = find_locale (LC_COLLATE, now->val.str.startmb, + copy_locale = load_locale (LC_COLLATE, now->val.str.startmb, repertoire_name, charmap); if ((copy_locale->avail & COLLATE_LOCALE) == 0) { diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index 97ff7fc8bb..0fd430662f 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -324,6 +324,8 @@ ctype_finish (struct localedef_t *locale, struct charmap_t *charmap) /* Now resolve copying and also handle completely missing definitions. */ if (ctype == NULL) { + const char *repertoire_name; + /* First see whether we were supposed to copy. If yes, find the actual definition. */ if (locale->copy_name[LC_CTYPE] != NULL) @@ -351,6 +353,11 @@ ctype_finish (struct localedef_t *locale, struct charmap_t *charmap) ctype_startup (NULL, locale, charmap, 0); ctype = locale->categories[LC_CTYPE].ctype; } + + /* Get the repertoire we have to use. */ + repertoire_name = locale->repertoire_name ?: repertoire_global; + if (repertoire_name != NULL) + ctype->repertoire = repertoire_read (repertoire_name); } /* Set default value for classes not specified. */ diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c index 5e12c9ba78..e317fc11a2 100644 --- a/locale/programs/ld-time.c +++ b/locale/programs/ld-time.c @@ -154,7 +154,8 @@ time_finish (struct localedef_t *locale, struct charmap_t *charmap) empty one. */ if (time == NULL) { - error (0, 0, _("No definition for %s category found"), "LC_TIME"); + if (! be_quiet) + error (0, 0, _("No definition for %s category found"), "LC_TIME"); time_startup (NULL, locale, 0); time = locale->categories[LC_TIME].time; nothing = 1; @@ -481,7 +482,7 @@ time_finish (struct localedef_t *locale, struct charmap_t *charmap) time->cal_direction = 1; else if (time->cal_direction > 3) error (0, 0, _("\ -%s: values for field `%s' must not be larger than 3"), +%s: values for field `%s' must not be larger than %d"), "LC_TIME", "cal_direction", 3); /* XXX We don't perform any tests on the timezone value since this is diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c index 564173083e..c689153bda 100644 --- a/locale/programs/linereader.c +++ b/locale/programs/linereader.c @@ -711,7 +711,7 @@ non-symbolic character value should not be used")); { /* This name is not in the repertoire map. */ lr_error (lr, _("symbol `%.*s' not in repertoire map"), - bufact - startidx, &buf[startidx]); + (int) (bufact - startidx), &buf[startidx]); illegal_string = 1; } else @@ -726,7 +726,7 @@ non-symbolic character value should not be used")); { /* This name is not in the charmap. */ lr_error (lr, _("symbol `%.*s' not in charmap"), - bufact - startidx, &buf[startidx]); + (int) (bufact - startidx), &buf[startidx]); illegal_string = 1; /* Now forget about the name we just added. */ diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c index 4fe3a28943..fa5d3de02b 100644 --- a/locale/programs/localedef.c +++ b/locale/programs/localedef.c @@ -490,3 +490,23 @@ find_locale (int locale, const char *name, const char *repertoire_name, return result; } + + +struct localedef_t * +load_locale (int locale, const char *name, const char *repertoire_name, + struct charmap_t *charmap) +{ + struct localedef_t *result; + + /* Generate the locale if it does not exist. */ + result = add_to_readlist (locale, name, repertoire_name, 1); + + assert (result != NULL); + + if ((result->avail & (1 << locale)) == 0 + && locfile_read (result, charmap) != 0) + error (4, errno, _("cannot open locale definition file `%s'"), + result->name); + + return result; +} diff --git a/locale/programs/localedef.h b/locale/programs/localedef.h index 31721c5353..4f8a103fd9 100644 --- a/locale/programs/localedef.h +++ b/locale/programs/localedef.h @@ -131,4 +131,9 @@ extern struct localedef_t *find_locale (int locale, const char *name, const char *repertoire_name, struct charmap_t *charmap); +/* Load (if necessary) the information for the locale NAME. */ +extern struct localedef_t *load_locale (int locale, const char *name, + const char *repertoire_name, + struct charmap_t *charmap); + #endif /* localedef.h */ diff --git a/locale/programs/repertoire.c b/locale/programs/repertoire.c index 4a4ef756fa..9293c03b7e 100644 --- a/locale/programs/repertoire.c +++ b/locale/programs/repertoire.c @@ -431,7 +431,8 @@ hexadecimal range format should use only capital characters")); && errno == ERANGE) || *to_end != '\0') { - lr_error (lr, _("<%s> and <%s> are invalid names for range")); + lr_error (lr, _("<%s> and <%s> are invalid names for range"), + from, to); return; } |