static void debug_obj(FILE *stream, js_val *obj, int indent, bool force_enum) { js_prop *x; bool first = true; OBJ_ITER(obj, x) { if (!x->enumerable && !force_enum) continue; if (first) { if (indent) fprintf(stream, "%*s", indent, " "); fprintf(stream, "{"); first = false; } else { fprintf(stream, ",\n"); fprintf(stream, "%*s", indent + 1, " "); } fprintf(stream, " %s: ", x->name); if (x->circular) cfprintf(stream, ANSI_BLUE, "[Circular]"); else fh_debug(stream, x->ptr, indent + 3, false); }; fprintf(stream, first ? "{}" : " }"); }
static void debug_arr(FILE *stream, js_val *arr, int indent) { if (arr->object.length == 0) { fprintf(stream, "[]"); return; } fprintf(stream, "[ "); bool first = true; js_prop *prop; unsigned long i; for (i = 0; i < arr->object.length; i++) { prop = fh_get_prop(arr, JSNUMKEY(i)->string.ptr); if (!first) fprintf(stream, ", "); else first = false; if (!prop) continue; if (prop->circular) cfprintf(stream, ANSI_BLUE, "[Circular]"); else fh_debug(stream, prop->ptr, 0, false); } fprintf(stream, " ]"); }
azt_val * print_sayln(azt_val *instance, azt_args *args, eval_state *state) { unsigned i; for (i = 0; i < ARGLEN(args); i++) fh_debug(stdout, fh_to_primitive(ARG(args, i), T_STRING), 0, 1); return AZTUNDEF(); }