Closed erkyrath closed 1 year ago
This would particularly benefit retro systems that didn't have a consist standard for newlines. Mac Classic uses \r
only, for example.
As far as I can tell without testing, the compiler behaves correctly on Mac Classic (and when opening \r
source files).
(a)
source_to_iso_grid[]
converts\r
to\n
anyhow
Fixed with the above merge.
The compiler opens source files with
fopen(name,"r")
. This can behave differently on different platforms.On Windows (I should really say, with the standard Windows C environment), fopen() in text mode converts DOS line breaks
\r\n
to\n
. On Mac/Unix, it doesn't. (Probably on Classic MacOS, fopen() converts\r
to\n
, not that anyone cares any more.)This is mostly transparent to Inform because (a)
source_to_iso_grid[]
converts\r
to\n
anyhow; and (b) the I6 language always treats a double line break the same as a single line break. So if you compile a DOS-style text file on Unix, the\r\n
line breaks come in as\n\n
, but the game compiles the same.However, this messes up error reporting. Every
\n
is a call to reached_new_line(). So error/warning messages report double the line number.It would be better in principle to behave exactly the same on every platform. We would open source files with
fopen(name,"rb")
and then do our own conversion of either\r\n
or\r
to\n
. Probably this would happen in get_next_char_from_pipeline()?Forum thread: https://intfiction.org/t/i6-compiler-bug-line-error-reference/62300