about summary refs log tree commit diff
path: root/transform.e
diff options
context:
space:
mode:
Diffstat (limited to 'transform.e')
-rw-r--r--transform.e30
1 files changed, 30 insertions, 0 deletions
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