System Procedures GetDir, ChDir, MkDir and RmDir

This function processes system procedure GetDir.
Function Proc_GetDir: Word; Far;
Var DriveExpression, DirExpression: Texpression;
begin
  ExpectTokenAndGetNext (Token_LeftParenthesis);
  With DriveExpression do
    begin
      ExpectIntegerExpression;
      CheckOrdinalRange (Ptr (SystemUnitSegment, Byte_TypeOffset));
      PushExpression
    end;
  ExpectTokenAndGetNext (Token_Comma);
  DirExpression.ExpectStringVariable;
  DirExpression.PushArrayPointerAndHighestIndex;
  ExpectTokenAndGetNext (Token_RightParenthesis);
  StoreCode_icGoSub (DriveExpression.IntermediateCodeOffset);
  StoreCode_icGoSub (DirExpression.IntermediateCodeOffset);
  GenerateInstruction_CALL_FAR (SysProc_DirGet);
  Proc_GetDir := EndSubroutine;
end;
This function processes system procedures ChDir, MkDir and RmDir.
Function Proc_ChDir_MkDir_RmDir: Word; Far;
Var DirExpression: Texpression;
begin
  ExpectTokenAndGetNext (Token_LeftParenthesis);
  DirExpression.ExpectAndStoreStringAndPushPointer;
  ExpectTokenAndGetNext (Token_RightParenthesis);
  DirExpression.Calculate;
  GenerateInstruction_CALL_FAR (ProcParameter);
  GenerateIOErrorCheckingCode;
  Proc_ChDir_MkDir_RmDir := EndSubroutine;
end;
 
 
 
© 2017 Turbo Pascal | Privacy Policy