mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 21:32:26 +00:00
ReadString and ReadLine from Files module now adjusts Rider
This commit is contained in:
parent
e4aca9f6f9
commit
7d4815e2ae
1 changed files with 6 additions and 3 deletions
|
|
@ -634,17 +634,19 @@ Especially Length would become fairly complex.
|
|||
END ReadLReal;
|
||||
|
||||
PROCEDURE ReadString* (VAR R: Rider; VAR x: ARRAY OF CHAR);
|
||||
VAR i: INTEGER; ch: CHAR;
|
||||
BEGIN i := 0;
|
||||
VAR i: INTEGER; ch: CHAR; pos: LONGINT;
|
||||
BEGIN i := 0; pos := Pos(R);
|
||||
REPEAT Read(R, ch); x[i] := ch; INC(i) UNTIL ch = 0X;
|
||||
x[i] := 0X;
|
||||
IF ~R.eof THEN Set(R, R.buf.f, pos + i + 1); END;
|
||||
END ReadString;
|
||||
|
||||
PROCEDURE ReadLine* (VAR R: Rider; VAR x: ARRAY OF CHAR);
|
||||
VAR i: INTEGER; ch: CHAR; b : BOOLEAN;
|
||||
VAR i: INTEGER; ch: CHAR; b : BOOLEAN; pos: LONGINT;
|
||||
BEGIN
|
||||
i := 0;
|
||||
b := FALSE;
|
||||
pos := Pos(R);
|
||||
REPEAT
|
||||
Read(R, ch);
|
||||
IF ((ch = 0X) OR (ch = 0AX) OR (ch = 0DX)) THEN
|
||||
|
|
@ -655,6 +657,7 @@ Especially Length would become fairly complex.
|
|||
END;
|
||||
UNTIL b;
|
||||
x[i] := 0X;
|
||||
IF ~R.eof THEN Set(R, R.buf.f, pos + i + 1); END;
|
||||
END ReadLine;
|
||||
|
||||
PROCEDURE ReadNum* (VAR R: Rider; VAR x: LONGINT);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue