summaryrefslogtreecommitdiff
path: root/libc/locale
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2009-07-29 15:58:14 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2009-07-29 15:58:14 +0000
commit4d6da0374a6f9e36702cb9fbc7418d144cd62410 (patch)
tree2bb034af8c0fbf06bc06b9e485e17ae16cdd1b8a /libc/locale
parentdccd0f1fe606c19588c65468c90060350f5d368b (diff)
Merge changes between r8623 and r8721 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@8722 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/locale')
-rw-r--r--libc/locale/C-ctype.c6
-rw-r--r--libc/locale/langinfo.h1
-rw-r--r--libc/locale/localeinfo.h4
-rw-r--r--libc/locale/programs/ld-ctype.c27
4 files changed, 34 insertions, 4 deletions
diff --git a/libc/locale/C-ctype.c b/libc/locale/C-ctype.c
index 72666f2f5..1b2792a03 100644
--- a/libc/locale/C-ctype.c
+++ b/libc/locale/C-ctype.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2002, 2003, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
@@ -531,7 +531,7 @@ _nl_C_LC_CTYPE_width attribute_hidden =
};
/* Number of fields with fixed meanings, starting at 0. */
-#define NR_FIXED 71
+#define NR_FIXED 72
/* Number of class fields, starting at CLASS_OFFSET. */
#define NR_CLASSES 12
/* Number of map fields, starting at MAP_OFFSET. */
@@ -687,6 +687,8 @@ const struct locale_data _nl_C_LC_CTYPE attribute_hidden =
{ .wstr = NULL },
/* _NL_CTYPE_MAP_TO_NONASCII */
{ .word = 0 },
+ /* _NL_CTYPE_NONASCII_CASE */
+ { .word = 0 },
/* NR_CLASSES wctype_tables */
{ .string = (const char *) _nl_C_LC_CTYPE_class_upper.header },
{ .string = (const char *) _nl_C_LC_CTYPE_class_lower.header },
diff --git a/libc/locale/langinfo.h b/libc/locale/langinfo.h
index 59017b31c..c940c743a 100644
--- a/libc/locale/langinfo.h
+++ b/libc/locale/langinfo.h
@@ -334,6 +334,7 @@ enum
_NL_CTYPE_TRANSLIT_IGNORE_LEN,
_NL_CTYPE_TRANSLIT_IGNORE,
_NL_CTYPE_MAP_TO_NONASCII,
+ _NL_CTYPE_NONASCII_CASE,
_NL_CTYPE_EXTRA_MAP_1,
_NL_CTYPE_EXTRA_MAP_2,
_NL_CTYPE_EXTRA_MAP_3,
diff --git a/libc/locale/localeinfo.h b/libc/locale/localeinfo.h
index 3661080bb..19ea41ae6 100644
--- a/libc/locale/localeinfo.h
+++ b/libc/locale/localeinfo.h
@@ -1,5 +1,5 @@
/* Declarations for internal libc locale interfaces
- Copyright (C) 1995-2003, 2005, 2006, 2007, 2008
+ Copyright (C) 1995-2003, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -35,6 +35,8 @@
#define LIMAGIC(category) \
(category == LC_COLLATE \
? ((unsigned int) (0x20051014 ^ (category))) \
+ : category == LC_CTYPE \
+ ? ((unsigned int) (0x20090720 ^ (category))) \
: ((unsigned int) (0x20031115 ^ (category))))
/* Two special weight constants for the collation data. */
diff --git a/libc/locale/programs/ld-ctype.c b/libc/locale/programs/ld-ctype.c
index 2a4eae7f3..65adc0d75 100644
--- a/libc/locale/programs/ld-ctype.c
+++ b/libc/locale/programs/ld-ctype.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2006, 2007, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -223,6 +223,7 @@ struct locale_ctype_t
size_t default_missing_lineno;
uint32_t to_nonascii;
+ uint32_t nonascii_case;
/* The arrays for the binary representation. */
char_class_t *ctype_b;
@@ -666,6 +667,27 @@ character <SP> not defined in character map")));
else
ctype->class256_collection[space_seq->bytes[0]] |= BIT (tok_print);
+ /* Check whether all single-byte characters make to their upper/lowercase
+ equivalent according to the ASCII rules. */
+ for (cnt = 'A'; cnt <= 'Z'; ++cnt)
+ {
+ uint32_t uppval = ctype->map256_collection[0][cnt];
+ uint32_t lowval = ctype->map256_collection[1][cnt];
+ uint32_t lowuppval = ctype->map256_collection[0][lowval];
+ uint32_t lowlowval = ctype->map256_collection[1][lowval];
+
+ if (uppval != cnt
+ || lowval != cnt + 0x20
+ || lowuppval != cnt
+ || lowlowval != cnt + 0x20)
+ ctype->nonascii_case = 1;
+ }
+ for (cnt = 0; cnt < 256; ++cnt)
+ if (cnt < 'A' || (cnt > 'Z' && cnt < 'a') || cnt > 'z')
+ if (ctype->map256_collection[0][cnt] != cnt
+ || ctype->map256_collection[1][cnt] != cnt)
+ ctype->nonascii_case = 1;
+
/* Now that the tests are done make sure the name array contains all
characters which are handled in the WIDTH section of the
character set definition file. */
@@ -1036,6 +1058,9 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap,
CTYPE_UINT32 (_NL_CTYPE_MAP_TO_NONASCII, ctype->to_nonascii);
+ CTYPE_DATA (_NL_CTYPE_NONASCII_CASE,
+ &ctype->nonascii_case, sizeof (uint32_t));
+
case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS_MB_LEN):
add_locale_uint32 (&file, ctype->mbdigits_act / 10);
break;