Phase 7.10: command-line args + buxc2 check/build working
Runtime: - bux_argc()/bux_argv() — command-line arg access from Bux programs - g_argc/g_argv globals — set by C main() wrapper Compiler: - C backend generates extern g_argc/g_argv + int main(argc,argv) wrapper - main.bux reads args via bux_argc/bux_argv and passes to Cli_Run buxc2 verified: - buxc2 version — reads CLI args correctly - buxc2 check <file.bux> — lexes, parses, type-checks, generates C - buxc2 build <file.bux> <output.c> — writes C output PLAN.md updated with Phase 7.10 status and remaining work. All 18 examples pass, all unit tests pass.
This commit is contained in:
@@ -544,7 +544,11 @@ proc emitModule*(be: var CBackend, module: HirModule): string =
|
||||
# Generate C main wrapper if Bux Main exists
|
||||
if hasMain:
|
||||
be.emitLine("/* C entry point wrapper */")
|
||||
be.emitLine("extern int g_argc;")
|
||||
be.emitLine("extern char** g_argv;")
|
||||
be.emitLine("int main(int argc, char** argv) {")
|
||||
be.emitLine(" g_argc = argc;")
|
||||
be.emitLine(" g_argv = argv;")
|
||||
be.emitLine(" return Main();")
|
||||
be.emitLine("}")
|
||||
be.emitLine("")
|
||||
|
||||
Reference in New Issue
Block a user