summary refs log tree commit diff
path: root/transform.e
diff options
context:
space:
mode:
Diffstat (limited to 'transform.e')
-rw-r--r--transform.e60
1 files changed, 52 insertions, 8 deletions
diff --git a/transform.e b/transform.e
index 4201d64..7d5d5bd 100644
--- a/transform.e
+++ b/transform.e
@@ -2742,7 +2742,10 @@ allocate-transformation-state s" transformation-state" variable
 : hex-output-metadata-entry-type-string-literal 5 ;
 : hex-output-metadata-entry-type-raw-string-literal 6 ;
 : hex-output-metadata-entry-type-alignment 7 ;
-: hex-output-metadata-entry-type-provide-substring-hex64 8 ;
+: hex-output-metadata-entry-type-provide-substring-hex8 8 ;
+: hex-output-metadata-entry-type-provide-substring-hex16 9 ;
+: hex-output-metadata-entry-type-provide-substring-hex32 10 ;
+: hex-output-metadata-entry-type-provide-substring-hex64 11 ;
 
 ~   Initialize the contents of the output metadata to all zeroes. This is
 ~ called from hex-transform at its top level, at the very start, to make sure
@@ -2996,7 +2999,11 @@ allocate-transformation-state s" transformation-state" variable
 
 : is-provide-substring-entry
   hex-output-metadata-entry-type @
-  hex-output-metadata-entry-type-provide-substring-hex64 = ;
+  dup hex-output-metadata-entry-type-provide-substring-hex8 = swap
+  dup hex-output-metadata-entry-type-provide-substring-hex16 = swap
+  dup hex-output-metadata-entry-type-provide-substring-hex32 = swap
+  hex-output-metadata-entry-type-provide-substring-hex64 = swap
+  || || || ;
 
 : is-fresh-line@
   transformation-state transformation-state-output-metadata @
@@ -3245,6 +3252,24 @@ allocate-transformation-state s" transformation-state" variable
         pop-substring-entry-stack
 
         dup hex-output-metadata-entry-type @
+        hex-output-metadata-entry-type-provide-substring-hex8 = {
+          ." 0x"
+          dup hex-output-metadata-entry-string @ .hex8
+        } if
+
+        dup hex-output-metadata-entry-type @
+        hex-output-metadata-entry-type-provide-substring-hex16 = {
+          ." 0x"
+          dup hex-output-metadata-entry-string @ .hex16
+        } if
+
+        dup hex-output-metadata-entry-type @
+        hex-output-metadata-entry-type-provide-substring-hex32 = {
+          ." 0x"
+          dup hex-output-metadata-entry-string @ .hex32
+        } if
+
+        dup hex-output-metadata-entry-type @
         hex-output-metadata-entry-type-provide-substring-hex64 = {
           ." 0x"
           dup hex-output-metadata-entry-string @ .hex64
@@ -3383,8 +3408,7 @@ allocate-transformation-state s" transformation-state" variable
           0 current-column!
         } if
 
-        dup hex-output-metadata-entry-type @
-        hex-output-metadata-entry-type-provide-substring-hex64 = {
+        dup is-provide-substring-entry {
           dup push-substring-entry-stack
         } if
       } if
@@ -4212,10 +4236,30 @@ allocate-transformation-state s" transformation-state" variable
     exit
   } if
 
-  dup s" provide-substring-hex64" stringcmp 0 = {
-    ~   Create a new "provide substring hex64" entry. Notice that we
-    ~ intentionally read one stack level deeper than anything of ours, which
-    ~ will be a value provided by the code the magic comment is embedded in.
+  ~   Now we have some commands for the various provide-substring variants.
+  ~ Notice with all of these that we intentionally read one stack level deeper
+  ~ than anything of ours, which will be a value provided by the code the
+  ~ magic comment is embedded in.
+  dup s" provide-hex8" stringcmp 0 = {
+    ~ Create a new "provide substring hex8" entry.
+    drop 2 pick hex-output-metadata-entry-type-provide-substring-hex8 swap
+    add-hex-output-metadata-entry
+    exit
+  } if
+  dup s" provide-hex16" stringcmp 0 = {
+    ~ Create a new "provide substring hex16" entry.
+    drop 2 pick hex-output-metadata-entry-type-provide-substring-hex16 swap
+    add-hex-output-metadata-entry
+    exit
+  } if
+  dup s" provide-hex32" stringcmp 0 = {
+    ~ Create a new "provide substring hex32" entry.
+    drop 2 pick hex-output-metadata-entry-type-provide-substring-hex32 swap
+    add-hex-output-metadata-entry
+    exit
+  } if
+  dup s" provide-hex64" stringcmp 0 = {
+    ~ Create a new "provide substring hex64" entry.
     drop 2 pick hex-output-metadata-entry-type-provide-substring-hex64 swap
     add-hex-output-metadata-entry
     exit