mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 21:32:26 +00:00
Merge d9a56a7d49 into aa5252dc6b
This commit is contained in:
commit
2c07d9edc0
1 changed files with 16 additions and 5 deletions
|
|
@ -634,25 +634,36 @@ 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;
|
||||
REPEAT Read(R, ch); x[i] := ch; INC(i) UNTIL ch = 0X
|
||||
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; tail: INTEGER;
|
||||
BEGIN
|
||||
i := 0;
|
||||
b := FALSE;
|
||||
pos := Pos(R);
|
||||
tail := 0;
|
||||
REPEAT
|
||||
Read(R, ch);
|
||||
IF ((ch = 0X) OR (ch = 0AX) OR (ch = 0DX)) THEN
|
||||
IF (ch = 0X) THEN
|
||||
tail := 1;
|
||||
ELSE
|
||||
tail := Strings.Length(Platform.nl);
|
||||
END;
|
||||
b := TRUE
|
||||
ELSE
|
||||
x[i] := ch;
|
||||
INC(i);
|
||||
END;
|
||||
UNTIL b
|
||||
UNTIL b;
|
||||
x[i] := 0X;
|
||||
IF ~R.eof THEN Set(R, R.buf.f, pos + i + tail); END;
|
||||
END ReadLine;
|
||||
|
||||
PROCEDURE ReadNum* (VAR R: Rider; VAR x: LONGINT);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue