System Functions for Text Files

This procedure processes system functions SeekEoln, SeekEof, Eoln for text files and Eof for all files.
Procedure Func_TextFunctions; Far;
begin
  If CheckAndGetNextToken (Token_LeftParenthesis) then
    begin
      Expression^.ExpectFileVariableAndPushPointerToMemory;
      If Expression^.TypeDefPtr^.BaseType <> btText then
        begin
          If FuncParameter <> SysProc_GetTEof then Error (InvalidFileType);
          FuncParameter := SysProc_GetFEof;
        end;
      ExpectTokenAndGetNext (Token_RightParenthesis);
      Expression^.Calculate;
    end else PushPointerToTextRec (0, 0);
  GenerateInstruction_CALL_FAR (FuncParameter);
  GenerateIOErrorCheckingCode;
  With Expression ^do
    begin
      Expression^.EndIntermediateCodeSubroutine;
      Location := elRegister;
      DataType := [];
      UsedRegisters := [urSP, urDX, urAX];
      LocationData.Register := rDX_AX;
      TypeDefPtr := Ptr (SystemUnitSegment, Boolean_TypeOffset);
    end;
end;
 
 
 
© 2017 Turbo Pascal | Privacy Policy