rpg_trim.zig, rpg_eval.zig and rpg_eval_builtins.zig: %CHAR of an integer owns its label definitions (operation 15) #763

Manually merged
binjovi-bot merged 3 commits from lo15 into trunk 2026-11-08 14:57:06 +00:00
Owner

rpg_trim.zig, rpg_eval.zig and rpg_eval_builtins.zig: %CHAR of an integer owns its label definitions (operation 15)

%CHAR(I) of an integer compiles to a zoned convert of I into a temporary T,
a copy of its digits behind one byte of a buffer B, a loop that strips the
leading zeros (three label definitions, operation 15) and the sign. No unit
read that expansion, so the first label stopped the statement at
control_flow / operation_semantics. rpg_trim.charStrip now reads the whole
expansion with its labels (the parked lc2b unit, ported onto the tracer
tokens and the trim halves of trunk). The consumers of the stripped digits
differ, and each is its own reader; the statement is recovered when one of them
reads the rest:

  • the copy to a character field (S = %CHAR(I); copyTail, now shared with
    the trim assignment);
  • the copy to a part of a data structure whose address the statement pushed
    first (R.b = %CHAR(I); copyTail mode stacked, the head has op 5 where
    34 S 0 stands; aimBefore reads the address);
  • the trim loops that start at 27 P; 35 Q with the N of the strip
    (%TRIM(%CHAR(I)); loopsFrom is loops entered at its first label);
  • the concatenation with a literal piece ('Total ' + %CHAR(N); charConcat,
    copyTail mode joined).

rpg_eval_builtins.charInteger renders the value (one hook line in
rpg_eval.zig). The temporary of the trim form is saved as a buffer value so
that Source.temp of the trim operation reads it.

Red tests (G header of the dump / source statement)

Recovered: h-editc G29 / 44, dspf-io G30 / 37, h-subfill G25 / 66, d4-edit G10 /
14, lc2-cat-char-int G16 / 24 (src/rpg_lo15_labels_test.zig). The parked
commit alone (lc2b 9f771bcd) recovered the first two.

Not in this change (family 2, range checks of %SUBST with a variable start,
%LEFT, %RIGHT, and %SUBST of %EDITC): h-bifs-char G8, G14, G15 and
r5e-editc-held G6 still stop at operation 15.

# rpg_trim.zig, rpg_eval.zig and rpg_eval_builtins.zig: %CHAR of an integer owns its label definitions (operation 15) `%CHAR(I)` of an integer compiles to a zoned convert of I into a temporary T, a copy of its digits behind one byte of a buffer B, a loop that strips the leading zeros (three label definitions, operation 15) and the sign. No unit read that expansion, so the first label stopped the statement at control_flow / operation_semantics. `rpg_trim.charStrip` now reads the whole expansion with its labels (the parked lc2b unit, ported onto the tracer tokens and the trim halves of trunk). The consumers of the stripped digits differ, and each is its own reader; the statement is recovered when one of them reads the rest: - the copy to a character field (`S = %CHAR(I)`; `copyTail`, now shared with the trim assignment); - the copy to a part of a data structure whose address the statement pushed first (`R.b = %CHAR(I)`; `copyTail` mode `stacked`, the head has op 5 where `34 S 0` stands; `aimBefore` reads the address); - the trim loops that start at `27 P; 35 Q` with the N of the strip (`%TRIM(%CHAR(I))`; `loopsFrom` is `loops` entered at its first label); - the concatenation with a literal piece (`'Total ' + %CHAR(N)`; `charConcat`, `copyTail` mode `joined`). `rpg_eval_builtins.charInteger` renders the value (one hook line in `rpg_eval.zig`). The temporary of the trim form is saved as a buffer value so that `Source.temp` of the trim operation reads it. ## Red tests (G header of the dump / source statement) Recovered: h-editc G29 / 44, dspf-io G30 / 37, h-subfill G25 / 66, d4-edit G10 / 14, lc2-cat-char-int G16 / 24 (`src/rpg_lo15_labels_test.zig`). The parked commit alone (lc2b 9f771bcd) recovered the first two. Not in this change (family 2, range checks of %SUBST with a variable start, %LEFT, %RIGHT, and %SUBST of %EDITC): h-bifs-char G8, G14, G15 and r5e-editc-held G6 still stop at operation 15.
binjovi-bot manually merged commit 4695858e55 into trunk 2026-11-08 14:57:06 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sean/sourcerer!763
No description provided.