From f0c7c524bb92cdc42cc4e0f7ba1ddda865a4494c Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 16 Nov 2003 07:14:28 +0000 Subject: Update. * posix/regex_internal.h: Add forward declaration of re_dfa_t. Replace last two parameters of re_string_allocate and re_string_construct with pointer to DFA. (re_dfa_t): Add map_notascii field. * posix/regcomp.c (re_compile_internal): Add call of re_string_construct. (init_dfa): Initialize mpa_notascii. * posix/regex_internal.c: Adjust definitions of re_string_allocate and re_string_construct. Pass DFA to re_string_construct. Adjust definition. Initialize map_notascii field. (build_wcs_upper_buffer): If map_notascii is zero use simplfied method to map ASCII values to upper case. * posix/regex.c: Include localeinfo.h. * posix/regexec.c: Adjust call of re_string_allocate. * locale/langinfo.h: Add _NL_CTYPE_MAP_TO_NONASCII. * locale/localeinfo.h (LIMAGIC): Change value. * locale/categories.def. Add entry for _NL_CTYPE_MAP_TO_NONASCII. * locale/C-ctype.h: Likewise. * locale/programs/ld-ctype.c: Compute whether any mapping maps from ASCII to non-ASCII value. Write out that value. --- locale/C-ctype.c | 6 ++++-- locale/categories.def | 3 ++- locale/langinfo.h | 3 ++- locale/localeinfo.h | 4 ++-- locale/programs/ld-ctype.c | 16 +++++++++++++++- 5 files changed, 25 insertions(+), 7 deletions(-) (limited to 'locale') diff --git a/locale/C-ctype.c b/locale/C-ctype.c index ff56258e58..85f3d2addb 100644 --- a/locale/C-ctype.c +++ b/locale/C-ctype.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1995. @@ -528,7 +528,7 @@ _nl_C_LC_CTYPE_width attribute_hidden = }; /* Number of fields with fixed meanings, starting at 0. */ -#define NR_FIXED 70 +#define NR_FIXED 71 /* Number of class fields, starting at CLASS_OFFSET. */ #define NR_CLASSES 12 /* Number of map fields, starting at MAP_OFFSET. */ @@ -665,6 +665,8 @@ const struct locale_data _nl_C_LC_CTYPE attribute_hidden = { .word = 0 }, /* _NL_CTYPE_TRANSLIT_IGNORE */ { .wstr = NULL }, + /* _NL_CTYPE_MAP_TO_NONASCII */ + { .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/locale/categories.def b/locale/categories.def index dc01a977ce..c4831f61a8 100644 --- a/locale/categories.def +++ b/locale/categories.def @@ -1,5 +1,5 @@ /* Definition of all available locale categories and their items. -*- C -*- - Copyright (C) 1995-2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1995-2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -133,6 +133,7 @@ DEFINE_CATEGORY DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_DEFAULT_MISSING, "ctype-translit-default-missing", std, wstring) DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_IGNORE_LEN, "ctype-translit-ignore-len", std, word) DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_IGNORE, "ctype-translit-ignore", std, string) + DEFINE_ELEMENT (_NL_CTYPE_MAP_TO_NONASCII, "map-to-nonascii", std, word) ), _nl_postload_ctype) diff --git a/locale/langinfo.h b/locale/langinfo.h index ef17b15ba2..6d7c25c6c2 100644 --- a/locale/langinfo.h +++ b/locale/langinfo.h @@ -1,5 +1,5 @@ /* Access to locale-dependent parameters. - Copyright (C) 1995-99,2000,01,02 Free Software Foundation, Inc. + Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -334,6 +334,7 @@ enum _NL_CTYPE_TRANSLIT_DEFAULT_MISSING, _NL_CTYPE_TRANSLIT_IGNORE_LEN, _NL_CTYPE_TRANSLIT_IGNORE, + _NL_CTYPE_MAP_TO_NONASCII, _NL_CTYPE_EXTRA_MAP_1, _NL_CTYPE_EXTRA_MAP_2, _NL_CTYPE_EXTRA_MAP_3, diff --git a/locale/localeinfo.h b/locale/localeinfo.h index 466c16015c..e7b8f84da8 100644 --- a/locale/localeinfo.h +++ b/locale/localeinfo.h @@ -1,5 +1,5 @@ /* Declarations for internal libc locale interfaces - Copyright (C) 1995-2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1995-2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,7 +31,7 @@ #include /* For loaded_l10nfile definition. */ /* Magic number at the beginning of a locale data file for CATEGORY. */ -#define LIMAGIC(category) ((unsigned int) (0x20000828 ^ (category))) +#define LIMAGIC(category) ((unsigned int) (0x20031115 ^ (category))) /* Two special weight constants for the collation data. */ #define IGNORE_CHAR 2 diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index 2a2c831481..499868237b 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1995. @@ -181,6 +181,8 @@ struct locale_ctype_t const char *default_missing_file; size_t default_missing_lineno; + uint32_t to_nonascii; + /* The arrays for the binary representation. */ char_class_t *ctype_b; char_class32_t *ctype32_b; @@ -1035,6 +1037,10 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap, idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len; break; + + CTYPE_DATA (_NL_CTYPE_MAP_TO_NONASCII, + &ctype->to_nonascii, sizeof (uint32_t)); + case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS_MB_LEN): iov[2 + elem + offset].iov_base = alloca (sizeof (uint32_t)); iov[2 + elem + offset].iov_len = sizeof (uint32_t); @@ -2706,6 +2712,14 @@ with character code range values one must use the absolute ellipsis `...'")); if (!ignore_content) { + /* Check whether the mapping converts from an ASCII value + to a non-ASCII value. */ + if (from_seq != NULL && from_seq->nbytes == 1 + && isascii (from_seq->bytes[0]) + && to_seq != NULL && (to_seq->nbytes != 1 + || !isascii (to_seq->bytes[0]))) + ctype->to_nonascii = 1; + if (mapidx < 2 && from_seq != NULL && to_seq != NULL && from_seq->nbytes == 1 && to_seq->nbytes == 1) /* We can use this value. */ -- cgit v1.2.3