Menu

Commit [r13062]  Maximize  Restore  History

dotnet: the whole d4 demo application now compiles

d4 is the Informix demo app that ships with Aubit - eight modules,
globals in one of them, cross-module calls, forms, menus, input
arrays and two reports. It now generates and compiles to .NET with no
errors. That was 501 errors across its two biggest modules alone when
this started.

Nothing needed to change about how modules combine: 4GL has one flat
function namespace per program, and the generator already emits every
module as "public partial class Simple", so the modules of one program
merge into one class and cross-module calls and globals resolve on
their own. What was missing was the prototype collection - fglproto
takes the .dat module definitions, and the whole program's modules have
to go in together, or a call into another module cannot be typed. Note
that fglproto wants the .dat, not the .4gl, and that a .glb has no
module definition to load, so it has to be left out or the run aborts.

Generator fixes:

- Inside a report, every call was prefixed with thisApp. on the basis
that a report is a nested class and its module's functions live on
the outer one. That was applied before checking whether the name had
already been rewritten to a runtime static, so a builtin came out as
thisApp.Fgl.Length(...), which resolves to nothing. The prefix is
now skipped for an already-qualified name.
- IS NULL and IS NOT NULL were emitted bare, so they only resolved at
module level, not from inside a report. Both now name the runtime.
- INPUT ARRAY binds the SHAPE of a row - the column types and widths,
with the values coming from the array handed to the dialog - but it
emitted the same Append names the value form uses, and the two
collide on arity: AppendString(3) is a CHAR(3) column in one and the
value 3 in the other. The shape form is Declare* now.

Runtime: MESSAGE, ERROR, FGLIdent, DRAW BOX, ARR_CURR, SCR_LINE,
ARR_COUNT, SET_COUNT, STATUS, INT_FLAG; the scroll-cursor fetches
(FIRST, LAST, NEXT, PREVIOUS, ABSOLUTE, RELATIVE); IsNotNull; column
declarations on ASqlBinding; PAUSE with a message.

FglBool is new, and it is worth explaining. 4GL has no boolean type: a
comparison yields an INTEGER, and the language uses it both ways -

IF lv_a = lv_b THEN ... -- a condition
LET lv_flag = lv_a = lv_b -- a value, 0 or 1

C# will take neither an int as a condition nor a bool as a number, so
a comparison now returns a type that converts implicitly to both and
renders as "0"/"1". The first attempt simply returned bool, which
compiled everywhere and was wrong: the types probe caught it printing
"False" where C prints "0". That is exactly the kind of thing these
probes exist to catch, and it would have been invisible in a review.

Standalone demo programs compiling clean: 13 of 33, up from 6. The
largest remaining group is SMALLINT: the generator maps it to short?
but arithmetic on it yields int, and it does not insert a narrowing
cast, which is about 58 of the ~130 errors left.

Fidelity: 27 semantics, 9 UI messages, 30 USING, the 66-line report and
5 end-to-end programs all agree with C. 203 runtime tests pass.

mikeaubury 2026-09-02

changed /aubit4glsrc/trunk/dotnet/src/Aubit4GL.Runtime/FglSession.cs
changed /aubit4glsrc/trunk/dotnet/src/Aubit4GL.Runtime/Report/BaseFGLReport.cs
changed /aubit4glsrc/trunk/dotnet/src/Aubit4GL.Runtime/Sql/ASqlApi.cs
changed /aubit4glsrc/trunk/dotnet/src/Aubit4GL.Runtime/Sql/ASqlBinding.cs
added /aubit4glsrc/trunk/dotnet/src/Aubit4GL.Runtime/Types/FglBool.cs
changed /aubit4glsrc/trunk/dotnet/src/Aubit4GL.Runtime/Types/FglBuiltins.cs
changed /aubit4glsrc/trunk/lib/liblex/lex_cs/compile_cs.c
/aubit4glsrc/trunk/dotnet/src/Aubit4GL.Runtime/FglSession.cs Diff Switch to side-by-side view
Loading...
/aubit4glsrc/trunk/dotnet/src/Aubit4GL.Runtime/Report/BaseFGLReport.cs Diff Switch to side-by-side view
Loading...
/aubit4glsrc/trunk/dotnet/src/Aubit4GL.Runtime/Sql/ASqlApi.cs Diff Switch to side-by-side view
Loading...
/aubit4glsrc/trunk/dotnet/src/Aubit4GL.Runtime/Sql/ASqlBinding.cs Diff Switch to side-by-side view
Loading...
/aubit4glsrc/trunk/dotnet/src/Aubit4GL.Runtime/Types/FglBool.cs Diff Switch to side-by-side view
Loading...
/aubit4glsrc/trunk/dotnet/src/Aubit4GL.Runtime/Types/FglBuiltins.cs Diff Switch to side-by-side view
Loading...
/aubit4glsrc/trunk/lib/liblex/lex_cs/compile_cs.c Diff Switch to side-by-side view
Loading...