From e93a62e0af0e75d20039302949d687dc2acfed58 Mon Sep 17 00:00:00 2001
From: Brad Nelson
Date: Thu, 11 Feb 2021 22:59:21 -0800
Subject: [PATCH] -> ESP32forth
---
ueforth/Makefile | 28 ++++++++++++++++------------
ueforth/arduino/arduino.template.ino | 6 +++---
ueforth/common/core.h | 6 +++---
ueforth/common/interp.h | 2 +-
ueforth/posix/posix_main.c | 4 ++--
ueforth/site/index.html | 12 ++++++------
ueforth/windows/windows_interp.h | 2 +-
ueforth/windows/windows_main.c | 4 ++--
8 files changed, 34 insertions(+), 30 deletions(-)
diff --git a/ueforth/Makefile b/ueforth/Makefile
index dbaf64c..a516b7a 100644
--- a/ueforth/Makefile
+++ b/ueforth/Makefile
@@ -1,3 +1,5 @@
+VERSION=7.0.1
+
OUT = out
GEN = $(OUT)/gen
RES = $(OUT)/resources
@@ -51,7 +53,7 @@ WIN_LFLAGS64 = /LIBPATH:"c:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Lib
TARGETS = $(WEB)/terminal.html \
$(WEB)/ueforth.js \
$(POSIX)/ueforth \
- $(ARDUINO)/ueforth/ueforth.ino
+ $(ARDUINO)/ESP32forth-$(VERSION)/ESP32forth-$(VERSION).ino
FINDQ = find 2>/dev/null
@@ -239,39 +241,41 @@ $(WINDOWS)/uEf64.exe: \
# ---- ARDUINO ----
-$(ARDUINO)/ueforth:
+$(ARDUINO)/ESP32forth-$(VERSION):
mkdir -p $@
-$(ARDUINO)/ueforth/ueforth.ino: \
+$(ARDUINO)/ESP32forth-$(VERSION)/ESP32forth-$(VERSION).ino: \
arduino/fuse_ino.js \
arduino/arduino.template.ino \
common/opcodes.h \
common/calling.h \
common/core.h \
common/interp.h \
- $(GEN)/arduino_boot.h | $(ARDUINO)/ueforth
+ $(GEN)/arduino_boot.h | $(ARDUINO)/ESP32forth-$(VERSION)
$^ >$@
# ---- PACKAGE ----
-$(ARDUINO)/ueforth-arduino-esp32.zip: $(ARDUINO)/ueforth/ueforth.ino
- cd $(ARDUINO) && zip -r ueforth-arduino-esp32.zip ueforth
+$(ARDUINO)/ESP32forth-$(VERSION).zip: $(ARDUINO)/ESP32forth-$(VERSION)/ESP32forth-$(VERSION).ino
+ cd $(ARDUINO) && zip -r ESP32forth-$(VERSION).zip ESP32forth-$(VERSION)
# ---- DEPLOY ----
$(DEPLOY):
mkdir -p $@
-$(DEPLOY)/app.yaml: $(ARDUINO)/ueforth-arduino-esp32.zip \
+$(DEPLOY)/app.yaml: $(ARDUINO)/ESP32forth-$(VERSION).zip \
site/index.html \
site/app.yaml \
site/eforth.go \
$(TARGETS) | $(DEPLOY)
mkdir -p $(DEPLOY)/static
- cp -r $(ARDUINO)/ueforth-arduino-esp32.zip $(DEPLOY)/static
- cp -r $(POSIX)/ueforth $(DEPLOY)/static/ueforth.linux
- cp -r $(WINDOWS)/uEf32.exe $(DEPLOY)/static/uEf32.exe
- cp -r $(WINDOWS)/uEf64.exe $(DEPLOY)/static/uEf64.exe
+ cp -r $(ARDUINO)/ESP32forth-$(VERSION).zip $(DEPLOY)/static
+ cp -r $(POSIX)/ueforth $(DEPLOY)/static/ueforth-$(VERSION).linux
+ cp -r $(WINDOWS)/uEf32.exe $(DEPLOY)/static/uEf32-$(VERSION).exe
+ cp -r $(WINDOWS)/uEf64.exe $(DEPLOY)/static/uEf64-$(VERSION).exe
cp -r $(RES)/eforth.ico $(DEPLOY)/static/favicon.ico
- cp -r site/* $(DEPLOY)
+ cp -r site/*.go $(DEPLOY)
+ cp -r site/*.yaml $(DEPLOY)
+ sed 's/{{VERSION}}/$(VERSION)/g' site/index.html >$(DEPLOY)/index.html
cp -r site/.gcloudignore $(DEPLOY)
diff --git a/ueforth/arduino/arduino.template.ino b/ueforth/arduino/arduino.template.ino
index 4f37704..d441837 100644
--- a/ueforth/arduino/arduino.template.ino
+++ b/ueforth/arduino/arduino.template.ino
@@ -336,16 +336,16 @@ static void InvokeWebServerOn(WebServer *ws, const char *url, cell_t xt) {
cell_t *rp = rstack;
*++rp = (cell_t) (stack + 1);
*++rp = (cell_t) code;
- ueforth_run(rp);
+ forth_run(rp);
});
}
#endif
void setup() {
cell_t *heap = (cell_t *) malloc(HEAP_SIZE);
- ueforth_init(0, 0, heap, boot, sizeof(boot));
+ forth_init(0, 0, heap, boot, sizeof(boot));
}
void loop() {
- g_sys.rp = ueforth_run(g_sys.rp);
+ g_sys.rp = forth_run(g_sys.rp);
}
diff --git a/ueforth/common/core.h b/ueforth/common/core.h
index f381eab..d08b1cc 100644
--- a/ueforth/common/core.h
+++ b/ueforth/common/core.h
@@ -125,9 +125,9 @@ static cell_t *evaluate1(cell_t *sp) {
return sp;
}
-static cell_t *ueforth_run(cell_t *initrp);
+static cell_t *forth_run(cell_t *initrp);
-static void ueforth_init(int argc, char *argv[], void *heap,
+static void forth_init(int argc, char *argv[], void *heap,
const char *src, cell_t src_len) {
g_sys.heap = (cell_t *) heap + 4; // Leave a little room.
cell_t *sp = g_sys.heap + 1; g_sys.heap += STACK_SIZE;
@@ -142,7 +142,7 @@ static void ueforth_init(int argc, char *argv[], void *heap,
*g_sys.heap++ = (cell_t) forth;
for (int i = 0; i < VOCABULARY_DEPTH; ++i) { *g_sys.heap++ = 0; }
- ueforth_run(0);
+ forth_run(0);
(*g_sys.current)[-1] = IMMEDIATE; // Make last word ; IMMEDIATE
g_sys.DOLIT_XT = FIND("DOLIT");
g_sys.DOEXIT_XT = FIND("EXIT");
diff --git a/ueforth/common/interp.h b/ueforth/common/interp.h
index 76a7021..63af230 100644
--- a/ueforth/common/interp.h
+++ b/ueforth/common/interp.h
@@ -4,7 +4,7 @@
#define ADDR_DOCREATE && OP_DOCREATE
#define ADDR_DODOES && OP_DODOES
-static cell_t *ueforth_run(cell_t *init_rp) {
+static cell_t *forth_run(cell_t *init_rp) {
if (!init_rp) {
#define X(name, op, code) create(name, sizeof(name) - 1, name[0] == ';', && OP_ ## op);
PLATFORM_OPCODE_LIST
diff --git a/ueforth/posix/posix_main.c b/ueforth/posix/posix_main.c
index 236d650..68bc9de 100644
--- a/ueforth/posix/posix_main.c
+++ b/ueforth/posix/posix_main.c
@@ -19,7 +19,7 @@
int main(int argc, char *argv[]) {
void *heap = mmap(0, HEAP_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
- ueforth_init(argc, argv, heap, boot, sizeof(boot));
- for (;;) { g_sys.rp = ueforth_run(g_sys.rp); }
+ forth_init(argc, argv, heap, boot, sizeof(boot));
+ for (;;) { g_sys.rp = forth_run(g_sys.rp); }
return 1;
}
diff --git a/ueforth/site/index.html b/ueforth/site/index.html
index 3065b6c..df4ac17 100644
--- a/ueforth/site/index.html
+++ b/ueforth/site/index.html
@@ -43,10 +43,10 @@ EForth is a delightfully minimalist approach to Forth originated by Bill Muench
A reduced cross-platform EForth version
- - ueforth-arduino-esp32.zip
- - ESP32 Arduino Source Code ← SVFIG & Forth2020 folks start here!
+
- ESP32forth-{{VERSION}}.zip
+ - ESP32forth Source Code ← SVFIG & Forth2020 folks start here!
- - Regular ESP32 (may work better with your particular board)
+
- ESP32 Dev Module or similar (may work better with your particular board)
- Board: ESP32 Dev Module
- Partition Scheme: No OTA (2M APP, 2M SPIFFS) ← Non-default
@@ -68,9 +68,9 @@ A reduced cross-platform EForth version
- - uEf32.exe - Window 32-bit EXE µEforth
- - uEf64.exe - Window 64-bit EXE µEforth
- - ueforth.linux - Linux 64-bit Executable µEforth
+ - uEf32-{{VERSION}}.exe - Window 32-bit EXE µEforth
+ - uEf64-{{VERSION}}.exe - Window 64-bit EXE µEforth
+ - ueforth-{{VERSION}}.linux - Linux 64-bit Executable µEforth
diff --git a/ueforth/windows/windows_interp.h b/ueforth/windows/windows_interp.h
index e80733d..1dec86f 100644
--- a/ueforth/windows/windows_interp.h
+++ b/ueforth/windows/windows_interp.h
@@ -14,7 +14,7 @@ enum {
#undef X
};
-static cell_t *ueforth_run(cell_t *init_rp) {
+static cell_t *forth_run(cell_t *init_rp) {
if (!init_rp) {
#define X(name, op, code) \
create(name, sizeof(name) - 1, name[0] == ';', (void *) OP_ ## op);
diff --git a/ueforth/windows/windows_main.c b/ueforth/windows/windows_main.c
index ce4e683..4f43f9f 100644
--- a/ueforth/windows/windows_main.c
+++ b/ueforth/windows/windows_main.c
@@ -39,7 +39,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmd, int show) {
#endif
void *heap = VirtualAlloc(
NULL, HEAP_SIZE, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
- ueforth_init(0, 0, heap, boot, sizeof(boot));
- for (;;) { g_sys.rp = ueforth_run(g_sys.rp); }
+ forth_init(0, 0, heap, boot, sizeof(boot));
+ for (;;) { g_sys.rp = forth_run(g_sys.rp); }
}