Menu

Commit [r13052]  Maximize  Restore  History

Generator: carry CHAR widths through to the generated code

A 4GL CHAR is fixed width and blank padded, but it maps to a C# string,
which has no width - so LET c = "hello" on a CHAR(10) was losing the
padding and DISPLAY printed five columns instead of ten.

The width is known at the assignment even though it is not recoverable
from the C# type, so every assignment to a CHAR is now wrapped:

L_s = Fgl.Pad("hello", 10);

This uses the generator's existing write-prefix / suffix mechanism in
decode_varbind, so it costs one helper and two small branches rather
than switching the emitted type to FglChar - which would have touched
the declaration, LET and parameter paths.

VARCHAR is deliberately excluded: it has no fixed width to pad to.

Also adds Fgl.CompareString, which generated code calls wherever either
side of a comparison is a string. Trailing blanks are not significant,
and a comparison involving NULL is false - including NULL against NULL.

A second end-to-end probe covers nine assignment forms: CHAR padding and
truncation, CHAR from CHAR, VARCHAR, an array element, a record field,
NULL, and an INTEGER's display width. Both probes pass.

mikeaubury 2026-09-02

changed /aubit4glsrc/trunk/dotnet/fidelity/endtoend/prog.4gl
changed /aubit4glsrc/trunk/dotnet/fidelity/endtoend/run.sh
added /aubit4glsrc/trunk/dotnet/fidelity/endtoend/types.4gl
changed /aubit4glsrc/trunk/dotnet/src/Aubit4GL.Runtime/FglSession.cs
changed /aubit4glsrc/trunk/dotnet/src/Aubit4GL.Runtime/Types/FglBuiltins.cs
changed /aubit4glsrc/trunk/dotnet/tests/Aubit4GL.Runtime.Tests/BuiltinTests.cs
changed /aubit4glsrc/trunk/lib/liblex/lex_cs/compile_cs.c
/aubit4glsrc/trunk/dotnet/fidelity/endtoend/prog.4gl Diff Switch to side-by-side view
Loading...
/aubit4glsrc/trunk/dotnet/fidelity/endtoend/run.sh Diff Switch to side-by-side view
Loading...
/aubit4glsrc/trunk/dotnet/fidelity/endtoend/types.4gl Diff Switch to side-by-side view
Loading...
/aubit4glsrc/trunk/dotnet/src/Aubit4GL.Runtime/FglSession.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/dotnet/tests/Aubit4GL.Runtime.Tests/BuiltinTests.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...