rpg_range.zig, rpg_trim.zig, rpg_eval.zig and rpg_eval_builtins.zig: the guards of %LEFT, %RIGHT and %SUBST with a variable start own their labels (operation 15) #764
Loading…
Reference in a new issue
No description provided.
Delete branch "lo15b"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
rpg_range.zig, rpg_trim.zig, rpg_eval.zig and rpg_eval_builtins.zig: the guards of %LEFT, %RIGHT and %SUBST with a variable start own their labels (operation 15)
Three built-ins of a character field keep guards that stop the statement at
control_flow / operation_semantics on the first label definition (operation 15),
which no value rewriter read.
S = %left(C : 3),h-bifs-char G14 / source 29 and G15 / 30). The compiler keeps the zero tests of
the field length and of the requested length, both constants that the unit
itself stored, so neither jump is taken.
rpg_range.unitproves the constants(0 < K <= LEN = length of C), the two jumps, their two label definitions
(only those jumps go to them) and the typed copy with its blank fill, and
reads the whole as
%SUBST(C: 1: K)(%LEFT) or%SUBST(C: LEN - K + 1: K)(
%RIGHT), the operationop_subst_const. The text is the substring because theobject does not distinguish %LEFT(C : K) from %SUBST(C : 1 : K), and the emitter
already writes a substring. A first version left the copy to the raw rules and
produced
S = C, which pads all of C: wrong text that compiles. The copy isnow part of the unit.
rpg_trim.substVarreads the range check of the start (error 100 outside 1..LEN, the signal of the
status), the address and the length of the rest, then the copy of the bytes on
the stack to the field (
copyTail, new modeonstack). The start stays on thestack and
op_subst_varshows%SUBST(C: start).rpg_eval.zigtakes one hook line; the value isrpg_eval_builtins.substConst.Red tests (G header of the dump / source statement)
Recovered: h-bifs-char G8 / 23, G14 / 29, G15 / 30 (
src/rpg_lo15_labels_test.zig).Not done: r5e-editc-held G6 / 12,
%dec(%subst(out7 : pos : 3) : 3 : 0)The statement has the same start check, then a second check of the end
(
start - 1 + 3against the field length) and the call_QRNX_GET_DECIMAL_NUMon the substring. The checks are the same shape assubstVar, but the consumer is the decimal-call reader (rpg_decimal_call.zig),which reads
ADDRESS(F.K, N)with constant offset K and has no source at avariable start. A unit in this lane's files cannot finish the statement; the
change is in
rpg_decimal_call.zig: accept the substring value of thevariable start as the source of the conversion.