Lines Matching refs:uc
78 json_isspace(const unsigned char uc) in json_isspace() argument
80 switch (uc) { in json_isspace()
92 json_isdigit(unsigned char uc) in json_isdigit() argument
94 switch (uc) { in json_isdigit()
104 json_isxdigit(unsigned char uc) in json_isxdigit() argument
106 if (json_isdigit(uc)) in json_isxdigit()
108 switch (uc) { in json_isxdigit()
118 json_skip_space(const unsigned char *uc, const unsigned char *ue) in json_skip_space() argument
120 while (uc < ue && json_isspace(*uc)) in json_skip_space()
121 uc++; in json_skip_space()
122 return uc; in json_skip_space()
130 const unsigned char *uc = *ucp; in json_parse_string() local
133 DPRINTF("Parse string: ", uc, *ucp); in json_parse_string()
134 while (uc < ue) { in json_parse_string()
135 switch (*uc++) { in json_parse_string()
139 if (uc == ue) in json_parse_string()
141 switch (*uc++) { in json_parse_string()
154 if (ue - uc < 4) { in json_parse_string()
155 uc = ue; in json_parse_string()
159 if (!json_isxdigit(*uc++)) in json_parse_string()
166 DPRINTF("Good string: ", uc, *ucp); in json_parse_string()
167 *ucp = uc; in json_parse_string()
174 DPRINTF("Bad string: ", uc, *ucp); in json_parse_string()
175 *ucp = uc; in json_parse_string()
183 const unsigned char *uc = *ucp; in json_parse_array() local
185 DPRINTF("Parse array: ", uc, *ucp); in json_parse_array()
186 while (uc < ue) { in json_parse_array()
187 uc = json_skip_space(uc, ue); in json_parse_array()
188 if (uc == ue) in json_parse_array()
190 if (*uc == ']') in json_parse_array()
192 if (!json_parse(&uc, ue, st, lvl + 1)) in json_parse_array()
194 if (uc == ue) in json_parse_array()
196 switch (*uc) { in json_parse_array()
198 uc++; in json_parse_array()
203 DPRINTF("Good array: ", uc, *ucp); in json_parse_array()
204 *ucp = uc + 1; in json_parse_array()
211 DPRINTF("Bad array: ", uc, *ucp); in json_parse_array()
212 *ucp = uc; in json_parse_array()
220 const unsigned char *uc = *ucp; in json_parse_object() local
221 DPRINTF("Parse object: ", uc, *ucp); in json_parse_object()
222 while (uc < ue) { in json_parse_object()
223 uc = json_skip_space(uc, ue); in json_parse_object()
224 if (uc == ue) in json_parse_object()
226 if (*uc == '}') { in json_parse_object()
227 uc++; in json_parse_object()
230 if (*uc++ != '"') { in json_parse_object()
231 DPRINTF("not string", uc, *ucp); in json_parse_object()
234 DPRINTF("next field", uc, *ucp); in json_parse_object()
235 if (!json_parse_string(&uc, ue, lvl)) { in json_parse_object()
236 DPRINTF("not string", uc, *ucp); in json_parse_object()
239 uc = json_skip_space(uc, ue); in json_parse_object()
240 if (uc == ue) in json_parse_object()
242 if (*uc++ != ':') { in json_parse_object()
243 DPRINTF("not colon", uc, *ucp); in json_parse_object()
246 if (!json_parse(&uc, ue, st, lvl + 1)) { in json_parse_object()
247 DPRINTF("not json", uc, *ucp); in json_parse_object()
250 if (uc == ue) in json_parse_object()
252 switch (*uc++) { in json_parse_object()
257 DPRINTF("Good object: ", uc, *ucp); in json_parse_object()
258 *ucp = uc; in json_parse_object()
261 DPRINTF("not more", uc, *ucp); in json_parse_object()
262 *ucp = uc - 1; in json_parse_object()
267 DPRINTF("Bad object: ", uc, *ucp); in json_parse_object()
268 *ucp = uc; in json_parse_object()
277 const unsigned char *uc = *ucp; in json_parse_number() local
280 DPRINTF("Parse number: ", uc, *ucp); in json_parse_number()
281 if (uc == ue) in json_parse_number()
283 if (*uc == '-') in json_parse_number()
284 uc++; in json_parse_number()
286 for (; uc < ue; uc++) { in json_parse_number()
287 if (!json_isdigit(*uc)) in json_parse_number()
291 if (uc == ue) in json_parse_number()
293 if (*uc == '.') in json_parse_number()
294 uc++; in json_parse_number()
295 for (; uc < ue; uc++) { in json_parse_number()
296 if (!json_isdigit(*uc)) in json_parse_number()
300 if (uc == ue) in json_parse_number()
302 if (got && (*uc == 'e' || *uc == 'E')) { in json_parse_number()
303 uc++; in json_parse_number()
305 if (uc == ue) in json_parse_number()
307 if (*uc == '+' || *uc == '-') in json_parse_number()
308 uc++; in json_parse_number()
309 for (; uc < ue; uc++) { in json_parse_number()
310 if (!json_isdigit(*uc)) in json_parse_number()
317 DPRINTF("Bad number: ", uc, *ucp); in json_parse_number()
319 DPRINTF("Good number: ", uc, *ucp); in json_parse_number()
320 *ucp = uc; in json_parse_number()
329 const unsigned char *uc = *ucp; in json_parse_const() local
331 DPRINTF("Parse const: ", uc, *ucp); in json_parse_const()
335 for (; uc < ue && --len;) { in json_parse_const()
336 if (*uc++ != *++str) { in json_parse_const()
337 DPRINTF("Bad const: ", uc, *ucp); in json_parse_const()
341 DPRINTF("Good const: ", uc, *ucp); in json_parse_const()
349 const unsigned char *uc, *ouc; in json_parse() local
353 ouc = uc = json_skip_space(*ucp, ue); in json_parse()
354 if (uc == ue) in json_parse()
359 DPRINTF("Too many levels", uc, *ucp); in json_parse()
368 DPRINTF("Parse general: ", uc, *ucp); in json_parse()
369 switch (*uc++) { in json_parse()
371 rv = json_parse_string(&uc, ue, lvl + 1); in json_parse()
375 rv = json_parse_array(&uc, ue, st, lvl + 1); in json_parse()
379 rv = json_parse_object(&uc, ue, st, lvl + 1); in json_parse()
383 rv = json_parse_const(&uc, ue, "true", sizeof("true"), lvl + 1); in json_parse()
387 rv = json_parse_const(&uc, ue, "false", sizeof("false"), in json_parse()
392 rv = json_parse_const(&uc, ue, "null", sizeof("null"), lvl + 1); in json_parse()
396 --uc; in json_parse()
397 rv = json_parse_number(&uc, ue, lvl + 1); in json_parse()
403 uc = json_skip_space(uc, ue); in json_parse()
405 DPRINTF("End general: ", uc, *ucp); in json_parse()
406 *ucp = uc; in json_parse()
410 if (uc == ue) in json_parse()
412 if (*ouc == *uc && json_parse(&uc, ue, st, 1)) in json_parse()
424 const unsigned char *uc = CAST(const unsigned char *, b->fbuf); in file_is_json() local
425 const unsigned char *ue = uc + b->flen; in file_is_json()
436 if ((jt = json_parse(&uc, ue, st, 0)) == 0) in file_is_json()