* locale.cc (print_lc_mstrings): New function to print
semicolon-separated strings. (enum type_t): New type is_sepstrings_linf. (lc_time_names): Change type of era and alt_digits entry to is_sepstrings_linf. (print_lc): Add case for is_sepstrings_linf and call print_lc_mstrings in that case.
This commit is contained in:
parent
1929fc8ece
commit
f13fe16475
@ -1,3 +1,13 @@
|
||||
2010-02-19 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* locale.cc (print_lc_mstrings): New function to print
|
||||
semicolon-separated strings.
|
||||
(enum type_t): New type is_sepstrings_linf.
|
||||
(lc_time_names): Change type of era and alt_digits entry to
|
||||
is_sepstrings_linf.
|
||||
(print_lc): Add case for is_sepstrings_linf and call print_lc_mstrings
|
||||
in that case.
|
||||
|
||||
2010-02-17 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* Makefile.in (CYGWIN_BINS): Rename getlocale to locale.
|
||||
|
@ -317,6 +317,36 @@ print_lc_svalue (int key, const char *name, const char *value)
|
||||
fputc ('\n', stdout);
|
||||
}
|
||||
|
||||
void
|
||||
print_lc_sepstrings (int key, const char *name, const char *value)
|
||||
{
|
||||
char *c;
|
||||
|
||||
if (key)
|
||||
printf ("%s=", name);
|
||||
while (value && *value)
|
||||
{
|
||||
if (key)
|
||||
fputc ('"', stdout);
|
||||
c = strchr (value, ';');
|
||||
if (!c)
|
||||
{
|
||||
fputs (value, stdout);
|
||||
value = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("%.*s", c - value, value);
|
||||
value = c + 1;
|
||||
}
|
||||
if (key)
|
||||
fputc ('"', stdout);
|
||||
if (value && *value)
|
||||
fputc (';', stdout);
|
||||
}
|
||||
fputc ('\n', stdout);
|
||||
}
|
||||
|
||||
void
|
||||
print_lc_strings (int key, const char *name, int from, int to)
|
||||
{
|
||||
@ -360,6 +390,7 @@ enum type_t
|
||||
is_grouping_lconv,
|
||||
is_string_linf,
|
||||
is_mstrings_linf,
|
||||
is_sepstrings_linf,
|
||||
is_mb_cur_max,
|
||||
is_codeset,
|
||||
is_end
|
||||
@ -413,9 +444,9 @@ lc_names_t lc_time_names[] =
|
||||
{ "d_fmt", is_string_linf, D_FMT, 0 },
|
||||
{ "t_fmt", is_string_linf, T_FMT, 0 },
|
||||
{ "t_fmt_ampm", is_string_linf, T_FMT_AMPM, 0 },
|
||||
{ "era", is_string_linf, ERA, 0 },
|
||||
{ "era", is_sepstrings_linf,ERA, 0 },
|
||||
{ "era_d_fmt", is_string_linf, ERA_D_FMT, 0 },
|
||||
{ "alt_digits", is_string_linf, ALT_DIGITS, 0 },
|
||||
{ "alt_digits", is_sepstrings_linf,ALT_DIGITS, 0 },
|
||||
{ "era_d_t_fmt", is_string_linf, ERA_D_T_FMT, 0 },
|
||||
{ "era_t_fmt", is_string_linf, ERA_T_FMT, 0 },
|
||||
{ "time-codeset", is_codeset, LC_TIME, 0 },
|
||||
@ -492,6 +523,9 @@ print_lc (int cat, int key, const char *category, const char *name,
|
||||
case is_string_linf:
|
||||
print_lc_svalue (key, lc->name, nl_langinfo (lc->fromval));
|
||||
break;
|
||||
case is_sepstrings_linf:
|
||||
print_lc_sepstrings (key, lc->name, nl_langinfo (lc->fromval));
|
||||
break;
|
||||
case is_mstrings_linf:
|
||||
print_lc_strings (key, lc->name, lc->fromval, lc->toval);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user