rpg_source.zig, rpg_source_ctdata.zig: an array of compile-time data is declared with CTDATA and its data records follow the last line #796

Manually merged
binjovi-bot merged 2 commits from lctd into trunk 2026-11-13 20:18:31 +00:00
Owner

rpg_source.zig, rpg_source_ctdata.zig: an array of compile-time data is declared with CTDATA and its data records follow the last line

A program with dcl-s list char(13) dim(1000) ctdata; and a **CTDATA list section was written as one scalar with
all the bytes inline (dcl-s A_00255 char(13000) inz('...')). That is refused as "declaration of symbol N: longer
than 100 bytes", and every statement that names the array then failed as "not declared". The emit now writes

dcl-s A_00255 char(13) dim(1000) ctdata;
...statements...
// sourcerer: recovered source of ...
**CTDATA A_00255
61087   87490
...

one element in each record, the blanks at the end of a record left out, the section after the summary comments (nothing
after **CTDATA is source). The section is named, so the order of several arrays does not matter. The receipt names
its lines emit_ctdata_v1 (a new form of the table in docs/DUMP.md; the summary is no longer the last line when a
section follows). fromImageFiles reads the text of the statements only, so the digits of the records are no literal.

What the object proves (battery lctd-ctdata, 14 captures of 2026-11-13; one question each)

  • Where the data sit. In every compile-time array the data are one item S253.0 CHARACTER[n] = X'...' (the
    record bytes, elements end to end, short records padded with blanks) at the HEAD of the static initialization:
    items 1 to k, before the compiler's own first item S(n).0 POINTER[16] = ADDRESS(S(n+1).0). Two arrays are
    items 1 and 2 (lctd-two-arrays). A fact that comes later is not: the INZ twin of the same first value
    (dcl-s list char(13) dim(3) inz('00012 00345')) is the item S253.0 CHARACTER[39] = ALL X'F0F0F0F1F2404040F0F0F3F4F5',
    item 26 of 27, and a character scalar with INZ (d7-args) is item 26 of 28. The symbol records of the CTDATA and
    the INZ array are byte for byte equal (kind 8, class 3, length 39, flag words 0x7000c000 and 0x80010000), so the
    position in the static initialization is the only discriminator. Census over the 970 public twins: of the 850
    programs with a static initialization of 20 items or more, 845 start with the pointer item; the other 5 start
    with CHARACTER[256] = X'000102...', the identity table of the compiler (control bytes: no record).
    Long data are items of 400 bytes (dev5/p3: 32 items of 400 and one of 200 for 13000 bytes), which initial
    already joins into one value.
  • Width and count. Only the unit of a VARIABLE index holds them: 34 A 0; 29 N 0 T; 87 4; 75 4; 77 4; 27 ONE; 52; 27 K; 138; 78 4; 65 W is K + 1 elements of W bytes (lctd-loop: K = 2, W = 13, 39 bytes), and the length of
    A is their product. A CONSTANT index is an offset: list(1) is 34 253 0, list(3) is 34 253 0; 27 26; 62,
    the operations of %subst(scalar: 27: 13); the literal pool holds the offset (26 in lctd-c13-3) and the
    width of the access (13, also in the INZ twin), nothing that names an element count.
    No element width and no count: the 11 battery cases that index by constants only are not declared as arrays
    (the scalar they had stays, or the refusal). The element is a character field because a decimal call reads
    the unit as characters (%INT(%SUBST(list(i): 1: 5)): decimal_call with a character source whose first
    operation is the head of the unit). That call is the only proof; a typed access of the same array
    (array_element_v1) can only veto it (a numeric element, or another width or count).
  • No trace of DIM(*CTDATA) against DIM(3) (lctd-dim-star and lctd-short-line have the same
    statements and instructions; they differ in the constants and the data bytes), of a bare ** against
    **CTDATA list (lctd-plain-star: the same item as lctd-c13-3), or of the padding of a short record
    (00012 then 8 blanks). PERRCD has no mark either in the item of lctd-perrcd2 (AAAAABBBBBCCCCCDDDDD: four
    elements of 5 end to end), but no PERRCD(1) twin was compiled yet (request lctd/ctdata-index,
    lctd2-perrcd and lctd2-perrcd-one). The emit writes dim(n), named sections and one element in each record.
    Observed, not proved: the symbols follow the order of the names (i, list, x are S253, S254, S255; list, n
    are S253, S254), and the emitted names (A_00253...) keep that order.

What is written, and what is refused (a failure line, never a guess)

The array is declared when ALL hold: the symbol is a static character field whose whole initial value is bytes;
it is initialized at the head of the static initialization; a decimal call that reads it as characters at a
packed index gives W and N with W * N the length of the symbol, N >= 2; the elements are records. The failure line
compile-time data array: <fact> is written, in place of the declaration, when an element holds a control
byte, a character that has another code point in some CCSID (only the invariant characters are written), is
blank (not measured), starts with * or / (a mark of a source line), is wider than 100 bytes (a source line),
or when every element is equal (an INZ array is not excluded: no probe of equal CTDATA records yet).
Not read, and unchanged: arrays that a statement indexes by a constant only; units of an integer or zoned index
(the packed index is the form of the battery and the development programs); numeric CTDATA arrays (they keep
"the initial value of the numeric array has no rule"); the fixed-form and mixed renders.

Battery before and after (capture-emit-diff.sh, base = v0.1.512)

Only lctd-loop changes (statements, emitted, failures 5, 4, 1 to 5, 5, 0). The 13 other cases are the same, as
the object proves nothing more for them: lctd-c1-2, -c13-3, -c13-5, -ctdata-after-other, -dim-100,
-dim-star, -inz-twin, -perrcd2, -plain-star, -short-line, -two-arrays, -zoned-3 keep their emit: a
scalar char(N) inz('...') (none for the INZ twin) and the DSPLY failure line (the reader of the DSPLY
arguments is not this change); -dim-star-elem has no failure line before or after.

dcl-s A_00254 char(13) dim(3) ctdata;           (lctd-loop, was char(39) inz('00012   0034500678 ...'))
V00255 = %INT(%SUBST(A_00254(A_00253): 1: 5));  (was: the name A_00254 is declared without DIM)
**CTDATA A_00254 / 00012   00345 / 00678   00901 / 11111   22222

The development programs p3 and p4 (fit, not a rule: no test holds their text): one declaration
char(13) dim(1000) ctdata, a section of 1000 records that is byte for byte the data of the source, and the two
statements that read %INT(%SUBST(list(i): ...)); failure lines 5 to 2 and 6 to 3 (what is left is SORTA and
%LOOKUP). The scorer: suspect 3 and 3, same 30 to 35, refused 10 to 5, decl_missing 2 to 0, and
type_unmarked 0 to 2, which is DIM(*CTDATA) of the source against dim(1000) ctdata.

Probe

  • Probe lctd-loop (dictionary capture). Tests: src/rpg_ctdata_test.zig.

Gate

== a. development emits (dev-hash)
p1 same
p2 same
p3 DIFFERENT
p4 DIFFERENT
p5 same
== b. L10-test direction
L10-test unchanged
== c. committed twins (emit-bytes-diff)
emit-bytes-diff: identical
== d. captures (capture-emit-diff)
p3 base=[18,14,5] head=[18,16,2] CHANGED fail-lines=2
p4 base=[22,17,6] head=[22,19,3] CHANGED fail-lines=3
lctd-loop base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
capture-emit-diff: 25 cases, 3 changed, 3 with no failure line in the head emit
== e. source agreement (agree)
suspect        base=80 head=80
conflict       base=0 head=0
params_wrong   base=15 head=15
decl_missing   base=83 head=81
decl_extra     base=25 head=25
type_unmarked  base=58 head=60
WATCH: type_unmarked rose 58->60: declaration differences move with the statements a build recovers (Lptr: 80->87 missing while 72->52 consequent); read the changed cases in /Users/someara/data/sourcerer-loop/coord-bin/gate-lctd/head
== f. host round trips (both binaries)
cases to round-trip: 3
dev5/p5                                            base=different head=different
lctd-ctdata/lctd-dim-star-elem                     base=different head=different
lctd-ctdata/lctd-loop                              base=different head=different
gate: PASS

The type_unmarked WATCH: source DIM(*CTDATA) against emitted dim(1000) ctdata, a spelling difference the object does not record.

## rpg_source.zig, rpg_source_ctdata.zig: an array of compile-time data is declared with CTDATA and its data records follow the last line A program with `dcl-s list char(13) dim(1000) ctdata;` and a `**CTDATA list` section was written as one scalar with all the bytes inline (`dcl-s A_00255 char(13000) inz('...')`). That is refused as "declaration of symbol N: longer than 100 bytes", and every statement that names the array then failed as "not declared". The emit now writes dcl-s A_00255 char(13) dim(1000) ctdata; ...statements... // sourcerer: recovered source of ... **CTDATA A_00255 61087 87490 ... one element in each record, the blanks at the end of a record left out, the section after the summary comments (nothing after `**CTDATA` is source). The section is named, so the order of several arrays does not matter. The receipt names its lines `emit_ctdata_v1` (a new form of the table in docs/DUMP.md; the summary is no longer the last line when a section follows). `fromImageFiles` reads the text of the statements only, so the digits of the records are no literal. ### What the object proves (battery `lctd-ctdata`, 14 captures of 2026-11-13; one question each) - **Where the data sit.** In every compile-time array the data are one item `S253.0 CHARACTER[n] = X'...'` (the record bytes, elements end to end, short records padded with blanks) at the HEAD of the static initialization: items 1 to k, before the compiler's own first item `S(n).0 POINTER[16] = ADDRESS(S(n+1).0)`. Two arrays are items 1 and 2 (`lctd-two-arrays`). A fact that comes later is not: the INZ twin of the same first value (`dcl-s list char(13) dim(3) inz('00012 00345')`) is the item `S253.0 CHARACTER[39] = ALL X'F0F0F0F1F2404040F0F0F3F4F5'`, item 26 of 27, and a character scalar with INZ (`d7-args`) is item 26 of 28. The symbol records of the CTDATA and the INZ array are byte for byte equal (kind 8, class 3, length 39, flag words 0x7000c000 and 0x80010000), so the position in the static initialization is the only discriminator. Census over the 970 public twins: of the 850 programs with a static initialization of 20 items or more, 845 start with the pointer item; the other 5 start with `CHARACTER[256] = X'000102...'`, the identity table of the compiler (control bytes: no record). Long data are items of 400 bytes (`dev5/p3`: 32 items of 400 and one of 200 for 13000 bytes), which `initial` already joins into one value. - **Width and count.** Only the unit of a VARIABLE index holds them: `34 A 0; 29 N 0 T; 87 4; 75 4; 77 4; 27 ONE; 52; 27 K; 138; 78 4; 65 W` is K + 1 elements of W bytes (`lctd-loop`: K = 2, W = 13, 39 bytes), and the length of A is their product. A CONSTANT index is an offset: `list(1)` is `34 253 0`, `list(3)` is `34 253 0; 27 26; 62`, the operations of `%subst(scalar: 27: 13)`; the literal pool holds the offset (26 in `lctd-c13-3`) and the width of the access (13, also in the INZ twin), nothing that names an element count. No element width and no count: the 11 battery cases that index by constants only are not declared as arrays (the scalar they had stays, or the refusal). The element is a character field because a decimal call reads the unit as characters (`%INT(%SUBST(list(i): 1: 5))`: `decimal_call` with a character source whose first operation is the head of the unit). That call is the only proof; a typed access of the same array (`array_element_v1`) can only veto it (a numeric element, or another width or count). - **No trace** of `DIM(*CTDATA)` against `DIM(3)` (`lctd-dim-star` and `lctd-short-line` have the same statements and instructions; they differ in the constants and the data bytes), of a bare `**` against `**CTDATA list` (`lctd-plain-star`: the same item as `lctd-c13-3`), or of the padding of a short record (`00012` then 8 blanks). PERRCD has no mark either in the item of `lctd-perrcd2` (`AAAAABBBBBCCCCCDDDDD`: four elements of 5 end to end), but no PERRCD(1) twin was compiled yet (request `lctd/ctdata-index`, `lctd2-perrcd` and `lctd2-perrcd-one`). The emit writes `dim(n)`, named sections and one element in each record. Observed, not proved: the symbols follow the order of the names (`i, list, x` are S253, S254, S255; `list, n` are S253, S254), and the emitted names (`A_00253`...) keep that order. ### What is written, and what is refused (a failure line, never a guess) The array is declared when ALL hold: the symbol is a static character field whose whole initial value is bytes; it is initialized at the head of the static initialization; a decimal call that reads it as characters at a packed index gives W and N with W * N the length of the symbol, N >= 2; the elements are records. The failure line `compile-time data array: <fact>` is written, in place of the declaration, when an element holds a control byte, a character that has another code point in some CCSID (only the invariant characters are written), is blank (not measured), starts with `*` or `/` (a mark of a source line), is wider than 100 bytes (a source line), or when every element is equal (an INZ array is not excluded: no probe of equal CTDATA records yet). Not read, and unchanged: arrays that a statement indexes by a constant only; units of an integer or zoned index (the packed index is the form of the battery and the development programs); numeric CTDATA arrays (they keep "the initial value of the numeric array has no rule"); the fixed-form and mixed renders. ### Battery before and after (`capture-emit-diff.sh`, base = v0.1.512) Only `lctd-loop` changes (statements, emitted, failures 5, 4, 1 to 5, 5, 0). The 13 other cases are the same, as the object proves nothing more for them: `lctd-c1-2`, `-c13-3`, `-c13-5`, `-ctdata-after-other`, `-dim-100`, `-dim-star`, `-inz-twin`, `-perrcd2`, `-plain-star`, `-short-line`, `-two-arrays`, `-zoned-3` keep their emit: a scalar `char(N) inz('...')` (none for the INZ twin) and the `DSPLY` failure line (the reader of the DSPLY arguments is not this change); `-dim-star-elem` has no failure line before or after. dcl-s A_00254 char(13) dim(3) ctdata; (lctd-loop, was char(39) inz('00012 0034500678 ...')) V00255 = %INT(%SUBST(A_00254(A_00253): 1: 5)); (was: the name A_00254 is declared without DIM) **CTDATA A_00254 / 00012 00345 / 00678 00901 / 11111 22222 The development programs `p3` and `p4` (fit, not a rule: no test holds their text): one declaration `char(13) dim(1000) ctdata`, a section of 1000 records that is byte for byte the data of the source, and the two statements that read `%INT(%SUBST(list(i): ...))`; failure lines 5 to 2 and 6 to 3 (what is left is `SORTA` and `%LOOKUP`). The scorer: suspect 3 and 3, same 30 to 35, refused 10 to 5, `decl_missing` 2 to 0, and `type_unmarked` 0 to 2, which is `DIM(*CTDATA)` of the source against `dim(1000) ctdata`. ### Probe - Probe `lctd-loop` (dictionary capture). Tests: `src/rpg_ctdata_test.zig`. ## Gate ``` == a. development emits (dev-hash) p1 same p2 same p3 DIFFERENT p4 DIFFERENT p5 same == b. L10-test direction L10-test unchanged == c. committed twins (emit-bytes-diff) emit-bytes-diff: identical == d. captures (capture-emit-diff) p3 base=[18,14,5] head=[18,16,2] CHANGED fail-lines=2 p4 base=[22,17,6] head=[22,19,3] CHANGED fail-lines=3 lctd-loop base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 capture-emit-diff: 25 cases, 3 changed, 3 with no failure line in the head emit == e. source agreement (agree) suspect base=80 head=80 conflict base=0 head=0 params_wrong base=15 head=15 decl_missing base=83 head=81 decl_extra base=25 head=25 type_unmarked base=58 head=60 WATCH: type_unmarked rose 58->60: declaration differences move with the statements a build recovers (Lptr: 80->87 missing while 72->52 consequent); read the changed cases in /Users/someara/data/sourcerer-loop/coord-bin/gate-lctd/head == f. host round trips (both binaries) cases to round-trip: 3 dev5/p5 base=different head=different lctd-ctdata/lctd-dim-star-elem base=different head=different lctd-ctdata/lctd-loop base=different head=different gate: PASS ``` The type_unmarked WATCH: source `DIM(*CTDATA)` against emitted `dim(1000) ctdata`, a spelling difference the object does not record.
The data of a compile-time array are the leading items of the static
initialization of the program (an INZ array is one item that comes after the
compiler's own first item), and a unit of a packed index holds the width and
the count of the elements. With both, the emit writes `char(W) dim(N) ctdata`
and a named `**CTDATA` section after the last line, one element in each
record. A record that the source cannot hold, or equal elements, is a failure
line. An array that statements index by constant only is not declared.
Regenerate the operations legend
All checks were successful
binjovi/ci Binjovi completed the frozen plan
e5cb1085bf
binjovi-bot manually merged commit e5cb1085bf into trunk 2026-11-13 20:18:31 +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!796
No description provided.