From patchwork Wed Jun 28 10:07:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafal Luzynski X-Patchwork-Id: 21312 Received: (qmail 125626 invoked by alias); 28 Jun 2017 10:07:27 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 125269 invoked by uid 89); 28 Jun 2017 10:07:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY autolearn=ham version=3.3.2 spammy= X-HELO: aev204.rev.netart.pl X-Spam-Score: 0 Date: Wed, 28 Jun 2017 12:07:20 +0200 (CEST) From: Rafal Luzynski Reply-To: Rafal Luzynski To: libc-alpha@sourceware.org Message-ID: <802187586.499480.1498644440085@poczta.nazwa.pl> Subject: [RFC][PATCH v8 09/16] Abbreviated alternative month names (%Ob) also added (bug 10871). MIME-Version: 1.0 X-Originating-Client: com.openexchange.ox.gui.dhtml All the previous changes (except the backward compatibility) also repeated to support abbreviated alternative month names. In most languages which have declension and need nominative/genitive month names the abbreviated forms for both cases are the same. An example where they do differ is May in Russian: this name is too short to be abbreviated so even the abbreviated form feature the declension suffixes. [BZ #10871] * locale/C-time.c: define all abbreviated alternative month names as empty strings. * locale/categories.def: ab_alt_mon and wide-ab_alt_mon added. * locale/langinfo.h: _NL_[W]ABALTMON_1 .. _NL_[W]ABALTMON_12 defined. * locale/programs/ld-time.c: abbreviated alternative month names support added, they are a copy of abmon if not provided explicitly. * locale/programs/locfile-kw.gperf: ab_alt_mon defined. * locale/programs/locfile-kw.h: regenerated for ab_alt_mon. * locale/programs/locfile-token.h: ab_alt_mon defined. * time/strftime_l.c: %Ob (%Oh) format for abbreviated alternative month names added. * time/strptime_l.c: abbreviated alternative month names also recognized. --- locale/C-time.c | 26 +++++++++- locale/categories.def | 6 ++- locale/langinfo.h | 31 +++++++++++ locale/programs/ld-time.c | 19 +++++++ locale/programs/locfile-kw.gperf | 1 + locale/programs/locfile-kw.h | 108 ++++++++++++++++++++------------------- locale/programs/locfile-token.h | 1 + time/strftime_l.c | 14 ++++- time/strptime_l.c | 18 +++++++ 9 files changed, 166 insertions(+), 58 deletions(-) # define HERE_AM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (AM_STR)].string) @@ -418,6 +420,18 @@ __strptime_internal (const char *rp, const char *fmt, struct tm *tmp, decided_longest = loc; } trp = rp; + if (match_string (_NL_CURRENT (LC_TIME, _NL_ABALTMON_1 + cnt), + trp) + && trp > rp_longest) + { + rp_longest = trp; + cnt_longest = cnt; + if (s.decided == not + && strcmp (_NL_CURRENT (LC_TIME, _NL_ABALTMON_1 + cnt), + alt_month_name[cnt])) + decided_longest = loc; + } + trp = rp; #endif if (match_string (_NL_CURRENT (LC_TIME, MON_1 + cnt), trp) && trp > rp_longest) @@ -448,6 +462,8 @@ __strptime_internal (const char *rp, const char *fmt, struct tm *tmp, #ifdef _LIBC || ((trp = rp, match_string (alt_month_name[cnt], trp)) && trp > rp_longest) + || ((trp = rp, match_string (ab_alt_month_name[cnt], trp)) + && trp > rp_longest) #endif || ((trp = rp, match_string (ab_month_name[cnt], trp)) && trp > rp_longest))) @@ -1036,7 +1052,9 @@ __strptime_internal (const char *rp, const char *fmt, struct tm *tmp, case 'O': switch (*fmt++) { + case 'b': case 'B': + case 'h': /* Undo the increment and continue. */ fmt--; break; diff --git a/locale/C-time.c b/locale/C-time.c index 5b1e6cf..c84be2c 100644 --- a/locale/C-time.c +++ b/locale/C-time.c @@ -30,7 +30,7 @@ const struct __locale_data _nl_C_LC_TIME attribute_hidden = { NULL, }, /* no cached data */ UNDELETABLE, 0, - 135, + 159, { { .string = "Sun" }, { .string = "Mon" }, @@ -166,6 +166,30 @@ const struct __locale_data _nl_C_LC_TIME attribute_hidden = { .wstr = (const uint32_t *) L"" }, { .wstr = (const uint32_t *) L"" }, { .wstr = (const uint32_t *) L"" }, + { .wstr = (const uint32_t *) L"" }, + { .string = "" }, + { .string = "" }, + { .string = "" }, + { .string = "" }, + { .string = "" }, + { .string = "" }, + { .string = "" }, + { .string = "" }, + { .string = "" }, + { .string = "" }, + { .string = "" }, + { .string = "" }, + { .wstr = (const uint32_t *) L"" }, + { .wstr = (const uint32_t *) L"" }, + { .wstr = (const uint32_t *) L"" }, + { .wstr = (const uint32_t *) L"" }, + { .wstr = (const uint32_t *) L"" }, + { .wstr = (const uint32_t *) L"" }, + { .wstr = (const uint32_t *) L"" }, + { .wstr = (const uint32_t *) L"" }, + { .wstr = (const uint32_t *) L"" }, + { .wstr = (const uint32_t *) L"" }, + { .wstr = (const uint32_t *) L"" }, { .wstr = (const uint32_t *) L"" } } }; diff --git a/locale/categories.def b/locale/categories.def index 53ec8c5..07b19b2 100644 --- a/locale/categories.def +++ b/locale/categories.def @@ -249,8 +249,10 @@ DEFINE_CATEGORY DEFINE_ELEMENT (_DATE_FMT, "date_fmt", opt, string) DEFINE_ELEMENT (_NL_W_DATE_FMT, "wide-date_fmt", opt, wstring) DEFINE_ELEMENT (_NL_TIME_CODESET, "time-codeset", std, string) - DEFINE_ELEMENT (ALTMON_1, "alt_mon", opt, stringarray, 12, 12) - DEFINE_ELEMENT (_NL_WALTMON_1, "wide-alt_mon", opt, wstringarray, 12, 12) + DEFINE_ELEMENT (ALTMON_1, "alt_mon", opt, stringarray, 12, 12) + DEFINE_ELEMENT (_NL_WALTMON_1, "wide-alt_mon", opt, wstringarray, 12, 12) + DEFINE_ELEMENT (_NL_ABALTMON_1, "ab_alt_mon", opt, stringarray, 12, 12) + DEFINE_ELEMENT (_NL_WABALTMON_1, "wide-ab_alt_mon", opt, wstringarray, 12, 12) ), NO_POSTLOAD) diff --git a/locale/langinfo.h b/locale/langinfo.h index f24e225..7ae3cac 100644 --- a/locale/langinfo.h +++ b/locale/langinfo.h @@ -283,6 +283,37 @@ enum _NL_WALTMON_11, _NL_WALTMON_12, + /* Abbreviated alternative month names. */ + /* In most languages which need alternative month names the abbreviated + regular and the abbreviated alternative month names are identical. + An example where they differ is May in Russian. */ + _NL_ABALTMON_1, /* Jan */ + _NL_ABALTMON_2, + _NL_ABALTMON_3, + _NL_ABALTMON_4, + _NL_ABALTMON_5, + _NL_ABALTMON_6, + _NL_ABALTMON_7, + _NL_ABALTMON_8, + _NL_ABALTMON_9, + _NL_ABALTMON_10, + _NL_ABALTMON_11, + _NL_ABALTMON_12, + + /* Abbreviated alternative month names. */ + _NL_WABALTMON_1, /* Jan */ + _NL_WABALTMON_2, + _NL_WABALTMON_3, + _NL_WABALTMON_4, + _NL_WABALTMON_5, + _NL_WABALTMON_6, + _NL_WABALTMON_7, + _NL_WABALTMON_8, + _NL_WABALTMON_9, + _NL_WABALTMON_10, + _NL_WABALTMON_11, + _NL_WABALTMON_12, + _NL_NUM_LC_TIME, /* Number of indices in LC_TIME category. */ /* LC_COLLATE category: text sorting. diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c index a6bf2b1..fe5c613 100644 --- a/locale/programs/ld-time.c +++ b/locale/programs/ld-time.c @@ -94,6 +94,9 @@ struct locale_time_t const char *alt_mon[12]; const uint32_t *walt_mon[12]; int alt_mon_defined; + const char *ab_alt_mon[12]; + const uint32_t *wab_alt_mon[12]; + int ab_alt_mon_defined; unsigned char week_ndays; uint32_t week_1stday; unsigned char week_1stweek; @@ -664,6 +667,14 @@ time_output (struct localedef_t *locale, const struct charmap_t *charmap, for (n = 0; n < 12; ++n) add_locale_wstring (&file, time->walt_mon[n] ?: empty_wstr); + /* The ab'alt'mons. */ + for (n = 0; n < 12; ++n) + add_locale_string (&file, time->ab_alt_mon[n] ?: ""); + + /* The wide character ab'alt'mons. */ + for (n = 0; n < 12; ++n) + add_locale_wstring (&file, time->wab_alt_mon[n] ?: empty_wstr); + write_locale_data (output_path, LC_TIME, "LC_TIME", &file); } @@ -808,6 +819,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result, STRARR_ELEM (am_pm, 2, 2); STRARR_ELEM (alt_digits, 0, 100); STRARR_ELEM (alt_mon, 12, 12); + STRARR_ELEM (ab_alt_mon, 12, 12); case tok_era: /* Ignore the rest of the line if we don't need the input of @@ -968,6 +980,13 @@ time_read (struct linereader *ldfile, struct localedef_t *result, memcpy (time->walt_mon, time->wmon, sizeof (time->wmon)); time->alt_mon_defined = 1; } + /* The same for abbreviated versions. */ + if (!ignore_content && !time->ab_alt_mon_defined) + { + memcpy (time->ab_alt_mon, time->abmon, sizeof (time->abmon)); + memcpy (time->wab_alt_mon, time->wabmon, sizeof (time->wabmon)); + time->ab_alt_mon_defined = 1; + } return; default: diff --git a/locale/programs/locfile-kw.gperf b/locale/programs/locfile-kw.gperf index 3d11cc6..cae0ad8 100644 --- a/locale/programs/locfile-kw.gperf +++ b/locale/programs/locfile-kw.gperf @@ -149,6 +149,7 @@ cal_direction, tok_cal_direction, 0 timezone, tok_timezone, 0 date_fmt, tok_date_fmt, 0 alt_mon, tok_alt_mon, 0 +ab_alt_mon, tok_ab_alt_mon, 0 LC_MESSAGES, tok_lc_messages, 0 yesexpr, tok_yesexpr, 0 noexpr, tok_noexpr, 0 diff --git a/locale/programs/locfile-kw.h b/locale/programs/locfile-kw.h index 1507a07..450a921 100644 --- a/locale/programs/locfile-kw.h +++ b/locale/programs/locfile-kw.h @@ -54,7 +54,7 @@ #line 24 "locfile-kw.gperf" struct keyword_t ; -#define TOTAL_KEYWORDS 177 +#define TOTAL_KEYWORDS 178 #define MIN_WORD_LENGTH 3 #define MAX_WORD_LENGTH 22 #define MIN_HASH_VALUE 3 @@ -147,22 +147,22 @@ locfile_hash (register const char *str, register unsigned int len) #line 30 "locfile-kw.gperf" {"LC_CTYPE", tok_lc_ctype, 0}, {""}, -#line 167 "locfile-kw.gperf" +#line 168 "locfile-kw.gperf" {"LC_ADDRESS", tok_lc_address, 0}, -#line 152 "locfile-kw.gperf" +#line 153 "locfile-kw.gperf" {"LC_MESSAGES", tok_lc_messages, 0}, -#line 160 "locfile-kw.gperf" +#line 161 "locfile-kw.gperf" {"LC_NAME", tok_lc_name, 0}, -#line 157 "locfile-kw.gperf" +#line 158 "locfile-kw.gperf" {"LC_PAPER", tok_lc_paper, 0}, -#line 185 "locfile-kw.gperf" +#line 186 "locfile-kw.gperf" {"LC_MEASUREMENT", tok_lc_measurement, 0}, #line 56 "locfile-kw.gperf" {"LC_COLLATE", tok_lc_collate, 0}, {""}, -#line 187 "locfile-kw.gperf" +#line 188 "locfile-kw.gperf" {"LC_IDENTIFICATION", tok_lc_identification, 0}, -#line 200 "locfile-kw.gperf" +#line 201 "locfile-kw.gperf" {"revision", tok_revision, 0}, #line 69 "locfile-kw.gperf" {"UNDEFINED", tok_undefined, 0}, @@ -170,19 +170,19 @@ locfile_hash (register const char *str, register unsigned int len) {"LC_NUMERIC", tok_lc_numeric, 0}, #line 82 "locfile-kw.gperf" {"LC_MONETARY", tok_lc_monetary, 0}, -#line 180 "locfile-kw.gperf" +#line 181 "locfile-kw.gperf" {"LC_TELEPHONE", tok_lc_telephone, 0}, {""}, {""}, {""}, #line 75 "locfile-kw.gperf" {"define", tok_define, 0}, -#line 153 "locfile-kw.gperf" +#line 154 "locfile-kw.gperf" {"yesexpr", tok_yesexpr, 0}, #line 141 "locfile-kw.gperf" {"era_year", tok_era_year, 0}, {""}, #line 54 "locfile-kw.gperf" {"translit_ignore", tok_translit_ignore, 0}, -#line 155 "locfile-kw.gperf" +#line 156 "locfile-kw.gperf" {"yesstr", tok_yesstr, 0}, {""}, #line 89 "locfile-kw.gperf" @@ -190,7 +190,7 @@ locfile_hash (register const char *str, register unsigned int len) {""}, #line 137 "locfile-kw.gperf" {"t_fmt", tok_t_fmt, 0}, -#line 158 "locfile-kw.gperf" +#line 159 "locfile-kw.gperf" {"height", tok_height, 0}, {""}, {""}, #line 52 "locfile-kw.gperf" @@ -213,7 +213,7 @@ locfile_hash (register const char *str, register unsigned int len) {""}, #line 142 "locfile-kw.gperf" {"era_d_fmt", tok_era_d_fmt, 0}, -#line 188 "locfile-kw.gperf" +#line 189 "locfile-kw.gperf" {"title", tok_title, 0}, {""}, {""}, #line 149 "locfile-kw.gperf" @@ -243,7 +243,7 @@ locfile_hash (register const char *str, register unsigned int len) {"duo_n_cs_precedes", tok_duo_n_cs_precedes, 0}, #line 127 "locfile-kw.gperf" {"thousands_sep", tok_thousands_sep, 0}, -#line 196 "locfile-kw.gperf" +#line 197 "locfile-kw.gperf" {"territory", tok_territory, 0}, #line 36 "locfile-kw.gperf" {"digit", tok_digit, 0}, @@ -258,7 +258,7 @@ locfile_hash (register const char *str, register unsigned int len) {""}, #line 78 "locfile-kw.gperf" {"else", tok_else, 0}, -#line 183 "locfile-kw.gperf" +#line 184 "locfile-kw.gperf" {"int_select", tok_int_select, 0}, {""}, {""}, {""}, #line 132 "locfile-kw.gperf" @@ -266,11 +266,11 @@ locfile_hash (register const char *str, register unsigned int len) #line 33 "locfile-kw.gperf" {"upper", tok_upper, 0}, {""}, {""}, -#line 193 "locfile-kw.gperf" +#line 194 "locfile-kw.gperf" {"tel", tok_tel, 0}, #line 93 "locfile-kw.gperf" {"p_sep_by_space", tok_p_sep_by_space, 0}, -#line 159 "locfile-kw.gperf" +#line 160 "locfile-kw.gperf" {"width", tok_width, 0}, {""}, #line 98 "locfile-kw.gperf" @@ -301,7 +301,7 @@ locfile_hash (register const char *str, register unsigned int len) {""}, {""}, {""}, {""}, {""}, #line 58 "locfile-kw.gperf" {"section-symbol", tok_section_symbol, 0}, -#line 184 "locfile-kw.gperf" +#line 185 "locfile-kw.gperf" {"int_prefix", tok_int_prefix, 0}, {""}, {""}, {""}, {""}, #line 42 "locfile-kw.gperf" @@ -318,7 +318,7 @@ locfile_hash (register const char *str, register unsigned int len) {"duo_p_sep_by_space", tok_duo_p_sep_by_space, 0}, #line 118 "locfile-kw.gperf" {"duo_int_p_sign_posn", tok_duo_int_p_sign_posn, 0}, -#line 156 "locfile-kw.gperf" +#line 157 "locfile-kw.gperf" {"nostr", tok_nostr, 0}, {""}, {""}, #line 140 "locfile-kw.gperf" @@ -327,26 +327,26 @@ locfile_hash (register const char *str, register unsigned int len) #line 84 "locfile-kw.gperf" {"currency_symbol", tok_currency_symbol, 0}, {""}, -#line 166 "locfile-kw.gperf" +#line 167 "locfile-kw.gperf" {"name_ms", tok_name_ms, 0}, -#line 164 "locfile-kw.gperf" - {"name_mrs", tok_name_mrs, 0}, #line 165 "locfile-kw.gperf" + {"name_mrs", tok_name_mrs, 0}, +#line 166 "locfile-kw.gperf" {"name_miss", tok_name_miss, 0}, #line 83 "locfile-kw.gperf" {"int_curr_symbol", tok_int_curr_symbol, 0}, -#line 189 "locfile-kw.gperf" +#line 190 "locfile-kw.gperf" {"source", tok_source, 0}, -#line 163 "locfile-kw.gperf" +#line 164 "locfile-kw.gperf" {"name_mr", tok_name_mr, 0}, -#line 162 "locfile-kw.gperf" +#line 163 "locfile-kw.gperf" {"name_gen", tok_name_gen, 0}, -#line 201 "locfile-kw.gperf" +#line 202 "locfile-kw.gperf" {"date", tok_date, 0}, {""}, {""}, -#line 190 "locfile-kw.gperf" +#line 191 "locfile-kw.gperf" {"address", tok_address, 0}, -#line 161 "locfile-kw.gperf" +#line 162 "locfile-kw.gperf" {"name_fmt", tok_name_fmt, 0}, #line 32 "locfile-kw.gperf" {"copy", tok_copy, 0}, @@ -365,16 +365,16 @@ locfile_hash (register const char *str, register unsigned int len) #line 117 "locfile-kw.gperf" {"duo_n_sign_posn", tok_duo_n_sign_posn, 0}, {""}, -#line 169 "locfile-kw.gperf" +#line 170 "locfile-kw.gperf" {"country_name", tok_country_name, 0}, #line 71 "locfile-kw.gperf" {"reorder-after", tok_reorder_after, 0}, {""}, {""}, -#line 154 "locfile-kw.gperf" +#line 155 "locfile-kw.gperf" {"noexpr", tok_noexpr, 0}, #line 50 "locfile-kw.gperf" {"tolower", tok_tolower, 0}, -#line 197 "locfile-kw.gperf" +#line 198 "locfile-kw.gperf" {"audience", tok_audience, 0}, {""}, {""}, {""}, #line 49 "locfile-kw.gperf" @@ -395,7 +395,7 @@ locfile_hash (register const char *str, register unsigned int len) {""}, #line 102 "locfile-kw.gperf" {"int_p_sign_posn", tok_int_p_sign_posn, 0}, -#line 174 "locfile-kw.gperf" +#line 175 "locfile-kw.gperf" {"country_car", tok_country_car, 0}, {""}, {""}, #line 104 "locfile-kw.gperf" @@ -406,9 +406,9 @@ locfile_hash (register const char *str, register unsigned int len) {""}, {""}, #line 116 "locfile-kw.gperf" {"duo_p_sign_posn", tok_duo_p_sign_posn, 0}, -#line 186 "locfile-kw.gperf" +#line 187 "locfile-kw.gperf" {"measurement", tok_measurement, 0}, -#line 175 "locfile-kw.gperf" +#line 176 "locfile-kw.gperf" {"country_isbn", tok_country_isbn, 0}, #line 37 "locfile-kw.gperf" {"outdigit", tok_outdigit, 0}, @@ -418,9 +418,9 @@ locfile_hash (register const char *str, register unsigned int len) {""}, {""}, {""}, #line 34 "locfile-kw.gperf" {"lower", tok_lower, 0}, -#line 182 "locfile-kw.gperf" +#line 183 "locfile-kw.gperf" {"tel_dom_fmt", tok_tel_dom_fmt, 0}, -#line 170 "locfile-kw.gperf" +#line 171 "locfile-kw.gperf" {"country_post", tok_country_post, 0}, #line 148 "locfile-kw.gperf" {"cal_direction", tok_cal_direction, 0}, @@ -430,7 +430,7 @@ locfile_hash (register const char *str, register unsigned int len) #line 91 "locfile-kw.gperf" {"frac_digits", tok_frac_digits, 0}, {""}, {""}, -#line 176 "locfile-kw.gperf" +#line 177 "locfile-kw.gperf" {"lang_name", tok_lang_name, 0}, #line 90 "locfile-kw.gperf" {"int_frac_digits", tok_int_frac_digits, 0}, @@ -445,7 +445,7 @@ locfile_hash (register const char *str, register unsigned int len) {""}, {""}, {""}, {""}, #line 107 "locfile-kw.gperf" {"duo_frac_digits", tok_duo_frac_digits, 0}, -#line 181 "locfile-kw.gperf" +#line 182 "locfile-kw.gperf" {"tel_int_fmt", tok_tel_int_fmt, 0}, #line 123 "locfile-kw.gperf" {"duo_valid_to", tok_duo_valid_to, 0}, @@ -455,7 +455,7 @@ locfile_hash (register const char *str, register unsigned int len) #line 130 "locfile-kw.gperf" {"abday", tok_abday, 0}, {""}, -#line 199 "locfile-kw.gperf" +#line 200 "locfile-kw.gperf" {"abbreviation", tok_abbreviation, 0}, #line 147 "locfile-kw.gperf" {"first_workday", tok_first_workday, 0}, @@ -472,12 +472,12 @@ locfile_hash (register const char *str, register unsigned int len) #line 45 "locfile-kw.gperf" {"blank", tok_blank, 0}, {""}, {""}, -#line 195 "locfile-kw.gperf" +#line 196 "locfile-kw.gperf" {"language", tok_language, 0}, #line 120 "locfile-kw.gperf" {"uno_valid_from", tok_uno_valid_from, 0}, {""}, -#line 198 "locfile-kw.gperf" +#line 199 "locfile-kw.gperf" {"application", tok_application, 0}, {""}, #line 80 "locfile-kw.gperf" @@ -498,7 +498,7 @@ locfile_hash (register const char *str, register unsigned int len) #line 96 "locfile-kw.gperf" {"p_sign_posn", tok_p_sign_posn, 0}, {""}, -#line 202 "locfile-kw.gperf" +#line 203 "locfile-kw.gperf" {"category", tok_category, 0}, {""}, {""}, {""}, {""}, #line 134 "locfile-kw.gperf" @@ -510,29 +510,29 @@ locfile_hash (register const char *str, register unsigned int len) #line 63 "locfile-kw.gperf" {"order_start", tok_order_start, 0}, {""}, {""}, {""}, {""}, {""}, -#line 177 "locfile-kw.gperf" +#line 178 "locfile-kw.gperf" {"lang_ab", tok_lang_ab, 0}, -#line 179 "locfile-kw.gperf" +#line 180 "locfile-kw.gperf" {"lang_lib", tok_lang_lib, 0}, {""}, {""}, {""}, -#line 191 "locfile-kw.gperf" +#line 192 "locfile-kw.gperf" {"contact", tok_contact, 0}, {""}, {""}, {""}, -#line 172 "locfile-kw.gperf" +#line 173 "locfile-kw.gperf" {"country_ab3", tok_country_ab3, 0}, {""}, {""}, {""}, -#line 192 "locfile-kw.gperf" +#line 193 "locfile-kw.gperf" {"email", tok_email, 0}, -#line 171 "locfile-kw.gperf" +#line 172 "locfile-kw.gperf" {"country_ab2", tok_country_ab2, 0}, {""}, {""}, {""}, #line 55 "locfile-kw.gperf" {"default_missing", tok_default_missing, 0}, {""}, {""}, -#line 194 "locfile-kw.gperf" +#line 195 "locfile-kw.gperf" {"fax", tok_fax, 0}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 173 "locfile-kw.gperf" +#line 174 "locfile-kw.gperf" {"country_num", tok_country_num, 0}, {""}, {""}, {""}, {""}, {""}, {""}, #line 51 "locfile-kw.gperf" @@ -560,7 +560,9 @@ locfile_hash (register const char *str, register unsigned int len) #line 59 "locfile-kw.gperf" {"collating-element", tok_collating_element, 0}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 152 "locfile-kw.gperf" + {"ab_alt_mon", tok_ab_alt_mon, 0}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, @@ -571,7 +573,7 @@ locfile_hash (register const char *str, register unsigned int len) #line 85 "locfile-kw.gperf" {"mon_decimal_point", tok_mon_decimal_point, 0}, {""}, {""}, -#line 168 "locfile-kw.gperf" +#line 169 "locfile-kw.gperf" {"postal_fmt", tok_postal_fmt, 0}, {""}, {""}, {""}, {""}, {""}, #line 60 "locfile-kw.gperf" @@ -590,7 +592,7 @@ locfile_hash (register const char *str, register unsigned int len) #line 87 "locfile-kw.gperf" {"mon_grouping", tok_mon_grouping, 0}, {""}, -#line 178 "locfile-kw.gperf" +#line 179 "locfile-kw.gperf" {"lang_term", tok_lang_term, 0}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, diff --git a/locale/programs/locfile-token.h b/locale/programs/locfile-token.h index 2a313b2..6631796 100644 --- a/locale/programs/locfile-token.h +++ b/locale/programs/locfile-token.h @@ -187,6 +187,7 @@ enum token_t tok_timezone, tok_date_fmt, tok_alt_mon, + tok_ab_alt_mon, tok_lc_messages, tok_yesexpr, tok_noexpr, diff --git a/time/strftime_l.c b/time/strftime_l.c index 1559a82..203bb9e 100644 --- a/time/strftime_l.c +++ b/time/strftime_l.c @@ -108,6 +108,7 @@ extern char *tzname[]; # define UCHAR_T unsigned char # define L_(Str) Str # define NLW(Sym) Sym +# define ABALTMON_1 _NL_ABALTMON_1 # if !defined STDC_HEADERS && !defined HAVE_MEMCPY # define MEMCPY(d, s, n) bcopy ((s), (d), (n)) @@ -501,6 +502,9 @@ __strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, # define f_month \ ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11 \ ? "?" : _NL_CURRENT (LC_TIME, NLW(MON_1) + tp->tm_mon))) +# define a_altmonth \ + ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11 \ + ? "?" : _NL_CURRENT (LC_TIME, NLW(ABALTMON_1) + tp->tm_mon))) # define f_altmonth \ ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11 \ ? "?" : _NL_CURRENT (LC_TIME, NLW(ALTMON_1) + tp->tm_mon))) @@ -510,6 +514,7 @@ __strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, # define aw_len STRLEN (a_wkday) # define am_len STRLEN (a_month) +# define aam_len STRLEN (a_altmonth) # define ap_len STRLEN (ampm) #else # if !HAVE_STRFTIME @@ -519,11 +524,13 @@ __strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, ? "?" : month_name[tp->tm_mon]) # define a_wkday f_wkday # define a_month f_month +# define a_altmonth a_month # define f_altmonth f_month # define ampm (L_("AMPM") + 2 * (tp->tm_hour > 11)) size_t aw_len = 3; size_t am_len = 3; + size_t aam_len = 3; size_t ap_len = 2; # endif #endif @@ -788,10 +795,13 @@ __strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, to_uppcase = 1; to_lowcase = 0; } - if (modifier != 0) + if (modifier == L_('E')) goto bad_format; #if defined _NL_CURRENT || !HAVE_STRFTIME - cpy (am_len, a_month); + if (modifier == L_('O')) + cpy (aam_len, a_altmonth); + else + cpy (am_len, a_month); break; #else goto underlying_strftime; diff --git a/time/strptime_l.c b/time/strptime_l.c index 4c62435..d24aa2d 100644 --- a/time/strptime_l.c +++ b/time/strptime_l.c @@ -126,6 +126,8 @@ extern const struct __locale_data _nl_C_LC_TIME attribute_hidden; # define ab_month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABMON_1)].string) # define alt_month_name \ (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ALTMON_1)].string) +# define ab_alt_month_name \ + (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (_NL_ABALTMON_1)].string) # define HERE_D_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_T_FMT)].string) # define HERE_D_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_FMT)].string)