aboutsummaryrefslogtreecommitdiff
path: root/locale
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-05-29 04:48:04 +0000
committerRoland McGrath <roland@gnu.org>1996-05-29 04:48:04 +0000
commit0200214b288810fc261b0b65c32f7068fcfa9b40 (patch)
treea488a0a435ccf62b0870121b839b08de0d37a9b5 /locale
parent215dbbb1508bd6b86211112dd5ddaf9bd2290690 (diff)
downloadglibc-0200214b288810fc261b0b65c32f7068fcfa9b40.tar
glibc-0200214b288810fc261b0b65c32f7068fcfa9b40.tar.gz
glibc-0200214b288810fc261b0b65c32f7068fcfa9b40.tar.bz2
glibc-0200214b288810fc261b0b65c32f7068fcfa9b40.zip
Tue May 28 04:38:10 1996 Ulrich Drepper <drepper@cygnus.com>
* limits.h: Change MB_LEN_MAX to 6. A 31-bit ISO 10646 character in UTF-8 encoding has that many bytes. * locale/langinfo.h: New element _NL_CTYPE_MB_CUR_MAX. * locale/categories.def: Add description of field _NL_CTYPE_MB_CUR_MAX. * locale/Makefile (routines): Add mb_cur_max. * locale/mb_cur_max.c: New file. This function gets called when the macro MB_CUR_MAX is used. * locale/C-ctype.c: Initialize new mb_cur_max field. * locale/localeinfo.h: Change magic value because of incompatible change. * locale/programs/ld-ctype.c: Determine value of mb_cur_max according to current character set and write it out with the rest. * stdlib/stdlib.h (MB_CUR_MAX): Not constant anymore. Get value according to currently used locale for catefory LC_CTYPE by calling the function __ctype_get_mb_cur_max. Tue May 28 03:27:46 1996 Ulrich Drepper <drepper@cygnus.com> * FAQ: Fix some typos. Tell that for Linux the kernel header files are necessary. * PROJECTS: New file. List of open jobs for glibc. * Makefile (distribute): Add PROJECTS. * crypt/GNUmakefile (headers): New variable. Mention crypt.h. * crypt/crypt.h: Header for crypt functions. * elf/elf.h: Add some new constants from recent Cygnus ELF header files. * login/getutid_r.c: Test for correct type. Don't depend on ut_type and ut_id unless _HAVE_UT_TYPE and _HAVE_UT_ID resp. are defined. Make really compliant with specification. * login/getutline_r.c, login/pututline_r.c: Don't depend on ut_type and ut_id unless _HAVE_UT_TYPE and _HAVE_UT_ID resp. are defined. Make really compliant with specification. * login/setutent_r.c: Don't depend on ut_type and ut_id unless _HAVE_UT_TYPE and _HAVE_UT_ID resp. are defined. * login/login.c, login/logout.c, login/logwtmp.c: Complete rewrite. Now based on getut*/setut* functions. * stdlib/strtol.c: Undo changes of Wed May 22 01:48:54 1996. This prevented using this file in other GNU packages. * sysdeps/gnu/utmpbits.h: Define _HAVE_UT_TYPE, _HAVE_UT_ID, and _HAVE_UT_TV because struct utmp has these members. * sysdeps/libm-i387/e_exp.S: Correct exp(+-Inf) case. * utmp.h: New file. Wrapper around login/utmp.h. * elf/dl-error.c (struct catch): New type. (catch): New static variable, struct catch *. (catch_env, signalled_errstring, signalled_objname): Variables removed. (_dl_signal_error): If CATCH is non-null, set its errstring and objname members and jump to CATCH->env. If it is null, call _dl_sysdep_fatal with a standard message. * elf/rtld.c (dl_main): Explode `doit' function into dl_main's body. No longer use _dl_catch_error.
Diffstat (limited to 'locale')
-rw-r--r--locale/C-ctype.c5
-rw-r--r--locale/Makefile3
-rw-r--r--locale/categories.def1
-rw-r--r--locale/langinfo.h1
-rw-r--r--locale/localeinfo.h2
-rw-r--r--locale/mb_cur_max.c32
-rw-r--r--locale/programs/ld-ctype.c10
7 files changed, 50 insertions, 4 deletions
diff --git a/locale/C-ctype.c b/locale/C-ctype.c
index ea990da8af..0eb131c050 100644
--- a/locale/C-ctype.c
+++ b/locale/C-ctype.c
@@ -898,7 +898,7 @@ const struct locale_data _nl_C_LC_CTYPE =
{
_nl_C_name,
NULL, 0, /* no file mapped */
- 13,
+ 14,
{
{ string: _nl_C_LC_CTYPE_class },
#if BYTE_ORDER == LITTLE_ENDIAN
@@ -919,6 +919,7 @@ const struct locale_data _nl_C_LC_CTYPE =
{ string: "upper\0" "lower\0" "alpha\0" "digit\0" "xdigit\0" "space\0"
"print\0" "graph\0" "blank\0" "cntrl\0" "punct\0" "alnum\0" },
{ string: "tolower\0" "toupper\0" },
- { string: _nl_C_LC_CTYPE_width }
+ { string: _nl_C_LC_CTYPE_width },
+ { word: 2 }
}
};
diff --git a/locale/Makefile b/locale/Makefile
index d7941d689f..e0618c0a01 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -28,7 +28,8 @@ distribute = localeinfo.h categories.def \
charmap-kw.gperf charmap-kw.h locfile-token.h \
locfile-kw.gperf locfile-kw.h linereader.h \
locales.h locfile.h stringtrans.h
-routines = setlocale findlocale loadlocale localeconv nl_langinfo
+routines = setlocale findlocale loadlocale localeconv nl_langinfo \
+ mb_cur_max
categories = ctype messages monetary numeric time collate
aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name
others = localedef locale
diff --git a/locale/categories.def b/locale/categories.def
index f65140f7af..d3caef2265 100644
--- a/locale/categories.def
+++ b/locale/categories.def
@@ -74,6 +74,7 @@ DEFINE_CATEGORY
DEFINE_ELEMENT (_NL_CTYPE_CLASS_NAMES, "ctype-class-names", std, string)
DEFINE_ELEMENT (_NL_CTYPE_MAP_NAMES, "ctype-map-names", std, string)
DEFINE_ELEMENT (_NL_CTYPE_WIDTH, "ctype-width", std, bytearray)
+ DEFINE_ELEMENT (_NL_CTYPE_MB_CUR_MAX, "ctype-mb-cur-max", std, word)
), _nl_postload_ctype, ctype_input, ctype_check, ctype_output)
diff --git a/locale/langinfo.h b/locale/langinfo.h
index af081e7614..3490045654 100644
--- a/locale/langinfo.h
+++ b/locale/langinfo.h
@@ -133,6 +133,7 @@ typedef enum
_NL_CTYPE_CLASS_NAMES,
_NL_CTYPE_MAP_NAMES,
_NL_CTYPE_WIDTH,
+ _NL_CTYPE_MB_CUR_MAX,
_NL_NUM_LC_CTYPE,
/* LC_MONETARY category: formatting of monetary quantities.
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
index ac14626dc0..9d4b302b01 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) (0x960316de ^ (category))
+#define LIMAGIC(category) (0x960528de ^ (category))
/* Two special weight constants for the collation data. */
#define FORWARD_CHAR ((wchar_t) 0xfffffffd)
diff --git a/locale/mb_cur_max.c b/locale/mb_cur_max.c
new file mode 100644
index 0000000000..750d2155c8
--- /dev/null
+++ b/locale/mb_cur_max.c
@@ -0,0 +1,32 @@
+/* Return number of characters in multibyte representation for current
+ character set.
+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"
+
+
+int
+__ctype_get_mb_cur_max (void)
+{
+ return _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX);
+}
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index 96124988ce..c4a6f7ba64 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -108,6 +108,7 @@ struct locale_ctype_t
u_int32_t *class_name_ptr;
u_int32_t *map_name_ptr;
unsigned char *width;
+ u_int32_t mb_cur_max;
};
@@ -471,6 +472,9 @@ ctype_output (struct localedef_t *locale, struct charset_t *charset,
CTYPE_DATA (_NL_CTYPE_WIDTH,
ctype->width, ctype->plane_size * ctype->plane_cnt);
+ CTYPE_DATA (_NL_CTYPE_MB_CUR_MAX,
+ &ctype->mb_cur_max, sizeof (u_int32_t));
+
default:
assert (! "unknown CTYPE element");
}
@@ -1372,4 +1376,10 @@ Computing table size for character classes might take a while..."),
= charset->width_rules[cnt].width;
}
}
+
+ /* Compute MB_CUR_MAX. Please note the value mb_cur_max in the
+ character set definition gives the number of bytes in the wide
+ 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];
}