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:
@@ -7,6 +7,16 @@
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Command-line argument storage */
|
||||
int g_argc = 0;
|
||||
char** g_argv = NULL;
|
||||
|
||||
int bux_argc(void) { return g_argc; }
|
||||
char* bux_argv(int index) {
|
||||
if (index < 0 || index >= g_argc) return "";
|
||||
return g_argv[index];
|
||||
}
|
||||
|
||||
/* Memory allocation */
|
||||
void* bux_alloc(size_t size) {
|
||||
void* ptr = malloc(size);
|
||||
|
||||
Reference in New Issue
Block a user