diff options
Diffstat (limited to 'locale/programs')
-rw-r--r-- | locale/programs/ld-address.c | 17 | ||||
-rw-r--r-- | locale/programs/ld-ctype.c | 361 | ||||
-rw-r--r-- | locale/programs/ld-paper.c | 31 | ||||
-rw-r--r-- | locale/programs/ld-time.c | 420 |
4 files changed, 109 insertions, 720 deletions
diff --git a/locale/programs/ld-address.c b/locale/programs/ld-address.c index 49900bd471..6dce62bf8f 100644 --- a/locale/programs/ld-address.c +++ b/locale/programs/ld-address.c @@ -68,7 +68,6 @@ struct locale_address_t const char *country_ab2; const char *country_ab3; uint32_t country_num; - uint32_t country_num_ob; const char *country_car; const char *country_isbn; const char *lang_name; @@ -295,7 +294,6 @@ address_finish (struct localedef_t *locale, struct charmap_t *charmap) %s: numeric country code `%d' not valid"), "LC_ADDRESS", address->country_num); } - address->country_num_ob = bswap_32 (address->country_num); if (address->country_ab2 == NULL) { @@ -373,21 +371,8 @@ address_output (struct localedef_t *locale, struct charmap_t *charmap, iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1; ++cnt; -#if __BYTE_ORDER == __LITTLE_ENDIAN -# define country_num_eb country_num_ob -# define country_num_el country_num -#else -# define country_num_eb country_num -# define country_num_el country_num_ob -#endif - - idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len; - iov[cnt].iov_base = (void *) address->country_num_eb; - iov[cnt].iov_len = sizeof (uint32_t); - ++cnt; - idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len; - iov[cnt].iov_base = (void *) address->country_num_el; + iov[cnt].iov_base = (void *) address->country_num; iov[cnt].iov_len = sizeof (uint32_t); ++cnt; diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index 6dea9d0dd8..d587288db7 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -65,9 +65,7 @@ the number of bits for character classes to 16. When compatibility is not necessary anymore increase the number to 32. */ #define char_class_t uint16_t -#define CHAR_CLASS_TRANS bswap_16 #define char_class32_t uint32_t -#define CHAR_CLASS32_TRANS bswap_32 /* Type to describe a transliteration action. We have a possibly @@ -144,27 +142,19 @@ struct locale_ctype_t uint32_t plane_cnt; char_class_t *ctype_b; char_class32_t *ctype32_b; - uint32_t *names_el; - uint32_t *names_eb; - uint32_t **map_eb; - uint32_t **map_el; + uint32_t *names; + uint32_t **map; uint32_t *class_name_ptr; uint32_t *map_name_ptr; unsigned char *width; uint32_t mb_cur_max; const char *codeset_name; - uint32_t translit_hash_size_eb; - uint32_t translit_hash_size_el; - uint32_t translit_hash_layers_eb; - uint32_t translit_hash_layers_el; - uint32_t *translit_from_idx_eb; - uint32_t *translit_from_idx_el; - uint32_t *translit_from_tbl_eb; - uint32_t *translit_from_tbl_el; - uint32_t *translit_to_idx_eb; - uint32_t *translit_to_idx_el; - uint32_t *translit_to_tbl_eb; - uint32_t *translit_to_tbl_el; + uint32_t translit_hash_size; + uint32_t translit_hash_layers; + uint32_t *translit_from_idx; + uint32_t *translit_from_tbl; + uint32_t *translit_to_idx; + uint32_t *translit_to_tbl; size_t translit_idx_size; size_t translit_from_tbl_size; size_t translit_to_tbl_size; @@ -740,21 +730,12 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap, ctype->ctype_b, (256 + 128) * sizeof (char_class_t)); - CTYPE_DATA (_NL_CTYPE_TOUPPER_EB, - ctype->map_eb[0], + CTYPE_DATA (_NL_CTYPE_TOUPPER, + ctype->map[0], (ctype->plane_size * ctype->plane_cnt + 128) * sizeof (uint32_t)); - CTYPE_DATA (_NL_CTYPE_TOLOWER_EB, - ctype->map_eb[1], - (ctype->plane_size * ctype->plane_cnt + 128) - * sizeof (uint32_t)); - - CTYPE_DATA (_NL_CTYPE_TOUPPER_EL, - ctype->map_el[0], - (ctype->plane_size * ctype->plane_cnt + 128) - * sizeof (uint32_t)); - CTYPE_DATA (_NL_CTYPE_TOLOWER_EL, - ctype->map_el[1], + CTYPE_DATA (_NL_CTYPE_TOLOWER, + ctype->map[1], (ctype->plane_size * ctype->plane_cnt + 128) * sizeof (uint32_t)); @@ -763,90 +744,34 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap, (ctype->plane_size * ctype->plane_cnt * sizeof (char_class32_t))); - CTYPE_DATA (_NL_CTYPE_NAMES_EB, - ctype->names_eb, (ctype->plane_size * ctype->plane_cnt - * sizeof (uint32_t))); - CTYPE_DATA (_NL_CTYPE_NAMES_EL, - ctype->names_el, (ctype->plane_size * ctype->plane_cnt - * sizeof (uint32_t))); - - CTYPE_DATA (_NL_CTYPE_TRANSLIT_HASH_SIZE_EB, - &ctype->translit_hash_size_eb, sizeof (uint32_t)); - CTYPE_DATA (_NL_CTYPE_TRANSLIT_HASH_SIZE_EL, - &ctype->translit_hash_size_el, sizeof (uint32_t)); - CTYPE_DATA (_NL_CTYPE_TRANSLIT_HASH_LAYERS_EB, - &ctype->translit_hash_layers_eb, sizeof (uint32_t)); - CTYPE_DATA (_NL_CTYPE_TRANSLIT_HASH_LAYERS_EL, - &ctype->translit_hash_layers_el, sizeof (uint32_t)); - - CTYPE_DATA (_NL_CTYPE_TRANSLIT_FROM_IDX_EB, - ctype->translit_from_idx_eb, - ctype->translit_idx_size); - CTYPE_DATA (_NL_CTYPE_TRANSLIT_FROM_IDX_EL, - ctype->translit_from_idx_el, + CTYPE_DATA (_NL_CTYPE_NAMES, + ctype->names, (ctype->plane_size * ctype->plane_cnt + * sizeof (uint32_t))); + + CTYPE_DATA (_NL_CTYPE_TRANSLIT_HASH_SIZE, + &ctype->translit_hash_size, sizeof (uint32_t)); + CTYPE_DATA (_NL_CTYPE_TRANSLIT_HASH_LAYERS, + &ctype->translit_hash_layers, sizeof (uint32_t)); + + CTYPE_DATA (_NL_CTYPE_TRANSLIT_FROM_IDX, + ctype->translit_from_idx, ctype->translit_idx_size); - CTYPE_DATA (_NL_CTYPE_TRANSLIT_FROM_TBL_EB, - ctype->translit_from_tbl_eb, - ctype->translit_from_tbl_size); - CTYPE_DATA (_NL_CTYPE_TRANSLIT_FROM_TBL_EL, - ctype->translit_from_tbl_el, + CTYPE_DATA (_NL_CTYPE_TRANSLIT_FROM_TBL, + ctype->translit_from_tbl, ctype->translit_from_tbl_size); - CTYPE_DATA (_NL_CTYPE_TRANSLIT_TO_IDX_EB, - ctype->translit_to_idx_eb, - ctype->translit_idx_size); - CTYPE_DATA (_NL_CTYPE_TRANSLIT_TO_IDX_EL, - ctype->translit_to_idx_el, + CTYPE_DATA (_NL_CTYPE_TRANSLIT_TO_IDX, + ctype->translit_to_idx, ctype->translit_idx_size); - CTYPE_DATA (_NL_CTYPE_TRANSLIT_TO_TBL_EB, - ctype->translit_to_tbl_eb, ctype->translit_to_tbl_size); - CTYPE_DATA (_NL_CTYPE_TRANSLIT_TO_TBL_EL, - ctype->translit_to_tbl_el, ctype->translit_to_tbl_size); + CTYPE_DATA (_NL_CTYPE_TRANSLIT_TO_TBL, + ctype->translit_to_tbl, ctype->translit_to_tbl_size); -#if __BYTE_ORDER == __BIG_ENDIAN - CTYPE_DATA (_NL_CTYPE_HASH_SIZE_EB, + CTYPE_DATA (_NL_CTYPE_HASH_SIZE, &ctype->plane_size, sizeof (uint32_t)); - CTYPE_DATA (_NL_CTYPE_HASH_LAYERS_EB, + CTYPE_DATA (_NL_CTYPE_HASH_LAYERS, &ctype->plane_cnt, sizeof (uint32_t)); -#else - case _NL_ITEM_INDEX (_NL_CTYPE_HASH_SIZE_EB): - iov[2 + elem + offset].iov_base = - (uint32_t *) alloca (sizeof (uint32_t)); - *(uint32_t *) iov[2 + elem + offset].iov_base = - bswap_32 (ctype->plane_size); - iov[2 + elem + offset].iov_len = sizeof (uint32_t); - break; - case _NL_ITEM_INDEX (_NL_CTYPE_HASH_LAYERS_EB): - iov[2 + elem + offset].iov_base = - (uint32_t *) alloca (sizeof (uint32_t)); - *(uint32_t *) iov[2 + elem + offset].iov_base = - bswap_32 (ctype->plane_cnt); - iov[2 + elem + offset].iov_len = sizeof (uint32_t); - break; -#endif -#if __BYTE_ORDER == __BIG_ENDIAN - CTYPE_DATA (_NL_CTYPE_HASH_SIZE_EL, - &ctype->plane_size, sizeof (uint32_t)); - CTYPE_DATA (_NL_CTYPE_HASH_LAYERS_EL, - &ctype->plane_cnt, sizeof (uint32_t)); -#else - case _NL_ITEM_INDEX (_NL_CTYPE_HASH_SIZE_EL): - iov[2 + elem + offset].iov_base = - (uint32_t *) alloca (sizeof (uint32_t)); - *(uint32_t *) iov[2 + elem + offset].iov_base = - bswap_32 (ctype->plane_size); - iov[2 + elem + offset].iov_len = sizeof (uint32_t); - break; - case _NL_ITEM_INDEX (_NL_CTYPE_HASH_LAYERS_EL): - iov[2 + elem + offset].iov_base = - (uint32_t *) alloca (sizeof (uint32_t)); - *(uint32_t *) iov[2 + elem + offset].iov_base = - bswap_32 (ctype->plane_cnt); - iov[2 + elem + offset].iov_len = sizeof (uint32_t); - break; -#endif case _NL_ITEM_INDEX (_NL_CTYPE_CLASS_NAMES): /* The class name array. */ @@ -906,34 +831,18 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap, idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len; break; - case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS_MB_LEN_EB): - case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS_MB_LEN_EL): + 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); - if ((elem == _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS_MB_LEN_EB) - && __BYTE_ORDER == __BIG_ENDIAN) - || (elem == _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS_MB_LEN_EL) - && __BYTE_ORDER == __LITTLE_ENDIAN)) - *(uint32_t *) iov[2 + elem + offset].iov_base = - ctype->mbdigits_act / 10; - else - *(uint32_t *) iov[2 + elem + offset].iov_base = - bswap_32 (ctype->mbdigits_act / 10); + *(uint32_t *) iov[2 + elem + offset].iov_base = + ctype->mbdigits_act / 10; break; - case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS_WC_LEN_EB): - case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS_WC_LEN_EL): + case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS_WC_LEN): iov[2 + elem + offset].iov_base = alloca (sizeof (uint32_t)); iov[2 + elem + offset].iov_len = sizeof (uint32_t); - if ((elem == _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS_WC_LEN_EB) - && __BYTE_ORDER == __BIG_ENDIAN) - || (elem == _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS_WC_LEN_EL) - && __BYTE_ORDER == __LITTLE_ENDIAN)) - *(uint32_t *) iov[2 + elem + offset].iov_base = - ctype->wcdigits_act / 10; - else - *(uint32_t *) iov[2 + elem + offset].iov_base = - bswap_32 (ctype->wcdigits_act / 10); + *(uint32_t *) iov[2 + elem + offset].iov_base = + ctype->wcdigits_act / 10; break; case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS0_MB) ... _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS9_MB): @@ -973,59 +882,25 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap, ctype->mbdigits[cnt]->nbytes) = '\0'; break; - case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS0_WC_EB) ... _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS9_WC_EB): - total = ctype->wcdigits_act / 10; - - iov[2 + elem + offset].iov_base = - (uint32_t *) alloca (total * sizeof (uint32_t)); - iov[2 + elem + offset].iov_len = total * sizeof (uint32_t); - - for (cnt = elem - _NL_CTYPE_INDIGITS0_WC_EB; - cnt < ctype->wcdigits_act; cnt += 10) - ((uint32_t *) iov[2 + elem + offset].iov_base)[cnt / 10] - = (__BYTE_ORDER == __LITTLE_ENDIAN - ? bswap_32 (ctype->wcdigits[cnt]) : ctype->wcdigits[cnt]); - break; - - case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS0_WC_EL) ... _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS9_WC_EL): + case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS0_WC) ... _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS9_WC): total = ctype->wcdigits_act / 10; iov[2 + elem + offset].iov_base = (uint32_t *) alloca (total * sizeof (uint32_t)); iov[2 + elem + offset].iov_len = total * sizeof (uint32_t); - for (cnt = elem - _NL_CTYPE_INDIGITS0_WC_EL; + for (cnt = elem - _NL_CTYPE_INDIGITS0_WC; cnt < ctype->wcdigits_act; cnt += 10) ((uint32_t *) iov[2 + elem + offset].iov_base)[cnt / 10] - = (__BYTE_ORDER == __BIG_ENDIAN - ? bswap_32 (ctype->wcdigits[cnt]) : ctype->wcdigits[cnt]); + = ctype->wcdigits[cnt]; break; -#if __BYTE_ORDER == __BIG_ENDIAN - case _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT0_WC_EB) ... _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT9_WC_EB): - cnt = elem - _NL_CTYPE_OUTDIGIT0_WC_EB; -#else - case _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT0_WC_EL) ... _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT9_WC_EL): - cnt = elem - _NL_CTYPE_OUTDIGIT0_WC_EL; -#endif + case _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT0_WC) ... _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT9_WC): + cnt = elem - _NL_CTYPE_OUTDIGIT0_WC; iov[2 + elem + offset].iov_base = &ctype->wcoutdigits[cnt]; iov[2 + elem + offset].iov_len = sizeof (uint32_t); break; -#if __BYTE_ORDER == __LITTLE_ENDIAN - case _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT0_WC_EB) ... _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT9_WC_EB): - cnt = elem - _NL_CTYPE_OUTDIGIT0_WC_EB; -#else - case _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT0_WC_EL) ... _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT9_WC_EL): - cnt = elem - _NL_CTYPE_OUTDIGIT0_WC_EL; -#endif - iov[2 + elem + offset].iov_base = - (uint32_t *) alloca (sizeof (uint32_t)); - *(uint32_t *) iov[2 + elem + offset].iov_base = - bswap_32 (ctype->wcoutdigits[cnt]); - iov[2 + elem + offset].iov_len = sizeof (uint32_t); - break; - default: assert (! "unknown CTYPE element"); } @@ -1034,11 +909,7 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap, /* Handle extra maps. */ size_t nr = (elem - _NL_ITEM_INDEX (_NL_NUM_LC_CTYPE)) >> 1; - if (((elem - _NL_ITEM_INDEX (_NL_NUM_LC_CTYPE)) & 1) == 0) - iov[2 + elem + offset].iov_base = ctype->map_eb[nr]; - else - iov[2 + elem + offset].iov_base = ctype->map_el[nr]; - + iov[2 + elem + offset].iov_base = ctype->map[nr]; iov[2 + elem + offset].iov_len = ((ctype->plane_size * ctype->plane_cnt + 128) * sizeof (uint32_t)); @@ -2976,45 +2847,31 @@ Computing table size for character classes might take a while..."), fputs (_(" done\n"), stderr); -#if __BYTE_ORDER == __LITTLE_ENDIAN -# define NAMES_B1 ctype->names_el -# define NAMES_B2 ctype->names_eb -#else -# define NAMES_B1 ctype->names_eb -# define NAMES_B2 ctype->names_el -#endif - - ctype->names_eb = (uint32_t *) xcalloc (ctype->plane_size - * ctype->plane_cnt, - sizeof (uint32_t)); - ctype->names_el = (uint32_t *) xcalloc (ctype->plane_size - * ctype->plane_cnt, - sizeof (uint32_t)); + ctype->names = (uint32_t *) xcalloc (ctype->plane_size + * ctype->plane_cnt, + sizeof (uint32_t)); for (idx = 1; idx < 256; ++idx) - NAMES_B1[idx] = idx; + ctype->names[idx] = idx; /* Trick: change the 0th entry's name to 1 to mark the cell occupied. */ - NAMES_B1[0] = 1; + ctype->names[0] = 1; for (idx = 256; idx < ctype->charnames_act; ++idx) { size_t nr = (ctype->charnames[idx] % ctype->plane_size); size_t depth = 0; - while (NAMES_B1[nr + depth * ctype->plane_size]) + while (ctype->names[nr + depth * ctype->plane_size]) ++depth; assert (depth < ctype->plane_cnt); - NAMES_B1[nr + depth * ctype->plane_size] = ctype->charnames[idx]; + ctype->names[nr + depth * ctype->plane_size] = ctype->charnames[idx]; /* Now for faster access remember the index in the NAMES_B array. */ ctype->charnames[idx] = nr + depth * ctype->plane_size; } - NAMES_B1[0] = 0; - - for (idx = 0; idx < ctype->plane_size * ctype->plane_cnt; ++idx) - NAMES_B2[idx] = bswap_32 (NAMES_B1[idx]); + ctype->names[0] = 0; /* You wonder about this amount of memory? This is only because some @@ -3028,18 +2885,9 @@ Computing table size for character classes might take a while..."), * ctype->plane_cnt, sizeof (char_class32_t)); - /* Fill in the character class information. */ -#if __BYTE_ORDER == __LITTLE_ENDIAN -# define TRANS(w) CHAR_CLASS_TRANS (w) -# define TRANS32(w) CHAR_CLASS32_TRANS (w) -#else -# define TRANS(w) (w) -# define TRANS32(w) (w) -#endif - - /* This is the array accessed usig the multibyte string elements. */ + /* This is the array accessed using the multibyte string elements. */ for (idx = 0; idx < 256; ++idx) - ctype->ctype_b[128 + idx] = TRANS (ctype->class256_collection[idx]); + ctype->ctype_b[128 + idx] = ctype->class256_collection[idx]; /* Mirror first 127 entries. We must take care that entry -1 is not mirrored because EOF == -1. */ @@ -3048,14 +2896,11 @@ Computing table size for character classes might take a while..."), /* The 32 bit array contains all characters. */ for (idx = 0; idx < ctype->class_collection_act; ++idx) - ctype->ctype32_b[ctype->charnames[idx]] - = TRANS32 (ctype->class_collection[idx]); + ctype->ctype32_b[ctype->charnames[idx]] = ctype->class_collection[idx]; /* Room for table of mappings. */ - ctype->map_eb = (uint32_t **) xmalloc (ctype->map_collection_nr - * sizeof (uint32_t *)); - ctype->map_el = (uint32_t **) xmalloc (ctype->map_collection_nr - * sizeof (uint32_t *)); + ctype->map = (uint32_t **) xmalloc (ctype->map_collection_nr + * sizeof (uint32_t *)); /* Fill in all mappings. */ for (idx = 0; idx < ctype->map_collection_nr; ++idx) @@ -3063,40 +2908,25 @@ Computing table size for character classes might take a while..."), unsigned int idx2; /* Allocate table. */ - ctype->map_eb[idx] = (uint32_t *) xmalloc ((ctype->plane_size - * ctype->plane_cnt + 128) - * sizeof (uint32_t)); - ctype->map_el[idx] = (uint32_t *) xmalloc ((ctype->plane_size - * ctype->plane_cnt + 128) - * sizeof (uint32_t)); - -#if __BYTE_ORDER == __LITTLE_ENDIAN -# define MAP_B1 ctype->map_el -# define MAP_B2 ctype->map_eb -#else -# define MAP_B1 ctype->map_eb -# define MAP_B2 ctype->map_el -#endif + ctype->map[idx] = (uint32_t *) xmalloc ((ctype->plane_size + * ctype->plane_cnt + 128) + * sizeof (uint32_t)); /* Copy default value (identity mapping). */ - memcpy (&MAP_B1[idx][128], NAMES_B1, + memcpy (&ctype->map[idx][128], ctype->names, ctype->plane_size * ctype->plane_cnt * sizeof (uint32_t)); /* Copy values from collection. */ for (idx2 = 0; idx2 < 256; ++idx2) - MAP_B1[idx][128 + idx2] = ctype->map256_collection[idx][idx2]; + ctype->map[idx][128 + idx2] = ctype->map256_collection[idx][idx2]; /* Mirror first 127 entries. We must take care not to map entry -1 because EOF == -1. */ for (idx2 = 0; idx2 < 127; ++idx2) - MAP_B1[idx][idx2] = MAP_B1[idx][256 + idx2]; + ctype->map[idx][idx2] = ctype->map[idx][256 + idx2]; /* EOF must map to EOF. */ - MAP_B1[idx][127] = EOF; - - /* And now the other byte order. */ - for (idx2 = 0; idx2 < ctype->plane_size * ctype->plane_cnt + 128; ++idx2) - MAP_B2[idx][idx2] = bswap_32 (MAP_B1[idx][idx2]); + ctype->map[idx][127] = EOF; } /* Extra array for class and map names. */ @@ -3126,7 +2956,7 @@ Computing table size for character classes might take a while..."), size_t nr = idx % ctype->plane_size; size_t depth = 0; - while (NAMES_B1[nr + depth * ctype->plane_size] != nr) + while (ctype->names[nr + depth * ctype->plane_size] != nr) ++depth; assert (depth < ctype->plane_cnt); @@ -3269,33 +3099,10 @@ Computing table size for character classes might take a while..."), } /* We can allocate the arrays for the results. */ -#if BYTE_ORDER == LITTLE_ENDIAN -# define from_idx translit_from_idx_el -# define from_tbl translit_from_tbl_el -# define to_idx translit_to_idx_el -# define to_tbl translit_to_tbl_el -# define from_idx_ob translit_from_idx_eb -# define from_tbl_ob translit_from_tbl_eb -# define to_idx_ob translit_to_idx_eb -# define to_tbl_ob translit_to_tbl_eb -#else -# define from_idx translit_from_idx_eb -# define from_tbl translit_from_tbl_eb -# define to_idx translit_to_idx_eb -# define to_tbl translit_to_tbl_eb -# define from_idx_ob translit_from_idx_el -# define from_tbl_ob translit_from_tbl_el -# define to_idx_ob translit_to_idx_el -# define to_tbl_ob translit_to_tbl_el -#endif - ctype->from_idx = xmalloc (number * sizeof (uint32_t)); - ctype->from_idx_ob = xmalloc (number * sizeof (uint32_t)); - ctype->from_tbl = xmalloc (from_len * sizeof (uint32_t)); - ctype->from_tbl_ob = xmalloc (from_len * sizeof (uint32_t)); - ctype->to_idx = xmalloc (number * sizeof (uint32_t)); - ctype->to_idx_ob = xmalloc (number * sizeof (uint32_t)); - ctype->to_tbl = xmalloc (to_len * sizeof (uint32_t)); - ctype->to_tbl_ob = xmalloc (to_len * sizeof (uint32_t)); + ctype->translit_from_idx = xmalloc (number * sizeof (uint32_t)); + ctype->translit_from_tbl = xmalloc (from_len * sizeof (uint32_t)); + ctype->translit_to_idx = xmalloc (number * sizeof (uint32_t)); + ctype->translit_to_tbl = xmalloc (to_len * sizeof (uint32_t)); from_len = 0; to_len = 0; @@ -3304,37 +3111,26 @@ Computing table size for character classes might take a while..."), size_t len; struct translit_to_t *srunp; - ctype->from_idx[cnt] = from_len; - ctype->to_idx[cnt] = to_len; + ctype->translit_from_idx[cnt] = from_len; + ctype->translit_to_idx[cnt] = to_len; len = wcslen ((const wchar_t *) sorted[cnt]->from) + 1; - wmemcpy ((wchar_t *) &ctype->from_tbl[from_len], + wmemcpy ((wchar_t *) &ctype->translit_from_tbl[from_len], (const wchar_t *) sorted[cnt]->from, len); from_len += len; - ctype->to_idx[cnt] = to_len; + ctype->translit_to_idx[cnt] = to_len; srunp = sorted[cnt]->to; while (srunp != NULL) { len = wcslen ((const wchar_t *) srunp->str) + 1; - wmemcpy ((wchar_t *) &ctype->to_tbl[to_len], + wmemcpy ((wchar_t *) &ctype->translit_to_tbl[to_len], (const wchar_t *) srunp->str, len); to_len += len; srunp = srunp->next; } - ctype->to_tbl[to_len++] = L'\0'; - } - - /* Now create the tables for the other endianess. */ - for (cnt = 0; cnt < number; ++cnt) - { - ctype->from_idx_ob[cnt] = bswap_32 (ctype->from_idx[cnt]); - ctype->to_idx_ob[cnt] = bswap_32 (ctype->to_idx[cnt]); + ctype->translit_to_tbl[to_len++] = L'\0'; } - for (cnt = 0; cnt < from_len; ++cnt) - ctype->from_tbl[cnt] = bswap_32 (ctype->from_tbl_ob[cnt]); - for (cnt = 0; cnt < to_len; ++cnt) - ctype->to_tbl[cnt] = bswap_32 (ctype->to_tbl_ob[cnt]); /* Store the information about the length. */ ctype->translit_idx_size = number * sizeof (uint32_t); @@ -3346,12 +3142,9 @@ Computing table size for character classes might take a while..."), /* Provide some dummy pointers since we have nothing to write out. */ static uint32_t no_str = { 0 }; - ctype->translit_from_idx_el = &no_str; - ctype->translit_from_idx_eb = &no_str; - ctype->translit_from_tbl_el = &no_str; - ctype->translit_from_tbl_eb = &no_str; - ctype->translit_to_tbl_el = &no_str; - ctype->translit_to_tbl_eb = &no_str; + ctype->translit_from_idx = &no_str; + ctype->translit_from_tbl = &no_str; + ctype->translit_to_tbl = &no_str; ctype->translit_idx_size = 0; ctype->translit_from_tbl_size = 0; ctype->translit_to_tbl_size = 0; diff --git a/locale/programs/ld-paper.c b/locale/programs/ld-paper.c index 642ca41380..e20d789a98 100644 --- a/locale/programs/ld-paper.c +++ b/locale/programs/ld-paper.c @@ -21,7 +21,6 @@ # include <config.h> #endif -#include <byteswap.h> #include <error.h> #include <langinfo.h> #include <string.h> @@ -37,9 +36,7 @@ struct locale_paper_t { uint32_t height; - uint32_t height_ob; uint32_t width; - uint32_t width_ob; }; @@ -104,7 +101,6 @@ paper_finish (struct localedef_t *locale, struct charmap_t *charmap) /* Use as default values the values from the i18n locale. */ paper->height = 297; } - paper->height_ob = bswap_32 (paper->height); if (paper->width == 0) { @@ -113,7 +109,6 @@ paper_finish (struct localedef_t *locale, struct charmap_t *charmap) /* Use as default values the values from the i18n locale. */ paper->width = 210; } - paper->width_ob = bswap_32 (paper->width); } @@ -133,39 +128,17 @@ paper_output (struct localedef_t *locale, struct charmap_t *charmap, iov[cnt].iov_len = sizeof (data); ++cnt; -#if __BYTE_ORDER == __LITTLE_ENDIAN -# define height_eb height_ob -# define height_el height -# define width_eb width_ob -# define width_el width -#else -# define height_eb height -# define height_el height_ob -# define width_eb width -# define width_el width_ob -#endif - iov[cnt].iov_base = (void *) idx; iov[cnt].iov_len = sizeof (idx); ++cnt; idx[cnt - 2] = iov[0].iov_len + iov[1].iov_len; - iov[cnt].iov_base = &paper->height_eb; - iov[cnt].iov_len = 4; - ++cnt; - - idx[cnt - 2] = iov[0].iov_len + iov[1].iov_len; - iov[cnt].iov_base = &paper->height_el; - iov[cnt].iov_len = 4; - ++cnt; - - idx[cnt - 2] = iov[0].iov_len + iov[1].iov_len; - iov[cnt].iov_base = &paper->width_eb; + iov[cnt].iov_base = &paper->height; iov[cnt].iov_len = 4; ++cnt; idx[cnt - 2] = iov[0].iov_len + iov[1].iov_len; - iov[cnt].iov_base = &paper->width_el; + iov[cnt].iov_base = &paper->width; iov[cnt].iov_len = 4; ++cnt; diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c index 88d98e2c21..5a52029858 100644 --- a/locale/programs/ld-time.c +++ b/locale/programs/ld-time.c @@ -55,55 +55,40 @@ struct locale_time_t { const char *abday[7]; const uint32_t *wabday[7]; - const uint32_t *wabday_ob[7]; int abday_defined; const char *day[7]; const uint32_t *wday[7]; - const uint32_t *wday_ob[7]; int day_defined; const char *abmon[12]; const uint32_t *wabmon[12]; - const uint32_t *wabmon_ob[12]; int abmon_defined; const char *mon[12]; const uint32_t *wmon[12]; - const uint32_t *wmon_ob[12]; int mon_defined; const char *am_pm[2]; const uint32_t *wam_pm[2]; - const uint32_t *wam_pm_ob[2]; int am_pm_defined; const char *d_t_fmt; const uint32_t *wd_t_fmt; - const uint32_t *wd_t_fmt_ob; const char *d_fmt; const uint32_t *wd_fmt; - const uint32_t *wd_fmt_ob; const char *t_fmt; const uint32_t *wt_fmt; - const uint32_t *wt_fmt_ob; const char *t_fmt_ampm; const uint32_t *wt_fmt_ampm; - const uint32_t *wt_fmt_ampm_ob; const char **era; const uint32_t **wera; - const uint32_t **wera_ob; uint32_t num_era; const char *era_year; const uint32_t *wera_year; - const uint32_t *wera_year_ob; const char *era_d_t_fmt; const uint32_t *wera_d_t_fmt; - const uint32_t *wera_d_t_fmt_ob; const char *era_t_fmt; const uint32_t *wera_t_fmt; - const uint32_t *wera_t_fmt_ob; const char *era_d_fmt; const uint32_t *wera_d_fmt; - const uint32_t *wera_d_fmt_ob; const char *alt_digits[100]; const uint32_t *walt_digits[100]; - const uint32_t *walt_digits_ob[100]; int alt_digits_defined; unsigned char week_ndays; uint32_t week_1stday; @@ -115,7 +100,6 @@ struct locale_time_t const uint32_t *wtimezone; struct era_data *era_entries; - struct era_data *era_entries_ob; }; @@ -143,7 +127,6 @@ void time_finish (struct localedef_t *locale, struct charmap_t *charmap) { struct locale_time_t *time = locale->categories[LC_TIME].time; - size_t cnt; int nothing = 0; /* Now resolve copying and also handle completely missing definitions. */ @@ -183,22 +166,6 @@ time_finish (struct localedef_t *locale, struct charmap_t *charmap) { \ if(! be_quiet && ! nothing) \ error (0, 0, _("%s: field `%s' not defined"), "LC_TIME", #cat); \ - } \ - else if (time->w##cat != NULL) \ - { \ - size_t n; \ - for (n = 0; n < sizeof (time->w##cat) / sizeof (time->w##cat[0]); ++n) \ - { \ - size_t len = wcslen ((wchar_t *) time->w##cat[n]) + 1; \ - uint32_t *wstr = (uint32_t *) xmalloc (len * sizeof (uint32_t)); \ - do \ - { \ - --len; \ - wstr[len] = bswap_32 (time->w##cat[n][len]); \ - } \ - while (len > 0); \ - time->w##cat##_ob[n] = wstr; \ - } \ } TESTARR_ELEM (abday); @@ -212,18 +179,6 @@ time_finish (struct localedef_t *locale, struct charmap_t *charmap) { \ if (! be_quiet && ! nothing) \ error (0, 0, _("%s: field `%s' not defined"), "LC_TIME", #cat); \ - } \ - else if (time->w##cat != NULL) \ - { \ - size_t len = wcslen ((wchar_t *) time->w##cat) + 1; \ - uint32_t *wstr = (uint32_t *) xmalloc (len * sizeof (uint32_t)); \ - do \ - { \ - --len; \ - wstr[len] = bswap_32 (time->w##cat[len]); \ - } \ - while (len > 0); \ - time->w##cat##_ob = wstr; \ } TEST_ELEM (d_t_fmt); @@ -237,20 +192,6 @@ time_finish (struct localedef_t *locale, struct charmap_t *charmap) /* Use the 24h format as default. */ time->t_fmt_ampm = time->t_fmt; time->wt_fmt_ampm = time->wt_fmt; - time->wt_fmt_ampm_ob = time->wt_fmt_ob; - } - else - { - /* Convert the byte order. */ - size_t len = wcslen ((wchar_t *) time->wt_fmt_ampm) + 1; - uint32_t *wstr = (uint32_t *) xmalloc (len * sizeof (uint32_t)); - do - { - --len; - wstr[len] = bswap_32 (time->wt_fmt_ampm[len]); - } - while (len > 0); - time->wt_fmt_ampm_ob = wstr; } /* Now process the era entries. */ @@ -499,60 +440,6 @@ time_finish (struct localedef_t *locale, struct charmap_t *charmap) wstr = wstr ? wcschr (wstr, L':') : NULL; /* end name */ time->era_entries[idx].wformat = (uint32_t *) wstr; } - - /* Construct the array for the other byte order. */ - time->era_entries_ob = - (struct era_data *) xmalloc (time->num_era * sizeof (struct era_data)); - - for (idx = 0; idx < time->num_era; ++idx) - { - time->era_entries_ob[idx].direction = - bswap_32 (time->era_entries[idx].direction); - time->era_entries_ob[idx].offset = - bswap_32 (time->era_entries[idx].offset); - time->era_entries_ob[idx].start_date[0] = - bswap_32 (time->era_entries[idx].start_date[0]); - time->era_entries_ob[idx].start_date[1] = - bswap_32 (time->era_entries[idx].start_date[1]); - time->era_entries_ob[idx].start_date[2] = - bswap_32 (time->era_entries[idx].stop_date[2]); - time->era_entries_ob[idx].stop_date[0] = - bswap_32 (time->era_entries[idx].stop_date[0]); - time->era_entries_ob[idx].stop_date[1] = - bswap_32 (time->era_entries[idx].stop_date[1]); - time->era_entries_ob[idx].stop_date[2] = - bswap_32 (time->era_entries[idx].stop_date[2]); - time->era_entries_ob[idx].name = - time->era_entries[idx].name; - time->era_entries_ob[idx].format = - time->era_entries[idx].format; - if (time->era_entries[idx].wname != NULL) - { - size_t inner = (wcslen ((wchar_t *) time->era_entries[idx].wname) - + 1); - time->era_entries_ob[idx].wname = xmalloc (inner - * sizeof (uint32_t)); - do - time->era_entries_ob[idx].wname[inner - 1] - = bswap_32 (time->era_entries[idx].wname[inner - 1]); - while (inner-- > 0); - } - else - time->era_entries_ob[idx].wname = NULL; - if (time->era_entries[idx].wformat != NULL) - { - size_t inner - = wcslen ((wchar_t *) time->era_entries[idx].wformat) + 1; - time->era_entries_ob[idx].wformat = xmalloc (inner - * sizeof (uint32_t)); - do - time->era_entries_ob[idx].wformat[inner - 1] - = bswap_32 (time->era_entries[idx].wformat[inner - 1]); - while (inner-- > 0); - } - else - time->era_entries_ob[idx].wformat = NULL; - } } if (time->week_ndays == 0) @@ -594,18 +481,6 @@ time_finish (struct localedef_t *locale, struct charmap_t *charmap) simply useless, stupid $&$!@... */ if (time->timezone == NULL) time->timezone = ""; - - /* Generate alt digits in other byte order. */ - for (cnt = 0; cnt < 100; ++cnt) - if (time->walt_digits[cnt] != NULL) - { - size_t len = wcslen ((wchar_t *) time->walt_digits[cnt]) + 1; - uint32_t *wstr = xmalloc (len * sizeof (uint32_t)); - do - wstr[len - 1] = bswap_32 (time->walt_digits[cnt][len - 1]); - while (len-- > 0); - time->walt_digits_ob[cnt] = wstr; - } } @@ -621,8 +496,6 @@ time_output (struct localedef_t *locale, struct charmap_t *charmap, struct locale_file data; uint32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_TIME)]; size_t cnt, last_idx, num, n; - uint32_t num_era_eb; - uint32_t num_era_el; data.magic = LIMAGIC (LC_TIME); data.n = _NL_ITEM_INDEX (_NL_NUM_LC_TIME); @@ -749,66 +622,46 @@ time_output (struct localedef_t *locale, struct charmap_t *charmap, ++cnt; /* The `era' data in usable form. */ -#if __BYTE_ORDER == __LITTLE_ENDIAN - num_era_eb = bswap_32 (time->num_era); - num_era_el = time->num_era; -#else - num_era_eb = time->num_era; - num_era_el = bswap_32 (time->num_era); -#endif - - iov[2 + cnt].iov_base = (void *) &num_era_eb; - iov[2 + cnt].iov_len = sizeof (uint32_t); - idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; - ++cnt; - ++last_idx; - - iov[2 + cnt].iov_base = (void *) &num_era_el; + iov[2 + cnt].iov_base = (void *) &time->num_era; iov[2 + cnt].iov_len = sizeof (uint32_t); idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; ++cnt; ++last_idx; -#if __BYTE_ORDER == __LITTLE_ENDIAN -# define ERA_B1 time->era_entries_ob -# define ERA_B2 time->era_entries -#else -# define ERA_B1 time->era_entries -# define ERA_B2 time->era_entries_ob -#endif idx[1 + last_idx] = idx[last_idx]; for (num = 0; num < time->num_era; ++num) { size_t l; - iov[2 + cnt].iov_base = (void *) &ERA_B1[num].direction; + iov[2 + cnt].iov_base = (void *) &time->era_entries[num].direction; iov[2 + cnt].iov_len = sizeof (int32_t); ++cnt; - iov[2 + cnt].iov_base = (void *) &ERA_B1[num].offset; + iov[2 + cnt].iov_base = (void *) &time->era_entries[num].offset; iov[2 + cnt].iov_len = sizeof (int32_t); ++cnt; - iov[2 + cnt].iov_base = (void *) &ERA_B1[num].start_date[0]; + iov[2 + cnt].iov_base = (void *) &time->era_entries[num].start_date[0]; iov[2 + cnt].iov_len = sizeof (int32_t); ++cnt; - iov[2 + cnt].iov_base = (void *) &ERA_B1[num].start_date[1]; + iov[2 + cnt].iov_base = (void *) &time->era_entries[num].start_date[1]; iov[2 + cnt].iov_len = sizeof (int32_t); ++cnt; - iov[2 + cnt].iov_base = (void *) &ERA_B1[num].start_date[2]; + iov[2 + cnt].iov_base = (void *) &time->era_entries[num].start_date[2]; iov[2 + cnt].iov_len = sizeof (int32_t); ++cnt; - iov[2 + cnt].iov_base = (void *) &ERA_B1[num].stop_date[0]; + iov[2 + cnt].iov_base = (void *) &time->era_entries[num].stop_date[0]; iov[2 + cnt].iov_len = sizeof (int32_t); ++cnt; - iov[2 + cnt].iov_base = (void *) &ERA_B1[num].stop_date[1]; + iov[2 + cnt].iov_base = (void *) &time->era_entries[num].stop_date[1]; iov[2 + cnt].iov_len = sizeof (int32_t); ++cnt; - iov[2 + cnt].iov_base = (void *) &ERA_B1[num].stop_date[2]; + iov[2 + cnt].iov_base = (void *) &time->era_entries[num].stop_date[2]; iov[2 + cnt].iov_len = sizeof (int32_t); ++cnt; - l = (strchr (ERA_B1[num].format, '\0') - ERA_B1[num].name) + 1; + l = (strchr (time->era_entries[num].format, '\0') + - time->era_entries[num].name) + 1; l = (l + 3) & ~3; - iov[2 + cnt].iov_base = (void *) ERA_B1[num].name; + iov[2 + cnt].iov_base = (void *) time->era_entries[num].name; iov[2 + cnt].iov_len = l; ++cnt; @@ -816,57 +669,9 @@ time_output (struct localedef_t *locale, struct charmap_t *charmap, assert (idx[1 + last_idx] % 4 == 0); - iov[2 + cnt].iov_base = (void *) ERA_B1[num].wname; - iov[2 + cnt].iov_len = ((wcschr ((wchar_t *) ERA_B1[cnt].wformat, L'\0') - - (wchar_t *) ERA_B1[num].wname + 1) - * sizeof (uint32_t)); - ++cnt; - - idx[1 + last_idx] += iov[2 + cnt].iov_len; - } - ++last_idx; - - idx[1 + last_idx] = idx[last_idx]; - for (num = 0; num < time->num_era; ++num) - { - size_t l; - - iov[2 + cnt].iov_base = (void *) &ERA_B2[num].direction; - iov[2 + cnt].iov_len = sizeof (int32_t); - ++cnt; - iov[2 + cnt].iov_base = (void *) &ERA_B2[num].offset; - iov[2 + cnt].iov_len = sizeof (int32_t); - ++cnt; - iov[2 + cnt].iov_base = (void *) &ERA_B2[num].start_date[0]; - iov[2 + cnt].iov_len = sizeof (int32_t); - ++cnt; - iov[2 + cnt].iov_base = (void *) &ERA_B2[num].start_date[1]; - iov[2 + cnt].iov_len = sizeof (int32_t); - ++cnt; - iov[2 + cnt].iov_base = (void *) &ERA_B2[num].start_date[2]; - iov[2 + cnt].iov_len = sizeof (int32_t); - ++cnt; - iov[2 + cnt].iov_base = (void *) &ERA_B2[num].stop_date[0]; - iov[2 + cnt].iov_len = sizeof (int32_t); - ++cnt; - iov[2 + cnt].iov_base = (void *) &ERA_B2[num].stop_date[1]; - iov[2 + cnt].iov_len = sizeof (int32_t); - ++cnt; - iov[2 + cnt].iov_base = (void *) &ERA_B2[num].stop_date[2]; - iov[2 + cnt].iov_len = sizeof (int32_t); - ++cnt; - - l = (strchr (ERA_B2[num].format, '\0') - ERA_B2[num].name) + 1; - l = (l + 3) & ~3; - iov[2 + cnt].iov_base = (void *) ERA_B2[num].name; - iov[2 + cnt].iov_len = l; - ++cnt; - - idx[1 + last_idx] += 8 * sizeof (int32_t) + l; - - iov[2 + cnt].iov_base = (void *) ERA_B1[num].wname; - iov[2 + cnt].iov_len = ((wcschr ((wchar_t *) ERA_B1[cnt].wformat, L'\0') - - (wchar_t *) ERA_B1[num].wname + 1) + iov[2 + cnt].iov_base = (void *) time->era_entries[num].wname; + iov[2 + cnt].iov_len = ((wcschr ((wchar_t *) time->era_entries[cnt].wformat, L'\0') + - (wchar_t *) time->era_entries[num].wname + 1) * sizeof (uint32_t)); ++cnt; @@ -874,79 +679,11 @@ time_output (struct localedef_t *locale, struct charmap_t *charmap, } ++last_idx; -#if __BYTE_ORDER == __LITTLE_ENDIAN -# define WABDAY_B1 wabday_ob -# define WDAY_B1 wday_ob -# define WABMON_B1 wabmon_ob -# define WMON_B1 wmon_ob -# define WAM_PM_B1 wam_pm_ob -# define WD_T_FMT_B1 wd_t_fmt_ob -# define WD_FMT_B1 wd_fmt_ob -# define WT_FMT_B1 wt_fmt_ob -# define WT_FMT_AMPM_B1 wt_fmt_ampm_ob -# define WERA_YEAR_B1 wera_year_ob -# define WERA_D_FMT_B1 wera_d_fmt_ob -# define WALT_DIGITS_B1 walt_digits_ob -# define WERA_D_T_FMT_B1 wera_d_t_fmt_ob -# define WERA_T_FMT_B1 wera_t_fmt_ob -# define WABDAY_B2 wabday -# define WDAY_B2 wday -# define WABMON_B2 wabmon -# define WMON_B2 wmon -# define WAM_PM_B2 wam_pm -# define WD_T_FMT_B2 wd_t_fmt -# define WD_FMT_B2 wd_fmt -# define WT_FMT_B2 wt_fmt -# define WT_FMT_AMPM_B2 wt_fmt_ampm -# define WERA_YEAR_B2 wera_year -# define WERA_D_FMT_B2 wera_d_fmt -# define WALT_DIGITS_B2 walt_digits -# define WERA_D_T_FMT_B2 wera_d_t_fmt -# define WERA_T_FMT_B2 wera_t_fmt -#else -# define WABDAY_B1 wabday -# define WDAY_B1 wday -# define WABMON_B1 wabmon -# define WMON_B1 wmon -# define WAM_PM_B1 wam_pm -# define WD_T_FMT_B1 wd_t_fmt -# define WD_FMT_B1 wd_fmt -# define WT_FMT_B1 wt_fmt -# define WT_FMT_AMPM_B1 wt_fmt_ampm -# define WERA_YEAR_B1 wera_year -# define WERA_D_FMT_B1 wera_d_fmt -# define WALT_DIGITS_B1 walt_digits -# define WERA_D_T_FMT_B1 wera_d_t_fmt -# define WERA_T_FMT_B1 wera_t_fmt -# define WABDAY_B2 wabday_ob -# define WDAY_B2 wday_ob -# define WABMON_B2 wabmon_ob -# define WMON_B2 wmon_ob -# define WAM_PM_B2 wam_pm_ob -# define WD_T_FMT_B2 wd_t_fmt_ob -# define WD_FMT_B2 wd_fmt_ob -# define WT_FMT_B2 wt_fmt_ob -# define WT_FMT_AMPM_B2 wt_fmt_ampm_ob -# define WERA_YEAR_B2 wera_year_ob -# define WERA_D_FMT_B2 wera_d_fmt_ob -# define WALT_DIGITS_B2 walt_digits_ob -# define WERA_D_T_FMT_B2 wera_d_t_fmt_ob -# define WERA_T_FMT_B2 wera_t_fmt_ob -#endif - /* The wide character ab'days. */ for (n = 0; n < 7; ++n, ++cnt, ++last_idx) { iov[2 + cnt].iov_base = - (void *) (time->WABDAY_B1[n] ?: empty_wstr); - iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) - * sizeof (uint32_t)); - idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; - } - for (n = 0; n < 7; ++n, ++cnt, ++last_idx) - { - iov[2 + cnt].iov_base = - (void *) (time->WABDAY_B2[n] ?: empty_wstr); + (void *) (time->wabday[n] ?: empty_wstr); iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) * sizeof (uint32_t)); idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; @@ -956,15 +693,7 @@ time_output (struct localedef_t *locale, struct charmap_t *charmap, for (n = 0; n < 7; ++n, ++cnt, ++last_idx) { iov[2 + cnt].iov_base = - (void *) (time->WDAY_B1[n] ?: empty_wstr); - iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) - * sizeof (uint32_t)); - idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; - } - for (n = 0; n < 7; ++n, ++cnt, ++last_idx) - { - iov[2 + cnt].iov_base = - (void *) (time->WDAY_B2[n] ?: empty_wstr); + (void *) (time->wday[n] ?: empty_wstr); iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) * sizeof (uint32_t)); idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; @@ -974,15 +703,7 @@ time_output (struct localedef_t *locale, struct charmap_t *charmap, for (n = 0; n < 12; ++n, ++cnt, ++last_idx) { iov[2 + cnt].iov_base = - (void *) (time->WABMON_B1[n] ?: empty_wstr); - iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) - * sizeof (uint32_t)); - idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; - } - for (n = 0; n < 12; ++n, ++cnt, ++last_idx) - { - iov[2 + cnt].iov_base = - (void *) (time->WABMON_B2[n] ?: empty_wstr); + (void *) (time->wabmon[n] ?: empty_wstr); iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) * sizeof (uint32_t)); idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; @@ -992,15 +713,7 @@ time_output (struct localedef_t *locale, struct charmap_t *charmap, for (n = 0; n < 12; ++n, ++cnt, ++last_idx) { iov[2 + cnt].iov_base = - (void *) (time->WMON_B1[n] ?: empty_wstr); - iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) - * sizeof (uint32_t)); - idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; - } - for (n = 0; n < 12; ++n, ++cnt, ++last_idx) - { - iov[2 + cnt].iov_base = - (void *) (time->WMON_B2[n] ?: empty_wstr); + (void *) (time->wmon[n] ?: empty_wstr); iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) * sizeof (uint32_t)); idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; @@ -1010,123 +723,48 @@ time_output (struct localedef_t *locale, struct charmap_t *charmap, for (n = 0; n < 2; ++n, ++cnt, ++last_idx) { iov[2 + cnt].iov_base = - (void *) (time->WAM_PM_B1[n] ?: empty_wstr); - iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) - * sizeof (uint32_t)); - idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; - } - for (n = 0; n < 2; ++n, ++cnt, ++last_idx) - { - iov[2 + cnt].iov_base = - (void *) (time->WAM_PM_B2[n] ?: empty_wstr); + (void *) (time->wam_pm[n] ?: empty_wstr); iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) * sizeof (uint32_t)); idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; } - iov[2 + cnt].iov_base = (void *) (time->WD_T_FMT_B1 ?: empty_wstr); - iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) - * sizeof (uint32_t)); - idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; - ++cnt; - ++last_idx; - - iov[2 + cnt].iov_base = (void *) (time->WD_FMT_B1 ?: empty_wstr); - iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) - * sizeof (uint32_t)); - idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; - ++cnt; - ++last_idx; - - iov[2 + cnt].iov_base = (void *) (time->WT_FMT_B1 ?: empty_wstr); - iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) - * sizeof (uint32_t)); - idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; - ++cnt; - ++last_idx; - - iov[2 + cnt].iov_base = (void *) (time->WT_FMT_AMPM_B1 ?: empty_wstr); + iov[2 + cnt].iov_base = (void *) (time->wd_t_fmt ?: empty_wstr); iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) * sizeof (uint32_t)); idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; ++cnt; ++last_idx; - iov[2 + cnt].iov_base = (void *) (time->WD_T_FMT_B2 ?: empty_wstr); + iov[2 + cnt].iov_base = (void *) (time->wd_fmt ?: empty_wstr); iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) * sizeof (uint32_t)); idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; ++cnt; ++last_idx; - iov[2 + cnt].iov_base = (void *) (time->WD_FMT_B2 ?: empty_wstr); - iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) - * sizeof (uint32_t)); - idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; - ++cnt; - ++last_idx; - - iov[2 + cnt].iov_base = (void *) (time->WT_FMT_B2 ?: empty_wstr); - iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) - * sizeof (uint32_t)); - idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; - ++cnt; - ++last_idx; - - iov[2 + cnt].iov_base = (void *) (time->WT_FMT_AMPM_B2 ?: empty_wstr); - iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) - * sizeof (uint32_t)); - idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; - ++cnt; - ++last_idx; - - iov[2 + cnt].iov_base = (void *) (time->WERA_YEAR_B2 ?: empty_wstr); - iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) - * sizeof (uint32_t)); - idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; - ++cnt; - ++last_idx; - - iov[2 + cnt].iov_base = (void *) (time->WERA_D_FMT_B2 ?: empty_wstr); - iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) - * sizeof (uint32_t)); - idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; - ++cnt; - ++last_idx; - - idx[1 + last_idx] = idx[last_idx]; - for (num = 0; num < 100; ++num, ++cnt) - { - iov[2 + cnt].iov_base = (void *) (time->WALT_DIGITS_B2[num] - ?: empty_wstr); - iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) - * sizeof (uint32_t)); - idx[1 + last_idx] += iov[2 + cnt].iov_len; - } - ++last_idx; - - iov[2 + cnt].iov_base = (void *) (time->WERA_D_T_FMT_B2 ?: empty_wstr); + iov[2 + cnt].iov_base = (void *) (time->wt_fmt ?: empty_wstr); iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) * sizeof (uint32_t)); idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; ++cnt; ++last_idx; - iov[2 + cnt].iov_base = (void *) (time->WERA_T_FMT_B2 ?: empty_wstr); + iov[2 + cnt].iov_base = (void *) (time->wt_fmt_ampm ?: empty_wstr); iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) * sizeof (uint32_t)); idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; ++cnt; ++last_idx; - iov[2 + cnt].iov_base = (void *) (time->WERA_YEAR_B1 ?: empty_wstr); + iov[2 + cnt].iov_base = (void *) (time->wera_year ?: empty_wstr); iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) * sizeof (uint32_t)); idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; ++cnt; ++last_idx; - iov[2 + cnt].iov_base = (void *) (time->WERA_D_FMT_B1 ?: empty_wstr); + iov[2 + cnt].iov_base = (void *) (time->wera_d_fmt ?: empty_wstr); iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) * sizeof (uint32_t)); idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; @@ -1136,7 +774,7 @@ time_output (struct localedef_t *locale, struct charmap_t *charmap, idx[1 + last_idx] = idx[last_idx]; for (num = 0; num < 100; ++num, ++cnt) { - iov[2 + cnt].iov_base = (void *) (time->WALT_DIGITS_B1[num] + iov[2 + cnt].iov_base = (void *) (time->walt_digits[num] ?: empty_wstr); iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) * sizeof (uint32_t)); @@ -1144,14 +782,14 @@ time_output (struct localedef_t *locale, struct charmap_t *charmap, } ++last_idx; - iov[2 + cnt].iov_base = (void *) (time->WERA_D_T_FMT_B1 ?: empty_wstr); + iov[2 + cnt].iov_base = (void *) (time->wera_d_t_fmt ?: empty_wstr); iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) * sizeof (uint32_t)); idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; ++cnt; ++last_idx; - iov[2 + cnt].iov_base = (void *) (time->WERA_T_FMT_B1 ?: empty_wstr); + iov[2 + cnt].iov_base = (void *) (time->wera_t_fmt ?: empty_wstr); iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) * sizeof (uint32_t)); idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; |