diff --git a/builtin/README.md b/builtin/README.md deleted file mode 100644 index 956ebadf..00000000 --- a/builtin/README.md +++ /dev/null @@ -1,9 +0,0 @@ -The Wren scripts in this directory get converted to C string literals into files -with a `.wren.inc` extension. Those are then `#include`d 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 translation is `util/wren_to_c_string.py`. - -When any of the ".wren" files in here are changed, the Makefile automatically -updates the generated C headers. diff --git a/src/README.md b/src/README.md index c5312ffd..b6c105a9 100644 --- a/src/README.md +++ b/src/README.md @@ -1,19 +1,24 @@ This contains the Wren source code. It is organized like so: -* `cli`: the source code for the command line interface. This is a custom - exectuable that embeds the VM in itself. Code here handles reading - command-line, running the REPL, loading modules from disc, etc. +* `aux`: the Wren and C source code for the auxiliary modules. These are built + in to the VM and can be used even when you embed the VM in your own + application. But they are also optional and can be compiled out by setting + defines. -* `include`: the public header directory for the VM. If you are embedding the - VM in your own application, you will add this to your include path. +* `cli`: the source code for the command line interface. This is a custom + exectuable that embeds the VM in itself. Code here handles reading + command-line, running the REPL, loading modules from disc, etc. -* `module`: the source code for the built-in modules that come with the CLI. - These modules are written in a mixture of C and Wren and generally use - [libuv][] to implement their underlying functionality. +* `include`: the public header directory for the VM. If you are embedding the + VM in your own application, you will add this to your include path. -* `vm`: the source code for the Wren VM itself. Unlike code in `cli` and - `module`, this has no dependencies on libuv. If you are embedding the VM in - your own application from source, you will compile the files here into your - app. +* `module`: the source code for the built-in modules that come with the CLI. + These modules are written in a mixture of C and Wren and generally use + [libuv][] to implement their underlying functionality. + +* `vm`: the source code for the Wren VM itself. Unlike code in `cli` and + `module`, this has no dependencies on libuv. If you are embedding the VM in + your own application from source, you will compile the files here into your + app. [libuv]: http://libuv.org/ diff --git a/src/aux/wren_aux_random.wren.inc b/src/aux/wren_aux_random.wren.inc index 4f39756d..cc2d5b31 100644 --- a/src/aux/wren_aux_random.wren.inc +++ b/src/aux/wren_aux_random.wren.inc @@ -1,4 +1,4 @@ -// Generated automatically from src/module/random.wren. Do not edit. +// Generated automatically from src/aux/wren_aux_random.wren. Do not edit. static const char* randomModuleSource = "foreign class Random {\n" " construct new() {\n" diff --git a/builtin/core.wren b/src/vm/wren_core.wren similarity index 100% rename from builtin/core.wren rename to src/vm/wren_core.wren diff --git a/src/vm/wren_core.wren.inc b/src/vm/wren_core.wren.inc index 3a81df0e..1fce5623 100644 --- a/src/vm/wren_core.wren.inc +++ b/src/vm/wren_core.wren.inc @@ -1,4 +1,4 @@ -// Generated automatically from builtin/core.wren. Do not edit. +// Generated automatically from src/vm/wren_core.wren. Do not edit. static const char* coreModuleSource = "class Bool {}\n" "class Fiber {}\n" diff --git a/util/wren.mk b/util/wren.mk index 21ab9a41..478bdea5 100644 --- a/util/wren.mk +++ b/util/wren.mk @@ -208,7 +208,7 @@ $(LIBUV): $(LIBUV_DIR)/build/gyp/gyp util/libuv.py src/aux/wren_aux_%.wren.inc: src/aux/wren_aux_%.wren util/wren_to_c_string.py @ ./util/wren_to_c_string.py $@ $< -src/vm/wren_%.wren.inc: builtin/%.wren util/wren_to_c_string.py +src/vm/wren_%.wren.inc: src/vm/wren_%.wren util/wren_to_c_string.py @ ./util/wren_to_c_string.py $@ $< src/module/%.wren.inc: src/module/%.wren util/wren_to_c_string.py diff --git a/util/wren_to_c_string.py b/util/wren_to_c_string.py index c93b1b1a..f33bc3c6 100755 --- a/util/wren_to_c_string.py +++ b/util/wren_to_c_string.py @@ -42,7 +42,8 @@ def main(): wren_source_lines = f.readlines() module = os.path.splitext(os.path.basename(args.input))[0] - module = module.replace("wren_aux_", "") + module = module.replace("aux_", "") + module = module.replace("wren_", "") c_source = wren_to_c_string(args.input, wren_source_lines, module)