#include "glib.h"#include <time.h>#include <string.h>#include <ctype.h>#include <stdlib.h>#include <locale.h>Go to the source code of this file.
|
|
Definition at line 448 of file gdate.c. Referenced by g_date_fill_parse_tokens(). |
|
|
|
|
||||||||||||
|
Definition at line 950 of file gdate.c. References FALSE, g_date_update_julian(), g_date_valid(), g_return_if_fail, and NULL. Referenced by main(). 00951 { 00952 g_return_if_fail (d != NULL); 00953 g_return_if_fail (g_date_valid (d)); 00954 00955 if (!d->julian) 00956 { 00957 g_date_update_julian (d); 00958 } 00959 g_return_if_fail (d->julian); 00960 00961 d->julian_days += ndays; 00962 d->dmy = FALSE; 00963 }
|
|
||||||||||||
|
Definition at line 983 of file gdate.c. References days_in_months, FALSE, g_date_is_leap_year(), g_date_update_dmy(), g_date_valid(), g_return_if_fail, and NULL. Referenced by main(). 00985 { 00986 guint years, months; 00987 gint index; 00988 00989 g_return_if_fail (d != NULL); 00990 g_return_if_fail (g_date_valid (d)); 00991 00992 if (!d->dmy) 00993 { 00994 g_date_update_dmy (d); 00995 } 00996 g_return_if_fail (d->dmy); 00997 00998 nmonths += d->month - 1; 00999 01000 years = nmonths/12; 01001 months = nmonths%12; 01002 01003 d->month = months + 1; 01004 d->year += years; 01005 01006 index = g_date_is_leap_year (d->year) ? 1 : 0; 01007 01008 if (d->day > days_in_months[index][d->month]) 01009 d->day = days_in_months[index][d->month]; 01010 01011 d->julian = FALSE; 01012 01013 g_return_if_fail (g_date_valid (d)); 01014 }
|
|
||||||||||||
|
Definition at line 1058 of file gdate.c. References FALSE, g_date_is_leap_year(), g_date_update_dmy(), g_date_valid(), g_return_if_fail, and NULL. Referenced by main(). 01060 { 01061 g_return_if_fail (d != NULL); 01062 g_return_if_fail (g_date_valid (d)); 01063 01064 if (!d->dmy) 01065 { 01066 g_date_update_dmy (d); 01067 } 01068 g_return_if_fail (d->dmy); 01069 01070 d->year += nyears; 01071 01072 if (d->month == 2 && d->day == 29) 01073 { 01074 if (!g_date_is_leap_year (d->year)) 01075 { 01076 d->day = 28; 01077 } 01078 } 01079 01080 d->julian = FALSE; 01081 }
|
|
||||||||||||
|
Definition at line 394 of file gdate.c. References g_return_if_fail, and NULL. Referenced by g_date_monday_week_of_year(), g_date_monday_weeks_in_year(), g_date_prepare_to_parse(), g_date_set_parse(), g_date_sunday_week_of_year(), g_date_sunday_weeks_in_year(), and main(). 00395 { 00396 g_return_if_fail (d != NULL); 00397 g_return_if_fail (ndates != 0); 00398 00399 memset (d, 0x0, ndates*sizeof (GDate)); 00400 }
|
|
||||||||||||
|
Definition at line 1179 of file gdate.c. References g_date_update_julian(), g_date_valid(), g_return_val_if_fail, NULL, and TRUE. Referenced by main(). 01181 { 01182 g_return_val_if_fail (lhs != NULL, 0); 01183 g_return_val_if_fail (rhs != NULL, 0); 01184 g_return_val_if_fail (g_date_valid (lhs), 0); 01185 g_return_val_if_fail (g_date_valid (rhs), 0); 01186 01187 /* Remember the self-comparison case! I think it works right now. */ 01188 01189 while (TRUE) 01190 { 01191 01192 if (lhs->julian && rhs->julian) 01193 { 01194 if (lhs->julian_days < rhs->julian_days) return -1; 01195 else if (lhs->julian_days > rhs->julian_days) return 1; 01196 else return 0; 01197 } 01198 else if (lhs->dmy && rhs->dmy) 01199 { 01200 if (lhs->year < rhs->year) return -1; 01201 else if (lhs->year > rhs->year) return 1; 01202 else 01203 { 01204 if (lhs->month < rhs->month) return -1; 01205 else if (lhs->month > rhs->month) return 1; 01206 else 01207 { 01208 if (lhs->day < rhs->day) return -1; 01209 else if (lhs->day > rhs->day) return 1; 01210 else return 0; 01211 } 01212 01213 } 01214 01215 } 01216 else 01217 { 01218 if (!lhs->julian) g_date_update_julian (lhs); 01219 if (!rhs->julian) g_date_update_julian (rhs); 01220 g_return_val_if_fail (lhs->julian, 0); 01221 g_return_val_if_fail (rhs->julian, 0); 01222 } 01223 01224 } 01225 return 0; /* warnings */ 01226 }
|
|
|
Definition at line 292 of file gdate.c. References G_DATE_BAD_DAY, g_date_update_dmy(), g_date_valid(), g_return_val_if_fail, and NULL. Referenced by main(). 00293 { 00294 g_return_val_if_fail (d != NULL, G_DATE_BAD_DAY); 00295 g_return_val_if_fail (g_date_valid (d), G_DATE_BAD_DAY); 00296 00297 if (!d->dmy) 00298 { 00299 g_date_update_dmy (d); 00300 } 00301 g_return_val_if_fail (d->dmy, G_DATE_BAD_DAY); 00302 00303 return d->day; 00304 }
|
|
|
Definition at line 322 of file gdate.c. References days_in_year, g_date_is_leap_year(), g_date_update_dmy(), g_date_valid(), g_return_val_if_fail, and NULL. Referenced by g_date_monday_week_of_year(), g_date_sunday_week_of_year(), g_date_to_struct_tm(), and main(). 00323 { 00324 gint index; 00325 00326 g_return_val_if_fail (d != NULL, 0); 00327 g_return_val_if_fail (g_date_valid (d), 0); 00328 00329 if (!d->dmy) 00330 { 00331 g_date_update_dmy (d); 00332 } 00333 g_return_val_if_fail (d->dmy, 0); 00334 00335 index = g_date_is_leap_year (d->year) ? 1 : 0; 00336 00337 return (days_in_year[index][d->month] + d->day); 00338 }
|
|
||||||||||||
|
Definition at line 1121 of file gdate.c. References days_in_months, g_date_is_leap_year(), g_date_valid_month(), g_date_valid_year(), and g_return_val_if_fail. Referenced by main(). 01123 { 01124 gint index; 01125 01126 g_return_val_if_fail (g_date_valid_year (year), 0); 01127 g_return_val_if_fail (g_date_valid_month (month), 0); 01128 01129 index = g_date_is_leap_year (year) ? 1 : 0; 01130 01131 return days_in_months[index][month]; 01132 }
|
|
||||||||||||
|
Definition at line 452 of file gdate.c. References G_DATE_BAD_MONTH, g_strdown(), long_month_names, _GDateParseTokens::month, _GDateParseTokens::n, NULL, _GDateParseTokens::num_ints, NUM_LEN, and short_month_names. Referenced by g_date_prepare_to_parse(). 00453 { 00454 gchar num[4][NUM_LEN+1]; 00455 gint i; 00456 const guchar *s; 00457 00458 /* We count 4, but store 3; so we can give an error 00459 * if there are 4. 00460 */ 00461 num[0][0] = num[1][0] = num[2][0] = num[3][0] = '\0'; 00462 00463 s = str; 00464 pt->num_ints = 0; 00465 while (*s && pt->num_ints < 4) 00466 { 00467 00468 i = 0; 00469 while (*s && isdigit (*s) && i <= NUM_LEN) 00470 { 00471 num[pt->num_ints][i] = *s; 00472 ++s; 00473 ++i; 00474 } 00475 00476 if (i > 0) 00477 { 00478 num[pt->num_ints][i] = '\0'; 00479 ++(pt->num_ints); 00480 } 00481 00482 if (*s == '\0') break; 00483 00484 ++s; 00485 } 00486 00487 pt->n[0] = pt->num_ints > 0 ? atoi (num[0]) : 0; 00488 pt->n[1] = pt->num_ints > 1 ? atoi (num[1]) : 0; 00489 pt->n[2] = pt->num_ints > 2 ? atoi (num[2]) : 0; 00490 00491 pt->month = G_DATE_BAD_MONTH; 00492 00493 if (pt->num_ints < 3) 00494 { 00495 gchar lcstr[128]; 00496 int i = 1; 00497 00498 strncpy (lcstr, str, 127); 00499 g_strdown (lcstr); 00500 00501 while (i < 13) 00502 { 00503 if (long_month_names[i] != NULL) 00504 { 00505 const gchar *found = strstr (lcstr, long_month_names[i]); 00506 00507 if (found != NULL) 00508 { 00509 pt->month = i; 00510 return; 00511 } 00512 } 00513 00514 if (short_month_names[i] != NULL) 00515 { 00516 const gchar *found = strstr (lcstr, short_month_names[i]); 00517 00518 if (found != NULL) 00519 { 00520 pt->month = i; 00521 return; 00522 } 00523 } 00524 00525 ++i; 00526 } 00527 } 00528 }
|
|
|
Definition at line 90 of file gdate.c. References g_free(), g_return_if_fail, and NULL. Referenced by main(). 00091 { 00092 g_return_if_fail (d != NULL); 00093 00094 g_free (d); 00095 }
|
|
|
Definition at line 914 of file gdate.c. References FALSE, g_date_update_dmy(), g_date_valid(), g_return_val_if_fail, NULL, and TRUE. 00915 { 00916 g_return_val_if_fail (d != NULL, FALSE); 00917 g_return_val_if_fail (g_date_valid (d), FALSE); 00918 00919 if (!d->dmy) 00920 { 00921 g_date_update_dmy (d); 00922 } 00923 g_return_val_if_fail (d->dmy, FALSE); 00924 00925 if (d->day == 1) return TRUE; 00926 else return FALSE; 00927 }
|
|
|
Definition at line 930 of file gdate.c. References days_in_months, FALSE, g_date_is_leap_year(), g_date_update_dmy(), g_date_valid(), g_return_val_if_fail, NULL, and TRUE. 00931 { 00932 gint index; 00933 00934 g_return_val_if_fail (d != NULL, FALSE); 00935 g_return_val_if_fail (g_date_valid (d), FALSE); 00936 00937 if (!d->dmy) 00938 { 00939 g_date_update_dmy (d); 00940 } 00941 g_return_val_if_fail (d->dmy, FALSE); 00942 00943 index = g_date_is_leap_year (d->year) ? 1 : 0; 00944 00945 if (d->day == days_in_months[index][d->month]) return TRUE; 00946 else return FALSE; 00947 }
|
|
|
Definition at line 1112 of file gdate.c. References FALSE, g_date_valid_year(), and g_return_val_if_fail. Referenced by g_date_add_months(), g_date_add_years(), g_date_day_of_year(), g_date_days_in_month(), g_date_is_last_of_month(), g_date_monday_weeks_in_year(), g_date_subtract_months(), g_date_subtract_years(), g_date_sunday_weeks_in_year(), g_date_update_julian(), g_date_valid_dmy(), and main(). 01113 { 01114 g_return_val_if_fail (g_date_valid_year (year), FALSE); 01115 01116 return ( (((year % 4) == 0) && ((year % 100) != 0)) || 01117 (year % 400) == 0 ); 01118 }
|
|
|
Definition at line 307 of file gdate.c. References G_DATE_BAD_JULIAN, g_date_update_julian(), g_date_valid(), g_return_val_if_fail, and NULL. Referenced by main(). 00308 { 00309 g_return_val_if_fail (d != NULL, G_DATE_BAD_JULIAN); 00310 g_return_val_if_fail (g_date_valid (d), G_DATE_BAD_JULIAN); 00311 00312 if (!d->julian) 00313 { 00314 g_date_update_julian (d); 00315 } 00316 g_return_val_if_fail (d->julian, G_DATE_BAD_JULIAN); 00317 00318 return d->julian_days; 00319 }
|
|
|
Definition at line 341 of file gdate.c. References g_date_clear(), g_date_day_of_year(), g_date_set_dmy(), g_date_update_dmy(), g_date_valid(), g_date_weekday(), g_return_val_if_fail, NULL, and _GDate::year. Referenced by main(). 00342 { 00343 GDateWeekday wd; 00344 guint day; 00345 GDate first; 00346 00347 g_return_val_if_fail (d != NULL, 0); 00348 g_return_val_if_fail (g_date_valid (d), 0); 00349 00350 if (!d->dmy) 00351 { 00352 g_date_update_dmy (d); 00353 } 00354 g_return_val_if_fail (d->dmy, 0); 00355 00356 g_date_clear (&first, 1); 00357 00358 g_date_set_dmy (&first, 1, 1, d->year); 00359 00360 wd = g_date_weekday (&first) - 1; /* make Monday day 0 */ 00361 day = g_date_day_of_year (d) - 1; 00362 00363 return ((day + wd)/7U + (wd == 0 ? 1 : 0)); 00364 }
|
|
|
Definition at line 1135 of file gdate.c. References g_date_clear(), g_date_is_leap_year(), G_DATE_MONDAY, g_date_set_dmy(), g_date_valid_year(), g_date_weekday(), and g_return_val_if_fail. Referenced by main(). 01136 { 01137 GDate d; 01138 01139 g_return_val_if_fail (g_date_valid_year (year), 0); 01140 01141 g_date_clear (&d, 1); 01142 g_date_set_dmy (&d, 1, 1, year); 01143 if (g_date_weekday (&d) == G_DATE_MONDAY) return 53; 01144 g_date_set_dmy (&d, 31, 12, year); 01145 if (g_date_weekday (&d) == G_DATE_MONDAY) return 53; 01146 if (g_date_is_leap_year (year)) 01147 { 01148 g_date_set_dmy (&d, 2, 1, year); 01149 if (g_date_weekday (&d) == G_DATE_MONDAY) return 53; 01150 g_date_set_dmy (&d, 30, 12, year); 01151 if (g_date_weekday (&d) == G_DATE_MONDAY) return 53; 01152 } 01153 return 52; 01154 }
|
|
|
Definition at line 262 of file gdate.c. References G_DATE_BAD_MONTH, g_date_update_dmy(), g_date_valid(), g_return_val_if_fail, and NULL. Referenced by main(). 00263 { 00264 g_return_val_if_fail (d != NULL, G_DATE_BAD_MONTH); 00265 g_return_val_if_fail (g_date_valid (d), G_DATE_BAD_MONTH); 00266 00267 if (!d->dmy) 00268 { 00269 g_date_update_dmy (d); 00270 } 00271 g_return_val_if_fail (d->dmy, G_DATE_BAD_MONTH); 00272 00273 return d->month; 00274 }
|
|
|
Definition at line 44 of file gdate.c. References g_new0. Referenced by main(). 00045 { 00046 GDate *d = g_new0 (GDate, 1); /* happily, 0 is the invalid flag for everything. */ 00047 00048 return d; 00049 }
|
|
||||||||||||||||
|
Definition at line 52 of file gdate.c. References _GDate::day, _GDate::dmy, FALSE, g_assert, g_date_valid(), g_date_valid_dmy(), g_new, g_return_val_if_fail, _GDate::julian, _GDate::month, NULL, TRUE, and _GDate::year. Referenced by main(). 00053 { 00054 GDate *d; 00055 g_return_val_if_fail (g_date_valid_dmy (day, m, y), NULL); 00056 00057 d = g_new (GDate, 1); 00058 00059 d->julian = FALSE; 00060 d->dmy = TRUE; 00061 00062 d->month = m; 00063 d->day = day; 00064 d->year = y; 00065 00066 g_assert (g_date_valid (d)); 00067 00068 return d; 00069 }
|
|
|
Definition at line 72 of file gdate.c. References _GDate::dmy, FALSE, g_assert, g_date_valid(), g_date_valid_julian(), g_new, g_return_val_if_fail, _GDate::julian, _GDate::julian_days, NULL, and TRUE. 00073 { 00074 GDate *d; 00075 g_return_val_if_fail (g_date_valid_julian (j), NULL); 00076 00077 d = g_new (GDate, 1); 00078 00079 d->julian = TRUE; 00080 d->dmy = FALSE; 00081 00082 d->julian_days = j; 00083 00084 g_assert (g_date_valid (d)); 00085 00086 return d; 00087 }
|
|
||||||||||||
|
Definition at line 532 of file gdate.c. References current_locale, dmy_order, FALSE, g_date_clear(), G_DATE_DAY, g_date_fill_parse_tokens(), G_DATE_MONTH, g_date_set_dmy(), g_date_strftime(), g_date_valid(), G_DATE_YEAR, g_free(), g_message(), g_return_if_fail, g_strdown(), g_strdup(), long_month_names, _GDateParseTokens::n, NULL, _GDateParseTokens::num_ints, short_month_names, TRUE, twodigit_start_year, and using_twodigit_years. Referenced by g_date_set_parse(). 00533 { 00534 const gchar *locale = setlocale (LC_TIME, NULL); 00535 gboolean recompute_localeinfo = FALSE; 00536 GDate d; 00537 00538 g_return_if_fail (locale != NULL); /* should not happen */ 00539 00540 g_date_clear (&d, 1); /* clear for scratch use */ 00541 00542 if ( (current_locale == NULL) || (strcmp (locale, current_locale) != 0) ) 00543 { 00544 recompute_localeinfo = TRUE; /* Uh, there used to be a reason for the temporary */ 00545 } 00546 00547 if (recompute_localeinfo) 00548 { 00549 int i = 1; 00550 GDateParseTokens testpt; 00551 gchar buf[128]; 00552 00553 g_free (current_locale); /* still works if current_locale == NULL */ 00554 00555 current_locale = g_strdup (locale); 00556 00557 while (i < 13) 00558 { 00559 g_date_set_dmy (&d, 1, i, 1); 00560 00561 g_return_if_fail (g_date_valid (&d)); 00562 00563 g_date_strftime (buf, 127, "%b", &d); 00564 g_free (short_month_names[i]); 00565 g_strdown (buf); 00566 short_month_names[i] = g_strdup (buf); 00567 00568 00569 00570 g_date_strftime (buf, 127, "%B", &d); 00571 g_free (long_month_names[i]); 00572 g_strdown (buf); 00573 long_month_names[i] = g_strdup (buf); 00574 00575 ++i; 00576 } 00577 00578 /* Determine DMY order */ 00579 00580 /* had to pick a random day - don't change this, some strftimes 00581 * are broken on some days, and this one is good so far. */ 00582 g_date_set_dmy (&d, 4, 7, 1976); 00583 00584 g_date_strftime (buf, 127, "%x", &d); 00585 00586 g_date_fill_parse_tokens (buf, &testpt); 00587 00588 i = 0; 00589 while (i < testpt.num_ints) 00590 { 00591 switch (testpt.n[i]) 00592 { 00593 case 7: 00594 dmy_order[i] = G_DATE_MONTH; 00595 break; 00596 case 4: 00597 dmy_order[i] = G_DATE_DAY; 00598 break; 00599 case 76: 00600 using_twodigit_years = TRUE; /* FALL THRU */ 00601 case 1976: 00602 dmy_order[i] = G_DATE_YEAR; 00603 break; 00604 default: 00605 /* leave it unchanged */ 00606 break; 00607 } 00608 ++i; 00609 } 00610 00611 #ifdef G_ENABLE_DEBUG 00612 g_message ("**GDate prepared a new set of locale-specific parse rules."); 00613 i = 1; 00614 while (i < 13) 00615 { 00616 g_message (" %s %s", long_month_names[i], short_month_names[i]); 00617 ++i; 00618 } 00619 if (using_twodigit_years) 00620 { 00621 g_message ("**Using twodigit years with cutoff year: %u", twodigit_start_year); 00622 } 00623 { 00624 gchar *strings[3]; 00625 i = 0; 00626 while (i < 3) 00627 { 00628 switch (dmy_order[i]) 00629 { 00630 case G_DATE_MONTH: 00631 strings[i] = "Month"; 00632 break; 00633 case G_DATE_YEAR: 00634 strings[i] = "Year"; 00635 break; 00636 case G_DATE_DAY: 00637 strings[i] = "Day"; 00638 break; 00639 default: 00640 strings[i] = NULL; 00641 break; 00642 } 00643 ++i; 00644 } 00645 g_message ("**Order: %s, %s, %s", strings[0], strings[1], strings[2]); 00646 g_message ("**Sample date in this locale: `%s'", buf); 00647 } 00648 #endif 00649 } 00650 00651 g_date_fill_parse_tokens (str, pt); 00652 }
|
|
||||||||||||
|
Definition at line 848 of file gdate.c. References _GDate::day, _GDate::dmy, FALSE, g_date_update_dmy(), g_date_valid_day(), g_date_valid_dmy(), g_return_if_fail, _GDate::julian, _GDate::month, NULL, TRUE, and _GDate::year. Referenced by main(). 00850 { 00851 g_return_if_fail (d != NULL); 00852 g_return_if_fail (g_date_valid_day (day)); 00853 00854 if (d->julian && !d->dmy) g_date_update_dmy(d); 00855 d->julian = FALSE; 00856 00857 d->day = day; 00858 00859 if (g_date_valid_dmy (d->day, d->month, d->year)) 00860 d->dmy = TRUE; 00861 else 00862 d->dmy = FALSE; 00863 }
|
|
||||||||||||||||||||
|
Definition at line 884 of file gdate.c. References _GDate::day, _GDate::dmy, FALSE, g_date_valid_dmy(), g_return_if_fail, _GDate::julian, _GDate::month, NULL, TRUE, and _GDate::year. Referenced by g_date_monday_week_of_year(), g_date_monday_weeks_in_year(), g_date_prepare_to_parse(), g_date_sunday_week_of_year(), g_date_sunday_weeks_in_year(), and main(). 00888 { 00889 g_return_if_fail (d != NULL); 00890 g_return_if_fail (g_date_valid_dmy (day, m, y)); 00891 00892 d->julian = FALSE; 00893 00894 d->month = m; 00895 d->day = day; 00896 d->year = y; 00897 00898 d->dmy = TRUE; 00899 }
|
|
||||||||||||
|
Definition at line 902 of file gdate.c. References _GDate::dmy, FALSE, g_date_valid_julian(), g_return_if_fail, _GDate::julian, _GDate::julian_days, NULL, and TRUE. Referenced by main(). 00903 { 00904 g_return_if_fail (d != NULL); 00905 g_return_if_fail (g_date_valid_julian (j)); 00906 00907 d->julian_days = j; 00908 d->julian = TRUE; 00909 d->dmy = FALSE; 00910 }
|
|
||||||||||||
|
Definition at line 830 of file gdate.c. References _GDate::day, _GDate::dmy, FALSE, g_date_update_dmy(), g_date_valid_dmy(), g_date_valid_month(), g_return_if_fail, _GDate::julian, _GDate::month, NULL, TRUE, and _GDate::year. 00832 { 00833 g_return_if_fail (d != NULL); 00834 g_return_if_fail (g_date_valid_month (m)); 00835 00836 if (d->julian && !d->dmy) g_date_update_dmy(d); 00837 d->julian = FALSE; 00838 00839 d->month = m; 00840 00841 if (g_date_valid_dmy (d->day, d->month, d->year)) 00842 d->dmy = TRUE; 00843 else 00844 d->dmy = FALSE; 00845 }
|
|
||||||||||||
|
Definition at line 655 of file gdate.c. References _GDate::day, _GDate::dmy, dmy_order, g_assert, G_DATE_BAD_DAY, G_DATE_BAD_MONTH, G_DATE_BAD_YEAR, g_date_clear(), G_DATE_DAY, G_DATE_MONTH, g_date_prepare_to_parse(), g_date_valid_dmy(), G_DATE_YEAR, G_LOCK, g_message(), g_return_if_fail, G_UNLOCK, _GDateParseTokens::month, _GDate::month, _GDateParseTokens::n, NULL, _GDateParseTokens::num_ints, TRUE, twodigit_start_year, using_twodigit_years, and _GDate::year. Referenced by main(). 00657 { 00658 GDateParseTokens pt; 00659 guint m = G_DATE_BAD_MONTH, day = G_DATE_BAD_DAY, y = G_DATE_BAD_YEAR; 00660 00661 g_return_if_fail (d != NULL); 00662 00663 /* set invalid */ 00664 g_date_clear (d, 1); 00665 00666 G_LOCK (g_date_global); 00667 00668 g_date_prepare_to_parse (str, &pt); 00669 00670 #ifdef G_ENABLE_DEBUG 00671 g_message ("Found %d ints, `%d' `%d' `%d' and written out month %d", 00672 pt.num_ints, pt.n[0], pt.n[1], pt.n[2], pt.month); 00673 #endif 00674 00675 00676 if (pt.num_ints == 4) 00677 { 00678 G_UNLOCK (g_date_global); 00679 return; /* presumably a typo; bail out. */ 00680 } 00681 00682 if (pt.num_ints > 1) 00683 { 00684 int i = 0; 00685 int j = 0; 00686 00687 g_assert (pt.num_ints < 4); /* i.e., it is 2 or 3 */ 00688 00689 while (i < pt.num_ints && j < 3) 00690 { 00691 switch (dmy_order[j]) 00692 { 00693 case G_DATE_MONTH: 00694 { 00695 if (pt.num_ints == 2 && pt.month != G_DATE_BAD_MONTH) 00696 { 00697 m = pt.month; 00698 ++j; /* skip months, but don't skip this number */ 00699 continue; 00700 } 00701 else 00702 m = pt.n[i]; 00703 } 00704 break; 00705 case G_DATE_DAY: 00706 { 00707 if (pt.num_ints == 2 && pt.month == G_DATE_BAD_MONTH) 00708 { 00709 day = 1; 00710 ++j; /* skip days, since we may have month/year */ 00711 continue; 00712 } 00713 day = pt.n[i]; 00714 } 00715 |