43 lines
896 B
Plaintext
43 lines
896 B
Plaintext
(*$S+*) (* rmx/udi version *)
|
||
MODULE GETREC;
|
||
|
||
(*$I FIBDEF.LIB*)
|
||
|
||
VAR
|
||
@LFB: EXTERNAL ^FIB;
|
||
|
||
EXTERNAL PROCEDURE @RNB;
|
||
|
||
PROCEDURE GET(VAR F:FIB; SZ:INTEGER);
|
||
VAR
|
||
IS_EOLN : BOOLEAN;
|
||
BEGIN
|
||
F.FEOLN := FALSE; (* DEFAULT IS THAT WE RESET IT *)
|
||
|
||
@LFB := ADDR(F);
|
||
IF F.FEOF THEN
|
||
BEGIN
|
||
F.FEOLN := TRUE;
|
||
EXIT
|
||
END;
|
||
|
||
@RNB; (* GO READ FROM THE FILE/CONSOLE *)
|
||
|
||
IF F.FTEXT THEN (* TEXT FILE, EOLN/EOF MUST BE SET *)
|
||
BEGIN
|
||
F.FEOF := (F.FBUFFER[0] = CHR($1A)) OR (F.FEOF);
|
||
IS_EOLN := (F.FBUFFER[0] = CHR($0D)); (* $0D for rmx/udi *)
|
||
IF (IS_EOLN) OR (F.FEOF) THEN
|
||
F.FEOLN := TRUE;
|
||
|
||
IF (IS_EOLN) AND (F.OPTION = FRDWR) THEN (* GOBBLE LF *)
|
||
@RNB;
|
||
|
||
IF F.FEOF OR F.FEOLN THEN
|
||
F.FBUFFER[0] := ' ';
|
||
END
|
||
END;
|
||
|
||
MODEND.
|
||
|
||
|