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, const 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);
163 /* date parser's scan function too large for VC6 - VC7.x
168 static int scan(Scanner *s)
170 uchar *cursor = s->cur;
175 s->tok = cursor;
176 s->len = 0;
213 s->recurrences = timelib_get_unsigned_nr(&ptr, 9);
215 s->have_recurrences = 1;
223 if (s->have_date || s->have_period) {
224 current = s->end;
225 s->have_end_date = 1;
227 current = s->begin;
228 s->have_begin_date = 1;
237 current->s = timelib_get_nr(&ptr, 2);
238 s->have_date = 1;
256 add_error(s, "Missing expected time part");
262 case 'Y': s->period->y = nr; break;
263 case 'W': s->period->d += nr * 7; break;
264 case 'D': s->period->d += nr; break;
265 case 'H': s->period->h = nr; break;
266 case 'S': s->period->s = nr; break;
269 s->period->i = nr;
271 s->period->m = nr;
275 add_error(s, "Undefined period specifier");
279 } while (!s->errors->error_count && *ptr);
280 s->have_period = 1;
289 s->period->y = timelib_get_unsigned_nr(&ptr, 4);
291 s->period->m = timelib_get_unsigned_nr(&ptr, 2);
293 s->period->d = timelib_get_unsigned_nr(&ptr, 2);
295 s->period->h = timelib_get_unsigned_nr(&ptr, 2);
297 s->period->i = timelib_get_unsigned_nr(&ptr, 2);
299 s->period->s = timelib_get_unsigned_nr(&ptr, 2);
300 s->have_period = 1;
312 s->pos = cursor; s->line++;
318 add_error(s, "Unexpected character");
329 void timelib_strtointerval(const char *s, size_t len,
336 const char *e = s + len - 1;
346 while (isspace(*s) && s < e) {
347 s++;
349 while (isspace(*e) && e > s) {
353 if (e - s < 0) {
365 in.str = timelib_malloc((e - s) + YYMAXFILL);
366 memset(in.str, 0, (e - s) + YYMAXFILL);
367 memcpy(in.str, s, (e - s));
368 in.lim = in.str + (e - s) + YYMAXFILL;
378 in.begin->s = TIMELIB_UNSET;
391 in.end->s = TIMELIB_UNSET;
404 in.period->s = 0;