Lucas Stadler лет назад: 9
Родитель
Сommit
a2a6817f6b
1 измененных файлов с 4 добавлено и 8 удалено
  1. 4 8
      c/ton/main.c

+ 4 - 8
c/ton/main.c

26
char* get_contents(char *path);
26
char* get_contents(char *path);
27
27
28
#ifdef DEBUG
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
#else
30
#else
31
#define debug_print_value(prefix, ctx, val) ;
31
#define debug_print_value(prefix, ctx, val)
32
#endif
32
#endif
33
33
34
void print_value(char *prefix, JSContextRef ctx, JSValueRef exception) {
34
void print_value(char *prefix, JSContextRef ctx, JSValueRef exception) {
37
		char ex_buf[1000];
37
		char ex_buf[1000];
38
		ex_buf[0] = '\0';
38
		ex_buf[0] = '\0';
39
		JSStringGetUTF8CString(ex_str, ex_buf, 1000-1);
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
		JSStringRelease(ex_str);
41
		JSStringRelease(ex_str);
42
	}
42
	}
43
}
43
}
324
			}
324
			}
325
			free(line);
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
}