feat: replace inline C string literals with auto-generated .wren.inc includes
Replace the manually embedded C string constants for builtin Wren modules with a new build system that automatically generates `.wren.inc` header files from `.wren` source files. The old `script/generate_builtins.py` is removed and replaced by `script/wren_to_c_string.py`, which produces standalone include files with a `PREAMBLE` containing the module name and source path. The Makefile gains pattern rules to rebuild these `.wren.inc` files whenever the corresponding `.wren` source changes, and the `builtin` phony target is removed since the generation is now automatic. The `wren.mk` wildcard lists are updated to include the new `.wren.inc` files as dependencies. The `timer.c` and `wren_core.c` source files now `#include` their respective `.wren.inc` headers instead of defining the string literals inline, and the `timer.wren` trailing newline is removed.
This commit is contained in:
+7
-5
@@ -1,7 +1,9 @@
|
||||
The Wren scripts in this directory get converted to C string literals and then
|
||||
inserted into their respective .c files so that the interpreter can load them
|
||||
directly without having to do any file IO.
|
||||
The Wren scripts in this directory get converted to C string literals into files
|
||||
with a `.wren.inc` extension. Those are then `#includ`ed into their respective
|
||||
`.c` files so that the interpreter can load them directly without having to do
|
||||
any file IO.
|
||||
|
||||
The script that does this copying is `script/generate_builtins.py`.
|
||||
The script that does this translation is `script/wren_to_c_string.py`.
|
||||
|
||||
You can invoke using `make builtin`.
|
||||
When any of the ".wren" files in here are changed, the Makefile automatically
|
||||
updates the generated C headers.
|
||||
|
||||
Reference in New Issue
Block a user