Commit Graph
9 Commits
Author SHA1 Message Date
Josh Goebel c1b97522dd fix: escape backslashes in embedded Wren source strings for C compilation
Add `line.replace("\\", "\\\\")` to the `wren_to_c_string.py` script so that backslashes in Wren source code (e.g., `\n`, `\r`, `\x1b`) are properly escaped when embedded as C string literals. This fixes incorrect escape sequences in `io.wren.inc` and `repl.wren.inc` that caused runtime failures when reading line separators and rendering REPL output.
2021-05-21 23:09:05 +00:00
Josh Goebel b22f1ab185 chore: replace manual fiber scheduling with Scheduler.await_ in io and timer modules
Refactor File.openWithFlags, File.close, Stat.path, and Timer.sleep to use the new
Scheduler.await_ block syntax instead of manually calling runNextScheduled_ after
each foreign operation. This simplifies the async pattern and ensures proper fiber
suspension. Also fix File.close to check isOpen flag before attempting close.
2021-05-04 21:59:25 +00:00
Josh Goebel 27cf54d449 feat: add Directory.create/delete and refactor io module to use Scheduler.await_
Add foreign static methods `create_` and `delete_` to the Directory class in the Wren io module, backed by C implementations using `uv_fs_mkdir` and `uv_fs_rmdir` with proper error handling via `schedulerResumeError`. Refactor existing `Directory.list` and `File.delete` to use the new `Scheduler.await_` helper instead of manually calling `runNextScheduled_`, and rename `ensurePath_` to `ensureString_` for consistency across both classes. Introduce a new test file `create_delete.wren` that validates directory creation, existence checks, and deletion on both POSIX and Windows platforms.
2021-05-01 22:58:17 +00:00
Josh Goebel 7b56ba281b chore: update generated file headers to reference wren_to_c_string.py
Replace the generic "Do not edit" comment in all five `.wren.inc` files with a
more informative preamble that explicitly names the source `.wren` file and the
`util/wren_to_c_string.py` generator script, and update the script's own
`PREAMBLE` template accordingly.
2021-04-28 21:49:10 +00:00
Josh Goebel 0045a5218a docs: add make.mac project instructions to README alongside existing make section 2021-04-28 21:48:31 +00:00
Josh Goebel aaca62617c fix: add leading space to format lines and update source paths in metrics output
- Prepend a space to C_FORMAT_LINE and WREN_FORMAT_LINE for consistent column alignment
- Add hr() helper function to print horizontal separators for readability
- Change C metrics label from empty string to "C" and WREN label from empty to "WREN"
- Update source directories from "src/vm" and "src/optional" to "deps/wren/src/vm" and "deps/wren/src/optional" to match actual project structure
2021-04-28 21:47:22 +00:00
Josh Goebel 857d11fc73 test: add platform name validation and version component count checks
Extend cross-platform tests to verify Platform.name returns one of seven known
OS strings and assert Process.version splits into exactly three numeric
components, while fixing missing trailing newline in isPosix test file.
2021-04-28 21:45:50 +00:00
Josh Goebel e65ab48dc2 feat: replace FINALIZER macro with ALLOCATE and FINALIZE for parity in module bindings
Add ALLOCATE macro alongside existing FINALIZE macro to provide symmetric
handling of foreign method allocation and finalization in the module
registry. Update File class bindings to use the new ALLOCATE macro for
fileAllocate and FINALIZE for fileFinalize, replacing the previous
FINALIZER macro usage.
2021-04-28 21:44:36 +00:00
Josh Goebel bf822779f0 fix: add .gitattributes to map .wren files as JavaScript for GitHub linguist highlighting 2021-04-28 21:41:02 +00:00