Sfoglia il codice sorgente

Use print_value in the repl

Lucas Stadler 9 anni fa
parent
commit
a2a6817f6b
1 ha cambiato i file con 4 aggiunte e 8 eliminazioni
  1. 4 8
      c/ton/main.c

+ 4 - 8
c/ton/main.c

@ -26,9 +26,9 @@ JSObjectRef get_function(JSContextRef ctx, char *namespace, char *name);
26 26
char* get_contents(char *path);
27 27
28 28
#ifdef DEBUG
29
#define debug_print_value(prefix, ctx, val)	print_value(prefix, ctx, val);
29
#define debug_print_value(prefix, ctx, val)	print_value(prefix ": ", ctx, val)
30 30
#else
31
#define debug_print_value(prefix, ctx, val) ;
31
#define debug_print_value(prefix, ctx, val)
32 32
#endif
33 33
34 34
void print_value(char *prefix, JSContextRef ctx, JSValueRef exception) {
@ -37,7 +37,7 @@ void print_value(char *prefix, JSContextRef ctx, JSValueRef exception) {
37 37
		char ex_buf[1000];
38 38
		ex_buf[0] = '\0';
39 39
		JSStringGetUTF8CString(ex_str, ex_buf, 1000-1);
40
		printf("%s: %s\n", prefix, ex_buf);
40
		printf("%s%s\n", prefix, ex_buf);
41 41
		JSStringRelease(ex_str);
42 42
	}
43 43
}
@ -324,11 +324,7 @@ int main(int argc, char **argv) {
324 324
			}
325 325
			free(line);
326 326
327
			char res_buf[1000];
328
			res_buf[0] = '\0';
329
			JSStringRef res_str = to_string(ctx, res);
330
			JSStringGetUTF8CString(res_str, res_buf, 1000);
331
			printf("%s\n", res_buf);
327
			print_value("", ctx, res);
332 328
		}
333 329
	}
334 330
}