summaryrefslogtreecommitdiff
path: root/quickjs.h
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2025-04-30 13:40:15 +0200
committerFabrice Bellard <fabrice@bellard.org>2025-04-30 13:40:15 +0200
commitbe06b3e92b77a343adefa49a4b29e1ad523014ea (patch)
tree4bb72313c0e0dffa830e8504db969a21efa1f5e8 /quickjs.h
parent30fe3de91dd49bc6f725bbae24095c99fe7d001f (diff)
downloadquickjs-be06b3e92b77a343adefa49a4b29e1ad523014ea.tar.gz
quickjs-be06b3e92b77a343adefa49a4b29e1ad523014ea.zip
added JS_PrintValue() and use it in console.log(), print() and the REPL (#256)
Diffstat (limited to 'quickjs.h')
-rw-r--r--quickjs.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/quickjs.h b/quickjs.h
index adc8620..b851cd9 100644
--- a/quickjs.h
+++ b/quickjs.h
@@ -1113,6 +1113,23 @@ int JS_SetModuleExport(JSContext *ctx, JSModuleDef *m, const char *export_name,
int JS_SetModuleExportList(JSContext *ctx, JSModuleDef *m,
const JSCFunctionListEntry *tab, int len);
+/* debug value output */
+
+typedef struct {
+ JS_BOOL show_hidden : 8; /* only show enumerable properties */
+ JS_BOOL show_closure : 8; /* show closure variables */
+ JS_BOOL raw_dump : 8; /* avoid doing autoinit and avoid any malloc() call (for internal use) */
+ uint32_t max_depth; /* recurse up to this depth, 0 = no limit */
+ uint32_t max_string_length; /* print no more than this length for
+ strings, 0 = no limit */
+ uint32_t max_item_count; /* print no more than this count for
+ arrays or objects, 0 = no limit */
+} JSPrintValueOptions;
+
+void JS_PrintValueSetDefaultOptions(JSPrintValueOptions *options);
+void JS_PrintValueRT(JSRuntime *rt, FILE *fo, JSValueConst val, const JSPrintValueOptions *options);
+void JS_PrintValue(JSContext *ctx, FILE *fo, JSValueConst val, const JSPrintValueOptions *options);
+
#undef js_unlikely
#undef js_force_inline