Merge branch 'cli_audit' into ir_artifact
This commit is contained in:
@@ -277,13 +277,11 @@ static int run_test_suite(size_t heap_size)
|
||||
|
||||
static void print_usage(const char *prog)
|
||||
{
|
||||
printf("Usage: %s [options] <script> [args...]\n\n", prog);
|
||||
printf("Run a cell script (.ce actor or .cm module).\n\n");
|
||||
printf("Usage: %s [options] <program> [args...]\n\n", prog);
|
||||
printf("Run a cell program (.ce actor).\n\n");
|
||||
printf("Options:\n");
|
||||
printf(" --core <path> Set core path directly (overrides CELL_CORE)\n");
|
||||
printf(" --shop <path> Set shop path (overrides CELL_SHOP)\n");
|
||||
printf(" --emit-qbe Emit QBE IL (for native compilation)\n");
|
||||
printf(" --dump-mach Dump MACH bytecode disassembly\n");
|
||||
printf(" --dev Dev mode (shop=.cell, core=.)\n");
|
||||
printf(" --test [heap_size] Run C test suite\n");
|
||||
printf(" -h, --help Show this help message\n");
|
||||
@@ -316,24 +314,13 @@ int cell_init(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Default: run script through bootstrap pipeline */
|
||||
int emit_qbe = 0;
|
||||
int dump_mach = 0;
|
||||
int arg_start = 1;
|
||||
const char *shop_override = NULL;
|
||||
const char *core_override = NULL;
|
||||
|
||||
// Parse flags (order-independent)
|
||||
while (arg_start < argc && argv[arg_start][0] == '-') {
|
||||
if (strcmp(argv[arg_start], "--mcode") == 0) {
|
||||
/* --mcode is now always on; accept and ignore for compat */
|
||||
arg_start++;
|
||||
} else if (strcmp(argv[arg_start], "--emit-qbe") == 0) {
|
||||
emit_qbe = 1;
|
||||
arg_start++;
|
||||
} else if (strcmp(argv[arg_start], "--dump-mach") == 0) {
|
||||
dump_mach = 1;
|
||||
arg_start++;
|
||||
} else if (strcmp(argv[arg_start], "--shop") == 0) {
|
||||
if (strcmp(argv[arg_start], "--shop") == 0) {
|
||||
if (arg_start + 1 >= argc) {
|
||||
printf("ERROR: --shop requires a path argument\n");
|
||||
return 1;
|
||||
@@ -363,6 +350,11 @@ int cell_init(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (arg_start >= argc) {
|
||||
print_usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!find_cell_shop(shop_override, core_override)) return 1;
|
||||
|
||||
actor_initialize();
|
||||
@@ -427,8 +419,9 @@ int cell_init(int argc, char **argv)
|
||||
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, "emit_qbe", JS_NewBool(ctx, emit_qbe));
|
||||
JS_SetPropertyStr(ctx, hidden_env, "dump_mach", JS_NewBool(ctx, dump_mach));
|
||||
/* TODO: remove after next 'make regen' — old bootstrap.mach reads these */
|
||||
JS_SetPropertyStr(ctx, hidden_env, "emit_qbe", JS_FALSE);
|
||||
JS_SetPropertyStr(ctx, hidden_env, "dump_mach", JS_FALSE);
|
||||
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));
|
||||
|
||||
Reference in New Issue
Block a user