From: Bruno Haible Date: Tue, 18 Oct 2005 12:19:58 +0000 (+0000) Subject: Drop support of CEN locale name syntax. X-Git-Tag: v0.15~361 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60492b1ffd681f677a17ed8ba5d4fa1e9a027e7b;p=thirdparty%2Fgettext.git Drop support of CEN locale name syntax. --- diff --git a/gettext-runtime/intl/ChangeLog b/gettext-runtime/intl/ChangeLog index 66816927b..56b6f2d10 100644 --- a/gettext-runtime/intl/ChangeLog +++ b/gettext-runtime/intl/ChangeLog @@ -1,3 +1,15 @@ +2005-10-09 Bruno Haible +2002-07-24 Ulrich Drepper + + * explodename.c (_nl_find_language, _nl_explode_name): Remove support + for CEN-style locale variables. It was never used and shouldn't be + since it's not portable. + * finddomain.c (_nl_find_domain): Likewise. + * l10nflist.c (_nl_make_l10nflist): Likewise. + * loadinfo.h (_nl_make_l10nflist, _nl_explode_name): Likewise. + (CEN_*, XPG_SPECIFIC): Remove macros. + (XPG_TERRITORY): Renamed from TERRITORY. + 2005-08-28 Bruno Haible * libgnuintl.h.in: Add IN_LIBGLOCALE conditional. diff --git a/gettext-runtime/intl/explodename.c b/gettext-runtime/intl/explodename.c index 547d363ec..a55e74d93 100644 --- a/gettext-runtime/intl/explodename.c +++ b/gettext-runtime/intl/explodename.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-1998, 2000-2001, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1995-1998, 2000-2001, 2003, 2005 Free Software Foundation, Inc. Contributed by Ulrich Drepper , 1995. This program is free software; you can redistribute it and/or modify it @@ -45,8 +45,7 @@ static char *_nl_find_language (const char *name); static char * _nl_find_language (const char *name) { - while (name[0] != '\0' && name[0] != '_' && name[0] != '@' - && name[0] != '+' && name[0] != ',') + while (name[0] != '\0' && name[0] != '_' && name[0] != '@') ++name; return (char *) name; @@ -57,10 +56,8 @@ int _nl_explode_name (char *name, const char **language, const char **modifier, const char **territory, const char **codeset, - const char **normalized_codeset, const char **special, - const char **sponsor, const char **revision) + const char **normalized_codeset) { - enum { undecided, xpg, cen } syntax; char *cp; int mask; @@ -68,15 +65,10 @@ _nl_explode_name (char *name, *territory = NULL; *codeset = NULL; *normalized_codeset = NULL; - *special = NULL; - *sponsor = NULL; - *revision = NULL; /* Now we determine the single parts of the locale name. First - look for the language. Termination symbols are `_' and `@' if - we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */ + look for the language. Termination symbols are `_' and `@'. */ mask = 0; - syntax = undecided; *language = cp = name; cp = _nl_find_language (*language); @@ -90,16 +82,14 @@ _nl_explode_name (char *name, cp[0] = '\0'; *territory = ++cp; - while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@' - && cp[0] != '+' && cp[0] != ',' && cp[0] != '_') + while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@' && cp[0] != '_') ++cp; - mask |= TERRITORY; + mask |= XPG_TERRITORY; if (cp[0] == '.') { /* Next is the codeset. */ - syntax = xpg; cp[0] = '\0'; *codeset = ++cp; @@ -120,71 +110,23 @@ _nl_explode_name (char *name, } } - if (cp[0] == '@' || (syntax != xpg && cp[0] == '+')) + if (cp[0] == '@') { /* Next is the modifier. */ - syntax = cp[0] == '@' ? xpg : cen; cp[0] = '\0'; *modifier = ++cp; - while (syntax == cen && cp[0] != '\0' && cp[0] != '+' - && cp[0] != ',' && cp[0] != '_') - ++cp; - - mask |= XPG_MODIFIER | CEN_AUDIENCE; - } - - if (syntax != xpg && (cp[0] == '+' || cp[0] == ',' || cp[0] == '_')) - { - syntax = cen; - - if (cp[0] == '+') - { - /* Next is special application (CEN syntax). */ - cp[0] = '\0'; - *special = ++cp; - - while (cp[0] != '\0' && cp[0] != ',' && cp[0] != '_') - ++cp; - - mask |= CEN_SPECIAL; - } - - if (cp[0] == ',') - { - /* Next is sponsor (CEN syntax). */ - cp[0] = '\0'; - *sponsor = ++cp; - - while (cp[0] != '\0' && cp[0] != '_') - ++cp; - - mask |= CEN_SPONSOR; - } - - if (cp[0] == '_') - { - /* Next is revision (CEN syntax). */ - cp[0] = '\0'; - *revision = ++cp; - - mask |= CEN_REVISION; - } + mask |= XPG_MODIFIER; } - /* For CEN syntax values it might be important to have the - separator character in the file name, not for XPG syntax. */ - if (syntax == xpg) - { - if (*territory != NULL && (*territory)[0] == '\0') - mask &= ~TERRITORY; + if (*territory != NULL && (*territory)[0] == '\0') + mask &= ~XPG_TERRITORY; - if (*codeset != NULL && (*codeset)[0] == '\0') - mask &= ~XPG_CODESET; + if (*codeset != NULL && (*codeset)[0] == '\0') + mask &= ~XPG_CODESET; - if (*modifier != NULL && (*modifier)[0] == '\0') - mask &= ~XPG_MODIFIER; - } + if (*modifier != NULL && (*modifier)[0] == '\0') + mask &= ~XPG_MODIFIER; return mask; } diff --git a/gettext-runtime/intl/finddomain.c b/gettext-runtime/intl/finddomain.c index 8b014e9b1..320cb1056 100644 --- a/gettext-runtime/intl/finddomain.c +++ b/gettext-runtime/intl/finddomain.c @@ -63,9 +63,6 @@ _nl_find_domain (const char *dirname, char *locale, const char *territory; const char *codeset; const char *normalized_codeset; - const char *special; - const char *sponsor; - const char *revision; const char *alias_value; int mask; @@ -73,21 +70,14 @@ _nl_find_domain (const char *dirname, char *locale, language[_territory[.codeset]][@modifier] - and six parts for the CEN syntax: - - language[_territory][+audience][+special][,[sponsor][_revision]] - Beside the first part all of them are allowed to be missing. If the full specified locale is not found, the less specific one are looked for. The various parts will be stripped off according to the following order: - (1) revision - (2) sponsor - (3) special - (4) codeset - (5) normalized codeset - (6) territory - (7) audience/modifier + (1) codeset + (2) normalized codeset + (3) territory + (4) modifier */ /* We need to protect modifying the _NL_LOADED_DOMAINS data. */ @@ -98,7 +88,7 @@ _nl_find_domain (const char *dirname, char *locale, be one data set in the list of loaded domains. */ retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname, strlen (dirname) + 1, 0, locale, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, domainname, 0); + NULL, NULL, domainname, 0); __libc_rwlock_unlock (lock); @@ -147,11 +137,9 @@ _nl_find_domain (const char *dirname, char *locale, } /* Now we determine the single parts of the locale name. First - look for the language. Termination symbols are `_' and `@' if - we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */ + look for the language. Termination symbols are `_' and `@'. */ mask = _nl_explode_name (locale, &language, &modifier, &territory, - &codeset, &normalized_codeset, &special, - &sponsor, &revision); + &codeset, &normalized_codeset); /* We need to protect modifying the _NL_LOADED_DOMAINS data. */ __libc_rwlock_wrlock (lock); @@ -160,8 +148,8 @@ _nl_find_domain (const char *dirname, char *locale, generalization. */ retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname, strlen (dirname) + 1, mask, language, territory, - codeset, normalized_codeset, modifier, special, - sponsor, revision, domainname, 1); + codeset, normalized_codeset, modifier, + domainname, 1); __libc_rwlock_unlock (lock); diff --git a/gettext-runtime/intl/l10nflist.c b/gettext-runtime/intl/l10nflist.c index 0501b976b..1baaa792d 100644 --- a/gettext-runtime/intl/l10nflist.c +++ b/gettext-runtime/intl/l10nflist.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-1999, 2000-2004 Free Software Foundation, Inc. +/* Copyright (C) 1995-1999, 2000-2005 Free Software Foundation, Inc. Contributed by Ulrich Drepper , 1995. This program is free software; you can redistribute it and/or modify it @@ -170,8 +170,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list, const char *dirlist, size_t dirlist_len, int mask, const char *language, const char *territory, const char *codeset, const char *normalized_codeset, - const char *modifier, const char *special, - const char *sponsor, const char *revision, + const char *modifier, const char *filename, int do_allocate) { char *abs_filename; @@ -190,23 +189,14 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list, /* Allocate room for the full file name. */ abs_filename = (char *) malloc (dirlist_len + strlen (language) - + ((mask & TERRITORY) != 0 + + ((mask & XPG_TERRITORY) != 0 ? strlen (territory) + 1 : 0) + ((mask & XPG_CODESET) != 0 ? strlen (codeset) + 1 : 0) + ((mask & XPG_NORM_CODESET) != 0 ? strlen (normalized_codeset) + 1 : 0) - + (((mask & XPG_MODIFIER) != 0 - || (mask & CEN_AUDIENCE) != 0) + + ((mask & XPG_MODIFIER) != 0 ? strlen (modifier) + 1 : 0) - + ((mask & CEN_SPECIAL) != 0 - ? strlen (special) + 1 : 0) - + (((mask & CEN_SPONSOR) != 0 - || (mask & CEN_REVISION) != 0) - ? (1 + ((mask & CEN_SPONSOR) != 0 - ? strlen (sponsor) : 0) - + ((mask & CEN_REVISION) != 0 - ? strlen (revision) + 1 : 0)) : 0) + 1 + strlen (filename) + 1); if (abs_filename == NULL) @@ -224,7 +214,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list, cp = stpcpy (cp, language); - if ((mask & TERRITORY) != 0) + if ((mask & XPG_TERRITORY) != 0) { *cp++ = '_'; cp = stpcpy (cp, territory); @@ -239,29 +229,11 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list, *cp++ = '.'; cp = stpcpy (cp, normalized_codeset); } - if ((mask & (XPG_MODIFIER | CEN_AUDIENCE)) != 0) + if ((mask & XPG_MODIFIER) != 0) { - /* This component can be part of both syntaces but has different - leading characters. For CEN we use `+', else `@'. */ - *cp++ = (mask & CEN_AUDIENCE) != 0 ? '+' : '@'; + *cp++ = '@'; cp = stpcpy (cp, modifier); } - if ((mask & CEN_SPECIAL) != 0) - { - *cp++ = '+'; - cp = stpcpy (cp, special); - } - if ((mask & (CEN_SPONSOR | CEN_REVISION)) != 0) - { - *cp++ = ','; - if ((mask & CEN_SPONSOR) != 0) - cp = stpcpy (cp, sponsor); - if ((mask & CEN_REVISION) != 0) - { - *cp++ = '_'; - cp = stpcpy (cp, revision); - } - } *cp++ = '/'; stpcpy (cp, filename); @@ -332,8 +304,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list, normalized_codeset. */ for (cnt = dirlist_count > 1 ? mask : mask - 1; cnt >= 0; --cnt) if ((cnt & ~mask) == 0 - && ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0) - && ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0)) + && !((cnt & XPG_CODESET) != 0 && (cnt & XPG_NORM_CODESET) != 0)) { if (dirlist_count > 1) { @@ -345,15 +316,14 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list, retval->successor[entries++] = _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1, cnt, language, territory, codeset, - normalized_codeset, modifier, special, - sponsor, revision, filename, 1); + normalized_codeset, modifier, filename, + 1); } else retval->successor[entries++] = _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, cnt, language, territory, codeset, - normalized_codeset, modifier, special, - sponsor, revision, filename, 1); + normalized_codeset, modifier, filename, 1); } retval->successor[entries] = NULL; diff --git a/gettext-runtime/intl/loadinfo.h b/gettext-runtime/intl/loadinfo.h index 6e4b0c81c..41ef6a92a 100644 --- a/gettext-runtime/intl/loadinfo.h +++ b/gettext-runtime/intl/loadinfo.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-1999, 2000-2003 Free Software Foundation, Inc. +/* Copyright (C) 1996-1999, 2000-2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -56,17 +56,10 @@ #endif /* Encoding of locale name parts. */ -#define CEN_REVISION 1 -#define CEN_SPONSOR 2 -#define CEN_SPECIAL 4 -#define XPG_NORM_CODESET 8 -#define XPG_CODESET 16 -#define TERRITORY 32 -#define CEN_AUDIENCE 64 -#define XPG_MODIFIER 128 - -#define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE) -#define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER) +#define XPG_NORM_CODESET 1 +#define XPG_CODESET 2 +#define XPG_TERRITORY 4 +#define XPG_MODIFIER 8 struct loaded_l10nfile @@ -93,9 +86,9 @@ extern const char *_nl_normalize_codeset (const char *codeset, files of the same kind, sorted in decreasing order of ->filename. DIRLIST and DIRLIST_LEN are an argz list of directories in which to look, containing at least one directory (i.e. DIRLIST_LEN > 0). - MASK, LANGUAGE, TERRITORY, CODESET, NORMALIZED_CODESET, MODIFIER, - SPECIAL, SPONSOR, REVISION are the pieces of the locale name, as - produced by _nl_explode_name(). FILENAME is the filename suffix. + MASK, LANGUAGE, TERRITORY, CODESET, NORMALIZED_CODESET, MODIFIER + are the pieces of the locale name, as produced by _nl_explode_name(). + FILENAME is the filename suffix. The return value is the lookup result, either found in *L10NFILE_LIST, or - if DO_ALLOCATE is nonzero - freshly allocated, or possibly NULL. If the return value is non-NULL, it is added to *L10NFILE_LIST, and @@ -107,8 +100,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list, const char *dirlist, size_t dirlist_len, int mask, const char *language, const char *territory, const char *codeset, const char *normalized_codeset, - const char *modifier, const char *special, - const char *sponsor, const char *revision, + const char *modifier, const char *filename, int do_allocate); /* Lookup the real locale name for a locale alias NAME, or NULL if @@ -118,28 +110,23 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list, extern LIBINTL_DLL_EXPORTED const char *_nl_expand_alias (const char *name); /* Split a locale name NAME into its pieces: language, modifier, - territory, codeset, special, sponsor, revision. + territory, codeset. NAME gets destructively modified: NUL bytes are inserted here and there. *LANGUAGE gets assigned NAME. Each of *MODIFIER, *TERRITORY, - *CODESET, *SPECIAL, *SPONSOR, *REVISION gets assigned either a - pointer into the old NAME string, or NULL. *NORMALIZED_CODESET - gets assigned the expanded *CODESET, if it is different from *CODESET; - this one is dynamically allocated and has to be freed by the caller. + *CODESET gets assigned either a pointer into the old NAME string, or + NULL. *NORMALIZED_CODESET gets assigned the expanded *CODESET, if it + is different from *CODESET; this one is dynamically allocated and has + to be freed by the caller. The return value is a bitmask, where each bit corresponds to one filled-in value: - XPG_MODIFIER, CEN_AUDIENCE for *MODIFIER, - TERRITORY for *TERRITORY, + XPG_MODIFIER for *MODIFIER, + XPG_TERRITORY for *TERRITORY, XPG_CODESET for *CODESET, - XPG_NORM_CODESET for *NORMALIZED_CODESET, - CEN_SPECIAL for *SPECIAL, - CEN_SPONSOR for *SPONSOR, - CEN_REVISION for *REVISION. + XPG_NORM_CODESET for *NORMALIZED_CODESET. */ extern int _nl_explode_name (char *name, const char **language, const char **modifier, const char **territory, const char **codeset, - const char **normalized_codeset, - const char **special, const char **sponsor, - const char **revision); + const char **normalized_codeset); #endif /* loadinfo.h */ diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 78b2e58ab..2aaf7ad3e 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,8 @@ +2005-10-09 Bruno Haible + + * msginit.c (catalogname_for_locale, language_of_locale): Drop support + of CEN locale name syntax. + 2005-10-05 Bruno Haible * format.h (check_msgid_msgstr_format): Add plural_distribution diff --git a/gettext-tools/src/msginit.c b/gettext-tools/src/msginit.c index 1fbad5ce6..5d7b06007 100644 --- a/gettext-tools/src/msginit.c +++ b/gettext-tools/src/msginit.c @@ -640,7 +640,7 @@ catalogname_for_locale (const char *locale) const char *codeset_end; char *shorter_locale; - codeset_end = strpbrk (dot + 1, "_@+,"); + codeset_end = strpbrk (dot + 1, "_@"); if (codeset_end == NULL) codeset_end = dot + strlen (dot); @@ -680,7 +680,7 @@ language_of_locale (const char *locale) { const char *language_end; - language_end = strpbrk (locale, "_.@+,"); + language_end = strpbrk (locale, "_.@"); if (language_end != NULL) { size_t len;