void MAPPUSH() { if (mapstackpointer >= &mapstack[STACKDEPTH]) {hard_err("internal error: mapstack overflow");} mapstackpointer++; map_safe_peek()->stk = stack_safe_peek(); map_safe_peek()->opt = optind; map_safe_peek()->fin = 0; switch (json_typeof(PEEK)) { case JSON_OBJECT: map_safe_peek()->itr = json_object_iter(PEEK); break; case JSON_ARRAY: map_safe_peek()->lin = 0; break; default: err("parse error: type not mappable"); } }
void MAPPOP() { stackpointer = map_safe_peek()->stk; optind = map_safe_peek()->opt; mapstackpointer = map_safe_peek(); }
void MAPNEXT() { stackpointer = map_safe_peek()->stk + 1; optind = map_safe_peek()->opt; switch (json_typeof(*(map_safe_peek()->stk))) { case JSON_OBJECT: json_object_iter_key(map_safe_peek()->itr); PUSH(maybe_deep(json_object_iter_value(map_safe_peek()->itr))); map_safe_peek()->itr = json_object_iter_next(*(map_safe_peek()->stk), map_safe_peek()->itr); if (!map_safe_peek()->itr) {map_safe_peek()->fin = 1;} break; case JSON_ARRAY: PUSH(maybe_deep(json_array_get(*(map_safe_peek()->stk), map_safe_peek()->lin))); map_safe_peek()->lin++; if (map_safe_peek()->lin >= json_array_size(*(map_safe_peek()->stk))) {map_safe_peek()->fin = 1;} break; default: err("parse error: type not mappable"); map_safe_peek()->fin = 1; } }