]> pd.if.org Git - pdclib/blob - functions/time/strftime.c
Moving repetetive code into helper functions.
[pdclib] / functions / time / strftime.c
1 /* strftime( char * restrict, size_t, const char * restrict, const struct tm * restrict )
2
3    This file is part of the Public Domain C Library (PDCLib).
4    Permission is granted to use, modify, and / or redistribute at will.
5 */
6
7 #include <time.h>
8 #include <stdlib.h>
9 #include <locale.h>
10 #include <string.h>
11 #include <assert.h>
12
13 #ifndef REGTEST
14
15 /* TODO: Alternative representations / numerals not supported. Multibyte support missing. */
16
17 /* This implementation's code is highly repetitive, but I did not really
18    care for putting it into a number of macros / helper functions.
19 */
20
21 enum wstart_t
22 {
23     E_SUNDAY = 0,
24     E_MONDAY = 1,
25     E_ISO_WEEK,
26     E_ISO_YEAR
27 };
28
29 #include <stdio.h>
30
31 static int week_calc( const struct tm * timeptr, int wtype )
32 {
33     if ( wtype <= E_MONDAY )
34     {
35         /* Simple -- first week starting with E_SUNDAY / E_MONDAY,
36            days before that are week 0.
37         */
38         int wday = ( timeptr->tm_wday + 7 - wtype ) % 7;
39         div_t week = div( timeptr->tm_yday, 7 );
40         if ( week.rem >= wday )
41         {
42             ++week.quot;
43         }
44         return week.quot;
45     }
46
47     /* calculating ISO week; relies on Sunday == 7 */
48     int wday = timeptr->tm_wday;
49     if ( wday == 0 )
50     {
51         wday = 7;
52     }
53     /* https://en.wikipedia.org/wiki/ISO_week_date */
54     int week = ( timeptr->tm_yday - wday + 11 ) / 7;
55     if ( week == 53 )
56     {
57         /* date *may* belong to the *next* year, if:
58            * it is 31.12. and Monday - Wednesday
59            * it is 30.12. and Monday - Tuesday
60            * it is 29.12. and Monday
61            We can safely assume December...
62         */
63         if ( ( timeptr->tm_yday - wday - _PDCLIB_is_leap( timeptr->tm_year ) ) > 360 )
64         {
65             week = 1;
66         }
67     }
68     else if ( week == 0 )
69     {
70         /* date *does* belong to *previous* year,
71            i.e. has week 52 *unless*...
72            * current year started on a Friday, or
73            * previous year is leap and this year
74              started on a Saturday.
75         */
76         int firstday = timeptr->tm_wday - ( timeptr->tm_yday % 7 );
77         if ( firstday < 0 )
78         {
79             firstday += 7;
80         }
81         if ( ( firstday == 5 ) || ( _PDCLIB_is_leap( timeptr->tm_year - 1 ) && firstday == 6 ) )
82         {
83             week = 53;
84         }
85         else
86         {
87             week = 52;
88         }
89     }
90     if ( wtype == E_ISO_WEEK )
91     {
92         return week;
93     }
94
95     /* E_ISO_YEAR -- determine the "week-based year" */
96     int bias = 0;
97     if ( week >= 52 && timeptr->tm_mon == 0 )
98     {
99         --bias;
100     }
101     else if ( week == 1 && timeptr->tm_mon == 11 )
102     {
103         ++bias;
104     }
105     return timeptr->tm_year + 1900 + bias;
106 }
107
108 /* Assuming presence of s, rc, maxsize.
109    Checks index for valid range, target buffer for sufficient remaining
110    capacity, and copies the locale-specific string (or "?" if index out
111    of range). Returns with zero if buffer capacity insufficient.
112 */
113 #define SPRINTSTR( array, index, max ) \
114     { \
115         int ind = (index); \
116         const char * str = "?"; \
117         if ( ind >= 0 && ind <= max ) \
118         { \
119             str = array[ ind ]; \
120         } \
121         size_t len = strlen( str ); \
122         if ( rc < ( maxsize - len ) ) \
123         { \
124             strcpy( s + rc, str ); \
125             rc += len; \
126         } \
127         else \
128         { \
129             return 0; \
130         } \
131     }
132
133 #define SPRINTREC( format ) \
134     { \
135         size_t count = strftime( s + rc, maxsize - rc, format, timeptr ); \
136         if ( count == 0 ) \
137         { \
138             return 0; \
139         } \
140         else \
141         { \
142             rc += count; \
143         } \
144     }
145
146 size_t strftime( char * _PDCLIB_restrict s, size_t maxsize, const char * _PDCLIB_restrict format, const struct tm * _PDCLIB_restrict timeptr )
147 {
148     size_t rc = 0;
149
150     while ( rc < maxsize )
151     {
152         if ( *format != '%' )
153         {
154             if ( ( s[rc] = *format++ ) == '\0' )
155             {
156                 return rc;
157             }
158             else
159             {
160                 ++rc;
161             }
162         }
163         else
164         {
165             /* char flag = 0; */
166             switch ( *++format )
167             {
168                 case 'E':
169                 case 'O':
170                     /* flag = *format++; */
171                     break;
172                 default:
173                     /* EMPTY */
174                     break;
175             }
176             switch( *format++ )
177             {
178                 case 'a':
179                     {
180                         /* tm_wday abbreviated */
181                         SPRINTSTR( _PDCLIB_lconv.day_name_abbr, timeptr->tm_wday, 6 );
182                         break;
183                     }
184                 case 'A':
185                     {
186                         /* tm_wday full */
187                         SPRINTSTR( _PDCLIB_lconv.day_name_full, timeptr->tm_wday, 6 );
188                         break;
189                     }
190                 case 'b':
191                 case 'h':
192                     {
193                         /* tm_mon abbreviated */
194                         SPRINTSTR( _PDCLIB_lconv.month_name_abbr, timeptr->tm_mon, 11 );
195                         break;
196                     }
197                 case 'B':
198                     {
199                         /* tm_mon full */
200                         SPRINTSTR( _PDCLIB_lconv.month_name_full, timeptr->tm_mon, 11 );
201                         break;
202                     }
203                 case 'c':
204                     {
205                         /* locale's date / time representation, %a %b %e %T %Y for C locale */
206                         /* 'E' for locale's alternative representation */
207                         SPRINTREC( _PDCLIB_lconv.date_time_format );
208                         break;
209                     }
210                 case 'C':
211                     {
212                         /* tm_year divided by 100, truncated to decimal (00-99) */
213                         /* 'E' for base year (period) in locale's alternative representation */
214                         if ( rc < ( maxsize - 2 ) )
215                         {
216                             div_t period = div( ( ( timeptr->tm_year + 1900 ) / 100 ), 10 );
217                             s[rc++] = '0' + period.quot;
218                             s[rc++] = '0' + period.rem;
219                         }
220                         else
221                         {
222                             return 0;
223                         }
224                         break;
225                     }
226                 case 'd':
227                     {
228                         /* tm_mday as decimal (01-31) */
229                         /* 'O' for locale's alternative numeric symbols */
230                         if ( rc < ( maxsize - 2 ) )
231                         {
232                             div_t day = div( timeptr->tm_mday, 10 );
233                             s[rc++] = '0' + day.quot;
234                             s[rc++] = '0' + day.rem;
235                         }
236                         else
237                         {
238                             return 0;
239                         }
240                         break;
241                     }
242                 case 'D':
243                     {
244                         /* %m/%d/%y */
245                         SPRINTREC( "%m/%d/%y" );
246                         break;
247                     }
248                 case 'e':
249                     {
250                         /* tm_mday as decimal ( 1-31) */
251                         /* 'O' for locale's alternative numeric symbols */
252                         if ( rc < ( maxsize - 2 ) )
253                         {
254                             div_t day = div( timeptr->tm_mday, 10 );
255                             s[rc++] = ( day.quot > 0 ) ? '0' + day.quot : ' ';
256                             s[rc++] = '0' + day.rem;
257                         }
258                         else
259                         {
260                             return 0;
261                         }
262                         break;
263                     }
264                 case 'F':
265                     {
266                         /* %Y-%m-%d */
267                         SPRINTREC( "%Y-%m-%d" );
268                         break;
269                     }
270                 case 'g':
271                     {
272                         /* last 2 digits of the week-based year as decimal (00-99) */
273                         if ( rc < ( maxsize - 2 ) )
274                         {
275                             div_t year = div( week_calc( timeptr, E_ISO_YEAR ) % 100, 10 );
276                             s[rc++] = '0' + year.quot;
277                             s[rc++] = '0' + year.rem;
278                         }
279                         else
280                         {
281                             return 0;
282                         }
283                         break;
284                     }
285                 case 'G':
286                     {
287                         /* week-based year as decimal (e.g. 1997) */
288                         if ( rc < ( maxsize - 4 ) )
289                         {
290                             int year = week_calc( timeptr, E_ISO_YEAR );
291                             for ( int i = 3; i >= 0; --i )
292                             {
293                                 div_t digit = div( year, 10 );
294                                 s[ rc + i ] = '0' + digit.rem;
295                                 year = digit.quot;
296                             }
297
298                             rc += 4;
299                         }
300                         else
301                         {
302                             return 0;
303                         }
304                         break;
305                     }
306                 case 'H':
307                     {
308                         /* tm_hour as 24h decimal (00-23) */
309                         /* 'O' for locale's alternative numeric symbols */
310                         if ( rc < ( maxsize - 2 ) )
311                         {
312                             div_t hour = div( timeptr->tm_hour, 10 );
313                             s[rc++] = '0' + hour.quot;
314                             s[rc++] = '0' + hour.rem;
315                         }
316                         else
317                         {
318                             return 0;
319                         }
320                         break;
321                     }
322                 case 'I':
323                     {
324                         /* tm_hour as 12h decimal (01-12) */
325                         /* 'O' for locale's alternative numeric symbols */
326                         if ( rc < ( maxsize - 2 ) )
327                         {
328                             div_t hour = div( ( timeptr->tm_hour + 11 ) % 12 + 1, 10 );
329                             s[rc++] = '0' + hour.quot;
330                             s[rc++] = '0' + hour.rem;
331                         }
332                         else
333                         {
334                             return 0;
335                         }
336                         break;
337                     }
338                 case 'j':
339                     {
340                         /* tm_yday as decimal (001-366) */
341                         if ( rc < ( maxsize - 3 ) )
342                         {
343                             div_t yday = div( timeptr->tm_yday + 1, 100 );
344                             s[rc++] = '0' + yday.quot;
345                             s[rc++] = '0' + yday.rem / 10;
346                             s[rc++] = '0' + yday.rem % 10;
347                         }
348                         else
349                         {
350                             return 0;
351                         }
352                         break;
353                     }
354                 case 'm':
355                     {
356                         /* tm_mon as decimal (01-12) */
357                         /* 'O' for locale's alternative numeric symbols */
358                         if ( rc < ( maxsize - 2 ) )
359                         {
360                             div_t mon = div( timeptr->tm_mon + 1, 10 );
361                             s[rc++] = '0' + mon.quot;
362                             s[rc++] = '0' + mon.rem;
363                         }
364                         else
365                         {
366                             return 0;
367                         }
368                         break;
369                     }
370                 case 'M':
371                     {
372                         /* tm_min as decimal (00-59) */
373                         /* 'O' for locale's alternative numeric symbols */
374                         if ( rc < ( maxsize - 2 ) )
375                         {
376                             div_t min = div( timeptr->tm_min, 10 );
377                             s[rc++] = '0' + min.quot;
378                             s[rc++] = '0' + min.rem;
379                         }
380                         else
381                         {
382                             return 0;
383                         }
384                         break;
385                     }
386                 case 'n':
387                     {
388                         /* newline */
389                         s[rc++] = '\n';
390                         break;
391                     }
392                 case 'p':
393                     {
394                         /* tm_hour locale's AM/PM designations */
395                         SPRINTSTR( _PDCLIB_lconv.am_pm, timeptr->tm_hour > 11, 1 );
396                         break;
397                     }
398                 case 'r':
399                     {
400                         /* tm_hour / tm_min / tm_sec as locale's 12-hour clock time, %I:%M:%S %p for C locale */
401                         SPRINTREC( _PDCLIB_lconv.time_format_12h );
402                         break;
403                     }
404                 case 'R':
405                     {
406                         /* %H:%M */
407                         SPRINTREC( "%H:%M" );
408                         break;
409                     }
410                 case 'S':
411                     {
412                         /* tm_sec as decimal (00-60) */
413                         /* 'O' for locale's alternative numeric symbols */
414                         if ( rc < ( maxsize - 2 ) )
415                         {
416                             div_t sec = div( timeptr->tm_sec, 10 );
417                             s[rc++] = '0' + sec.quot;
418                             s[rc++] = '0' + sec.rem;
419                         }
420                         else
421                         {
422                             return 0;
423                         }
424                         break;
425                     }
426                 case 't':
427                     {
428                         /* tabulator */
429                         s[rc++] = '\t';
430                         break;
431                     }
432                 case 'T':
433                     {
434                         /* %H:%M:%S */
435                         SPRINTREC( "%H:%M:%S" );
436                         break;
437                     }
438                 case 'u':
439                     {
440                         /* tm_wday as decimal (1-7) with Monday == 1 */
441                         /* 'O' for locale's alternative numeric symbols */
442                         s[rc++] = ( timeptr->tm_wday == 0 ) ? '7' : '0' + timeptr->tm_wday;
443                         break;
444                     }
445                 case 'U':
446                     {
447                         /* week number of the year (first Sunday as the first day of week 1) as decimal (00-53) */
448                         /* 'O' for locale's alternative numeric symbols */
449                         if ( rc < ( maxsize - 2 ) )
450                         {
451                             div_t week = div( week_calc( timeptr, E_SUNDAY ), 10 );
452                             s[rc++] = '0' + week.quot;
453                             s[rc++] = '0' + week.rem;
454                         }
455                         else
456                         {
457                             return 0;
458                         }
459                         break;
460                     }
461                 case 'V':
462                     {
463                         /* ISO week number as decimal (01-53) */
464                         /* 'O' for locale's alternative numeric symbols */
465                         if ( rc < ( maxsize - 2 ) )
466                         {
467                             div_t week = div( week_calc( timeptr, E_ISO_WEEK ), 10 );
468                             s[rc++] = '0' + week.quot;
469                             s[rc++] = '0' + week.rem;
470                         }
471                         else
472                         {
473                             return 0;
474                         }
475                         break;
476                     }
477                 case 'w':
478                     {
479                         /* tm_wday as decimal number (0-6) with Sunday == 0 */
480                         /* 'O' for locale's alternative numeric symbols */
481                         s[rc++] = '0' + timeptr->tm_wday;
482                         break;
483                     }
484                 case 'W':
485                     {
486                         /* week number of the year (first Monday as the first day of week 1) as decimal (00-53) */
487                         /* 'O' for locale's alternative numeric symbols */
488                         if ( rc < ( maxsize - 2 ) )
489                         {
490                             div_t week = div( week_calc( timeptr, E_MONDAY ), 10 );
491                             s[rc++] = '0' + week.quot;
492                             s[rc++] = '0' + week.rem;
493                         }
494                         else
495                         {
496                             return 0;
497                         }
498                         break;
499                     }
500                 case 'x':
501                     {
502                         /* locale's date representation, %m/%d/%y for C locale */
503                         /* 'E' for locale's alternative representation */
504                         SPRINTREC( _PDCLIB_lconv.date_format );
505                         break;
506                     }
507                 case 'X':
508                     {
509                         /* locale's time representation, %T for C locale */
510                         /* 'E' for locale's alternative representation */
511                         SPRINTREC( _PDCLIB_lconv.time_format );
512                         break;
513                     }
514                 case 'y':
515                     {
516                         /* last 2 digits of tm_year as decimal (00-99) */
517                         /* 'E' for offset from %EC (year only) in locale's alternative representation */
518                         /* 'O' for locale's alternative numeric symbols */
519                         if ( rc < ( maxsize - 2 ) )
520                         {
521                             div_t year = div( ( timeptr->tm_year % 100 ), 10 );
522                             s[rc++] = '0' + year.quot;
523                             s[rc++] = '0' + year.rem;
524                         }
525                         else
526                         {
527                             return 0;
528                         }
529                         break;
530                     }
531                 case 'Y':
532                     {
533                         /* tm_year as decimal (e.g. 1997) */
534                         /* 'E' for locale's alternative representation */
535                         if ( rc < ( maxsize - 4 ) )
536                         {
537                             int year = timeptr->tm_year + 1900;
538
539                             for ( int i = 3; i >= 0; --i )
540                             {
541                                 div_t digit = div( year, 10 );
542                                 s[ rc + i ] = '0' + digit.rem;
543                                 year = digit.quot;
544                             }
545
546                             rc += 4;
547                         }
548                         else
549                         {
550                             return 0;
551                         }
552                         break;
553                     }
554                 case 'z':
555                     {
556                         /* tm_isdst / UTC offset in ISO8601 format (e.g. -0430 meaning 4 hours 30 minutes behind Greenwich), or no characters */
557                         /* TODO: 'z' */
558                         break;
559                     }
560                 case 'Z':
561                     {
562                         /* tm_isdst / locale's time zone name or abbreviation, or no characters */
563                         /* TODO: 'Z' */
564                         break;
565                     }
566                 case '%':
567                     {
568                         /* '%' character */
569                         s[rc++] = '%';
570                         break;
571                     }
572             }
573         }
574     }
575
576     return 0;
577 }
578
579 #endif
580
581 #ifdef TEST
582
583 #include "_PDCLIB_test.h"
584
585 #define MKTIME( tm, sec, min, hour, day, month, year, wday, yday ) tm.tm_sec = sec; tm.tm_min = min; tm.tm_hour = hour; tm.tm_mday = day; tm.tm_mon = month; tm.tm_year = year; tm.tm_wday = wday; tm.tm_yday = yday; tm.tm_isdst = -1;
586
587 /* Test data generated by reference mktime() / strftime(), listing:
588    * tm_year
589    * tm_wday
590    * tm_yday
591    * '%U' result
592    * '%V' result
593    * '%W' result
594 */
595 int data[1020][6] =
596 {
597 { 70, 4, 0, 0, 1, 0 },
598 { 70, 5, 1, 0, 1, 0 },
599 { 70, 6, 2, 0, 1, 0 },
600 { 70, 0, 3, 1, 1, 0 },
601 { 70, 1, 4, 1, 2, 1 },
602 { 70, 2, 5, 1, 2, 1 },
603 { 70, 3, 6, 1, 2, 1 },
604 { 70, 4, 357, 51, 52, 51 },
605 { 70, 5, 358, 51, 52, 51 },
606 { 70, 6, 359, 51, 52, 51 },
607 { 70, 0, 360, 52, 52, 51 },
608 { 70, 1, 361, 52, 53, 52 },
609 { 70, 2, 362, 52, 53, 52 },
610 { 70, 3, 363, 52, 53, 52 },
611 { 70, 4, 364, 52, 53, 52 },
612 { 71, 5, 0, 0, 53, 0 },
613 { 71, 6, 1, 0, 53, 0 },
614 { 71, 0, 2, 1, 53, 0 },
615 { 71, 1, 3, 1, 1, 1 },
616 { 71, 2, 4, 1, 1, 1 },
617 { 71, 3, 5, 1, 1, 1 },
618 { 71, 4, 6, 1, 1, 1 },
619 { 71, 5, 357, 51, 51, 51 },
620 { 71, 6, 358, 51, 51, 51 },
621 { 71, 0, 359, 52, 51, 51 },
622 { 71, 1, 360, 52, 52, 52 },
623 { 71, 2, 361, 52, 52, 52 },
624 { 71, 3, 362, 52, 52, 52 },
625 { 71, 4, 363, 52, 52, 52 },
626 { 71, 5, 364, 52, 52, 52 },
627 { 72, 6, 0, 0, 52, 0 },
628 { 72, 0, 1, 1, 52, 0 },
629 { 72, 1, 2, 1, 1, 1 },
630 { 72, 2, 3, 1, 1, 1 },
631 { 72, 3, 4, 1, 1, 1 },
632 { 72, 4, 5, 1, 1, 1 },
633 { 72, 5, 6, 1, 1, 1 },
634 { 72, 0, 358, 52, 51, 51 },
635 { 72, 1, 359, 52, 52, 52 },
636 { 72, 2, 360, 52, 52, 52 },
637 { 72, 3, 361, 52, 52, 52 },
638 { 72, 4, 362, 52, 52, 52 },
639 { 72, 5, 363, 52, 52, 52 },
640 { 72, 6, 364, 52, 52, 52 },
641 { 72, 0, 365, 53, 52, 52 },
642 { 73, 1, 0, 0, 1, 1 },
643 { 73, 2, 1, 0, 1, 1 },
644 { 73, 3, 2, 0, 1, 1 },
645 { 73, 4, 3, 0, 1, 1 },
646 { 73, 5, 4, 0, 1, 1 },
647 { 73, 6, 5, 0, 1, 1 },
648 { 73, 0, 6, 1, 1, 1 },
649 { 73, 1, 357, 51, 52, 52 },
650 { 73, 2, 358, 51, 52, 52 },
651 { 73, 3, 359, 51, 52, 52 },
652 { 73, 4, 360, 51, 52, 52 },
653 { 73, 5, 361, 51, 52, 52 },
654 { 73, 6, 362, 51, 52, 52 },
655 { 73, 0, 363, 52, 52, 52 },
656 { 73, 1, 364, 52, 1, 53 },
657 { 74, 2, 0, 0, 1, 0 },
658 { 74, 3, 1, 0, 1, 0 },
659 { 74, 4, 2, 0, 1, 0 },
660 { 74, 5, 3, 0, 1, 0 },
661 { 74, 6, 4, 0, 1, 0 },
662 { 74, 0, 5, 1, 1, 0 },
663 { 74, 1, 6, 1, 2, 1 },
664 { 74, 2, 357, 51, 52, 51 },
665 { 74, 3, 358, 51, 52, 51 },
666 { 74, 4, 359, 51, 52, 51 },
667 { 74, 5, 360, 51, 52, 51 },
668 { 74, 6, 361, 51, 52, 51 },
669 { 74, 0, 362, 52, 52, 51 },
670 { 74, 1, 363, 52, 1, 52 },
671 { 74, 2, 364, 52, 1, 52 },
672 { 75, 3, 0, 0, 1, 0 },
673 { 75, 4, 1, 0, 1, 0 },
674 { 75, 5, 2, 0, 1, 0 },
675 { 75, 6, 3, 0, 1, 0 },
676 { 75, 0, 4, 1, 1, 0 },
677 { 75, 1, 5, 1, 2, 1 },
678 { 75, 2, 6, 1, 2, 1 },
679 { 75, 3, 357, 51, 52, 51 },
680 { 75, 4, 358, 51, 52, 51 },
681 { 75, 5, 359, 51, 52, 51 },
682 { 75, 6, 360, 51, 52, 51 },
683 { 75, 0, 361, 52, 52, 51 },
684 { 75, 1, 362, 52, 1, 52 },
685 { 75, 2, 363, 52, 1, 52 },
686 { 75, 3, 364, 52, 1, 52 },
687 { 76, 4, 0, 0, 1, 0 },
688 { 76, 5, 1, 0, 1, 0 },
689 { 76, 6, 2, 0, 1, 0 },
690 { 76, 0, 3, 1, 1, 0 },
691 { 76, 1, 4, 1, 2, 1 },
692 { 76, 2, 5, 1, 2, 1 },
693 { 76, 3, 6, 1, 2, 1 },
694 { 76, 5, 358, 51, 52, 51 },
695 { 76, 6, 359, 51, 52, 51 },
696 { 76, 0, 360, 52, 52, 51 },
697 { 76, 1, 361, 52, 53, 52 },
698 { 76, 2, 362, 52, 53, 52 },
699 { 76, 3, 363, 52, 53, 52 },
700 { 76, 4, 364, 52, 53, 52 },
701 { 76, 5, 365, 52, 53, 52 },
702 { 77, 6, 0, 0, 53, 0 },
703 { 77, 0, 1, 1, 53, 0 },
704 { 77, 1, 2, 1, 1, 1 },
705 { 77, 2, 3, 1, 1, 1 },
706 { 77, 3, 4, 1, 1, 1 },
707 { 77, 4, 5, 1, 1, 1 },
708 { 77, 5, 6, 1, 1, 1 },
709 { 77, 6, 357, 51, 51, 51 },
710 { 77, 0, 358, 52, 51, 51 },
711 { 77, 1, 359, 52, 52, 52 },
712 { 77, 2, 360, 52, 52, 52 },
713 { 77, 3, 361, 52, 52, 52 },
714 { 77, 4, 362, 52, 52, 52 },
715 { 77, 5, 363, 52, 52, 52 },
716 { 77, 6, 364, 52, 52, 52 },
717 { 78, 0, 0, 1, 52, 0 },
718 { 78, 1, 1, 1, 1, 1 },
719 { 78, 2, 2, 1, 1, 1 },
720 { 78, 3, 3, 1, 1, 1 },
721 { 78, 4, 4, 1, 1, 1 },
722 { 78, 5, 5, 1, 1, 1 },
723 { 78, 6, 6, 1, 1, 1 },
724 { 78, 0, 357, 52, 51, 51 },
725 { 78, 1, 358, 52, 52, 52 },
726 { 78, 2, 359, 52, 52, 52 },
727 { 78, 3, 360, 52, 52, 52 },
728 { 78, 4, 361, 52, 52, 52 },
729 { 78, 5, 362, 52, 52, 52 },
730 { 78, 6, 363, 52, 52, 52 },
731 { 78, 0, 364, 53, 52, 52 },
732 { 79, 1, 0, 0, 1, 1 },
733 { 79, 2, 1, 0, 1, 1 },
734 { 79, 3, 2, 0, 1, 1 },
735 { 79, 4, 3, 0, 1, 1 },
736 { 79, 5, 4, 0, 1, 1 },
737 { 79, 6, 5, 0, 1, 1 },
738 { 79, 0, 6, 1, 1, 1 },
739 { 79, 1, 357, 51, 52, 52 },
740 { 79, 2, 358, 51, 52, 52 },
741 { 79, 3, 359, 51, 52, 52 },
742 { 79, 4, 360, 51, 52, 52 },
743 { 79, 5, 361, 51, 52, 52 },
744 { 79, 6, 362, 51, 52, 52 },
745 { 79, 0, 363, 52, 52, 52 },
746 { 79, 1, 364, 52, 1, 53 },
747 { 80, 2, 0, 0, 1, 0 },
748 { 80, 3, 1, 0, 1, 0 },
749 { 80, 4, 2, 0, 1, 0 },
750 { 80, 5, 3, 0, 1, 0 },
751 { 80, 6, 4, 0, 1, 0 },
752 { 80, 0, 5, 1, 1, 0 },
753 { 80, 1, 6, 1, 2, 1 },
754 { 80, 3, 358, 51, 52, 51 },
755 { 80, 4, 359, 51, 52, 51 },
756 { 80, 5, 360, 51, 52, 51 },
757 { 80, 6, 361, 51, 52, 51 },
758 { 80, 0, 362, 52, 52, 51 },
759 { 80, 1, 363, 52, 1, 52 },
760 { 80, 2, 364, 52, 1, 52 },
761 { 80, 3, 365, 52, 1, 52 },
762 { 81, 4, 0, 0, 1, 0 },
763 { 81, 5, 1, 0, 1, 0 },
764 { 81, 6, 2, 0, 1, 0 },
765 { 81, 0, 3, 1, 1, 0 },
766 { 81, 1, 4, 1, 2, 1 },
767 { 81, 2, 5, 1, 2, 1 },
768 { 81, 3, 6, 1, 2, 1 },
769 { 81, 4, 357, 51, 52, 51 },
770 { 81, 5, 358, 51, 52, 51 },
771 { 81, 6, 359, 51, 52, 51 },
772 { 81, 0, 360, 52, 52, 51 },
773 { 81, 1, 361, 52, 53, 52 },
774 { 81, 2, 362, 52, 53, 52 },
775 { 81, 3, 363, 52, 53, 52 },
776 { 81, 4, 364, 52, 53, 52 },
777 { 82, 5, 0, 0, 53, 0 },
778 { 82, 6, 1, 0, 53, 0 },
779 { 82, 0, 2, 1, 53, 0 },
780 { 82, 1, 3, 1, 1, 1 },
781 { 82, 2, 4, 1, 1, 1 },
782 { 82, 3, 5, 1, 1, 1 },
783 { 82, 4, 6, 1, 1, 1 },
784 { 82, 5, 357, 51, 51, 51 },
785 { 82, 6, 358, 51, 51, 51 },
786 { 82, 0, 359, 52, 51, 51 },
787 { 82, 1, 360, 52, 52, 52 },
788 { 82, 2, 361, 52, 52, 52 },
789 { 82, 3, 362, 52, 52, 52 },
790 { 82, 4, 363, 52, 52, 52 },
791 { 82, 5, 364, 52, 52, 52 },
792 { 83, 6, 0, 0, 52, 0 },
793 { 83, 0, 1, 1, 52, 0 },
794 { 83, 1, 2, 1, 1, 1 },
795 { 83, 2, 3, 1, 1, 1 },
796 { 83, 3, 4, 1, 1, 1 },
797 { 83, 4, 5, 1, 1, 1 },
798 { 83, 5, 6, 1, 1, 1 },
799 { 83, 6, 357, 51, 51, 51 },
800 { 83, 0, 358, 52, 51, 51 },
801 { 83, 1, 359, 52, 52, 52 },
802 { 83, 2, 360, 52, 52, 52 },
803 { 83, 3, 361, 52, 52, 52 },
804 { 83, 4, 362, 52, 52, 52 },
805 { 83, 5, 363, 52, 52, 52 },
806 { 83, 6, 364, 52, 52, 52 },
807 { 84, 0, 0, 1, 52, 0 },
808 { 84, 1, 1, 1, 1, 1 },
809 { 84, 2, 2, 1, 1, 1 },
810 { 84, 3, 3, 1, 1, 1 },
811 { 84, 4, 4, 1, 1, 1 },
812 { 84, 5, 5, 1, 1, 1 },
813 { 84, 6, 6, 1, 1, 1 },
814 { 84, 1, 358, 52, 52, 52 },
815 { 84, 2, 359, 52, 52, 52 },
816 { 84, 3, 360, 52, 52, 52 },
817 { 84, 4, 361, 52, 52, 52 },
818 { 84, 5, 362, 52, 52, 52 },
819 { 84, 6, 363, 52, 52, 52 },
820 { 84, 0, 364, 53, 52, 52 },
821 { 84, 1, 365, 53, 1, 53 },
822 { 85, 2, 0, 0, 1, 0 },
823 { 85, 3, 1, 0, 1, 0 },
824 { 85, 4, 2, 0, 1, 0 },
825 { 85, 5, 3, 0, 1, 0 },
826 { 85, 6, 4, 0, 1, 0 },
827 { 85, 0, 5, 1, 1, 0 },
828 { 85, 1, 6, 1, 2, 1 },
829 { 85, 2, 357, 51, 52, 51 },
830 { 85, 3, 358, 51, 52, 51 },
831 { 85, 4, 359, 51, 52, 51 },
832 { 85, 5, 360, 51, 52, 51 },
833 { 85, 6, 361, 51, 52, 51 },
834 { 85, 0, 362, 52, 52, 51 },
835 { 85, 1, 363, 52, 1, 52 },
836 { 85, 2, 364, 52, 1, 52 },
837 { 86, 3, 0, 0, 1, 0 },
838 { 86, 4, 1, 0, 1, 0 },
839 { 86, 5, 2, 0, 1, 0 },
840 { 86, 6, 3, 0, 1, 0 },
841 { 86, 0, 4, 1, 1, 0 },
842 { 86, 1, 5, 1, 2, 1 },
843 { 86, 2, 6, 1, 2, 1 },
844 { 86, 3, 357, 51, 52, 51 },
845 { 86, 4, 358, 51, 52, 51 },
846 { 86, 5, 359, 51, 52, 51 },
847 { 86, 6, 360, 51, 52, 51 },
848 { 86, 0, 361, 52, 52, 51 },
849 { 86, 1, 362, 52, 1, 52 },
850 { 86, 2, 363, 52, 1, 52 },
851 { 86, 3, 364, 52, 1, 52 },
852 { 87, 4, 0, 0, 1, 0 },
853 { 87, 5, 1, 0, 1, 0 },
854 { 87, 6, 2, 0, 1, 0 },
855 { 87, 0, 3, 1, 1, 0 },
856 { 87, 1, 4, 1, 2, 1 },
857 { 87, 2, 5, 1, 2, 1 },
858 { 87, 3, 6, 1, 2, 1 },
859 { 87, 4, 357, 51, 52, 51 },
860 { 87, 5, 358, 51, 52, 51 },
861 { 87, 6, 359, 51, 52, 51 },
862 { 87, 0, 360, 52, 52, 51 },
863 { 87, 1, 361, 52, 53, 52 },
864 { 87, 2, 362, 52, 53, 52 },
865 { 87, 3, 363, 52, 53, 52 },
866 { 87, 4, 364, 52, 53, 52 },
867 { 88, 5, 0, 0, 53, 0 },
868 { 88, 6, 1, 0, 53, 0 },
869 { 88, 0, 2, 1, 53, 0 },
870 { 88, 1, 3, 1, 1, 1 },
871 { 88, 2, 4, 1, 1, 1 },
872 { 88, 3, 5, 1, 1, 1 },
873 { 88, 4, 6, 1, 1, 1 },
874 { 88, 6, 358, 51, 51, 51 },
875 { 88, 0, 359, 52, 51, 51 },
876 { 88, 1, 360, 52, 52, 52 },
877 { 88, 2, 361, 52, 52, 52 },
878 { 88, 3, 362, 52, 52, 52 },
879 { 88, 4, 363, 52, 52, 52 },
880 { 88, 5, 364, 52, 52, 52 },
881 { 88, 6, 365, 52, 52, 52 },
882 { 89, 0, 0, 1, 52, 0 },
883 { 89, 1, 1, 1, 1, 1 },
884 { 89, 2, 2, 1, 1, 1 },
885 { 89, 3, 3, 1, 1, 1 },
886 { 89, 4, 4, 1, 1, 1 },
887 { 89, 5, 5, 1, 1, 1 },
888 { 89, 6, 6, 1, 1, 1 },
889 { 89, 0, 357, 52, 51, 51 },
890 { 89, 1, 358, 52, 52, 52 },
891 { 89, 2, 359, 52, 52, 52 },
892 { 89, 3, 360, 52, 52, 52 },
893 { 89, 4, 361, 52, 52, 52 },
894 { 89, 5, 362, 52, 52, 52 },
895 { 89, 6, 363, 52, 52, 52 },
896 { 89, 0, 364, 53, 52, 52 },
897 { 90, 1, 0, 0, 1, 1 },
898 { 90, 2, 1, 0, 1, 1 },
899 { 90, 3, 2, 0, 1, 1 },
900 { 90, 4, 3, 0, 1, 1 },
901 { 90, 5, 4, 0, 1, 1 },
902 { 90, 6, 5, 0, 1, 1 },
903 { 90, 0, 6, 1, 1, 1 },
904 { 90, 1, 357, 51, 52, 52 },
905 { 90, 2, 358, 51, 52, 52 },
906 { 90, 3, 359, 51, 52, 52 },
907 { 90, 4, 360, 51, 52, 52 },
908 { 90, 5, 361, 51, 52, 52 },
909 { 90, 6, 362, 51, 52, 52 },
910 { 90, 0, 363, 52, 52, 52 },
911 { 90, 1, 364, 52, 1, 53 },
912 { 91, 2, 0, 0, 1, 0 },
913 { 91, 3, 1, 0, 1, 0 },
914 { 91, 4, 2, 0, 1, 0 },
915 { 91, 5, 3, 0, 1, 0 },
916 { 91, 6, 4, 0, 1, 0 },
917 { 91, 0, 5, 1, 1, 0 },
918 { 91, 1, 6, 1, 2, 1 },
919 { 91, 2, 357, 51, 52, 51 },
920 { 91, 3, 358, 51, 52, 51 },
921 { 91, 4, 359, 51, 52, 51 },
922 { 91, 5, 360, 51, 52, 51 },
923 { 91, 6, 361, 51, 52, 51 },
924 { 91, 0, 362, 52, 52, 51 },
925 { 91, 1, 363, 52, 1, 52 },
926 { 91, 2, 364, 52, 1, 52 },
927 { 92, 3, 0, 0, 1, 0 },
928 { 92, 4, 1, 0, 1, 0 },
929 { 92, 5, 2, 0, 1, 0 },
930 { 92, 6, 3, 0, 1, 0 },
931 { 92, 0, 4, 1, 1, 0 },
932 { 92, 1, 5, 1, 2, 1 },
933 { 92, 2, 6, 1, 2, 1 },
934 { 92, 4, 358, 51, 52, 51 },
935 { 92, 5, 359, 51, 52, 51 },
936 { 92, 6, 360, 51, 52, 51 },
937 { 92, 0, 361, 52, 52, 51 },
938 { 92, 1, 362, 52, 53, 52 },
939 { 92, 2, 363, 52, 53, 52 },
940 { 92, 3, 364, 52, 53, 52 },
941 { 92, 4, 365, 52, 53, 52 },
942 { 93, 5, 0, 0, 53, 0 },
943 { 93, 6, 1, 0, 53, 0 },
944 { 93, 0, 2, 1, 53, 0 },
945 { 93, 1, 3, 1, 1, 1 },
946 { 93, 2, 4, 1, 1, 1 },
947 { 93, 3, 5, 1, 1, 1 },
948 { 93, 4, 6, 1, 1, 1 },
949 { 93, 5, 357, 51, 51, 51 },
950 { 93, 6, 358, 51, 51, 51 },
951 { 93, 0, 359, 52, 51, 51 },
952 { 93, 1, 360, 52, 52, 52 },
953 { 93, 2, 361, 52, 52, 52 },
954 { 93, 3, 362, 52, 52, 52 },
955 { 93, 4, 363, 52, 52, 52 },
956 { 93, 5, 364, 52, 52, 52 },
957 { 94, 6, 0, 0, 52, 0 },
958 { 94, 0, 1, 1, 52, 0 },
959 { 94, 1, 2, 1, 1, 1 },
960 { 94, 2, 3, 1, 1, 1 },
961 { 94, 3, 4, 1, 1, 1 },
962 { 94, 4, 5, 1, 1, 1 },
963 { 94, 5, 6, 1, 1, 1 },
964 { 94, 6, 357, 51, 51, 51 },
965 { 94, 0, 358, 52, 51, 51 },
966 { 94, 1, 359, 52, 52, 52 },
967 { 94, 2, 360, 52, 52, 52 },
968 { 94, 3, 361, 52, 52, 52 },
969 { 94, 4, 362, 52, 52, 52 },
970 { 94, 5, 363, 52, 52, 52 },
971 { 94, 6, 364, 52, 52, 52 },
972 { 95, 0, 0, 1, 52, 0 },
973 { 95, 1, 1, 1, 1, 1 },
974 { 95, 2, 2, 1, 1, 1 },
975 { 95, 3, 3, 1, 1, 1 },
976 { 95, 4, 4, 1, 1, 1 },
977 { 95, 5, 5, 1, 1, 1 },
978 { 95, 6, 6, 1, 1, 1 },
979 { 95, 0, 357, 52, 51, 51 },
980 { 95, 1, 358, 52, 52, 52 },
981 { 95, 2, 359, 52, 52, 52 },
982 { 95, 3, 360, 52, 52, 52 },
983 { 95, 4, 361, 52, 52, 52 },
984 { 95, 5, 362, 52, 52, 52 },
985 { 95, 6, 363, 52, 52, 52 },
986 { 95, 0, 364, 53, 52, 52 },
987 { 96, 1, 0, 0, 1, 1 },
988 { 96, 2, 1, 0, 1, 1 },
989 { 96, 3, 2, 0, 1, 1 },
990 { 96, 4, 3, 0, 1, 1 },
991 { 96, 5, 4, 0, 1, 1 },
992 { 96, 6, 5, 0, 1, 1 },
993 { 96, 0, 6, 1, 1, 1 },
994 { 96, 2, 358, 51, 52, 52 },
995 { 96, 3, 359, 51, 52, 52 },
996 { 96, 4, 360, 51, 52, 52 },
997 { 96, 5, 361, 51, 52, 52 },
998 { 96, 6, 362, 51, 52, 52 },
999 { 96, 0, 363, 52, 52, 52 },
1000 { 96, 1, 364, 52, 1, 53 },
1001 { 96, 2, 365, 52, 1, 53 },
1002 { 97, 3, 0, 0, 1, 0 },
1003 { 97, 4, 1, 0, 1, 0 },
1004 { 97, 5, 2, 0, 1, 0 },
1005 { 97, 6, 3, 0, 1, 0 },
1006 { 97, 0, 4, 1, 1, 0 },
1007 { 97, 1, 5, 1, 2, 1 },
1008 { 97, 2, 6, 1, 2, 1 },
1009 { 97, 3, 357, 51, 52, 51 },
1010 { 97, 4, 358, 51, 52, 51 },
1011 { 97, 5, 359, 51, 52, 51 },
1012 { 97, 6, 360, 51, 52, 51 },
1013 { 97, 0, 361, 52, 52, 51 },
1014 { 97, 1, 362, 52, 1, 52 },
1015 { 97, 2, 363, 52, 1, 52 },
1016 { 97, 3, 364, 52, 1, 52 },
1017 { 98, 4, 0, 0, 1, 0 },
1018 { 98, 5, 1, 0, 1, 0 },
1019 { 98, 6, 2, 0, 1, 0 },
1020 { 98, 0, 3, 1, 1, 0 },
1021 { 98, 1, 4, 1, 2, 1 },
1022 { 98, 2, 5, 1, 2, 1 },
1023 { 98, 3, 6, 1, 2, 1 },
1024 { 98, 4, 357, 51, 52, 51 },
1025 { 98, 5, 358, 51, 52, 51 },
1026 { 98, 6, 359, 51, 52, 51 },
1027 { 98, 0, 360, 52, 52, 51 },
1028 { 98, 1, 361, 52, 53, 52 },
1029 { 98, 2, 362, 52, 53, 52 },
1030 { 98, 3, 363, 52, 53, 52 },
1031 { 98, 4, 364, 52, 53, 52 },
1032 { 99, 5, 0, 0, 53, 0 },
1033 { 99, 6, 1, 0, 53, 0 },
1034 { 99, 0, 2, 1, 53, 0 },
1035 { 99, 1, 3, 1, 1, 1 },
1036 { 99, 2, 4, 1, 1, 1 },
1037 { 99, 3, 5, 1, 1, 1 },
1038 { 99, 4, 6, 1, 1, 1 },
1039 { 99, 5, 357, 51, 51, 51 },
1040 { 99, 6, 358, 51, 51, 51 },
1041 { 99, 0, 359, 52, 51, 51 },
1042 { 99, 1, 360, 52, 52, 52 },
1043 { 99, 2, 361, 52, 52, 52 },
1044 { 99, 3, 362, 52, 52, 52 },
1045 { 99, 4, 363, 52, 52, 52 },
1046 { 99, 5, 364, 52, 52, 52 },
1047 { 100, 6, 0, 0, 52, 0 },
1048 { 100, 0, 1, 1, 52, 0 },
1049 { 100, 1, 2, 1, 1, 1 },
1050 { 100, 2, 3, 1, 1, 1 },
1051 { 100, 3, 4, 1, 1, 1 },
1052 { 100, 4, 5, 1, 1, 1 },
1053 { 100, 5, 6, 1, 1, 1 },
1054 { 100, 0, 358, 52, 51, 51 },
1055 { 100, 1, 359, 52, 52, 52 },
1056 { 100, 2, 360, 52, 52, 52 },
1057 { 100, 3, 361, 52, 52, 52 },
1058 { 100, 4, 362, 52, 52, 52 },
1059 { 100, 5, 363, 52, 52, 52 },
1060 { 100, 6, 364, 52, 52, 52 },
1061 { 100, 0, 365, 53, 52, 52 },
1062 { 101, 1, 0, 0, 1, 1 },
1063 { 101, 2, 1, 0, 1, 1 },
1064 { 101, 3, 2, 0, 1, 1 },
1065 { 101, 4, 3, 0, 1, 1 },
1066 { 101, 5, 4, 0, 1, 1 },
1067 { 101, 6, 5, 0, 1, 1 },
1068 { 101, 0, 6, 1, 1, 1 },
1069 { 101, 1, 357, 51, 52, 52 },
1070 { 101, 2, 358, 51, 52, 52 },
1071 { 101, 3, 359, 51, 52, 52 },
1072 { 101, 4, 360, 51, 52, 52 },
1073 { 101, 5, 361, 51, 52, 52 },
1074 { 101, 6, 362, 51, 52, 52 },
1075 { 101, 0, 363, 52, 52, 52 },
1076 { 101, 1, 364, 52, 1, 53 },
1077 { 102, 2, 0, 0, 1, 0 },
1078 { 102, 3, 1, 0, 1, 0 },
1079 { 102, 4, 2, 0, 1, 0 },
1080 { 102, 5, 3, 0, 1, 0 },
1081 { 102, 6, 4, 0, 1, 0 },
1082 { 102, 0, 5, 1, 1, 0 },
1083 { 102, 1, 6, 1, 2, 1 },
1084 { 102, 2, 357, 51, 52, 51 },
1085 { 102, 3, 358, 51, 52, 51 },
1086 { 102, 4, 359, 51, 52, 51 },
1087 { 102, 5, 360, 51, 52, 51 },
1088 { 102, 6, 361, 51, 52, 51 },
1089 { 102, 0, 362, 52, 52, 51 },
1090 { 102, 1, 363, 52, 1, 52 },
1091 { 102, 2, 364, 52, 1, 52 },
1092 { 103, 3, 0, 0, 1, 0 },
1093 { 103, 4, 1, 0, 1, 0 },
1094 { 103, 5, 2, 0, 1, 0 },
1095 { 103, 6, 3, 0, 1, 0 },
1096 { 103, 0, 4, 1, 1, 0 },
1097 { 103, 1, 5, 1, 2, 1 },
1098 { 103, 2, 6, 1, 2, 1 },
1099 { 103, 3, 357, 51, 52, 51 },
1100 { 103, 4, 358, 51, 52, 51 },
1101 { 103, 5, 359, 51, 52, 51 },
1102 { 103, 6, 360, 51, 52, 51 },
1103 { 103, 0, 361, 52, 52, 51 },
1104 { 103, 1, 362, 52, 1, 52 },
1105 { 103, 2, 363, 52, 1, 52 },
1106 { 103, 3, 364, 52, 1, 52 },
1107 { 104, 4, 0, 0, 1, 0 },
1108 { 104, 5, 1, 0, 1, 0 },
1109 { 104, 6, 2, 0, 1, 0 },
1110 { 104, 0, 3, 1, 1, 0 },
1111 { 104, 1, 4, 1, 2, 1 },
1112 { 104, 2, 5, 1, 2, 1 },
1113 { 104, 3, 6, 1, 2, 1 },
1114 { 104, 5, 358, 51, 52, 51 },
1115 { 104, 6, 359, 51, 52, 51 },
1116 { 104, 0, 360, 52, 52, 51 },
1117 { 104, 1, 361, 52, 53, 52 },
1118 { 104, 2, 362, 52, 53, 52 },
1119 { 104, 3, 363, 52, 53, 52 },
1120 { 104, 4, 364, 52, 53, 52 },
1121 { 104, 5, 365, 52, 53, 52 },
1122 { 105, 6, 0, 0, 53, 0 },
1123 { 105, 0, 1, 1, 53, 0 },
1124 { 105, 1, 2, 1, 1, 1 },
1125 { 105, 2, 3, 1, 1, 1 },
1126 { 105, 3, 4, 1, 1, 1 },
1127 { 105, 4, 5, 1, 1, 1 },
1128 { 105, 5, 6, 1, 1, 1 },
1129 { 105, 6, 357, 51, 51, 51 },
1130 { 105, 0, 358, 52, 51, 51 },
1131 { 105, 1, 359, 52, 52, 52 },
1132 { 105, 2, 360, 52, 52, 52 },
1133 { 105, 3, 361, 52, 52, 52 },
1134 { 105, 4, 362, 52, 52, 52 },
1135 { 105, 5, 363, 52, 52, 52 },
1136 { 105, 6, 364, 52, 52, 52 },
1137 { 106, 0, 0, 1, 52, 0 },
1138 { 106, 1, 1, 1, 1, 1 },
1139 { 106, 2, 2, 1, 1, 1 },
1140 { 106, 3, 3, 1, 1, 1 },
1141 { 106, 4, 4, 1, 1, 1 },
1142 { 106, 5, 5, 1, 1, 1 },
1143 { 106, 6, 6, 1, 1, 1 },
1144 { 106, 0, 357, 52, 51, 51 },
1145 { 106, 1, 358, 52, 52, 52 },
1146 { 106, 2, 359, 52, 52, 52 },
1147 { 106, 3, 360, 52, 52, 52 },
1148 { 106, 4, 361, 52, 52, 52 },
1149 { 106, 5, 362, 52, 52, 52 },
1150 { 106, 6, 363, 52, 52, 52 },
1151 { 106, 0, 364, 53, 52, 52 },
1152 { 107, 1, 0, 0, 1, 1 },
1153 { 107, 2, 1, 0, 1, 1 },
1154 { 107, 3, 2, 0, 1, 1 },
1155 { 107, 4, 3, 0, 1, 1 },
1156 { 107, 5, 4, 0, 1, 1 },
1157 { 107, 6, 5, 0, 1, 1 },
1158 { 107, 0, 6, 1, 1, 1 },
1159 { 107, 1, 357, 51, 52, 52 },
1160 { 107, 2, 358, 51, 52, 52 },
1161 { 107, 3, 359, 51, 52, 52 },
1162 { 107, 4, 360, 51, 52, 52 },
1163 { 107, 5, 361, 51, 52, 52 },
1164 { 107, 6, 362, 51, 52, 52 },
1165 { 107, 0, 363, 52, 52, 52 },
1166 { 107, 1, 364, 52, 1, 53 },
1167 { 108, 2, 0, 0, 1, 0 },
1168 { 108, 3, 1, 0, 1, 0 },
1169 { 108, 4, 2, 0, 1, 0 },
1170 { 108, 5, 3, 0, 1, 0 },
1171 { 108, 6, 4, 0, 1, 0 },
1172 { 108, 0, 5, 1, 1, 0 },
1173 { 108, 1, 6, 1, 2, 1 },
1174 { 108, 3, 358, 51, 52, 51 },
1175 { 108, 4, 359, 51, 52, 51 },
1176 { 108, 5, 360, 51, 52, 51 },
1177 { 108, 6, 361, 51, 52, 51 },
1178 { 108, 0, 362, 52, 52, 51 },
1179 { 108, 1, 363, 52, 1, 52 },
1180 { 108, 2, 364, 52, 1, 52 },
1181 { 108, 3, 365, 52, 1, 52 },
1182 { 109, 4, 0, 0, 1, 0 },
1183 { 109, 5, 1, 0, 1, 0 },
1184 { 109, 6, 2, 0, 1, 0 },
1185 { 109, 0, 3, 1, 1, 0 },
1186 { 109, 1, 4, 1, 2, 1 },
1187 { 109, 2, 5, 1, 2, 1 },
1188 { 109, 3, 6, 1, 2, 1 },
1189 { 109, 4, 357, 51, 52, 51 },
1190 { 109, 5, 358, 51, 52, 51 },
1191 { 109, 6, 359, 51, 52, 51 },
1192 { 109, 0, 360, 52, 52, 51 },
1193 { 109, 1, 361, 52, 53, 52 },
1194 { 109, 2, 362, 52, 53, 52 },
1195 { 109, 3, 363, 52, 53, 52 },
1196 { 109, 4, 364, 52, 53, 52 },
1197 { 110, 5, 0, 0, 53, 0 },
1198 { 110, 6, 1, 0, 53, 0 },
1199 { 110, 0, 2, 1, 53, 0 },
1200 { 110, 1, 3, 1, 1, 1 },
1201 { 110, 2, 4, 1, 1, 1 },
1202 { 110, 3, 5, 1, 1, 1 },
1203 { 110, 4, 6, 1, 1, 1 },
1204 { 110, 5, 357, 51, 51, 51 },
1205 { 110, 6, 358, 51, 51, 51 },
1206 { 110, 0, 359, 52, 51, 51 },
1207 { 110, 1, 360, 52, 52, 52 },
1208 { 110, 2, 361, 52, 52, 52 },
1209 { 110, 3, 362, 52, 52, 52 },
1210 { 110, 4, 363, 52, 52, 52 },
1211 { 110, 5, 364, 52, 52, 52 },
1212 { 111, 6, 0, 0, 52, 0 },
1213 { 111, 0, 1, 1, 52, 0 },
1214 { 111, 1, 2, 1, 1, 1 },
1215 { 111, 2, 3, 1, 1, 1 },
1216 { 111, 3, 4, 1, 1, 1 },
1217 { 111, 4, 5, 1, 1, 1 },
1218 { 111, 5, 6, 1, 1, 1 },
1219 { 111, 6, 357, 51, 51, 51 },
1220 { 111, 0, 358, 52, 51, 51 },
1221 { 111, 1, 359, 52, 52, 52 },
1222 { 111, 2, 360, 52, 52, 52 },
1223 { 111, 3, 361, 52, 52, 52 },
1224 { 111, 4, 362, 52, 52, 52 },
1225 { 111, 5, 363, 52, 52, 52 },
1226 { 111, 6, 364, 52, 52, 52 },
1227 { 112, 0, 0, 1, 52, 0 },
1228 { 112, 1, 1, 1, 1, 1 },
1229 { 112, 2, 2, 1, 1, 1 },
1230 { 112, 3, 3, 1, 1, 1 },
1231 { 112, 4, 4, 1, 1, 1 },
1232 { 112, 5, 5, 1, 1, 1 },
1233 { 112, 6, 6, 1, 1, 1 },
1234 { 112, 1, 358, 52, 52, 52 },
1235 { 112, 2, 359, 52, 52, 52 },
1236 { 112, 3, 360, 52, 52, 52 },
1237 { 112, 4, 361, 52, 52, 52 },
1238 { 112, 5, 362, 52, 52, 52 },
1239 { 112, 6, 363, 52, 52, 52 },
1240 { 112, 0, 364, 53, 52, 52 },
1241 { 112, 1, 365, 53, 1, 53 },
1242 { 113, 2, 0, 0, 1, 0 },
1243 { 113, 3, 1, 0, 1, 0 },
1244 { 113, 4, 2, 0, 1, 0 },
1245 { 113, 5, 3, 0, 1, 0 },
1246 { 113, 6, 4, 0, 1, 0 },
1247 { 113, 0, 5, 1, 1, 0 },
1248 { 113, 1, 6, 1, 2, 1 },
1249 { 113, 2, 357, 51, 52, 51 },
1250 { 113, 3, 358, 51, 52, 51 },
1251 { 113, 4, 359, 51, 52, 51 },
1252 { 113, 5, 360, 51, 52, 51 },
1253 { 113, 6, 361, 51, 52, 51 },
1254 { 113, 0, 362, 52, 52, 51 },
1255 { 113, 1, 363, 52, 1, 52 },
1256 { 113, 2, 364, 52, 1, 52 },
1257 { 114, 3, 0, 0, 1, 0 },
1258 { 114, 4, 1, 0, 1, 0 },
1259 { 114, 5, 2, 0, 1, 0 },
1260 { 114, 6, 3, 0, 1, 0 },
1261 { 114, 0, 4, 1, 1, 0 },
1262 { 114, 1, 5, 1, 2, 1 },
1263 { 114, 2, 6, 1, 2, 1 },
1264 { 114, 3, 357, 51, 52, 51 },
1265 { 114, 4, 358, 51, 52, 51 },
1266 { 114, 5, 359, 51, 52, 51 },
1267 { 114, 6, 360, 51, 52, 51 },
1268 { 114, 0, 361, 52, 52, 51 },
1269 { 114, 1, 362, 52, 1, 52 },
1270 { 114, 2, 363, 52, 1, 52 },
1271 { 114, 3, 364, 52, 1, 52 },
1272 { 115, 4, 0, 0, 1, 0 },
1273 { 115, 5, 1, 0, 1, 0 },
1274 { 115, 6, 2, 0, 1, 0 },
1275 { 115, 0, 3, 1, 1, 0 },
1276 { 115, 1, 4, 1, 2, 1 },
1277 { 115, 2, 5, 1, 2, 1 },
1278 { 115, 3, 6, 1, 2, 1 },
1279 { 115, 4, 357, 51, 52, 51 },
1280 { 115, 5, 358, 51, 52, 51 },
1281 { 115, 6, 359, 51, 52, 51 },
1282 { 115, 0, 360, 52, 52, 51 },
1283 { 115, 1, 361, 52, 53, 52 },
1284 { 115, 2, 362, 52, 53, 52 },
1285 { 115, 3, 363, 52, 53, 52 },
1286 { 115, 4, 364, 52, 53, 52 },
1287 { 116, 5, 0, 0, 53, 0 },
1288 { 116, 6, 1, 0, 53, 0 },
1289 { 116, 0, 2, 1, 53, 0 },
1290 { 116, 1, 3, 1, 1, 1 },
1291 { 116, 2, 4, 1, 1, 1 },
1292 { 116, 3, 5, 1, 1, 1 },
1293 { 116, 4, 6, 1, 1, 1 },
1294 { 116, 6, 358, 51, 51, 51 },
1295 { 116, 0, 359, 52, 51, 51 },
1296 { 116, 1, 360, 52, 52, 52 },
1297 { 116, 2, 361, 52, 52, 52 },
1298 { 116, 3, 362, 52, 52, 52 },
1299 { 116, 4, 363, 52, 52, 52 },
1300 { 116, 5, 364, 52, 52, 52 },
1301 { 116, 6, 365, 52, 52, 52 },
1302 { 117, 0, 0, 1, 52, 0 },
1303 { 117, 1, 1, 1, 1, 1 },
1304 { 117, 2, 2, 1, 1, 1 },
1305 { 117, 3, 3, 1, 1, 1 },
1306 { 117, 4, 4, 1, 1, 1 },
1307 { 117, 5, 5, 1, 1, 1 },
1308 { 117, 6, 6, 1, 1, 1 },
1309 { 117, 0, 357, 52, 51, 51 },
1310 { 117, 1, 358, 52, 52, 52 },
1311 { 117, 2, 359, 52, 52, 52 },
1312 { 117, 3, 360, 52, 52, 52 },
1313 { 117, 4, 361, 52, 52, 52 },
1314 { 117, 5, 362, 52, 52, 52 },
1315 { 117, 6, 363, 52, 52, 52 },
1316 { 117, 0, 364, 53, 52, 52 },
1317 { 118, 1, 0, 0, 1, 1 },
1318 { 118, 2, 1, 0, 1, 1 },
1319 { 118, 3, 2, 0, 1, 1 },
1320 { 118, 4, 3, 0, 1, 1 },
1321 { 118, 5, 4, 0, 1, 1 },
1322 { 118, 6, 5, 0, 1, 1 },
1323 { 118, 0, 6, 1, 1, 1 },
1324 { 118, 1, 357, 51, 52, 52 },
1325 { 118, 2, 358, 51, 52, 52 },
1326 { 118, 3, 359, 51, 52, 52 },
1327 { 118, 4, 360, 51, 52, 52 },
1328 { 118, 5, 361, 51, 52, 52 },
1329 { 118, 6, 362, 51, 52, 52 },
1330 { 118, 0, 363, 52, 52, 52 },
1331 { 118, 1, 364, 52, 1, 53 },
1332 { 119, 2, 0, 0, 1, 0 },
1333 { 119, 3, 1, 0, 1, 0 },
1334 { 119, 4, 2, 0, 1, 0 },
1335 { 119, 5, 3, 0, 1, 0 },
1336 { 119, 6, 4, 0, 1, 0 },
1337 { 119, 0, 5, 1, 1, 0 },
1338 { 119, 1, 6, 1, 2, 1 },
1339 { 119, 2, 357, 51, 52, 51 },
1340 { 119, 3, 358, 51, 52, 51 },
1341 { 119, 4, 359, 51, 52, 51 },
1342 { 119, 5, 360, 51, 52, 51 },
1343 { 119, 6, 361, 51, 52, 51 },
1344 { 119, 0, 362, 52, 52, 51 },
1345 { 119, 1, 363, 52, 1, 52 },
1346 { 119, 2, 364, 52, 1, 52 },
1347 { 120, 3, 0, 0, 1, 0 },
1348 { 120, 4, 1, 0, 1, 0 },
1349 { 120, 5, 2, 0, 1, 0 },
1350 { 120, 6, 3, 0, 1, 0 },
1351 { 120, 0, 4, 1, 1, 0 },
1352 { 120, 1, 5, 1, 2, 1 },
1353 { 120, 2, 6, 1, 2, 1 },
1354 { 120, 4, 358, 51, 52, 51 },
1355 { 120, 5, 359, 51, 52, 51 },
1356 { 120, 6, 360, 51, 52, 51 },
1357 { 120, 0, 361, 52, 52, 51 },
1358 { 120, 1, 362, 52, 53, 52 },
1359 { 120, 2, 363, 52, 53, 52 },
1360 { 120, 3, 364, 52, 53, 52 },
1361 { 120, 4, 365, 52, 53, 52 },
1362 { 121, 5, 0, 0, 53, 0 },
1363 { 121, 6, 1, 0, 53, 0 },
1364 { 121, 0, 2, 1, 53, 0 },
1365 { 121, 1, 3, 1, 1, 1 },
1366 { 121, 2, 4, 1, 1, 1 },
1367 { 121, 3, 5, 1, 1, 1 },
1368 { 121, 4, 6, 1, 1, 1 },
1369 { 121, 5, 357, 51, 51, 51 },
1370 { 121, 6, 358, 51, 51, 51 },
1371 { 121, 0, 359, 52, 51, 51 },
1372 { 121, 1, 360, 52, 52, 52 },
1373 { 121, 2, 361, 52, 52, 52 },
1374 { 121, 3, 362, 52, 52, 52 },
1375 { 121, 4, 363, 52, 52, 52 },
1376 { 121, 5, 364, 52, 52, 52 },
1377 { 122, 6, 0, 0, 52, 0 },
1378 { 122, 0, 1, 1, 52, 0 },
1379 { 122, 1, 2, 1, 1, 1 },
1380 { 122, 2, 3, 1, 1, 1 },
1381 { 122, 3, 4, 1, 1, 1 },
1382 { 122, 4, 5, 1, 1, 1 },
1383 { 122, 5, 6, 1, 1, 1 },
1384 { 122, 6, 357, 51, 51, 51 },
1385 { 122, 0, 358, 52, 51, 51 },
1386 { 122, 1, 359, 52, 52, 52 },
1387 { 122, 2, 360, 52, 52, 52 },
1388 { 122, 3, 361, 52, 52, 52 },
1389 { 122, 4, 362, 52, 52, 52 },
1390 { 122, 5, 363, 52, 52, 52 },
1391 { 122, 6, 364, 52, 52, 52 },
1392 { 123, 0, 0, 1, 52, 0 },
1393 { 123, 1, 1, 1, 1, 1 },
1394 { 123, 2, 2, 1, 1, 1 },
1395 { 123, 3, 3, 1, 1, 1 },
1396 { 123, 4, 4, 1, 1, 1 },
1397 { 123, 5, 5, 1, 1, 1 },
1398 { 123, 6, 6, 1, 1, 1 },
1399 { 123, 0, 357, 52, 51, 51 },
1400 { 123, 1, 358, 52, 52, 52 },
1401 { 123, 2, 359, 52, 52, 52 },
1402 { 123, 3, 360, 52, 52, 52 },
1403 { 123, 4, 361, 52, 52, 52 },
1404 { 123, 5, 362, 52, 52, 52 },
1405 { 123, 6, 363, 52, 52, 52 },
1406 { 123, 0, 364, 53, 52, 52 },
1407 { 124, 1, 0, 0, 1, 1 },
1408 { 124, 2, 1, 0, 1, 1 },
1409 { 124, 3, 2, 0, 1, 1 },
1410 { 124, 4, 3, 0, 1, 1 },
1411 { 124, 5, 4, 0, 1, 1 },
1412 { 124, 6, 5, 0, 1, 1 },
1413 { 124, 0, 6, 1, 1, 1 },
1414 { 124, 2, 358, 51, 52, 52 },
1415 { 124, 3, 359, 51, 52, 52 },
1416 { 124, 4, 360, 51, 52, 52 },
1417 { 124, 5, 361, 51, 52, 52 },
1418 { 124, 6, 362, 51, 52, 52 },
1419 { 124, 0, 363, 52, 52, 52 },
1420 { 124, 1, 364, 52, 1, 53 },
1421 { 124, 2, 365, 52, 1, 53 },
1422 { 125, 3, 0, 0, 1, 0 },
1423 { 125, 4, 1, 0, 1, 0 },
1424 { 125, 5, 2, 0, 1, 0 },
1425 { 125, 6, 3, 0, 1, 0 },
1426 { 125, 0, 4, 1, 1, 0 },
1427 { 125, 1, 5, 1, 2, 1 },
1428 { 125, 2, 6, 1, 2, 1 },
1429 { 125, 3, 357, 51, 52, 51 },
1430 { 125, 4, 358, 51, 52, 51 },
1431 { 125, 5, 359, 51, 52, 51 },
1432 { 125, 6, 360, 51, 52, 51 },
1433 { 125, 0, 361, 52, 52, 51 },
1434 { 125, 1, 362, 52, 1, 52 },
1435 { 125, 2, 363, 52, 1, 52 },
1436 { 125, 3, 364, 52, 1, 52 },
1437 { 126, 4, 0, 0, 1, 0 },
1438 { 126, 5, 1, 0, 1, 0 },
1439 { 126, 6, 2, 0, 1, 0 },
1440 { 126, 0, 3, 1, 1, 0 },
1441 { 126, 1, 4, 1, 2, 1 },
1442 { 126, 2, 5, 1, 2, 1 },
1443 { 126, 3, 6, 1, 2, 1 },
1444 { 126, 4, 357, 51, 52, 51 },
1445 { 126, 5, 358, 51, 52, 51 },
1446 { 126, 6, 359, 51, 52, 51 },
1447 { 126, 0, 360, 52, 52, 51 },
1448 { 126, 1, 361, 52, 53, 52 },
1449 { 126, 2, 362, 52, 53, 52 },
1450 { 126, 3, 363, 52, 53, 52 },
1451 { 126, 4, 364, 52, 53, 52 },
1452 { 127, 5, 0, 0, 53, 0 },
1453 { 127, 6, 1, 0, 53, 0 },
1454 { 127, 0, 2, 1, 53, 0 },
1455 { 127, 1, 3, 1, 1, 1 },
1456 { 127, 2, 4, 1, 1, 1 },
1457 { 127, 3, 5, 1, 1, 1 },
1458 { 127, 4, 6, 1, 1, 1 },
1459 { 127, 5, 357, 51, 51, 51 },
1460 { 127, 6, 358, 51, 51, 51 },
1461 { 127, 0, 359, 52, 51, 51 },
1462 { 127, 1, 360, 52, 52, 52 },
1463 { 127, 2, 361, 52, 52, 52 },
1464 { 127, 3, 362, 52, 52, 52 },
1465 { 127, 4, 363, 52, 52, 52 },
1466 { 127, 5, 364, 52, 52, 52 },
1467 { 128, 6, 0, 0, 52, 0 },
1468 { 128, 0, 1, 1, 52, 0 },
1469 { 128, 1, 2, 1, 1, 1 },
1470 { 128, 2, 3, 1, 1, 1 },
1471 { 128, 3, 4, 1, 1, 1 },
1472 { 128, 4, 5, 1, 1, 1 },
1473 { 128, 5, 6, 1, 1, 1 },
1474 { 128, 0, 358, 52, 51, 51 },
1475 { 128, 1, 359, 52, 52, 52 },
1476 { 128, 2, 360, 52, 52, 52 },
1477 { 128, 3, 361, 52, 52, 52 },
1478 { 128, 4, 362, 52, 52, 52 },
1479 { 128, 5, 363, 52, 52, 52 },
1480 { 128, 6, 364, 52, 52, 52 },
1481 { 128, 0, 365, 53, 52, 52 },
1482 { 129, 1, 0, 0, 1, 1 },
1483 { 129, 2, 1, 0, 1, 1 },
1484 { 129, 3, 2, 0, 1, 1 },
1485 { 129, 4, 3, 0, 1, 1 },
1486 { 129, 5, 4, 0, 1, 1 },
1487 { 129, 6, 5, 0, 1, 1 },
1488 { 129, 0, 6, 1, 1, 1 },
1489 { 129, 1, 357, 51, 52, 52 },
1490 { 129, 2, 358, 51, 52, 52 },
1491 { 129, 3, 359, 51, 52, 52 },
1492 { 129, 4, 360, 51, 52, 52 },
1493 { 129, 5, 361, 51, 52, 52 },
1494 { 129, 6, 362, 51, 52, 52 },
1495 { 129, 0, 363, 52, 52, 52 },
1496 { 129, 1, 364, 52, 1, 53 },
1497 { 130, 2, 0, 0, 1, 0 },
1498 { 130, 3, 1, 0, 1, 0 },
1499 { 130, 4, 2, 0, 1, 0 },
1500 { 130, 5, 3, 0, 1, 0 },
1501 { 130, 6, 4, 0, 1, 0 },
1502 { 130, 0, 5, 1, 1, 0 },
1503 { 130, 1, 6, 1, 2, 1 },
1504 { 130, 2, 357, 51, 52, 51 },
1505 { 130, 3, 358, 51, 52, 51 },
1506 { 130, 4, 359, 51, 52, 51 },
1507 { 130, 5, 360, 51, 52, 51 },
1508 { 130, 6, 361, 51, 52, 51 },
1509 { 130, 0, 362, 52, 52, 51 },
1510 { 130, 1, 363, 52, 1, 52 },
1511 { 130, 2, 364, 52, 1, 52 },
1512 { 131, 3, 0, 0, 1, 0 },
1513 { 131, 4, 1, 0, 1, 0 },
1514 { 131, 5, 2, 0, 1, 0 },
1515 { 131, 6, 3, 0, 1, 0 },
1516 { 131, 0, 4, 1, 1, 0 },
1517 { 131, 1, 5, 1, 2, 1 },
1518 { 131, 2, 6, 1, 2, 1 },
1519 { 131, 3, 357, 51, 52, 51 },
1520 { 131, 4, 358, 51, 52, 51 },
1521 { 131, 5, 359, 51, 52, 51 },
1522 { 131, 6, 360, 51, 52, 51 },
1523 { 131, 0, 361, 52, 52, 51 },
1524 { 131, 1, 362, 52, 1, 52 },
1525 { 131, 2, 363, 52, 1, 52 },
1526 { 131, 3, 364, 52, 1, 52 },
1527 { 132, 4, 0, 0, 1, 0 },
1528 { 132, 5, 1, 0, 1, 0 },
1529 { 132, 6, 2, 0, 1, 0 },
1530 { 132, 0, 3, 1, 1, 0 },
1531 { 132, 1, 4, 1, 2, 1 },
1532 { 132, 2, 5, 1, 2, 1 },
1533 { 132, 3, 6, 1, 2, 1 },
1534 { 132, 5, 358, 51, 52, 51 },
1535 { 132, 6, 359, 51, 52, 51 },
1536 { 132, 0, 360, 52, 52, 51 },
1537 { 132, 1, 361, 52, 53, 52 },
1538 { 132, 2, 362, 52, 53, 52 },
1539 { 132, 3, 363, 52, 53, 52 },
1540 { 132, 4, 364, 52, 53, 52 },
1541 { 132, 5, 365, 52, 53, 52 },
1542 { 133, 6, 0, 0, 53, 0 },
1543 { 133, 0, 1, 1, 53, 0 },
1544 { 133, 1, 2, 1, 1, 1 },
1545 { 133, 2, 3, 1, 1, 1 },
1546 { 133, 3, 4, 1, 1, 1 },
1547 { 133, 4, 5, 1, 1, 1 },
1548 { 133, 5, 6, 1, 1, 1 },
1549 { 133, 6, 357, 51, 51, 51 },
1550 { 133, 0, 358, 52, 51, 51 },
1551 { 133, 1, 359, 52, 52, 52 },
1552 { 133, 2, 360, 52, 52, 52 },
1553 { 133, 3, 361, 52, 52, 52 },
1554 { 133, 4, 362, 52, 52, 52 },
1555 { 133, 5, 363, 52, 52, 52 },
1556 { 133, 6, 364, 52, 52, 52 },
1557 { 134, 0, 0, 1, 52, 0 },
1558 { 134, 1, 1, 1, 1, 1 },
1559 { 134, 2, 2, 1, 1, 1 },
1560 { 134, 3, 3, 1, 1, 1 },
1561 { 134, 4, 4, 1, 1, 1 },
1562 { 134, 5, 5, 1, 1, 1 },
1563 { 134, 6, 6, 1, 1, 1 },
1564 { 134, 0, 357, 52, 51, 51 },
1565 { 134, 1, 358, 52, 52, 52 },
1566 { 134, 2, 359, 52, 52, 52 },
1567 { 134, 3, 360, 52, 52, 52 },
1568 { 134, 4, 361, 52, 52, 52 },
1569 { 134, 5, 362, 52, 52, 52 },
1570 { 134, 6, 363, 52, 52, 52 },
1571 { 134, 0, 364, 53, 52, 52 },
1572 { 135, 1, 0, 0, 1, 1 },
1573 { 135, 2, 1, 0, 1, 1 },
1574 { 135, 3, 2, 0, 1, 1 },
1575 { 135, 4, 3, 0, 1, 1 },
1576 { 135, 5, 4, 0, 1, 1 },
1577 { 135, 6, 5, 0, 1, 1 },
1578 { 135, 0, 6, 1, 1, 1 },
1579 { 135, 1, 357, 51, 52, 52 },
1580 { 135, 2, 358, 51, 52, 52 },
1581 { 135, 3, 359, 51, 52, 52 },
1582 { 135, 4, 360, 51, 52, 52 },
1583 { 135, 5, 361, 51, 52, 52 },
1584 { 135, 6, 362, 51, 52, 52 },
1585 { 135, 0, 363, 52, 52, 52 },
1586 { 135, 1, 364, 52, 1, 53 },
1587 { 136, 2, 0, 0, 1, 0 },
1588 { 136, 3, 1, 0, 1, 0 },
1589 { 136, 4, 2, 0, 1, 0 },
1590 { 136, 5, 3, 0, 1, 0 },
1591 { 136, 6, 4, 0, 1, 0 },
1592 { 136, 0, 5, 1, 1, 0 },
1593 { 136, 1, 6, 1, 2, 1 },
1594 { 136, 3, 358, 51, 52, 51 },
1595 { 136, 4, 359, 51, 52, 51 },
1596 { 136, 5, 360, 51, 52, 51 },
1597 { 136, 6, 361, 51, 52, 51 },
1598 { 136, 0, 362, 52, 52, 51 },
1599 { 136, 1, 363, 52, 1, 52 },
1600 { 136, 2, 364, 52, 1, 52 },
1601 { 136, 3, 365, 52, 1, 52 },
1602 { 137, 4, 0, 0, 1, 0 },
1603 { 137, 5, 1, 0, 1, 0 },
1604 { 137, 6, 2, 0, 1, 0 },
1605 { 137, 0, 3, 1, 1, 0 },
1606 { 137, 1, 4, 1, 2, 1 },
1607 { 137, 2, 5, 1, 2, 1 },
1608 { 137, 3, 6, 1, 2, 1 },
1609 { 137, 4, 357, 51, 52, 51 },
1610 { 137, 5, 358, 51, 52, 51 },
1611 { 137, 6, 359, 51, 52, 51 },
1612 { 137, 0, 360, 52, 52, 51 },
1613 { 137, 1, 361, 52, 53, 52 },
1614 { 137, 2, 362, 52, 53, 52 },
1615 { 137, 3, 363, 52, 53, 52 },
1616 { 137, 4, 364, 52, 53, 52 },
1617 };
1618
1619 static int test_week_calc( void )
1620 {
1621     char buffer[100];
1622     int rc = 1;
1623     for ( int i = 0; i < 1020; ++i )
1624     {
1625         struct tm t = { 0 };
1626         t.tm_year = data[i][0];
1627         t.tm_wday = data[i][1];
1628         t.tm_yday = data[i][2];
1629         assert( strftime( buffer, 100, "%U %V %W", &t ) == 8 );
1630         int U, V, W;
1631         assert( sscanf( buffer, "%d %d %d", &U, &V, &W ) == 3 );
1632         if ( data[i][3] != U || data[i][4] != V || data[i][5] != W )
1633         {
1634             printf( "Fehler in { %d, %d, %d, %d, %d, %d } (encountered { %d, %d, %d })\n", data[i][0], data[i][1], data[i][2], data[i][3], data[i][4], data[i][5], U, V, W );
1635             rc = 0;
1636         }
1637     }
1638     return rc;
1639 }
1640
1641 int main( void )
1642 {
1643     char buffer[100];
1644     /* Basic functionality */
1645     struct tm timeptr;
1646     MKTIME( timeptr, 59, 30, 12, 1, 9, 72, 0, 274 );
1647     TESTCASE( strftime( buffer, 100, "%a ", &timeptr ) == 4 );
1648     TESTCASE( strcmp( buffer, "Sun " ) == 0 );
1649     TESTCASE( strftime( buffer, 100, "%A ", &timeptr ) == 7 );
1650     TESTCASE( strcmp( buffer, "Sunday " ) == 0 );
1651     TESTCASE( strftime( buffer, 100, "%b ", &timeptr ) == 4 );
1652     TESTCASE( strcmp( buffer, "Oct " ) == 0 );
1653     TESTCASE( strftime( buffer, 100, "%h ", &timeptr ) == 4 );
1654     TESTCASE( strcmp( buffer, "Oct " ) == 0 );
1655     TESTCASE( strftime( buffer, 100, "%B ", &timeptr ) == 8 );
1656     TESTCASE( strcmp( buffer, "October " ) == 0 );
1657     TESTCASE( strftime( buffer, 100, "%c ", &timeptr ) == 25 );
1658     TESTCASE( strcmp( buffer, "Sun Oct  1 12:30:59 1972 " ) == 0 );
1659     TESTCASE( strftime( buffer, 100, "%C ", &timeptr ) == 3 );
1660     TESTCASE( strcmp( buffer, "19 " ) == 0 );
1661     TESTCASE( strftime( buffer, 100, "%d ", &timeptr ) == 3 );
1662     TESTCASE( strcmp( buffer, "01 " ) == 0 );
1663     TESTCASE( strftime( buffer, 100, "%D ", &timeptr ) == 9 );
1664     TESTCASE( strcmp( buffer, "10/01/72 " ) == 0 );
1665     TESTCASE( strftime( buffer, 100, "%e ", &timeptr ) == 3 );
1666     TESTCASE( strcmp( buffer, " 1 " ) == 0 );
1667     TESTCASE( strftime( buffer, 100, "%F ", &timeptr ) == 11 );
1668     TESTCASE( strcmp( buffer, "1972-10-01 " ) == 0 );
1669     TESTCASE( strftime( buffer, 100, "%H ", &timeptr ) == 3 );
1670     TESTCASE( strcmp( buffer, "12 " ) == 0 );
1671     TESTCASE( strftime( buffer, 100, "%I ", &timeptr ) == 3 );
1672     TESTCASE( strcmp( buffer, "12 " ) == 0 );
1673     TESTCASE( strftime( buffer, 100, "%j ", &timeptr ) == 4 );
1674     TESTCASE( strcmp( buffer, "275 " ) == 0 );
1675     TESTCASE( strftime( buffer, 100, "%m ", &timeptr ) == 3 );
1676     TESTCASE( strcmp( buffer, "10 " ) == 0 );
1677     TESTCASE( strftime( buffer, 100, "%M ", &timeptr ) == 3 );
1678     TESTCASE( strcmp( buffer, "30 " ) == 0 );
1679     TESTCASE( strftime( buffer, 100, "%p ", &timeptr ) == 3 );
1680     TESTCASE( strcmp( buffer, "PM " ) == 0 );
1681     TESTCASE( strftime( buffer, 100, "%r ", &timeptr ) == 12 );
1682     TESTCASE( strcmp( buffer, "12:30:59 PM " ) == 0 );
1683     TESTCASE( strftime( buffer, 100, "%R ", &timeptr ) == 6 );
1684     TESTCASE( strcmp( buffer, "12:30 " ) == 0 );
1685     TESTCASE( strftime( buffer, 100, "%S ", &timeptr ) == 3 );
1686     TESTCASE( strcmp( buffer, "59 " ) == 0 );
1687     TESTCASE( strftime( buffer, 100, "%T ", &timeptr ) == 9 );
1688     TESTCASE( strcmp( buffer, "12:30:59 " ) == 0 );
1689     TESTCASE( strftime( buffer, 100, "%u ", &timeptr ) == 2 );
1690     TESTCASE( strcmp( buffer, "7 " ) == 0 );
1691     TESTCASE( strftime( buffer, 100, "%w ", &timeptr ) == 2 );
1692     TESTCASE( strcmp( buffer, "0 " ) == 0 );
1693     TESTCASE( strftime( buffer, 100, "%x ", &timeptr ) == 9 );
1694     TESTCASE( strcmp( buffer, "10/01/72 " ) == 0 );
1695     TESTCASE( strftime( buffer, 100, "%X ", &timeptr ) == 9 );
1696     TESTCASE( strcmp( buffer, "12:30:59 " ) == 0 );
1697     TESTCASE( strftime( buffer, 100, "%y ", &timeptr ) == 3 );
1698     TESTCASE( strcmp( buffer, "72 " ) == 0 );
1699     TESTCASE( strftime( buffer, 100, "%Y ", &timeptr ) == 5 );
1700     TESTCASE( strcmp( buffer, "1972 " ) == 0 );
1701     TESTCASE( strftime( buffer, 100, "%% ", &timeptr ) == 2 );
1702     TESTCASE( strcmp( buffer, "% " ) == 0 );
1703     TESTCASE( strftime( buffer, 100, "%n ", &timeptr ) == 2 );
1704     TESTCASE( strcmp( buffer, "\n " ) == 0 );
1705     TESTCASE( strftime( buffer, 100, "%t ", &timeptr ) == 2 );
1706     TESTCASE( strcmp( buffer, "\t " ) == 0 );
1707     TESTCASE( test_week_calc() );
1708     return TEST_RESULTS;
1709 }
1710
1711 #endif