summary refs log tree commit diff
path: root/dynamic.e
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-06-11 19:25:38 -0700
committerIrene Knapp <ireneista@irenes.space>2026-06-11 19:26:38 -0700
commitd1cccb7b2096f9b4418487f1d2a605c0b157441a (patch)
tree630754c5252ea71ab09066ab13f7bbead84976bd /dynamic.e
parent9dbdfdc9b780dbd27915f4280ccac4e41c56f9dc (diff)
add ascii to the hexdumps
yay! that helps a lot

(as tempting as it was to keep doing it mentally forever...)

Force-Push: yes
Change-Id: I7a213bc46913d00f9a9d3f49bcb22bfed248a010
Diffstat (limited to 'dynamic.e')
-rw-r--r--dynamic.e23
1 files changed, 21 insertions, 2 deletions
diff --git a/dynamic.e b/dynamic.e
index f99f0ec..a02eec0 100644
--- a/dynamic.e
+++ b/dynamic.e
@@ -150,14 +150,33 @@
   { dup word-heading next-newer-entry } while drop ;
 
 
+~ (byte -- boolean)
+: is-printable
+  dup 0x20 <= swap 0x7F > && ;
+
+
 ~ (content end, content start, label start --)
 : hexdump-row
   2 indent dup .hex32 dup 4 unroll
-  0 { dup 16 > }
-  { dup 7 & 0 = { space } if space
+  ~ (label start, content end, content start, label start)
+  0 { dup 16 > } {
+    ~ (label start, content end, content start, label start, offset within row)
+    dup 7 & 0 = { space } if space
     2dup + dup 4 pick <= swap 5 pick > &&
       { 2dup + 8@ .hex8 } { space space } if-else
     1+ } while
+  drop
+  2 indent s" |" emitstring
+  0 { dup 16 > } {
+    ~ (label start, content end, content start, label start, offset within row)
+    2dup + dup 4 pick <= swap 5 pick > &&
+      { 2dup + 8@
+        dup is-printable
+        { value@ emitstring } { s" ." emitstring } if-else
+        drop }
+      { space } if-else
+    1+ } while
+  s" |" emitstring
   newline 5 ndrop ;