diff --git a/ueforth/Makefile b/ueforth/Makefile index 5088534..8e10567 100644 --- a/ueforth/Makefile +++ b/ueforth/Makefile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION=7.0.6.12 +VERSION=7.0.6.13 STABLE_VERSION=7.0.5.4 REVISION=$(shell git rev-parse HEAD | head -c 20) REVSHORT=$(shell echo $(REVISION) | head -c 7) @@ -26,7 +26,7 @@ WINDOWS = $(OUT)/windows ESP32 = $(OUT)/esp32 DEPLOY = $(OUT)/deploy -CFLAGS_COMMON = -std=c++11 -O2 -I ./ -I $(OUT) +CFLAGS_COMMON = -O2 -I ./ -I $(OUT) CFLAGS_MINIMIZE = \ -s \ @@ -43,6 +43,7 @@ CFLAGS_MINIMIZE = \ -fmerge-all-constants CFLAGS = $(CFLAGS_COMMON) \ $(CFLAGS_MINIMIZE) \ + -std=c++11 \ -Wall \ -Werror \ -no-pie \ @@ -170,7 +171,7 @@ WINDOWS_BOOT = common/boot.fs common/conditionals.fs common/vocabulary.fs \ common/blocks.fs common/locals.fs \ common/fini.fs $(GEN)/windows_boot.h: common/source_to_string.js $(WINDOWS_BOOT) | $(GEN) - $< boot $(VERSION) $(REVISION) $(WINDOWS_BOOT) >$@ + $< -win boot $(VERSION) $(REVISION) $(WINDOWS_BOOT) >$@ ESP32_BOOT = common/boot.fs common/conditionals.fs common/vocabulary.fs \ common/tasks.fs esp32/platform.fs esp32/highlevel.fs \ diff --git a/ueforth/common/source_to_string.js b/ueforth/common/source_to_string.js index 990c51e..9ad5d82 100755 --- a/ueforth/common/source_to_string.js +++ b/ueforth/common/source_to_string.js @@ -30,17 +30,33 @@ function DropCopyright(source) { return cleaned.join('\n'); } -var name = process.argv[2]; -var version = process.argv[3]; -var revision = process.argv[4]; +var is_windows = false; + +var args = process.argv.slice(2); +if (args.length > 0 && args[0] == '-win') { + is_windows = true; + args.shift(); +} +var name = args.shift(); +var version = args.shift(); +var revision = args.shift(); var source = ''; -for (var i = 5; i < process.argv.length; i++) { - source += DropCopyright(fs.readFileSync(process.argv[i]).toString()); +while (args.length > 0) { + source += DropCopyright(fs.readFileSync(args.shift()).toString()); } source = source.replace('{{VERSION}}', version); source = source.replace('{{REVISION}}', revision); -source = 'const char ' + name + '[] = R"""(\n' + source + ')""";\n'; +if (is_windows) { + source = source.replace(/\\/g, '\\\\'); + source = source.replace(/["]/g, '\\"'); + source = '"' + source.split('\n').join('\\n"\n"') + '\\n"'; + source = source.replace(/["] ["]/g, ''); + source = source.replace(/["] [(] ([^)]*)[)] ["]/g, '// $1'); + source = 'const char ' + name + '[] =\n' + source + ';\n'; +} else { + source = 'const char ' + name + '[] = R"""(\n' + source + ')""";\n'; +} process.stdout.write(source); diff --git a/ueforth/esp32/template.ino b/ueforth/esp32/template.ino index bfbb185..0c191b7 100644 --- a/ueforth/esp32/template.ino +++ b/ueforth/esp32/template.ino @@ -95,6 +95,8 @@ # define USER_WORDS #endif +static cell_t ResizeFile(cell_t fd, cell_t size); + #define PLATFORM_OPCODE_LIST \ FLOATING_POINT_LIST \ REQUIRED_MEMORY_SUPPORT \ @@ -297,6 +299,9 @@ # include "esp_intr_alloc.h" # include "driver/timer.h" # include "driver/gpio.h" +static cell_t EspIntrAlloc(cell_t source, cell_t flags, cell_t xt, cell_t arg, void *ret); +static cell_t GpioIsrHandlerAdd(cell_t pin, cell_t xt, cell_t arg); +static cell_t TimerIsrRegister(cell_t group, cell_t timer, cell_t xt, cell_t arg, cell_t flags, void *ret); # define OPTIONAL_INTERRUPTS_SUPPORT \ Y(gpio_config, n0 = gpio_config((const gpio_config_t *) a0)) \ Y(gpio_reset_pin, n0 = gpio_reset_pin((gpio_num_t) n0)) \ @@ -546,6 +551,7 @@ static cell_t FromIP(IPAddress ip) { # define OPTIONAL_WEBSERVER_SUPPORT #else # include +static void InvokeWebServerOn(WebServer *ws, const char *url, cell_t xt); # define ws0 ((WebServer *) a0) # define OPTIONAL_WEBSERVER_SUPPORT \ /* WebServer */ \ @@ -614,12 +620,6 @@ static char filename[PATH_MAX]; static String string_value; #endif -#ifdef ENABLE_INTERRUPTS_SUPPORT -static cell_t EspIntrAlloc(cell_t source, cell_t flags, cell_t xt, cell_t arg, cell_t *ret); -static cell_t GpioIsrHandlerAdd(cell_t pin, cell_t xt, cell_t arg); -static cell_t TimerIsrRegister(cell_t group, cell_t timer, cell_t xt, cell_t arg, void *ret); -#endif - {{core}} {{interp}} {{boot}}