Lines Matching refs:from

79 findentry(mj_t *atom, const char *name, const unsigned from, const unsigned incr)
83 for (i = from ; i < atom->c ; i += incr) {
131 gettok(const char *s, int *from, int *to, int *tok)
144 if (regexec(&tokregex, &s[*from = *to], 15, matches, 0) != 0) {
147 *to = *from + (int)(matches[1].rm_eo);
154 (s[*from + (int)(matches[10].rm_so)] == '[') ? MJ_OPEN_BRACKET :
155 (s[*from + (int)(matches[10].rm_so)] == ']') ? MJ_CLOSE_BRACKET :
156 (s[*from + (int)(matches[10].rm_so)] == '{') ? MJ_OPEN_BRACE :
157 (s[*from + (int)(matches[10].rm_so)] == '}') ? MJ_CLOSE_BRACE :
158 (s[*from + (int)(matches[10].rm_so)] == ':') ? MJ_COLON :
160 *from += (int)(matches[1].rm_so);
317 /* read into a JSON tree from a string */
319 mj_parse(mj_t *atom, const char *s, int *from, int *to, int *tok)
323 switch(atom->type = *tok = gettok(s, from, to, tok)) {
325 atom->value.s = strnsave(&s[*from], *to - *from, MJ_JSON_ENCODE);
327 return gettok(s, from, to, tok);
329 atom->value.s = strnsave(&s[*from + 1], *to - *from - 2, MJ_HUMAN);
331 return gettok(s, from, to, tok);
336 return gettok(s, from, to, tok);
340 while (mj_parse(&atom->value.v[atom->c++], s, from, to, tok) >= 0 && *tok != MJ_CLOSE_BRACKET) {
342 (void) fprintf(stderr, "1. expected comma (got %d) at '%s'\n", *tok, &s[*from]);
347 return gettok(s, from, to, tok);
351 for (i = 0 ; mj_parse(&atom->value.v[atom->c++], s, from, to, tok) >= 0 && *tok != MJ_CLOSE_BRACE ; i++) {
353 (void) fprintf(stderr, "2. expected comma (got %d) at '%s'\n", *tok, &s[*from]);
358 return gettok(s, from, to, tok);
366 mj_object_find(mj_t *atom, const char *name, const unsigned from, const unsigned incr)
368 return findentry(atom, name, from, incr);