]> granicus.if.org Git - jq/commitdiff
WIP
authorStephen Dolan <mu@netsoc.tcd.ie>
Sun, 5 May 2013 21:59:46 +0000 (22:59 +0100)
committerStephen Dolan <mu@netsoc.tcd.ie>
Sun, 5 May 2013 21:59:53 +0000 (22:59 +0100)
jq_test.c
main.c

index cbcbd8f59efcd9876973355fce923200238380af..5abd02754a53154ec89601252583072cdddb921b 100644 (file)
--- a/jq_test.c
+++ b/jq_test.c
@@ -53,11 +53,9 @@ static void run_jq_tests() {
     tests++;
     struct bytecode* bc = jq_compile(buf);
     if (!bc) {invalid++; continue;}
-#if JQ_DEBUG
     printf("Disassembly:\n");
     dump_disassembly(2, bc);
     printf("\n");
-#endif
     fgets(buf, sizeof(buf), testdata);
     jv input = jv_parse(buf);
     if (!jv_is_valid(input)){ invalid++; continue; }
diff --git a/main.c b/main.c
index 06466d4e7ca3866ec9ab5b58b2c6a73fe106bf6d..71150161f95785471597951eece4d5a91e2a88cc 100644 (file)
--- a/main.c
+++ b/main.c
@@ -57,6 +57,9 @@ enum {
   NO_COLOUR_OUTPUT = 128,
 
   FROM_FILE = 256,
+
+  /* debugging only */
+  DUMP_DISASM = 2048,
 };
 static int options = 0;
 static struct bytecode* bc;
@@ -180,6 +183,8 @@ int main(int argc, char* argv[]) {
       options |= PROVIDE_NULL;
     } else if (isoption(argv[i], 'f', "from-file")) {
       options |= FROM_FILE;
+    } else if (isoption(argv[i],  0,  "debug-dump-disasm")) {
+      options |= DUMP_DISASM;
     } else if (isoption(argv[i], 'h', "help")) {
       usage();
     } else if (isoption(argv[i], 'V', "version")) {
@@ -213,10 +218,10 @@ int main(int argc, char* argv[]) {
   }
   if (!bc) return 1;
 
-#if JQ_DEBUG
-  dump_disassembly(0, bc);
-  printf("\n");
-#endif
+  if (options & DUMP_DISASM) {
+    dump_disassembly(0, bc);
+    printf("\n");
+  }
 
   if (options & PROVIDE_NULL) {
     process(jv_null());