rpg_source.zig: a date or time field takes its external format from its descriptors, not from its start value #756

Manually merged
binjovi-bot merged 5 commits from lr3c into trunk 2026-11-07 21:36:20 +00:00
Owner

d = %date() into a date(*jis), *mdy, *dmy, *ymd or *jul field was emitted as %CHAR(%DATE()) into a char(8) (char(6) for *jul) field, a date(*jis) field as date, a time(*eur) field as time and a time(*jis) field as time(*hms): silent wrong text that compiles to another object. The start value cannot name these formats (*JIS starts as *ISO does, *EUR time as *ISO time, *MDY and *DMY alike), but the call of the date run time that follows builds a 16-byte descriptor for the field.

  • rpg_date_fields.zig reads the descriptor of each static field in a call of _QRNX_DT_CVT, _QRNX_DT_INC, _QRNX_DT_DEC or _QRNX_DT_SUB: the address stored at the descriptor and the literal stored beside it, in the order the call passes them. A field named with two formats is left out; the source of %DATE(c: fmt) (characters) is not a field of that format.
  • A field with a format is a date, a time or a timestamp field before any statement is read; its declaration is date(*jis), time(*eur) and so on, and the start value that is the default of its format is not an INZ clause (*MDY and *DMY 01/01/40, *YMD 40/01/01, *JUL 40/001).
  • The steps on these fields recover (the format allow-list of rpg_date_add.zig is gone).
  • The type is granted like the other types of the date work (new_typed): when the start value of the field has no rule in its format, the field keeps the declaration of the program without the descriptors. A start value in the format of the field is a date or time literal in the *ISO form (date(*mdy) '10/22/26' is d'2026-10-22', two-digit years 1940 to 2039, date(*jul) '26/295', time(*usa) '08:00 AM' is t'08.00.00'); the declaration names the format that the descriptors proved, and timeLiteral and dateInitial take it as the format of the value.
  • Two public twins change: s7f-types and s7f-types-dflt now declare the SQL host variables d1, t1 and s1 as date, time and timestamp (the source declares them so; they were not declared).
  • Probes lr3-date-jis-add, lr3-date-mdy-add, lr3-date-dmy-add, lr3-date-ymd-add, lr3-date-jul-add, lr3-time-eur-add, lr3-time-jis-add (dictionary captures; red tests in src/rpg_lr3c_test.zig).
  • A date, time or timestamp value (a built-in, a step or a conversion) stored into a subfield that the emitter declares as characters is a failure line, with the reason that the type of the subfield is not proved: A_00253_F10 = %DATE() into char(10) is not the program (probes lr3x-ds-step-first, lr3x-ds-ts-first; lr3x-date-char-in-ds is the control that a data structure with a date subfield stays a failure).
  • Open: the subfield of a data structure typed from its descriptor at its offset (ds.a is a date, a time or a timestamp). The refusal above stands in for it; the declaration of such a data structure as one char(N) with a start value (lr3x-date-char-in-ds) is the same family.
`d = %date()` into a `date(*jis)`, `*mdy`, `*dmy`, `*ymd` or `*jul` field was emitted as `%CHAR(%DATE())` into a `char(8)` (`char(6)` for `*jul`) field, a `date(*jis)` field as `date`, a `time(*eur)` field as `time` and a `time(*jis)` field as `time(*hms)`: silent wrong text that compiles to another object. The start value cannot name these formats (`*JIS` starts as `*ISO` does, `*EUR` time as `*ISO` time, `*MDY` and `*DMY` alike), but the call of the date run time that follows builds a 16-byte descriptor for the field. - `rpg_date_fields.zig` reads the descriptor of each static field in a call of `_QRNX_DT_CVT`, `_QRNX_DT_INC`, `_QRNX_DT_DEC` or `_QRNX_DT_SUB`: the address stored at the descriptor and the literal stored beside it, in the order the call passes them. A field named with two formats is left out; the source of `%DATE(c: fmt)` (characters) is not a field of that format. - A field with a format is a date, a time or a timestamp field before any statement is read; its declaration is `date(*jis)`, `time(*eur)` and so on, and the start value that is the default of its format is not an INZ clause (`*MDY` and `*DMY` `01/01/40`, `*YMD` `40/01/01`, `*JUL` `40/001`). - The steps on these fields recover (the format allow-list of `rpg_date_add.zig` is gone). - The type is granted like the other types of the date work (`new_typed`): when the start value of the field has no rule in its format, the field keeps the declaration of the program without the descriptors. A start value in the format of the field is a date or time literal in the *ISO form (`date(*mdy)` `'10/22/26'` is `d'2026-10-22'`, two-digit years 1940 to 2039, `date(*jul)` `'26/295'`, `time(*usa)` `'08:00 AM'` is `t'08.00.00'`); the declaration names the format that the descriptors proved, and `timeLiteral` and `dateInitial` take it as the format of the value. - Two public twins change: `s7f-types` and `s7f-types-dflt` now declare the SQL host variables `d1`, `t1` and `s1` as `date`, `time` and `timestamp` (the source declares them so; they were not declared). - Probes `lr3-date-jis-add`, `lr3-date-mdy-add`, `lr3-date-dmy-add`, `lr3-date-ymd-add`, `lr3-date-jul-add`, `lr3-time-eur-add`, `lr3-time-jis-add` (dictionary captures; red tests in `src/rpg_lr3c_test.zig`). - A date, time or timestamp value (a built-in, a step or a conversion) stored into a subfield that the emitter declares as characters is a failure line, with the reason that the type of the subfield is not proved: `A_00253_F10 = %DATE()` into `char(10)` is not the program (probes `lr3x-ds-step-first`, `lr3x-ds-ts-first`; `lr3x-date-char-in-ds` is the control that a data structure with a date subfield stays a failure). - Open: the subfield of a data structure typed from its descriptor at its offset (`ds.a` is a date, a time or a timestamp). The refusal above stands in for it; the declaration of such a data structure as one `char(N)` with a start value (`lr3x-date-char-in-ds`) is the same family.
binjovi-bot manually merged commit 1e322e1eba into trunk 2026-11-07 21:36:20 +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!756
No description provided.