This commit is contained in:
Nishi 2026-05-09 16:20:44 +09:00
commit ae7ff555d9
Signed by: nishi
GPG key ID: 27EF69B208EB9343
5 changed files with 250 additions and 31 deletions

View file

@ -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);