no more special case for core C
This commit is contained in:
@@ -42,12 +42,12 @@ static char *compute_blake2_hex(const char *data, size_t size) {
|
||||
return hex;
|
||||
}
|
||||
|
||||
// Build cache path: shop_path/build/<hex>.mach (caller must free)
|
||||
// Build cache path: shop_path/build/<hex> (caller must free)
|
||||
static char *build_cache_path(const char *hex) {
|
||||
if (!shop_path) return NULL;
|
||||
size_t len = strlen(shop_path) + strlen("/build/") + 64 + strlen(".mach") + 1;
|
||||
size_t len = strlen(shop_path) + strlen("/build/") + 64 + 1;
|
||||
char *path = malloc(len);
|
||||
snprintf(path, len, "%s/build/%s.mach", shop_path, hex);
|
||||
snprintf(path, len, "%s/build/%s", shop_path, hex);
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -225,11 +225,8 @@ void actor_disrupt(cell_rt *crt)
|
||||
actor_free(crt);
|
||||
}
|
||||
|
||||
JSValue js_os_use(JSContext *js);
|
||||
JSValue js_math_use(JSContext *js);
|
||||
JSValue js_json_use(JSContext *js);
|
||||
JSValue js_nota_use(JSContext *js);
|
||||
JSValue js_wota_use(JSContext *js);
|
||||
JSValue js_core_os_use(JSContext *js);
|
||||
JSValue js_core_json_use(JSContext *js);
|
||||
|
||||
void script_startup(cell_rt *prt)
|
||||
{
|
||||
@@ -255,7 +252,7 @@ void script_startup(cell_rt *prt)
|
||||
prt->actor_sym_ref.val = JS_NULL;
|
||||
|
||||
cell_rt *crt = JS_GetContextOpaque(js);
|
||||
JS_FreeValue(js, js_blob_use(js));
|
||||
JS_FreeValue(js, js_core_blob_use(js));
|
||||
|
||||
// Load pre-compiled bootstrap .mcode
|
||||
size_t boot_size;
|
||||
@@ -276,10 +273,8 @@ void script_startup(cell_rt *prt)
|
||||
|
||||
// Create hidden environment
|
||||
JSValue hidden_env = JS_NewObject(js);
|
||||
JS_SetPropertyStr(js, hidden_env, "os", js_os_use(js));
|
||||
JS_SetPropertyStr(js, hidden_env, "json", js_json_use(js));
|
||||
JS_SetPropertyStr(js, hidden_env, "nota", js_nota_use(js));
|
||||
JS_SetPropertyStr(js, hidden_env, "wota", js_wota_use(js));
|
||||
JS_SetPropertyStr(js, hidden_env, "os", js_core_os_use(js));
|
||||
JS_SetPropertyStr(js, hidden_env, "json", js_core_json_use(js));
|
||||
|
||||
crt->actor_sym_ref.val = JS_NewObject(js);
|
||||
JS_SetPropertyStr(js, hidden_env, "actorsym", JS_DupValue(js, crt->actor_sym_ref.val));
|
||||
@@ -502,17 +497,15 @@ int cell_init(int argc, char **argv)
|
||||
|
||||
root_cell = cli_rt;
|
||||
|
||||
JS_FreeValue(ctx, js_blob_use(ctx));
|
||||
JS_FreeValue(ctx, js_core_blob_use(ctx));
|
||||
|
||||
JSValue hidden_env = JS_NewObject(ctx);
|
||||
JS_SetPropertyStr(ctx, hidden_env, "os", js_os_use(ctx));
|
||||
JS_SetPropertyStr(ctx, hidden_env, "os", js_core_os_use(ctx));
|
||||
JS_SetPropertyStr(ctx, hidden_env, "core_path", JS_NewString(ctx, core_path));
|
||||
JS_SetPropertyStr(ctx, hidden_env, "shop_path",
|
||||
shop_path ? JS_NewString(ctx, shop_path) : JS_NULL);
|
||||
JS_SetPropertyStr(ctx, hidden_env, "actorsym", JS_DupValue(ctx, cli_rt->actor_sym_ref.val));
|
||||
JS_SetPropertyStr(ctx, hidden_env, "json", js_json_use(ctx));
|
||||
JS_SetPropertyStr(ctx, hidden_env, "nota", js_nota_use(ctx));
|
||||
JS_SetPropertyStr(ctx, hidden_env, "wota", js_wota_use(ctx));
|
||||
JS_SetPropertyStr(ctx, hidden_env, "json", js_core_json_use(ctx));
|
||||
JS_SetPropertyStr(ctx, hidden_env, "init", JS_NULL);
|
||||
JSValue args_arr = JS_NewArray(ctx);
|
||||
for (int i = arg_start; i < argc; i++) {
|
||||
|
||||
Reference in New Issue
Block a user