dos_compilers/Digital Research MT+86 Pascal v311/CPMGET.SRC

43 lines
896 B
Plaintext
Raw Permalink Normal View History

2024-06-30 20:44:12 +02:00
(*$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.