diff options
author | Roland McGrath <roland@gnu.org> | 1996-06-19 05:38:55 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-06-19 05:38:55 +0000 |
commit | 6990326c21e6d767e3531a00782af1e091eab4fe (patch) | |
tree | 152c349333df65328c835486fe719a4488856c90 /locale | |
parent | bd1be8ec88e0e9b7c0dc8d4c0ebfea69a11290f7 (diff) | |
download | glibc-6990326c21e6d767e3531a00782af1e091eab4fe.zip glibc-6990326c21e6d767e3531a00782af1e091eab4fe.tar.gz glibc-6990326c21e6d767e3531a00782af1e091eab4fe.tar.bz2 |
Wed Jun 19 01:27:57 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* math/Makefile (distribute): Add ieee-math.c.
Wed Jun 19 03:24:58 1996 Ulrich Drepper <drepper@cygnus.com>
* locale/codeset_name.c: New file. Provide function for information
about currently used character set.
* locale/Makefile (routines): Add codeset_name.
* locale/langinfo.h (_NL_CTYPE_CODESET_NAME): Add new constant.
* locale/localeinfo.h: Change magic number because of incompatible
change.
* locale/C-ctype.c: Add initializer for new field `codeset_name'.
* locale/programs/ld-ctype.c: Implement handling of `codeset_name'.
* locale/programs/locfile.c: Don't depend in pre-2.0 Linux specific
name `MAX_IOVEC'. Instead use standard name `UIO_MAXIOV'.
* locale/setlocale.c (setlocale): Initialize local variables to
prevent warnings.
Diffstat (limited to 'locale')
-rw-r--r-- | locale/C-ctype.c | 3 | ||||
-rw-r--r-- | locale/Makefile | 2 | ||||
-rw-r--r-- | locale/codeset_name.c | 31 | ||||
-rw-r--r-- | locale/langinfo.h | 1 | ||||
-rw-r--r-- | locale/localeinfo.h | 2 | ||||
-rw-r--r-- | locale/programs/ld-ctype.c | 9 | ||||
-rw-r--r-- | locale/programs/locfile.c | 6 | ||||
-rw-r--r-- | locale/setlocale.c | 4 |
8 files changed, 48 insertions, 10 deletions
diff --git a/locale/C-ctype.c b/locale/C-ctype.c index 0eb131c..0cbae19 100644 --- a/locale/C-ctype.c +++ b/locale/C-ctype.c @@ -920,6 +920,7 @@ const struct locale_data _nl_C_LC_CTYPE = "print\0" "graph\0" "blank\0" "cntrl\0" "punct\0" "alnum\0" }, { string: "tolower\0" "toupper\0" }, { string: _nl_C_LC_CTYPE_width }, - { word: 2 } + { word: 2 }, + { string: "ISO_646.IRV:1983" } } }; diff --git a/locale/Makefile b/locale/Makefile index 2ee2650..8069e7e 100644 --- a/locale/Makefile +++ b/locale/Makefile @@ -29,7 +29,7 @@ distribute = localeinfo.h categories.def \ locfile-kw.gperf locfile-kw.h linereader.h \ locales.h locfile.h stringtrans.h weight.h charset.h routines = setlocale findlocale loadlocale localeconv nl_langinfo \ - mb_cur_max + mb_cur_max codeset_name categories = ctype messages monetary numeric time collate aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name others = localedef locale diff --git a/locale/codeset_name.c b/locale/codeset_name.c new file mode 100644 index 0000000..c7fd818 --- /dev/null +++ b/locale/codeset_name.c @@ -0,0 +1,31 @@ +/* Internal function to return the name of the current codeset. +Copyright (C) 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + +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 <langinfo.h> +#include <locale.h> +#include <stdlib.h> +#include "localeinfo.h" + + +const char * +__ctype_get_codeset_name (void) +{ + return _NL_CURRENT (LC_CTYPE, _NL_CTYPE_CODESET_NAME); +} diff --git a/locale/langinfo.h b/locale/langinfo.h index 3490045..4f0a58f 100644 --- a/locale/langinfo.h +++ b/locale/langinfo.h @@ -134,6 +134,7 @@ typedef enum _NL_CTYPE_MAP_NAMES, _NL_CTYPE_WIDTH, _NL_CTYPE_MB_CUR_MAX, + _NL_CTYPE_CODESET_NAME, _NL_NUM_LC_CTYPE, /* LC_MONETARY category: formatting of monetary quantities. diff --git a/locale/localeinfo.h b/locale/localeinfo.h index 9d4b302..d24a9da 100644 --- a/locale/localeinfo.h +++ b/locale/localeinfo.h @@ -27,7 +27,7 @@ Cambridge, MA 02139, USA. */ #include "../intl/loadinfo.h" /* For loaded_l10nfile definition. */ /* Magic number at the beginning of a locale data file for CATEGORY. */ -#define LIMAGIC(category) (0x960528de ^ (category)) +#define LIMAGIC(category) (0x960617de ^ (category)) /* Two special weight constants for the collation data. */ #define FORWARD_CHAR ((wchar_t) 0xfffffffd) diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index c4a6f7b..4c74549 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -109,6 +109,7 @@ struct locale_ctype_t u_int32_t *map_name_ptr; unsigned char *width; u_int32_t mb_cur_max; + const char *codeset_name; }; @@ -475,6 +476,9 @@ ctype_output (struct localedef_t *locale, struct charset_t *charset, CTYPE_DATA (_NL_CTYPE_MB_CUR_MAX, &ctype->mb_cur_max, sizeof (u_int32_t)); + CTYPE_DATA (_NL_CTYPE_CODESET_NAME, + ctype->codeset_name, strlen (ctype->codeset_name) + 1); + default: assert (! "unknown CTYPE element"); } @@ -1382,4 +1386,9 @@ Computing table size for character classes might take a while..."), character representation. We compute the number of bytes used for the UTF-8 encoded form. */ ctype->mb_cur_max = ((int []) { 2, 3, 5, 6 }) [charset->mb_cur_max - 1]; + + /* We need the name of the currently used 8-bit character set to + make correct conversion between this 8-bit representation and the + ISO 10646 character set used internally for wide characters. */ + ctype->codeset_name = charset->code_set_name; } diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c index 3bbe479..284c7ce 100644 --- a/locale/programs/locfile.c +++ b/locale/programs/locfile.c @@ -963,11 +963,7 @@ write_locale_data (const char *output_path, const char *category, limitation of the implementation. */ for (cnt = 0; cnt < n_elem; cnt += step) { - /* XXX Fixme: should be in libc header. */ -#ifndef MAX_IOVEC -# define MAX_IOVEC 8 -#endif - step = MIN (MAX_IOVEC, n_elem - cnt); + step = MIN (UIO_MAXIOV, n_elem - cnt); if (writev (fd, &vec[cnt], step) < 0) { diff --git a/locale/setlocale.c b/locale/setlocale.c index 6eb6d98..98a4ffe 100644 --- a/locale/setlocale.c +++ b/locale/setlocale.c @@ -367,8 +367,8 @@ setlocale (int category, const char *locale) } else { - const struct locale_data *newdata; - char *newname; + const struct locale_data *newdata = NULL; + char *newname = NULL; if (_nl_current[category] != NULL) { |