|
|
@ -82,7 +82,6 @@ JSValueRef function_console_error(JSContextRef ctx, JSObjectRef function, JSObje
|
|
82
|
82
|
JSValueRef function_read_file(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject,
|
|
83
|
83
|
size_t argc, const JSValueRef args[], JSValueRef* exception) {
|
|
84
|
84
|
// TODO: implement fully
|
|
85
|
|
fprintf(stderr, "WARN: %s: stub\n", __func__);
|
|
86
|
85
|
|
|
87
|
86
|
if (argc == 1 && JSValueGetType(ctx, args[0]) == kJSTypeString) {
|
|
88
|
87
|
char path[100];
|
|
|
@ -90,7 +89,7 @@ JSValueRef function_read_file(JSContextRef ctx, JSObjectRef function, JSObjectRe
|
|
90
|
89
|
JSStringGetUTF8CString(path_str, path, 100);
|
|
91
|
90
|
JSStringRelease(path_str);
|
|
92
|
91
|
|
|
93
|
|
debug_print_value("read_file", ctx, args[0]);
|
|
|
92
|
// debug_print_value("read_file", ctx, args[0]);
|
|
94
|
93
|
|
|
95
|
94
|
char full_path[150];
|
|
96
|
95
|
// TODO: should not load from here?
|
|
|
@ -115,7 +114,6 @@ JSValueRef function_read_file(JSContextRef ctx, JSObjectRef function, JSObjectRe
|
|
115
|
114
|
JSValueRef function_load(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject,
|
|
116
|
115
|
size_t argc, const JSValueRef args[], JSValueRef* exception) {
|
|
117
|
116
|
// TODO: implement fully
|
|
118
|
|
fprintf(stderr, "WARN: %s: stub\n", __func__);
|
|
119
|
117
|
|
|
120
|
118
|
if (argc == 1 && JSValueGetType(ctx, args[0]) == kJSTypeString) {
|
|
121
|
119
|
char path[100];
|
|
|
@ -123,7 +121,7 @@ JSValueRef function_load(JSContextRef ctx, JSObjectRef function, JSObjectRef thi
|
|
123
|
121
|
JSStringGetUTF8CString(path_str, path, 100);
|
|
124
|
122
|
JSStringRelease(path_str);
|
|
125
|
123
|
|
|
126
|
|
debug_print_value("load", ctx, args[0]);
|
|
|
124
|
// debug_print_value("load", ctx, args[0]);
|
|
127
|
125
|
|
|
128
|
126
|
char full_path[150];
|
|
129
|
127
|
// TODO: should not load from here?
|
|
|
@ -209,7 +207,7 @@ JSValueRef function_eval(JSContextRef ctx, JSObjectRef function, JSObjectRef thi
|
|
209
|
207
|
if (argc == 2
|
|
210
|
208
|
&& JSValueGetType(ctx, args[0]) == kJSTypeString
|
|
211
|
209
|
&& JSValueGetType(ctx, args[1]) == kJSTypeString) {
|
|
212
|
|
debug_print_value("eval", ctx, args[0]);
|
|
|
210
|
// debug_print_value("eval", ctx, args[0]);
|
|
213
|
211
|
|
|
214
|
212
|
JSStringRef sourceRef = JSValueToStringCopy(ctx, args[0], NULL);
|
|
215
|
213
|
JSStringRef pathRef = JSValueToStringCopy(ctx, args[1], NULL);
|
|
|
@ -726,7 +724,7 @@ char *get_contents(char *path, time_t *last_modified) {
|
|
726
|
724
|
return buf;
|
|
727
|
725
|
|
|
728
|
726
|
err:
|
|
729
|
|
printf("get_contents(\"%s\"): %s: %s\n", path, err_prefix, strerror(errno));
|
|
|
727
|
//printf("get_contents(\"%s\"): %s: %s\n", path, err_prefix, strerror(errno));
|
|
730
|
728
|
return NULL;
|
|
731
|
729
|
}
|
|
732
|
730
|
|