59 #include <sys/types.h> 114 sp = strchr (vtext,
'#');
131 if (base < 2 || base > 16)
178 "Magnitude of integer number is too large.\n %s %s value.",
179 "The number has been set to the maximum",
229 sp = strpbrk (vtext,
"Ee");
248 sp = strchr (vtext,
'.');
263 "Magnitude of real number is too large\n %s %s value.",
264 "The number has been set to the maximum",
312 item.
format = (vflag == 1)? 1 : 0;
317 ntext = (
char *) malloc (vlength+1);
322 ODLPrintWarning (
"Storage allocation failed -- couldn't store symbol");
329 for (i = 0; i < vlength; i++)
332 ntext[i] = (islower (c))? toupper (c) : c;
335 ntext[vlength] =
'\0';
381 ntext = (
char *) malloc (vlength+1);
386 strncpy (ntext, vtext, vlength);
387 ntext[vlength] =
'\0';
394 ODLPrintWarning (
"Storage allocation failed -- couldn't store string");
549 sp = strchr (vtext,
'T');
555 sp = strchr (vtext,
'-');
607 static short day_table[2][13] =
608 {{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
609 {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};
611 static short doy_table[13] =
612 {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365};
617 nparts = sscanf (text,
"%ld%*[-/]%ld%*[-/]%ld", &year, &month, &day);
626 else if (year < 1700 || year > 2200)
634 leap_year = year%4 == 0 && year%100 != 0 || year%400 == 0;
645 if (doy < 1 || (!leap_year && doy > 365) || (leap_year && doy > 366))
648 (
"Day-of-year must be in range 1..365 (or 366 in a leap year)");
654 for (month=1 ; day > day_table[leap_year][month] ; month++)
656 day -= day_table[leap_year][month];
665 if (month >= 1 && month <= 12)
670 if (day >= 1 && day <= day_table[leap_year][month])
675 doy = doy_table[month-1] + day;
676 if (leap_year && month > 2)
686 "Day number should be in range 1..%d",
687 day_table[leap_year][month]);
701 item->
format += nparts*10;
765 char *ZUTCchar = NULL;
773 nparts = sscanf (text,
"%ld:%ld:%lf", &hours, &minutes, &seconds);
820 sp = strchr (text,
'.');
823 sp = strrchr (text,
'Z');
832 ZUTCchar = strrchr(sp,
'Z');
859 (long) (modf(seconds, &seconds)*1.0E9);
874 sp = strpbrk (text,
"+-");
888 nparts = sscanf (sp,
"%ld:%ld", &hours, &minutes);
890 if (hours < -12 || hours > 12)
892 ODLPrintError (
"Time zone hours value must be in range -12..+12");
909 (
"Time zone minutes value must be in range 0..59");
void ODLExtractTime(char *text, VALUE_DATA *item)
VALUE_DATA ODLConvertSymbol(char vtext[], int vlength, int vflag)
VALUE_DATA ODLConvertDate(char vtext[], int vlength)
VALUE_DATA ODLConvertTime(char vtext[], int vlength)
void ODLExtractDate(char *text, VALUE_DATA *item)
struct ODLInteger integer
VALUE_DATA ODLConvertReal(char vtext[], int vlength)
VALUE_DATA ODLConvertInteger(char vtext[], int vlength)
VALUE_DATA ODLConvertDateTime(char vtext[], int vlength)
VALUE_DATA ODLConvertString(char vtext[], int vlength)
union Value_Data::@2 value