summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--hex.e9
-rw-r--r--transform.e16
2 files changed, 19 insertions, 6 deletions
diff --git a/hex.e b/hex.e
index c20d61a..fd283ca 100644
--- a/hex.e
+++ b/hex.e
@@ -254,6 +254,10 @@
 ~ Everything directly called by all-contents has this same interface.
 ~
 : all-contents
+  ~ :   This particular program is 'hex' itself. You of course already need to
+  ~ : have a binary copy of it to use this file, but you may find it helpful
+  ~ : to have this hex dump anyway, to aid in auditing your binary.
+  ~ : blank-line
   0x08000000 L!' origin
   elf-file-header
   elf-program-header-writable
@@ -271,7 +275,10 @@
   current-offset L!' buffer 0 pack64
   ~ : deindent
 
-  current-offset L!' total-size ;
+  current-offset L!' total-size
+  ~ : blank-line
+  ~ : This is the end of the hex dump.
+  ;
 
 ' all-contents entry-to-execution-token label-loop
 swap sys-write bye
diff --git a/transform.e b/transform.e
index 12c5483..7560752 100644
--- a/transform.e
+++ b/transform.e
@@ -3094,7 +3094,7 @@ allocate-transformation-state s" transformation-state" variable
 : hex-sys-write-replacement
   postprocess-metadata-entries
 
-  { over } {
+  { over 0 <= } {
     transformation-state transformation-state-output-metadata @
     hex-output-metadata-first-entry
     ~ (length remaining, current output address, metadata scan pointer)
@@ -3193,10 +3193,16 @@ allocate-transformation-state s" transformation-state" variable
     } while
     drop
 
-    is-fresh-line@ { indentation-depth@ dup indent advance-current-column } if
-    dup 8@ .hex8 space
-    3 advance-current-column
-    0 is-fresh-line!
+    over {
+      is-fresh-line@ {
+        indentation-depth@ dup indent advance-current-column
+      } if
+
+      dup 8@ .hex8 space
+
+      3 advance-current-column
+      0 is-fresh-line!
+    } if
 
     1+ swap 1- swap
   } while ;