46 #include <netinet/in.h> 50 #if defined (SUPPRESS_STRLEN_WARNING) 51 #define strlen(s1) ((int) strlen(s1)) 54 #define TXT_CONV_LINE_SIZE 512 55 #define TXT_CONV_ITEM_GROW_COUNT 128 57 #define LOC_CURRENT_COLL_TAIL(ld) (&(ld->collations[ld->coll_cnt].tail_coll)) 62 "a.m.",
"p.m.",
"A.m.",
"P.m.",
"A.M.",
"P.M." 87 #define COLL_SHARED_DATA_SIZE (10 + 2) 110 static int start_month (
void *data,
const char **attr);
111 static int end_month (
void *data,
const char *el_name);
112 static int start_day (
void *data,
const char **attr);
113 static int end_day (
void *data,
const char *el_name);
153 static int handle_data (
void *data,
const char *s,
int len);
164 static void print_debug_start_el (
void *data,
const char **attrs,
const char *msg,
const int status);
173 const char *alpha_suffix);
182 static int str_pop_token (
char *str_p,
char **token_p,
char **next_p);
209 #define PRINT_DEBUG_START(d, a, m, s) \ 211 print_debug_start_el (d, a, m, s); \ 214 #define PRINT_DEBUG_END(d, m, s) \ 216 print_debug_end_el (d, m, s); \ 219 #define PRINT_DEBUG_DATA(d, m, s) \ 221 print_debug_data_content (d, m, s); \ 224 #define PRINT_TO_C_FILE_MAX_INT_LINE 10 226 #if defined(_WIN32) || defined(WINDOWS) || defined(WIN64) 227 #define DLL_EXPORT_PREFIX "__declspec(dllexport) " 228 #define LOCLIB_FILE_EXT "dll" 230 #define DLL_EXPORT_PREFIX "" 231 #define LOCLIB_FILE_EXT "so" 234 #define PRINT_STRING_TO_C_FILE(fp, val, len) \ 237 fprintf (fp, "\""); \ 238 for (istr = 0; istr < len; istr++) \ 240 fprintf (fp, "\\x%02X", (unsigned char) val[istr]); \ 242 fprintf (fp, "\""); \ 245 #define PRINT_VAR_TO_C_FILE(fp, type, valname, val, format, d) \ 247 fprintf (fp, "\n" DLL_EXPORT_PREFIX "const " \ 248 type " " valname "_%s = " format ";\n", d, val); \ 251 #define PRINT_STRING_VAR_TO_C_FILE(fp, valname, val, d) \ 253 fprintf (fp, "\n" DLL_EXPORT_PREFIX "const char " valname "_%s[] = ", d); \ 254 PRINT_STRING_TO_C_FILE (fp, val, strlen (val)); \ 255 fprintf (fp, ";\n"); \ 258 #define PRINT_STRING_ARRAY_TO_C_FILE(fp, valname, arrcount, val, d) \ 261 fprintf(fp, "\n" DLL_EXPORT_PREFIX"const char* " valname "_%s[] = {\n", d);\ 262 for (istrarr = 0; istrarr < arrcount; istrarr++) \ 265 PRINT_STRING_TO_C_FILE (fp, val[istrarr], strlen(val[istrarr])); \ 266 if (istrarr < arrcount - 1) \ 268 fprintf(fp, ",\n"); \ 275 fprintf(fp, "};\n"); \ 279 #define PRINT_NUM_ARRAY_TO_C_FILE(fp, vname, vtype, intf, arrcount, val, d) \ 283 "\n" DLL_EXPORT_PREFIX "const " vtype " " vname "_%s[] = {\n", d); \ 285 for (i_arr = 0; i_arr < arrcount; i_arr++) \ 288 fprintf(fp, intf, val[i_arr]); \ 289 if (i_arr < arrcount - 1) \ 294 if (j_arr > PRINT_TO_C_FILE_MAX_INT_LINE) \ 300 fprintf(fp, "};\n"); \ 304 #define PRINT_UNNAMED_NUM_ARRAY_TO_C_FILE(fp, intf, tab, arrcount, val) \ 306 int i_uarr, j_uarr; \ 307 fprintf(fp, tab"{\n"); \ 309 for (i_uarr = 0; i_uarr < arrcount; i_uarr++) \ 311 fprintf(fp, intf, val[i_uarr]); \ 312 if (i_uarr < arrcount - 1) \ 317 if (j_uarr > PRINT_TO_C_FILE_MAX_INT_LINE) \ 320 fprintf(fp, "\n" tab); \ 323 fprintf(fp, "\n" tab "}"); \ 327 #define XML_COMMENT_START "<!-- " 328 #define XML_COMMENT_END " -->" 446 "ldml dates calendars calendar dayPeriods dayPeriodContext dayPeriodWidth",
454 "ldml dates calendars calendar dayPeriods dayPeriodContext dayPeriodWidth dayPeriod",
606 {
"ldml collations collation rules reset first_primary_ignorable", 6,
612 {
"ldml collations collation rules reset last_primary_ignorable", 6,
618 {
"ldml collations collation rules reset first_secondary_ignorable", 6,
624 {
"ldml collations collation rules reset last_secondary_ignorable", 6,
630 {
"ldml collations collation rules reset first_tertiary_ignorable", 6,
636 {
"ldml collations collation rules reset last_tertiary_ignorable", 6,
642 {
"ldml collations collation rules reset first_non_ignorable", 6,
648 {
"ldml collations collation rules reset last_non_ignorable", 6,
664 "ldml collations collation cubridrules", 4,
1311 char *month_count =
NULL;
1415 char *day_ref_name =
NULL;
1430 for (i = 0; i < 7; i++)
1548 char *am_pm_ref_name =
NULL;
1571 assert (i >= 0 && i < CAL_AM_PM_COUNT);
1573 if (i >= 0 && i < CAL_AM_PM_COUNT)
1677 if (strcmp (el_name,
"decimal") == 0)
1712 char *att_val =
NULL;
1713 int currency_size = 0;
1725 PRINT_DEBUG_START (data, attr,
"Currency ISO code invalid, " "it must be 3 chars long.", -1);
1742 PRINT_DEBUG_START (data, attr,
"Currency tag does not have an ISO code type " "attribute.", -1);
1766 char *valid_locales =
NULL;
1771 bool locale_found =
false;
1772 bool search_end =
false;
1787 att_val_end = valid_locales +
strlen (valid_locales);
1790 t_start = t_end = valid_locales;
1797 if ((t_end - t_start == 3 && memcmp (t_start,
"all", 3) == 0) || (t_end - t_start == 1 && *t_start ==
'*')
1798 || (t_end - t_start == check_loc_len && memcmp (ld->
locale_name, t_start, t_end - t_start) == 0))
1800 locale_found =
true;
1817 while (!search_end);
1844 char *att_val =
NULL;
1851 if (locale_coll ==
NULL)
1918 char *att_val =
NULL;
1931 curr_coll_tail->
coll_id = atoi (att_val);
1935 snprintf (err_msg,
sizeof (err_msg) - 1,
1936 "File %s, line: %lu : " "Invalid collation numeric identifier : %d" 1950 if (strcasecmp (att_val,
"primary") == 0 || strcmp (att_val,
"1") == 0)
1954 else if ((strcasecmp (att_val,
"secondary") == 0) || (strcmp (att_val,
"2") == 0))
1958 else if ((strcasecmp (att_val,
"tertiary") == 0) || (strcmp (att_val,
"3") == 0))
1962 else if ((strcasecmp (att_val,
"quaternary") == 0) || (strcmp (att_val,
"4") == 0))
1966 else if ((strcasecmp (att_val,
"identical") == 0) || (strcmp (att_val,
"5") == 0))
1972 snprintf (err_msg,
sizeof (err_msg) - 1,
1973 "File %s, line: %lu : " "Invalid collation strength : '%s'" " for collation '%s'",
1987 if (strcasecmp (att_val,
"on") == 0)
1997 if (strcasecmp (att_val,
"on") == 0)
2007 if (strcasecmp (att_val,
"off") == 0)
2011 else if (strcasecmp (att_val,
"upper") == 0)
2015 else if (strcasecmp (att_val,
"lower") == 0)
2033 if (strcasecmp (att_val,
"use") == 0)
2043 if (strcasecmp (att_val,
"use") == 0)
2053 if (strcasecmp (att_val,
"use") == 0)
2063 if (strcasecmp (att_val,
"true") == 0)
2087 char *att_val =
NULL;
2101 if (strcmp (att_val,
"primary") == 0)
2105 else if (strcmp (att_val,
"secondary") == 0)
2109 else if (strcmp (att_val,
"tertiary") == 0)
2113 else if (strcmp (att_val,
"quaternary") == 0)
2240 if (ct_rule ==
NULL)
2266 char *att_val =
NULL;
2279 ct_rule = &(curr_coll_tail->
cub_rules[rule_id]);
2289 strcpy (ct_rule->
step, att_val);
2328 snprintf (msg,
sizeof (msg) - 1,
" * SET Rule no. %d, tag name :%s *", (rule_id + 1), el_name);
2361 ct_rule = &(curr_coll_tail->
cub_rules[rule_id]);
2376 if (strcmp (el_name,
"ch") == 0 || strcmp (el_name,
"sch") == 0)
2381 else if (strcmp (el_name,
"cp") == 0 || strcmp (el_name,
"scp") == 0)
2391 snprintf (msg,
sizeof (msg) - 1,
" * SET Rule no. %d, tag name :%s *", (rule_id + 1), el_name);
2432 ct_rule = &(curr_coll_tail->
cub_rules[rule_id]);
2437 if (strcmp (el_name,
"ech") == 0)
2441 else if (strcmp (el_name,
"ecp") == 0)
2450 snprintf (msg,
sizeof (msg) - 1,
"* SET Rule no. %d, tag name :%s *", (rule_id + 1), el_name);
2484 ct_rule = &(curr_coll_tail->
cub_rules[rule_id]);
2500 snprintf (msg,
sizeof (msg) - 1,
"* SET Rule no. %d, tag name :%s *", (rule_id + 1), el_name);
2534 char *
const realloc_t_buf = (
char *) realloc (t_rule->
t_buf, t_rule->
t_buf_size + len);
2535 if (realloc_t_buf ==
NULL)
2543 t_rule->
t_buf = realloc_t_buf;
2556 memcpy (msg, s, len);
2563 memcpy (msg2, s, 32);
2565 snprintf (msg,
sizeof (msg) - 1,
"%s | %d bytes", msg2, len);
2598 t_rule = &(curr_coll_tail->
rules[rule_id]);
2600 if (strcmp (el_name,
"p") == 0)
2604 else if (strcmp (el_name,
"s") == 0)
2608 else if (strcmp (el_name,
"t") == 0)
2612 else if (strcmp (el_name,
"i") == 0)
2616 else if (strcmp (el_name,
"pc") == 0)
2621 else if (strcmp (el_name,
"sc") == 0)
2626 else if (strcmp (el_name,
"tc") == 0)
2631 else if (strcmp (el_name,
"ic") == 0)
2724 t_rule = &(curr_coll_tail->
rules[rule_id]);
2732 snprintf (msg,
sizeof (msg) - 1,
" * X_Rule %d, L :%d, Dir:%d, PosType:%d, Mc:%d *", rule_id, t_rule->
level,
2764 t_rule = &(curr_coll_tail->
rules[rule_id]);
2769 if (realloc_t_buf ==
NULL)
2777 t_rule->
t_buf = realloc_t_buf;
2784 if (strcmp (el_name,
"p") == 0)
2788 else if (strcmp (el_name,
"s") == 0)
2792 else if (strcmp (el_name,
"t") == 0)
2796 else if (strcmp (el_name,
"i") == 0)
2842 t_rule = &(curr_coll_tail->
rules[rule_id]);
2848 if (realloc_r_buf ==
NULL)
2856 t_rule->
r_buf = realloc_r_buf;
2893 t_rule = &(curr_coll_tail->
rules[rule_id]);
2906 if (realloc_t_buf ==
NULL)
2914 t_rule->
t_buf = realloc_t_buf;
2927 snprintf (msg,
sizeof (msg) - 1,
"* Rule %d *", rule_id);
2979 if (strcmp (el_name,
"first_variable") == 0)
2983 else if (strcmp (el_name,
"last_variable") == 0)
2987 else if (strcmp (el_name,
"first_primary_ignorable") == 0)
2991 else if (strcmp (el_name,
"last_primary_ignorable") == 0)
2995 else if (strcmp (el_name,
"first_secondary_ignorable") == 0)
2999 else if (strcmp (el_name,
"last_secondary_ignorable") == 0)
3003 else if (strcmp (el_name,
"first_tertiary_ignorable") == 0)
3007 else if (strcmp (el_name,
"last_tertiary_ignorable") == 0)
3011 else if (strcmp (el_name,
"first_non_ignorable") == 0)
3015 else if (strcmp (el_name,
"last_non_ignorable") == 0)
3019 else if (strcmp (el_name,
"first_trailing") == 0)
3023 else if (strcmp (el_name,
"last_trailing") == 0)
3055 char *att_val =
NULL;
3079 if (strcasecmp (att_val,
"ASCII") == 0)
3083 else if (strcasecmp (att_val,
"UNICODEDATAFILE") == 0)
3089 PRINT_DEBUG_START (data, attr,
"Invalid value for CUBRIDAlphabetMode." "Expected ASCII or UNICODEDATAFILE",
3124 if (tf_rule ==
NULL)
3164 unsigned char *dummy =
NULL;
3170 sprintf (msg,
" * Case Rule %d, Src :%0X, Dest:%0X *", rule_id, cp_src, cp_dest);
3203 if (tf_rule ==
NULL)
3230 char *tf_buf =
NULL;
3258 if (strcmp (el_name,
"s") == 0)
3267 tf_rule->
src = tf_buf;
3270 else if (strcmp (el_name,
"d") == 0)
3279 tf_rule->
dest = tf_buf;
3317 char *att_val =
NULL;
3334 if (strcasecmp (att_val,
"ISO") == 0)
3338 else if (strcasecmp (att_val,
"DBCS") == 0)
3342 else if (strcasecmp (att_val,
"ISO88591") == 0)
3346 else if (strcasecmp (att_val,
"ISO88599") == 0)
3352 PRINT_DEBUG_START (data, attr,
"Invalid value for type." "Expecting ISO88591 or ISO or EUC", -1);
3429 sprintf (msg,
"Too much data : %d + %d bytes", ld->
data_buf_count, len);
3445 memcpy (msg, s, len);
3452 memcpy (msg2, s, 32);
3454 sprintf (msg,
"%s | %d bytes", msg2, len);
3497 if (realloc_collations ==
NULL)
3512 return loc_collation;
3537 if (realloc_rules ==
NULL)
3543 curr_coll_tail->
rules = realloc_rules;
3576 if (realloc_alpha_tailoring_rules ==
NULL)
3617 if (realloc_cub_rules ==
NULL)
3623 curr_coll_tail->
cub_rules = realloc_cub_rules;
3648 const char **curr_att;
3666 for (curr_att = attrs; *curr_att !=
NULL; curr_att++, curr_att++)
3668 printf (
" %s=\"%s\"", curr_att[0], curr_att[1]);
3671 if (*msg ==
'\0' && status == 0)
3683 else if (status == -1)
3723 if (*msg ==
'\0' && status == 0)
3771 printf (
"%s ", msg);
3799 #define ID_PER_RANGE 8 3800 #define START_GENERIC_RANGE LANG_MAX_BUILTIN_COLLATIONS 3801 #define START_LANG_RANGE 47 3805 const char *charset_part, *lang_part, *desc_part;
3806 int range_start, range_size;
3808 strcpy (coll_name, coll_tail->
coll_name);
3810 charset_part = coll_name;
3811 lang_part = strchr (coll_name,
'_');
3812 if (lang_part !=
NULL)
3815 desc_part = strchr (lang_part,
'_');
3816 if (desc_part !=
NULL)
3826 if (lang_part !=
NULL)
3828 if (strncasecmp (lang_part,
"gen", 3) == 0)
3835 int s = (int) *lang_part;
3837 s = (s >
'z') ?
'z' : ((s <
'a') ?
'a' : s);
3843 if (desc_part !=
NULL)
3845 while (desc_part < coll_name +
strlen (coll_name))
3847 coll_id += *desc_part++;
3851 coll_id %= range_size;
3852 coll_id += range_start;
3858 #undef START_GENERIC_RANGE 3859 #undef START_LANG_RANGE 3877 if (taken_collations[coll_tail->
coll_id] != 0)
3879 snprintf (err_msg,
sizeof (err_msg) - 1,
3880 "Invalid collation numeric identifier : %d" " for collation '%s'. Id is already taken.",
3886 taken_collations[coll_tail->
coll_id] = 1;
3905 char conv_file_name[PATH_MAX];
3908 int txt_conv_max_items = 0;
3909 int txt_conv_count_items = 0;
3911 unsigned int cp_text = 0;
3912 unsigned int cp_unicode = 0;
3922 printf (
"No console conversion data\n");
3932 printf (
"Built-in console conversion\n");
3939 conv_file_name[
sizeof (conv_file_name) - 1] =
'\0';
3941 fp =
fopen_ex (conv_file_name,
"rt");
3945 fp =
fopen_ex (conv_file_name,
"rt");
3958 printf (
"Using file: %s\n", conv_file_name);
3962 while (fgets (str,
sizeof (str), fp))
3975 if (*s ==
'\0' || *s ==
'#')
3985 snprintf_dots_truncate (err_msg,
sizeof (err_msg) - 1,
"Codepoint value too big" " in file :%s at line %d",
4003 if (*s ==
'\0' || *s ==
'#')
4007 assert (cp_text <= 0xff);
4008 if (strncasecmp (s,
"#DBCS", 5) == 0)
4025 && min_values.
text_cp == 0xffff
4031 if (cp_unicode > 0xffff)
4033 snprintf_dots_truncate (err_msg,
sizeof (err_msg) - 1,
"Codepoint value too big" " in file :%s at line %d",
4040 if (txt_conv_count_items >= txt_conv_max_items)
4044 (txt_conv_max_items +
4046 if (realloc_txt_conv_array ==
NULL)
4054 txt_conv_array = realloc_txt_conv_array;
4060 txt_conv_array[txt_conv_count_items].
text_cp = cp_text;
4061 txt_conv_array[txt_conv_count_items].
unicode_cp = cp_unicode;
4069 txt_conv_count_items++;
4074 printf (
"Building %d console conversion rules\n", txt_conv_count_items);
4125 for (i = 0; (int) i < txt_conv_count_items; i++)
4130 cp_text = txt_conv_array[
i].
text_cp;
4144 utf8_to_text_item->
size = 1;
4145 utf8_to_text_item->
bytes[0] = cp_text;
4158 free (txt_conv_array);
4179 if (txt_conv_array !=
NULL)
4181 free (txt_conv_array);
4209 pos1 = *((
char *) arg1);
4210 pos2 = *((
char *) arg2);
4214 cmp = strcmp (s2, s1);
4216 return (cmp == 0) ? (pos1 - pos2) : cmp;
4382 free (t_rule->
t_buf);
4388 free (t_rule->
r_buf);
4461 memset ((
void *) cd, 0,
sizeof (
COLL_DATA));
4488 free (tf_rule->
src);
4494 free (tf_rule->
dest);
4561 char *locale_str =
NULL;
4570 printf (
"\n*** Parsing LDML\n");
4574 ldml_parser.
ud = ld;
4575 ldml_parser.
verbose = is_verbose;
4598 printf (
"Parsing finished.\n");
4599 printf (
"Date format: %s\n", ld->
dateFormat);
4600 printf (
"Time format: %s\n", ld->
timeFormat);
4611 const char *xml_err_text = (
char *) XML_ErrorString (XML_GetErrorCode (ldml_parser.
xml_parser));
4614 "Error parsing file %s, " "line : %d, column : %d. Internal XML: %s",
4668 alphabet_sh_entry =
NULL;
4695 for (cp = 0; (int) cp < a->l_count; cp++)
4697 int case_cnt, case_size, cp_size;
4701 for (case_size = 0, case_cnt = 0; case_cnt < a->
lower_multiplier && *lower_cp != 0;
4702 case_cnt++, lower_cp++)
4704 if (*lower_cp == cp)
4720 snprintf (msg,
sizeof (msg) - 1,
4721 "Lower case " "sequence for codepoint Ux%04X is too " 4722 "big: %d bytes; expecting at most %d", cp, case_size,
4723 cp_size * INTL_IDENTIFIER_CASING_SIZE_MULTIPLIER);
4730 for (case_size = 0, case_cnt = 0; case_cnt < a->
upper_multiplier && *upper_cp != 0;
4731 case_cnt++, upper_cp++)
4733 if (*upper_cp == cp)
4749 snprintf (msg,
sizeof (msg) - 1,
4750 "Upper case " "sequence for codepoint Ux%04X is too " 4751 "big: %d bytes; expecting at most %d", cp, case_size,
4752 cp_size * INTL_IDENTIFIER_CASING_SIZE_MULTIPLIER);
4764 printf (
"\n*** Processing Unicode normalization data ***\n");
4771 if (norm_sh_entry ==
NULL)
4783 printf (
"\n*** Processing console conversion data ***\n");
4792 if (ld->
coll_cnt == 0 && is_verbose)
4794 printf (
"\n*** No collation defined ***\n");
4811 snprintf (msg,
sizeof (msg) - 1,
4812 "Collation name %s " "not allowed. It cannot contain white-spaces " 4820 snprintf (shared_coll_data,
sizeof (shared_coll_data) - 1,
"%d", lc->
tail_coll.
coll_id);
4832 if (coll_sh_entry !=
NULL)
4835 const char *coll_sh_data = (
const char *) coll_sh_entry->
data;
4839 if (strcmp (shared_coll_data, coll_sh_data) != 0)
4844 snprintf (msg,
sizeof (msg) - 1,
4845 "File: %s, line: %d : " "collation name %s (id:%d) already defined in " 4858 printf (
"Warning : Definition of collation %s (id: %d) " "ignored in file: %s, line: %d. " 4874 printf (
"\n*** Processing collation : %s ***\n" "Number of weights = %d\n", lc->
tail_coll.
coll_name,
4922 printf (
"\n Locale checksum :%s\n", ld->
checksum);
4932 printf (
"\n\nLocale finished\n\n\n");
4954 #define PRINT_DUPLICATE_SYMBOL_NAME(symbol, dupl_coll, orig_coll, do_print) \ 4957 printf ("\n *** Duplicate array: %s in collation %s is a duplicate " \ 4958 "of %s from collation %s", (symbol), \ 4959 (dupl_coll)->opt_coll.coll_name, \ 4960 (symbol), (orig_coll)->opt_coll.coll_name); \ 4970 for (i1 = end_index - 1; i1 >= start_index; i1--)
4973 for (j1 = cur_ld->
coll_cnt - 1; j1 >= 0; j1--)
4977 for (i2 = start_index; i2 <= i1; i2++)
4980 for (j2 = 0; (i1 == i2 && j2 < j1) || (i1 > i2 && j2 < comp_ld->
coll_cnt); j2++)
5081 #undef PRINT_DUPLICATE_SYMBOL_NAME 5101 for (i = start_index; i < end_index; i++)
5128 char locale_cfg_file[PATH_MAX];
5133 int max_locales = 10;
5142 fp =
fopen_ex (locale_cfg_file,
"rt");
5159 locale_files =
NULL;
5163 if (locale_files ==
NULL)
5170 while (fgets (line,
sizeof (line) - 1, fp) !=
NULL)
5175 if (*line ==
'\0' || *line ==
'#' ||
char_isspace ((
int) *line))
5182 if (num_locales >= max_locales)
5187 if (realloc_locale_files ==
NULL)
5195 locale_files = realloc_locale_files;
5199 loc = &(locale_files[num_locales - 1]);
5234 *p_locale_files = locale_files;
5235 *p_num_locales = num_locales;
5262 bool is_alloc_ldml_file =
false;
5263 bool is_alloc_lib_file =
false;
5271 LOG_LOCALE_ERROR (
"invalid locale name in 'cubrid_locales.txt'", er_status,
true);
5280 snprintf (ldml_short_file,
sizeof (ldml_short_file) - 1,
"cubrid_%s.xml", lf->
locale_name);
5281 ldml_short_file[
sizeof (ldml_short_file) - 1] =
'\0';
5288 lf->
ldml_file = (
char *) malloc (PATH_MAX + 1);
5296 is_alloc_ldml_file =
true;
5303 char lib_short_file[PATH_MAX];
5306 lib_short_file[
sizeof (lib_short_file) - 1] =
'\0';
5313 lf->
lib_file = (
char *) malloc (PATH_MAX + 1);
5321 is_alloc_lib_file =
true;
5332 snprintf (lib_short_file,
sizeof (lib_short_file) - 1,
"libcubrid_all_locales.%s",
LOCLIB_FILE_EXT);
5333 lib_short_file[
sizeof (lib_short_file) - 1] =
'\0';
5350 if (is_alloc_ldml_file)
5356 if (is_alloc_lib_file)
5379 fprintf (fp,
"\t{\n");
5380 fprintf (fp,
"\t\t%u, \n", c->
next);
5381 fprintf (fp,
"\t\t%u, \n", c->
wv);
5388 fprintf (fp,
",\n");
5396 fprintf (fp,
"\t\t{ 0 }");
5401 fprintf (fp,
"\t\t{ 0 },\n\t\t{ 0 }");
5404 fprintf (fp,
",\n\t\t");
5406 fprintf (fp,
", \n");
5407 fprintf (fp,
"\t\t%u, \n", c->
cp_count);
5408 fprintf (fp,
"\t\t%u, \n", c->
size);
5409 fprintf (fp,
"\t\t%u \n", c->
uca_num);
5411 fprintf (fp,
"} \n");
5430 char c_file_path[PATH_MAX];
5440 fprintf (fp,
"/* GENERATED FILE - DO NOT EDIT */\n");
5442 #if defined(WINDOWS) 5443 fprintf (fp,
"#include <stdio.h>\n");
5445 fprintf (fp,
"#include <stddef.h>\n");
5447 fprintf (fp,
"#include \"locale_lib_common.h\"\n\n");
5451 snprintf_dots_truncate (err_msg,
sizeof (err_msg) - 1,
"Error opening file %s for rewrite.", c_file_path);
5469 char c_file_path[PATH_MAX];
5503 snprintf (coll_suffix,
sizeof (coll_suffix) - 1,
"%d_%s", i, ld->
locale_name);
5526 snprintf_dots_truncate (err_msg,
sizeof (err_msg) - 1,
"Error opening file %s for append.", c_file_path);
5596 if (save_w_identier_name)
5641 const char *alpha_suffix;
5645 alpha_suffix =
"unicode";
5649 alpha_suffix =
"ascii";
5664 const char *alpha_suffix;
5665 bool save_w_identif =
false;
5669 alpha_suffix =
"unicode";
5673 alpha_suffix =
"ascii";
5678 save_w_identif =
true;
5794 if (i < cd->count_contr - 1)
5799 fprintf (fp,
"};\n");
5866 fprintf (fp,
"},\n");
5868 fprintf (fp,
"};\n");
5878 fprintf (fp,
"},\n");
5880 fprintf (fp,
"};\n");
5901 char *
p, *end, *token =
NULL;
5919 length = (int) (end - p);
5922 token = (
char *) malloc (length + 1);
5930 strncpy (token, p, length);
5931 token[length] =
'\0';
5958 #define DUMP_CP_BUF_SIZE 128 5961 unsigned int *case_buf;
5966 assert (lower_bound <= upper_bound);
5968 printf (
"Alphabet type: ");
5971 printf (
"Unicode\n");
5980 printf (
"Tailored\n");
5983 printf (
"Letter count: %d\n", ad->
l_count);
5990 for (cp = lower_bound; cp < upper_bound; cp++)
5994 printf (
"CP: Ux%04X | %-4s", cp, (cp > 0x0020 ? utf8_buf : (
unsigned char *)
""));
5997 bool print_case =
true;
5998 memset (out_cp, 0,
sizeof (out_cp));
5999 memset (out_case, 0,
sizeof (out_case));
6007 if (case_buf[i] == 0)
6012 if (case_buf[i] < 0x20)
6016 memset (utf8_buf, 0,
sizeof (utf8_buf));
6018 strcat (out_case, (
char *) utf8_buf);
6019 snprintf (temp_cp,
sizeof (temp_cp) - 1,
"Ux%04X", case_buf[i]);
6020 strcat (out_cp, temp_cp);
6022 printf (
" | Lower : CP(s): %-12s, lower char(s): %-12s", out_cp, (print_case ? out_case :
""));
6026 bool print_case =
true;
6027 memset (out_cp, 0,
sizeof (out_cp));
6028 memset (out_case, 0,
sizeof (out_case));
6036 if (case_buf[i] == 0)
6041 if (case_buf[i] < 0x20)
6046 memset (utf8_buf, 0,
sizeof (utf8_buf));
6048 strcat (out_case, (
char *) utf8_buf);
6049 snprintf (temp_cp,
sizeof (temp_cp) - 1,
"Ux%04X", case_buf[i]);
6050 strcat (out_cp, temp_cp);
6052 printf (
" | Upper : CP(s): %-12s, upper char(s): %-12s", out_cp, (print_case ? out_case :
""));
6073 unsigned int *coll_key_list =
NULL;
6074 int coll_key_list_cnt = 0;
6075 int lower_bound = 0;
6076 int upper_bound = 0;
6084 if (start_value > lower_bound)
6086 lower_bound = start_value;
6088 if (end_value > 0 && end_value < upper_bound)
6092 upper_bound = end_value + 1;
6097 printf (
"Max codepoints: %d\n", coll->
w_count);
6102 printf (
"Expansion CE num: %d\n", coll->
uca_exp_num);
6112 if (upper_bound < lower_bound)
6125 printf (
"* Codepoint collation info (codepoint order) *\n");
6126 for (cp = lower_bound; cp < upper_bound; cp++)
6128 unsigned int next_id;
6130 assert (cp >= 0 && cp < coll->w_count);
6135 printf (
" | Next : ");
6143 if (coll->
count_contr > 0 && (dl_settings & DUMPLOCALE_IS_COLLATION_CP_ORDER) != 0)
6146 printf (
"* Contraction collation info (contraction order) *\n");
6152 printf (
" | Next :");
6163 int keys_same_weight = 1;
6164 int cp_count = upper_bound - lower_bound;
6165 bool use_expansions;
6168 printf (
"* Collation info (weight order) *\n");
6170 coll_key_list = (
unsigned int *) malloc (coll_key_list_cnt *
sizeof (
unsigned int));
6171 if (coll_key_list ==
NULL)
6178 for (cp = lower_bound; cp < upper_bound; cp++)
6180 coll_key_list[cp - lower_bound] = cp;
6191 dump_coll_data = coll;
6202 for (i = 0; i < coll_key_list_cnt; i++)
6204 bool same_weights =
false;
6221 if (i > 0 && !same_weights)
6223 if (keys_same_weight > 1)
6225 printf (
" Keys same weight : %d\n", keys_same_weight);
6233 keys_same_weight = 1;
6248 if (coll_key_list !=
NULL)
6250 free (coll_key_list);
6272 int lower_bound = 0;
6273 int upper_bound = 0;
6274 int alphabet_settings;
6280 assert (start_value <= end_value);
6284 printf (
"*************************************************\n");
6286 printf (
"Locale string: %s\n", lld->
lang_name);
6287 printf (
"Locale checksum: %s\n", lld->
checksum);
6291 printf (
"\n * Calendar *\n");
6299 printf (
"\nAbbreviated month names:\n");
6304 printf (
"\nAbbreviated month names, sorted for tokenizer:\n");
6311 printf (
"\nWide month names:\n");
6314 printf (
"%d. %s\n", (i + 1), lld->
month_name[i]);
6316 printf (
"\nWide month names, sorted for tokenizer:\n");
6323 printf (
"\nAbbreviated weekday names:\n");
6328 printf (
"\nAbbreviated weekday names, sorted for parse order:\n");
6335 printf (
"\nWide weekday names:\n");
6338 printf (
"%d. %s\n", (i + 1), lld->
day_name[i]);
6340 printf (
"\nWide weekday names, sorted for tokenizer:\n");
6347 printf (
"\nDay periods:\n");
6350 printf (
"%d. %s\n", (i + 1), lld->
am_pm[i]);
6352 printf (
"\nDay periods, sorted for tokenizer:\n");
6363 printf (
"\n * Numbers *\n");
6373 if (start_value > lower_bound)
6375 lower_bound = start_value;
6377 if (end_value > 0 && end_value < upper_bound)
6381 upper_bound = end_value + 1;
6385 if (upper_bound < lower_bound)
6395 if ((dl_settings & DUMPLOCALE_IS_ALPHABET) != 0)
6397 alphabet_settings = 0;
6400 printf (
"\n * Alphabet data *\n");
6407 alphabet_settings = 0;
6418 printf (
"* Identifier alphabet data *\n");
6426 printf (
"* Normalization data *\n");
6434 printf (
"* Console conversion data *\n");
6457 int i, count_coll_to_load;
6471 printf (
"\n\n* Collations: %d collations found *\n", count_coll_to_load);
6473 for (i = 0; i < count_coll_to_load; i++)
6476 char *coll_name =
NULL;
6524 pos1 = *((
unsigned int *) arg1);
6525 pos2 = *((
unsigned int *) arg2);
6529 return (cmp == 0) ? (int) (pos1 - pos2) :
cmp;
6546 unsigned int wv1, wv2;
6549 pos1 = *((
unsigned int *) arg1);
6550 pos2 = *((
unsigned int *) arg2);
6591 pos1 = *((
unsigned int *) arg1);
6592 pos2 = *((
unsigned int *) arg2);
6596 return (cmp == 0) ? (int) (pos1 - pos2) :
cmp;
6620 pos1 = *((
unsigned int *) arg1);
6621 pos2 = *((
unsigned int *) arg2);
6634 utf8_buf_1[size1] =
'\0';
6635 str1 = (
char *) utf8_buf_1;
6646 utf8_buf_2[size2] =
'\0';
6647 str2 = (
char *) utf8_buf_2;
6651 (
const unsigned char *) str2, size2,
NULL,
false,
NULL,
false);
6699 bool print_utf8 =
true;
6708 for (i = 0; i < cp_count; i++)
6710 printf (
"Ux%04X ", cp_list[i]);
6711 if (cp_list[i] < 0x20)
6719 printf (
" | %s", contr->
c_buf);
6730 printf (
" | Weight : %04x", contr->
wv);
6736 printf (
" | Weight : ");
6737 for (i = 0; i < (int) contr->
uca_num; i++)
6744 printf (
"%04X]", contr->
uca_w_l4[i]);
6773 printf (
"CP: Ux%04X | %-4s", cp, ((cp > 0x20) ? utf8_buf : (
unsigned char *)
""));
6783 printf (
" | Weight%s: %04x", ((
int) cp < coll->w_count) ?
"" :
"(Computed)",
6784 (((
int) cp < coll->w_count) ? (coll->
weights[cp]) : (cp + 1)));
6791 if ((
int) cp < coll->w_count)
6796 printf (
" | Weight : ");
6801 for (i = 0; i < coll->
uca_num[cp]; i++)
6818 printf (
" | Weight(Computed) : %04X", cp + 1);
6840 #define SHARED_DATA_INCR_SIZE 32 6848 *found_entry =
NULL;
6852 if (lsd_type == shared_data[i].lsd_type && strcmp (lsd_key, shared_data[i].lsd_key) == 0)
6854 *found_entry = &(shared_data[
i]);
6866 if (realloc_shared_data ==
NULL)
6874 shared_data = realloc_shared_data;
6879 memset (&(shared_data[count_shared_data]), 0,
sizeof (
LOC_SHARED_DATA));
6881 strncpy (shared_data[count_shared_data].lsd_key, lsd_key,
COLL_NAME_SIZE - 1);
6887 if (shared_data[count_shared_data].data ==
NULL)
6895 if (ldml_context !=
NULL)
6898 if (shared_data[count_shared_data].ldml_context.
ldml_file ==
NULL)
6907 count_shared_data++;
6912 #undef SHARED_DATA_INCR_SIZE 6923 if (shared_data !=
NULL)
6931 if (shared_data[i].data !=
NULL)
6933 free (shared_data[i].data);
6965 char *att_val =
NULL;
7063 fprintf (fp,
"\t{%u, %d, ", um->
cp, um->
size);
7065 fprintf (fp,
"}%s\n", (i < norm->unicode_mappings_count - 1) ?
"," :
"");
7074 #define NORM_MAPPING_DUMP_MODE_FULL 0 7075 #define NORM_MAPPING_DUMP_MODE_COMP 1 7076 #define NORM_MAPPING_DUMP_MODE_DECOMP 2 7088 printf (
"Sorted list of unicode mappings: \n");
7091 printf (
"%d.\t ", i + 1);
7096 printf (
"\n Unicode composition mappings \n");
7099 int j, comp_start, comp_end;
7101 printf (
"CP: %04X | \t Comp: ", i);
7112 printf (
"(%2d) From: %d To: %d | \t", comp_end - comp_start, comp_start, comp_end);
7114 for (j = comp_start; j < comp_end; j++)
7122 printf (
"\n Unicode decomposition mappings\n");
7127 printf (
"CP: %04X | Decomp : ", i);
7135 assert (decomp_idx >= 0);
7153 unsigned char *next;
7154 unsigned char *cur_str;
7158 printf (
"Null mapping.\n");
7164 printf (
"CP: %04X", um->
cp);
7173 while (next < um->buffer + um->
size)
7176 printf (
"%04X ", cp);
7182 printf (
" -> CP: %04X", um->
cp);
7196 unsigned char cnv_utf8_buf[2 * 3 + 1];
7197 unsigned char *cnv_utf8;
7199 unsigned int utf8_cp, con_cp;
7200 unsigned char *next;
7202 unsigned char *char_to_print =
NULL;
7207 printf (
"\nNo console conversion for this locale.\n\n");
7211 printf (
"\nType: ");
7214 printf (
"built-in %s console to UTF-8 encoding \n",
7223 printf (
"Linux LANG charset values: %s\n", tc->
nl_lang_str);
7230 printf (
"\nConsole to UTF-8 conversion:\n");
7231 printf (
"Console codepoint -> Unicode codepoint | Character (UTF-8) \n");
7234 unsigned char dbcs_seq[2 + 1];
7239 printf (
"%02X -> Undefined or leading byte\n", con_cp);
7250 if (utf8_cp == 0x3f)
7253 printf (
"%04X -> Undefined codepoint\n", con_cp);
7258 assert ((
unsigned int) utf8_size <
sizeof (utf8_seq));
7259 utf8_seq[utf8_size] =
'\0';
7261 char_to_print = (utf8_cp > 0x20) ? utf8_seq : (
unsigned char *)
"";
7264 dbcs_seq[dbcs_size] =
'\0';
7266 cnv_utf8 = cnv_utf8_buf;
7267 utf8_size =
sizeof (cnv_utf8_buf);
7276 if (dbcs_size == 2 && tc->
byte_flag[dbcs_seq[0]] != 1)
7288 if (cnv_utf8 !=
NULL)
7290 assert ((
unsigned int) utf8_size <=
sizeof (cnv_utf8_buf));
7291 char_to_print = cnv_utf8;
7297 assert ((
unsigned int) utf8_size <
sizeof (utf8_seq));
7298 utf8_seq[utf8_size] =
'\0';
7300 char_to_print = (utf8_cp > 0x20) ? utf8_seq : (
unsigned char *)
"";
7305 printf (
"%02X -> Ux%04X | %s\n", con_cp, utf8_cp, char_to_print);
7309 printf (
"%04X -> Ux%04X | %s\n", con_cp, utf8_cp, char_to_print);
7317 printf (
"Range %02X - FF is not mapped\n", tc->
text_last_cp + 1);
7321 printf (
"Range %04X - FFFF is not mapped\n", tc->
text_last_cp + 1);
7325 printf (
"\n\nUTF-8 to console conversion:\n");
7326 printf (
"Unicode codepoint [Unicode character] ->" " Console codepoint | Character (UTF-8 encoding)\n");
7327 for (utf8_cp = 0; utf8_cp <= tc->
utf8_last_cp; utf8_cp++)
7332 assert ((
unsigned int) utf8_size <
sizeof (utf8_seq));
7333 utf8_seq[utf8_size] =
'\0';
7342 char_to_print = utf8_seq;
7353 assert (utf8_cp != 0x3f);
7354 printf (
"Ux%04X [%s] -> Not mapped\n", utf8_cp, utf8_seq);
7358 cnv_utf8 = cnv_utf8_buf;
7359 utf8_size =
sizeof (cnv_utf8_buf);
7371 assert ((
unsigned int) utf8_size <=
sizeof (cnv_utf8_buf));
7372 char_to_print = cnv_utf8 ? cnv_utf8 : utf8_seq;
7377 printf (
"Ux%04X [%s] -> %02X | %s\n", utf8_cp, utf8_seq, con_cp, char_to_print);
7381 printf (
"Ux%04X [%s] -> %04X | %s\n", utf8_cp, utf8_seq, con_cp, char_to_print);
7385 printf (
"Codepoints above Ux%04X are not mapped\n", tc->
utf8_last_cp);
7391 #define BUF_PUT_INT16(buf,v) \ 7393 unsigned short nv = htons(v); \ 7394 *((unsigned char *) (buf)) = ((unsigned char *) &nv)[1]; \ 7395 buf = (char *) (buf) + 1; \ 7396 *((unsigned char *) (buf)) = ((unsigned char *) &nv)[0]; \ 7397 buf = (char *) (buf) + 1; \ 7400 #define BUF_PUT_INT32(buf,v) \ 7402 unsigned int nv = htonl(v); \ 7403 *((unsigned char *) (buf)) = ((unsigned char *) &nv)[3]; \ 7404 buf = (char *) (buf) + 1; \ 7405 *((unsigned char *) (buf)) = ((unsigned char *) &nv)[2]; \ 7406 buf = (char *) (buf) + 1; \ 7407 *((unsigned char *) (buf)) = ((unsigned char *) &nv)[1]; \ 7408 buf = (char *) (buf) + 1; \ 7409 *((unsigned char *) (buf)) = ((unsigned char *) &nv)[0]; \ 7410 buf = (char *) (buf) + 1; \ 7413 #define BUF_ALIGN(buf, align) \ 7414 ((char *)((((UINTPTR)(buf) + ((UINTPTR)((align)-1)))) \ 7415 & ~((UINTPTR)((align)-1)))) 7427 char *input_buf =
NULL;
7464 input_buf = (
char *) malloc (input_size);
7465 if (input_buf ==
NULL)
7471 memset (input_buf, 0, input_size);
7472 buf_pos = input_buf;
7476 for (cp = 0; cp < cd->
w_count; cp++)
7487 for (cp = 0; cp < cd->
w_count; cp++)
7498 for (cp = 0; cp < cd->
w_count; cp++)
7504 for (cp = 0; cp < cd->
w_count; cp++)
7527 memcpy (buf_pos, c->
c_buf, sizeof (c->
c_buf));
7528 buf_pos +=
sizeof (c->
c_buf);
7531 *buf_pos++ = c->
size;
7535 sizeof (
COLL_CONTRACTION) - (2 *
sizeof (
int) + MAX_UCA_EXP_CE *
sizeof (int) +
7536 MAX_UCA_EXP_CE *
sizeof (
short) +
sizeof (c->
c_buf) + 3 *
sizeof (
char));
7549 buf_pos =
BUF_ALIGN (buf_pos,
sizeof (
int));
7552 buf_pos =
BUF_ALIGN (buf_pos,
sizeof (
int));
7555 buf_pos =
BUF_ALIGN (buf_pos,
sizeof (
int));
7558 if (buf_pos - input_buf != input_size)
7564 assert (buf_pos - input_buf == input_size);
7584 input_size +=
sizeof (a->
a_type);
7603 char *buf_pos = buf;
7608 for (cp = 0; cp < a->
l_count; cp++)
7616 for (cp = 0; cp < a->
l_count; cp++)
7637 char *input_buf =
NULL;
7654 input_size +=
sizeof (ld->
am_pm);
7698 input_buf = (
char *) malloc (input_size);
7699 if (input_buf ==
NULL)
7705 buf_pos = input_buf;
7706 memset (input_buf, 0, input_size);
7743 memcpy (buf_pos, ld->
am_pm, sizeof (ld->
am_pm));
7744 buf_pos +=
sizeof (ld->
am_pm);
7823 buf_pos +=
sizeof (um->
buffer);
7829 if (buf_pos - input_buf != input_size)
7835 assert (buf_pos - input_buf == input_size);
7900 int xml_line_no = XML_GetCurrentLineNumber (pd->
xml_parser);
7901 int xml_col_no = XML_GetCurrentColumnNumber (pd->
xml_parser);
7903 snprintf (msg,
sizeof (msg) - 1,
"* Rule %d, L :%d, Dir:%d, PosType:%d, Mc:%d ;" " XML: line: %d , col:%d *",
7924 char *ref_buf_p =
NULL;
7925 int ref_buf_size = 0;
7948 assert (ref_buf_size > 0);
7951 t_rule->
r_buf = (
char *) malloc (ref_buf_size);
7958 memcpy (t_rule->
r_buf, ref_buf_p, ref_buf_size);
7979 char *att_val =
NULL;
7980 char include_file_path[PATH_MAX] = { 0 };
7981 char *prev_ldml_file =
NULL;
7982 int prev_line_no = 0;
7990 PRINT_DEBUG_START (data, attr,
"<include> tag requires a valid " "FILE attribute.", -1);
8004 prev_line_no = context->
line_no;
8016 ret = snprintf (err_msg,
sizeof (err_msg) - 1,
"Inclusion loop found for file %s.", include_file_path);
8019 ret = snprintf (err_msg,
sizeof (err_msg) - 1,
"Failed to initialize subparser for file path %s.",
8023 ret = snprintf (err_msg,
sizeof (err_msg) - 1,
"Memory exhausted when creating subparser for file %s.",
8039 snprintf_dots_truncate (err_msg,
sizeof (err_msg) - 1,
"Included file %s does not exist or " "is not accessible.",
8049 const char *xml_err_text = (
char *) XML_ErrorString (XML_GetErrorCode (new_pd->
xml_parser));
8051 snprintf_dots_truncate (msg,
sizeof (msg) - 1,
"Error parsing file %s, " "line: %d, column: %d. Internal XML: %s",
8059 context->
line_no = prev_line_no;
XML_ELEMENT_DEF ldml_timetzFormatCUBRID
static int end_day(void *data, const char *el_name)
XML_ELEMENT_DEF ldml_elem_collation_cubrid_rules_set_cp
static int start_collation_x(void *data, const char **attr)
const char * month_short_parse_order
int uca_process_collation(LOCALE_COLLATION *lc, bool is_verbose)
unsigned char bytes[TEXT_CONV_MAX_BYTES]
#define LANG_MAX_COLLATIONS
#define INTL_IS_NEXT_CONTR(v)
XML_ELEMENT_DEF ldml_elem_collation_x_p
XML_ELEMENT_DEF ldml_elem_collation_reset_first_non_ignorable
const char * month_name[CAL_MONTH_COUNT]
char nl_lang_str[TXT_CONV_SYSTEM_STR_SIZE]
XML_ELEMENT_DEF ldml_elem_collation_reset_first_secondary_ignorable
static int end_collation_x(void *data, const char *el_name)
XML_ELEMENT_DEF ldml_elem_collation_reset_last_non_ignorable
char coll_next_cp_ref[LOC_LIB_SYMBOL_NAME_SIZE]
static int common_collation_end_rule(void *data, LOCALE_DATA *ld, const int rule_id, TAILOR_RULE *t_rule)
#define TXT_CONV_ITEM_GROW_COUNT
static int locale_save_calendar_to_C_file(FILE *fp, LOCALE_DATA *ld)
static int end_datetimetzFormatCUBRID(void *data, const char *el_name)
CONV_CP_TO_BYTES * utf8_to_text
XML_ELEMENT_DEF ldml_elem_collation_reset_last_trailing
XML_ELEMENT_DEF ldml_elem_calendars
#define BUF_PUT_INT32(buf, v)
char coll_cp_first_contr_array_ref[LOC_LIB_SYMBOL_NAME_SIZE]
XML_ELEMENT_DEF ldml_elem_dayPeriodContext
int lang_load_coll_from_lib(COLL_DATA *cd, void *lib_handle, const LOCALE_FILE *lf)
int locale_dump_lib_collations(void *lib_handle, const LOCALE_FILE *lf, int dl_settings, int start_value, int end_value)
#define XML_COMMENT_START
#define XML_CUB_ERR_FILE_MISSING
static int end_collation_cubrid_rule_set_cp_ch(void *data, const char *el_name)
unsigned char buffer[NORMALIZATION_MAX_BUF_SIZE]
XML_ELEMENT_DEF ldml_elem_collation_reset_first_tertiary_ignorable
static int end_timestampFormatCUBRID(void *data, const char *el_name)
XML_ELEMENT_DEF ldml_elem_collation_cubrid_rules_set_w
#define LOC_DATA_MONTH_ABBR_SIZE
LDML_CONTEXT ldml_context
char month_names_wide_parse_order[CAL_MONTH_COUNT]
static int start_consoleconversion(void *data, const char **attr)
XML_ELEMENT_DEF ldml_elem_collation_settings
CP_BUF_TYPE start_cp_buf_type
char end_cp_buf[LOC_DATA_BUFF_SIZE]
ALPHABET_DATA identif_alphabet
int locale_compile_locale(LOCALE_FILE *lf, LOCALE_DATA *ld, bool is_verbose)
XML_ELEMENT_DEF ldml_elem_days
XML_ELEMENT_DEF ldml_elem_collation_s
void locale_free_shared_data(void)
COLL_MATCH_CONTR sett_match_contr
char month_names_abbr_parse_order[CAL_MONTH_COUNT]
#define LOC_MAX_UCA_CHARS_SEQ
XML_ELEMENT_DEF ldml_elem_dayWidth
static int start_upper_case_rule(void *data, const char **attr)
static int end_collation_logical_pos(void *data, const char *el_name)
char last_anchor_buf[LOC_DATA_COLL_TWO_CHARS]
static int start_one_alphabet(void *data, const char **attr)
XML_ELEMENT_DEF ldml_elem_day
char timestampFormat[CAL_COMP_DATE_FORMAT_SIZE]
static int start_dayPeriodWidth(void *data, const char **attr)
static int start_unicode_file(void *data, const char **attr)
XML_ELEMENT_DEF ldml_elem_months
static void dump_collation_key(COLL_DATA *coll, const unsigned int key, bool print_weight, bool print_key)
LDML_CONTEXT ldml_context
static int comp_func_coll_uca_simple_weights(const void *arg1, const void *arg2)
XML_ELEMENT_DEF ldml_elem_collation_cubrid_rules_set_scp
UCA_L13_W uca_w_l13[MAX_UCA_EXP_CE]
int str_to_uint32(unsigned int *ret_p, char **end_p, const char *str_p, int base)
static int locale_check_and_set_shared_data(const LOC_SHARED_DATA_TYPE lsd_type, const char *lsd_key, const void *data, LDML_CONTEXT *ldml_context, LOC_SHARED_DATA **found_entry)
char start_cp_buf[LOC_DATA_BUFF_SIZE]
XML_PARSER_DATA * xml_create_subparser(XML_PARSER_DATA *pd, char *new_file)
static int end_collation_cubrid_rule_set_w_wr(void *data, const char *el_name)
static TAILOR_RULE * new_collation_rule(LOCALE_DATA *ld)
const char * am_pm[CAL_AM_PM_COUNT]
char * envvar_libdir_file(char *path, size_t size, const char *filename)
static int start_collation_reset(void *data, const char **attr)
XML_ELEMENT_DEF ldml_timestampFormatCUBRID
XML_ELEMENT_DEF ldml_elem_alphabet_upper
XML_ELEMENT_DEF ldml_elem_dayContext
int locale_save_all_to_C_file(LOCALE_DATA **ld, int start_index, int end_index, LOCALE_FILE *lf)
#define PRINT_STRING_ARRAY_TO_C_FILE(fp, valname, arrcount, val, d)
RULE_POS_TYPE last_rule_pos_type
XML_ELEMENT_DEF ldml_elem_numbers
#define TXT_CONV_LINE_SIZE
#define SHARED_DATA_INCR_SIZE
static void clear_data_buffer(XML_PARSER_DATA *pd)
static int start_calendar(void *data, const char **attr)
static int end_dayPeriod(void *data, const char *el_name)
void locale_destroy_alphabet_data(const ALPHABET_DATA *a)
static int start_one_collation(void *data, const char **attr)
static int start_currency(void *data, const char **attr)
#define DUMPLOCALE_IS_COLLATION_WEIGHT_ORDER
XML_ELEMENT_DEF ldml_elem_alphabet_lower
int(* ELEM_START_FUNC)(void *, const char **)
static int locale_alphabet_data_to_buf(ALPHABET_DATA *a, char *buf)
const char * month_short_name[CAL_MONTH_COUNT]
static int handle_data_collation_rule(void *data, const char *s, int len)
static char cmp_token_name_size
static int locale_save_alphabets_to_C_file(FILE *fp, LOCALE_DATA *ld)
XML_Parser xml_init_parser(void *data, const char *xml_file, const char *encoding, XML_ELEMENT_DEF **element_array, const int count)
#define XML_CUB_OUT_OF_MEMORY
static int end_collation_reset(void *data, const char *el_name)
static int end_month_day_Width(void *data, const char *el_name)
const char * datetime_format
#define XML_CUB_ERR_PARSER
int intl_cp_to_utf8(const unsigned int codepoint, unsigned char *utf8_seq)
#define NORM_MAPPING_DUMP_MODE_DECOMP
static int end_timestamptzFormatCUBRID(void *data, const char *el_name)
static int end_datetimeFormatCUBRID(void *data, const char *el_name)
#define BUF_PUT_INT16(buf, v)
XML_ELEMENT_DEF ldml_elem_collation_cubrid_rules_set_ch
static int end_collation_cubrid_rule_set(void *data, const char *el_name)
static int locale_save_collation_data_to_C_file(FILE *fp, LOCALE_COLLATION *lc)
XML_ELEMENT_DEF ldml_elem_alphabet_lower_dest
static CUBRID_TAILOR_RULE * new_collation_cubrid_rule(LOCALE_DATA *ld)
XML_ELEMENT_DEF ldml_datetimetzFormatCUBRID
#define NORM_MAPPING_DUMP_MODE_COMP
static int end_collation_x_rule(void *data, const char *el_name)
const char * timestamptz_format
#define XML_USER_DATA(xml)
static void locale_make_calendar_parse_order(LOCALE_DATA *ld)
static void locale_destroy_collation_data(const COLL_DATA *cd)
XML_ELEMENT_DEF ldml_elem_alphabet_upper_dest
#define LOC_DATA_DAY_ABBR_SIZE
char timetzFormat[CAL_SIMPLE_DATE_TZ_FORMAT_SIZE]
XML_ELEMENT_DEF ldml_elem_collation_cubrid_rules_set_ech
XML_ELEMENT_DEF ldml_elem_collation_x_s
XML_ELEMENT_DEF ldml_elem_collation_x_t
static int start_numbers_symbols(void *data, const char **attr)
static int end_collation_cubrid_rule_set_ech_ecp(void *data, const char *el_name)
#define LOC_DATA_AM_PM_SIZE
XML_ELEMENT_DEF ldml_elem_collation_cubrid_rules_set_ecp
static int locale_check_collation_id(const COLL_TAILORING *coll_tail)
XML_ELEMENT_DEF ldml_elem_consoleconversion
#define MAX_UNICODE_CHARS
static int end_element_ok(void *data, const char *el_name)
XML_ELEMENT_DEF ldml_elem_alphabet
XML_ELEMENT_DEF ldml_elem_collation
char month_names_wide[CAL_MONTH_COUNT][LOC_DATA_MONTH_WIDE_SIZE]
struct unicode_mapping UNICODE_MAPPING
LOC_SHARED_DATA_TYPE lsd_type
UNICODE_MAPPING * unicode_mappings
static int end_one_collation(void *data, const char *el_name)
char win_codepages[TXT_CONV_SYSTEM_STR_SIZE]
CONV_CP_TO_BYTES * text_to_utf8
static int end_dateFormatCUBRID(void *data, const char *el_name)
#define DUMPLOCALE_IS_CALENDAR
#define PRINT_STRING_TO_C_FILE(fp, val, len)
LOCALE_COLLATION * collations
ALPHABET_DATA ident_alphabet
static int locale_compute_coll_checksum(COLL_DATA *cd)
int lang_strmatch_utf8_uca_w_coll_data(const COLL_DATA *coll_data, bool is_match, const unsigned char *str1, const int size1, const unsigned char *str2, const int size2, const unsigned char *escape, const bool has_last_escape, int *str1_match_size, bool ignore_trailing_space)
static int locale_save_to_C_file(LOCALE_FILE lf, LOCALE_DATA *ld)
static int end_timetzFormatCUBRID(void *data, const char *el_name)
#define DUMPLOCALE_IS_IDENTIFIER_ALPHABET_LOWER
#define START_GENERIC_RANGE
static int save_contraction_to_C_file(FILE *fp, COLL_CONTRACTION *c, bool use_expansion, bool use_level_4)
static int start_month(void *data, const char **attr)
char am_pm_parse_order[CAL_AM_PM_COUNT]
#define DUMPLOCALE_IS_NORMALIZATION
unsigned int text_first_cp
static int locale_compute_locale_checksum(LOCALE_DATA *ld)
char coll_uca_w_l4_ref[LOC_LIB_SYMBOL_NAME_SIZE]
#define PRINT_DUPLICATE_SYMBOL_NAME(symbol, dupl_coll, orig_coll, do_print)
#define COLL_SHARED_DATA_SIZE
XML_ELEMENT_DEF ldml_elem_calendar
#define MAX_STRLEN_FOR_COLLATION_ELEMENT
bool intl_is_currency_symbol(const char *src, DB_CURRENCY *currency, int *symbol_size, const CURRENCY_CHECK_MODE check_mode)
XML_ELEMENT_DEF ldml_elem_currency
void xml_parser_exec(XML_PARSER_DATA *pd)
#define LANG_MAX_BUILTIN_COLLATIONS
XML_ELEMENT_DEF ldml_elem_collation_t
const char * timestamp_format
const char * day_parse_order
static int handle_data(void *data, const char *s, int len)
unsigned int intl_dbcs_to_cp(const unsigned char *seq, const int size, const unsigned char *byte_flag, unsigned char **next_char)
XML_ELEMENT_DEF ldml_elem_monthContext
UCA_L4_W uca_w_l4[MAX_UCA_EXP_CE]
unsigned int utf8_first_cp
XML_ELEMENT_DEF ldml_elem_collation_sc
XML_ELEMENT_DEF ldml_timeFormatCUBRID
static enum scanner_mode mode
static int start_collation_settings(void *data, const char **attr)
static int end_number_symbol(void *data, const char *el_name)
const char * day_short_parse_order
#define DUMPLOCALE_IS_IDENTIFIER_ALPHABET_UPPER
int * unicode_mapping_index
static int start_day(void *data, const char **attr)
const char * am_pm_parse_order
#define PRINT_DEBUG_START(d, a, m, s)
int locale_dump(void *data, LOCALE_FILE *lf, int dl_settings, int start_value, int end_value)
#define PRINT_DEBUG_END(d, m, s)
static void locale_alloc_collation_id(COLL_TAILORING *coll_tail)
int locale_get_cfg_locales(LOCALE_FILE **p_locale_files, int *p_num_locales, bool is_lang_init)
static LOC_SHARED_DATA * shared_data
static int start_collation_rule(void *data, const char **attr)
#define LOC_DATA_MONTH_WIDE_SIZE
static void print_debug_data_content(void *data, const char *msg, const int status)
static int end_month(void *data, const char *el_name)
void unicode_free_data(void)
CUBRID_TAILOR_RULE * cub_rules
unsigned int cp_first_contr_count
#define DUMPLOCALE_IS_ALPHABET
static void locale_destroy_alphabet_tailoring(const ALPHABET_TAILORING *cd)
XML_ELEMENT_DEF ldml_elem_collation_i
struct coll_contraction COLL_CONTRACTION
XML_ELEMENT_DEF ldml_elem_collation_reset_first_trailing
XML_ELEMENT_DEF ldml_elem_collation_rules
#define DUMPLOCALE_IS_NUMBERING
char coll_uca_w_l13_ref[LOC_LIB_SYMBOL_NAME_SIZE]
char am_pm[CAL_AM_PM_COUNT][LOC_DATA_AM_PM_SIZE]
unsigned int intl_utf8_to_cp(const unsigned char *utf8, const int size, unsigned char **next_char)
XML_ELEMENT_DEF ldml_elem_dateFormatCUBRID
struct uca_options UCA_OPTIONS
char timestamptzFormat[CAL_COMP_DATE_TZ_FORMAT_SIZE]
static int end_case_rule(void *data, const char *el_name)
XML_ELEMENT_DEF ldml_elem_collation_cubrid_rules_set_wr
static int start_include_collation(void *data, const char **attr)
CP_BUF_TYPE end_cp_buf_type
static int locale_save_one_alphabet_to_C_file(FILE *fp, ALPHABET_DATA *a, bool save_w_identier_name, const char *alpha_suffix)
static int start_lower_case_rule(void *data, const char **attr)
#define INTL_MAX_UNICODE_CP_ALLOWED
const char * day_name[CAL_DAY_COUNT]
int crypt_md5_buffer_hex(const char *buffer, size_t len, char *resblock)
char unicode_data_file[PATH_MAX]
int * cp_first_contr_array
char day_names_wide_parse_order[CAL_DAY_COUNT]
unsigned int utf8_last_cp
int unicode_process_alphabet(LOCALE_DATA *ld, bool is_verbose)
XML_ELEMENT_DEF ldml_elem_collation_reset_last_primary_ignorable
char anchor_buf[LOC_DATA_COLL_TWO_CHARS]
XML_ELEMENT_DEF ldml_elem_collation_ic
XML_ELEMENT_DEF ldml_elem_collation_cubrid_rules_set_sch
#define PRINT_DEBUG_DATA(d, m, s)
const char * month_parse_order
static int str_pop_token(char *str_p, char **token_p, char **next_p)
#define UNICODE_NORMALIZATION_DECORATOR
static char * cmp_token_name_array
void locale_init_data(LOCALE_DATA *ld, const char *locale_name)
#define PRINT_STRING_VAR_TO_C_FILE(fp, valname, val, d)
XML_ELEMENT_DEF ldml_elem_dayPeriodWidth
char c_buf[LOC_MAX_UCA_CHARS_SEQ *INTL_UTF8_MAX_CHAR_SIZE]
#define PRINT_UNNAMED_NUM_ARRAY_TO_C_FILE(fp, intf, tab, arrcount, val)
FILE * fopen_ex(const char *filename, const char *type)
int intl_text_dbcs_to_utf8_ext(void *t, const unsigned char *in_buf, const int in_size, unsigned char **out_buf, int *out_size)
UNICODE_NORMALIZATION unicode_norm
static int start_dayPeriod(void *data, const char **attr)
char day_names_wide[CAL_DAY_COUNT][LOC_DATA_DAY_WIDE_SIZE]
static int alloced_shared_data
#define LOC_CURRENT_COLL_TAIL(ld)
#define LOC_DATA_COLL_CUBRID_TAILOR_COUNT_GROW
static TRANSFORM_RULE * new_transform_rule(LOCALE_DATA *ld)
#define INTL_UTF8_MAX_CHAR_SIZE
int unicode_process_normalization(LOCALE_DATA *ld, bool is_verbose)
#define DUMPLOCALE_IS_TEXT_CONV
static void dump_collation_contr(COLL_DATA *coll, const COLL_CONTRACTION *contr, bool print_weight, bool print_contr)
static void print_debug_end_el(void *data, const char *msg, const int status)
XML_ELEMENT_DEF ldml_elem_currencies
static void error(const char *msg)
static int start_collation_cubrid_rule_set_wr(void *data, const char **attr)
static int dump_locale_alphabet(ALPHABET_DATA *ad, int dl_settings, int lower_bound, int upper_bound)
unsigned char byte_flag[256]
char day_names_abbr_parse_order[CAL_DAY_COUNT]
void locale_destroy_data(LOCALE_DATA *ld)
static int locale_alphabet_data_size(ALPHABET_DATA *a)
int intl_utf8_to_cp_list(const unsigned char *utf8, const int size, unsigned int *cp_array, const int max_array_size, int *array_count)
XML_ELEMENT_DEF ldml_elem_collation_pc
XML_ELEMENT_DEF ldml_elem_collation_x_extend
UNICODE_NORMALIZATION unicode_normalization
const char * ldml_ref_day_names[]
static int start_collation_cubrid_rule(void *data, const char **attr)
COLL_CONTRACTION * contr_list
XML_ELEMENT_DEF ldml_elem_dayPeriods
XML_ELEMENT_DEF ldml_elem_dayPeriod
XML_ELEMENT_DEF ldml_elem_collation_reset
#define snprintf_dots_truncate(dest, max_len,...)
static int locale_save_normalization_to_C_file(FILE *fp, LOCALE_DATA *ld)
XML_ELEMENT_DEF ldml_elem_collation_p
XML_ELEMENT_DEF ldml_elem_alphabet_lower_src
static void dump_collation_codepoint(COLL_DATA *coll, const unsigned int cp, bool print_weight, bool print_cp)
XML_ELEMENT_DEF ldml_elem_collations
static int start_collation_logical_pos(void *data, const char **attr)
char coll_weights_ref[LOC_LIB_SYMBOL_NAME_SIZE]
static int start_element_ok(void *data, const char **attr)
TEXT_CONVERSION * txt_conv
void locale_mark_duplicate_collations(LOCALE_DATA **ld, int start_index, int end_index, bool is_verbose)
XML_ELEMENT_DEF ldml_elem_unicodefile
static int locale_save_console_conv_to_C_file(FILE *fp, LOCALE_DATA *ld)
int intl_cp_to_dbcs(const unsigned int codepoint, const unsigned char *byte_flag, unsigned char *seq)
static void locale_destroy_collation_tailorings(const COLL_TAILORING *ct)
static void print_debug_start_el(void *data, const char **attrs, const char *msg, const int status)
int(* ELEM_DATA_FUNC)(void *, const char *, int)
char datetimetzFormat[CAL_COMP_DATE_TZ_FORMAT_SIZE]
XML_ELEMENT_DEF ldml_elem_dates
#define LOC_LOCALE_STR_SIZE
int(* ELEM_END_FUNC)(void *, const char *)
#define BUF_ALIGN(buf, align)
#define CP_HAS_MAPPINGS(val)
char step[MAX_STRLEN_FOR_COLLATION_ELEMENT]
char day_names_abbreviated[CAL_DAY_COUNT][LOC_DATA_DAY_ABBR_SIZE]
static int dump_console_conversion(TEXT_CONVERSION *tc)
void xml_destroy_parser_data(void *data)
char start_weight[MAX_STRLEN_FOR_COLLATION_ELEMENT]
#define LOC_DATA_TAILOR_RULES_COUNT_GROW
void xml_destroy_parser(void *data)
int unicode_mappings_count
DB_CURRENCY default_currency_code
static void locale_destroy_console_conversion(const TEXT_CONVERSION *tc)
int xml_check_att_value(const char **attrs, const char *att_name, const char *att_value)
TEXT_CONVERSION_PRM txt_conv_prm
XML_ELEMENT_DEF ldml_elem_ldml
#define PRINT_VAR_TO_C_FILE(fp, type, valname, val, format, d)
char * intl_get_money_ISO_symbol(const DB_CURRENCY currency)
XML_ELEMENT_DEF ldml_elem_collation_reset_last_secondary_ignorable
char * envvar_codepagedir_file(char *path, size_t size, const char *filename)
static int comp_func_coll_uca_exp_fo(const void *arg1, const void *arg2)
LDML_CONTEXT ldml_context
const char * datetimetz_format
XML_ELEMENT_DEF ldml_elem_include_collation
char * envvar_loclib_dir_file(char *path, size_t size, const char *filename)
char month_names_abbreviated[CAL_MONTH_COUNT][LOC_DATA_MONTH_ABBR_SIZE]
XML_ELEMENT_DEF * ldml_elements[]
char * msgcat_message(int cat_id, int set_id, int msg_id)
char dateFormat[CAL_SIMPLE_DATE_FORMAT_SIZE]
#define PRINT_NUM_ARRAY_TO_C_FILE(fp, vname, vtype, intf, arrcount, val, d)
#define LOG_LOCALE_ERROR(msg, er_status, do_print)
XML_ELEMENT_DEF ldml_elem_alphabet_upper_src
#define XML_CUB_ERR_PARSER_INIT_FAIL
static int start_collations(void *data, const char **attr)
static int end_collation_x_context(void *data, const char *el_name)
#define DUMPLOCALE_IS_IDENTIFIER_ALPHABET
unsigned short int UCA_L4_W
char * strdup(const char *str)
#define GET_MAPPING_OFFSET(val)
static int start_calendar_name_context(void *data, const char **attr)
char coll_contr_list_ref[LOC_LIB_SYMBOL_NAME_SIZE]
XML_ELEMENT_DEF ldml_timestamptzFormatCUBRID
XML_ELEMENT_DEF ldml_elem_symbol_decimal
static LOCALE_COLLATION * new_locale_collation(LOCALE_DATA *ld)
static int comp_func_parse_order_index(const void *arg1, const void *arg2)
LDML_CONTEXT ldml_context
char coll_name[COLL_NAME_SIZE]
char timeFormat[CAL_SIMPLE_DATE_FORMAT_SIZE]
#define DUMPLOCALE_IS_COLLATION_CP_ORDER
const char * ldml_ref_am_pm_names[]
XML_ELEMENT_DEF ldml_elem_collation_reset_first_variable
XML_ELEMENT_DEF ldml_elem_symbol_group
void locale_destroy_normalization_data(UNICODE_NORMALIZATION *norm)
#define LOC_DATA_DAY_WIDE_SIZE
#define NORM_MAPPING_DUMP_MODE_FULL
XML_ELEMENT_DEF ldml_datetimeFormatCUBRID
int xml_get_att_value(const char **attrs, const char *att_name, char **p_att_value)
char lsd_key[COLL_NAME_SIZE]
int lang_load_count_coll_from_lib(int *count_coll, void *lib_handle, const LOCALE_FILE *lf)
unsigned int text_last_cp
XML_ELEMENT_DEF ldml_elem_month
static int load_console_conv_data(LOCALE_DATA *ld, bool is_verbose)
XML_ELEMENT_DEF ldml_elem_collation_x_i
XML_ELEMENT_DEF ldml_elem_alphabets
int locale_prepare_C_file(void)
ALPHABET_TAILORING alpha_tailoring
char coll_name[COLL_NAME_SIZE]
#define XML_CUB_ERR_INCLUDE_LOOP
XML_ELEMENT_DEF ldml_elem_collation_reset_last_tertiary_ignorable
XML_ELEMENT_DEF ldml_elem_collation_x_context
XML_ELEMENT_DEF ldml_elem_collation_tc
char datetimeFormat[CAL_COMP_DATE_FORMAT_SIZE]
XML_ELEMENT_DEF ldml_elem_numbers_symbols
XML_ELEMENT_DEF ldml_elem_monthWidth
XML_ELEMENT_DEF ldml_elem_collation_cubrid_rules
DB_CURRENCY default_currency_code
char data_buffer[LOC_DATA_BUFF_SIZE]
#define INTL_GET_NEXT_CONTR_ID(v)
#define DLL_EXPORT_PREFIX
static int comp_func_coll_uca_simple_weights_fo(const void *arg1, const void *arg2)
static int end_timeFormatCUBRID(void *data, const char *el_name)
static void dump_locale_normalization(UNICODE_NORMALIZATION *norm)
bool lang_is_coll_name_allowed(const char *name)
#define LOC_DATA_BUFF_SIZE
char * envvar_ldmldir_file(char *path, size_t size, const char *filename)
XML_ELEMENT_DEF ldml_elem_collation_reset_first_primary_ignorable
int locale_check_and_set_default_files(LOCALE_FILE *lf, bool is_lang_init)
#define LOC_DATA_COLL_TWO_CHARS
char coll_uca_num_ref[LOC_LIB_SYMBOL_NAME_SIZE]
static COLL_DATA * dump_coll_data
XML_ELEMENT_DEF ldml_elem_collation_cubrid_rules_set
static int end_collation_x_extend(void *data, const char *el_name)
static void dump_unicode_mapping(UNICODE_MAPPING *um, const int mode)
static int comp_func_coll_uca_exp(const void *arg1, const void *arg2)
static int end_transform_buffer(void *data, const char *el_name)
static int end_collation_rule(void *data, const char *el_name)
static int dump_locale_collation(COLL_DATA *coll, int dl_settings, int start_value, int end_value)
XML_ELEMENT_DEF ldml_elem_collation_x
static int common_collation_start_rule(void *data, const char **attr, LOCALE_DATA *ld, TAILOR_RULE *t_rule)
unsigned int cp_first_contr_offset
static int start_month_day_Width(void *data, const char **attr)
#define DUMPLOCALE_IS_ALPHABET_LOWER
char * envvar_confdir_file(char *path, size_t size, const char *filename)
#define LOC_DATA_CURRENCY_ISO_CODE_LEN
#define INTL_IDENTIFIER_CASING_SIZE_MULTIPLIER
char locale_name[LOC_LOCALE_STR_SIZE]
int intl_text_single_byte_to_utf8_ext(void *t, const unsigned char *in_buf, const int in_size, unsigned char **out_buf, int *out_size)
const char * day_short_name[CAL_DAY_COUNT]
XML_ELEMENT_DEF ldml_elem_collation_reset_last_variable
static int count_shared_data
int lang_load_get_coll_name_from_lib(const int coll_pos, char **coll_name, void *lib_handle, const LOCALE_FILE *lf)
#define DUMPLOCALE_IS_ALPHABET_UPPER
#define MSGCAT_CATALOG_UTILS