mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 08:11:08 +00:00
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.
This commit is contained in:
parent
377c725f8e
commit
93693c4d82
40
ChangeLog
40
ChangeLog
@ -1,3 +1,43 @@
|
||||
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.
|
||||
|
||||
2001-02-03 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* iconv/iconv_prog.c (main): If output file name is "-" write to
|
||||
|
@ -34,9 +34,19 @@ CFLAGS-gconv_db.c = -DSTATIC_GCONV
|
||||
CFLAGS-gconv_simple.c = -DSTATIC_GCONV
|
||||
endif
|
||||
|
||||
vpath %.c ../locale/programs
|
||||
|
||||
iconv_prog-modules = iconv_charmap charmap charmap-dir linereader \
|
||||
dummy-repertoire simple-hash xstrdup xmalloc
|
||||
CFLAGS-iconv_prog.c = -I../locale/programs
|
||||
CFLAGS-iconv_charmap.c = -I../locale/programs
|
||||
CFLAGS-dummy-repertoire.c = -I../locale/programs
|
||||
CFLAGS-charmap.c = -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
|
||||
-DDEFAULT_CHARMAP=null_pointer
|
||||
|
||||
tests = tst-iconv1 tst-iconv2 tst-iconv3
|
||||
|
||||
distribute = gconv_builtin.h gconv_int.h loop.c skeleton.c
|
||||
distribute = gconv_builtin.h gconv_int.h loop.c skeleton.c iconv_prog.h
|
||||
|
||||
others = iconv_prog
|
||||
install-others = $(inst_bindir)/iconv
|
||||
@ -47,3 +57,5 @@ include ../Rules
|
||||
|
||||
$(inst_bindir)/iconv: $(objpfx)iconv_prog $(+force)
|
||||
$(do-install-program)
|
||||
|
||||
$(objpfx)iconv_prog: $(iconv_prog-modules:%=$(objpfx)%.o)
|
||||
|
37
iconv/dummy-repertoire.c
Normal file
37
iconv/dummy-repertoire.c
Normal file
@ -0,0 +1,37 @@
|
||||
/* Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* For iconv we don't have to handle repertoire maps. Provide dummy
|
||||
definitions to allow the use of linereader.c unchanged. */
|
||||
#include <repertoire.h>
|
||||
|
||||
|
||||
uint32_t
|
||||
repertoire_find_value (const struct repertoire_t *repertoire, const char *name,
|
||||
size_t len)
|
||||
{
|
||||
return ILLEGAL_CHAR_VALUE;
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
repertoire_find_symbol (const struct repertoire_t *repertoire, uint32_t ucs)
|
||||
{
|
||||
return NULL;
|
||||
}
|
563
iconv/iconv_charmap.c
Normal file
563
iconv/iconv_charmap.c
Normal file
@ -0,0 +1,563 @@
|
||||
/* Convert using charmaps and possibly iconv().
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <error.h>
|
||||
#include <fcntl.h>
|
||||
#include <iconv.h>
|
||||
#include <libintl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "iconv_prog.h"
|
||||
|
||||
|
||||
/* Prototypes for a few program-wide used functions. */
|
||||
extern void *xmalloc (size_t __n);
|
||||
extern void *xcalloc (size_t __n, size_t __s);
|
||||
|
||||
|
||||
struct convtable
|
||||
{
|
||||
int term[256 / 8];
|
||||
union
|
||||
{
|
||||
struct convtable *sub;
|
||||
struct charseq *out;
|
||||
} val[256];
|
||||
};
|
||||
|
||||
|
||||
static inline struct convtable *
|
||||
allocate_table (void)
|
||||
{
|
||||
return (struct convtable *) xcalloc (1, sizeof (struct convtable));
|
||||
}
|
||||
|
||||
|
||||
static inline int
|
||||
is_term (struct convtable *tbl, unsigned int idx)
|
||||
{
|
||||
return tbl->term[idx / 8] & (1 << (idx % 8));
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
clear_term (struct convtable *tbl, unsigned int idx)
|
||||
{
|
||||
tbl->term[idx / 8] &= ~(1 << (idx % 8));
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
set_term (struct convtable *tbl, unsigned int idx)
|
||||
{
|
||||
tbl->term[idx / 8] |= 1 << (idx % 8);
|
||||
}
|
||||
|
||||
|
||||
/* Generate the conversion table. */
|
||||
static struct convtable *use_from_charmap (struct charmap_t *from_charmap,
|
||||
const char *to_code);
|
||||
static struct convtable *use_to_charmap (const char *from_code,
|
||||
struct charmap_t *to_charmap);
|
||||
static struct convtable *use_both_charmaps (struct charmap_t *from_charmap,
|
||||
struct charmap_t *to_charmap);
|
||||
|
||||
/* Prototypes for the functions doing the actual work. */
|
||||
static int process_block (struct convtable *tbl, char *addr, size_t len,
|
||||
FILE *output);
|
||||
static int process_fd (struct convtable *tbl, int fd, FILE *output);
|
||||
static int process_file (struct convtable *tbl, FILE *input, FILE *output);
|
||||
|
||||
|
||||
int
|
||||
charmap_conversion (const char *from_code, struct charmap_t *from_charmap,
|
||||
const char *to_code, struct charmap_t *to_charmap,
|
||||
int argc, int remaining, char *argv[], FILE *output)
|
||||
{
|
||||
struct convtable *cvtbl;
|
||||
int status = EXIT_SUCCESS;
|
||||
|
||||
/* We have three different cases to handle:
|
||||
|
||||
- both, from_charmap and to_charmap, are available. This means we
|
||||
can assume that the symbolic names match and use them to create
|
||||
the mapping.
|
||||
|
||||
- only from_charmap is available. In this case we can only hope that
|
||||
the symbolic names used are of the <Uxxxx> form in which case we
|
||||
can use a UCS4->"to_code" iconv() conversion for the second step.
|
||||
|
||||
- only to_charmap is available. This is similar, only that we would
|
||||
use iconv() for the "to_code"->UCS4 conversion.
|
||||
|
||||
We first create a table which maps input bytes into output bytes.
|
||||
Once this is done we can handle all three of the cases above
|
||||
equally. */
|
||||
if (from_charmap != NULL)
|
||||
{
|
||||
if (to_charmap == NULL)
|
||||
cvtbl = use_from_charmap (from_charmap, to_code);
|
||||
else
|
||||
cvtbl = use_both_charmaps (from_charmap, to_charmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert (to_charmap != NULL);
|
||||
cvtbl = use_to_charmap (from_code, to_charmap);
|
||||
}
|
||||
|
||||
/* If we couldn't generate a table stop now. */
|
||||
if (cvtbl == NULL)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
/* We can now start the conversion. */
|
||||
if (remaining == argc)
|
||||
{
|
||||
if (process_file (cvtbl, stdin, output) != 0)
|
||||
status = EXIT_FAILURE;
|
||||
}
|
||||
else
|
||||
do
|
||||
{
|
||||
struct stat st;
|
||||
char *addr;
|
||||
int fd;
|
||||
|
||||
if (verbose)
|
||||
printf ("%s:\n", argv[remaining]);
|
||||
if (strcmp (argv[remaining], "-") == 0)
|
||||
fd = 0;
|
||||
else
|
||||
{
|
||||
fd = open (argv[remaining], O_RDONLY);
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
error (0, errno, _("cannot open input file `%s'"),
|
||||
argv[remaining]);
|
||||
status = EXIT_FAILURE;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _POSIX_MAPPED_FILES
|
||||
/* We have possibilities for reading the input file. First try
|
||||
to mmap() it since this will provide the fastest solution. */
|
||||
if (fstat (fd, &st) == 0
|
||||
&& ((addr = mmap (NULL, st.st_size, PROT_READ, MAP_PRIVATE,
|
||||
fd, 0)) != MAP_FAILED))
|
||||
{
|
||||
/* Yes, we can use mmap(). The descriptor is not needed
|
||||
anymore. */
|
||||
if (close (fd) != 0)
|
||||
error (EXIT_FAILURE, errno,
|
||||
_("error while closing input `%s'"), argv[remaining]);
|
||||
|
||||
if (process_block (cvtbl, addr, st.st_size, output) < 0)
|
||||
{
|
||||
/* Something went wrong. */
|
||||
status = EXIT_FAILURE;
|
||||
|
||||
/* We don't need the input data anymore. */
|
||||
munmap ((void *) addr, st.st_size);
|
||||
|
||||
/* We cannot go on with producing output since it might
|
||||
lead to problem because the last output might leave
|
||||
the output stream in an undefined state. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* We don't need the input data anymore. */
|
||||
munmap ((void *) addr, st.st_size);
|
||||
}
|
||||
else
|
||||
#endif /* _POSIX_MAPPED_FILES */
|
||||
{
|
||||
/* Read the file in pieces. */
|
||||
if (process_fd (cvtbl, fd, output) != 0)
|
||||
{
|
||||
/* Something went wrong. */
|
||||
status = EXIT_FAILURE;
|
||||
|
||||
/* We don't need the input file anymore. */
|
||||
close (fd);
|
||||
|
||||
/* We cannot go on with producing output since it might
|
||||
lead to problem because the last output might leave
|
||||
the output stream in an undefined state. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Now close the file. */
|
||||
close (fd);
|
||||
}
|
||||
}
|
||||
while (++remaining < argc);
|
||||
|
||||
/* All done. */
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
add_bytes (struct convtable *tbl, struct charseq *in, struct charseq *out)
|
||||
{
|
||||
int n = 0;
|
||||
unsigned int byte;
|
||||
|
||||
assert (in->nbytes > 0);
|
||||
|
||||
byte = ((unsigned char *) in->bytes)[n];
|
||||
while (n + 1 < in->nbytes)
|
||||
{
|
||||
if (is_term (tbl, byte) || tbl->val[byte].sub == NULL)
|
||||
{
|
||||
/* Note that we simply ignore a definition for a byte sequence
|
||||
which is also the prefix for a longer one. */
|
||||
clear_term (tbl, byte);
|
||||
tbl->val[byte].sub =
|
||||
(struct convtable *) xcalloc (1, sizeof (struct convtable));
|
||||
}
|
||||
|
||||
tbl = tbl->val[byte].sub;
|
||||
|
||||
byte = ((unsigned char *) in->bytes)[++n];
|
||||
}
|
||||
|
||||
/* Only add the new sequence if there is none yet and the byte sequence
|
||||
is not part of an even longer one. */
|
||||
if (! is_term (tbl, byte) && tbl->val[byte].sub == NULL)
|
||||
{
|
||||
set_term (tbl, byte);
|
||||
tbl->val[byte].out = out;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static struct convtable *
|
||||
use_from_charmap (struct charmap_t *from_charmap, const char *to_code)
|
||||
{
|
||||
/* We iterate over all entries in the from_charmap and for those which
|
||||
have a known UCS4 representation we use an iconv() call to determine
|
||||
the mapping to the to_code charset. */
|
||||
struct convtable *rettbl;
|
||||
iconv_t cd;
|
||||
void *ptr = NULL;
|
||||
const void *key;
|
||||
size_t keylen;
|
||||
void *data;
|
||||
|
||||
cd = iconv_open (to_code, "WCHAR_T");
|
||||
if (cd == (iconv_t) -1)
|
||||
/* We cannot do anything. */
|
||||
return NULL;
|
||||
|
||||
rettbl = allocate_table ();
|
||||
|
||||
while (iterate_table (&from_charmap->char_table, &ptr, &key, &keylen, &data)
|
||||
>= 0)
|
||||
{
|
||||
struct charseq *in = (struct charseq *) data;
|
||||
|
||||
if (in->ucs4 != UNINITIALIZED_CHAR_VALUE)
|
||||
{
|
||||
/* There is a chance. Try the iconv module. */
|
||||
wchar_t inbuf[1] = { in->ucs4 };
|
||||
unsigned char outbuf[64];
|
||||
char *inptr = (char *) inbuf;
|
||||
size_t inlen = sizeof (inbuf);
|
||||
char *outptr = (char *) outbuf;
|
||||
size_t outlen = sizeof (outbuf);
|
||||
|
||||
(void) iconv (cd, &inptr, &inlen, &outptr, &outlen);
|
||||
|
||||
if (outptr != (char *) outbuf)
|
||||
{
|
||||
/* We got some output. Good, use it. */
|
||||
struct charseq *newp;
|
||||
|
||||
outlen = sizeof (outbuf) - outlen;
|
||||
assert ((char *) outbuf + outlen == outptr);
|
||||
|
||||
newp = (struct charseq *) xmalloc (sizeof (struct charseq)
|
||||
+ outlen);
|
||||
newp->name = in->name;
|
||||
newp->ucs4 = in->ucs4;
|
||||
newp->nbytes = outlen;
|
||||
memcpy (newp->bytes, outbuf, outlen);
|
||||
|
||||
add_bytes (rettbl, in, newp);
|
||||
}
|
||||
|
||||
/* Clear any possible state left behind. */
|
||||
(void) iconv (cd, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
iconv_close (cd);
|
||||
|
||||
return rettbl;
|
||||
}
|
||||
|
||||
|
||||
static struct convtable *
|
||||
use_to_charmap (const char *from_code, struct charmap_t *to_charmap)
|
||||
{
|
||||
/* We iterate over all entries in the to_charmap and for those which
|
||||
have a known UCS4 representation we use an iconv() call to determine
|
||||
the mapping to the from_code charset. */
|
||||
struct convtable *rettbl;
|
||||
iconv_t cd;
|
||||
void *ptr = NULL;
|
||||
const void *key;
|
||||
size_t keylen;
|
||||
void *data;
|
||||
|
||||
/* Note that the conversion we use here is the reverse direction. Without
|
||||
exhaustive search we cannot figure out which input yields the UCS4
|
||||
character we are looking for. Therefore we determine it the other
|
||||
way round. */
|
||||
cd = iconv_open (from_code, "WCHAR_T");
|
||||
if (cd == (iconv_t) -1)
|
||||
/* We cannot do anything. */
|
||||
return NULL;
|
||||
|
||||
rettbl = allocate_table ();
|
||||
|
||||
while (iterate_table (&to_charmap->char_table, &ptr, &key, &keylen, &data)
|
||||
>= 0)
|
||||
{
|
||||
struct charseq *out = (struct charseq *) data;
|
||||
|
||||
if (out->ucs4 != UNINITIALIZED_CHAR_VALUE)
|
||||
{
|
||||
/* There is a chance. Try the iconv module. */
|
||||
wchar_t inbuf[1] = { out->ucs4 };
|
||||
unsigned char outbuf[64];
|
||||
char *inptr = (char *) inbuf;
|
||||
size_t inlen = sizeof (inbuf);
|
||||
char *outptr = (char *) outbuf;
|
||||
size_t outlen = sizeof (outbuf);
|
||||
|
||||
(void) iconv (cd, &inptr, &inlen, &outptr, &outlen);
|
||||
|
||||
if (outptr != (char *) outbuf)
|
||||
{
|
||||
/* We got some output. Good, use it. */
|
||||
struct charseq *newp;
|
||||
|
||||
outlen = sizeof (outbuf) - outlen;
|
||||
assert ((char *) outbuf + outlen == outptr);
|
||||
|
||||
newp = (struct charseq *) xmalloc (sizeof (struct charseq)
|
||||
+ outlen);
|
||||
newp->name = out->name;
|
||||
newp->ucs4 = out->ucs4;
|
||||
newp->nbytes = outlen;
|
||||
memcpy (newp->bytes, outbuf, outlen);
|
||||
|
||||
add_bytes (rettbl, newp, out);
|
||||
}
|
||||
|
||||
/* Clear any possible state left behind. */
|
||||
(void) iconv (cd, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
iconv_close (cd);
|
||||
|
||||
return rettbl;
|
||||
}
|
||||
|
||||
|
||||
static struct convtable *
|
||||
use_both_charmaps (struct charmap_t *from_charmap,
|
||||
struct charmap_t *to_charmap)
|
||||
{
|
||||
/* In this case we iterate over all the entries in the from_charmap,
|
||||
determine the internal name, and find an appropriate entry in the
|
||||
to_charmap (if it exists). */
|
||||
struct convtable *rettbl = allocate_table ();
|
||||
void *ptr = NULL;
|
||||
const void *key;
|
||||
size_t keylen;
|
||||
void *data;
|
||||
|
||||
while (iterate_table (&from_charmap->char_table, &ptr, &key, &keylen, &data)
|
||||
>= 0)
|
||||
{
|
||||
struct charseq *in = (struct charseq *) data;
|
||||
struct charseq *out = charmap_find_value (to_charmap, key, keylen);
|
||||
|
||||
if (out != NULL)
|
||||
add_bytes (rettbl, in, out);
|
||||
}
|
||||
|
||||
return rettbl;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
process_block (struct convtable *tbl, char *addr, size_t len, FILE *output)
|
||||
{
|
||||
size_t n = 0;
|
||||
|
||||
while (n < len)
|
||||
{
|
||||
struct convtable *cur = tbl;
|
||||
unsigned char *curp = (unsigned char *) addr;
|
||||
unsigned int byte = *curp;
|
||||
int cnt;
|
||||
struct charseq *out;
|
||||
|
||||
while (! is_term (cur, byte))
|
||||
if (cur->val[byte].sub == NULL)
|
||||
{
|
||||
/* This is a invalid sequence. Skip the first byte if we are
|
||||
ignoring errors. Otherwise punt. */
|
||||
if (! omit_invalid)
|
||||
{
|
||||
error (0, 0, _("illegal input sequence at position %Zd"), n);
|
||||
return -1;
|
||||
}
|
||||
|
||||
n -= curp - (unsigned char *) addr;
|
||||
|
||||
byte = *(curp = (unsigned char *) ++addr);
|
||||
if (++n >= len)
|
||||
/* All converted. */
|
||||
return 0;
|
||||
|
||||
cur = tbl;
|
||||
}
|
||||
else
|
||||
{
|
||||
cur = cur->val[byte].sub;
|
||||
|
||||
if (++n >= len)
|
||||
{
|
||||
error (0, 0, _("\
|
||||
incomplete character or shift sequence at end of buffer"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
byte = *++curp;
|
||||
}
|
||||
|
||||
/* We found a final byte. Write the output bytes. */
|
||||
out = cur->val[byte].out;
|
||||
for (cnt = 0; cnt < out->nbytes; ++cnt)
|
||||
fputc_unlocked (out->bytes[cnt], output);
|
||||
|
||||
addr = (char *) curp + 1;
|
||||
++n;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
process_fd (struct convtable *tbl, int fd, FILE *output)
|
||||
{
|
||||
/* we have a problem with reading from a desriptor since we must not
|
||||
provide the iconv() function an incomplete character or shift
|
||||
sequence at the end of the buffer. Since we have to deal with
|
||||
arbitrary encodings we must read the whole text in a buffer and
|
||||
process it in one step. */
|
||||
static char *inbuf = NULL;
|
||||
static size_t maxlen = 0;
|
||||
char *inptr = NULL;
|
||||
size_t actlen = 0;
|
||||
|
||||
while (actlen < maxlen)
|
||||
{
|
||||
ssize_t n = read (fd, inptr, maxlen - actlen);
|
||||
|
||||
if (n == 0)
|
||||
/* No more text to read. */
|
||||
break;
|
||||
|
||||
if (n == -1)
|
||||
{
|
||||
/* Error while reading. */
|
||||
error (0, errno, _("error while reading the input"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
inptr += n;
|
||||
actlen += n;
|
||||
}
|
||||
|
||||
if (actlen == maxlen)
|
||||
while (1)
|
||||
{
|
||||
ssize_t n;
|
||||
|
||||
/* Increase the buffer. */
|
||||
maxlen += 32768;
|
||||
inbuf = realloc (inbuf, maxlen);
|
||||
if (inbuf == NULL)
|
||||
error (0, errno, _("unable to allocate buffer for input"));
|
||||
inptr = inbuf + actlen;
|
||||
|
||||
do
|
||||
{
|
||||
n = read (fd, inptr, maxlen - actlen);
|
||||
|
||||
if (n == 0)
|
||||
/* No more text to read. */
|
||||
break;
|
||||
|
||||
if (n == -1)
|
||||
{
|
||||
/* Error while reading. */
|
||||
error (0, errno, _("error while reading the input"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
inptr += n;
|
||||
actlen += n;
|
||||
}
|
||||
while (actlen < maxlen);
|
||||
|
||||
if (n == 0)
|
||||
/* Break again so we leave both loops. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Now we have all the input in the buffer. Process it in one run. */
|
||||
return process_block (tbl, inbuf, actlen, output);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
process_file (struct convtable *tbl, FILE *input, FILE *output)
|
||||
{
|
||||
/* This should be safe since we use this function only for `stdin' and
|
||||
we haven't read anything so far. */
|
||||
return process_fd (tbl, fileno (input), output);
|
||||
}
|
@ -36,7 +36,9 @@
|
||||
#ifdef _POSIX_MAPPED_FILES
|
||||
# include <sys/mman.h>
|
||||
#endif
|
||||
#include <charmap.h>
|
||||
#include <gconv_int.h>
|
||||
#include "iconv_prog.h"
|
||||
|
||||
/* Get libc version number. */
|
||||
#include "../version.h"
|
||||
@ -94,13 +96,13 @@ static const char *to_code;
|
||||
static const char *output_file;
|
||||
|
||||
/* Nonzero if verbose ouput is wanted. */
|
||||
static int verbose;
|
||||
int verbose;
|
||||
|
||||
/* Nonzero if list of all coded character sets is wanted. */
|
||||
static int list;
|
||||
|
||||
/* If nonzero omit invalid character from output. */
|
||||
static int omit_invalid;
|
||||
int omit_invalid;
|
||||
|
||||
/* Prototypes for the functions doing the actual work. */
|
||||
static int process_block (iconv_t cd, char *addr, size_t len, FILE *output);
|
||||
@ -117,6 +119,8 @@ main (int argc, char *argv[])
|
||||
FILE *output;
|
||||
iconv_t cd;
|
||||
const char *orig_to_code;
|
||||
struct charmap_t *from_charmap = NULL;
|
||||
struct charmap_t *to_charmap = NULL;
|
||||
|
||||
/* Set locale via LC_ALL. */
|
||||
setlocale (LC_ALL, "");
|
||||
@ -179,18 +183,23 @@ main (int argc, char *argv[])
|
||||
to_code = newp;
|
||||
}
|
||||
|
||||
/* Let's see whether we have these coded character sets. */
|
||||
cd = iconv_open (to_code, from_code);
|
||||
if (cd == (iconv_t) -1)
|
||||
{
|
||||
if (errno == EINVAL)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("conversion from `%s' to `%s' not supported"),
|
||||
from_code, orig_to_code);
|
||||
else
|
||||
error (EXIT_FAILURE, errno,
|
||||
_("failed to start conversion processing"));
|
||||
}
|
||||
/* POSIX 1003.2b introduces a silly thing: the arguments to -t anf -f
|
||||
can be file names of charmaps. In this case iconv will have to read
|
||||
those charmaps and use them to do the conversion. But there are
|
||||
holes in the specification. There is nothing said that if -f is a
|
||||
charmap filename that -t must be, too. And vice versa. There is
|
||||
also no word about the symbolic names used. What if they don't
|
||||
match? */
|
||||
if (strchr (from_code, '/') != NULL)
|
||||
/* The from-name might be a charmap file name. Try reading the
|
||||
file. */
|
||||
from_charmap = charmap_read (from_code, /*0, 1*/1, 0, 0);
|
||||
|
||||
if (strchr (orig_to_code, '/') != NULL)
|
||||
/* The to-name might be a charmap file name. Try reading the
|
||||
file. */
|
||||
to_charmap = charmap_read (orig_to_code, /*0, 1,*/1,0, 0);
|
||||
|
||||
|
||||
/* Determine output file. */
|
||||
if (output_file != NULL && strcmp (output_file, "-") != 0)
|
||||
@ -202,92 +211,117 @@ main (int argc, char *argv[])
|
||||
else
|
||||
output = stdout;
|
||||
|
||||
/* Now process the remaining files. Write them to stdout or the file
|
||||
specified with the `-o' parameter. If we have no file given as
|
||||
the parameter process all from stdin. */
|
||||
if (remaining == argc)
|
||||
{
|
||||
if (process_file (cd, stdin, output) != 0)
|
||||
status = EXIT_FAILURE;
|
||||
}
|
||||
/* At this point we have to handle two cases. The first one is
|
||||
where a charmap is used for the from- or to-charset, or both. We
|
||||
handle this special since it is very different from the sane way of
|
||||
doing things. The other case allows converting using the iconv()
|
||||
function. */
|
||||
if (from_charmap != NULL || to_charmap != NULL)
|
||||
/* Construct the conversion table and do the conversion. */
|
||||
status = charmap_conversion (from_code, from_charmap, to_code, to_charmap,
|
||||
argc, remaining, argv, output);
|
||||
else
|
||||
do
|
||||
{
|
||||
struct stat st;
|
||||
char *addr;
|
||||
int fd;
|
||||
{
|
||||
/* Let's see whether we have these coded character sets. */
|
||||
cd = iconv_open (to_code, from_code);
|
||||
if (cd == (iconv_t) -1)
|
||||
{
|
||||
if (errno == EINVAL)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("conversion from `%s' to `%s' not supported"),
|
||||
from_code, orig_to_code);
|
||||
else
|
||||
error (EXIT_FAILURE, errno,
|
||||
_("failed to start conversion processing"));
|
||||
}
|
||||
|
||||
|
||||
if (verbose)
|
||||
printf ("%s:\n", argv[remaining]);
|
||||
if (strcmp (argv[remaining], "-") == 0)
|
||||
fd = 0;
|
||||
else
|
||||
/* Now process the remaining files. Write them to stdout or the file
|
||||
specified with the `-o' parameter. If we have no file given as
|
||||
the parameter process all from stdin. */
|
||||
if (remaining == argc)
|
||||
{
|
||||
if (process_file (cd, stdin, output) != 0)
|
||||
status = EXIT_FAILURE;
|
||||
}
|
||||
else
|
||||
do
|
||||
{
|
||||
fd = open (argv[remaining], O_RDONLY);
|
||||
struct stat st;
|
||||
char *addr;
|
||||
int fd;
|
||||
|
||||
if (fd == -1)
|
||||
if (verbose)
|
||||
printf ("%s:\n", argv[remaining]);
|
||||
if (strcmp (argv[remaining], "-") == 0)
|
||||
fd = 0;
|
||||
else
|
||||
{
|
||||
error (0, errno, _("cannot open input file `%s'"),
|
||||
argv[remaining]);
|
||||
status = EXIT_FAILURE;
|
||||
continue;
|
||||
fd = open (argv[remaining], O_RDONLY);
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
error (0, errno, _("cannot open input file `%s'"),
|
||||
argv[remaining]);
|
||||
status = EXIT_FAILURE;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _POSIX_MAPPED_FILES
|
||||
/* We have possibilities for reading the input file. First try
|
||||
to mmap() it since this will provide the fastest solution. */
|
||||
if (fstat (fd, &st) == 0
|
||||
&& ((addr = mmap (NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0))
|
||||
!= MAP_FAILED))
|
||||
{
|
||||
/* Yes, we can use mmap(). The descriptor is not needed
|
||||
anymore. */
|
||||
if (close (fd) != 0)
|
||||
error (EXIT_FAILURE, errno, _("error while closing input `%s'"),
|
||||
argv[remaining]);
|
||||
|
||||
if (process_block (cd, addr, st.st_size, output) < 0)
|
||||
/* We have possibilities for reading the input file. First try
|
||||
to mmap() it since this will provide the fastest solution. */
|
||||
if (fstat (fd, &st) == 0
|
||||
&& ((addr = mmap (NULL, st.st_size, PROT_READ, MAP_PRIVATE,
|
||||
fd, 0)) != MAP_FAILED))
|
||||
{
|
||||
/* Something went wrong. */
|
||||
status = EXIT_FAILURE;
|
||||
/* Yes, we can use mmap(). The descriptor is not needed
|
||||
anymore. */
|
||||
if (close (fd) != 0)
|
||||
error (EXIT_FAILURE, errno,
|
||||
_("error while closing input `%s'"),
|
||||
argv[remaining]);
|
||||
|
||||
if (process_block (cd, addr, st.st_size, output) < 0)
|
||||
{
|
||||
/* Something went wrong. */
|
||||
status = EXIT_FAILURE;
|
||||
|
||||
/* We don't need the input data anymore. */
|
||||
munmap ((void *) addr, st.st_size);
|
||||
|
||||
/* We cannot go on with producing output since it might
|
||||
lead to problem because the last output might leave
|
||||
the output stream in an undefined state. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* We don't need the input data anymore. */
|
||||
munmap ((void *) addr, st.st_size);
|
||||
|
||||
/* We cannot go on with producing output since it might
|
||||
lead to problem because the last output might leave
|
||||
the output stream in an undefined state. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* We don't need the input data anymore. */
|
||||
munmap ((void *) addr, st.st_size);
|
||||
}
|
||||
else
|
||||
else
|
||||
#endif /* _POSIX_MAPPED_FILES */
|
||||
{
|
||||
/* Read the file in pieces. */
|
||||
if (process_fd (cd, fd, output) != 0)
|
||||
{
|
||||
/* Something went wrong. */
|
||||
status = EXIT_FAILURE;
|
||||
/* Read the file in pieces. */
|
||||
if (process_fd (cd, fd, output) != 0)
|
||||
{
|
||||
/* Something went wrong. */
|
||||
status = EXIT_FAILURE;
|
||||
|
||||
/* We don't need the input file anymore. */
|
||||
/* We don't need the input file anymore. */
|
||||
close (fd);
|
||||
|
||||
/* We cannot go on with producing output since it might
|
||||
lead to problem because the last output might leave
|
||||
the output stream in an undefined state. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Now close the file. */
|
||||
close (fd);
|
||||
|
||||
/* We cannot go on with producing output since it might
|
||||
lead to problem because the last output might leave
|
||||
the output stream in an undefined state. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Now close the file. */
|
||||
close (fd);
|
||||
}
|
||||
}
|
||||
while (++remaining < argc);
|
||||
while (++remaining < argc);
|
||||
}
|
||||
|
||||
/* Close the output file now. */
|
||||
if (fclose (output))
|
||||
@ -402,7 +436,7 @@ conversion stopped due to problem in writing the output"));
|
||||
character sets we have to flush the state now. */
|
||||
outptr = outbuf;
|
||||
outlen = OUTBUF_SIZE;
|
||||
n = iconv (cd, NULL, NULL, &outptr, &outlen);
|
||||
(void) iconv (cd, NULL, NULL, &outptr, &outlen);
|
||||
|
||||
if (outptr != outbuf)
|
||||
{
|
||||
|
42
iconv/iconv_prog.h
Normal file
42
iconv/iconv_prog.h
Normal file
@ -0,0 +1,42 @@
|
||||
/* Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _ICONV_PROG_H
|
||||
#define _ICONV_PROG_H 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <charmap.h>
|
||||
|
||||
|
||||
/* Nonzero if verbose ouput is wanted. */
|
||||
extern int verbose;
|
||||
|
||||
/* If nonzero omit invalid character from output. */
|
||||
extern int omit_invalid;
|
||||
|
||||
/* Perform the conversion using a charmap or two. */
|
||||
extern int charmap_conversion (const char *from_code,
|
||||
struct charmap_t *from_charmap,
|
||||
const char *to_code,
|
||||
struct charmap_t *to_charmap,
|
||||
int argc, int remaining, char *argv[],
|
||||
FILE *output);
|
||||
|
||||
|
||||
#endif /* iconv_prog.h */
|
@ -59,13 +59,10 @@ while read from to subset targets; do
|
||||
if test -n "$targets"; then
|
||||
for t in $targets; do
|
||||
if test -f testdata/$from; then
|
||||
echo $ac_n "test data: $from -> $t $ac_c"
|
||||
echo $ac_n " test data: $from -> $t $ac_c"
|
||||
$PROG -f $from -t $t testdata/$from > $temp1 ||
|
||||
{ if test $? -gt 128; then exit 1; fi
|
||||
echo "FAILED"
|
||||
failed=1
|
||||
continue
|
||||
}
|
||||
echo "FAILED"; failed=1; continue; }
|
||||
echo $ac_n "OK$ac_c"
|
||||
if test -s testdata/$from..$t; then
|
||||
cmp $temp1 testdata/$from..$t > /dev/null 2>&1 ||
|
||||
@ -75,10 +72,7 @@ while read from to subset targets; do
|
||||
echo $ac_n " -> $from $ac_c"
|
||||
$PROG -f $t -t $to -o $temp2 $temp1 ||
|
||||
{ if test $? -gt 128; then exit 1; fi
|
||||
echo "FAILED"
|
||||
failed=1
|
||||
continue
|
||||
}
|
||||
echo "FAILED"; failed=1; continue; }
|
||||
echo $ac_n "OK$ac_c"
|
||||
test -s $temp1 && cmp testdata/$from $temp2 > /dev/null 2>&1 ||
|
||||
{ echo "/FAILED"; failed=1; continue; }
|
||||
@ -90,21 +84,45 @@ while read from to subset targets; do
|
||||
# of the coded character set we convert the text to this coded character
|
||||
# set. Otherwise we convert to all the TARGETS.
|
||||
if test $subset = Y; then
|
||||
echo $ac_n " suntzu: $from -> $t -> $to $ac_c"
|
||||
echo $ac_n " suntzu: $from -> $t -> $to $ac_c"
|
||||
$PROG -f $from -t $t testdata/suntzus |
|
||||
$PROG -f $t -t $to > $temp1 ||
|
||||
{ if test $? -gt 128; then exit 1; fi
|
||||
echo "FAILED"
|
||||
failed=1
|
||||
continue
|
||||
}
|
||||
echo "FAILED"; failed=1; continue; }
|
||||
echo $ac_n "OK$ac_c"
|
||||
cmp testdata/suntzus $temp1 ||
|
||||
{ echo "/FAILED";
|
||||
failed=1; continue; }
|
||||
{ echo "/FAILED"; failed=1; continue; }
|
||||
echo "/OK"
|
||||
fi
|
||||
rm -f $temp1
|
||||
|
||||
# And tests where iconv(1) has to handle charmaps.
|
||||
if test "$t" = UTF8; then tc=UTF-8; else tc="$t"; fi
|
||||
if test -f ../localedata/charmaps/$from &&
|
||||
test -f ../localedata/charmaps/$tc &&
|
||||
test -f testdata/$from; then
|
||||
echo $ac_n "test charmap: $from -> $t $ac_c"
|
||||
$PROG -f ../localedata/charmaps/$from -t ../localedata/charmaps/$tc \
|
||||
testdata/$from > $temp1 ||
|
||||
{ if test $? -gt 128; then exit 1; fi
|
||||
echo "FAILED"; failed=1; continue; }
|
||||
echo $ac_n "OK$ac_c"
|
||||
if test -s testdata/$from..$t; then
|
||||
cmp $temp1 testdata/$from..$t > /dev/null 2>&1 ||
|
||||
{ echo "/FAILED"; failed=1; continue; }
|
||||
echo $ac_n "/OK$ac_c"
|
||||
fi
|
||||
echo $ac_n " -> $from $ac_c"
|
||||
$PROG -t ../localedata/charmaps/$from -f ../localedata/charmaps/$tc \
|
||||
-o $temp2 $temp1 ||
|
||||
{ if test $? -gt 128; then exit 1; fi
|
||||
echo "FAILED"; failed=1; continue; }
|
||||
echo $ac_n "OK$ac_c"
|
||||
test -s $temp1 && cmp testdata/$from $temp2 > /dev/null 2>&1 ||
|
||||
{ echo "/FAILED"; failed=1; continue; }
|
||||
echo "/OK"
|
||||
rm -f $temp1 $temp2
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
@ -113,14 +131,10 @@ while read from to subset targets; do
|
||||
$PROG -f ASCII -t $to testdata/suntzus |
|
||||
$PROG -f $to -t ASCII > $temp1 ||
|
||||
{ if test $? -gt 128; then exit 1; fi
|
||||
echo "FAILED"
|
||||
failed=1
|
||||
continue
|
||||
}
|
||||
echo "FAILED"; failed=1; continue; }
|
||||
echo $ac_n "OK$ac_c"
|
||||
cmp testdata/suntzus $temp1 ||
|
||||
{ echo "/FAILED";
|
||||
failed=1; continue; }
|
||||
{ echo "/FAILED"; failed=1; continue; }
|
||||
echo "/OK"
|
||||
fi
|
||||
done < TESTS
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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"),
|
||||
"LC_COLLATE");
|
||||
}
|
||||
arg = lr_token (ldfile, charmap, NULL);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok == tok_eof)
|
||||
break;
|
||||
if (arg->tok == tok_eol)
|
||||
@ -3727,7 +3728,7 @@ error while adding equivalent collating symbol"));
|
||||
}
|
||||
|
||||
/* Prepare for the next round. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
||||
@ -1878,7 +1878,7 @@ read_translit_entry (struct linereader *ldfile, struct locale_ctype_t *ctype,
|
||||
|
||||
/* Next we have one or more transliterations. They are
|
||||
separated by semicolons. */
|
||||
now = lr_token (ldfile, charmap, repertoire);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
|
||||
if (!first && (now->tok == tok_semicolon || now->tok == tok_eol))
|
||||
{
|
||||
@ -1939,7 +1939,7 @@ read_translit_ignore_entry (struct linereader *ldfile,
|
||||
single characters, possibly defining a range when an ellipsis is used. */
|
||||
while (1)
|
||||
{
|
||||
struct token *now = lr_token (ldfile, charmap, repertoire);
|
||||
struct token *now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
struct translit_ignore_t *newp;
|
||||
uint32_t from;
|
||||
|
||||
@ -1983,7 +1983,7 @@ read_translit_ignore_entry (struct linereader *ldfile,
|
||||
|
||||
/* Now we expect either a semicolon, an ellipsis, or the end of the
|
||||
line. */
|
||||
now = lr_token (ldfile, charmap, repertoire);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
|
||||
if (now->tok == tok_ellipsis2 || now->tok == tok_ellipsis2_2)
|
||||
{
|
||||
@ -1992,7 +1992,7 @@ read_translit_ignore_entry (struct linereader *ldfile,
|
||||
uint32_t to;
|
||||
int step = now->tok == tok_ellipsis2_2 ? 2 : 1;
|
||||
|
||||
now = lr_token (ldfile, charmap, repertoire);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
|
||||
if (now->tok == tok_eol || now->tok == tok_eof)
|
||||
{
|
||||
@ -2033,7 +2033,7 @@ to-value <U%0*X> of range is smaller than from-value <U%0*X>"),
|
||||
}
|
||||
|
||||
/* And the next token. */
|
||||
now = lr_token (ldfile, charmap, repertoire);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
}
|
||||
|
||||
if (now->tok == tok_eol || now->tok == tok_eof)
|
||||
@ -2084,7 +2084,7 @@ ctype_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);
|
||||
@ -2092,18 +2092,19 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
/* If we see `copy' now we are almost done. */
|
||||
if (nowtok == tok_copy)
|
||||
{
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_string)
|
||||
{
|
||||
SYNTAX_ERROR (_("%s: syntax error"), "LC_CTYPE");
|
||||
|
||||
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_CTYPE");
|
||||
else if (now->tok != tok_lc_ctype)
|
||||
{
|
||||
@ -2132,7 +2133,7 @@ ctype_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;
|
||||
}
|
||||
|
||||
@ -2157,7 +2158,7 @@ ctype_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;
|
||||
}
|
||||
@ -2165,14 +2166,14 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
switch (nowtok)
|
||||
{
|
||||
case tok_charclass:
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
while (now->tok == tok_ident || now->tok == tok_string)
|
||||
{
|
||||
ctype_class_new (ldfile, ctype, now->val.str.startmb);
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_semicolon)
|
||||
break;
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
}
|
||||
if (now->tok != tok_eol)
|
||||
SYNTAX_ERROR (_("\
|
||||
@ -2180,14 +2181,14 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break;
|
||||
|
||||
case tok_charconv:
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
while (now->tok == tok_ident || now->tok == tok_string)
|
||||
{
|
||||
ctype_map_new (ldfile, ctype, now->val.str.startmb, charmap);
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_semicolon)
|
||||
break;
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
}
|
||||
if (now->tok != tok_eol)
|
||||
SYNTAX_ERROR (_("\
|
||||
@ -2205,7 +2206,7 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
/* We simply forget the `class' keyword and use the following
|
||||
operand to determine the bit. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok == tok_ident || now->tok == tok_string)
|
||||
{
|
||||
/* Must can be one of the predefined class names. */
|
||||
@ -2251,7 +2252,7 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
}
|
||||
|
||||
/* The next character must be a semicolon. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_semicolon)
|
||||
goto err_label;
|
||||
goto read_charclass;
|
||||
@ -2283,7 +2284,7 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
last_token = tok_none;
|
||||
ellipsis_token = tok_none;
|
||||
step = 1;
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
while (now->tok != tok_eol && now->tok != tok_eof)
|
||||
{
|
||||
uint32_t wch;
|
||||
@ -2420,7 +2421,7 @@ with character code range values one must use the absolute ellipsis `...'"));
|
||||
}
|
||||
|
||||
/* Next we expect a semicolon or the end of the line. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok == tok_eol || now->tok == tok_eof)
|
||||
break;
|
||||
|
||||
@ -2440,7 +2441,7 @@ with character code range values one must use the absolute ellipsis `...'"));
|
||||
|
||||
ellipsis_token = now->tok;
|
||||
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -2448,7 +2449,7 @@ with character code range values one must use the absolute ellipsis `...'"));
|
||||
goto err_label;
|
||||
|
||||
/* And get the next character. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
|
||||
ellipsis_token = tok_none;
|
||||
step = 1;
|
||||
@ -2523,7 +2524,7 @@ with character code range values one must use the absolute ellipsis `...'"));
|
||||
|
||||
/* We simply forget the `map' keyword and use the following
|
||||
operand to determine the mapping. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok == tok_ident || now->tok == tok_string)
|
||||
{
|
||||
size_t cnt;
|
||||
@ -2545,7 +2546,7 @@ with character code range values one must use the absolute ellipsis `...'"));
|
||||
else
|
||||
mapidx = now->tok - tok_toupper;
|
||||
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
/* This better should be a semicolon. */
|
||||
if (now->tok != tok_semicolon)
|
||||
goto err_label;
|
||||
@ -2561,7 +2562,7 @@ with character code range values one must use the absolute ellipsis `...'"));
|
||||
}
|
||||
ctype->tomap_done[mapidx] = 1;
|
||||
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
while (now->tok != tok_eol && now->tok != tok_eof)
|
||||
{
|
||||
struct charseq *from_seq;
|
||||
@ -2574,24 +2575,24 @@ with character code range values one must use the absolute ellipsis `...'"));
|
||||
goto err_label;
|
||||
|
||||
/* Next comes the from-value. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (get_character (now, charmap, repertoire, &from_seq,
|
||||
&from_wch) != 0)
|
||||
goto err_label;
|
||||
|
||||
/* The next is a comma. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_comma)
|
||||
goto err_label;
|
||||
|
||||
/* And the other value. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (get_character (now, charmap, repertoire, &to_seq,
|
||||
&to_wch) != 0)
|
||||
goto err_label;
|
||||
|
||||
/* And the last thing is the closing brace. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_close_brace)
|
||||
goto err_label;
|
||||
|
||||
@ -2613,9 +2614,9 @@ with character code range values one must use the absolute ellipsis `...'"));
|
||||
}
|
||||
|
||||
/* Now comes a semicolon or the end of the line/file. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok == tok_semicolon)
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -2627,7 +2628,7 @@ with character code range values one must use the absolute ellipsis `...'"));
|
||||
do
|
||||
{
|
||||
lr_ignore_rest (ldfile, 0);
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
}
|
||||
while (now->tok != tok_translit_end && now->tok != tok_eof);
|
||||
|
||||
@ -2650,7 +2651,7 @@ with character code range values one must use the absolute ellipsis `...'"));
|
||||
ldfile->return_widestr = 1;
|
||||
|
||||
/* We proceed until we see the `translit_end' token. */
|
||||
while (now = lr_token (ldfile, charmap, repertoire),
|
||||
while (now = lr_token (ldfile, charmap, repertoire, verbose),
|
||||
now->tok != tok_translit_end && now->tok != tok_eof)
|
||||
{
|
||||
if (now->tok == tok_eol)
|
||||
@ -2664,7 +2665,7 @@ with character code range values one must use the absolute ellipsis `...'"));
|
||||
const char *repertoire_name;
|
||||
struct translit_include_t *include_stmt, **include_ptr;
|
||||
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
/* This should be a string or an identifier. In any
|
||||
case something to name a locale. */
|
||||
if (now->tok != tok_string && now->tok != tok_ident)
|
||||
@ -2677,12 +2678,12 @@ with character code range values one must use the absolute ellipsis `...'"));
|
||||
locale_name = now->val.str.startmb;
|
||||
|
||||
/* Next should be a semicolon. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_semicolon)
|
||||
goto translit_syntax;
|
||||
|
||||
/* Now the repertoire name. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if ((now->tok != tok_string && now->tok != tok_ident)
|
||||
|| now->val.str.startmb == NULL)
|
||||
goto translit_syntax;
|
||||
@ -2716,7 +2717,7 @@ with character code range values one must use the absolute ellipsis `...'"));
|
||||
{
|
||||
/* We expect a single character or string as the
|
||||
argument. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
wstr = read_widestring (ldfile, now, charmap,
|
||||
repertoire);
|
||||
|
||||
@ -2746,7 +2747,7 @@ previous definition was here"));
|
||||
break;
|
||||
|
||||
/* Maybe there is another replacement we can use. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok == tok_eol || now->tok == tok_eof)
|
||||
{
|
||||
/* Nothing found. We tell the user. */
|
||||
@ -2837,7 +2838,7 @@ previous definition was here"));
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_CTYPE'. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok == tok_eof)
|
||||
break;
|
||||
if (now->tok == tok_eol)
|
||||
@ -2856,7 +2857,7 @@ previous definition was here"));
|
||||
}
|
||||
|
||||
/* Prepare for the next round. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
||||
@ -301,7 +301,7 @@ identification_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);
|
||||
@ -328,7 +328,7 @@ identification_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;
|
||||
}
|
||||
@ -345,7 +345,7 @@ identification_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 (identification->cat != NULL) \
|
||||
@ -386,15 +386,15 @@ identification_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
}
|
||||
|
||||
/* We expect two operands. */
|
||||
arg = lr_token (ldfile, charmap, NULL);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok != tok_string && arg->tok != tok_ident)
|
||||
goto err_label;
|
||||
/* Next is a semicolon. */
|
||||
cattok = lr_token (ldfile, charmap, NULL);
|
||||
cattok = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (cattok->tok != tok_semicolon)
|
||||
goto err_label;
|
||||
/* Now a LC_xxx identifier. */
|
||||
cattok = lr_token (ldfile, charmap, NULL);
|
||||
cattok = lr_token (ldfile, charmap, NULL, verbose);
|
||||
switch (cattok->tok)
|
||||
{
|
||||
#define CATEGORY(lname, uname) \
|
||||
@ -430,7 +430,7 @@ identification_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_IDENTIFICATION'. */
|
||||
arg = lr_token (ldfile, charmap, NULL);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok == tok_eof)
|
||||
break;
|
||||
if (arg->tok == tok_eol)
|
||||
@ -448,7 +448,7 @@ identification_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;
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
||||
@ -164,7 +164,7 @@ measurement_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);
|
||||
@ -191,7 +191,7 @@ measurement_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;
|
||||
}
|
||||
@ -208,7 +208,7 @@ measurement_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 (measurement->cat != 0) \
|
||||
@ -222,7 +222,7 @@ measurement_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_MEASUREMENT'. */
|
||||
arg = lr_token (ldfile, charmap, NULL);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok == tok_eof)
|
||||
break;
|
||||
if (arg->tok == tok_eol)
|
||||
@ -240,7 +240,7 @@ measurement_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;
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
||||
@ -245,7 +245,7 @@ messages_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);
|
||||
@ -273,7 +273,7 @@ messages_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;
|
||||
}
|
||||
@ -297,7 +297,7 @@ messages_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
lr_ignore_rest (ldfile, 0); \
|
||||
break; \
|
||||
} \
|
||||
now = lr_token (ldfile, charmap, repertoire); \
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose); \
|
||||
if (now->tok != tok_string) \
|
||||
goto syntax_error; \
|
||||
else if (!ignore_content && now->val.str.startmb == NULL) \
|
||||
@ -317,7 +317,7 @@ messages_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_MESSAGES'. */
|
||||
arg = lr_token (ldfile, charmap, NULL);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok == tok_eof)
|
||||
break;
|
||||
if (arg->tok == tok_eol)
|
||||
@ -334,7 +334,7 @@ messages_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;
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
||||
@ -642,7 +642,7 @@ monetary_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);
|
||||
@ -668,7 +668,7 @@ monetary_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;
|
||||
}
|
||||
@ -685,7 +685,7 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
now = lr_token (ldfile, charmap, NULL); \
|
||||
now = lr_token (ldfile, charmap, NULL, verbose); \
|
||||
if (now->tok != tok_string) \
|
||||
goto err_label; \
|
||||
else if (monetary->cat != NULL) \
|
||||
@ -720,7 +720,7 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
} \
|
||||
\
|
||||
ldfile->return_widestr = 1; \
|
||||
now = lr_token (ldfile, charmap, repertoire); \
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose); \
|
||||
if (now->tok != tok_string) \
|
||||
goto err_label; \
|
||||
if (monetary->cat != NULL) \
|
||||
@ -761,7 +761,7 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
now = lr_token (ldfile, charmap, NULL); \
|
||||
now = lr_token (ldfile, charmap, NULL, verbose); \
|
||||
if (now->tok != tok_minus1 && now->tok != tok_number) \
|
||||
goto err_label; \
|
||||
else if (monetary->cat != -2) \
|
||||
@ -813,7 +813,7 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break;
|
||||
}
|
||||
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_minus1 && now->tok != tok_number)
|
||||
goto err_label;
|
||||
else
|
||||
@ -861,11 +861,11 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
grouping[act++] = now->val.num;
|
||||
|
||||
/* Next must be semicolon. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_semicolon)
|
||||
break;
|
||||
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
}
|
||||
while (now->tok == tok_minus1 || now->tok == tok_number);
|
||||
|
||||
@ -891,7 +891,7 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break;
|
||||
}
|
||||
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_number)
|
||||
goto err_label;
|
||||
if (now->val.num == 0)
|
||||
@ -908,11 +908,11 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
if (!ignore_content)
|
||||
monetary->conversion_rate[0] = now->val.num;
|
||||
/* Next must be a semicolon. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_semicolon)
|
||||
goto err_label;
|
||||
/* And another number. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_number)
|
||||
goto err_label;
|
||||
if (now->val.num == 0)
|
||||
@ -925,7 +925,7 @@ monetary_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_MONETARY'. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok == tok_eof)
|
||||
break;
|
||||
if (now->tok == tok_eol)
|
||||
@ -942,7 +942,7 @@ monetary_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;
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
||||
@ -223,7 +223,7 @@ name_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);
|
||||
@ -249,7 +249,7 @@ name_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;
|
||||
}
|
||||
@ -266,7 +266,7 @@ name_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 (name->cat != NULL) \
|
||||
@ -291,7 +291,7 @@ name_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_NAME'. */
|
||||
arg = lr_token (ldfile, charmap, NULL);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok == tok_eof)
|
||||
break;
|
||||
if (arg->tok == tok_eol)
|
||||
@ -308,7 +308,7 @@ name_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;
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
||||
@ -207,7 +207,7 @@ numeric_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);
|
||||
@ -233,7 +233,7 @@ numeric_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;
|
||||
}
|
||||
@ -251,7 +251,7 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
} \
|
||||
\
|
||||
ldfile->return_widestr = 1; \
|
||||
now = lr_token (ldfile, charmap, repertoire); \
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose); \
|
||||
if (now->tok != tok_string) \
|
||||
goto err_label; \
|
||||
if (numeric->cat != NULL) \
|
||||
@ -291,7 +291,7 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break;
|
||||
}
|
||||
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_minus1 && now->tok != tok_number)
|
||||
goto err_label;
|
||||
else
|
||||
@ -338,11 +338,11 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
grouping[act++] = now->val.num;
|
||||
|
||||
/* Next must be semicolon. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_semicolon)
|
||||
break;
|
||||
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
}
|
||||
while (now->tok == tok_minus1 || now->tok == tok_number);
|
||||
|
||||
@ -361,7 +361,7 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_NUMERIC'. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok == tok_eof)
|
||||
break;
|
||||
if (now->tok == tok_eol)
|
||||
@ -378,7 +378,7 @@ numeric_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;
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
||||
@ -166,7 +166,7 @@ paper_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);
|
||||
@ -192,7 +192,7 @@ paper_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;
|
||||
}
|
||||
@ -209,7 +209,7 @@ paper_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 (paper->cat != 0) \
|
||||
@ -224,7 +224,7 @@ paper_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_PAPER'. */
|
||||
arg = lr_token (ldfile, charmap, NULL);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok == tok_eof)
|
||||
break;
|
||||
if (arg->tok == tok_eol)
|
||||
@ -241,7 +241,7 @@ paper_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;
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
||||
@ -233,7 +233,7 @@ telephone_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);
|
||||
@ -259,7 +259,7 @@ telephone_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;
|
||||
}
|
||||
@ -276,7 +276,7 @@ telephone_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 (telephone->cat != NULL) \
|
||||
@ -299,7 +299,7 @@ telephone_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_TELEPHONE'. */
|
||||
arg = lr_token (ldfile, charmap, NULL);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (arg->tok == tok_eof)
|
||||
break;
|
||||
if (arg->tok == tok_eol)
|
||||
@ -316,7 +316,7 @@ telephone_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;
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
||||
@ -904,7 +904,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
do
|
||||
{
|
||||
now = lr_token (ldfile, charmap, repertoire);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
while (nowtok == tok_eol);
|
||||
@ -930,7 +930,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
/* Ingore empty lines. */
|
||||
if (nowtok == tok_eol)
|
||||
{
|
||||
now = lr_token (ldfile, charmap, repertoire);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
nowtok = now->tok;
|
||||
continue;
|
||||
}
|
||||
@ -949,7 +949,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
\
|
||||
for (cnt = 0; cnt < max; ++cnt) \
|
||||
{ \
|
||||
now = lr_token (ldfile, charmap, repertoire); \
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose); \
|
||||
if (now->tok == tok_eol) \
|
||||
{ \
|
||||
if (cnt < min) \
|
||||
@ -981,7 +981,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
} \
|
||||
\
|
||||
/* Match the semicolon. */ \
|
||||
now = lr_token (ldfile, charmap, repertoire); \
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose); \
|
||||
if (now->tok != tok_semicolon && now->tok != tok_eol) \
|
||||
break; \
|
||||
} \
|
||||
@ -995,7 +995,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
\
|
||||
if (now->tok == tok_semicolon) \
|
||||
{ \
|
||||
now = lr_token (ldfile, charmap, repertoire); \
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose); \
|
||||
if (now->tok == tok_eol) \
|
||||
lr_error (ldfile, _("extra trailing semicolon")); \
|
||||
else if (now->tok == tok_string) \
|
||||
@ -1031,7 +1031,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
}
|
||||
do
|
||||
{
|
||||
now = lr_token (ldfile, charmap, repertoire);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (now->tok != tok_string)
|
||||
goto err_label;
|
||||
if (!ignore_content && (now->val.str.startmb == NULL
|
||||
@ -1053,7 +1053,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
* sizeof (char *));
|
||||
time->wera[time->num_era++] = now->val.str.startwc;
|
||||
}
|
||||
now = lr_token (ldfile, charmap, repertoire);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (now->tok != tok_eol && now->tok != tok_semicolon)
|
||||
goto err_label;
|
||||
}
|
||||
@ -1070,7 +1070,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
now = lr_token (ldfile, charmap, repertoire); \
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose); \
|
||||
if (now->tok != tok_string) \
|
||||
goto err_label; \
|
||||
else if (time->cat != NULL) \
|
||||
@ -1112,7 +1112,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
now = lr_token (ldfile, charmap, repertoire); \
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose); \
|
||||
if (now->tok != tok_number) \
|
||||
goto err_label; \
|
||||
else if (time->cat != 0) \
|
||||
@ -1135,25 +1135,25 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
break;
|
||||
}
|
||||
|
||||
now = lr_token (ldfile, charmap, repertoire);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (now->tok != tok_number)
|
||||
goto err_label;
|
||||
time->week_ndays = now->val.num;
|
||||
|
||||
now = lr_token (ldfile, charmap, repertoire);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (now->tok != tok_semicolon)
|
||||
goto err_label;
|
||||
|
||||
now = lr_token (ldfile, charmap, repertoire);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (now->tok != tok_number)
|
||||
goto err_label;
|
||||
time->week_1stday = now->val.num;
|
||||
|
||||
now = lr_token (ldfile, charmap, repertoire);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (now->tok != tok_semicolon)
|
||||
goto err_label;
|
||||
|
||||
now = lr_token (ldfile, charmap, repertoire);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (now->tok != tok_number)
|
||||
goto err_label;
|
||||
time->week_1stweek = now->val.num;
|
||||
@ -1163,7 +1163,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
case tok_end:
|
||||
/* Next we assume `LC_TIME'. */
|
||||
now = lr_token (ldfile, charmap, repertoire);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
if (now->tok == tok_eof)
|
||||
break;
|
||||
if (now->tok == tok_eol)
|
||||
@ -1180,7 +1180,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
}
|
||||
|
||||
/* Prepare for the next round. */
|
||||
now = lr_token (ldfile, charmap, repertoire);
|
||||
now = lr_token (ldfile, charmap, repertoire, verbose);
|
||||
nowtok = now->tok;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996,1997,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.
|
||||
|
||||
@ -31,7 +31,11 @@
|
||||
#include "charmap.h"
|
||||
#include "error.h"
|
||||
#include "linereader.h"
|
||||
#include "localedef.h"
|
||||
|
||||
/* Prototypes for a few program-wide used functions. */
|
||||
extern void *xmalloc (size_t __n);
|
||||
extern void *xrealloc (void *__p, size_t __n);
|
||||
extern char *xstrdup (const char *__str);
|
||||
|
||||
|
||||
/* Prototypes for local functions. */
|
||||
@ -40,7 +44,8 @@ static struct token *get_symname (struct linereader *lr);
|
||||
static struct token *get_ident (struct linereader *lr);
|
||||
static struct token *get_string (struct linereader *lr,
|
||||
const struct charmap_t *charmap,
|
||||
const struct repertoire_t *repertoire);
|
||||
const struct repertoire_t *repertoire,
|
||||
int verbose);
|
||||
|
||||
|
||||
struct linereader *
|
||||
@ -158,7 +163,7 @@ extern char *program_name;
|
||||
|
||||
struct token *
|
||||
lr_token (struct linereader *lr, const struct charmap_t *charmap,
|
||||
const struct repertoire_t *repertoire)
|
||||
const struct repertoire_t *repertoire, int verbose)
|
||||
{
|
||||
int ch;
|
||||
|
||||
@ -290,7 +295,7 @@ lr_token (struct linereader *lr, const struct charmap_t *charmap,
|
||||
return &lr->token;
|
||||
|
||||
case '"':
|
||||
return get_string (lr, charmap, repertoire);
|
||||
return get_string (lr, charmap, repertoire, verbose);
|
||||
|
||||
case '-':
|
||||
ch = lr_getc (lr);
|
||||
@ -563,7 +568,7 @@ get_ident (struct linereader *lr)
|
||||
|
||||
static struct token *
|
||||
get_string (struct linereader *lr, const struct charmap_t *charmap,
|
||||
const struct repertoire_t *repertoire)
|
||||
const struct repertoire_t *repertoire, int verbose)
|
||||
{
|
||||
int return_widestr = lr->return_widestr;
|
||||
char *buf;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper, <drepper@gnu.org>.
|
||||
|
||||
@ -91,7 +91,8 @@ extern void lr_close (struct linereader *lr);
|
||||
extern int lr_next (struct linereader *lr);
|
||||
extern struct token *lr_token (struct linereader *lr,
|
||||
const struct charmap_t *charmap,
|
||||
const struct repertoire_t *repertoire);
|
||||
const struct repertoire_t *repertoire,
|
||||
int verbose);
|
||||
|
||||
|
||||
#define lr_error(lr, fmt, args...) \
|
||||
|
@ -190,7 +190,7 @@ main (int argc, char *argv[])
|
||||
error (3, 0, _("FATAL: system does not define `_POSIX2_LOCALEDEF'"));
|
||||
|
||||
/* Process charmap file. */
|
||||
charmap = charmap_read (charmap_file);
|
||||
charmap = charmap_read (charmap_file, verbose, be_quiet, 1);
|
||||
|
||||
/* Add the first entry in the locale list. */
|
||||
memset (&global, '\0', sizeof (struct localedef_t));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996,1997,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.
|
||||
|
||||
@ -95,7 +95,7 @@ locfile_read (struct localedef_t *result, struct charmap_t *charmap)
|
||||
/* Parse locale definition file and store result in RESULT. */
|
||||
while (1)
|
||||
{
|
||||
struct token *now = lr_token (ldfile, charmap, NULL);
|
||||
struct token *now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
enum token_t nowtok = now->tok;
|
||||
struct token *arg;
|
||||
|
||||
@ -111,7 +111,7 @@ locfile_read (struct localedef_t *result, struct charmap_t *charmap)
|
||||
case tok_escape_char:
|
||||
case tok_comment_char:
|
||||
/* We need an argument. */
|
||||
arg = lr_token (ldfile, charmap, NULL);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
|
||||
if (arg->tok != tok_ident)
|
||||
{
|
||||
@ -138,7 +138,7 @@ argument to `%s' must be a single character"),
|
||||
|
||||
case tok_repertoiremap:
|
||||
/* We need an argument. */
|
||||
arg = lr_token (ldfile, charmap, NULL);
|
||||
arg = lr_token (ldfile, charmap, NULL, verbose);
|
||||
|
||||
if (arg->tok != tok_ident)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996,1997,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.
|
||||
|
||||
@ -54,7 +54,7 @@ handle_copy (struct linereader *ldfile, struct charmap_t *charmap,
|
||||
struct token *now;
|
||||
int warned = 0;
|
||||
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
if (now->tok != tok_string)
|
||||
lr_error (ldfile, _("expect string argument for `copy'"));
|
||||
else if (!ignore_content)
|
||||
@ -74,7 +74,7 @@ locale name should consist only of portable characters"));
|
||||
|
||||
/* The rest of the line must be empty and the next keyword must be
|
||||
`END xxx'. */
|
||||
while ((now = lr_token (ldfile, charmap, NULL))->tok != tok_end
|
||||
while ((now = lr_token (ldfile, charmap, NULL, verbose))->tok != tok_end
|
||||
&& now->tok != tok_eof)
|
||||
{
|
||||
if (warned == 0)
|
||||
@ -90,7 +90,7 @@ no other keyword shall be specified when `copy' is used"));
|
||||
if (now->tok != tok_eof)
|
||||
{
|
||||
/* Handle `END xxx'. */
|
||||
now = lr_token (ldfile, charmap, NULL);
|
||||
now = lr_token (ldfile, charmap, NULL, verbose);
|
||||
|
||||
if (now->tok != token)
|
||||
lr_error (ldfile, _("\
|
||||
|
@ -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.
|
||||
|
||||
@ -149,7 +149,7 @@ repertoire_read (const char *filename)
|
||||
while (1)
|
||||
{
|
||||
/* What's on? */
|
||||
struct token *now = lr_token (repfile, NULL, NULL);
|
||||
struct token *now = lr_token (repfile, NULL, NULL, verbose);
|
||||
enum token_t nowtok = now->tok;
|
||||
struct token *arg;
|
||||
|
||||
@ -168,7 +168,7 @@ repertoire_read (const char *filename)
|
||||
if (nowtok == tok_escape_char || nowtok == tok_comment_char)
|
||||
{
|
||||
/* We know that we need an argument. */
|
||||
arg = lr_token (repfile, NULL, NULL);
|
||||
arg = lr_token (repfile, NULL, NULL, verbose);
|
||||
|
||||
if (arg->tok != tok_ident)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user