Tags v3-showcase15, v3-showcase15-summary (this doc).
Suite 131/131; fixpoint OK (2,103,316 bytes).
compiler/tests/showcase15.mod (Showcase15, exit 42) links a
DEFINITION/IMPLEMENTATION helper plus four stdlib modules:
IMPORT Showcase15Lib, IOChan, TextIO, Strings;
Showcase15Lib is a
classic DEFINITION/IMPLEMENTATION pair; its signatures are
verified by the new check (InitPoint, SumPoint,
AppendInt).Point, InitPoint(VAR p …)."point " + <int> via Strings.Assign + AppendInt.OpenWrite a channel, write "total",
"point <n>", Close, then OpenRead and ReadString the lines
back, checking both.Output:
read back: point 42
showcase15 total=42
m2freadline originally set the descriptor's count header to the
number of bytes read. But HIGH(s) of an open ARRAY OF CHAR formal
reads that same header, so HIGH(s) + 1 (used by IOChan.ReadString
as the capacity) collapsed to the previous line's length after the
first read — the second line was truncated ("point" instead of
"point 42").
m2freadline now leaves the capacity header intact and returns the
byte count instead, so a caller may keep using HIGH. (ReadString
only needs the NUL-terminated content.)
Also, max is now declared int in C: Modula-2 CARDINAL arguments
arrive in a 32-bit register (QBE w), so only the low 32 bits of the
C long parameter are defined.
rm -f gen_ssa/_showcase15.txt before and after;
expect_run_files_out Showcase15 42 "read back: point 42" … with the
helper and the SysShim/Utf8/iochan/textio/strings/
conversions modules.
compiler/tests/showcase15.mod,
compiler/tests/showcase15lib.def/.mod,
compiler/run_tests.sh, runtime/syslib/shim.c,
docs/summary_showcase15.md.