Metropoli BBS
VIEWER: dos.pas MODE: TEXT (CP437)
{█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█}
{█                                                       █}
{█      Virtual Pascal Runtime Library.  Version 1.1.    █}
{█      DOS interface unit for OS/2                      █}
{█      ─────────────────────────────────────────────────█}
{█      Copyright (C) 1995,96 fPrint UK Ltd              █}
{█                                                       █}
{▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀}

{$S-,R-,Q-,I-,Cdecl-,OrgName-,AlignRec-,Delphi+,PureInt+}

unit Dos;

interface

uses Os2Def, Os2Base, Use32;

const

{ Flags bit masks }

  fCarry     = $0001;
  fParity    = $0004;
  fAuxiliary = $0010;
  fZero      = $0040;
  fSign      = $0080;
  fOverflow  = $0800;

{ File mode magic numbers }

  fmClosed =  $A55AD7B0;
  fmInput  =  $A55AD7B1;
  fmOutput =  $A55AD7B2;
  fmInOut  =  $A55AD7B3;

{ File attribute constants }

  ReadOnly  = $01;
  Hidden    = $02;
  SysFile   = $04;
  VolumeID  = $08;      { For compatibility only, OS/2 doesn't use this attribute }
  Directory = $10;
  Archive   = $20;
  AnyFile   = $37;

type

{ String types }

  ComStr  = String;     { Command line string           }
  PathStr = String;     { File pathname string          }
  DirStr  = String;     { Drive and directory string    }
  NameStr = String;     { File name string              }
  ExtStr  = String;     { File extension string         }

{ Typed-file and untyped-file record }

  FileRec = record
    Handle:   Longint;                  { File Handle                }
    Mode:     Longint;                  { Current file mode          }
    RecSize:  Longint;                  { I/O operation record size  }
    Private:  array [1..28] of Byte;    { Reserved                   }
    UserData: array [1..32] of Byte;    { User data area             }
    Name:     array [0..259] of Char;   { File name (ASCIIZ)         }
  end;

{ Textfile record }

  TextBuf = array [0..127] of Char;
  TextRec = record
    Handle:    Longint;                 { File Handle                }
    Mode:      Longint;                 { Current file mode          }
    BufSize:   Longint;                 { Text File buffer size      }
    BufPos:    Longint;                 { Buffer current position    }
    BufEnd:    Longint;                 { Buffer ending position     }
    BufPtr:    ^TextBuf;                { Pointer to the buffer      }
    OpenFunc:  Pointer;                 { Open Text File function @  }
    InOutFunc: Pointer;                 { In/Out ...                 }
    FlushFunc: Pointer;                 { Flush ...                  }
    CloseFunc: Pointer;                 { Close ...                  }
    UserData:  array [1..32] of Byte;   { User data area             }
    Name:      array [0..259] of Char;  { File name (ASCIIZ)         }
    Buffer:    TextBuf;                 { Default I/O buffer         }
  end;

{ Search record used by FindFirst and FindNext }

  SearchRec = record
    HDir: ULong;
    Attr: Byte;
    Time: Longint;
    Size: Longint;
    Name: NameStr;
  end;

{ Date and time record used by PackTime and UnpackTime }

  DateTime = record
    Year,Month,Day,Hour,Min,Sec: Word;
  end;

{ Error status variable }

threadvar
  DosError: Integer;
  ExecFlags: ULong;     { exec_Sync = 0 }

{ Exec flags }
const
  efSync  = exec_Sync;
  efAsync = exec_AsyncResult;

function DosVersion: Word;
procedure GetDate(var Year,Month,Day,DayOfWeek: Word);
procedure SetDate(Year,Month,Day: Word);
procedure GetTime(var Hour,Minute,Second,Sec100: Word);
procedure SetTime(Hour,Minute,Second,Sec100: Word);
procedure GetVerify(var Verify: Boolean);
procedure SetVerify(Verify: Boolean);
function DiskFree(Drive: Byte): Longint;
function DiskSize(Drive: Byte): Longint;
procedure GetFAttr(var F; var Attr: Word);
procedure SetFAttr(var F; Attr: Word);
procedure GetFTime(var F; var Time: Longint);
procedure SetFTime(var F; Time: Longint);
procedure FindFirst(const Path: PathStr; Attr: Word; var F: SearchRec);
procedure FindNext(var F: SearchRec);
procedure UnpackTime(P: Longint; var T: DateTime);
procedure PackTime(var T: DateTime; var P: Longint);
function FSearch(const Path: PathStr; const DirList: String): PathStr;
function FExpand(const Path: PathStr): PathStr;
function EnvCount: Integer;
function EnvStr(Index: Integer): String;
function GetEnv(const EnvVar: String): String;
procedure FSplit(const Path: PathStr; var Dir: DirStr; var Name: NameStr;
  var Ext: ExtStr);
procedure Exec(const Path: PathStr; const ComLine: ComStr);
function DosExitCode: Word;

{ The following procedures are not implemented

procedure Intr(IntNo: Byte; var Regs: Registers);
procedure MsDos(var Regs: Registers);
procedure GetCBreak(var Break: Boolean);
procedure SetCBreak(Break: Boolean);
procedure GetIntVec(IntNo: Byte; var Vector: Pointer);
procedure SetIntVec(IntNo: Byte; Vector: Pointer);
procedure Keep(ExitCode: Word);

}

{ SwapVectors remains for compatibility but do nothing }

procedure SwapVectors;

{ The following support have been added }

procedure FindClose(var F: SearchRec);

implementation

uses Strings;

end.
[ RETURN TO DIRECTORY ]