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
  111,
33
  135,
34
  {
34
  {
35
    { .string = "Sun" },
35
    { .string = "Sun" },
36
    { .string = "Mon" },
36
    { .string = "Mon" },
Lines 142-147 const struct __locale_data _nl_C_LC_TIME attribute_hidden = Link Here
142
    { .string = "" },
142
    { .string = "" },
143
    { .string = "%a %b %e %H:%M:%S %Z %Y" },
143
    { .string = "%a %b %e %H:%M:%S %Z %Y" },
144
    { .wstr = (const uint32_t *) L"%a %b %e %H:%M:%S %Z %Y" },
144
    { .wstr = (const uint32_t *) L"%a %b %e %H:%M:%S %Z %Y" },
145
    { .string = _nl_C_codeset }
145
    { .string = _nl_C_codeset },
146
    { .string = "January" },
147
    { .string = "February" },
148
    { .string = "March" },
149
    { .string = "April" },
150
    { .string = "May" },
151
    { .string = "June" },
152
    { .string = "July" },
153
    { .string = "August" },
154
    { .string = "September" },
155
    { .string = "October" },
156
    { .string = "November" },
157
    { .string = "December" },
158
    { .wstr = (const uint32_t *) L"January" },
159
    { .wstr = (const uint32_t *) L"February" },
160
    { .wstr = (const uint32_t *) L"March" },
161
    { .wstr = (const uint32_t *) L"April" },
162
    { .wstr = (const uint32_t *) L"May" },
163
    { .wstr = (const uint32_t *) L"June" },
164
    { .wstr = (const uint32_t *) L"July" },
165
    { .wstr = (const uint32_t *) L"August" },
166
    { .wstr = (const uint32_t *) L"September" },
167
    { .wstr = (const uint32_t *) L"October" },
168
    { .wstr = (const uint32_t *) L"November" },
169
    { .wstr = (const uint32_t *) L"December" }
146
  }
170
  }
147
};
171
};
(-)a/locale/categories.def (+2 lines)
Lines 249-254 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)
253
  DEFINE_ELEMENT (_NL_WALTMON_1,  "wide-alt_mon",  opt, wstringarray, 12, 12)
252
  ), NO_POSTLOAD)
254
  ), NO_POSTLOAD)
253
255
254
256
(-)a/locale/langinfo.h (-2 / +48 lines)
Lines 100-106 enum Link Here
100
  ABMON_12,
100
  ABMON_12,
101
#define ABMON_12		ABMON_12
101
#define ABMON_12		ABMON_12
102
102
103
  /* Long month names.  */
103
  /* Long month names, in the grammatical form used when the month
104
     forms part of a complete date.  */
104
  MON_1,			/* January */
105
  MON_1,			/* January */
105
#define MON_1			MON_1
106
#define MON_1			MON_1
106
  MON_2,
107
  MON_2,
Lines 189-195 enum Link Here
189
  _NL_WABMON_11,
190
  _NL_WABMON_11,
190
  _NL_WABMON_12,
191
  _NL_WABMON_12,
191
192
192
  /* Long month names.  */
193
  /* Long month names, in the grammatical form used when the month
194
     forms part of a complete date.  */
193
  _NL_WMON_1,		/* January */
195
  _NL_WMON_1,		/* January */
194
  _NL_WMON_2,
196
  _NL_WMON_2,
195
  _NL_WMON_3,
197
  _NL_WMON_3,
Lines 231-236 enum Link Here
231
233
232
  _NL_TIME_CODESET,
234
  _NL_TIME_CODESET,
233
235
236
  /* Long month names, in the grammatical form used when the month
237
     is named by itself.  */
238
  __ALTMON_1,			/* January */
239
  __ALTMON_2,
240
  __ALTMON_3,
241
  __ALTMON_4,
242
  __ALTMON_5,
243
  __ALTMON_6,
244
  __ALTMON_7,
245
  __ALTMON_8,
246
  __ALTMON_9,
247
  __ALTMON_10,
248
  __ALTMON_11,
249
  __ALTMON_12,
250
#ifdef __USE_GNU
251
# define ALTMON_1		__ALTMON_1
252
# define ALTMON_2		__ALTMON_2
253
# define ALTMON_3		__ALTMON_3
254
# define ALTMON_4		__ALTMON_4
255
# define ALTMON_5		__ALTMON_5
256
# define ALTMON_6		__ALTMON_6
257
# define ALTMON_7		__ALTMON_7
258
# define ALTMON_8		__ALTMON_8
259
# define ALTMON_9		__ALTMON_9
260
# define ALTMON_10		__ALTMON_10
261
# define ALTMON_11		__ALTMON_11
262
# define ALTMON_12		__ALTMON_12
263
#endif
264
265
  /* Long month names, in the grammatical form used when the month
266
     is named by itself.  */
267
  _NL_WALTMON_1,			/* January */
268
  _NL_WALTMON_2,
269
  _NL_WALTMON_3,
270
  _NL_WALTMON_4,
271
  _NL_WALTMON_5,
272
  _NL_WALTMON_6,
273
  _NL_WALTMON_7,
274
  _NL_WALTMON_8,
275
  _NL_WALTMON_9,
276
  _NL_WALTMON_10,
277
  _NL_WALTMON_11,
278
  _NL_WALTMON_12,
279
234
  _NL_NUM_LC_TIME,	/* Number of indices in LC_TIME category.  */
280
  _NL_NUM_LC_TIME,	/* Number of indices in LC_TIME category.  */
235
281
236
  /* LC_COLLATE category: text sorting.
282
  /* LC_COLLATE category: text sorting.
(-)a/locale/programs/ld-time.c (+21 lines)
Lines 91-96 struct locale_time_t Link Here
91
  const char *date_fmt;
91
  const char *date_fmt;
92
  const uint32_t *wdate_fmt;
92
  const uint32_t *wdate_fmt;
93
  int alt_digits_defined;
93
  int alt_digits_defined;
94
  const char *alt_mon[12];
95
  const uint32_t *walt_mon[12];
96
  int alt_mon_defined;
94
  unsigned char week_ndays;
97
  unsigned char week_ndays;
95
  uint32_t week_1stday;
98
  uint32_t week_1stday;
96
  unsigned char week_1stweek;
99
  unsigned char week_1stweek;
Lines 639-644 time_output (struct localedef_t *locale, const struct charmap_t *charmap, Link Here
639
  add_locale_string (&file, time->date_fmt);
642
  add_locale_string (&file, time->date_fmt);
640
  add_locale_wstring (&file, time->wdate_fmt);
643
  add_locale_wstring (&file, time->wdate_fmt);
641
  add_locale_string (&file, charmap->code_set_name);
644
  add_locale_string (&file, charmap->code_set_name);
645
646
  /* The alt'mons.  */
647
  for (n = 0; n < 12; ++n)
648
    add_locale_string (&file, time->alt_mon[n] ?: "");
649
650
  /* The wide character alt'mons.  */
651
  for (n = 0; n < 12; ++n)
652
    add_locale_wstring (&file, time->walt_mon[n] ?: empty_wstr);
653
642
  write_locale_data (output_path, LC_TIME, "LC_TIME", &file);
654
  write_locale_data (output_path, LC_TIME, "LC_TIME", &file);
643
}
655
}
644
656
Lines 782-787 time_read (struct linereader *ldfile, struct localedef_t *result, Link Here
782
	  STRARR_ELEM (mon, 12, 12);
794
	  STRARR_ELEM (mon, 12, 12);
783
	  STRARR_ELEM (am_pm, 2, 2);
795
	  STRARR_ELEM (am_pm, 2, 2);
784
	  STRARR_ELEM (alt_digits, 0, 100);
796
	  STRARR_ELEM (alt_digits, 0, 100);
797
	  STRARR_ELEM (alt_mon, 12, 12);
785
798
786
	case tok_era:
799
	case tok_era:
787
	  /* Ignore the rest of the line if we don't need the input of
800
	  /* Ignore the rest of the line if we don't need the input of
Lines 934-939 time_read (struct linereader *ldfile, struct localedef_t *result, Link Here
934
	    lr_error (ldfile, _("\
947
	    lr_error (ldfile, _("\
935
%1$s: definition does not end with `END %1$s'"), "LC_TIME");
948
%1$s: definition does not end with `END %1$s'"), "LC_TIME");
936
	  lr_ignore_rest (ldfile, now->tok == tok_lc_time);
949
	  lr_ignore_rest (ldfile, now->tok == tok_lc_time);
950
951
	  /* If alt_mon was not specified, make it a copy of mon.  */
952
	  if (!ignore_content && !time->alt_mon_defined)
953
	    {
954
	      memcpy (time->alt_mon, time->mon, sizeof (time->mon));
955
	      memcpy (time->walt_mon, time->wmon, sizeof (time->wmon));
956
	      time->alt_mon_defined = 1;
957
	    }
937
	  return;
958
	  return;
938
959
939
	default:
960
	default:
(-)a/locale/programs/locfile-kw.gperf (+1 lines)
Lines 148-153 first_workday, tok_first_workday, 0 Link Here
148
cal_direction,          tok_cal_direction,          0
148
cal_direction,          tok_cal_direction,          0
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
LC_MESSAGES,            tok_lc_messages,            0
152
LC_MESSAGES,            tok_lc_messages,            0
152
yesexpr,                tok_yesexpr,                0
153
yesexpr,                tok_yesexpr,                0
153
noexpr,                 tok_noexpr,                 0
154
noexpr,                 tok_noexpr,                 0
(-)a/locale/programs/locfile-token.h (+1 lines)
Lines 186-191 enum token_t Link Here
186
  tok_cal_direction,
186
  tok_cal_direction,
187
  tok_timezone,
187
  tok_timezone,
188
  tok_date_fmt,
188
  tok_date_fmt,
189
  tok_alt_mon,
189
  tok_lc_messages,
190
  tok_lc_messages,
190
  tok_yesexpr,
191
  tok_yesexpr,
191
  tok_noexpr,
192
  tok_noexpr,
(-)a/localedata/tst-langinfo.c (+12 lines)
Lines 50-55 struct map Link Here
50
  VAL (ABMON_8),
50
  VAL (ABMON_8),
51
  VAL (ABMON_9),
51
  VAL (ABMON_9),
52
  VAL (ALT_DIGITS),
52
  VAL (ALT_DIGITS),
53
  VAL (ALTMON_1),
54
  VAL (ALTMON_10),
55
  VAL (ALTMON_11),
56
  VAL (ALTMON_12),
57
  VAL (ALTMON_2),
58
  VAL (ALTMON_3),
59
  VAL (ALTMON_4),
60
  VAL (ALTMON_5),
61
  VAL (ALTMON_6),
62
  VAL (ALTMON_7),
63
  VAL (ALTMON_8),
64
  VAL (ALTMON_9),
53
  VAL (AM_STR),
65
  VAL (AM_STR),
54
  VAL (CRNCYSTR),
66
  VAL (CRNCYSTR),
55
  VAL (CURRENCY_SYMBOL),
67
  VAL (CURRENCY_SYMBOL),
(-)a/time/Makefile (-1 / +1 lines)
Lines 48-54 tests := test_time clocktest tst-posixtz tst-strptime tst_wcsftime \ Link Here
48
include ../Rules
48
include ../Rules
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
51
LOCALES := de_DE.ISO-8859-1 en_US.ISO-8859-1 ja_JP.EUC-JP pl_PL.UTF-8
52
include ../gen-locales.mk
52
include ../gen-locales.mk
53
53
54
$(objpfx)tst-ftime_l.out: $(gen-locales)
54
$(objpfx)tst-ftime_l.out: $(gen-locales)
(-)a/time/strftime_l.c (-2 / +9 lines)
Lines 492-497 __strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, Link Here
492
# define f_month \
492
# define f_month \
493
  ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11			     \
493
  ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11			     \
494
		     ? "?" : _NL_CURRENT (LC_TIME, NLW(MON_1) + tp->tm_mon)))
494
		     ? "?" : _NL_CURRENT (LC_TIME, NLW(MON_1) + tp->tm_mon)))
495
# define f_altmonth \
496
  ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11			     \
497
		     ? "?" : _NL_CURRENT (LC_TIME, NLW(ALTMON_1) + tp->tm_mon)))
495
# define ampm \
498
# define ampm \
496
  ((const CHAR_T *) _NL_CURRENT (LC_TIME, tp->tm_hour > 11		      \
499
  ((const CHAR_T *) _NL_CURRENT (LC_TIME, tp->tm_hour > 11		      \
497
				 ? NLW(PM_STR) : NLW(AM_STR)))
500
				 ? NLW(PM_STR) : NLW(AM_STR)))
Lines 507-512 __strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, Link Here
507
		   ? "?" : month_name[tp->tm_mon])
510
		   ? "?" : month_name[tp->tm_mon])
508
#  define a_wkday f_wkday
511
#  define a_wkday f_wkday
509
#  define a_month f_month
512
#  define a_month f_month
513
#  define f_altmonth f_month
510
#  define ampm (L_("AMPM") + 2 * (tp->tm_hour > 11))
514
#  define ampm (L_("AMPM") + 2 * (tp->tm_hour > 11))
511
515
512
  size_t aw_len = 3;
516
  size_t aw_len = 3;
Lines 785-791 __strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, Link Here
785
#endif
789
#endif
786
790
787
	case L_('B'):
791
	case L_('B'):
788
	  if (modifier != 0)
792
	  if (modifier == L_('E'))
789
	    goto bad_format;
793
	    goto bad_format;
790
	  if (change_case)
794
	  if (change_case)
791
	    {
795
	    {
Lines 793-799 __strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, Link Here
793
	      to_lowcase = 0;
797
	      to_lowcase = 0;
794
	    }
798
	    }
795
#if defined _NL_CURRENT || !HAVE_STRFTIME
799
#if defined _NL_CURRENT || !HAVE_STRFTIME
796
	  cpy (STRLEN (f_month), f_month);
800
	  if (modifier == L_('O'))
801
	    cpy (STRLEN (f_altmonth), f_altmonth);
802
	  else
803
	    cpy (STRLEN (f_month), f_month);
797
	  break;
804
	  break;
798
#else
805
#else
799
	  goto underlying_strftime;
806
	  goto underlying_strftime;
(-)a/time/strptime_l.c (-4 / +28 lines)
Lines 124-129 extern const struct __locale_data _nl_C_LC_TIME attribute_hidden; Link Here
124
  (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABDAY_1)].string)
124
  (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABDAY_1)].string)
125
# define month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (MON_1)].string)
125
# define month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (MON_1)].string)
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 \
128
  (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ALTMON_1)].string)
127
# define HERE_D_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_T_FMT)].string)
129
# define HERE_D_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_T_FMT)].string)
128
# define HERE_D_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_FMT)].string)
130
# define HERE_D_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_FMT)].string)
129
# define HERE_AM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (AM_STR)].string)
131
# define HERE_AM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (AM_STR)].string)
Lines 319-328 __strptime_internal (const char *rp, const char *fmt, struct tm *tmp, Link Here
319
      while (*fmt >= '0' && *fmt <= '9')
321
      while (*fmt >= '0' && *fmt <= '9')
320
	++fmt;
322
	++fmt;
321
323
322
#ifndef _NL_CURRENT
324
      /* In some cases, modifiers are handled by adjusting state and
323
      /* We need this for handling the `E' modifier.  */
325
         then restarting the switch statement below.  */
324
    start_over:
326
    start_over:
325
#endif
326
327
327
      /* Make back up of current processing pointer.  */
328
      /* Make back up of current processing pointer.  */
328
      rp_backup = rp;
329
      rp_backup = rp;
Lines 423-435 __strptime_internal (const char *rp, const char *fmt, struct tm *tmp, Link Here
423
				     ab_month_name[cnt]))
424
				     ab_month_name[cnt]))
424
			decided_longest = loc;
425
			decided_longest = loc;
425
		    }
426
		    }
427
#ifdef _LIBC
428
		  /* Now check the alt month.  */
429
		  trp = rp;
430
		  if (match_string (_NL_CURRENT (LC_TIME, ALTMON_1 + cnt), trp)
431
		      && trp > rp_longest)
432
		    {
433
		      rp_longest = trp;
434
		      cnt_longest = cnt;
435
		      if (s.decided == not
436
			  && strcmp (_NL_CURRENT (LC_TIME, ALTMON_1 + cnt),
437
				     alt_month_name[cnt]))
438
			decided_longest = loc;
439
		    }
440
#endif
426
		}
441
		}
427
#endif
442
#endif
428
	      if (s.decided != loc
443
	      if (s.decided != loc
429
		  && (((trp = rp, match_string (month_name[cnt], trp))
444
		  && (((trp = rp, match_string (month_name[cnt], trp))
430
		       && trp > rp_longest)
445
		       && trp > rp_longest)
431
		      || ((trp = rp, match_string (ab_month_name[cnt], trp))
446
		      || ((trp = rp, match_string (ab_month_name[cnt], trp))
432
			  && trp > rp_longest)))
447
			  && trp > rp_longest)
448
#ifdef _LIBC
449
		      || ((trp = rp, match_string (alt_month_name[cnt], trp))
450
			  && trp > rp_longest)
451
#endif
452
	      ))
433
		{
453
		{
434
		  rp_longest = trp;
454
		  rp_longest = trp;
435
		  cnt_longest = cnt;
455
		  cnt_longest = cnt;
Lines 1015-1020 __strptime_internal (const char *rp, const char *fmt, struct tm *tmp, Link Here
1015
	case 'O':
1035
	case 'O':
1016
	  switch (*fmt++)
1036
	  switch (*fmt++)
1017
	    {
1037
	    {
1038
	    case 'B':
1039
	      /* Match month name.  Reprocess as plain 'B'.  */
1040
	      fmt--;
1041
	      goto start_over;
1018
	    case 'd':
1042
	    case 'd':
1019
	    case 'e':
1043
	    case 'e':
1020
	      /* Match day of month using alternate numeric symbols.  */
1044
	      /* Match day of month using alternate numeric symbols.  */
(-)a/time/tst-strptime.c (-1 / +6 lines)
Lines 51-56 static const struct Link Here
51
    6, 0, 0, 1 },
51
    6, 0, 0, 1 },
52
  { "ja_JP.EUC-JP", "2001 20 \xb7\xee", "%Y %U %a", 1, 140, 4, 21 },
52
  { "ja_JP.EUC-JP", "2001 20 \xb7\xee", "%Y %U %a", 1, 140, 4, 21 },
53
  { "ja_JP.EUC-JP", "2001 21 \xb7\xee", "%Y %W %a", 1, 140, 4, 21 },
53
  { "ja_JP.EUC-JP", "2001 21 \xb7\xee", "%Y %W %a", 1, 140, 4, 21 },
54
  { "pl_PL.UTF-8", "21 lis 2017", "%d %b %Y", 2, 324, 10, 21 },
55
  { "pl_PL.UTF-8", "22 LIS 2017", "%d %B %Y", 3, 325, 10, 22 },
56
  /* TODO: Use the genitive case here as soon as it is added to localedata.  */
57
  { "pl_PL.UTF-8", "23 listopad 2017", "%d %B %Y", 4, 326, 10, 23 },
58
  /* The nominative case is incorrect here but it is parseable.  */
59
  { "pl_PL.UTF-8", "24 listopad 2017", "%d %OB %Y", 5, 327, 10, 24 },
54
};
60
};
55
61
56
62
57
- 

Return to bug 10871