Lines Matching refs:ptr
64 static char *read_description_numeric_abbr(char **ptr) in read_description_numeric_abbr() argument
66 const char *begin = *ptr + 1; in read_description_numeric_abbr()
69 (*ptr)++; in read_description_numeric_abbr()
71 while (**ptr != '\0' && **ptr != '>') { in read_description_numeric_abbr()
72 (*ptr)++; in read_description_numeric_abbr()
75 if (**ptr == '\0') { in read_description_numeric_abbr()
79 if (**ptr == '>') { in read_description_numeric_abbr()
80 (*ptr)++; in read_description_numeric_abbr()
84 if (*ptr - begin - 1 < 1) { in read_description_numeric_abbr()
88 return timelib_strndup(begin, *ptr - begin - 1); in read_description_numeric_abbr()
92 static char *read_description_abbr(char **ptr) in read_description_abbr() argument
94 const char *begin = *ptr; in read_description_abbr()
97 while ((**ptr >= 'A' && **ptr <= 'Z') || (**ptr >= 'a' && **ptr <= 'z')) { in read_description_abbr()
98 (*ptr)++; in read_description_abbr()
102 if (*ptr - begin < 1) { in read_description_abbr()
106 return timelib_strndup(begin, *ptr - begin); in read_description_abbr()
110 static char *read_description(char **ptr) in read_description() argument
112 if (**ptr == '<') { in read_description()
113 return read_description_numeric_abbr(ptr); in read_description()
115 return read_description_abbr(ptr); in read_description()
120 static int read_sign(char **ptr) in read_sign() argument
124 if (**ptr == '+') { in read_sign()
125 (*ptr)++; in read_sign()
126 } else if (**ptr == '-') { in read_sign()
128 (*ptr)++; in read_sign()
135 static timelib_sll read_number(char **ptr) in read_number() argument
137 const char *begin = *ptr; in read_number()
141 while (**ptr == '0') { in read_number()
142 (*ptr)++; in read_number()
145 while (**ptr >= '0' && **ptr <= '9') { in read_number()
147 acc += (**ptr) - '0'; in read_number()
148 (*ptr)++; in read_number()
151 if (begin == *ptr) { in read_number()
159 static timelib_sll read_offset(char **ptr) in read_offset() argument
162 int bias = read_sign(ptr); in read_offset()
167 begin = *ptr; in read_offset()
170 hours = read_number(ptr); in read_offset()
176 if (**ptr == ':') { in read_offset()
177 (*ptr)++; // skip ':' in read_offset()
178 minutes = read_number(ptr); in read_offset()
185 if (**ptr == ':') { in read_offset()
186 (*ptr)++; // skip ':' in read_offset()
187 seconds = read_number(ptr); in read_offset()
193 if (begin == *ptr) { in read_offset()
204 static timelib_posix_trans_info* read_trans_spec_mwd(char **ptr) in read_trans_spec_mwd() argument
211 (*ptr)++; in read_trans_spec_mwd()
213 tmp->mwd.month = read_number(ptr); in read_trans_spec_mwd()
219 if (**ptr != '.') { in read_trans_spec_mwd()
222 (*ptr)++; in read_trans_spec_mwd()
224 tmp->mwd.week = read_number(ptr); in read_trans_spec_mwd()
230 if (**ptr != '.') { in read_trans_spec_mwd()
233 (*ptr)++; in read_trans_spec_mwd()
235 tmp->mwd.dow = read_number(ptr); in read_trans_spec_mwd()
248 static timelib_posix_trans_info* read_transition_spec(char **ptr) in read_transition_spec() argument
252 if (**ptr == 'M') { in read_transition_spec()
253 tmp = read_trans_spec_mwd(ptr); in read_transition_spec()
260 if (**ptr == 'J') { in read_transition_spec()
262 (*ptr)++; in read_transition_spec()
265 tmp->days = read_number(ptr); in read_transition_spec()
272 if (**ptr == '/') { in read_transition_spec()
273 (*ptr)++; in read_transition_spec()
274 tmp->hour = read_offset(ptr); in read_transition_spec()
326 char *ptr = (char*) posix; in timelib_parse_posix_str() local
329 tmp->std = read_description(&ptr); in timelib_parse_posix_str()
336 tmp->std_offset = read_offset(&ptr); in timelib_parse_posix_str()
344 if (*ptr == '\0') { in timelib_parse_posix_str()
351 tmp->dst = read_description(&ptr); in timelib_parse_posix_str()
359 if (*ptr != ',' && *ptr != '\0') { in timelib_parse_posix_str()
360 tmp->dst_offset = read_offset(&ptr); in timelib_parse_posix_str()
369 if (*ptr != ',') { in timelib_parse_posix_str()
374 ptr++; // skip ',' in timelib_parse_posix_str()
377 tmp->dst_begin = read_transition_spec(&ptr); in timelib_parse_posix_str()
385 if (*ptr != ',') { in timelib_parse_posix_str()
390 ptr++; // skip ',' in timelib_parse_posix_str()
393 tmp->dst_end = read_transition_spec(&ptr); in timelib_parse_posix_str()
400 if (*ptr != '\0') { in timelib_parse_posix_str()