diff options
| -rw-r--r-- | ChangeLog | 97 | ||||
| -rw-r--r-- | ctype/ctype-info.c | 2 | ||||
| -rw-r--r-- | locale/C-collate.c | 10 | ||||
| -rw-r--r-- | locale/C-ctype.c | 12 | ||||
| -rw-r--r-- | locale/categories.def | 6 | ||||
| -rw-r--r-- | locale/langinfo.h | 12 | ||||
| -rw-r--r-- | locale/lc-ctype.c | 31 | ||||
| -rw-r--r-- | locale/programs/ld-collate.c | 430 | ||||
| -rw-r--r-- | locale/programs/ld-ctype.c | 659 | ||||
| -rw-r--r-- | locale/weightwc.h | 22 | ||||
| -rw-r--r-- | posix/fnmatch.c | 2 | ||||
| -rw-r--r-- | posix/fnmatch_loop.c | 153 | ||||
| -rw-r--r-- | string/strcoll.c | 20 | ||||
| -rw-r--r-- | string/strxfrm.c | 22 | ||||
| -rw-r--r-- | wcsmbs/wcwidth.h | 37 | ||||
| -rw-r--r-- | wctype/Makefile | 7 | ||||
| -rw-r--r-- | wctype/cname-lookup.h | 62 | ||||
| -rw-r--r-- | wctype/iswctype.c | 31 | ||||
| -rw-r--r-- | wctype/iswctype_l.c | 32 | ||||
| -rw-r--r-- | wctype/towctrans.c | 19 | ||||
| -rw-r--r-- | wctype/towctrans_l.c | 19 | ||||
| -rw-r--r-- | wctype/wcextra.c | 54 | ||||
| -rw-r--r-- | wctype/wcextra_l.c | 55 | ||||
| -rw-r--r-- | wctype/wcfuncs.c | 65 | ||||
| -rw-r--r-- | wctype/wcfuncs_l.c | 79 | ||||
| -rw-r--r-- | wctype/wchar-lookup.h | 4 | ||||
| -rw-r--r-- | wctype/wctrans.c | 25 | ||||
| -rw-r--r-- | wctype/wctrans_l.c | 20 | ||||
| -rw-r--r-- | wctype/wctype.c | 20 | ||||
| -rw-r--r-- | wctype/wctype_l.c | 20 |
30 files changed, 468 insertions, 1559 deletions
@@ -1,3 +1,100 @@ +2000-08-31 Bruno Haible <haible@clisp.cons.org> + + * wctype/wcfuncs.c (iswblank): New function. + * wctype/wcfuncs_l.c (__iswblank_l): New function. + * wctype/wcextra.c: Remove file. + * wctype/wcextra_l.c: Remove file. + * wctype/Makefile (distribute): Remove wcextra and wcextra_l. + +2000-08-31 Bruno Haible <haible@clisp.cons.org> + + * locale/programs/ld-collate.c (collate_output): Remove redundant + assert call. + * string/strcoll.c: Likewise. + * string/strxfrm.c: Include assert.h. Add assert calls like in + string/strcoll.c. + +2000-08-31 Bruno Haible <haible@clisp.cons.org> + + * locale/categories.def (_NL_COLLATE_HASH_SIZE, + _NL_COLLATE_HASH_LAYERS, _NL_COLLATE_NAMES, _NL_CTYPE_NAMES, + _NL_CTYPE_HASH_SIZE, _NL_CTYPE_HASH_LAYERS): Remove definitions. + * locale/langinfo.h (_NL_COLLATE_HASH_SIZE, _NL_COLLATE_HASH_LAYERS, + _NL_COLLATE_NAMES): Rename to _NL_COLLATE_GAP1/2/3 respectively. + (_NL_CTYPE_NAMES): Rename to _NL_CTYPE_GAP3. + (_NL_CTYPE_GAP3): Rename to _NL_CTYPE_GAP4. + (_NL_CTYPE_HASH_SIZE, _NL_CTYPE_HASH_LAYERS): Rename to + _NL_CTYPE_GAP5/6 respectively. + + * locale/C-ctype.c (_nl_C_LC_CTYPE): Update. + * ctype/ctype-info.c (__ctype_names, __ctype_width): Remove variables. + * locale/lc-ctype.c (_nl_postload_ctype): Assume new locale format. + Don't initialize __ctype_names and __ctype_width. + * wctype/cname-lookup.h: Remove file. + * wctype/Makefile (distribute): Remove cname-lookup.h. + * wctype/wchar-lookup.h: Include stdint.h. + * wctype/wctype.c (__wctype): Assume new locale format. + * wctype/wctype_l.c (__wctype_l): Likewise. + * wctype/iswctype.c: Don't include cname-lookup.h. + (__iswctype): Assume new locale format. + * wctype/iswctype_l.c: Don't include cname-lookup.h. + (__iswctype_l): Assume new locale format. + * wctype/wctrans.c: Don't include ctype.h. + (wctrans): Assume new locale format. + * wctype/wctrans_l.c (__wctrans_l): Likewise. + * wctype/towctrans.c: Don't include cname-lookup.h. + (__towctrans): Assume new locale format. + * wctype/towctrans_l.c: Don't include cname-lookup.h. + (__towctrans_l): Assume new locale format. + * wctype/wcfuncs.c: Don't include ctype.h and cname-lookup.h. Include + localeinfo.h instead. + (__NO_WCTYPE): Remove unused macro. + (__ctype32_b, __ctype32_toupper, __ctype32_tolower): Remove + declarations. + (iswalnum, iswalpha, iswcntrl, iswdigit, iswlower, iswgraph, iswprint, + iswpunct, iswspace, iswupper, iswxdigit): Assume new locale format. + (towlower, towupper): Likewise. + * wctype/wcfuncs_l.c: Don't include cname-lookup.h. Include + localeinfo.h instead. + (__NO_WCTYPE): Remove unused macro. + (__iswalnum_l, __iswalpha_l, __iswcntrl_l, __iswdigit_l, __iswlower_l, + __iswgraph_l, __iswprint_l, __iswpunct_l, __iswspace_l, __iswupper_l, + __iswxdigit_l): Assume new locale format. + (__towlower_l, __towupper_l): Likewise. + * wcsmbs/wcwidth.h: Don't include cname-lookup.h. + (__ctype32_b): Remove declaration. + (internal_wcwidth): Assume new locale format. + * locale/programs/ld-ctype.c (struct locale_ctype_t): Remove fields + plane_size, plane_cnt, names, width. Rename map to map_b, rename map32 + to map32_b, rename width_3level to width. + (ctype_output): Always create new locale format. Don't emit + _NL_CTYPE_NAMES, _NL_CTYPE_HASH_SIZE, _NL_CTYPE_HASH_LAYERS any more. + (allocate_arrays): Always create new locale format. + + * locale/C-collate.c (_nl_C_LC_COLLATE): Update. + * locale/weightwc.h (findidx): Assume new locale format. + * string/strcoll.c (wcscoll): Remove local variables size, layers, + names. + * string/strxfrm.c (wcsxfrm): Likewise. + * posix/fnmatch_loop.c (internal_fnwmatch): Likewise. Change type of + local variable collseq to 'const char *'. + (SUFFIX): Don't use, don't undefine. + * posix/fnmatch.c: Remove SUFFIX definition. + * locale/programs/ld-collate.c (struct locale_collate_t): Remove + fields plane_size, plane_cnt, wcheads, wcseqorder. Rename + wcheads_3level to wcheads, rename wcseqorder_3level to wcseqorder. + (collate_finish): Always create new locale format. Remove local + variables min_total, act_size. + (collate_output): Always create new locale format. Remove local + variables table_size, names, tablewc. Rename tablewc_3level to + tablewc. + +2000-08-31 Bruno Haible <haible@clisp.cons.org> + + * locale/programs/ld-collate.c (obstack_int32_grow, + obstack_int32_grow_fast): New inline functions. + (output_weightwc, collate_output): Use them where possible. + 2000-09-01 Ulrich Drepper <drepper@redhat.com> * libio/libio.h (_IO_flockfile, _IO_funlockfile): Fix typo in last diff --git a/ctype/ctype-info.c b/ctype/ctype-info.c index 57f1256572..5a210f66fd 100644 --- a/ctype/ctype-info.c +++ b/ctype/ctype-info.c @@ -48,8 +48,6 @@ const __int32_t *__ctype_tolower = b (__int32_t, tolower, 128); const __int32_t *__ctype_toupper = b (__int32_t, toupper, 128); const __uint32_t *__ctype32_tolower = b (__uint32_t, tolower, 128); const __uint32_t *__ctype32_toupper = b (__uint32_t, toupper, 128); -const __uint32_t *__ctype_names; -const unsigned char *__ctype_width; const char *__ctype32_wctype[12] = { b(char, class_upper, 32), diff --git a/locale/C-collate.c b/locale/C-collate.c index a0ba0ff691..964ea50113 100644 --- a/locale/C-collate.c +++ b/locale/C-collate.c @@ -119,11 +119,11 @@ const struct locale_data _nl_C_LC_COLLATE = { string: NULL }, /* _NL_COLLATE_INDIRECTMB */ { string: NULL }, - /* _NL_COLLATE_HASH_SIZE */ - { word: 0 }, - /* _NL_COLLATE_HASH_LAYERS */ - { word: 0 }, - /* _NL_COLLATE_NAMES */ + /* _NL_COLLATE_GAP1 */ + { string: NULL }, + /* _NL_COLLATE_GAP2 */ + { string: NULL }, + /* _NL_COLLATE_GAP3 */ { string: NULL }, /* _NL_COLLATE_TABLEWC */ { string: NULL }, diff --git a/locale/C-ctype.c b/locale/C-ctype.c index 4f8e204a5d..f9eee1ca94 100644 --- a/locale/C-ctype.c +++ b/locale/C-ctype.c @@ -550,14 +550,14 @@ const struct locale_data _nl_C_LC_CTYPE = { string: NULL }, /* _NL_CTYPE_CLASS32 */ { string: _nl_C_LC_CTYPE_class32 }, - /* _NL_CTYPE_NAMES */ - { string: NULL }, /* _NL_CTYPE_GAP3 */ { string: NULL }, - /* _NL_CTYPE_HASH_SIZE */ - { word: 0 }, - /* _NL_CTYPE_HASH_LAYERS */ - { word: 0 }, + /* _NL_CTYPE_GAP4 */ + { string: NULL }, + /* _NL_CTYPE_GAP5 */ + { string: NULL }, + /* _NL_CTYPE_GAP6 */ + { string: NULL }, /* _NL_CTYPE_CLASS_NAMES */ { 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" diff --git a/locale/categories.def b/locale/categories.def index 95873d0036..2ec45e477a 100644 --- a/locale/categories.def +++ b/locale/categories.def @@ -48,9 +48,6 @@ DEFINE_CATEGORY DEFINE_ELEMENT (_NL_COLLATE_WEIGHTMB, "collate-weightmb", std, string) DEFINE_ELEMENT (_NL_COLLATE_EXTRAMB, "collate-extramb", std, string) DEFINE_ELEMENT (_NL_COLLATE_INDIRECTMB, "collate-indirectmb", std, string) - DEFINE_ELEMENT (_NL_COLLATE_HASH_SIZE, "collate-hash-size", std, word) - DEFINE_ELEMENT (_NL_COLLATE_HASH_LAYERS, "collate-hash-layers", std, word) - DEFINE_ELEMENT (_NL_COLLATE_NAMES, "collate-names", std, string) DEFINE_ELEMENT (_NL_COLLATE_TABLEWC, "collate-tablewc", std, string) DEFINE_ELEMENT (_NL_COLLATE_WEIGHTWC, "collate-weightwc", std, string) DEFINE_ELEMENT (_NL_COLLATE_EXTRAWC, "collate-extrawc", std, string) @@ -74,9 +71,6 @@ DEFINE_CATEGORY DEFINE_ELEMENT (_NL_CTYPE_TOUPPER, "ctype-toupper", std, string) DEFINE_ELEMENT (_NL_CTYPE_TOLOWER, "ctype-tolower", std, string) DEFINE_ELEMENT (_NL_CTYPE_CLASS32, "ctype-class32", std, string) - DEFINE_ELEMENT (_NL_CTYPE_NAMES, "ctype-names", std, string) - DEFINE_ELEMENT (_NL_CTYPE_HASH_SIZE, "ctype-hash-size", std, word) - DEFINE_ELEMENT (_NL_CTYPE_HASH_LAYERS, "ctype-hash-layers", std, word) DEFINE_ELEMENT (_NL_CTYPE_CLASS_NAMES, "ctype-class-names", std, stringlist) DEFINE_ELEMENT (_NL_CTYPE_MAP_NAMES, "ctype-map-names", std, stringlist) DEFINE_ELEMENT (_NL_CTYPE_WIDTH, "ctype-width", std, bytearray) diff --git a/locale/langinfo.h b/locale/langinfo.h index 6a94a8759b..494b14e413 100644 --- a/locale/langinfo.h +++ b/locale/langinfo.h @@ -238,9 +238,9 @@ enum _NL_COLLATE_WEIGHTMB, _NL_COLLATE_EXTRAMB, _NL_COLLATE_INDIRECTMB, - _NL_COLLATE_HASH_SIZE, - _NL_COLLATE_HASH_LAYERS, - _NL_COLLATE_NAMES, + _NL_COLLATE_GAP1, + _NL_COLLATE_GAP2, + _NL_COLLATE_GAP3, _NL_COLLATE_TABLEWC, _NL_COLLATE_WEIGHTWC, _NL_COLLATE_EXTRAWC, @@ -261,10 +261,10 @@ enum _NL_CTYPE_TOLOWER, _NL_CTYPE_GAP2, _NL_CTYPE_CLASS32, - _NL_CTYPE_NAMES, _NL_CTYPE_GAP3, - _NL_CTYPE_HASH_SIZE, - _NL_CTYPE_HASH_LAYERS, + _NL_CTYPE_GAP4, + _NL_CTYPE_GAP5, + _NL_CTYPE_GAP6, _NL_CTYPE_CLASS_NAMES, _NL_CTYPE_MAP_NAMES, _NL_CTYPE_WIDTH, diff --git a/locale/lc-ctype.c b/locale/lc-ctype.c index 4b40b8a22d..bf7b525129 100644 --- a/locale/lc-ctype.c +++ b/locale/lc-ctype.c @@ -41,41 +41,28 @@ _nl_postload_ctype (void) ((const type *) _NL_CURRENT (LC_CTYPE, paste(_NL_CTYPE_,x)) + offset) extern const uint32_t *__ctype32_b; - extern const uint32_t *__ctype_names; - extern const unsigned char *__ctype_width; extern const uint32_t *__ctype32_toupper; extern const uint32_t *__ctype32_tolower; extern const char *__ctype32_wctype[12]; extern const char *__ctype32_wctrans[2]; extern const char *__ctype32_width; + size_t offset, cnt; + __ctype_b = current (uint16_t, CLASS, 128); __ctype_toupper = current (uint32_t, TOUPPER, 128); __ctype_tolower = current (uint32_t, TOLOWER, 128); __ctype32_b = current (uint32_t, CLASS32, 0); __ctype32_toupper = current (uint32_t, TOUPPER32, 0); __ctype32_tolower = current (uint32_t, TOLOWER32, 0); - if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_HASH_SIZE) != 0) - { - /* Old locale format. */ - __ctype_names = current (uint32_t, NAMES, 0); - __ctype_width = current (unsigned char, WIDTH, 0); - } - else - { - /* New locale format. */ - size_t offset, cnt; - offset = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_CLASS_OFFSET); - for (cnt = 0; cnt < 12; cnt++) - __ctype32_wctype[cnt] = - _nl_current_LC_CTYPE->values[offset + cnt].string; + offset = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_CLASS_OFFSET); + for (cnt = 0; cnt < 12; cnt++) + __ctype32_wctype[cnt] = _nl_current_LC_CTYPE->values[offset + cnt].string; - offset = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET); - for (cnt = 0; cnt < 2; cnt++) - __ctype32_wctrans[cnt] = - _nl_current_LC_CTYPE->values[offset + cnt].string; + offset = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET); + for (cnt = 0; cnt < 2; cnt++) + __ctype32_wctrans[cnt] = _nl_current_LC_CTYPE->values[offset + cnt].string; - __ctype32_width = current (char, WIDTH, 0); - } + __ctype32_width = current (char, WIDTH, 0); } diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c index 6513d89adf..1bfce616f3 100644 --- a/locale/programs/ld-collate.c +++ b/locale/programs/ld-collate.c @@ -41,6 +41,24 @@ #define obstack_chunk_alloc malloc #define obstack_chunk_free free +static inline void +obstack_int32_grow (struct obstack *obstack, int32_t data) +{ + if (sizeof (int32_t) == sizeof (int)) + obstack_int_grow (obstack, data); + else + obstack_grow (obstack, &data, sizeof (int32_t)); +} + +static inline void +obstack_int32_grow_fast (struct obstack *obstack, int32_t data) +{ + if (sizeof (int32_t) == sizeof (int)) + obstack_int_grow_fast (obstack, data); + else + obstack_grow (obstack, &data, sizeof (int32_t)); +} + /* Forward declaration. */ struct element_t; @@ -212,19 +230,13 @@ struct locale_collate_t the multibyte sequences. */ struct element_t *mbheads[256]; - /* Table size of wide character hash table. */ - uint32_t plane_size; - uint32_t plane_cnt; - /* Arrays with heads of the list for each of the leading bytes in the multibyte sequences. */ - struct element_t **wcheads; - struct wchead_table wcheads_3level; + struct wchead_table wcheads; /* The arrays with the collation sequence order. */ unsigned char mbseqorder[256]; - uint32_t *wcseqorder; - struct collseq_table wcseqorder_3level; + struct collseq_table wcseqorder; }; @@ -1468,8 +1480,6 @@ collate_finish (struct localedef_t *locale, struct charmap_t *charmap) struct section_list *sect; int ruleidx; int nr_wide_elems = 0; - size_t min_total; - size_t act_size; if (collate == NULL) { @@ -1645,125 +1655,13 @@ collate_finish (struct localedef_t *locale, struct charmap_t *charmap) } /* Now to the wide character case. */ - if (oldstyle_tables) - { - /* Here we have to find first a good mapping function to get the - wide range of wide character values (0x00000000 to 0x7fffffff) - to a managable table. This might take some time so we issue - a warning. - - We use a very trivial hashing function to store the sparse - table. CH % TABSIZE is used as an index. To solve multiple hits - we have N planes. This guarantees a fixed search time for a - character [N / 2]. In the following code we determine the minimum - value for TABSIZE * N, where TABSIZE >= 256. - - Some people complained that this algorithm takes too long. Well, - go on, improve it. But changing the step size is *not* an - option. Some people changed this to use only sizes of prime - numbers. Think again, do some math. We are looking for the - optimal solution, not something which works in general. Unless - somebody can provide a dynamic programming solution I think this - implementation is as good as it can get. */ - if (nr_wide_elems > 512 && !be_quiet) - fputs (_("\ -Computing table size for collation table might take a while..."), - stderr); - - min_total = UINT_MAX; - act_size = 256; - - /* While we want to have a small total size we are willing to use a - little bit larger table if this reduces the number of layers. - Therefore we add a little penalty to the number of planes. - Maybe this constant has to be adjusted a bit. */ -#define PENALTY 128 - do - { - size_t cnt[act_size]; - struct element_t *elem[act_size]; - size_t act_planes = 1; + collate->wcheads.p = 6; + collate->wcheads.q = 10; + wchead_table_init (&collate->wcheads); - memset (cnt, '\0', sizeof cnt); - memset (elem, '\0', sizeof elem); - - runp = collate->start; - while (runp != NULL) - { - if (runp->wcs != NULL) - { - size_t nr = runp->wcs[0] % act_size; - struct element_t *elemp = elem[nr]; - - while (elemp != NULL) - { - if (elemp->wcs[0] == runp->wcs[0]) - break; - elemp = elemp->wcnext; - } - - if (elemp == NULL && ++cnt[nr] > act_planes) - { - act_planes = cnt[nr]; - - runp->wcnext = elem[nr]; - elem[nr] = runp; - - if ((act_size + PENALTY) * act_planes >= min_total) - break; - } - } - - /* Up to the next entry. */ - runp = runp->next; - } - - if ((act_size + PENALTY) * act_planes < min_total) - { - min_total = (act_size + PENALTY) * act_planes; - collate->plane_size = act_size; - collate->plane_cnt = act_planes; - } - - ++act_size; - } - while (act_size < min_total); - - if (nr_wide_elems > 512 && !be_quiet) - fputs (_(" done\n"), stderr); - - /* Now that we know how large the table has to be we are able to - allocate the array and start adding the characters to the lists - in the same way we did it for the multibyte characters. */ - collate->wcheads = (struct element_t **) - obstack_alloc (&collate->mempool, (collate->plane_size - * collate->plane_cnt - * sizeof (struct element_t *))); - memset (collate->wcheads, '\0', (collate->plane_size - * collate->plane_cnt - * sizeof (struct element_t *))); - - collate->wcseqorder = (uint32_t *) - obstack_alloc (&collate->mempool, (collate->plane_size - * collate->plane_cnt - * sizeof (uint32_t))); - memset (collate->wcseqorder, '\0', (collate->plane_size - * collate->plane_cnt - * sizeof (uint32_t))); - } - else - { - collate->plane_size = 0; - collate->plane_cnt = 0; - - collate->wcheads_3level.p = 6; - collate->wcheads_3level.q = 10; - wchead_table_init (&collate->wcheads_3level); - - collate->wcseqorder_3level.p = 6; - collate->wcseqorder_3level.q = 10; - collseq_table_init (&collate->wcseqorder_3level); - } + collate->wcseqorder.p = 6; + collate->wcseqorder.q = 10; + collseq_table_init (&collate->wcseqorder); /* Start adding. */ runp = collate->start; @@ -1774,38 +1672,14 @@ Computing table size for collation table might take a while..."), struct element_t *e; struct element_t **eptr; struct element_t *lastp; - size_t idx; - - if (oldstyle_tables) - { - /* Find a free index. */ - idx = runp->wcs[0] % collate->plane_size; - while (collate->wcheads[idx] != NULL) - { - /* Stop if this is an entry with the same starting character. */ - if (collate->wcheads[idx]->wcs[0] == runp->wc |
