Lines Matching refs:s

31 # define strtoll(s, f, b) _atoi64(s)
34 # define strtoll(s, f, b) atoll(s)
36 # define strtoll(s, f, b) strtol(s, f, b)
52 #define YYLIMIT s->lim
53 #define YYMARKER s->ptr
56 #define RET(i) {s->cur = cursor; return i;}
60 #define TIMELIB_INIT s->cur = cursor; str = timelib_string(s); ptr = str
64 #define DEBUG_OUTPUT(s) printf("%s\n", s);
65 #define YYDEBUG(s,c) { if (s != -1) { printf("state: %d ", s); printf("[%c]\n", c); } }
67 #define DEBUG_OUTPUT(s)
68 #define YYDEBUG(s,c)
89 static void add_error(Scanner *s, char *error)
91 s->errors->error_count++;
92s->errors->error_messages = timelib_realloc(s->errors->error_messages, s->errors->error_count * si…
93 s->errors->error_messages[s->errors->error_count - 1].position = s->tok ? s->tok - s->str : 0;
94 s->errors->error_messages[s->errors->error_count - 1].character = s->tok ? *s->tok : 0;
95 s->errors->error_messages[s->errors->error_count - 1].message = timelib_strdup(error);
98 static char *timelib_string(Scanner *s)
100 char *tmp = timelib_calloc(1, s->cur - s->tok + 1);
101 memcpy(tmp, s->tok, s->cur - s->tok);
162 /* date parser's scan function too large for VC6 - VC7.x
167 static int scan(Scanner *s)
169 uchar *cursor = s->cur;
173 s->tok = cursor;
174 s->len = 0;
211 s->recurrences = timelib_get_unsigned_nr((char **) &ptr, 9);
213 s->have_recurrences = 1;
221 if (s->have_date || s->have_period) {
222 current = s->end;
223 s->have_end_date = 1;
225 current = s->begin;
226 s->have_begin_date = 1;
235 current->s = timelib_get_nr((char **) &ptr, 2);
236 s->have_date = 1;
254 add_error(s, "Missing expected time part");
260 case 'Y': s->period->y = nr; break;
261 case 'W': s->period->d = nr * 7; break;
262 case 'D': s->period->d = nr; break;
263 case 'H': s->period->h = nr; break;
264 case 'S': s->period->s = nr; break;
267 s->period->i = nr;
269 s->period->m = nr;
273 add_error(s, "Undefined period specifier");
277 } while (!s->errors->error_count && *ptr);
278 s->have_period = 1;
287 s->period->y = timelib_get_unsigned_nr((char **) &ptr, 4);
289 s->period->m = timelib_get_unsigned_nr((char **) &ptr, 2);
291 s->period->d = timelib_get_unsigned_nr((char **) &ptr, 2);
293 s->period->h = timelib_get_unsigned_nr((char **) &ptr, 2);
295 s->period->i = timelib_get_unsigned_nr((char **) &ptr, 2);
297 s->period->s = timelib_get_unsigned_nr((char **) &ptr, 2);
298 s->have_period = 1;
310 s->pos = cursor; s->line++;
316 add_error(s, "Unexpected character");
327 void timelib_strtointerval(char *s, size_t len,
334 char *e = s + len - 1;
344 while (isspace(*s) && s < e) {
345 s++;
347 while (isspace(*e) && e > s) {
351 if (e - s < 0) {
363 in.str = timelib_malloc((e - s) + YYMAXFILL);
364 memset(in.str, 0, (e - s) + YYMAXFILL);
365 memcpy(in.str, s, (e - s));
366 in.lim = in.str + (e - s) + YYMAXFILL;
376 in.begin->s = TIMELIB_UNSET;
389 in.end->s = TIMELIB_UNSET;
402 in.period->s = 0;