Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update.
2001-04-06  Ulrich Drepper  <drepper@redhat.com>

	* iconv/iconv_open.c: Move strip and upstr definitions...
	* iconv/gconv_charset.h: ...here.  New file.
	* iconv/gconv_db.c (once): Move to file level.
	(do_lookup_alias): Split out from __gconv_find_transform.
	(__gconv_find_transform): Call do_lookup_alias.
	(__gconv_loopup_alias): New function.
	* locale/langinfo.h: Define _NL_*_CODESET values for all categories
	but LC_CTYPE.
	* locale/categories.def: Add entries for new _NL_*_CODESET values.
	* locale/C-ctype.c: Use _nl_C_codeset to initialize CODESET entry.
	* locale/C-address.c: Initialize _NL_*_CODESET element.
	* locale/C-collate.c: Likewise.
	* locale/C-identification.c: Likewise.
	* locale/C-measurement.c: Likewise.
	* locale/C-messages.c: Likewise.
	* locale/C-monetary.c: Likewise.
	* locale/C-name.c: Likewise.
	* locale/C-numeric.c: Likewise.
	* locale/C-paper.c: Likewise.
	* locale/C-telephone.c: Likewise.
	* locale/C-time.c: Likewise.
	* locale/localeinfo.h: Declare _nl_C_codeset.
	* locale/C_name.c: Define _nl_C_codeset.
	* locale/findlocale.c: Before accepting locale check that the used
	charset does not conflict with what the locale name said.
	* locale/programs/ld-address.c: Emit codeset information.
	* locale/programs/ld-collate.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.

	* localedata/tests-mbwc/tst_funcs.h (TST_HEAD_LOCALE): It is an error
	if the locale data couldn't be found.

	* string/Makefile: Define tst-strxfrm-ENV.

	* ysdeps/unix/sysv/linux/ia64/getcontext.S: Fix comment.
  • Loading branch information
Ulrich Drepper committed Apr 6, 2001
1 parent ee62473 commit e7f21fa
Show file tree
Hide file tree
Showing 34 changed files with 329 additions and 53 deletions.
46 changes: 46 additions & 0 deletions ChangeLog
@@ -1,3 +1,49 @@
2001-04-06 Ulrich Drepper <drepper@redhat.com>

* iconv/iconv_open.c: Move strip and upstr definitions...
* iconv/gconv_charset.h: ...here. New file.
* iconv/gconv_db.c (once): Move to file level.
(do_lookup_alias): Split out from __gconv_find_transform.
(__gconv_find_transform): Call do_lookup_alias.
(__gconv_loopup_alias): New function.
* locale/langinfo.h: Define _NL_*_CODESET values for all categories
but LC_CTYPE.
* locale/categories.def: Add entries for new _NL_*_CODESET values.
* locale/C-ctype.c: Use _nl_C_codeset to initialize CODESET entry.
* locale/C-address.c: Initialize _NL_*_CODESET element.
* locale/C-collate.c: Likewise.
* locale/C-identification.c: Likewise.
* locale/C-measurement.c: Likewise.
* locale/C-messages.c: Likewise.
* locale/C-monetary.c: Likewise.
* locale/C-name.c: Likewise.
* locale/C-numeric.c: Likewise.
* locale/C-paper.c: Likewise.
* locale/C-telephone.c: Likewise.
* locale/C-time.c: Likewise.
* locale/localeinfo.h: Declare _nl_C_codeset.
* locale/C_name.c: Define _nl_C_codeset.
* locale/findlocale.c: Before accepting locale check that the used
charset does not conflict with what the locale name said.
* locale/programs/ld-address.c: Emit codeset information.
* locale/programs/ld-collate.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.

* localedata/tests-mbwc/tst_funcs.h (TST_HEAD_LOCALE): It is an error
if the locale data couldn't be found.

* string/Makefile: Define tst-strxfrm-ENV.

* ysdeps/unix/sysv/linux/ia64/getcontext.S: Fix comment.

2001-04-06 Andreas Jaeger <aj@suse.de>

* include/sys/profil.h: New file.
Expand Down
60 changes: 60 additions & 0 deletions iconv/gconv_charset.h
@@ -0,0 +1,60 @@
/* Charset name normalization.
Copyright (C) 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.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 <ctype.h>


static inline void
strip (char *wp, const char *s)
{
int slash_count = 0;

while (*s != '\0')
{
if (isalnum (*s) || *s == '_' || *s == '-' || *s == '.')
*wp++ = toupper (*s);
else if (*s == '/')
{
if (++slash_count == 3)
break;
*wp++ = '/';
}
++s;
}

while (slash_count++ < 2)
*wp++ = '/';

*wp = '\0';
}


static char *
upstr (char *dst, const char *str)
{
char *cp = dst;
while ((*cp++ = toupper (*str++)) != '\0')
/* nothing */;
return dst;
}


/* If NAME is an codeset alias expand it. */
extern const char *__gconv_lookup_alias (const char *name);
39 changes: 28 additions & 11 deletions iconv/gconv_db.c
Expand Up @@ -614,13 +614,38 @@ find_derivation (const char *toset, const char *toset_expand,
}


/* Control of initialization. */
__libc_once_define (static, once);


static const char *
do_lookup_alias (const char *name)
{
struct gconv_alias key;
struct gconv_alias **found;

key.fromname = (char *) name;
found = __tfind (&key, &__gconv_alias_db, __gconv_alias_compare);
return found != NULL ? (*found)->toname : NULL;
}


const char *
__gconv_lookup_alias (const char *name)
{
/* Ensure that the configuration data is read. */
__libc_once (once, __gconv_read_conf);

return do_lookup_alias (name) ?: name;
}


int
internal_function
__gconv_find_transform (const char *toset, const char *fromset,
struct __gconv_step **handle, size_t *nsteps,
int flags)
{
__libc_once_define (static, once);
const char *fromset_expand = NULL;
const char *toset_expand = NULL;
int result;
Expand All @@ -641,16 +666,8 @@ __gconv_find_transform (const char *toset, const char *fromset,
/* See whether the names are aliases. */
if (__gconv_alias_db != NULL)
{
struct gconv_alias key;
struct gconv_alias **found;

key.fromname = (char *) fromset;
found = __tfind (&key, &__gconv_alias_db, __gconv_alias_compare);
fromset_expand = found != NULL ? (*found)->toname : NULL;

key.fromname = (char *) toset;
found = __tfind (&key, &__gconv_alias_db, __gconv_alias_compare);
toset_expand = found != NULL ? (*found)->toname : NULL;
fromset_expand = do_lookup_alias (fromset);
toset_expand = do_lookup_alias (toset);
}

if (__builtin_expect (flags & GCONV_AVOID_NOCONV, 0)
Expand Down
7 changes: 4 additions & 3 deletions locale/C-address.c
@@ -1,4 +1,4 @@
/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
Expand Down Expand Up @@ -31,7 +31,7 @@ const struct locale_data _nl_C_LC_ADDRESS =
UNDELETABLE,
0,
NULL,
12,
13,
{
{ string: "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N" },
{ string: "" },
Expand All @@ -44,6 +44,7 @@ const struct locale_data _nl_C_LC_ADDRESS =
{ string: "" },
{ string: "" },
{ string: "" },
{ string: "" }
{ string: "" },
{ string: _nl_C_codeset }
}
};
8 changes: 5 additions & 3 deletions locale/C-collate.c
@@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1995,1996,1997,1999,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
Expand Down Expand Up @@ -105,7 +105,7 @@ const struct locale_data _nl_C_LC_COLLATE =
UNDELETABLE,
0,
NULL,
18,
19,
{
/* _NL_COLLATE_NRULES */
{ word: 0 },
Expand Down Expand Up @@ -142,6 +142,8 @@ const struct locale_data _nl_C_LC_COLLATE =
/* _NL_COLLATE_COLLSEQMB */
{ string: collseqmb },
/* _NL_COLLATE_COLLSEQWC */
{ string: (const char *) collseqwc }
{ string: (const char *) collseqwc },
/* _NL_COLLATE_CODESET */
{ string: _nl_C_codeset }
}
};
4 changes: 2 additions & 2 deletions locale/C-ctype.c
@@ -1,4 +1,4 @@
/* Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
Expand Down Expand Up @@ -590,7 +590,7 @@ const struct locale_data _nl_C_LC_CTYPE =
/* _NL_CTYPE_MB_CUR_MAX */
{ word: 1 },
/* _NL_CTYPE_CODESET_NAME */
{ string: "ANSI_X3.4-1968" },
{ string: _nl_C_codeset },
/* _NL_CTYPE_TOUPPER32 */
{ string: (const char *) &_nl_C_LC_CTYPE_toupper[128] },
/* _NL_CTYPE_TOLOWER32 */
Expand Down
7 changes: 4 additions & 3 deletions locale/C-identification.c
@@ -1,4 +1,4 @@
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
Expand Down Expand Up @@ -31,7 +31,7 @@ const struct locale_data _nl_C_LC_IDENTIFICATION =
UNDELETABLE,
0,
NULL,
15,
16,
{
{ string: "ISO/IEC 14652 i18n FDCC-set" },
{ string: "ISO/IEC JTC1/SC22/WG20 - internationalization" },
Expand All @@ -51,6 +51,7 @@ const struct locale_data _nl_C_LC_IDENTIFICATION =
"i18n:1999\0" "i18n:1999\0" "\0" "i18n:1999\0"
"i18n:1999\0" "i18n:1999\0" "i18n:1999\0" "i18n:1999\0"
"i18n:1999\0" "i18n:1999\0" "i18n:1999\0" "i18n:1999\0"
"i18n:1999" }
"i18n:1999" },
{ string: _nl_C_codeset }
}
};
7 changes: 4 additions & 3 deletions locale/C-measurement.c
@@ -1,4 +1,4 @@
/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
Expand Down Expand Up @@ -31,8 +31,9 @@ const struct locale_data _nl_C_LC_MEASUREMENT =
UNDELETABLE,
0,
NULL,
1,
2,
{
{ string: "\1" }
{ string: "\1" },
{ string: _nl_C_codeset }
}
};
7 changes: 4 additions & 3 deletions locale/C-messages.c
@@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
Expand Down Expand Up @@ -31,11 +31,12 @@ const struct locale_data _nl_C_LC_MESSAGES =
UNDELETABLE,
0,
NULL,
4,
5,
{
{ string: "^[yY]" },
{ string: "^[nN]" },
{ string: "" },
{ string: "" }
{ string: "" },
{ string: _nl_C_codeset }
}
};
7 changes: 4 additions & 3 deletions locale/C-monetary.c
@@ -1,4 +1,4 @@
/* Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
Expand Down Expand Up @@ -35,7 +35,7 @@ const struct locale_data _nl_C_LC_MONETARY =
UNDELETABLE,
0,
NULL,
45,
46,
{
{ string: "" },
{ string: "" },
Expand Down Expand Up @@ -81,6 +81,7 @@ const struct locale_data _nl_C_LC_MONETARY =
{ word: 99991231 },
{ word: 1 },
{ word: (unsigned int) L'\0' },
{ word: (unsigned int) L'\0' }
{ word: (unsigned int) L'\0' },
{ string: _nl_C_codeset }
}
};
7 changes: 4 additions & 3 deletions locale/C-name.c
@@ -1,4 +1,4 @@
/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
Expand Down Expand Up @@ -31,13 +31,14 @@ const struct locale_data _nl_C_LC_NAME =
UNDELETABLE,
0,
NULL,
6,
7,
{
{ string: "%p%t%g%t%m%t%f" },
{ string: "" },
{ string: "" },
{ string: "" },
{ string: "" },
{ string: "" }
{ string: "" },
{ string: _nl_C_codeset }
}
};
7 changes: 4 additions & 3 deletions locale/C-numeric.c
@@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
Expand Down Expand Up @@ -28,12 +28,13 @@ const struct locale_data _nl_C_LC_NUMERIC =
UNDELETABLE,
0,
NULL,
5,
6,
{
{ string: "." },
{ string: "" },
{ string: "" },
{ word: (unsigned int) L'.' },
{ word: (unsigned int) L'\0' }
{ word: (unsigned int) L'\0' },
{ string: _nl_C_codeset }
}
};
7 changes: 4 additions & 3 deletions locale/C-paper.c
@@ -1,4 +1,4 @@
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
Expand Down Expand Up @@ -31,9 +31,10 @@ const struct locale_data _nl_C_LC_PAPER =
UNDELETABLE,
0,
NULL,
2,
3,
{
{ word: 297 },
{ word: 210 }
{ word: 210 },
{ string: _nl_C_codeset }
}
};

0 comments on commit e7f21fa

Please sign in to comment.