diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-08-02 00:09:25 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-08-02 00:09:25 +0000 |
commit | 8fb81470d9466b7e3d60cbfd6fc2d04fd1aae78a (patch) | |
tree | f8046bf51bce4125faaa2bfe115d8e0d026e57b8 /locale | |
parent | 925e31d9c22c5cdf1d80d9a5683523efc729cfd1 (diff) | |
download | glibc-8fb81470d9466b7e3d60cbfd6fc2d04fd1aae78a.tar.gz glibc-8fb81470d9466b7e3d60cbfd6fc2d04fd1aae78a.tar.xz glibc-8fb81470d9466b7e3d60cbfd6fc2d04fd1aae78a.zip |
Update.
* gnulib/Makefile (tests): Add tst-gcc. * gnulib/tst-gcc.c: New file. * assert/Makefile (routines): Add __assert. * assert/Versions: Export __assert for glibc 2.2. * assert/__assert.c: New file. * assert/assert.h: Declare __assert. 2000-07-27 Bruno Haible <haible@clisp.cons.org> * locale/localeinfo.h (_ISCTYPE): New macro. * posix/fnmatch_loop.c (internal_fnmatch): Use it, support new LC_CTYPE locale format. * locale/programs/ld-ctype.c (locale_ctype_t): New field class_b. (ctype_output): Output class_b[nr] right before class_3level[nr]. (allocate_arrays): Fill class_b, similarly to class_3level. 2000-08-01 Ulrich Drepper <drepper@redhat.com>
Diffstat (limited to 'locale')
-rw-r--r-- | locale/localeinfo.h | 8 | ||||
-rw-r--r-- | locale/programs/ld-ctype.c | 29 |
2 files changed, 33 insertions, 4 deletions
diff --git a/locale/localeinfo.h b/locale/localeinfo.h index 412ac27a06..f986282392 100644 --- a/locale/localeinfo.h +++ b/locale/localeinfo.h @@ -130,6 +130,14 @@ enum }; +/* LC_CTYPE specific: + Access a wide character class with a single character index. + _ISCTYPE (c, desc) = iswctype (btowc (c), desc). + c must be an `unsigned char'. desc must be a nonzero wctype_t. */ +#define _ISCTYPE(c, desc) \ + (((((const uint32_t *) (desc)) - 8)[(c) >> 5] >> ((c) & 0x1f)) & 1) + + /* For each category declare the variable for the current locale data. */ #define DEFINE_CATEGORY(category, category_name, items, a) \ extern struct locale_data *_nl_current_##category; diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index f3edd6cbc0..0460d10084 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -170,6 +170,7 @@ struct locale_ctype_t uint32_t *names; uint32_t **map; uint32_t **map32; + uint32_t **class_b; struct iovec *class_3level; struct iovec *map_3level; uint32_t *class_name_ptr; @@ -842,7 +843,7 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap, + (oldstyle_tables ? (ctype->map_collection_nr - 2) : (ctype->nr_charclass + ctype->map_collection_nr))); - struct iovec iov[2 + nelems + ctype->nr_charclass + struct iovec iov[2 + nelems + 2 * ctype->nr_charclass + ctype->map_collection_nr + 2]; struct locale_file data; uint32_t idx[nelems + 1]; @@ -1169,6 +1170,12 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap, size_t nr = elem - _NL_ITEM_INDEX (_NL_CTYPE_EXTRA_MAP_1); if (nr < ctype->nr_charclass) { + iov[2 + elem + offset].iov_base = ctype->class_b[nr]; + iov[2 + elem + offset].iov_len = 256 / 32 + * sizeof (uint32_t); + idx[elem] += iov[2 + elem + offset].iov_len; + ++offset; + iov[2 + elem + offset] = ctype->class_3level[nr]; } else @@ -1182,7 +1189,7 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap, } } - assert (2 + elem + offset == (nelems + ctype->nr_charclass + assert (2 + elem + offset == (nelems + 2 * ctype->nr_charclass + ctype->map_collection_nr + 2 + 2)); write_locale_data (output_path, "LC_CTYPE", 2 + elem + offset, iov); @@ -4083,8 +4090,12 @@ Computing table size for character classes might take a while..."), xcalloc ((oldstyle_tables ? ctype->plane_size * ctype->plane_cnt : 256), sizeof (char_class32_t)); if (!oldstyle_tables) - ctype->class_3level = (struct iovec *) - xmalloc (ctype->nr_charclass * sizeof (struct iovec)); + { + ctype->class_b = (uint32_t **) + xmalloc (ctype->nr_charclass * sizeof (uint32_t *)); + ctype->class_3level = (struct iovec *) + xmalloc (ctype->nr_charclass * sizeof (struct iovec)); + } /* This is the array accessed using the multibyte string elements. */ for (idx = 0; idx < 256; ++idx) @@ -4115,6 +4126,16 @@ Computing table size for character classes might take a while..."), for (nr = 0; nr < ctype->nr_charclass; nr++) { + ctype->class_b[nr] = (uint32_t *) + xcalloc (256 / 32, sizeof (uint32_t)); + + for (idx = 0; idx < 256; ++idx) + if (ctype->class256_collection[idx] & _ISbit (nr)) + ctype->class_b[nr][idx >> 5] |= (uint32_t)1 << (idx & 0x1f); + } + + for (nr = 0; nr < ctype->nr_charclass; nr++) + { struct wctype_table t; t.p = 4; /* or: 5 */ |