From 4b10dd6c1959577f57850ca427a94fe22b9f3299 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 31 Aug 1999 07:04:41 +0000 Subject: Update. * locale/Makefile (distribute): Add iso-639.def and iso-3166.def. Change charset.h to charmap.h. (categories): Add new categories. Leave out collate for now. Update build rules. * locale/categories.def: Add definitions for new categories. * locale/langinfo.h: Likewise. * locale/locale.h: Likewise. * locale/C-address.c: New file. * locale/C-identification.c: New file. * locale/C-measurement.c: New file. * locale/C-name.c: New file. * locale/C-paper.c: New file. * locale/C-telephone.c: New file. * locale/lc-address.c: Likewise. * locale/lc-identification.c: Likewise. * locale/lc-measurement.c: Likewise. * locale/lc-name.c: Likewise. * locale/lc-paper.c: Likewise. * locale/lc-telephone.c: Likewise. * locale/C-ctype.c: Update for locale rewrite. * locale/C-messages.c: Likewise. * locale/C-monetary.c: Likewise. * locale/C-time.c: Likewise. * locale/lc-collate.c: Likewise. * locale/lc-ctype.c: Likewise. * locale/lc-monetary.c: Likewise. * locale/lc-time.c: Likewise. * locale/localeinfo.h: Likewise. * locale/newlocale.c: Likewise. * locale/setlocale.c: Likewise. * locale/weight.h: Likewise. * locale/findlocale.c: Unconditionally use mmap. Handle new categories. * locale/loadlocale.c: Likewise. * locale/iso-3166.def: New file. * locale/iso-639.def: New file. * locale/programs/charmap-kw.gperf: Add new keywords. * locale/programs/locfile-kw.gperf: Likewise. * locale/programs/locfile-token.h: Define new tokens. * locale/programs/charmap.c: Rewrite to handle multibyte charsets. * locale/programs/charmap.h: New file. * locale/programs/charset.h: Removed. * locale/programs/config.h: Add __LC_LAST. * locale/programs/lc-address.c: New file. * locale/programs/lc-identification.c: New file. * locale/programs/lc-measurement.c: New file. * locale/programs/lc-name.c: New file. * locale/programs/lc-paper.c: New file. * locale/programs/lc-telephone.c: New file. * locale/programs/lc-collate.c: Update for locale rewrite. * locale/programs/lc-ctype.c: Likewise. * locale/programs/lc-messages.c: Likewise. * locale/programs/lc-monetary.c: Likewise. * locale/programs/lc-numeric.c: Likewise. * locale/programs/lc-time.c: Likewise. * locale/programs/locale.c: Likewise. * locale/programs/localedef.c: Likewise. * locale/programs/locfile.c: Likewise. * locale/programs/repertoire.c: Likewise. * locale/programs/repertoire.h: Likewise. * locale/programs/locfile.c: Update prototypes. Update handle_copy definition. * locale/programs/linereader.c: Add handling of wide char strings and new definition file syntax. * locale/programs/linereader.h (struct token): Add elements for wide character strings. * locale/programs/locale-spec.c: Disable handling of collation elements for now. * locale/programs/simple-hash.h: Cleanup. * locale/programs/stringtrans.h: Handle quite of end of line. * string/strcoll.c: Fall back on strcmp for now. * string/strxfrm.c: Fall back on strncpy/strlen for now. * time/strftime.c: Use new wide character data for wcsftime. * time/strptime.c: Remove _nl_C_LC_TIME declaration. * wctype/cname-lookup.h: Update for new LC_CTYPE data. --- time/strftime.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'time/strftime.c') diff --git a/time/strftime.c b/time/strftime.c index 60c8123afa..9ad16b2372 100644 --- a/time/strftime.c +++ b/time/strftime.c @@ -86,10 +86,15 @@ extern char *tzname[]; #endif #ifdef COMPILE_WIDE +# include # define CHAR_T wchar_t # define UCHAR_T unsigned int # define L_(Str) L##Str -# define NLW(Sym) _NL_W##Sym +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define NLW(Sym) _NL_W##Sym##_EL +# else +# define NLW(Sym) _NL_W##Sym##_EB +# endif # define MEMCPY(d, s, n) wmemcpy (d, s, n) # define STRLEN(s) wcslen (s) @@ -833,11 +838,11 @@ my_strftime (s, maxsize, format, tp ut_argument) if (era) { # ifdef COMPILE_WIDE - /* XXX For the time being there is no equivalent to - _nl_get_era_entry to get a wide character variant. */ - wchar_t *ws; - size_t len; - widen (era->name_fmt, ws, len); + /* The wide name is after the single byte name and + format. */ + char *tcp = strchr (era->name_fmt, '\0') + 1; + wchar_t *ws = (wchar_t *) (strchr (tcp, '\0') + 1); + size_t len = wcslen (ws); cpy (len, ws); # else size_t len = strlen (era->name_fmt); @@ -909,13 +914,7 @@ my_strftime (s, maxsize, format, tp ut_argument) /* Get the locale specific alternate representation of the number NUMBER_VALUE. If none exist NULL is returned. */ # ifdef COMPILE_WIDE - const char *ncp = _nl_get_alt_digit (number_value); - wchar_t *cp = NULL; - if (ncp != NULL) - { - size_t len; - widen (ncp, cp, len); - } + const wchar_t *cp = _nl_get_walt_digit (number_value); # else const char *cp = _nl_get_alt_digit (number_value); # endif @@ -1200,13 +1199,12 @@ my_strftime (s, maxsize, format, tp ut_argument) if (era) { # ifdef COMPILE_WIDE - /* XXX For the time being there is no wide character - equivalent or _nl_get_era_entry. */ - const char *ncp = strchr (era->name_fmt, '\0') + 1; + /* The wide name is after the single byte name and + format. */ + char *tcp = strchr (era->name_fmt, '\0') + 1; size_t len; - wchar_t *s; - widen (ncp, s, len); - subfmt = s; + subfmt = (wchar_t *) (strchr (tcp, '\0') + 1); + subfmt = wcschr (subfmt, L'\0') + 1; # else subfmt = strchr (era->name_fmt, '\0') + 1; # endif -- cgit v1.2.3