dos_compilers/Digital Research MT+86 Pascal v311/CPMGET.SRC
2024-06-30 11:44:12 -07:00

43 lines
896 B
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(*$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.