+2005-10-09 Bruno Haible <bruno@clisp.org>
+2002-07-24 Ulrich Drepper <drepper@redhat.com>
+
+ * 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 <bruno@clisp.org>
* libgnuintl.h.in: Add IN_LIBGLOCALE conditional.
-/* 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 <drepper@gnu.ai.mit.edu>, 1995.
This program is free software; you can redistribute it and/or modify it
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;
_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;
*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);
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;
}
}
- 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;
}
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;
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. */
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);
}
/* 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);
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);
-/* Copyright (C) 1995-1999, 2000-2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000-2005 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This program is free software; you can redistribute it and/or modify it
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;
/* 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)
cp = stpcpy (cp, language);
- if ((mask & TERRITORY) != 0)
+ if ((mask & XPG_TERRITORY) != 0)
{
*cp++ = '_';
cp = stpcpy (cp, territory);
*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);
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)
{
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;
-/* 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 <drepper@cygnus.com>, 1996.
#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
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
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
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 */
+2005-10-09 Bruno Haible <bruno@clisp.org>
+
+ * msginit.c (catalogname_for_locale, language_of_locale): Drop support
+ of CEN locale name syntax.
+
2005-10-05 Bruno Haible <bruno@clisp.org>
* format.h (check_msgid_msgstr_format): Add plural_distribution
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);
{
const char *language_end;
- language_end = strpbrk (locale, "_.@+,");
+ language_end = strpbrk (locale, "_.@");
if (language_end != NULL)
{
size_t len;