wip
This commit is contained in:
parent
6ae9cf6e1e
commit
ae7ff555d9
5 changed files with 250 additions and 31 deletions
8
src/js.c
8
src/js.c
|
|
@ -34,13 +34,13 @@ int js_init(int argc, char** argv) {
|
|||
js_fs_init();
|
||||
|
||||
if(duk_peval_lstring(js_ctx, js_core, js_core_len) != 0) {
|
||||
printf("error: js/core.js: %s\n", duk_safe_to_string(js_ctx, -1));
|
||||
printf("JS error: js/core.js: %s\n", duk_safe_to_string(js_ctx, -1));
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define X(name, prefix) \
|
||||
if(duk_peval_lstring(js_ctx, prefix##_##name, prefix##_##name##_len) != 0) { \
|
||||
printf("error: %s: %s\n", #prefix "/" #name ".js", duk_safe_to_string(js_ctx, -1)); \
|
||||
printf("JS error: %s: %s\n", #prefix "/" #name ".js", duk_safe_to_string(js_ctx, -1)); \
|
||||
return 1; \
|
||||
}
|
||||
JS;
|
||||
|
|
@ -49,7 +49,7 @@ int js_init(int argc, char** argv) {
|
|||
if((st = js_run("pmake.js")) != 0) return st;
|
||||
|
||||
if(duk_peval_lstring(js_ctx, js_cmdline, js_cmdline_len) != 0) {
|
||||
printf("error: js/cmdline.js: %s\n", duk_safe_to_string(js_ctx, -1));
|
||||
printf("JS error: js/cmdline.js: %s\n", duk_safe_to_string(js_ctx, -1));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ int js_run(const char* file) {
|
|||
fread(buffer, 1, len, f);
|
||||
|
||||
if(duk_peval_lstring(js_ctx, buffer, len) != 0) {
|
||||
printf("error: %s: %s\n", file, duk_safe_to_string(js_ctx, -1));
|
||||
printf("JS error: %s: %s\n", file, duk_safe_to_string(js_ctx, -1));
|
||||
|
||||
free(buffer);
|
||||
fclose(f);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue