refactor(interp): extract PRINT formatting into PrintFormat
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Thu, 3 Sep 2026 21:00:38 +0000 (00:00 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Thu, 3 Sep 2026 21:00:38 +0000 (00:00 +0300)
commit0ef35bda5e4a7f6f18d0ca4f24a1cd72a6caee34
treed7bc449ccbf942f8c81501a93420de5981710871
parentd78fea147c5502bd6dd35d97f2bb81388d05ea9d
refactor(interp): extract PRINT formatting into PrintFormat

The classic number style (SINGLE 7-digit / DOUBLE 16-digit, D±xx/E±xx
scientific, sign padding), the PRINT USING field walker, and the
14-column zone arithmetic lived in Interpreter; the zone math was
duplicated in two places with different wrap rules (console wraps at
its column count, file output at 255).

PrintFormat now owns all of it: number()/singleNumber(), usingFormat()
with an item-value callback (items still evaluate in the interpreter),
numericField(), and nextZone() shared by the console printZoneAdvance
and IoSubsystem's PRINT # zones — the wrap rule is now an explicit
parameter at both call sites instead of two divergent inline copies.

Verification: 93/93 tests green; CHECK (PRINT USING), FLPT (STR$/HEX$)
and BAR (PRINT USING + records) re-run pixel-identical.
src/main/java/eu/svjatoslav/crtbasic/interp/Interpreter.java
src/main/java/eu/svjatoslav/crtbasic/interp/PrintFormat.java [new file with mode: 0644]
src/main/java/eu/svjatoslav/crtbasic/io/IoSubsystem.java