View | Details | Raw Unified | Return to bug 10871 | Differences between
and this patch

Collapse All | Expand All

(-)a/locale/C-time.c (-2 / +26 lines)
Lines 30-36 const struct __locale_data _nl_C_LC_TIME attribute_hidden = Link Here
30
  { NULL, },			/* no cached data */
30
  { NULL, },			/* no cached data */
31
  UNDELETABLE,
31
  UNDELETABLE,
32
  0,
32
  0,
33
  135,
33
  159,
34
  {
34
  {
35
    { .string = "Sun" },
35
    { .string = "Sun" },
36
    { .string = "Mon" },
36
    { .string = "Mon" },
Lines 166-171 const struct __locale_data _nl_C_LC_TIME attribute_hidden = Link Here
166
    { .wstr = (const uint32_t *) L"September" },
166
    { .wstr = (const uint32_t *) L"September" },
167
    { .wstr = (const uint32_t *) L"October" },
167
    { .wstr = (const uint32_t *) L"October" },
168
    { .wstr = (const uint32_t *) L"November" },
168
    { .wstr = (const uint32_t *) L"November" },
169
    { .wstr = (const uint32_t *) L"December" }
169
    { .wstr = (const uint32_t *) L"December" },
170
    { .string = "Jan" },
171
    { .string = "Feb" },
172
    { .string = "Mar" },
173
    { .string = "Apr" },
174
    { .string = "May" },
175
    { .string = "Jun" },
176
    { .string = "Jul" },
177
    { .string = "Aug" },
178
    { .string = "Sep" },
179
    { .string = "Oct" },
180
    { .string = "Nov" },
181
    { .string = "Dec" },
182
    { .wstr = (const uint32_t *) L"Jan" },
183
    { .wstr = (const uint32_t *) L"Feb" },
184
    { .wstr = (const uint32_t *) L"Mar" },
185
    { .wstr = (const uint32_t *) L"Apr" },
186
    { .wstr = (const uint32_t *) L"May" },
187
    { .wstr = (const uint32_t *) L"Jun" },
188
    { .wstr = (const uint32_t *) L"Jul" },
189
    { .wstr = (const uint32_t *) L"Aug" },
190
    { .wstr = (const uint32_t *) L"Sep" },
191
    { .wstr = (const uint32_t *) L"Oct" },
192
    { .wstr = (const uint32_t *) L"Nov" },
193
    { .wstr = (const uint32_t *) L"Dec" }
170
  }
194
  }
171
};
195
};
(-)a/locale/categories.def (-2 / +4 lines)
Lines 249-256 DEFINE_CATEGORY Link Here
249
  DEFINE_ELEMENT (_DATE_FMT,                "date_fmt",            opt, string)
249
  DEFINE_ELEMENT (_DATE_FMT,                "date_fmt",            opt, string)
250
  DEFINE_ELEMENT (_NL_W_DATE_FMT,           "wide-date_fmt",       opt, wstring)
250
  DEFINE_ELEMENT (_NL_W_DATE_FMT,           "wide-date_fmt",       opt, wstring)
251
  DEFINE_ELEMENT (_NL_TIME_CODESET,	    "time-codeset",	   std, string)
251
  DEFINE_ELEMENT (_NL_TIME_CODESET,	    "time-codeset",	   std, string)
252
  DEFINE_ELEMENT (ALTMON_1,       "alt_mon",       opt, stringarray, 12, 12)
252
  DEFINE_ELEMENT (ALTMON_1,        "alt_mon",         opt, stringarray,  12, 12)
253
  DEFINE_ELEMENT (_NL_WALTMON_1,  "wide-alt_mon",  opt, wstringarray, 12, 12)
253
  DEFINE_ELEMENT (_NL_WALTMON_1,   "wide-alt_mon",    opt, wstringarray, 12, 12)
254
  DEFINE_ELEMENT (_NL_ABALTMON_1,  "ab_alt_mon",      opt, stringarray,  12, 12)
255
  DEFINE_ELEMENT (_NL_WABALTMON_1, "wide-ab_alt_mon", opt, wstringarray, 12, 12)
254
  ), NO_POSTLOAD)
256
  ), NO_POSTLOAD)
255
257
256
258
(-)a/locale/langinfo.h (-2 / +34 lines)
Lines 74-80 enum Link Here
74
  DAY_7,			/* Saturday */
74
  DAY_7,			/* Saturday */
75
#define DAY_7			DAY_7
75
#define DAY_7			DAY_7
76
76
77
  /* Abbreviated month names.  */
77
  /* Abbreviated month names, in the grammatical form used when the month
78
     is a part of a complete date.  */
78
  ABMON_1,			/* Jan */
79
  ABMON_1,			/* Jan */
79
#define ABMON_1			ABMON_1
80
#define ABMON_1			ABMON_1
80
  ABMON_2,
81
  ABMON_2,
Lines 176-182 enum Link Here
176
  _NL_WDAY_6,		/* Friday */
177
  _NL_WDAY_6,		/* Friday */
177
  _NL_WDAY_7,		/* Saturday */
178
  _NL_WDAY_7,		/* Saturday */
178
179
179
  /* Abbreviated month names.  */
180
  /* Abbreviated month names, in the grammatical form used when the month
181
     is a part of a complete date.  */
180
  _NL_WABMON_1,		/* Jan */
182
  _NL_WABMON_1,		/* Jan */
181
  _NL_WABMON_2,
183
  _NL_WABMON_2,
182
  _NL_WABMON_3,
184
  _NL_WABMON_3,
Lines 277-282 enum Link Here
277
  _NL_WALTMON_11,
279
  _NL_WALTMON_11,
278
  _NL_WALTMON_12,
280
  _NL_WALTMON_12,
279
281
282
  /* Abbreviated month names, in the grammatical form used when the month
283
     is named by itself.  */
284
  _NL_ABALTMON_1,			/* Jan */
285
  _NL_ABALTMON_2,
286
  _NL_ABALTMON_3,
287
  _NL_ABALTMON_4,
288
  _NL_ABALTMON_5,
289
  _NL_ABALTMON_6,
290
  _NL_ABALTMON_7,
291
  _NL_ABALTMON_8,
292
  _NL_ABALTMON_9,
293
  _NL_ABALTMON_10,
294
  _NL_ABALTMON_11,
295
  _NL_ABALTMON_12,
296
297
  /* Abbreviated month names, in the grammatical form used when the month
298
     is named by itself.  */
299
  _NL_WABALTMON_1,			/* Jan */
300
  _NL_WABALTMON_2,
301
  _NL_WABALTMON_3,
302
  _NL_WABALTMON_4,
303
  _NL_WABALTMON_5,
304
  _NL_WABALTMON_6,
305
  _NL_WABALTMON_7,
306
  _NL_WABALTMON_8,
307
  _NL_WABALTMON_9,
308
  _NL_WABALTMON_10,
309
  _NL_WABALTMON_11,
310
  _NL_WABALTMON_12,
311
280
  _NL_NUM_LC_TIME,	/* Number of indices in LC_TIME category.  */
312
  _NL_NUM_LC_TIME,	/* Number of indices in LC_TIME category.  */
281
313
282
  /* LC_COLLATE category: text sorting.
314
  /* LC_COLLATE category: text sorting.
(-)a/locale/programs/ld-time.c (+19 lines)
Lines 94-99 struct locale_time_t Link Here
94
  const char *alt_mon[12];
94
  const char *alt_mon[12];
95
  const uint32_t *walt_mon[12];
95
  const uint32_t *walt_mon[12];
96
  int alt_mon_defined;
96
  int alt_mon_defined;
97
  const char *ab_alt_mon[12];
98
  const uint32_t *wab_alt_mon[12];
99
  int ab_alt_mon_defined;
97
  unsigned char week_ndays;
100
  unsigned char week_ndays;
98
  uint32_t week_1stday;
101
  uint32_t week_1stday;
99
  unsigned char week_1stweek;
102
  unsigned char week_1stweek;
Lines 651-656 time_output (struct localedef_t *locale, const struct charmap_t *charmap, Link Here
651
  for (n = 0; n < 12; ++n)
654
  for (n = 0; n < 12; ++n)
652
    add_locale_wstring (&file, time->walt_mon[n] ?: empty_wstr);
655
    add_locale_wstring (&file, time->walt_mon[n] ?: empty_wstr);
653
656
657
  /* The ab'alt'mons.  */
658
  for (n = 0; n < 12; ++n)
659
    add_locale_string (&file, time->ab_alt_mon[n] ?: "");
660
661
  /* The wide character ab'alt'mons.  */
662
  for (n = 0; n < 12; ++n)
663
    add_locale_wstring (&file, time->wab_alt_mon[n] ?: empty_wstr);
664
654
  write_locale_data (output_path, LC_TIME, "LC_TIME", &file);
665
  write_locale_data (output_path, LC_TIME, "LC_TIME", &file);
655
}
666
}
656
667
Lines 795-800 time_read (struct linereader *ldfile, struct localedef_t *result, Link Here
795
	  STRARR_ELEM (am_pm, 2, 2);
806
	  STRARR_ELEM (am_pm, 2, 2);
796
	  STRARR_ELEM (alt_digits, 0, 100);
807
	  STRARR_ELEM (alt_digits, 0, 100);
797
	  STRARR_ELEM (alt_mon, 12, 12);
808
	  STRARR_ELEM (alt_mon, 12, 12);
809
	  STRARR_ELEM (ab_alt_mon, 12, 12);
798
810
799
	case tok_era:
811
	case tok_era:
800
	  /* Ignore the rest of the line if we don't need the input of
812
	  /* Ignore the rest of the line if we don't need the input of
Lines 955-960 time_read (struct linereader *ldfile, struct localedef_t *result, Link Here
955
	      memcpy (time->walt_mon, time->wmon, sizeof (time->wmon));
967
	      memcpy (time->walt_mon, time->wmon, sizeof (time->wmon));
956
	      time->alt_mon_defined = 1;
968
	      time->alt_mon_defined = 1;
957
	    }
969
	    }
970
	  /* The same for abbreviated versions.  */
971
	  if (!ignore_content && !time->ab_alt_mon_defined)
972
	    {
973
	      memcpy (time->ab_alt_mon, time->abmon, sizeof (time->abmon));
974
	      memcpy (time->wab_alt_mon, time->wabmon, sizeof (time->wabmon));
975
	      time->ab_alt_mon_defined = 1;
976
	    }
958
	  return;
977
	  return;
959
978
960
	default:
979
	default:
(-)a/locale/programs/locfile-kw.gperf (+1 lines)
Lines 149-154 cal_direction, tok_cal_direction, 0 Link Here
149
timezone,               tok_timezone,               0
149
timezone,               tok_timezone,               0
150
date_fmt,               tok_date_fmt,               0
150
date_fmt,               tok_date_fmt,               0
151
alt_mon,                tok_alt_mon,                0
151
alt_mon,                tok_alt_mon,                0
152
ab_alt_mon,             tok_ab_alt_mon,             0
152
LC_MESSAGES,            tok_lc_messages,            0
153
LC_MESSAGES,            tok_lc_messages,            0
153
yesexpr,                tok_yesexpr,                0
154
yesexpr,                tok_yesexpr,                0
154
noexpr,                 tok_noexpr,                 0
155
noexpr,                 tok_noexpr,                 0
(-)a/locale/programs/locfile-token.h (+1 lines)
Lines 187-192 enum token_t Link Here
187
  tok_timezone,
187
  tok_timezone,
188
  tok_date_fmt,
188
  tok_date_fmt,
189
  tok_alt_mon,
189
  tok_alt_mon,
190
  tok_ab_alt_mon,
190
  tok_lc_messages,
191
  tok_lc_messages,
191
  tok_yesexpr,
192
  tok_yesexpr,
192
  tok_noexpr,
193
  tok_noexpr,
(-)a/time/Makefile (-1 / +1 lines)
Lines 49-55 include ../Rules Link Here
49
49
50
ifeq ($(run-built-tests),yes)
50
ifeq ($(run-built-tests),yes)
51
LOCALES := de_DE.ISO-8859-1 en_US.ISO-8859-1 ja_JP.EUC-JP fr_FR.UTF-8 \
51
LOCALES := de_DE.ISO-8859-1 en_US.ISO-8859-1 ja_JP.EUC-JP fr_FR.UTF-8 \
52
	   pl_PL.UTF-8
52
	   es_ES.UTF-8 pl_PL.UTF-8 ru_RU.UTF-8
53
include ../gen-locales.mk
53
include ../gen-locales.mk
54
54
55
$(objpfx)tst-ftime_l.out: $(gen-locales)
55
$(objpfx)tst-ftime_l.out: $(gen-locales)
(-)a/time/strftime_l.c (-2 / +12 lines)
Lines 106-111 extern char *tzname[]; Link Here
106
# define UCHAR_T unsigned char
106
# define UCHAR_T unsigned char
107
# define L_(Str) Str
107
# define L_(Str) Str
108
# define NLW(Sym) Sym
108
# define NLW(Sym) Sym
109
# define ABALTMON_1 _NL_ABALTMON_1
109
110
110
# if !defined STDC_HEADERS && !defined HAVE_MEMCPY
111
# if !defined STDC_HEADERS && !defined HAVE_MEMCPY
111
#  define MEMCPY(d, s, n) bcopy ((s), (d), (n))
112
#  define MEMCPY(d, s, n) bcopy ((s), (d), (n))
Lines 492-497 __strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, Link Here
492
# define f_month \
493
# define f_month \
493
  ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11			     \
494
  ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11			     \
494
		     ? "?" : _NL_CURRENT (LC_TIME, NLW(MON_1) + tp->tm_mon)))
495
		     ? "?" : _NL_CURRENT (LC_TIME, NLW(MON_1) + tp->tm_mon)))
496
# define a_altmonth \
497
  ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11			     \
498
		     ? "?" : _NL_CURRENT (LC_TIME, NLW(ABALTMON_1) + tp->tm_mon)))
495
# define f_altmonth \
499
# define f_altmonth \
496
  ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11			     \
500
  ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11			     \
497
		     ? "?" : _NL_CURRENT (LC_TIME, NLW(ALTMON_1) + tp->tm_mon)))
501
		     ? "?" : _NL_CURRENT (LC_TIME, NLW(ALTMON_1) + tp->tm_mon)))
Lines 501-506 __strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, Link Here
501
505
502
# define aw_len STRLEN (a_wkday)
506
# define aw_len STRLEN (a_wkday)
503
# define am_len STRLEN (a_month)
507
# define am_len STRLEN (a_month)
508
# define aam_len STRLEN (a_altmonth)
504
# define ap_len STRLEN (ampm)
509
# define ap_len STRLEN (ampm)
505
#else
510
#else
506
# if !HAVE_STRFTIME
511
# if !HAVE_STRFTIME
Lines 510-520 __strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, Link Here
510
		   ? "?" : month_name[tp->tm_mon])
515
		   ? "?" : month_name[tp->tm_mon])
511
#  define a_wkday f_wkday
516
#  define a_wkday f_wkday
512
#  define a_month f_month
517
#  define a_month f_month
518
#  define a_altmonth a_month
513
#  define f_altmonth f_month
519
#  define f_altmonth f_month
514
#  define ampm (L_("AMPM") + 2 * (tp->tm_hour > 11))
520
#  define ampm (L_("AMPM") + 2 * (tp->tm_hour > 11))
515
521
516
  size_t aw_len = 3;
522
  size_t aw_len = 3;
517
  size_t am_len = 3;
523
  size_t am_len = 3;
524
  size_t aam_len = 3;
518
  size_t ap_len = 2;
525
  size_t ap_len = 2;
519
# endif
526
# endif
520
#endif
527
#endif
Lines 779-788 __strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, Link Here
779
	      to_uppcase = 1;
786
	      to_uppcase = 1;
780
	      to_lowcase = 0;
787
	      to_lowcase = 0;
781
	    }
788
	    }
782
	  if (modifier != 0)
789
	  if (modifier == L_('E'))
783
	    goto bad_format;
790
	    goto bad_format;
784
#if defined _NL_CURRENT || !HAVE_STRFTIME
791
#if defined _NL_CURRENT || !HAVE_STRFTIME
785
	  cpy (am_len, a_month);
792
	  if (modifier == L_('O'))
793
	    cpy (aam_len, a_altmonth);
794
	  else
795
	    cpy (am_len, a_month);
786
	  break;
796
	  break;
787
#else
797
#else
788
	  goto underlying_strftime;
798
	  goto underlying_strftime;
(-)a/time/strptime_l.c (+18 lines)
Lines 126-131 extern const struct __locale_data _nl_C_LC_TIME attribute_hidden; Link Here
126
# define ab_month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABMON_1)].string)
126
# define ab_month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABMON_1)].string)
127
# define alt_month_name \
127
# define alt_month_name \
128
  (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ALTMON_1)].string)
128
  (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ALTMON_1)].string)
129
# define ab_alt_month_name \
130
  (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (_NL_ABALTMON_1)].string)
129
# define HERE_D_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_T_FMT)].string)
131
# define HERE_D_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_T_FMT)].string)
130
# define HERE_D_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_FMT)].string)
132
# define HERE_D_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_FMT)].string)
131
# define HERE_AM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (AM_STR)].string)
133
# define HERE_AM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (AM_STR)].string)
Lines 437-442 __strptime_internal (const char *rp, const char *fmt, struct tm *tmp, Link Here
437
				     alt_month_name[cnt]))
439
				     alt_month_name[cnt]))
438
			decided_longest = loc;
440
			decided_longest = loc;
439
		    }
441
		    }
442
		  trp = rp;
443
		  if (match_string (_NL_CURRENT (LC_TIME, _NL_ABALTMON_1 + cnt),
444
				    trp)
445
		      && trp > rp_longest)
446
		    {
447
		      rp_longest = trp;
448
		      cnt_longest = cnt;
449
		      if (s.decided == not
450
			  && strcmp (_NL_CURRENT (LC_TIME, _NL_ABALTMON_1 + cnt),
451
				     alt_month_name[cnt]))
452
			decided_longest = loc;
453
		    }
440
#endif
454
#endif
441
		}
455
		}
442
#endif
456
#endif
Lines 448-453 __strptime_internal (const char *rp, const char *fmt, struct tm *tmp, Link Here
448
#ifdef _LIBC
462
#ifdef _LIBC
449
		      || ((trp = rp, match_string (alt_month_name[cnt], trp))
463
		      || ((trp = rp, match_string (alt_month_name[cnt], trp))
450
			  && trp > rp_longest)
464
			  && trp > rp_longest)
465
		      || ((trp = rp, match_string (ab_alt_month_name[cnt], trp))
466
			  && trp > rp_longest)
451
#endif
467
#endif
452
	      ))
468
	      ))
453
		{
469
		{
Lines 1035-1041 __strptime_internal (const char *rp, const char *fmt, struct tm *tmp, Link Here
1035
	case 'O':
1051
	case 'O':
1036
	  switch (*fmt++)
1052
	  switch (*fmt++)
1037
	    {
1053
	    {
1054
	    case 'b':
1038
	    case 'B':
1055
	    case 'B':
1056
	    case 'h':
1039
	      /* Match month name.  Reprocess as plain 'B'.  */
1057
	      /* Match month name.  Reprocess as plain 'B'.  */
1040
	      fmt--;
1058
	      fmt--;
1041
	      goto start_over;
1059
	      goto start_over;
(-)a/time/tst-strptime.c (-1 / +9 lines)
Lines 56-61 static const struct Link Here
56
  { "en_US.ISO-8859-1", "November 17, 2017", "%B %e, %Y", 5, 320, 10, 17 },
56
  { "en_US.ISO-8859-1", "November 17, 2017", "%B %e, %Y", 5, 320, 10, 17 },
57
  { "de_DE.ISO-8859-1", "18. Nov 2017", "%d. %b %Y", 6, 321, 10, 18 },
57
  { "de_DE.ISO-8859-1", "18. Nov 2017", "%d. %b %Y", 6, 321, 10, 18 },
58
  { "fr_FR.UTF-8", "19 novembre 2017", "%d %OB %Y", 0, 322, 10, 19 },
58
  { "fr_FR.UTF-8", "19 novembre 2017", "%d %OB %Y", 0, 322, 10, 19 },
59
  { "es_ES.UTF-8", "20 de nov de 2017", "%d de %Ob de %Y", 1, 323, 10, 20 },
59
  /* Some languages do need the declension of the month names.  */
60
  /* Some languages do need the declension of the month names.  */
60
  { "pl_PL.UTF-8", "21 lis 2017", "%d %b %Y", 2, 324, 10, 21 },
61
  { "pl_PL.UTF-8", "21 lis 2017", "%d %b %Y", 2, 324, 10, 21 },
61
  { "pl_PL.UTF-8", "22 LIS 2017", "%d %B %Y", 3, 325, 10, 22 },
62
  { "pl_PL.UTF-8", "22 LIS 2017", "%d %B %Y", 3, 325, 10, 22 },
Lines 63-68 static const struct Link Here
63
  { "pl_PL.UTF-8", "23 listopad 2017", "%d %B %Y", 4, 326, 10, 23 },
64
  { "pl_PL.UTF-8", "23 listopad 2017", "%d %B %Y", 4, 326, 10, 23 },
64
  /* The nominative case is incorrect here but it is parseable.  */
65
  /* The nominative case is incorrect here but it is parseable.  */
65
  { "pl_PL.UTF-8", "24 listopad 2017", "%d %OB %Y", 5, 327, 10, 24 },
66
  { "pl_PL.UTF-8", "24 listopad 2017", "%d %OB %Y", 5, 327, 10, 24 },
67
  { "pl_PL.UTF-8", "25 lis 2017", "%d %Ob %Y", 6, 328, 10, 25 },
68
  /* ноя - pronounce: 'noya' - "Nov" (abbreviated "November") in Russian.  */
69
  { "ru_RU.UTF-8", "26 ноя 2017", "%d %b %Y", 0, 329, 10, 26 },
70
  /* TODO: Add an example of "may"/"maya" (5th month, May) using %Ob in
71
     Russian when the localedata is updated.  Without the genitive forms
72
     in localedata the word "maya" is ambiguous and may be mistaken for
73
     "mart" (March).
74
   */
66
};
75
};
67
76
68
77
69
- 

Return to bug 10871