Lines Matching refs:ctype
50 #define ELEM(ctype, collection, idx, value) \ argument
51 *find_idx (ctype, &ctype->collection idx, &ctype->collection##_max idx, \
52 &ctype->collection##_act idx, value)
261 struct locale_ctype_t *ctype, const char *name);
263 struct locale_ctype_t *ctype,
265 static uint32_t *find_idx (struct locale_ctype_t *ctype, uint32_t **table,
267 static void set_class_defaults (struct locale_ctype_t *ctype,
270 static void allocate_arrays (struct locale_ctype_t *ctype,
294 struct locale_ctype_t *ctype; in ctype_startup() local
296 if (!ignore_content && locale->categories[LC_CTYPE].ctype == NULL) in ctype_startup()
301 locale->categories[LC_CTYPE].ctype = ctype = in ctype_startup()
306 ctype->charnames_max = charmap->mb_cur_max == 1 ? 256 : 512; in ctype_startup()
307 ctype->charnames = (uint32_t *) xmalloc (ctype->charnames_max in ctype_startup()
310 ctype->charnames[cnt] = cnt; in ctype_startup()
311 ctype->charnames_act = 256; in ctype_startup()
312 idx_table_init (&ctype->charnames_idx); in ctype_startup()
315 ctype->last_class_char = ILLEGAL_CHAR_VALUE; in ctype_startup()
318 ctype_class_new (lr, ctype, "upper"); in ctype_startup()
319 ctype_class_new (lr, ctype, "lower"); in ctype_startup()
320 ctype_class_new (lr, ctype, "alpha"); in ctype_startup()
321 ctype_class_new (lr, ctype, "digit"); in ctype_startup()
322 ctype_class_new (lr, ctype, "xdigit"); in ctype_startup()
323 ctype_class_new (lr, ctype, "space"); in ctype_startup()
324 ctype_class_new (lr, ctype, "print"); in ctype_startup()
325 ctype_class_new (lr, ctype, "graph"); in ctype_startup()
326 ctype_class_new (lr, ctype, "blank"); in ctype_startup()
327 ctype_class_new (lr, ctype, "cntrl"); in ctype_startup()
328 ctype_class_new (lr, ctype, "punct"); in ctype_startup()
329 ctype_class_new (lr, ctype, "alnum"); in ctype_startup()
331 ctype->class_collection_max = charmap->mb_cur_max == 1 ? 256 : 512; in ctype_startup()
332 ctype->class_collection in ctype_startup()
334 ctype->class_collection_max); in ctype_startup()
335 ctype->class_collection_act = 256; in ctype_startup()
338 ctype->last_map_idx = MAX_NR_CHARMAP; in ctype_startup()
339 ctype_map_new (lr, ctype, "toupper", charmap); in ctype_startup()
340 ctype_map_new (lr, ctype, "tolower", charmap); in ctype_startup()
345 ctype->map_collection[0][cnt] = cnt; in ctype_startup()
346 ctype->map_collection[1][cnt] = cnt; in ctype_startup()
348 ctype->map256_collection[0][cnt] = cnt; in ctype_startup()
349 ctype->map256_collection[1][cnt] = cnt; in ctype_startup()
353 ctype->to_nonascii = 1; in ctype_startup()
355 obstack_init (&ctype->mempool); in ctype_startup()
358 ctype = locale->categories[LC_CTYPE].ctype = in ctype_startup()
359 copy_locale->categories[LC_CTYPE].ctype; in ctype_startup()
395 struct locale_ctype_t *ctype = locale->categories[LC_CTYPE].ctype; in ctype_finish() local
403 if (ctype == NULL) in ctype_finish()
418 while (from->categories[LC_CTYPE].ctype == NULL in ctype_finish()
421 ctype = locale->categories[LC_CTYPE].ctype in ctype_finish()
422 = from->categories[LC_CTYPE].ctype; in ctype_finish()
427 if (ctype == NULL) in ctype_finish()
432 ctype = locale->categories[LC_CTYPE].ctype; in ctype_finish()
438 ctype->repertoire = repertoire_read (repertoire_name); in ctype_finish()
444 ctype->codeset_name = charmap->code_set_name; in ctype_finish()
445 if (ctype->codeset_name == NULL) in ctype_finish()
449 ctype->codeset_name = "//UNKNOWN//"; in ctype_finish()
453 set_class_defaults (ctype, charmap, ctype->repertoire); in ctype_finish()
456 for (cnt = 0; cnt < ctype->class_collection_act; ++cnt) in ctype_finish()
458 uint32_t tmp = ctype->class_collection[cnt]; in ctype_finish()
473 uint32_t value = ctype->charnames[cnt]; in ctype_finish()
487 uint32_t value = ctype->charnames[cnt]; in ctype_finish()
499 ctype->class_collection[cnt] |= _ISwbit (cls2); in ctype_finish()
512 uint32_t tmp = ctype->class256_collection[cnt]; in ctype_finish()
555 ctype->class256_collection[cnt] |= _ISbit (cls2); in ctype_finish()
569 (ELEM (ctype, class_collection, , space_value) in ctype_finish()
572 (ELEM (ctype, class_collection, , space_value) in ctype_finish()
579 (ELEM (ctype, class_collection, , space_value) in ctype_finish()
582 (ELEM (ctype, class_collection, , space_value) in ctype_finish()
591 ELEM (ctype, class_collection, , space_value) |= BITw (tok_print); in ctype_finish()
604 (ctype->class256_collection[space_seq->bytes[0]] in ctype_finish()
607 (ctype->class256_collection[space_seq->bytes[0]] in ctype_finish()
614 (ctype->class256_collection[space_seq->bytes[0]] in ctype_finish()
617 (ctype->class256_collection[space_seq->bytes[0]] in ctype_finish()
625 ctype->class256_collection[space_seq->bytes[0]] |= BIT (tok_print); in ctype_finish()
631 uint32_t uppval = ctype->map256_collection[0][cnt]; in ctype_finish()
632 uint32_t lowval = ctype->map256_collection[1][cnt]; in ctype_finish()
633 uint32_t lowuppval = ctype->map256_collection[0][lowval]; in ctype_finish()
634 uint32_t lowlowval = ctype->map256_collection[1][lowval]; in ctype_finish()
640 ctype->nonascii_case = 1; in ctype_finish()
644 if (ctype->map256_collection[0][cnt] != cnt in ctype_finish()
645 || ctype->map256_collection[1][cnt] != cnt) in ctype_finish()
646 ctype->nonascii_case = 1; in ctype_finish()
680 wch = repertoire_find_value (ctype->repertoire, seq->name, in ctype_finish()
687 (void) find_idx (ctype, NULL, NULL, NULL, wch); in ctype_finish()
721 data->ucs4 = repertoire_find_value (ctype->repertoire, in ctype_finish()
725 (void) find_idx (ctype, NULL, NULL, NULL, data->ucs4); in ctype_finish()
729 if (ctype->mbdigits_act % 10 != 0) in ctype_finish()
731 assert (ctype->mbdigits_act == ctype->wcdigits_act); in ctype_finish()
732 ctype->wcdigits_act -= ctype->mbdigits_act % 10; in ctype_finish()
733 ctype->mbdigits_act -= ctype->mbdigits_act % 10; in ctype_finish()
742 while (cnt < ctype->mbdigits_act) in ctype_finish()
746 if (ctype->mbdigits[cnt + inner] == NULL) in ctype_finish()
754 memmove (&ctype->mbdigits[cnt], &ctype->mbdigits[cnt + 10], in ctype_finish()
755 ((ctype->wcdigits_act - cnt - 10) in ctype_finish()
756 * sizeof (ctype->mbdigits[0]))); in ctype_finish()
757 ctype->mbdigits_act -= 10; in ctype_finish()
762 if (ctype->mbdigits_act == 0) in ctype_finish()
764 if (ctype->mbdigits_max == 0) in ctype_finish()
766 ctype->mbdigits = obstack_alloc (&((struct charmap_t *) charmap)->mem_pool, in ctype_finish()
768 ctype->mbdigits_max = 10; in ctype_finish()
773 ctype->mbdigits[cnt] = charmap_find_symbol (charmap, in ctype_finish()
775 if (ctype->mbdigits[cnt] == NULL) in ctype_finish()
777 ctype->mbdigits[cnt] = charmap_find_symbol (charmap, in ctype_finish()
780 if (ctype->mbdigits[cnt] == NULL) in ctype_finish()
786 ctype->mbdigits[cnt] = obstack_alloc (&((struct charmap_t *) charmap)->mem_pool, in ctype_finish()
790 ctype->mbdigits[cnt]->bytes[0] = digits[cnt]; in ctype_finish()
791 ctype->mbdigits[cnt]->nbytes = 1; in ctype_finish()
796 ctype->mbdigits_act = 10; in ctype_finish()
804 while (cnt < ctype->wcdigits_act) in ctype_finish()
808 if (ctype->wcdigits[cnt + inner] == ILLEGAL_CHAR_VALUE) in ctype_finish()
816 memmove (&ctype->wcdigits[cnt], &ctype->wcdigits[cnt + 10], in ctype_finish()
817 ((ctype->wcdigits_act - cnt - 10) in ctype_finish()
818 * sizeof (ctype->wcdigits[0]))); in ctype_finish()
819 ctype->wcdigits_act -= 10; in ctype_finish()
824 if (ctype->wcdigits_act == 0) in ctype_finish()
826 if (ctype->wcdigits_max == 0) in ctype_finish()
828 ctype->wcdigits = obstack_alloc (&((struct charmap_t *) charmap)->mem_pool, in ctype_finish()
830 ctype->wcdigits_max = 10; in ctype_finish()
834 ctype->wcdigits[cnt] = L'0' + cnt; in ctype_finish()
836 ctype->mbdigits_act = 10; in ctype_finish()
842 if (ctype->mboutdigits[cnt] == NULL) in ctype_finish()
856 ctype->mboutdigits[cnt] = (struct charseq *) &replace; in ctype_finish()
861 if (ctype->wcoutdigits[cnt] == 0) in ctype_finish()
870 ctype->wcoutdigits[cnt] = L'?'; in ctype_finish()
874 if (ctype->translit_ignore != NULL) in ctype_finish()
876 struct translit_ignore_t *firstp = ctype->translit_ignore; in ctype_finish()
879 ctype->ntranslit_ignore = 1; in ctype_finish()
886 ++ctype->ntranslit_ignore; in ctype_finish()
897 ctype->translit_ignore = firstp; in ctype_finish()
906 struct locale_ctype_t *ctype = locale->categories[LC_CTYPE].ctype; in ctype_output() local
908 + ctype->nr_charclass + ctype->map_collection_nr); in ctype_output()
914 allocate_arrays (ctype, charmap, ctype->repertoire); in ctype_output()
916 default_missing_len = (ctype->default_missing in ctype_output()
917 ? wcslen ((wchar_t *) ctype->default_missing) in ctype_output()
944 ctype->ctype_b, in ctype_output()
952 CTYPE_UINT32_ARRAY (_NL_CTYPE_TOUPPER, ctype->map_b[0], 256 + 128); in ctype_output()
953 CTYPE_UINT32_ARRAY (_NL_CTYPE_TOLOWER, ctype->map_b[1], 256 + 128); in ctype_output()
954 CTYPE_UINT32_ARRAY (_NL_CTYPE_TOUPPER32, ctype->map32_b[0], 256); in ctype_output()
955 CTYPE_UINT32_ARRAY (_NL_CTYPE_TOLOWER32, ctype->map32_b[1], 256); in ctype_output()
957 ctype->ctype32_b, in ctype_output()
965 CTYPE_UINT32 (_NL_CTYPE_CLASS_OFFSET, ctype->class_offset); in ctype_output()
966 CTYPE_UINT32 (_NL_CTYPE_MAP_OFFSET, ctype->map_offset); in ctype_output()
967 CTYPE_UINT32 (_NL_CTYPE_TRANSLIT_TAB_SIZE, ctype->translit_idx_size); in ctype_output()
970 ctype->translit_from_idx, in ctype_output()
971 ctype->translit_idx_size); in ctype_output()
974 ctype->translit_from_tbl, in ctype_output()
975 ctype->translit_from_tbl_size in ctype_output()
979 ctype->translit_to_idx, in ctype_output()
980 ctype->translit_idx_size); in ctype_output()
983 ctype->translit_to_tbl, in ctype_output()
984 ctype->translit_to_tbl_size / sizeof (uint32_t)); in ctype_output()
989 for (cnt = 0; cnt < ctype->nr_charclass; ++cnt) in ctype_output()
990 add_locale_string (&file, ctype->classnames[cnt]); in ctype_output()
999 for (cnt = 0; cnt < ctype->map_collection_nr; ++cnt) in ctype_output()
1000 add_locale_string (&file, ctype->mapnames[cnt]); in ctype_output()
1007 add_locale_wcwidth_table (&file, &ctype->width); in ctype_output()
1010 CTYPE_UINT32 (_NL_CTYPE_MB_CUR_MAX, ctype->mb_cur_max); in ctype_output()
1013 add_locale_string (&file, ctype->codeset_name); in ctype_output()
1016 CTYPE_UINT32 (_NL_CTYPE_MAP_TO_NONASCII, ctype->to_nonascii); in ctype_output()
1018 CTYPE_UINT32 (_NL_CTYPE_NONASCII_CASE, ctype->nonascii_case); in ctype_output()
1021 add_locale_uint32 (&file, ctype->mbdigits_act / 10); in ctype_output()
1025 add_locale_uint32 (&file, ctype->wcdigits_act / 10); in ctype_output()
1031 cnt < ctype->mbdigits_act; cnt += 10) in ctype_output()
1033 add_locale_raw_data (&file, ctype->mbdigits[cnt]->bytes, in ctype_output()
1034 ctype->mbdigits[cnt]->nbytes); in ctype_output()
1043 add_locale_raw_data (&file, ctype->mboutdigits[cnt]->bytes, in ctype_output()
1044 ctype->mboutdigits[cnt]->nbytes); in ctype_output()
1052 cnt < ctype->wcdigits_act; cnt += 10) in ctype_output()
1053 add_locale_uint32 (&file, ctype->wcdigits[cnt]); in ctype_output()
1059 add_locale_uint32 (&file, ctype->wcoutdigits[cnt]); in ctype_output()
1067 add_locale_uint32_array (&file, ctype->default_missing, in ctype_output()
1072 add_locale_uint32 (&file, ctype->ntranslit_ignore); in ctype_output()
1079 for (runp = ctype->translit_ignore; runp != NULL; in ctype_output()
1097 if (nr < ctype->nr_charclass) in ctype_output()
1100 add_locale_uint32_array (&file, ctype->class_b[nr], 256 / 32); in ctype_output()
1102 add_locale_wctype_table (&file, &ctype->class_3level[nr]); in ctype_output()
1106 nr -= ctype->nr_charclass; in ctype_output()
1107 assert (nr < ctype->map_collection_nr); in ctype_output()
1108 add_locale_wctrans_table (&file, &ctype->map_3level[nr]); in ctype_output()
1119 ctype_class_new (struct linereader *lr, struct locale_ctype_t *ctype, in ctype_class_new() argument
1124 for (cnt = 0; cnt < ctype->nr_charclass; ++cnt) in ctype_class_new()
1125 if (strcmp (ctype->classnames[cnt], name) == 0) in ctype_class_new()
1128 if (cnt < ctype->nr_charclass) in ctype_class_new()
1134 if (ctype->nr_charclass == MAX_NR_CHARCLASS) in ctype_class_new()
1140 ctype->classnames[ctype->nr_charclass++] = name; in ctype_class_new()
1145 ctype_map_new (struct linereader *lr, struct locale_ctype_t *ctype, in ctype_map_new() argument
1151 for (cnt = 0; cnt < ctype->map_collection_nr; ++cnt) in ctype_map_new()
1153 if (strcmp (ctype->mapnames[cnt], name) == 0) in ctype_map_new()
1156 if (max_chars < ctype->map_collection_max[cnt]) in ctype_map_new()
1157 max_chars = ctype->map_collection_max[cnt]; in ctype_map_new()
1160 if (cnt < ctype->map_collection_nr) in ctype_map_new()
1166 if (ctype->map_collection_nr == MAX_NR_CHARMAP) in ctype_map_new()
1172 ctype->mapnames[cnt] = name; in ctype_map_new()
1175 ctype->map_collection_max[cnt] = charmap->mb_cur_max == 1 ? 256 : 512; in ctype_map_new()
1177 ctype->map_collection_max[cnt] = max_chars; in ctype_map_new()
1179 ctype->map_collection[cnt] = (uint32_t *) in ctype_map_new()
1180 xcalloc (sizeof (uint32_t), ctype->map_collection_max[cnt]); in ctype_map_new()
1181 ctype->map_collection_act[cnt] = 256; in ctype_map_new()
1183 ++ctype->map_collection_nr; in ctype_map_new()
1190 find_idx (struct locale_ctype_t *ctype, uint32_t **table, size_t *max, in find_idx() argument
1200 cnt = idx_table_get (&ctype->charnames_idx, idx); in find_idx()
1203 cnt = ctype->charnames_act; in find_idx()
1205 for (cnt = 256; cnt < ctype->charnames_act; ++cnt) in find_idx()
1206 if (ctype->charnames[cnt] == idx) in find_idx()
1211 if (cnt == ctype->charnames_act) in find_idx()
1214 if (ctype->charnames_act == ctype->charnames_max) in find_idx()
1216 ctype->charnames_max *= 2; in find_idx()
1217 ctype->charnames = (uint32_t *) in find_idx()
1218 xrealloc (ctype->charnames, in find_idx()
1219 sizeof (uint32_t) * ctype->charnames_max); in find_idx()
1221 ctype->charnames[ctype->charnames_act++] = idx; in find_idx()
1222 idx_table_add (&ctype->charnames_idx, idx, cnt); in find_idx()
1339 struct locale_ctype_t *ctype, in charclass_symbolic_ellipsis() argument
1403 ctype->class256_collection[seq->bytes[0]] |= class256_bit; in charclass_symbolic_ellipsis()
1407 *find_idx (ctype, &ctype->class_collection, in charclass_symbolic_ellipsis()
1408 &ctype->class_collection_max, in charclass_symbolic_ellipsis()
1409 &ctype->class_collection_act, wch) |= class_bit; in charclass_symbolic_ellipsis()
1414 if (ctype->mbdigits_act == ctype->mbdigits_max) in charclass_symbolic_ellipsis()
1416 ctype->mbdigits_max *= 2; in charclass_symbolic_ellipsis()
1417 ctype->mbdigits = xrealloc (ctype->mbdigits, in charclass_symbolic_ellipsis()
1418 (ctype->mbdigits_max in charclass_symbolic_ellipsis()
1420 ctype->wcdigits_max *= 2; in charclass_symbolic_ellipsis()
1421 ctype->wcdigits = xrealloc (ctype->wcdigits, in charclass_symbolic_ellipsis()
1422 (ctype->wcdigits_max in charclass_symbolic_ellipsis()
1426 ctype->mbdigits[ctype->mbdigits_act++] = seq; in charclass_symbolic_ellipsis()
1427 ctype->wcdigits[ctype->wcdigits_act++] = wch; in charclass_symbolic_ellipsis()
1432 if (ctype->outdigits_act >= 10) in charclass_symbolic_ellipsis()
1440 ctype->mboutdigits[ctype->outdigits_act] = seq; in charclass_symbolic_ellipsis()
1441 ctype->wcoutdigits[ctype->outdigits_act] = wch; in charclass_symbolic_ellipsis()
1442 ++ctype->outdigits_act; in charclass_symbolic_ellipsis()
1452 struct locale_ctype_t *ctype, in charclass_ucs4_ellipsis() argument
1526 ctype->class256_collection[(size_t) seq->bytes[0]] in charclass_ucs4_ellipsis()
1531 *find_idx (ctype, &ctype->class_collection, in charclass_ucs4_ellipsis()
1532 &ctype->class_collection_max, in charclass_ucs4_ellipsis()
1533 &ctype->class_collection_act, last_wch) |= class_bit; in charclass_ucs4_ellipsis()
1538 if (ctype->mbdigits_act == ctype->mbdigits_max) in charclass_ucs4_ellipsis()
1540 ctype->mbdigits_max *= 2; in charclass_ucs4_ellipsis()
1541 ctype->mbdigits = xrealloc (ctype->mbdigits, in charclass_ucs4_ellipsis()
1542 (ctype->mbdigits_max in charclass_ucs4_ellipsis()
1544 ctype->wcdigits_max *= 2; in charclass_ucs4_ellipsis()
1545 ctype->wcdigits = xrealloc (ctype->wcdigits, in charclass_ucs4_ellipsis()
1546 (ctype->wcdigits_max in charclass_ucs4_ellipsis()
1550 ctype->mbdigits[ctype->mbdigits_act++] = (seq->ucs4 == last_wch in charclass_ucs4_ellipsis()
1552 ctype->wcdigits[ctype->wcdigits_act++] = last_wch; in charclass_ucs4_ellipsis()
1557 if (ctype->outdigits_act >= 10) in charclass_ucs4_ellipsis()
1565 ctype->mboutdigits[ctype->outdigits_act] = (seq->ucs4 == last_wch in charclass_ucs4_ellipsis()
1567 ctype->wcoutdigits[ctype->outdigits_act] = last_wch; in charclass_ucs4_ellipsis()
1568 ++ctype->outdigits_act; in charclass_ucs4_ellipsis()
1577 struct locale_ctype_t *ctype, in charclass_charcode_ellipsis() argument
1616 ctype->class256_collection[(size_t) last_charcode[0]] in charclass_charcode_ellipsis()
1630 *find_idx (ctype, &ctype->class_collection, in charclass_charcode_ellipsis()
1631 &ctype->class_collection_max, in charclass_charcode_ellipsis()
1632 &ctype->class_collection_act, wch) |= class_bit; in charclass_charcode_ellipsis()
1640 if (ctype->mbdigits_act == ctype->mbdigits_max) in charclass_charcode_ellipsis()
1642 ctype->mbdigits_max *= 2; in charclass_charcode_ellipsis()
1643 ctype->mbdigits = xrealloc (ctype->mbdigits, in charclass_charcode_ellipsis()
1644 (ctype->mbdigits_max in charclass_charcode_ellipsis()
1646 ctype->wcdigits_max *= 2; in charclass_charcode_ellipsis()
1647 ctype->wcdigits = xrealloc (ctype->wcdigits, in charclass_charcode_ellipsis()
1648 (ctype->wcdigits_max in charclass_charcode_ellipsis()
1656 ctype->mbdigits[ctype->mbdigits_act++] = seq; in charclass_charcode_ellipsis()
1657 ctype->wcdigits[ctype->wcdigits_act++] = wch; in charclass_charcode_ellipsis()
1663 if (ctype->outdigits_act >= 10) in charclass_charcode_ellipsis()
1675 ctype->mboutdigits[ctype->outdigits_act] = seq; in charclass_charcode_ellipsis()
1676 ctype->wcoutdigits[ctype->outdigits_act] = wch; in charclass_charcode_ellipsis()
1677 ++ctype->outdigits_act; in charclass_charcode_ellipsis()
1687 find_translit2 (struct locale_ctype_t *ctype, const struct charmap_t *charmap, in find_translit2() argument
1690 struct translit_t *trunp = ctype->translit; in find_translit2()
1691 struct translit_ignore_t *tirunp = ctype->translit_ignore; in find_translit2()
1751 struct locale_ctype_t *ctype; in find_translit() local
1755 ctype = locale->categories[LC_CTYPE].ctype; in find_translit()
1757 if (ctype == NULL) in find_translit()
1760 if (ctype->translit != NULL) in find_translit()
1761 result = find_translit2 (ctype, charmap, wch); in find_translit()
1765 struct translit_include_t *irunp = ctype->translit_include; in find_translit()
1855 read_translit_entry (struct linereader *ldfile, struct locale_ctype_t *ctype, in read_translit_entry() argument
1862 struct obstack *ob = &ctype->mempool; in read_translit_entry()
1906 result->next = ctype->translit; in read_translit_entry()
1907 ctype->translit = result; in read_translit_entry()
1939 struct locale_ctype_t *ctype, in read_translit_ignore_entry() argument
1982 obstack_alloc (&ctype->mempool, sizeof (struct translit_ignore_t)); in read_translit_ignore_entry()
1987 newp->next = ctype->translit_ignore; in read_translit_ignore_entry()
1988 ctype->translit_ignore = newp; in read_translit_ignore_entry()
2069 struct locale_ctype_t *ctype; in ctype_read() local
2139 if (copy_locale->categories[LC_CTYPE].ctype == NULL) in ctype_read()
2151 ctype = result->categories[LC_CTYPE].ctype; in ctype_read()
2155 ctype->repertoire = repertoire; in ctype_read()
2181 ctype_class_new (ldfile, ctype, now->val.str.startmb); in ctype_read()
2196 ctype_map_new (ldfile, ctype, now->val.str.startmb, charmap); in ctype_read()
2222 for (cnt = 0; cnt < ctype->nr_charclass; ++cnt) in ctype_read()
2223 if (strcmp (ctype->classnames[cnt], now->val.str.startmb) == 0) in ctype_read()
2225 if (cnt >= ctype->nr_charclass) in ctype_read()
2228 ctype_class_new (ldfile, ctype, now->val.str.startmb); in ctype_read()
2230 class_bit = _ISwbit (ctype->nr_charclass - 1); in ctype_read()
2278 ctype->class_done |= class_bit; in ctype_read()
2296 ctype->class256_collection[seq->bytes[0]] |= class256_bit; in ctype_read()
2301 *find_idx (ctype, &ctype->class_collection, in ctype_read()
2302 &ctype->class_collection_max, in ctype_read()
2303 &ctype->class_collection_act, wch) |= class_bit; in ctype_read()
2321 if (ctype->mbdigits_act == ctype->mbdigits_max) in ctype_read()
2323 ctype->mbdigits_max += 10; in ctype_read()
2324 ctype->mbdigits = xrealloc (ctype->mbdigits, in ctype_read()
2325 (ctype->mbdigits_max in ctype_read()
2327 ctype->wcdigits_max += 10; in ctype_read()
2328 ctype->wcdigits = xrealloc (ctype->wcdigits, in ctype_read()
2329 (ctype->wcdigits_max in ctype_read()
2333 ctype->mbdigits[ctype->mbdigits_act++] = seq; in ctype_read()
2334 ctype->wcdigits[ctype->wcdigits_act++] = wch; in ctype_read()
2339 if (ctype->outdigits_act >= 10) in ctype_read()
2348 ctype->mboutdigits[ctype->outdigits_act] = seq; in ctype_read()
2349 ctype->wcoutdigits[ctype->outdigits_act] = wch; in ctype_read()
2350 ++ctype->outdigits_act; in ctype_read()
2375 charclass_symbolic_ellipsis (ldfile, ctype, charmap, in ctype_read()
2390 charclass_ucs4_ellipsis (ldfile, ctype, charmap, in ctype_read()
2404 charclass_charcode_ellipsis (ldfile, ctype, charmap, in ctype_read()
2477 if (ctype->outdigits_act != 0) in ctype_read()
2526 for (cnt = 2; cnt < ctype->map_collection_nr; ++cnt) in ctype_read()
2527 if (strcmp (now->val.str.startmb, ctype->mapnames[cnt]) == 0) in ctype_read()
2530 if (cnt < ctype->map_collection_nr) in ctype_read()
2534 ctype_map_new (ldfile, ctype, now->val.str.startmb, charmap); in ctype_read()
2550 if (ctype->tomap_done[mapidx]) in ctype_read()
2553 ctype->mapnames[mapidx]); in ctype_read()
2557 ctype->tomap_done[mapidx] = 1; in ctype_read()
2601 ctype->to_nonascii = 1; in ctype_read()
2606 ctype->map256_collection[mapidx][from_seq->bytes[0]] in ctype_read()
2612 *find_idx (ctype, &ctype->map_collection[mapidx], in ctype_read()
2613 &ctype->map_collection_max[mapidx], in ctype_read()
2614 &ctype->map_collection_act[mapidx], in ctype_read()
2704 include_ptr = &ctype->translit_include; in ctype_read()
2731 if (ctype->default_missing != NULL) in ctype_read()
2736 ctype->default_missing_file, in ctype_read()
2737 ctype->default_missing_lineno, in ctype_read()
2743 ctype->default_missing = wstr; in ctype_read()
2744 ctype->default_missing_file = ldfile->fname; in ctype_read()
2745 ctype->default_missing_lineno = ldfile->lineno; in ctype_read()
2772 read_translit_ignore_entry (ldfile, ctype, charmap, in ctype_read()
2777 read_translit_entry (ldfile, ctype, now, charmap, repertoire); in ctype_read()
2799 for (cnt = 0; cnt < ctype->nr_charclass; ++cnt) in ctype_read()
2800 if (strcmp (now->val.str.startmb, ctype->classnames[cnt]) == 0) in ctype_read()
2802 if (cnt < ctype->nr_charclass) in ctype_read()
2809 for (cnt = 0; cnt < ctype->map_collection_nr; ++cnt) in ctype_read()
2810 if (strcmp (now->val.str.startmb, ctype->mapnames[cnt]) == 0) in ctype_read()
2812 if (cnt < ctype->map_collection_nr) in ctype_read()
2852 set_one_default (struct locale_ctype_t *ctype, in set_one_default() argument
2886 ctype->class256_collection[seq->bytes[0]] |= bit; in set_one_default()
2890 ELEM (ctype, class_collection, , ch) |= bitw; in set_one_default()
2895 set_class_defaults (struct locale_ctype_t *ctype, in set_class_defaults() argument
2900 set_one_default (ctype, charmap, bitpos, from, to) in set_class_defaults()
2908 if ((ctype->class_done & BITw (tok_upper)) == 0) in set_class_defaults()
2914 if ((ctype->class_done & BITw (tok_lower)) == 0) in set_class_defaults()
2920 if ((ctype->class_done & BITw (tok_alpha)) == 0) in set_class_defaults()
2928 if ((ctype->class256_collection[cnt] & mask) != 0) in set_class_defaults()
2929 ctype->class256_collection[cnt] |= BIT (tok_alpha); in set_class_defaults()
2931 for (size_t cnt = 0; cnt < ctype->class_collection_act; ++cnt) in set_class_defaults()
2932 if ((ctype->class_collection[cnt] & maskw) != 0) in set_class_defaults()
2933 ctype->class_collection[cnt] |= BITw (tok_alpha); in set_class_defaults()
2936 if ((ctype->class_done & BITw (tok_digit)) == 0) in set_class_defaults()
2950 if ((ctype->class256_collection[cnt] & mask) != 0) in set_class_defaults()
2951 ctype->class256_collection[cnt] |= BIT (tok_alnum); in set_class_defaults()
2953 for (size_t cnt = 0; cnt < ctype->class_collection_act; ++cnt) in set_class_defaults()
2954 if ((ctype->class_collection[cnt] & maskw) != 0) in set_class_defaults()
2955 ctype->class_collection[cnt] |= BITw (tok_alnum); in set_class_defaults()
2958 if ((ctype->class_done & BITw (tok_space)) == 0) in set_class_defaults()
2982 ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space); in set_class_defaults()
2985 ELEM (ctype, class_collection, , L' ') |= BITw (tok_space); in set_class_defaults()
3001 ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space); in set_class_defaults()
3004 ELEM (ctype, class_collection, , L'\f') |= BITw (tok_space); in set_class_defaults()
3021 ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space); in set_class_defaults()
3024 ELEM (ctype, class_collection, , L'\n') |= BITw (tok_space); in set_class_defaults()
3041 ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space); in set_class_defaults()
3044 ELEM (ctype, class_collection, , L'\r') |= BITw (tok_space); in set_class_defaults()
3061 ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space); in set_class_defaults()
3064 ELEM (ctype, class_collection, , L'\t') |= BITw (tok_space); in set_class_defaults()
3081 ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space); in set_class_defaults()
3084 ELEM (ctype, class_collection, , L'\v') |= BITw (tok_space); in set_class_defaults()
3087 if ((ctype->class_done & BITw (tok_xdigit)) == 0) in set_class_defaults()
3098 if ((ctype->class_done & BITw (tok_blank)) == 0) in set_class_defaults()
3120 ctype->class256_collection[seq->bytes[0]] |= BIT (tok_blank); in set_class_defaults()
3123 ELEM (ctype, class_collection, , L' ') |= BITw (tok_blank); in set_class_defaults()
3140 ctype->class256_collection[seq->bytes[0]] |= BIT (tok_blank); in set_class_defaults()
3143 ELEM (ctype, class_collection, , L'\t') |= BITw (tok_blank); in set_class_defaults()
3146 if ((ctype->class_done & BITw (tok_graph)) == 0) in set_class_defaults()
3158 for (size_t cnt = 0; cnt < ctype->class_collection_act; ++cnt) in set_class_defaults()
3159 if ((ctype->class_collection[cnt] & maskw) != 0) in set_class_defaults()
3160 ctype->class_collection[cnt] |= BITw (tok_graph); in set_class_defaults()
3163 if ((ctype->class256_collection[cnt] & mask) != 0) in set_class_defaults()
3164 ctype->class256_collection[cnt] |= BIT (tok_graph); in set_class_defaults()
3167 if ((ctype->class_done & BITw (tok_print)) == 0) in set_class_defaults()
3181 for (size_t cnt = 0; cnt < ctype->class_collection_act; ++cnt) in set_class_defaults()
3182 if ((ctype->class_collection[cnt] & maskw) != 0) in set_class_defaults()
3183 ctype->class_collection[cnt] |= BITw (tok_print); in set_class_defaults()
3186 if ((ctype->class256_collection[cnt] & mask) != 0) in set_class_defaults()
3187 ctype->class256_collection[cnt] |= BIT (tok_print); in set_class_defaults()
3206 ctype->class256_collection[seq->bytes[0]] |= BIT (tok_print); in set_class_defaults()
3209 ELEM (ctype, class_collection, , L' ') |= BITw (tok_print); in set_class_defaults()
3212 if (ctype->tomap_done[0] == 0) in set_class_defaults()
3274 ctype->map256_collection[0][seq_from->bytes[0]] in set_class_defaults()
3279 ELEM (ctype, map_collection, [0], ch) = ch + ('A' - 'a'); in set_class_defaults()
3283 if (ctype->tomap_done[1] == 0) in set_class_defaults()
3287 for (size_t cnt = 0; cnt < ctype->map_collection_act[0]; ++cnt) in set_class_defaults()
3288 if (ctype->map_collection[0][cnt] != 0) in set_class_defaults()
3289 ELEM (ctype, map_collection, [1], in set_class_defaults()
3290 ctype->map_collection[0][cnt]) in set_class_defaults()
3291 = ctype->charnames[cnt]; in set_class_defaults()
3294 if (ctype->map256_collection[0][cnt] != 0) in set_class_defaults()
3295 ctype->map256_collection[1][ctype->map256_collection[0][cnt]] = cnt; in set_class_defaults()
3298 if (ctype->outdigits_act != 10) in set_class_defaults()
3300 if (ctype->outdigits_act != 0) in set_class_defaults()
3305 for (size_t cnt = ctype->outdigits_act; cnt < 10; ++cnt) in set_class_defaults()
3307 ctype->mboutdigits[cnt] = charmap_find_symbol (charmap, in set_class_defaults()
3311 if (ctype->mboutdigits[cnt] == NULL) in set_class_defaults()
3312 ctype->mboutdigits[cnt] = charmap_find_symbol (charmap, in set_class_defaults()
3316 if (ctype->mboutdigits[cnt] == NULL) in set_class_defaults()
3317 ctype->mboutdigits[cnt] = charmap_find_symbol (charmap, in set_class_defaults()
3320 if (ctype->mboutdigits[cnt] == NULL) in set_class_defaults()
3326 ctype->mboutdigits[cnt] = obstack_alloc (&((struct charmap_t *) charmap)->mem_pool, in set_class_defaults()
3331 ctype->mboutdigits[cnt]->bytes[0] = digits[cnt]; in set_class_defaults()
3332 ctype->mboutdigits[cnt]->nbytes = 1; in set_class_defaults()
3335 ctype->wcoutdigits[cnt] = L'0' + cnt; in set_class_defaults()
3338 ctype->outdigits_act = 10; in set_class_defaults()
3527 translit_flatten (struct locale_ctype_t *ctype, in translit_flatten() argument
3531 while (ctype->translit_include != NULL) in translit_flatten()
3533 const char *copy_locale = ctype->translit_include->copy_locale; in translit_flatten()
3534 const char *copy_repertoire = ctype->translit_include->copy_repertoire; in translit_flatten()
3539 ctype->translit_include = ctype->translit_include->next; in translit_flatten()
3543 if (other == NULL || other->categories[LC_CTYPE].ctype == NULL) in translit_flatten()
3552 other->categories[LC_CTYPE].ctype; in translit_flatten()
3573 if (ctype->default_missing == NULL) in translit_flatten()
3574 ctype->default_missing = other_ctype->default_missing; in translit_flatten()
3582 allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, in allocate_arrays() argument
3596 ctype->ctype_b = (char_class_t *) xcalloc (256 + 128, sizeof (char_class_t)); in allocate_arrays()
3597 ctype->ctype32_b = (char_class32_t *) xcalloc (256, sizeof (char_class32_t)); in allocate_arrays()
3598 ctype->class_b = (uint32_t **) in allocate_arrays()
3599 xmalloc (ctype->nr_charclass * sizeof (uint32_t *)); in allocate_arrays()
3600 ctype->class_3level = (struct wctype_table *) in allocate_arrays()
3601 xmalloc (ctype->nr_charclass * sizeof (struct wctype_table)); in allocate_arrays()
3605 ctype->ctype_b[128 + idx] = ctype->class256_collection[idx]; in allocate_arrays()
3610 ctype->ctype_b[idx] = ctype->ctype_b[256 + idx]; in allocate_arrays()
3613 for (idx = 0; idx < ctype->class_collection_act; ++idx) in allocate_arrays()
3614 if (ctype->charnames[idx] < 0x100) in allocate_arrays()
3615 ctype->ctype32_b[ctype->charnames[idx]] = ctype->class_collection[idx]; in allocate_arrays()
3617 for (nr = 0; nr < ctype->nr_charclass; nr++) in allocate_arrays()
3619 ctype->class_b[nr] = (uint32_t *) xcalloc (256 / 32, sizeof (uint32_t)); in allocate_arrays()
3627 if (ctype->class256_collection[idx] & _ISbit (nr)) in allocate_arrays()
3628 ctype->class_b[nr][idx >> 5] |= (uint32_t) 1 << (idx & 0x1f); in allocate_arrays()
3631 for (nr = 0; nr < ctype->nr_charclass; nr++) in allocate_arrays()
3635 t = &ctype->class_3level[nr]; in allocate_arrays()
3640 for (idx = 0; idx < ctype->class_collection_act; ++idx) in allocate_arrays()
3641 if (ctype->class_collection[idx] & _ISwbit (nr)) in allocate_arrays()
3642 wctype_table_add (t, ctype->charnames[idx]); in allocate_arrays()
3646 "LC_CTYPE", ctype->classnames[nr], in allocate_arrays()
3651 ctype->map_b = (uint32_t **) xmalloc (2 * sizeof (uint32_t *)); in allocate_arrays()
3652 ctype->map32_b = (uint32_t **) xmalloc (ctype->map_collection_nr in allocate_arrays()
3654 ctype->map_3level = (struct wctrans_table *) in allocate_arrays()
3655 xmalloc (ctype->map_collection_nr * sizeof (struct wctrans_table)); in allocate_arrays()
3663 ctype->map_b[idx] = (uint32_t *) in allocate_arrays()
3668 ctype->map_b[idx][128 + idx2] = ctype->map256_collection[idx][idx2]; in allocate_arrays()
3673 ctype->map_b[idx][idx2] = ctype->map_b[idx][256 + idx2]; in allocate_arrays()
3676 ctype->map_b[idx][127] = EOF; in allocate_arrays()
3679 for (idx = 0; idx < ctype->map_collection_nr; ++idx) in allocate_arrays()
3684 ctype->map32_b[idx] = (uint32_t *) xmalloc (256 * sizeof (uint32_t)); in allocate_arrays()
3688 ctype->map32_b[idx][idx2] = in allocate_arrays()
3689 (ctype->map_collection[idx][idx2] != 0 in allocate_arrays()
3690 ? ctype->map_collection[idx][idx2] in allocate_arrays()
3694 for (nr = 0; nr < ctype->map_collection_nr; nr++) in allocate_arrays()
3698 t = &ctype->map_3level[nr]; in allocate_arrays()
3703 for (idx = 0; idx < ctype->map_collection_act[nr]; ++idx) in allocate_arrays()
3704 if (ctype->map_collection[nr][idx] != 0) in allocate_arrays()
3705 wctrans_table_add (t, ctype->charnames[idx], in allocate_arrays()
3706 ctype->map_collection[nr][idx]); in allocate_arrays()
3710 "LC_CTYPE", ctype->mapnames[nr], in allocate_arrays()
3715 ctype->class_name_ptr = (uint32_t *) xmalloc (ctype->nr_charclass in allocate_arrays()
3717 ctype->map_name_ptr = (uint32_t *) xmalloc (ctype->map_collection_nr in allocate_arrays()
3720 ctype->class_offset = _NL_ITEM_INDEX (_NL_CTYPE_EXTRA_MAP_1); in allocate_arrays()
3721 ctype->map_offset = ctype->class_offset + ctype->nr_charclass; in allocate_arrays()
3733 t = &ctype->width; in allocate_arrays()
3746 data->ucs4 = repertoire_find_value (ctype->repertoire, in allocate_arrays()
3752 find_idx (ctype, &ctype->class_collection, NULL, in allocate_arrays()
3753 &ctype->class_collection_act, data->ucs4); in allocate_arrays()
3790 wch = repertoire_find_value (ctype->repertoire, seq->name, in allocate_arrays()
3797 find_idx (ctype, &ctype->class_collection, NULL, in allocate_arrays()
3798 &ctype->class_collection_act, wch); in allocate_arrays()
3837 ctype->mb_cur_max = charmap->mb_cur_max; in allocate_arrays()
3845 if (ctype->translit_include != NULL) in allocate_arrays()
3848 translit_flatten (ctype, charmap, &ctype->translit); in allocate_arrays()
3850 if (ctype->translit != NULL) in allocate_arrays()
3855 struct translit_t *runp = ctype->translit; in allocate_arrays()
3868 runp = ctype->translit; in allocate_arrays()
3930 ctype->translit_from_idx = xmalloc (number * sizeof (uint32_t)); in allocate_arrays()
3931 ctype->translit_from_tbl = xmalloc (from_len * sizeof (uint32_t)); in allocate_arrays()
3932 ctype->translit_to_idx = xmalloc (number * sizeof (uint32_t)); in allocate_arrays()
3933 ctype->translit_to_tbl = xmalloc (to_len * sizeof (uint32_t)); in allocate_arrays()
3942 ctype->translit_from_idx[cnt] = from_len; in allocate_arrays()
3943 ctype->translit_to_idx[cnt] = to_len; in allocate_arrays()
3946 wmemcpy ((wchar_t *) &ctype->translit_from_tbl[from_len], in allocate_arrays()
3950 ctype->translit_to_idx[cnt] = to_len; in allocate_arrays()
3955 wmemcpy ((wchar_t *) &ctype->translit_to_tbl[to_len], in allocate_arrays()
3960 ctype->translit_to_tbl[to_len++] = L'\0'; in allocate_arrays()
3964 ctype->translit_idx_size = number; in allocate_arrays()
3965 ctype->translit_from_tbl_size = from_len * sizeof (uint32_t); in allocate_arrays()
3966 ctype->translit_to_tbl_size = to_len * sizeof (uint32_t); in allocate_arrays()
3970 ctype->translit_from_idx = no_str; in allocate_arrays()
3971 ctype->translit_from_tbl = no_str; in allocate_arrays()
3972 ctype->translit_to_tbl = no_str; in allocate_arrays()
3973 ctype->translit_idx_size = 0; in allocate_arrays()
3974 ctype->translit_from_tbl_size = 0; in allocate_arrays()
3975 ctype->translit_to_tbl_size = 0; in allocate_arrays()