Lines Matching refs:s

36 # define strtoll(s, f, b) _atoi64(s)
39 # define strtoll(s, f, b) atoll(s)
41 # define strtoll(s, f, b) strtol(s, f, b)
66 #define YYLIMIT s->lim
67 #define YYMARKER s->ptr
70 #define RET(i) {s->cur = cursor; return i;}
74 #define TIMELIB_INIT s->cur = cursor; str = timelib_string(s); ptr = str
78 #define DEBUG_OUTPUT(s) printf("%s\n", s);
79 #define YYDEBUG(s,c) { if (s != -1) { printf("state: %d ", s); printf("[%c]\n", c); } }
81 #define DEBUG_OUTPUT(s)
82 #define YYDEBUG(s,c)
105 static void add_warning(Scanner *s, char *error)
107 s->errors->warning_count++;
108s->errors->warning_messages = realloc(s->errors->warning_messages, s->errors->warning_count * size…
109 s->errors->warning_messages[s->errors->warning_count - 1].position = s->tok ? s->tok - s->str : 0;
110 s->errors->warning_messages[s->errors->warning_count - 1].character = s->tok ? *s->tok : 0;
111 s->errors->warning_messages[s->errors->warning_count - 1].message = strdup(error);
114 static void add_error(Scanner *s, char *error)
116 s->errors->error_count++;
117s->errors->error_messages = realloc(s->errors->error_messages, s->errors->error_count * sizeof(tim…
118 s->errors->error_messages[s->errors->error_count - 1].position = s->tok ? s->tok - s->str : 0;
119 s->errors->error_messages[s->errors->error_count - 1].character = s->tok ? *s->tok : 0;
120 s->errors->error_messages[s->errors->error_count - 1].message = strdup(error);
123 static char *timelib_string(Scanner *s)
125 char *tmp = calloc(1, s->cur - s->tok + 1);
126 memcpy(tmp, s->tok, s->cur - s->tok);
236 /* date parser's scan function too large for VC6 - VC7.x
241 static int scan(Scanner *s)
243 uchar *cursor = s->cur;
247 s->tok = cursor;
248 s->len = 0;
285 s->recurrences = timelib_get_unsigned_nr((char **) &ptr, 9);
287 s->have_recurrences = 1;
295 if (s->have_date || s->have_period) {
296 current = s->end;
297 s->have_end_date = 1;
299 current = s->begin;
300 s->have_begin_date = 1;
309 current->s = timelib_get_nr((char **) &ptr, 2);
310 s->have_date = 1;
328 add_error(s, "Missing expected time part");
334 case 'Y': s->period->y = nr; break;
335 case 'W': s->period->d = nr * 7; break;
336 case 'D': s->period->d = nr; break;
337 case 'H': s->period->h = nr; break;
338 case 'S': s->period->s = nr; break;
341 s->period->i = nr;
343 s->period->m = nr;
347 add_error(s, "Undefined period specifier");
351 } while (!s->errors->error_count && *ptr);
352 s->have_period = 1;
361 s->period->y = timelib_get_unsigned_nr((char **) &ptr, 4);
363 s->period->m = timelib_get_unsigned_nr((char **) &ptr, 2);
365 s->period->d = timelib_get_unsigned_nr((char **) &ptr, 2);
367 s->period->h = timelib_get_unsigned_nr((char **) &ptr, 2);
369 s->period->i = timelib_get_unsigned_nr((char **) &ptr, 2);
371 s->period->s = timelib_get_unsigned_nr((char **) &ptr, 2);
372 s->have_period = 1;
384 s->pos = cursor; s->line++;
390 add_error(s, "Unexpected character");
401 void timelib_strtointerval(char *s, int len,
408 char *e = s + len - 1;
418 while (isspace(*s) && s < e) {
419 s++;
421 while (isspace(*e) && e > s) {
425 if (e - s < 0) {
437 in.str = malloc((e - s) + YYMAXFILL);
438 memset(in.str, 0, (e - s) + YYMAXFILL);
439 memcpy(in.str, s, (e - s));
440 in.lim = in.str + (e - s) + YYMAXFILL;
450 in.begin->s = TIMELIB_UNSET;
463 in.end->s = TIMELIB_UNSET;
476 in.period->s = 0;