1998-10-19 13:24  Ulrich Drepper  <drepper@cygnus.com>

	* locale/programs/ld-collate.c (collate_startup): Clear bit for this
	category in copy_posix.
	(collate_finish): Don't warn about UNDEFINED not being defined.
	* locale/programs/ld-ctype.c (ctype_startup): Clear bit for this
	category in copy_posix.
	* locale/programs/ld-messages.c (messages_startup): Likewise.
	* locale/programs/ld-monetary.c (monetary_startup): Likewise.
	* locale/programs/ld-numeric.c (numeric_startup): Likewise.
	* locale/programs/ld-time.c (time_startup): Likewise.
	* locale/programs/localedef.c: Move copy_def_list_t definition into
	locales.h.  Define copy_posix variable.
	(main): Before processing copy list add &copy_posix to copy_list.
	* locale/programs/locales.h: Add definition of copy_def_list_t.
	* locale/programs/locfile.c: Clear bit for appropriate category in
	case of an copy instruction.
This commit is contained in:
Ulrich Drepper 1998-10-19 13:33:29 +00:00
parent 685c167680
commit 816e6eb5a7
15 changed files with 123 additions and 28 deletions

View File

@ -1,3 +1,21 @@
1998-10-19 13:24 Ulrich Drepper <drepper@cygnus.com>
* locale/programs/ld-collate.c (collate_startup): Clear bit for this
category in copy_posix.
(collate_finish): Don't warn about UNDEFINED not being defined.
* locale/programs/ld-ctype.c (ctype_startup): Clear bit for this
category in copy_posix.
* locale/programs/ld-messages.c (messages_startup): Likewise.
* locale/programs/ld-monetary.c (monetary_startup): Likewise.
* locale/programs/ld-numeric.c (numeric_startup): Likewise.
* locale/programs/ld-time.c (time_startup): Likewise.
* locale/programs/localedef.c: Move copy_def_list_t definition into
locales.h. Define copy_posix variable.
(main): Before processing copy list add &copy_posix to copy_list.
* locale/programs/locales.h: Add definition of copy_def_list_t.
* locale/programs/locfile.c: Clear bit for appropriate category in
case of an copy instruction.
1998-10-19 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/i386/setresgid.c: Remove #include of

View File

@ -22,8 +22,10 @@
#include <assert.h>
#include <gconv.h>
#include <sys/param.h>
#include <elf/ldsodefs.h>
#ifndef STATIC_GCONV
# include <elf/ldsodefs.h>
#endif
int
internal_function
@ -41,8 +43,12 @@ __gconv (gconv_t cd, const char **inbuf, const char *inbufend, char **outbuf,
if (inbuf == NULL || *inbuf == NULL)
/* We just flush. */
#ifdef _CALL_DL_FCT
result = _CALL_DL_FCT (cd->steps->fct,
(cd->steps, cd->data, NULL, NULL, converted, 1));
#else
result = cd->steps->fct (cd->steps, cd->data, NULL, NULL, converted, 1);
#endif
else
{
const char *last_start;
@ -54,9 +60,14 @@ __gconv (gconv_t cd, const char **inbuf, const char *inbufend, char **outbuf,
do
{
last_start = *inbuf;
#ifdef _CALL_DL_FCT
result = _CALL_DL_FCT (cd->steps->fct,
(cd->steps, cd->data, inbuf, inbufend,
converted, 0));
#else
result = cd->steps->fct (cd->steps, cd->data, inbuf, inbufend,
converted, 0);
#endif
}
while (result == GCONV_EMPTY_INPUT && last_start != *inbuf
&& *inbuf + cd->steps->min_needed_from <= inbufend);

View File

@ -22,7 +22,10 @@
#include <stdlib.h>
#include <string.h>
#include <bits/libc-lock.h>
#include <elf/ldsodefs.h>
#ifndef STATIC_GCONV
# include <elf/ldsodefs.h>
#endif
#include <gconv_int.h>
@ -155,7 +158,11 @@ free_derivation (void *p)
for (cnt = 0; cnt < deriv->nsteps; ++cnt)
if (deriv->steps[cnt].end_fct)
#ifdef _CALL_DL_FCT
_CALL_DL_FCT (deriv->steps[cnt].end_fct, (&deriv->steps[cnt]));
#else
deriv->steps[cnt].end_fct (&deriv->steps[cnt]);
#endif
free ((struct gconv_step *) deriv->steps);
free (deriv);
@ -221,7 +228,11 @@ gen_steps (struct derivation_step *best, const char *toset,
/* Call the init function. */
if (result[step_cnt].init_fct != NULL)
#ifdef _CALL_DL_FCT
_CALL_DL_FCT (result[step_cnt].init_fct, (&result[step_cnt]));
#else
result[step_cnt].init_fct (&result[step_cnt]);
#endif
current = current->last;
}
@ -232,7 +243,11 @@ gen_steps (struct derivation_step *best, const char *toset,
while (++step_cnt < *nsteps)
{
if (result[step_cnt].end_fct != NULL)
#ifdef _CALL_DL_FCT
_CALL_DL_FCT (result[step_cnt].end_fct, (&result[step_cnt]));
#else
result[step_cnt].end_fct (&result[step_cnt]);
#endif
#ifndef STATIC_GCONV
__gconv_release_shlib (result[step_cnt].shlib_handle);
#endif

View File

@ -155,6 +155,9 @@ collate_startup (struct linereader *lr, struct localedef_t *locale,
{
struct locale_collate_t *collate;
/* We have a definition for LC_COLLATE. */
copy_posix.mask &= ~(1 << LC_COLLATE);
/* It is important that we always use UCS4 encoding for strings now. */
encoding_method = ENC_UCS4;
@ -260,7 +263,7 @@ collate_finish (struct localedef_t *locale, struct charset_t *charset)
\**************************************************************/
u_int32_t weight;
if (!be_quiet)
if (/* XXX Remove the 0 & */ 0 && !be_quiet)
error (0, 0, _("no definition of `UNDEFINED'"));
collate->undefined.ordering_len = collate->nrules;

View File

@ -135,6 +135,9 @@ ctype_startup (struct linereader *lr, struct localedef_t *locale,
unsigned int cnt;
struct locale_ctype_t *ctype;
/* We have a definition for LC_CTYPE. */
copy_posix.mask &= ~(1 << LC_CTYPE);
/* It is important that we always use UCS1 encoding for strings now. */
encoding_method = ENC_UCS1;

View File

@ -60,6 +60,9 @@ messages_startup (struct linereader *lr, struct localedef_t *locale,
{
struct locale_messages_t *messages;
/* We have a definition for LC_MESSAGES. */
copy_posix.mask &= ~(1 << LC_MESSAGES);
/* It is important that we always use UCS1 encoding for strings now. */
encoding_method = ENC_UCS1;

View File

@ -84,6 +84,9 @@ monetary_startup (struct linereader *lr, struct localedef_t *locale,
{
struct locale_monetary_t *monetary;
/* We have a definition for LC_MONETARY. */
copy_posix.mask &= ~(1 << LC_MONETARY);
/* It is important that we always use UCS1 encoding for strings now. */
encoding_method = ENC_UCS1;
@ -129,15 +132,17 @@ monetary_finish (struct localedef_t *locale)
/* The international currency symbol must come from ISO 4217. */
if (monetary->int_curr_symbol != NULL)
{
if (strlen (monetary->int_curr_symbol) != 4)
if (strlen (monetary->int_curr_symbol) != 4
&& monetary->int_curr_symbol[0] != '\0')
{
if (!be_quiet)
error (0, 0, _("\
value of field `int_curr_symbol' in category `LC_MONETARY' has wrong length"));
}
else if (bsearch (monetary->int_curr_symbol, valid_int_curr,
NR_VALID_INT_CURR, sizeof (const char *),
(comparison_fn_t) curr_strcmp) == NULL
else if (monetary->int_curr_symbol[0] != '\0'
&& bsearch (monetary->int_curr_symbol, valid_int_curr,
NR_VALID_INT_CURR, sizeof (const char *),
(comparison_fn_t) curr_strcmp) == NULL
&& !be_quiet)
error (0, 0, _("\
value of field `int_curr_symbol' in category `LC_MONETARY' does \
@ -336,6 +341,8 @@ field `%s' in category `%s' declared more than once"), \
lr_error (lr, _("\
field `%s' in category `%s' declared more than once"), \
#cat, "LC_MONETARY"); \
else if (code->tok == tok_minus1) \
monetary->cat = -1; \
else \
monetary->cat = code->val.num; \
break

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@ -54,6 +54,9 @@ numeric_startup (struct linereader *lr, struct localedef_t *locale,
{
struct locale_numeric_t *numeric;
/* We have a definition for LC_NUMERIC. */
copy_posix.mask &= ~(1 << LC_NUMERIC);
/* It is important that we always use UCS1 encoding for strings now. */
encoding_method = ENC_UCS1;

View File

@ -90,6 +90,9 @@ time_startup (struct linereader *lr, struct localedef_t *locale,
{
struct locale_time_t *time;
/* We have a definition for LC_TIME. */
copy_posix.mask &= ~(1 << LC_TIME);
/* It is important that we always use UCS1 encoding for strings now. */
encoding_method = ENC_UCS1;

View File

@ -38,27 +38,21 @@
#include "error.h"
#include "charset.h"
#include "locfile.h"
#include "locales.h"
/* Undefine the following line in the production version. */
/* #define NDEBUG 1 */
#include <assert.h>
/* List of locale definition files which are used in `copy' instructions. */
struct copy_def_list_t
/* This is a special entry of the copylist. For all categories we don't
have a definition we use the data for the POSIX locale. */
struct copy_def_list_t copy_posix =
{
struct copy_def_list_t *next;
const char *name;
int mask;
struct localedef_t *locale;
struct
{
void *data;
size_t len;
} binary[6];
next: NULL,
name: "POSIX",
mask: (1 << LC_ALL) - 1,
locale: NULL
};
@ -153,7 +147,6 @@ main (int argc, char *argv[])
int remaining;
/* Set initial values for global variables. */
copy_list = NULL;
posix_conformance = getenv ("POSIXLY_CORRECT") != NULL;
error_print_progname = error_print;
@ -204,6 +197,10 @@ main (int argc, char *argv[])
if (localedef->failed != 0)
error (4, errno, _("cannot open locale definition file `%s'"), input_file);
/* Make sure all categories are defined. */
copy_posix.next = copy_list;
copy_list = &copy_posix;
/* Perhaps we saw some `copy' instructions. Process the given list.
We use a very simple algorithm: we look up the list from the
beginning every time. */
@ -229,8 +226,14 @@ main (int argc, char *argv[])
int avail = 0;
if (act_add_locdef->locale == NULL)
act_add_locdef->locale = locfile_read (act_add_locdef->name,
charset);
{
/* Saving the mask is an ugly trick to prevent the reader
from modifying `copy_posix' if we currently process it. */
int save_mask = act_add_locdef->mask;
act_add_locdef->locale = locfile_read (act_add_locdef->name,
charset);
act_add_locdef->mask = save_mask;
}
if (! act_add_locdef->locale->failed)
{

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@ -33,6 +33,26 @@
#include "localeinfo.h"
/* List of locale definition files which are used in `copy' instructions. */
struct copy_def_list_t
{
struct copy_def_list_t *next;
const char *name;
int mask;
struct localedef_t *locale;
struct
{
void *data;
size_t len;
} binary[6];
};
extern struct copy_def_list_t copy_posix;
/* Header of the locale data files. */
struct locale_file
{

View File

@ -116,6 +116,7 @@ locfile_read (const char *filename, struct charset_t *charset)
#define HANDLE_COPY(category, token, string) \
if (nowtok == tok_copy) \
{ \
copy_posix.mask &= ~(1 << category); \
copy_category = category; \
expected_tok = token; \
expected_str = string; \

View File

@ -1,3 +1,7 @@
1998-10-19 13:31 Ulrich Drepper <drepper@cygnus.com>
* locales/POSIX: Correct typo. Add UNDEFINED symbol.
1998-10-14 Ulrich Drepper <drepper@cygnus.com>
* locales/gr_GR: Renamed to...

View File

@ -21,7 +21,7 @@
# Distribution and use is free, also for
# commercial purposes.
repertoire_map mnemonic.ds
repertoiremap mnemonic.ds
LC_CTYPE
# The following is the POSIX Locale LC_CTYPE.
@ -206,6 +206,7 @@ order_start forward
<right-curly-bracket>
<tilde>
<DEL>
<UNDEFINED>
order_end
#
END LC_COLLATE

View File

@ -289,7 +289,7 @@ with_other_locale (char *new_locale,
/* @r{Copy the name so it won't be clobbered by @code{setlocale}.} */
saved_locale = strdup (old_locale);
if (old_locale == NULL)
if (saved_locale == NULL)
fatal ("Out of memory");
/* @r{Now change the locale and do some stuff with it.} */