-int jsoneq(const char huge *json, jsmntok_t huge *tok, const char huge *s) {
- if (tok->type == JSMN_STRING && (int)_fstrlen(s) == tok->end - tok->start &&
- _fstrncmp((char const *)json + tok->start, s, tok->end - tok->start) == 0) {
+int jsoneq(const char *json, jsmntok_t *tok, const char *s) {
+ if (tok->type == JSMN_STRING && (int) strlen(s) == tok->end - tok->start &&
+ strncmp(json + tok->start, s, tok->end - tok->start) == 0) {
-word dump(const char huge *js, jsmntok_t huge *t, size_t count, word indent, char *js_sv, map_t *map, unsigned long q) {
- unsigned long i;
+word dump(const char *js, jsmntok_t *t, size_t count, word indent, char *js_sv, map_t *map, dword q) {
+ dword i;
/* We may want to do strtol() here to get numeric value */
//0000fprintf(stderr, "t->type=%d\n", t->type);
if (t->type == JSMN_PRIMITIVE) {
/* We may want to do strtol() here to get numeric value */
//0000fprintf(stderr, "t->type=%d\n", t->type);
if (t->type == JSMN_PRIMITIVE) {
#ifdef DEBUG_MAPDATA
fprintf(stdout, "%d[%d]", q, map->data[q]);
#endif
}
else
#ifdef DEBUG_MAPDATA
fprintf(stdout, "%d[%d]", q, map->data[q]);
#endif
}
else
#ifdef DEBUG_MAPVAR
fprintf(stdout, "indent= [%d] ", indent);
fprintf(stdout, "h:[%d]\n", map->height);
#endif
#ifdef DEBUG_MAPVAR
fprintf(stdout, "indent= [%d] ", indent);
fprintf(stdout, "h:[%d]\n", map->height);
#endif
#ifdef DEBUG_MAPVAR
fprintf(stdout, "indent= [%d] ", indent);
fprintf(stdout, "w:[%d]\n", map->width);
#ifdef DEBUG_MAPVAR
fprintf(stdout, "indent= [%d] ", indent);
fprintf(stdout, "w:[%d]\n", map->width);
{
// fprintf(stdout, "[[[[%d|%d]]]]\n", &(t+1)->size, (t+1)->size);
// fprintf(stdout, "\n%.*s[xx[%d|%d]xx]\n", (t+1)->end - (t+1)->start, js+(t+1)->start, &(t+1)->size, (t+1)->size);
{
// fprintf(stdout, "[[[[%d|%d]]]]\n", &(t+1)->size, (t+1)->size);
// fprintf(stdout, "\n%.*s[xx[%d|%d]xx]\n", (t+1)->end - (t+1)->start, js+(t+1)->start, &(t+1)->size, (t+1)->size);
- map->data = halloc(sizeof(byte) * (t+1)->size, sizeof(byte));
- //map->data = malloc(sizeof(byte) * (t+1)->size);
- map->tiles = /*_f*/malloc(sizeof(tiles_t));
+ map->data = malloc(sizeof(byte) * (t+1)->size);
+ map->tiles = malloc(sizeof(tiles_t));
- _fstrcpy(js_sv, "width");//strdup(js+t->start);//, t->end - t->start);
- }else _fstrcpy(js_sv, "\0");
+ strcpy(js_sv, "width");//strdup(js+t->start);//, t->end - t->start);
+ }else strcpy(js_sv, "\0");
/* Allocate some tokens as a start */
//0000fprintf(stderr, "tok malloc\n");
/* Allocate some tokens as a start */
//0000fprintf(stderr, "tok malloc\n");
}
//0000fprintf(stdout, "r= [%d] BUFSIZ=%d\n", r, BUFSIZ);
//0000fprintf(stderr, "js alloc~\n");
}
//0000fprintf(stdout, "r= [%d] BUFSIZ=%d\n", r, BUFSIZ);
//0000fprintf(stderr, "js alloc~\n");
if (js == NULL) {
fprintf(stderr, "*js=%Fp\n", *js);
fprintf(stderr, "realloc(): errno = %d\n", errno);
return 3;
}
if (js == NULL) {
fprintf(stderr, "*js=%Fp\n", *js);
fprintf(stderr, "realloc(): errno = %d\n", errno);
return 3;
}
r = jsmn_parse(&p, js, jslen, tok, tokcount);
//0000fprintf(stdout, "r= [%d]\n", r);
if (r < 0) {
if (r == JSMN_ERROR_NOMEM) {
tokcount = tokcount * 2;
//0000fprintf(stderr, "tok realloc~ %zu\n", tokcount);
r = jsmn_parse(&p, js, jslen, tok, tokcount);
//0000fprintf(stdout, "r= [%d]\n", r);
if (r < 0) {
if (r == JSMN_ERROR_NOMEM) {
tokcount = tokcount * 2;
//0000fprintf(stderr, "tok realloc~ %zu\n", tokcount);
} else {
//printf("js=%Fp\n", (js));
//printf("*js=%Fp\n", (*(js)));
} else {
//printf("js=%Fp\n", (js));
//printf("*js=%Fp\n", (*(js)));
//printf("&buf=[%Fp]\n", &buf);
//printf("&buf_seg=[%x]\n", FP_SEG(&buf));
//printf("&buf_off=[%x]\n", FP_OFF(&buf));
//printf("&buf=[%Fp]\n", &buf);
//printf("&buf_seg=[%x]\n", FP_SEG(&buf));
//printf("&buf_off=[%x]\n", FP_OFF(&buf));
dump(js, tok, p.toknext, incr, &js_ss, map, 0);
eof_expected = 1;
}
}
dump(js, tok, p.toknext, incr, &js_ss, map, 0);
eof_expected = 1;
}
}