2000-08-14  Ulrich Drepper  <drepper@redhat.com>

	* locale/programs/ld-ctype.c: Add support for more definitions after
	copy statement.
This commit is contained in:
Ulrich Drepper 2000-08-14 18:58:08 +00:00
parent 14860991fc
commit a6bd56c753
2 changed files with 139 additions and 84 deletions

View File

@ -1,3 +1,8 @@
2000-08-14 Ulrich Drepper <drepper@redhat.com>
* locale/programs/ld-ctype.c: Add support for more definitions after
copy statement.
2000-08-14 Jakub Jelinek <jakub@redhat.com>
* dirent/Versions (getdirentries64): Export at GLIBC_2.2.

View File

@ -197,7 +197,9 @@ struct locale_ctype_t
/* Prototypes for local functions. */
static void ctype_startup (struct linereader *lr, struct localedef_t *locale,
struct charmap_t *charmap, int ignore_content);
struct charmap_t *charmap,
struct localedef_t *copy_locale,
int ignore_content);
static void ctype_class_new (struct linereader *lr,
struct locale_ctype_t *ctype, const char *name);
static void ctype_map_new (struct linereader *lr,
@ -228,16 +230,20 @@ static const unsigned char digits[] = "0123456789";
static void
ctype_startup (struct linereader *lr, struct localedef_t *locale,
struct charmap_t *charmap, int ignore_content)
struct charmap_t *charmap, struct localedef_t *copy_locale,
int ignore_content)
{
unsigned int cnt;
struct locale_ctype_t *ctype;
if (!ignore_content)
if (!ignore_content && locale->categories[LC_CTYPE].ctype == NULL)
{
if (copy_locale == NULL)
{
/* Allocate the needed room. */
locale->categories[LC_CTYPE].ctype = ctype =
(struct locale_ctype_t *) xcalloc (1, sizeof (struct locale_ctype_t));
(struct locale_ctype_t *) xcalloc (1,
sizeof (struct locale_ctype_t));
/* We have seen no names yet. */
ctype->charnames_max = charmap->mb_cur_max == 1 ? 256 : 512;
@ -313,6 +319,10 @@ ctype_startup (struct linereader *lr, struct localedef_t *locale,
obstack_init (&ctype->mempool);
}
else
ctype = locale->categories[LC_CTYPE].ctype =
copy_locale->categories[LC_CTYPE].ctype;
}
}
@ -383,7 +393,7 @@ ctype_finish (struct localedef_t *locale, struct charmap_t *charmap)
{
if (! be_quiet)
error (0, 0, _("No definition for %s category found"), "LC_CTYPE");
ctype_startup (NULL, locale, charmap, 0);
ctype_startup (NULL, locale, charmap, NULL, 0);
ctype = locale->categories[LC_CTYPE].ctype;
}
@ -400,7 +410,7 @@ ctype_finish (struct localedef_t *locale, struct charmap_t *charmap)
if (ctype->codeset_name == NULL)
{
if (! be_quiet)
error (0, 0, "no character set name specified in charmap");
error (0, 0, _("No character set name specified in charmap"));
ctype->codeset_name = "//UNKNOWN//";
}
@ -2047,6 +2057,7 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result,
size_t last_charcode_len = 0;
const char *last_str = NULL;
int mapidx;
struct localedef_t *copy_locale = NULL;
/* Get the repertoire we have to use. */
if (repertoire_name != NULL)
@ -2066,13 +2077,52 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result,
/* If we see `copy' now we are almost done. */
if (nowtok == tok_copy)
{
handle_copy (ldfile, charmap, repertoire_name, result, tok_lc_ctype,
LC_CTYPE, "LC_CTYPE", ignore_content);
now = lr_token (ldfile, charmap, NULL);
if (now->tok != tok_string)
{
SYNTAX_ERROR (_("%s: syntax error"), "LC_CTYPE");
skip_category:
do
now = lr_token (ldfile, charmap, NULL);
while (now->tok != tok_eof && now->tok != tok_end);
if (now->tok != tok_eof
|| (now = lr_token (ldfile, charmap, NULL), now->tok == tok_eof))
lr_error (ldfile, _("%s: premature end of file"), "LC_CTYPE");
else if (now->tok != tok_lc_ctype)
{
lr_error (ldfile, _("\
%1$s: definition does not end with `END %1$s'"), "LC_CTYPE");
lr_ignore_rest (ldfile, 0);
}
else
lr_ignore_rest (ldfile, 1);
return;
}
if (! ignore_content)
{
/* Get the locale definition. */
copy_locale = load_locale (LC_CTYPE, now->val.str.startmb,
repertoire_name, charmap, NULL);
if ((copy_locale->avail & CTYPE_LOCALE) == 0)
{
/* Not yet loaded. So do it now. */
if (locfile_read (copy_locale, charmap) != 0)
goto skip_category;
}
}
lr_ignore_rest (ldfile, 1);
now = lr_token (ldfile, charmap, NULL);
nowtok = now->tok;
}
/* Prepare the data structures. */
ctype_startup (ldfile, result, charmap, ignore_content);
ctype_startup (ldfile, result, charmap, copy_locale, ignore_content);
ctype = result->categories[LC_CTYPE].ctype;
/* Remember the repertoire we use. */