From 6f76a3a291d1a895e3e5cd36103fb4c4199825e1 Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Tue, 8 Sep 2026 05:04:37 -0700 Subject: the hex dump now prints trailing messages at the end of the data Force-Push: yes Change-Id: I71930b088c176ade6a0bf7aaecb46bdecb0636ad --- hex.e | 9 ++++++++- transform.e | 16 +++++++++++----- 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 ; -- cgit 1.4.1