about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--README.txt8
-rw-r--r--evoke.e11
-rw-r--r--hex.e6
-rw-r--r--inscribe-evoke.e8
-rw-r--r--inscribe-hex.e8
-rw-r--r--transform.e30
6 files changed, 61 insertions, 10 deletions
diff --git a/README.txt b/README.txt
index a767f43..55ba61b 100644
--- a/README.txt
+++ b/README.txt
@@ -264,7 +264,7 @@ built-in library.
 the compiler. When you have a change you want to try it out, you can use your
 existing copy of Evocation to compile a new one, like this:
 
-  $ cat labels.e elf.e transform.e execution.e evoke.e | ./evoke > evoke2
+  $ cat evoke.e | ./evoke > evoke2
   $ chmod 755 evoke2
 
   You can then run ./evoke2 and try out the new features you added. Fun,
@@ -332,18 +332,18 @@ can be metacircular while you're metacircular.)
 
   If you need to compile "hex", you can do so as follows:
 
-  $ cat labels.e elf.e hex.e | ./evoke > hex
+  $ cat hex.e | ./evoke > hex
   $ chmod 755 hex
 
   To produce the hex-dump version of it, do:
 
-  $ cat labels.e elf.e transform.e inscribe-hex.e | ./evoke > hex.hex
+  $ cat inscribe-hex.e | ./evoke > hex.hex
 
   The program "hex" is written in Evocation-assembly, but the hex transform
 also works on Forth programs, including Evocation itself. To produce the
 hex-dump version of Evocation, do:
 
-  $ cat labels.e elf.e transform.e inscribe-evoke.e | ./evoke > evoke.hex
+  $ cat inscribe-evoke.e | ./evoke > evoke.hex
 
   It should run to completion, producing output in evoke.hex. Passing
 evoke.hex through ./hex will give a binary that's byte-for-byte identical to
diff --git a/evoke.e b/evoke.e
index acd8f8e..7e6225f 100644
--- a/evoke.e
+++ b/evoke.e
@@ -1,4 +1,9 @@
-~ cat labels.e elf.e transform.e execution.e evoke.e | ./evoke > evoke2
+~ cat evoke.e | ./evoke > evoke2 && chmod 755 evoke2
+
+s" labels.e" include
+s" elf.e" include
+s" transform.e" include
+s" execution.e" include
 
 : read-inputs
   here @ dup
@@ -8,7 +13,7 @@
   s" amd64.e" pack-file-contents
   s" execution-support.e" pack-file-contents
   s" log-load.e" pack-file-contents
-  0 pack16 8 packalign here !
+  0 pack8 8 packalign here !
   s" source-to-precompile" variable
 
   here @ dup
@@ -24,7 +29,7 @@
   s" flow-control.e" pack-file-contents
   s" linux-dynamic.e" pack-file-contents
   s" files.e" pack-file-contents
-  0 pack16 8 packalign here !
+  0 pack8 8 packalign here !
   s" source-to-copy-to-log" variable ;
 read-inputs
 
diff --git a/hex.e b/hex.e
index 269856a..3f9a1d8 100644
--- a/hex.e
+++ b/hex.e
@@ -1,4 +1,8 @@
-~ cat labels.e elf.e hex.e | ./evoke > hex && chmod 755 hex && ./hex
+~ cat hex.e | ./evoke > hex && chmod 755 hex
+
+s" labels.e" include
+s" elf.e" include
+s" transform.e" include
 
 ~ (buffer start, output point, label offset
 ~  -- buffer start, output point)
diff --git a/inscribe-evoke.e b/inscribe-evoke.e
index 3e5a15a..2b459fe 100644
--- a/inscribe-evoke.e
+++ b/inscribe-evoke.e
@@ -1,3 +1,9 @@
+~ cat inscribe-evoke.e | ./evoke > evoke.hex
+
+s" labels.e" include
+s" elf.e" include
+s" transform.e" include
+
 : prepare
   here @ dup
   s" core.e" pack-file-contents
@@ -17,7 +23,7 @@
   s" transform.e" pack-file-contents
   s" execution.e" pack-file-contents
   s" evoke.e" pack-file-contents
-  0 pack16 8 packalign here !
+  0 pack8 8 packalign here !
   s" evoke-source" variable
 
   1024 1024 4 * * allocate s" evoke-binary" variable
diff --git a/inscribe-hex.e b/inscribe-hex.e
index f4be71f..e51b9f5 100644
--- a/inscribe-hex.e
+++ b/inscribe-hex.e
@@ -1,3 +1,9 @@
+~ cat inscribe-hex.e | ./evoke > hex.hex
+
+s" labels.e" include
+s" elf.e" include
+s" transform.e" include
+
 : prepare
   here @ dup
   s" core.e" pack-file-contents
@@ -15,7 +21,7 @@
   s" labels.e" pack-file-contents
   s" elf.e" pack-file-contents
   s" hex.e" pack-file-contents
-  0 pack16 8 packalign here !
+  0 pack8 8 packalign here !
   s" hex-source" variable
 
   1024 1024 * allocate s" hex-binary" variable
diff --git a/transform.e b/transform.e
index 3c844b6..4c550e1 100644
--- a/transform.e
+++ b/transform.e
@@ -6174,6 +6174,34 @@ allocate-transformation-state s" transformation-state" variable
   } if-else ; make-immediate
 
 
+~   This runs instead of "interpret" in code under the hex transform. The
+~ proximate effect of that is to make "include" work. Note, however, that this
+~ replacement only applies directly under the hex transform. It isn't a
+~ sensible approach under the log-load transform at all, and under the label
+~ transform it would have such strange behavior that it isn't a good idea
+~ either.
+: hex-interpret-replacement
+  ~ This is a forward reference, so we need to look it up.
+  s" hex-transform-one"
+  swap-transform-variables find swap-transform-variables
+  entry-to-execution-token execute
+
+  ~   We ignore the EOF indication, on the assumption something else will
+  ~ detect it and return to the outer loop, the one that's ours. For example,
+  ~ look at "include", in files.e.
+  drop ;
+
+
+~   This installs hex-interpret-replacement, compiling it in compile mode and
+~ executing it in immediate mode.
+: hex-interpret-alternate
+  interpreter-flags @ 0x01 & {
+    ' hex-interpret-replacement entry-to-execution-token ,
+  } {
+    hex-interpret-replacement
+  } if-else ; make-immediate
+
+
 ~   This implements the hex transform for a single word. It is directly
 ~ analogous to "interpret", and reading interpret.e may help in understanding
 ~ it, though it's meant to still make sense on its own.
@@ -6247,6 +6275,8 @@ allocate-transformation-state s" transformation-state" variable
   dup s" memmove" stringcmp 0 = { swap drop ' hex-memmove-alternate swap } if
   dup s" word" stringcmp 0 = { swap drop ' hex-word-alternate swap } if
   dup s" ~" stringcmp 0 = { swap drop ' hex-tilde-alternate swap } if
+  dup s" interpret" stringcmp 0 = {
+    swap drop ' hex-interpret-alternate swap } if
   ~ (name as stack string, 0 or alternate entry pointer, name pointer)
 
   find