diff options
author | Ulrich Drepper <drepper@redhat.com> | 2002-07-24 10:07:08 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2002-07-24 10:07:08 +0000 |
commit | e155c80135043ce7582a5cb8623142c8ca14cbe5 (patch) | |
tree | 04dfe662eccf94461c6cdc9f47c89ad2a733fa59 /intl | |
parent | 7e93f91553018f1e24c3610da694a51ffb7f7021 (diff) | |
download | glibc-e155c80135043ce7582a5cb8623142c8ca14cbe5.tar.gz |
Remove support for CEN-style locale variables. It was never used and shouldn't be since it's not portable.
Diffstat (limited to 'intl')
-rw-r--r-- | intl/explodename.c | 101 | ||||
-rw-r--r-- | intl/finddomain.c | 29 | ||||
-rw-r--r-- | intl/l10nflist.c | 51 | ||||
-rw-r--r-- | intl/loadinfo.h | 27 |
4 files changed, 47 insertions, 161 deletions
diff --git a/intl/explodename.c b/intl/explodename.c index 0b17776ec6..bfaa5aba53 100644 --- a/intl/explodename.c +++ b/intl/explodename.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1995-1998, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. @@ -42,8 +42,7 @@ char * _nl_find_language (name) const char *name; { - while (name[0] != '\0' && name[0] != '_' && name[0] != '@' - && name[0] != '+' && name[0] != ',') + while (name[0] != '\0' && name[0] != '_' && name[0] != '@' && name[0] != '.') ++name; return (char *) name; @@ -52,18 +51,14 @@ _nl_find_language (name) int _nl_explode_name (name, language, modifier, territory, codeset, - normalized_codeset, special, sponsor, revision) + normalized_codeset) 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; { - enum { undecided, xpg, cen } syntax; char *cp; int mask; @@ -71,15 +66,10 @@ _nl_explode_name (name, language, modifier, territory, codeset, *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); @@ -87,22 +77,23 @@ _nl_explode_name (name, language, modifier, territory, codeset, /* This does not make sense: language has to be specified. Use this entry as it is without exploding. Perhaps it is an alias. */ cp = strchr (*language, '\0'); - else if (cp[0] == '_') + else if (cp[0] != '@') { - /* Next is the territory. */ - cp[0] = '\0'; - *territory = ++cp; + if (cp[0] == '_') + { + /* Next is the territory. */ + cp[0] = '\0'; + *territory = ++cp; - while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@' - && cp[0] != '+' && cp[0] != ',' && cp[0] != '_') - ++cp; + while (cp[0] != '\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; @@ -123,71 +114,21 @@ _nl_explode_name (name, language, modifier, territory, codeset, } } - 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 (cp[0] != '\0') + mask |= XPG_MODIFIER; } - if (syntax != xpg && (cp[0] == '+' || cp[0] == ',' || cp[0] == '_')) - { - syntax = cen; + if (*territory != NULL && (*territory)[0] == '\0') + mask &= ~XPG_TERRITORY; - 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; - } - } - - /* 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 (*codeset != NULL && (*codeset)[0] == '\0') - mask &= ~XPG_CODESET; - - if (*modifier != NULL && (*modifier)[0] == '\0') - mask &= ~XPG_MODIFIER; - } + if (*codeset != NULL && (*codeset)[0] == '\0') + mask &= ~XPG_CODESET; return mask; } diff --git a/intl/finddomain.c b/intl/finddomain.c index d487bbdf42..e0e11f0b7e 100644 --- a/intl/finddomain.c +++ b/intl/finddomain.c @@ -1,5 +1,5 @@ /* Handle list of needed message catalogs - Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Ulrich Drepper <drepper@gnu.org>, 1995. @@ -60,9 +60,6 @@ _nl_find_domain (dirname, locale, domainname, domainbinding) 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; @@ -70,28 +67,21 @@ _nl_find_domain (dirname, locale, domainname, domainbinding) 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 */ /* If we have already tested for this locale entry there has to 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); if (retval != NULL) { /* We know something about this locale. */ @@ -139,15 +129,14 @@ _nl_find_domain (dirname, locale, domainname, domainbinding) look for the language. Termination symbols are `_' and `@' if we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */ mask = _nl_explode_name (locale, &language, &modifier, &territory, - &codeset, &normalized_codeset, &special, - &sponsor, &revision); + &codeset, &normalized_codeset); /* Create all possible locale entries which might be interested in 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); if (retval == NULL) /* This means we are out of core. */ return NULL; diff --git a/intl/l10nflist.c b/intl/l10nflist.c index 80d8acebad..31760bdaaa 100644 --- a/intl/l10nflist.c +++ b/intl/l10nflist.c @@ -168,8 +168,8 @@ pop (x) struct loaded_l10nfile * _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language, - territory, codeset, normalized_codeset, modifier, special, - sponsor, revision, filename, do_allocate) + territory, codeset, normalized_codeset, modifier, + filename, do_allocate) struct loaded_l10nfile **l10nfile_list; const char *dirlist; size_t dirlist_len; @@ -179,9 +179,6 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language, const char *codeset; const char *normalized_codeset; const char *modifier; - const char *special; - const char *sponsor; - const char *revision; const char *filename; int do_allocate; { @@ -195,23 +192,14 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language, /* 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) + 1 : 0) - + ((mask & CEN_REVISION) != 0 - ? strlen (revision) + 1 : 0)) : 0) + 1 + strlen (filename) + 1); if (abs_filename == NULL) @@ -227,7 +215,7 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language, *cp++ = '/'; cp = stpcpy (cp, language); - if ((mask & TERRITORY) != 0) + if ((mask & XPG_TERRITORY) != 0) { *cp++ = '_'; cp = stpcpy (cp, territory); @@ -242,29 +230,11 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language, *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); @@ -325,9 +295,7 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language, of the inner loop. */ cnt = __argz_count (dirlist, dirlist_len) == 1 ? mask - 1 : mask; for (; cnt >= 0; --cnt) - if ((cnt & ~mask) == 0 - && ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0) - && ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0)) + if ((cnt & ~mask) == 0) { /* Iterate over all elements of the DIRLIST. */ char *dir = NULL; @@ -337,8 +305,7 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language, 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); } retval->successor[entries] = NULL; diff --git a/intl/loadinfo.h b/intl/loadinfo.h index 1de6cfd24b..340535a4d3 100644 --- a/intl/loadinfo.h +++ b/intl/loadinfo.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1996,1997,1998,1999,2000,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -39,17 +39,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 @@ -77,9 +70,8 @@ _nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list, 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 *filename, int do_allocate)); + const char *modifier, const char *filename, + int do_allocate)); extern const char *_nl_expand_alias PARAMS ((const char *name)); @@ -90,10 +82,7 @@ extern int _nl_explode_name PARAMS ((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)); extern char *_nl_find_language PARAMS ((const char *name)); |