rpg_eval.zig and rpg_source.zig: steps in every unit, differences of times and timestamps, parts of times and timestamps, and characters or digits read as a date, a time or a timestamp #755

Manually merged
binjovi-bot merged 10 commits from lr3b into trunk 2026-11-07 20:49:31 +00:00
Owner

rpg_eval.zig and rpg_source.zig: steps in every unit, differences of times and timestamps, parts of times and timestamps, and characters or digits read as a date, a time or a timestamp

Second part of the date, time and timestamp work, from the capture lr3-dt-arith (41 compiles). The unit codes and descriptors below are read from those twins.

  • + %SECONDS(n) and - %SECONDS(n) (unit 0x12) on a time or a timestamp.
  • %DIFF(a: b: *UNIT) of two fields: years 0x0d, months 0x0e, days 0x0f, hours 0x10, minutes 0x11, seconds 0x12, mseconds 0x13; dates take years, months and days, times hours, minutes and seconds, timestamps all of them. All fields named by a %DIFF are typed by their width.
  • %SUBDT(f: *PART) of a time field or a timestamp field (the work area of _QRNX_DT_CVT is the native form of the kind).
  • %DATE(c: *USA), %DATE(c: *EUR), %DATE(c: *ISO0), %TIME(c: *ISO) and %TIMESTAMP(c) of a character field, and %DATE(i: *YMD) of a number, recover. %TIME(c: *ISO) and %TIMESTAMP(c) were emitted as %CHAR(c: *ISO) into a character field; they are the same conversion with the same descriptors, read by the kind.
  • A step on a *USA or *EUR date field and on a *USA or *HMS time field recovers (the result is converted back to the format of the field).
  • The target of a step written whole (S.0 = ...) takes the type of the field it steps from, also when the target steps from itself; a field started by *SYS of its own (not in a data structure) is a date.
  • Four guards after the first check of this change failed to compile a held-out program (RNF3430, "initial value does not match data type of field", on a declaration): a step target is typed only when it has the width of a date, a time or a timestamp (a data structure whose first subfield is the target is not one); a field of its own started by *SYS is recognised only by the code itself (the call of the current time before the field, the conversion of its buffer after it), not by its default start value; a conversion of a field in another format than *ISO is a %CHAR(date: fmt) that needs the format of the field, so it stays a failure here; and the start value of a time field is a time literal t'hh.mm.ss' in the ISO form whatever the format of the field (a character literal on a time field is RNF3430): a value hh.mm.ss is a bare time, hh:mm:ss is time(*hms) and hh:mm AM or PM is time(*usa), which is the declaration that the value shows (the *JIS and *EUR forms have the same bytes).
  • A field that only these rules type (a %DIFF or a step on it, %SUBDT of a time or a timestamp, %TIME(c), %TIMESTAMP(c), %DATE(c: fmt)) is typed when its start value has a rule in that type (the default of the type or a literal that it takes). When it has none, the field keeps the declaration of the program without these rules, and the statements that the rules recovered about it fail, as they did: the date work cannot lower the statements that are emitted nor turn a declaration into a refusal.
  • A time field whose start value has no time literal keeps the declaration of the program without the date work (the text and the type as they were); no field that was declared becomes undeclared (timeInitial).
  • The field a step is computed on is a date, a time or a timestamp by its width and the unit of the step (%DAYS, %MONTHS, %YEARS on 10 bytes, %HOURS, %MINUTES, %SECONDS on 8, any on 26); before, a step on a field that no other statement typed was emitted on a char field (char(10) = char(10) + %DAYS(1)). A date start value in the *USA (mm/dd/yyyy) or *EUR (dd.mm.yyyy) form is a date literal in a date(*usa) or date(*eur) field, as the time start values are. The time and date that a declaration has so far name no format: a colon time start value is time(*hms) and a *USA one time(*usa) (the form of the start value did not reach timeLiteral before, which compared the format with time). Probes lr3y-* (capture dt-arith3, red tests in src/rpg_lr3b_test.zig).
  • Open: the date formats *JIS, *MDY, *DMY, *YMD, *JUL and the time formats *EUR and *JIS of a field. d = %date() into them is emitted as %CHAR(%DATE()) into a character field because the field takes its format from its start value, which does not name them; the steps on them stay failures (probes lr3-date-jis-add, -mdy-, -dmy-, -ymd-, -jul-, lr3-time-eur-add, -jis- are in the capture, not adopted). %DIFF of two timestamps stores into int(20), whose start value has no rule (probes lr3-diff-ts-* emit their %DIFF line and one failure for the start value).
  • Probes (dictionary captures): adopted are lr3-date-field-days, lr3-date-var-count, lr3-date-expr-count, lr3-ts-field-add, lr3-ts-var-count, lr3-time-field-add, lr3-ts-units, lr3-add-secs, lr3-step-from-sys, lr3-diff-date-months, lr3-diff-date-years, lr3-diff-time-hours, lr3-diff-time-minutes, lr3-diff-time-seconds, lr3-diff-ts-days, lr3-diff-ts-hours, lr3-diff-ts-minutes, lr3-diff-ts-seconds, lr3-diff-ts-mseconds, lr3-subdt-date-months, lr3-subdt-time-secs, lr3-subdt-ts-hours, lr3-date-char-usa, lr3-date-char-eur, lr3-date-char-iso0, lr3-date-num-ymd, lr3-time-char, lr3-ts-char, lr3-date-usa-add, lr3-date-eur-add, lr3-time-usa-add, lr3-time-hms-add (red tests in src/rpg_lr3b_test.zig).

Gates

{"checks":{"net_statements":0},"census":{"statuses":{"recovered":645,"partial":0,"unresolved":0},"regressions":0,"newly_recovered":0},"golden":"golden floor 173 ceiling 0 <= dump 173/5/0","legend":"current","emit":{"worse":[],"better":2,"newly_clean":40,"clean_delta":40,"base":440,"new":480},"twins":{"groups":716,"recovered":698,"regressions":[],"newly":40},"allgroups":{"regressions":[],"newly":[],"worse":[]},"full_check":{"exit":0,"seconds":801}}
# rpg_eval.zig and rpg_source.zig: steps in every unit, differences of times and timestamps, parts of times and timestamps, and characters or digits read as a date, a time or a timestamp Second part of the date, time and timestamp work, from the capture `lr3-dt-arith` (41 compiles). The unit codes and descriptors below are read from those twins. - `+ %SECONDS(n)` and `- %SECONDS(n)` (unit 0x12) on a time or a timestamp. - `%DIFF(a: b: *UNIT)` of two fields: years 0x0d, months 0x0e, days 0x0f, hours 0x10, minutes 0x11, seconds 0x12, mseconds 0x13; dates take years, months and days, times hours, minutes and seconds, timestamps all of them. All fields named by a `%DIFF` are typed by their width. - `%SUBDT(f: *PART)` of a time field or a timestamp field (the work area of `_QRNX_DT_CVT` is the native form of the kind). - `%DATE(c: *USA)`, `%DATE(c: *EUR)`, `%DATE(c: *ISO0)`, `%TIME(c: *ISO)` and `%TIMESTAMP(c)` of a character field, and `%DATE(i: *YMD)` of a number, recover. `%TIME(c: *ISO)` and `%TIMESTAMP(c)` were emitted as `%CHAR(c: *ISO)` into a character field; they are the same conversion with the same descriptors, read by the kind. - A step on a `*USA` or `*EUR` date field and on a `*USA` or `*HMS` time field recovers (the result is converted back to the format of the field). - The target of a step written whole (`S.0 = ...`) takes the type of the field it steps from, also when the target steps from itself; a field started by `*SYS` of its own (not in a data structure) is a date. - Four guards after the first check of this change failed to compile a held-out program (RNF3430, "initial value does not match data type of field", on a declaration): a step target is typed only when it has the width of a date, a time or a timestamp (a data structure whose first subfield is the target is not one); a field of its own started by `*SYS` is recognised only by the code itself (the call of the current time before the field, the conversion of its buffer after it), not by its default start value; a conversion of a field in another format than *ISO is a `%CHAR(date: fmt)` that needs the format of the field, so it stays a failure here; and the start value of a time field is a time literal `t'hh.mm.ss'` in the ISO form whatever the format of the field (a character literal on a time field is RNF3430): a value hh.mm.ss is a bare `time`, hh:mm:ss is `time(*hms)` and hh:mm AM or PM is `time(*usa)`, which is the declaration that the value shows (the `*JIS` and `*EUR` forms have the same bytes). - A field that only these rules type (a `%DIFF` or a step on it, `%SUBDT` of a time or a timestamp, `%TIME(c)`, `%TIMESTAMP(c)`, `%DATE(c: fmt)`) is typed when its start value has a rule in that type (the default of the type or a literal that it takes). When it has none, the field keeps the declaration of the program without these rules, and the statements that the rules recovered about it fail, as they did: the date work cannot lower the statements that are emitted nor turn a declaration into a refusal. - A time field whose start value has no time literal keeps the declaration of the program without the date work (the text and the type as they were); no field that was declared becomes undeclared (`timeInitial`). - The field a step is computed on is a date, a time or a timestamp by its width and the unit of the step (`%DAYS`, `%MONTHS`, `%YEARS` on 10 bytes, `%HOURS`, `%MINUTES`, `%SECONDS` on 8, any on 26); before, a step on a field that no other statement typed was emitted on a `char` field (`char(10) = char(10) + %DAYS(1)`). A date start value in the *USA (mm/dd/yyyy) or *EUR (dd.mm.yyyy) form is a date literal in a `date(*usa)` or `date(*eur)` field, as the time start values are. The `time` and `date` that a declaration has so far name no format: a colon time start value is `time(*hms)` and a *USA one `time(*usa)` (the form of the start value did not reach `timeLiteral` before, which compared the format with `time`). Probes `lr3y-*` (capture dt-arith3, red tests in `src/rpg_lr3b_test.zig`). - Open: the date formats `*JIS`, `*MDY`, `*DMY`, `*YMD`, `*JUL` and the time formats `*EUR` and `*JIS` of a field. `d = %date()` into them is emitted as `%CHAR(%DATE())` into a character field because the field takes its format from its start value, which does not name them; the steps on them stay failures (probes `lr3-date-jis-add`, `-mdy-`, `-dmy-`, `-ymd-`, `-jul-`, `lr3-time-eur-add`, `-jis-` are in the capture, not adopted). `%DIFF` of two timestamps stores into `int(20)`, whose start value has no rule (probes `lr3-diff-ts-*` emit their `%DIFF` line and one failure for the start value). - Probes (dictionary captures): adopted are `lr3-date-field-days`, `lr3-date-var-count`, `lr3-date-expr-count`, `lr3-ts-field-add`, `lr3-ts-var-count`, `lr3-time-field-add`, `lr3-ts-units`, `lr3-add-secs`, `lr3-step-from-sys`, `lr3-diff-date-months`, `lr3-diff-date-years`, `lr3-diff-time-hours`, `lr3-diff-time-minutes`, `lr3-diff-time-seconds`, `lr3-diff-ts-days`, `lr3-diff-ts-hours`, `lr3-diff-ts-minutes`, `lr3-diff-ts-seconds`, `lr3-diff-ts-mseconds`, `lr3-subdt-date-months`, `lr3-subdt-time-secs`, `lr3-subdt-ts-hours`, `lr3-date-char-usa`, `lr3-date-char-eur`, `lr3-date-char-iso0`, `lr3-date-num-ymd`, `lr3-time-char`, `lr3-ts-char`, `lr3-date-usa-add`, `lr3-date-eur-add`, `lr3-time-usa-add`, `lr3-time-hms-add` (red tests in `src/rpg_lr3b_test.zig`). ## Gates ``` {"checks":{"net_statements":0},"census":{"statuses":{"recovered":645,"partial":0,"unresolved":0},"regressions":0,"newly_recovered":0},"golden":"golden floor 173 ceiling 0 <= dump 173/5/0","legend":"current","emit":{"worse":[],"better":2,"newly_clean":40,"clean_delta":40,"base":440,"new":480},"twins":{"groups":716,"recovered":698,"regressions":[],"newly":40},"allgroups":{"regressions":[],"newly":[],"worse":[]},"full_check":{"exit":0,"seconds":801}} ```
Name the open item of the date work: the subfield of a data structure
All checks were successful
binjovi/ci Binjovi completed the frozen plan
022d7a24ea
binjovi-bot manually merged commit 022d7a24ea into trunk 2026-11-07 20:49: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!755
No description provided.