Open GoogleCodeExporter opened 8 years ago
To prevent wrong processing of non-constant CHAR value, as:
MODULE TestAdrChar;
IMPORT SYSTEM;
VAR adr: LONGINT; ch: CHAR;
BEGIN
adr := SYSTEM.ADR(ch);
END TestAdrChar.
one additional condition is required into my code. Was:
IF f = Char THEN CharToString(z); f := String END;
Now:
IF (z^.class = Nconst) & (f = Char) THEN CharToString(z); f := String END;
https://github.com/Oleg-N-Cher/Ofront/commit/d907fa0f5e0b7d26805d6a340fd883161b7
f0be3
Original comment by al...@bk.ru
on 17 May 2015 at 7:33
And extra condition to make sure that a character code of SYSTEM.ADR("x")
argument is in range {0X, 20X..7FX}:
IF (z^.class = Nconst) & (f = Char) THEN
CASE CHR(z^.conval^.intval) OF 0X, 20X..7FX: CharToString(z); f := String ELSE err(127) END;
END;
https://github.com/Oleg-N-Cher/Ofront/commit/a5e7d06a6eb713ce9a893c8d3f673f81cf6
55c13
It's required for preventing to declare the one-character string with a
non-printable character. Note: SYSTEM.ADR(0X) translates to (LONGINT)"" - I see
sense to get the address of an empty string in such way.
Original comment by al...@bk.ru
on 17 May 2015 at 8:53
Original issue reported on code.google.com by
al...@bk.ru
on 17 May 2015 at 3:11