Commit Graph

6 Commits

Author SHA1 Message Date
Bob Nystrom
810da1f0fc feat: add libuv event loop integration with timer module and CLI restructuring
Add a vertical slice of real libuv integration by introducing a "timer" CLI module with a Timer class and static sleep() method. This required significant infrastructure changes: setting up libuv event loop in the CLI, creating a new src/module directory for CLI modules, updating all build scripts (Makefile, wren.mk, Xcode project) to handle the new module compilation, and reorganizing CLI code by moving REPL logic from main.c to vm.c. The generate_builtins.py script was also updated to support copying Wren sources into the module directory.
2015-08-07 15:10:55 +00:00
Bob Nystrom
ab12bc97e0 fix: remove redundant free in setRootDirectory and fix memory leak in runFile 2015-06-27 06:01:07 +00:00
André Althaus
f6014d41e8 fix: free previously allocated rootDirectory before reassignment and clear on VM teardown
Add missing free of the old rootDirectory pointer in setRootDirectory to prevent
memory leaks when the function is called multiple times. Also set rootDirectory
to NULL via setRootDirectory after VM teardown in runFile to ensure the pointer
is properly cleared before program exit.
2015-06-03 19:48:26 +00:00
Bob Nystrom
7ed5603ffc refactor: rename package module loading to module directory loading in readModule
Rename the internal concept from "package" to "module directory" when loading
module.wren files from subdirectories. Update variable names (packageModule
to moduleDir, packageModulePath to moduleDirPath) and adjust early return
logic to free modulePath before checking contents. Add test for loading
module from a directory and remove old package module test.
2015-03-23 13:48:08 +00:00
Gavin Schulz
1374797192 feat: fall back to loading module package when module file not found
Extract file path construction into `wrenFilePath` helper and modify `readModule` to first attempt loading the module as a `.wren` file. If that fails, treat the module name as a package directory and try to load `module.wren` from within it. Add test files `module_package/module.wren` and `package_module.wren` to verify the new package resolution behavior.
2015-03-21 23:05:02 +00:00
Bob Nystrom
11a61b47ab feat: extract CLI file loading functions into separate io.c and io.h
Extract the static `readFile`, `readModule`, and `setRootDirectory` functions from main.c into a new io module, replacing the fixed-size `rootDirectory` array with a heap-allocated pointer and adding the corresponding header with public declarations.
2015-03-16 14:22:52 +00:00