diff options
| author | Irene Knapp <ireneista@irenes.space> | 2026-08-30 03:27:07 -0700 |
|---|---|---|
| committer | Irene Knapp <ireneista@irenes.space> | 2026-08-30 03:27:07 -0700 |
| commit | 5a185b3751410d7901652752ddeeb156d1741bfd (patch) | |
| tree | 90dbcefeb56b18392a7e3466ba774b3df0fc011d | |
| parent | a66567fbc4d585f6da960a527ff8ee27ad7406b1 (diff) | |
store the output buffer length in the hex transform's output metadata
Force-Push: yes Change-Id: I77f18bba4ec9e6e806d2987cc107723ef91db802
| -rw-r--r-- | transform.e | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/transform.e b/transform.e index 61cc4e0..f32448b 100644 --- a/transform.e +++ b/transform.e @@ -2708,10 +2708,18 @@ allocate-transformation-state s" transformation-state" variable ~ (length to write, base address --) : hex-sys-write-replacement { over } { - ~ The output metadata is an array of structs in the format: referenced - ~ data pointer; referenced data length; string pointer. It ends with a - ~ value of 0 where the referenced data pointer would be. - transformation-state transformation-state-output-metadata @ + ~ The output metadata is a header structure followed by an array of + ~ entry structures, as follows: + ~ + ~ (header start) + ~ 0x00 - 0x07 Output buffer length + ~ (entry start) + ~ ... + 0x00 - ... + 0x07 Data pointer + ~ ... + 0x08 - ... + 0x0f Referenced data length + ~ ... + 0x10 - ... + 0x17 String pointer + ~ (entry fields repeat at successive offsets) + ~ ... + 0x00 - ... + 0x07 (end) Zero, used as a delimiter + transformation-state transformation-state-output-metadata @ 8 + ~ (length remaining, current output address, metadata scan pointer) { dup @ dup { dup 2 pick >= drop } if ~ dup { dup 2 pick >= } if @@ -2947,9 +2955,10 @@ allocate-transformation-state s" transformation-state" variable ~ ~ (size -- pointer) : hex-allocate-replacement - allocate + dup allocate swap transformation-state transformation-state-output-metadata @ + swap pack64 ~ (result pointer, metadata output point) over pack64 @@ -3259,6 +3268,7 @@ allocate-transformation-state s" transformation-state" variable ~ hex-sys-write-replacement for more notes on its format. transformation-state transformation-state-output-metadata @ 0 pack64 + 0 pack64 drop ~ It's important that the stack has nothing of ours on it that persists |