aboutsummaryrefslogtreecommitdiff
path: root/locale
diff options
context:
space:
mode:
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 ea990da..0eb131c 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 d7941d6..e0618c0 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 f65140f..d3caef2 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 af081e7..3490045 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 ac14626..9d4b302 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 0000000..750d215
--- /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 9612498..c4a6f7b 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];
}