aboutsummaryrefslogtreecommitdiff
path: root/locale
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-02-05 05:57:24 +0000
committerUlrich Drepper <drepper@redhat.com>2001-02-05 05:57:24 +0000
commit93693c4d820dac2f218e144f5126a5a761f1cfbf (patch)
tree7371d326f24a3c9d73fed75e7792133d0d654a50 /locale
parent377c725f8e2dba91af36af27206e6deb85cf6e6f (diff)
downloadglibc-93693c4d820dac2f218e144f5126a5a761f1cfbf.tar.xz
glibc-93693c4d820dac2f218e144f5126a5a761f1cfbf.zip
Update.
2001-02-04 Ulrich Drepper <drepper@redhat.com> * iconv/Makefile (iconv_prog-modules): Define. Add vpath to find files in locale/programs. Add CFLAGS definition to allow compiling localedef files. * iconv/dummy-repertoire.c: New file. * iconv/iconv_charmap.c: New file. * iconv/iconv_prog.h: New file. * iconv/iconv_prog.c: Make verbose and omit_invalid global. (main): If parameter for -f and -t contain slashes try first to resolve the strings as filenames of charmap files. Use them for conversion in this case. * iconvdata/run-iconv-test.sh: If charmaps exist also run tests with iconv getting charmap names as parameters. * locale/programs/linereader.c (lr_token): Take extra parameters verbose and pass it to get_string. (get_string): Take extra parameters verbose. * locale/programs/charmap.c (parse_charmap): Take extra parameters verbose and be_quiet. Change all callers of lr_token and parse_charmap. * locale/programs/charmap.h: Likewise. * locale/programs/ld-address.c: Likewise. * locale/programs/ld-collate.c: Likewise. * locale/programs/ld-ctype.c: Likewise. * locale/programs/ld-identification.c: Likewise. * locale/programs/ld-measurement.c: Likewise. * locale/programs/ld-messages.c: Likewise. * locale/programs/ld-monetary.c: Likewise. * locale/programs/ld-name.c: Likewise. * locale/programs/ld-numeric.c: Likewise. * locale/programs/ld-paper.c: Likewise. * locale/programs/ld-telephone.c: Likewise. * locale/programs/ld-time.c: Likewise. * locale/programs/linereader.c: Likewise. * locale/programs/linereader.h: Likewise. * locale/programs/localedef.c: Likewise. * locale/programs/locfile.c: Likewise. * locale/programs/locfile.h: Likewise. * locale/programs/repertoire.c: Likewise.
Diffstat (limited to 'locale')
-rw-r--r--locale/programs/charmap.c29
-rw-r--r--locale/programs/charmap.h5
-rw-r--r--locale/programs/ld-address.c16
-rw-r--r--locale/programs/ld-collate.c67
-rw-r--r--locale/programs/ld-ctype.c85
-rw-r--r--locale/programs/ld-identification.c18
-rw-r--r--locale/programs/ld-measurement.c12
-rw-r--r--locale/programs/ld-messages.c12
-rw-r--r--locale/programs/ld-monetary.c28
-rw-r--r--locale/programs/ld-name.c12
-rw-r--r--locale/programs/ld-numeric.c18
-rw-r--r--locale/programs/ld-paper.c12
-rw-r--r--locale/programs/ld-telephone.c12
-rw-r--r--locale/programs/ld-time.c34
-rw-r--r--locale/programs/linereader.c17
-rw-r--r--locale/programs/linereader.h5
-rw-r--r--locale/programs/localedef.c2
-rw-r--r--locale/programs/locfile.c8
-rw-r--r--locale/programs/locfile.h8
-rw-r--r--locale/programs/repertoire.c6
20 files changed, 209 insertions, 197 deletions
diff --git a/locale/programs/charmap.c b/locale/programs/charmap.c
index 59f317a699..14cb4f4089 100644
--- a/locale/programs/charmap.c
+++ b/locale/programs/charmap.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1998,1999,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -34,7 +34,6 @@
#include "linereader.h"
#include "charmap.h"
#include "charmap-dir.h"
-#include "locfile.h"
#include "repertoire.h"
#include <assert.h>
@@ -47,7 +46,8 @@
extern void *xmalloc (size_t __n);
/* Prototypes for local functions. */
-static struct charmap_t *parse_charmap (struct linereader *cmfile);
+static struct charmap_t *parse_charmap (struct linereader *cmfile,
+ int verbose, int be_quiet);
static void new_width (struct linereader *cmfile, struct charmap_t *result,
const char *from, const char *to,
unsigned long int width);
@@ -55,6 +55,9 @@ static void charmap_new_char (struct linereader *lr, struct charmap_t *cm,
int nbytes, char *bytes, const char *from,
const char *to, int decimal_ellipsis, int step);
+
+static const char *null_pointer;
+
static struct linereader *
cmlr_open (const char *directory, const char *name, kw_hash_fct_t hf)
{
@@ -82,7 +85,7 @@ cmlr_open (const char *directory, const char *name, kw_hash_fct_t hf)
}
struct charmap_t *
-charmap_read (const char *filename)
+charmap_read (const char *filename, int verbose, int be_quiet, int use_default)
{
struct charmap_t *result = NULL;
@@ -129,14 +132,14 @@ charmap_read (const char *filename)
if (cmfile != NULL)
{
- result = parse_charmap (cmfile);
+ result = parse_charmap (cmfile, verbose, be_quiet);
if (result == NULL && !be_quiet)
error (0, errno, _("character map file `%s' not found"), filename);
}
}
- if (result == NULL && filename != NULL)
+ if (result == NULL && filename != NULL && strchr (filename, '/') == NULL)
{
/* OK, one more try. We also accept the names given to the
character sets in the files. Sometimes they differ from the
@@ -170,7 +173,7 @@ charmap_read (const char *filename)
cmfile = cmlr_open (CHARMAP_PATH, dirent, charmap_hash);
if (cmfile != NULL)
- result = parse_charmap (cmfile);
+ result = parse_charmap (cmfile, verbose, be_quiet);
break;
}
@@ -180,13 +183,13 @@ charmap_read (const char *filename)
}
}
- if (result == NULL)
+ if (result == NULL && DEFAULT_CHARMAP != NULL)
{
struct linereader *cmfile;
cmfile = cmlr_open (CHARMAP_PATH, DEFAULT_CHARMAP, charmap_hash);
if (cmfile != NULL)
- result = parse_charmap (cmfile);
+ result = parse_charmap (cmfile, verbose, be_quiet);
if (result == NULL)
error (4, errno, _("default character map file `%s' not found"),
@@ -220,7 +223,7 @@ charmap_read (const char *filename)
must have the same value as the 'wchar_t' code, which in glibc is the
same as the Unicode code, which for all of the enumerated characters
is identical to the ASCII code. */
- if (result != NULL)
+ if (result != NULL && use_default)
{
static const char basic_charset[] =
{
@@ -256,7 +259,7 @@ character map `%s' is not ASCII compatible, locale not ISO C compliant\n"),
static struct charmap_t *
-parse_charmap (struct linereader *cmfile)
+parse_charmap (struct linereader *cmfile, int verbose, int be_quiet)
{
struct charmap_t *result;
int state;
@@ -293,7 +296,7 @@ parse_charmap (struct linereader *cmfile)
while (1)
{
/* What's on? */
- struct token *now = lr_token (cmfile, NULL, NULL);
+ struct token *now = lr_token (cmfile, NULL, NULL, verbose);
enum token_t nowtok = now->tok;
struct token *arg;
@@ -351,7 +354,7 @@ parse_charmap (struct linereader *cmfile)
}
/* We know that we need an argument. */
- arg = lr_token (cmfile, NULL, NULL);
+ arg = lr_token (cmfile, NULL, NULL, verbose);
switch (nowtok)
{
diff --git a/locale/programs/charmap.h b/locale/programs/charmap.h
index 88fd078ed9..7b82c52abe 100644
--- a/locale/programs/charmap.h
+++ b/locale/programs/charmap.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -65,7 +65,8 @@ struct charseq
/* Prototypes for charmap handling functions. */
-extern struct charmap_t *charmap_read (const char *filename);
+extern struct charmap_t *charmap_read (const char *filename, int verbose,
+ int be_quiet, int use_default);
/* Return the value stored under the given key in the hashing table. */
extern struct charseq *charmap_find_value (const struct charmap_t *charmap,
diff --git a/locale/programs/ld-address.c b/locale/programs/ld-address.c
index e35305d44c..a2b17bbccb 100644
--- a/locale/programs/ld-address.c
+++ b/locale/programs/ld-address.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -434,7 +434,7 @@ address_read (struct linereader *ldfile, struct localedef_t *result,
do
{
- now = lr_token (ldfile, charmap, NULL);
+ now = lr_token (ldfile, charmap, NULL, verbose);
nowtok = now->tok;
}
while (nowtok == tok_eol);
@@ -460,7 +460,7 @@ address_read (struct linereader *ldfile, struct localedef_t *result,
/* Ignore empty lines. */
if (nowtok == tok_eol)
{
- now = lr_token (ldfile, charmap, NULL);
+ now = lr_token (ldfile, charmap, NULL, verbose);
nowtok = now->tok;
continue;
}
@@ -477,7 +477,7 @@ address_read (struct linereader *ldfile, struct localedef_t *result,
break; \
} \
\
- arg = lr_token (ldfile, charmap, NULL); \
+ arg = lr_token (ldfile, charmap, NULL, verbose); \
if (arg->tok != tok_string) \
goto err_label; \
if (address->cat != NULL) \
@@ -514,7 +514,7 @@ address_read (struct linereader *ldfile, struct localedef_t *result,
break; \
} \
\
- arg = lr_token (ldfile, charmap, NULL); \
+ arg = lr_token (ldfile, charmap, NULL, verbose); \
if (arg->tok != tok_string && arg->tok != tok_number) \
goto err_label; \
if (address->cat != NULL) \
@@ -552,7 +552,7 @@ address_read (struct linereader *ldfile, struct localedef_t *result,
break; \
} \
\
- arg = lr_token (ldfile, charmap, NULL); \
+ arg = lr_token (ldfile, charmap, NULL, verbose); \
if (arg->tok != tok_number) \
goto err_label; \
else if (address->cat != 0) \
@@ -566,7 +566,7 @@ address_read (struct linereader *ldfile, struct localedef_t *result,
case tok_end:
/* Next we assume `LC_ADDRESS'. */
- arg = lr_token (ldfile, charmap, NULL);
+ arg = lr_token (ldfile, charmap, NULL, verbose);
if (arg->tok == tok_eof)
break;
if (arg->tok == tok_eol)
@@ -584,7 +584,7 @@ address_read (struct linereader *ldfile, struct localedef_t *result,
}
/* Prepare for the next round. */
- now = lr_token (ldfile, charmap, NULL);
+ now = lr_token (ldfile, charmap, NULL, verbose);
nowtok = now->tok;
}
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index b228834eaa..2ce4d46105 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -508,7 +508,7 @@ read_directions (struct linereader *ldfile, struct token *arg,
}
if (valid)
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
if (arg->tok == tok_eof || arg->tok == tok_eol || arg->tok == tok_comma
|| arg->tok == tok_semicolon)
@@ -572,7 +572,7 @@ read_directions (struct linereader *ldfile, struct token *arg,
}
}
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
}
if (nrules == 0)
@@ -697,7 +697,7 @@ insert_weights (struct linereader *ldfile, struct element_t *elem,
weight_cnt = 0;
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
do
{
if (arg->tok == tok_eof || arg->tok == tok_eol)
@@ -867,11 +867,11 @@ insert_weights (struct linereader *ldfile, struct element_t *elem,
break;
}
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
/* This better should be the end of the line or a semicolon. */
if (arg->tok == tok_semicolon)
/* OK, ignore this and read the next token. */
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
else if (arg->tok != tok_eof && arg->tok != tok_eol)
{
/* It's a syntax error. */
@@ -2567,7 +2567,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
do
{
- now = lr_token (ldfile, charmap, NULL);
+ now = lr_token (ldfile, charmap, NULL, verbose);
nowtok = now->tok;
}
while (nowtok == tok_eol);
@@ -2575,18 +2575,19 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
if (nowtok == tok_copy)
{
state = 2;
- now = lr_token (ldfile, charmap, NULL);
+ now = lr_token (ldfile, charmap, NULL, verbose);
if (now->tok != tok_string)
{
SYNTAX_ERROR (_("%s: syntax error"), "LC_COLLATE");
skip_category:
do
- now = lr_token (ldfile, charmap, NULL);
+ now = lr_token (ldfile, charmap, NULL, verbose);
while (now->tok != tok_eof && now->tok != tok_end);
if (now->tok != tok_eof
- || (now = lr_token (ldfile, charmap, NULL), now->tok == tok_eof))
+ || (now = lr_token (ldfile, charmap, NULL, verbose),
+ now->tok == tok_eof))
lr_error (ldfile, _("%s: premature end of file"), "LC_COLLATE");
else if (now->tok != tok_lc_collate)
{
@@ -2615,7 +2616,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
lr_ignore_rest (ldfile, 1);
- now = lr_token (ldfile, charmap, NULL);
+ now = lr_token (ldfile, charmap, NULL, verbose);
nowtok = now->tok;
}
@@ -2636,7 +2637,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
/* Ingore empty lines. */
if (nowtok == tok_eol)
{
- now = lr_token (ldfile, charmap, NULL);
+ now = lr_token (ldfile, charmap, NULL, verbose);
nowtok = now->tok;
continue;
}
@@ -2645,7 +2646,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
{
case tok_copy:
/* Allow copying other locales. */
- now = lr_token (ldfile, charmap, NULL);
+ now = lr_token (ldfile, charmap, NULL, verbose);
if (now->tok != tok_string)
goto err_label;
@@ -2668,7 +2669,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
if (state != 0)
goto err_label;
- arg = lr_token (ldfile, charmap, NULL);
+ arg = lr_token (ldfile, charmap, NULL, verbose);
if (arg->tok != tok_number)
goto err_label;
if (collate->col_weight_max != -1)
@@ -2691,7 +2692,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
if (state != 0)
goto err_label;
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
if (arg->tok != tok_bsymbol)
goto err_label;
else if (!ignore_content)
@@ -2738,7 +2739,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
if (state != 0)
goto err_label;
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
if (arg->tok != tok_bsymbol)
goto err_label;
else
@@ -2747,7 +2748,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
size_t symbol_len = arg->val.str.lenmb;
/* Next the `from' keyword. */
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
if (arg->tok != tok_from)
{
free ((char *) symbol);
@@ -2758,7 +2759,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
ldfile->translate_strings = 1;
/* Finally the string with the replacement. */
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
ldfile->return_widestr = 0;
ldfile->translate_strings = 0;
@@ -2807,7 +2808,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
if (state != 0 && state != 2)
goto err_label;
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
if (arg->tok != tok_bsymbol)
goto err_label;
else
@@ -2818,12 +2819,12 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
size_t endsymbol_len = 0;
enum token_t ellipsis = tok_none;
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
if (arg->tok == tok_ellipsis2 || arg->tok == tok_ellipsis4)
{
ellipsis = arg->tok;
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
if (arg->tok != tok_bsymbol)
{
free (symbol);
@@ -2954,7 +2955,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
if (state != 0)
goto err_label;
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
if (arg->tok != tok_bsymbol)
goto err_label;
else
@@ -2965,7 +2966,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
size_t symname_len;
struct symbol_t *symval;
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
if (arg->tok != tok_bsymbol)
{
if (newname != NULL)
@@ -3022,7 +3023,7 @@ error while adding equivalent collating symbol"));
case tok_script:
/* We get told about the scripts we know. */
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
if (arg->tok != tok_bsymbol)
goto err_label;
else
@@ -3074,7 +3075,7 @@ error while adding equivalent collating symbol"));
/* The 14652 draft does not specify whether all `order_start' lines
must contain the same number of sort-rules, but 14651 does. So
we require this here as well. */
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
if (arg->tok == tok_bsymbol)
{
/* This better should be a section name. */
@@ -3133,7 +3134,7 @@ error while adding equivalent collating symbol"));
}
/* Next should come the end of the line or a semicolon. */
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
if (arg->tok == tok_eol)
{
uint32_t cnt;
@@ -3156,7 +3157,7 @@ error while adding equivalent collating symbol"));
}
/* Get the next token. */
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
}
}
else
@@ -3237,7 +3238,7 @@ error while adding equivalent collating symbol"));
goto err_label;
state = 3;
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
if (arg->tok == tok_bsymbol || arg->tok == tok_ucs4)
{
/* Find this symbol in the sequence table. */
@@ -3366,7 +3367,7 @@ error while adding equivalent collating symbol"));
state = 5;
/* Get the name of the sections we are adding after. */
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
if (arg->tok == tok_bsymbol)
{
/* Now find a section with this name. */
@@ -3399,7 +3400,7 @@ error while adding equivalent collating symbol"));
{
lr_ignore_rest (ldfile, 0);
- now = lr_token (ldfile, charmap, NULL);
+ now = lr_token (ldfile, charmap, NULL, verbose);
}
while (now->tok == tok_reorder_sections_after
|| now->tok == tok_reorder_sections_end
@@ -3596,7 +3597,7 @@ error while adding equivalent collating symbol"));
/* Process the rest of the line which might change
the collation rules. */
- arg = lr_token (ldfile, charmap, repertoire);
+ arg = lr_token (ldfile, charmap, repertoire, verbose);
if (arg->tok != tok_eof && arg->tok != tok_eol)
read_directions (ldfile, arg, charmap, repertoire,
collate);
@@ -3710,7 +3711,7 @@ error while adding equivalent collating symbol"));
error (0, 0, _("%s: missing `reorder-sections-end' keyword"),