2
0

dosh.inc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 1999-2000 by the Free Pascal development team.
  4. Dos unit for BP7 compatible RTL - Interface declarations
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {$IFNDEF HAS_FILENAMELEN}
  12. Const
  13. FileNameLen = 255;
  14. {$ENDIF HAS_FILENAMELEN}
  15. {$IFDEF CPUI386}
  16. {$IFNDEF HAS_REGISTERS}
  17. type
  18. Registers = packed record
  19. case i : integer of
  20. 0 : (ax,f1,bx,f2,cx,f3,dx,f4,bp,f5,si,f51,di,f6,ds,f7,es,f8,flags,fs,gs : word);
  21. 1 : (al,ah,f9,f10,bl,bh,f11,f12,cl,ch,f13,f14,dl,dh : byte);
  22. 2 : (eax, ebx, ecx, edx, ebp, esi, edi : longint);
  23. End;
  24. {$ENDIF HAS_REGISTERS}
  25. {$ENDIF CPUI386}
  26. Const
  27. {Bitmasks for CPU Flags}
  28. fcarry = $0001;
  29. fparity = $0004;
  30. fauxiliary = $0010;
  31. fzero = $0040;
  32. fsign = $0080;
  33. foverflow = $0800;
  34. {Bitmasks for file attribute}
  35. readonly = $01;
  36. hidden = $02;
  37. sysfile = $04;
  38. volumeid = $08;
  39. directory = $10;
  40. archive = $20;
  41. anyfile = $3F;
  42. {File Status}
  43. fmclosed = $D7B0;
  44. fminput = $D7B1;
  45. fmoutput = $D7B2;
  46. fminout = $D7B3;
  47. Type
  48. { Needed for LFN Support }
  49. ComStr = String[FileNameLen];
  50. PathStr = String[FileNameLen];
  51. DirStr = String[FileNameLen];
  52. NameStr = String[FileNameLen];
  53. ExtStr = String[FileNameLen];
  54. DateTime = packed record
  55. Year,
  56. Month,
  57. Day,
  58. Hour,
  59. Min,
  60. Sec : word;
  61. End;
  62. {$ifdef FPC_HAS_FEATURE_THREADING}
  63. threadvar
  64. {$else FPC_HAS_FEATURE_THREADING}
  65. var
  66. {$endif FPC_HAS_FEATURE_THREADING}
  67. DosError : integer;
  68. {$ifdef cpui386}
  69. {Interrupt}
  70. Procedure Intr(intno: byte; var regs: registers);
  71. Procedure MSDos(var regs: registers);
  72. {$endif cpui386}
  73. {Info/Date/Time}
  74. Function DosVersion: Word;
  75. Procedure GetDate(var year, month, mday, wday: word);
  76. Procedure GetTime(var hour, minute, second, sec100: word);
  77. procedure SetDate(year,month,day: word);
  78. Procedure SetTime(hour,minute,second,sec100: word);
  79. Procedure UnpackTime(p: longint; var t: datetime);
  80. Procedure PackTime(var t: datetime; var p: longint);
  81. {Exec}
  82. Procedure Exec(const path: pathstr; const comline: comstr);
  83. Function DosExitCode: word;
  84. {Disk}
  85. Function DiskFree(drive: byte) : int64;
  86. Function DiskSize(drive: byte) : int64;
  87. Procedure FindFirst(const path: pathstr; attr: word; var f: searchRec);
  88. Procedure FindNext(var f: searchRec);
  89. Procedure FindClose(Var f: SearchRec);
  90. {File}
  91. Procedure GetFAttr(var f; var attr: word);
  92. Procedure GetFTime(var f; var time: longint);
  93. Function FSearch(path: pathstr; dirlist: string): pathstr;
  94. Function FExpand(const path: pathstr): pathstr;
  95. Procedure FSplit(path: pathstr; var dir: dirstr; var name: namestr; var ext: extstr);
  96. function GetShortName(var p : String) : boolean;
  97. function GetLongName(var p : String) : boolean;
  98. {Environment}
  99. Function EnvCount: longint;
  100. Function EnvStr (Index: longint): string;
  101. Function GetEnv(envvar: string): string;
  102. {Misc}
  103. Procedure SetFAttr(var f; attr: word);
  104. Procedure SetFTime(var f; time: longint);
  105. Procedure GetCBreak(var breakvalue: boolean);
  106. Procedure SetCBreak(breakvalue: boolean);
  107. Procedure GetVerify(var verify: boolean);
  108. Procedure SetVerify(verify: boolean);
  109. {Do Nothing Functions}
  110. Procedure SwapVectors;
  111. Procedure GetIntVec(intno: byte; var vector: {$ifdef cpui8086}farpointer{$else}pointer{$endif});
  112. Procedure SetIntVec(intno: byte; vector: {$ifdef cpui8086}farpointer{$else}pointer{$endif});
  113. Procedure Keep(exitcode: word);
  114. {Additional (non-TP) function for quick access to system timer - for FV etc.}
  115. Function GetMsCount: int64;
  116. {Offset between two return values corresponds to amount of milliseconds
  117. between the two calls, however the exact value is not guaranteed to have
  118. particular meaning - it can be e.g. amount of milliseconds since computer
  119. startup on DOS-like x86 platforms, derived from Unix time on Unix etc.}