about summary refs log tree commit diff
path: root/transform.e
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-09-08 18:32:42 -0700
committerIrene Knapp <ireneista@irenes.space>2026-09-08 18:34:33 -0700
commite03216ba8bbc7547b1451ed99497c0693446983b (patch)
treecfdc240bbec1ca905ecc70a342b3dbe21df067b5 /transform.e
parentecb9b0a2c65743c8d072eb1e8f13f7afbc68d505 (diff)
add "provide" words for all sizes of hex literal, and use them in amd64
Force-Push: yes
Change-Id: Ibdc4e05f8c63f0b4b6b8e504f89e053e6cd3a912
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