dos.tex 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. %
  2. % $Id$
  3. % This file is part of the FPC documentation.
  4. % Copyright (C) 1997, by Michael Van Canneyt
  5. %
  6. % The FPC documentation is free text; you can redistribute it and/or
  7. % modify it under the terms of the GNU Library General Public License as
  8. % published by the Free Software Foundation; either version 2 of the
  9. % License, or (at your option) any later version.
  10. %
  11. % The FPC Documentation is distributed in the hope that it will be useful,
  12. % but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. % Library General Public License for more details.
  15. %
  16. % You should have received a copy of the GNU Library General Public
  17. % License along with the FPC documentation; see the file COPYING.LIB. If not,
  18. % write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. % Boston, MA 02111-1307, USA.
  20. %
  21. \chapter{The DOS unit.}
  22. This chapter describes the \var{DOS} unit for Free pascal, both under \dos
  23. and \linux. The unit was first written for \dos by Florian kl\"ampfl.
  24. The unit was ported to \linux by Mark May\footnote{Current
  25. e-mail address \textsf{[email protected]}}, and enhanced by Micha\"el Van
  26. Canneyt.
  27. Under \linux, some of the functionality is lost, as it is either impossible
  28. or meaningless to implement it. Other than that,
  29. the functionality for both operating systems is the same.
  30. This chapter is divided in two sections.
  31. \begin{itemize}
  32. \item The first section lists the pre-defined constants, types and variables.
  33. \item The second section describes the functions which appear in the
  34. interface part of the DOS unit.
  35. \end{itemize}
  36. \section{Types, Variables, Constants}
  37. \subsection {Constants}
  38. The DOS unit implements the following constants:
  39. \begin{verbatim}
  40. {Bitmasks for CPU Flags}
  41. fcarry = $0001;
  42. fparity = $0004;
  43. fauxiliary = $0010;
  44. fzero = $0040;
  45. fsign = $0080;
  46. foverflow = $0800;
  47. {Bitmasks for file attribute}
  48. readonly = $01;
  49. hidden = $02;
  50. sysfile = $04;
  51. volumeid = $08;
  52. directory = $10;
  53. archive = $20;
  54. anyfile = $3F;
  55. fmclosed = $D7B0;
  56. fminput = $D7B1;
  57. fmoutput = $D7B2;
  58. fminout = $D7B3;
  59. \end{verbatim}
  60. \subsection{Types}
  61. The following string types are defined for easy handling of
  62. filenames :
  63. \begin{verbatim}
  64. ComStr = String[127]; { For command-lines }
  65. PathStr = String[79]; { For full path for file names }
  66. DirStr = String[67]; { For Directory and (DOS) drive string }
  67. NameStr = String[8]; { For Name of file }
  68. ExtStr = String[4]; { For Extension of file }
  69. \end{verbatim}
  70. Under \linux, these strings all have length 255.
  71. \begin{verbatim}
  72. {$PACKRECORDS 1}
  73. SearchRec = Record
  74. Fill : array[1..21] of byte;
  75. { Fill replaced with declarations below, for Linux}
  76. Attr : Byte; {attribute of found file}
  77. Time : LongInt; {last modify date of found file}
  78. Size : LongInt; {file size of found file}
  79. Reserved : Word; {future use}
  80. Name : String[255]; {name of found file}
  81. SearchSpec: String[255]; {search pattern}
  82. NamePos: Word; {end of path, start of name position}
  83. End;
  84. \end{verbatim}
  85. Under \linux, the \var{Fill} array is replaced with the following:
  86. \begin{verbatim}
  87. SearchNum: LongInt; {to track which search this is}
  88. SearchPos: LongInt; {directory position}
  89. DirPtr: LongInt; {directory pointer for reading directory}
  90. SearchType: Byte; {0=normal, 1=open will close}
  91. SearchAttr: Byte; {attribute we are searching for}
  92. Fill: Array[1..07] of Byte; {future use}
  93. \end{verbatim}
  94. This is because the searching meachanism on Unix systems is substantially
  95. different from \dos's, and the calls have to be mimicked.
  96. \begin{verbatim}
  97. const
  98. filerecnamelength = 255;
  99. type
  100. FileRec = Packed Record
  101. Handle,
  102. Mode,
  103. RecSize : longint;
  104. _private : array[1..32] of byte;
  105. UserData : array[1..16] of byte;
  106. name : array[0..filerecnamelength] of char;
  107. End;
  108. \end{verbatim}
  109. \var{FileRec} is used for internal representation of typed and untyped files.
  110. Text files are handled by the following types :
  111. \begin{verbatim}
  112. const
  113. TextRecNameLength = 256;
  114. TextRecBufSize = 256;
  115. type
  116. TextBuf = array[0..TextRecBufSize-1] of char;
  117. TextRec = Packed Record
  118. Handle,
  119. Mode,
  120. bufsize,
  121. _private,
  122. bufpos,
  123. bufend : longint;
  124. bufptr : ^textbuf;
  125. openfunc,
  126. inoutfunc,
  127. flushfunc,
  128. closefunc : pointer;
  129. UserData : array[1..16] of byte;
  130. name : array[0..textrecnamelength-1] of char;
  131. buffer : textbuf;
  132. End;
  133. \end{verbatim}
  134. Remark that this is not binary compatible with the Turbo Pascal definition
  135. of \var{TextRec}, since the sizes of the different fields are different.
  136. \begin{verbatim}
  137. Registers = record
  138. case i : integer of
  139. 0 : (ax,f1,bx,f2,cx,f3,dx,f4,bp,f5,si,
  140. f51,di,f6,ds,f7,es,f8,flags,fs,gs : word);
  141. 1 : (al,ah,f9,f10,bl,bh,f11,f12,
  142. cl,ch,f13,f14,dl,dh : byte);
  143. 2 : (eax, ebx, ecx, edx, ebp, esi, edi : longint);
  144. End;
  145. \end{verbatim}
  146. The \var{registers} type is used in the \var{MSDos} call.
  147. \begin{verbatim}
  148. DateTime = record
  149. Year: Word;
  150. Month: Word;
  151. Day: Word;
  152. Hour: Word;
  153. Min: Word;
  154. Sec: word;
  155. End;
  156. \end{verbatim}
  157. The \var{DateTime} type is used in \seep{PackTime} and \seep{UnPackTime} for
  158. setting/reading file times with \seep{GetFTime} and \seep{SetFTime}.
  159. \subsection{Variables}
  160. \begin{verbatim}
  161. DosError : integer;
  162. \end{verbatim}
  163. The \var{DosError} variable is used by the procedures in the \dos unit to
  164. report errors. It can have the following values :
  165. \begin{center}
  166. \begin{tabular}{cl}
  167. 2 & File not found. \\
  168. 3 & path not found. \\
  169. 5 & Access denied. \\
  170. 6 & Invalid handle. \\
  171. 8 & Not enough memory. \\
  172. 10 & Invalid environment. \\
  173. 11 & Invalid format. \\
  174. 18 & No more files.
  175. \end{tabular}
  176. \end{center}
  177. Other values are possible, but are not documented.
  178. %\begin{verbatim}
  179. % drivestr : array [0..26] of pchar;
  180. %\end{verbatim}
  181. %This variable is defined in the \linux version of the \dos unit. It is used
  182. %in the \seef{DiskFree} and \seef{DiskSize} calls.
  183. \section{Functions and Procedures}
  184. \procedure{AddDisk}{(Const S : String)}
  185. {\var{AddDisk} adds a filename \var{S} to the internal list of disks. It is
  186. implemented for \linux only.
  187. This list is used to determine which disks to use in the \seef{DiskFree}
  188. and \seef{DiskSize} calls.
  189. The \seef{DiskFree} and \seef{DiskSize} functions need a file on the
  190. specified drive, since this is required for the \var{statfs} system call.
  191. The names are added sequentially. The dos
  192. initialization code presets the first three disks to:
  193. \begin{itemize}
  194. \item \var{'.'} for the current drive,
  195. \item \var{'/fd0/.'} for the first floppy-drive.
  196. \item \var{'/fd1/.'} for the second floppy-drive.
  197. \item \var{'/'} for the first hard disk.
  198. \end{itemize}
  199. The first call to \var{AddDisk} will therefore add a name for the second
  200. harddisk, The second call for the third drive, and so on until 23 drives
  201. have been added (corresponding to drives \var{'D:'} to \var{'Z:'})
  202. }{None}{\seef{DiskFree}, \seef{DiskSize} }
  203. \function{DiskFree}{(Drive: byte)}{longint}{
  204. \var{DiskFree} returns the number of free bytes on a disk. The parameter
  205. \var{Drive} indicates which disk should be checked. This parameter is 1 for
  206. floppy \var{a:}, 2 for floppy \var{b:}, etc. A value of 0 returns the free
  207. space on the current drive.
  208. Typically, the free space is the size of a disk block, multiplied by the
  209. number of free blocks on the disk.
  210. \textbf{For \linux only:}\\
  211. The \var{diskfree} and \var{disksize} functions need a file on the
  212. specified drive, since this is required for the \var{statfs} system call.
  213. These filenames are set in the initialization of the dos unit, and have
  214. been preset to :
  215. \begin{itemize}
  216. \item \var{'.'} for the current drive,
  217. \item \var{'/fd0/.'} for the first floppy-drive.
  218. \item \var{'/fd1/.'} for the second floppy-drive.
  219. \item \var{'/'} for the first hard disk.
  220. \end{itemize}
  221. There is room for 1-26 drives. You can add a drive with the
  222. \seep{AddDisk} procedure.
  223. These settings can be coded in \var{dos.pp}, in the initialization part.
  224. }{-1 when a failure occurs, or an invalid \var{drivenr} is given.}
  225. {\seef{DiskSize}, \seep{AddDisk}}
  226. \latex{\inputlisting{dosex/ex6.pp}}
  227. \html{\input{dosex/ex6.tex}}
  228. \function{DiskSize}{(Drive: byte)}{longint}{
  229. \var{DiskSize} returns the total size (in bytes) of a disk. The parameter
  230. \var{Drive} indicates which disk should be checked. This parameter is 1 for
  231. floppy \var{a:}, 2 for floppy \var{b:}, etc. A value of 0 returns the size
  232. of the current drive.
  233. \textbf{For \linux only:}\\
  234. The \var{diskfree} and \var{disksize} functions need a file on the specified drive, since this
  235. is required for the \var{statfs} system call.
  236. These filenames are set in the initialization of the dos unit, and have
  237. been preset to :
  238. \begin{itemize}
  239. \item \var{'.'} for the current drive,
  240. \item \var{'/fd0/.'} for the first floppy-drive.
  241. \item \var{'/fd1/.'} for the second floppy-drive.
  242. \item \var{'/'} for the first hard disk.
  243. \end{itemize}
  244. There is room for 1-26 drives. You can add a drive with the
  245. \seep{AddDisk} procedure.
  246. These settings can be coded in \var{dos.pp}, in the initialization part.
  247. }{-1 when a failure occurs, or an invalid drive number is given.}
  248. {\seef{DiskFree}, \seep{AddDisk}}
  249. For an example, see \seef{DiskFree}.
  250. \Function{DosExitCode}{Word}{
  251. \var{DosExitCode} contains (in the low byte) the exit-code of a program
  252. executed with the \var{Exec} call.}{None.}{\seep{Exec}}
  253. \latex{\inputlisting{dosex/ex5.pp}}
  254. \html{\input{dosex/ex5.tex}}
  255. \Function{DosVersion}{Word}
  256. {\var{DosVersion} returns the \dos version number. On \linux systems, it
  257. returns the Linux version (The first 2 numbers, e.g Linux version 2.1.76 will
  258. give you DosVersion 2.1)}{None.}{}
  259. \latex{\inputlisting{dosex/ex1.pp}}
  260. \html{\input{dosex/ex1.tex}}
  261. \Function{EnvCount}{longint}{
  262. \var{EnvCount} returns the number of environment variables.}
  263. {None.}{\seef{EnvStr}, \seef{GetEnv}}
  264. \function{EnvStr}{(Index: integer)}{string}{
  265. \var{EnvStr} returns the \var{Index}-th \var{Name=Value} pair from the list
  266. of environment variables.
  267. The index of the first pair is zero.}
  268. {The length is limited to 255 characters. This may cause problems under
  269. \linux. The \linux unit solves this problem.}{\seef{EnvCount}, \seef{GetEnv}}
  270. \latex{\inputlisting{dosex/ex13.pp}}
  271. \html{\input{dosex/ex13.tex}}
  272. \procedure{Exec}{(const Path: pathstr; const ComLine: comstr)}{
  273. \var{Exec} executes the program in \var{Path}, with the options given by
  274. \var{ComLine}.
  275. After the program has terminated, the procedure returns. The Exit value of
  276. the program can be consulted with the \var{DosExitCode} function.
  277. }{Errors are reported in \var{DosError}.}{\seef{DosExitCode}}
  278. For an example, see \seef{DosExitCode}
  279. \functionl{FExpand}{Dos:FExpand}{(const path: pathstr)}{pathstr}{
  280. \var{FExpand} takes its argument and expands it to a complete filename, i.e.
  281. a filename starting from the root directory of the current drive, prepended
  282. with the drive-letter (under \dos).
  283. The resulting name is converted to uppercase on \dos systems. Under \linux,
  284. the name is left as it is. (filenames are case sensitive under Unix)
  285. }{\seep{FSplit}}
  286. \latex{\inputlisting{dosex/ex5.pp}}
  287. \html{\input{dosex/ex5.tex}}
  288. \procedure{FindClose}{(Var F: SearchRec)}{
  289. \textbf{\linux only}
  290. Under \linux, the \var{findfirst/findnext} calls have to be mimicked.
  291. An internal table of file descriptors is kept.
  292. When using different \var{searchrecs} at the same time,
  293. the system may run out of file descriptors for directories.
  294. The \linux implementation of the \dos unit therefore keeps a table of open
  295. directories, and when the table is full, closes one of the directories, and
  296. reopens another. This system is adequate but slow if you use a lot of
  297. \var{searchrecs}.
  298. So, to speed up the findfirst/findnext system, the \var{FindClose} call was
  299. implemented. When you don't need a \var{searchrec} any more, you can tell
  300. this to the \dos unit by issuing a \var{FindClose} call. The directory
  301. which is kept open for this \var{searchrec} is then closed, and the table slot
  302. freed.
  303. It is recommended to use the \linux call \var{Glob} when looking for files.
  304. }{None.}{\seef{Glob}.}
  305. \procedure{FindFirst}{(const Path: pathstr; Attr: word; var F: SearchRec)}{
  306. \var{FindFirst} searches the file specified in \var{Path}, checks the
  307. atrributes specified in \var{Attr}. It returns a \var{SearchRec} record for
  308. further searching in \var{F}.
  309. \var{Path} can contain the wildcard characters \var{?} (matches any single
  310. character) and \var{*} (matches 0 ore more arbitrary characters). In this
  311. case \var{FindFirst} will return the first file which matches the specified
  312. criteria.
  313. If \var{DosError} is different from zero, no file(s) matching the criteria
  314. was(were) found.}{Errors are reported in DosError.}{\seep{FindNext},
  315. \seep{FindClose}}
  316. \latex{\inputlisting{dosex/ex7.pp}}
  317. \html{\input{dosex/ex7.tex}}
  318. \procedure{FindNext}{(var f: searchRec)}{
  319. \var{FindNext} takes as an argument a \var{SearchRec} from a previous
  320. \var{FindNext} call, or a \var{FindFirst} call, and tries to find another
  321. file which matches the criteria, specified in the \var{FindFirst} call.
  322. If \var{DosError} is different from zero, no more files matching the
  323. criteria were found.}{\var{DosError} is used to report errors.}
  324. {\seep{FindFirst}, \seep{FindClose}}
  325. For an example, see \seep{FindFirst}.
  326. \functionl{FSearch}{Dos:FSearch}{(Path: pathstr; DirList: string)}{pathstr}
  327. {\var{FSearch} searches the file \var{Path} in all directories listed in
  328. \var{DirList}. The full name of the found file is returned.
  329. \var{DirList} must be a list of directories, separated by semi-colons (or
  330. colons under \linux).
  331. When no file is found, an empty string is returned.
  332. }{None.}{\seefl{FExpand}{Dos:FExpand}}
  333. \latex{\inputlisting{dosex/ex10.pp}}
  334. \html{\input{dosex/ex10.tex}}
  335. \procedure{FSplit}{(path: pathstr; \\ var dir: dirstr; var name: namestr;
  336. var ext: extstr)}{
  337. \var{FSplit} splits a full file name into 3 parts : A \var{Path}, a
  338. \var{Name} and an extension (in \var{ext}.)
  339. Under \linux, the extension is taken to be all letters after the last dot
  340. (.).
  341. }{None.}{\seefl{FSearch}{Dos:FSearch}}
  342. \latex{\inputlisting{dosex/ex12.pp}}
  343. \html{\input{dosex/ex12.tex}}
  344. \procedure{GetCBreak}{(var breakvalue: boolean)}{
  345. \var{GetCBreak} gets the status of CTRL-Break checking under \dos.
  346. When \var{BreakValue} is \var{false}, then \dos only checks for the
  347. CTRL-Break key-press when I/O is performed. When it is set to \var{True},
  348. then a check is done at every system call.}{Under Linux, this exists but is
  349. not implemented, i.e. the call does nothing.}{\seep{SetCBreak}}
  350. \procedurel{GetDate}{Dos:GetDate}{(var year, month, mday, wday: word)}{
  351. \var{GetDate} returns the system's date. \var{Year} is a number in the range
  352. 1980..2099.\var{mday} is the day of the month,
  353. \var{wday} is the day of the week, starting with Sunday as day 0.}
  354. {None.}{\seepl{GetTime}{Dos:GetTime},\seep{SetDate}}
  355. \latex{\inputlisting{dosex/ex2.pp}}
  356. \html{\input{dosex/ex2.tex}}
  357. \functionl{GetEnv}{Dos:GetEnv}{(EnvVar: String)}{String}{
  358. \var{Getenv} returns the value of the environment variable \var{EnvVar}.
  359. Under \linux, case is important when looking for \var{EnvVar}.
  360. When there is no environment variable \var{EnvVar} defined, an empty
  361. string is returned.}{None.}{\seef{EnvCount}, \seef{EnvStr}}
  362. \latex{\inputlisting{dosex/ex14.pp}}
  363. \html{\input{dosex/ex14.tex}}
  364. \procedure{GetFAttr}{(var F; var Attr: word)}{
  365. \var{GetFAttr} returns the file attributes of the file-variable \var{f}.
  366. \var{F} can be a untyped or typed file, or of type \var{Text}. \var{f} must
  367. have been assigned, but not opened. The attributes can be examined with the
  368. following constants :
  369. \begin{itemize}
  370. \item \var{ReadOnly = 01h}
  371. \item \var{Hidden = 02h}
  372. \item \var{SysFile = 04h}
  373. \item \var{VolumeId = 08h}
  374. \item \var{Directory = 10h}
  375. \item \var{Archive = 20h}
  376. \item \var{AnyFile = 3fh}
  377. \end{itemize}
  378. Under \linux, supported attributes are:
  379. \begin{itemize}
  380. \item \var{Directory}
  381. \item \var{ReadOnly} if the current process doesn't have access to the file.
  382. \item \var{Hidden} for files whose name starts with a dot \var{('.')}.
  383. \end{itemize}
  384. }{Errors are reported in \var{DosError}}{\seep{SetFAttr}}
  385. \latex{\inputlisting{dosex/ex8.pp}}
  386. \html{\input{dosex/ex8.tex}}
  387. \procedure{GetFTime}{(var F; var Time: longint)}{
  388. \var{GetFTime} returns the modification time of a file.
  389. This time is encoded and must be decoded with \var{UnPackTime}.
  390. \var{F} must be a file type, which has been assigned, and
  391. opened.}{Errors are reported in \var{DosError}}
  392. {\seep{SetFTime}, \seep{PackTime},\seep{UnPackTime}}
  393. \latex{\inputlisting{dosex/ex9.pp}}
  394. \html{\input{dosex/ex9.tex}}
  395. \procedure{GetIntVec}{(IntNo: byte; var Vector: pointer)}{
  396. \var{GetIntVec} returns the address of interrupt vector
  397. \var{IntNo}.}{None. Under \linux, this call exists bout isn't implemented,
  398. i.e. it does nothing.}{\seep{SetIntVec}}
  399. \procedurel{GetTime}{Dos:GetTime}{(var hour, minute, second, sec100: word)}{
  400. \var{GetTime} returns the system's time. \var{Hour} is a on a 24-hour time
  401. scale. \var{sec100} is in hundredth of a
  402. second.}{None.}{\seepl{GetDate}{Dos:GetDate},
  403. \seep{SetTime}}
  404. \latex{\inputlisting{dosex/ex3.pp}}
  405. \html{\input{dosex/ex3.tex}}
  406. \procedure{GetVerify}{(var verify: boolean)}{
  407. \var{GetVerify} returns the status of the verify flag under \dos. When
  408. \var{Verify} is \var{True}, then \dos checks data which are written to disk,
  409. by reading them after writing. If \var{Verify} is \var{False}, then data
  410. written to disk are not verified.}{Under \linux, Verify is always
  411. \var{True}.}{\seep{SetVerify}}
  412. \procedure{Intr}{(IntNo: byte; var Regs: registers)}{
  413. \var{Intr} executes a software interrupt number \var{IntNo} (must be between
  414. 0 and 255), with processor registers set to \var{Regs}. After the interrupt call
  415. returned, the processor registers are saved in \var{Regs}.}
  416. {Under \linux this call does nothing, because interrupts are managed by the
  417. kernel. The only allowed interrupt is 80h, the kernel entry interrupt.}
  418. {\seep{MSDos}, see the \linux unit.}
  419. \procedure{Keep}{(ExitCode: word)}{
  420. \var{Keep} terminates the program, but stays in memory. This is used for TSR
  421. (Terminate Stay Resident) programs which catch some interrupt.
  422. \var{ExitCode} is the same parameter as the \var{Halt} function takes.}
  423. {Under \linux, this call does nothing.}{\seem{Halt}{}}
  424. \procedure{MSDos}{(var regs: registers)}{
  425. \var{MSDos} executes an MS-\dos call (int 21h). This is the same as doing a
  426. \var{Intr} call with an interrupt number of 21h.}{None.}{\seep{Intr}}
  427. \procedure{PackTime}{(var T: datetime; var P: longint)}{
  428. \var{UnPackTime} converts the date and time specified in \var{T}
  429. to a packed-time format which can be fed to \var{SetFTime}.}
  430. {None.}
  431. {\seep{SetFTime}, \seep{FindFirst}, \seep{FindNext}, \seep{UnPackTime}}
  432. \latex{\inputlisting{dosex/ex4.pp}}
  433. \html{\input{dosex/ex4.tex}}
  434. \procedure{SetCBreak}{(breakvalue: boolean)}{
  435. \var{SetCBreak} sets the status of CTRL-Break checking under \dos.
  436. When \var{BreakValue} is \var{false}, then \dos only checks for the
  437. CTRL-Break key-press when I/O is performed. When it is set to \var{True},
  438. then a check is done at every system call.}{Under Linux, this call exists
  439. but is not implemented, i.e. it does nothing.}{\seep{GetCBreak}}
  440. \procedure{SetDate}{(year,month,day: word)}{
  441. \var{SetDate} sets the system's internal date. \var{Year} is a number
  442. between 1980 and 2099.}
  443. {On a \linux machine, this is not implemented (allthough a procedure
  444. exists, it just doesn't do anything. The setting of the date is a
  445. root-only privilege, and is hence not implemented.}{\seep{GetDate},
  446. \seep{SetTime}}
  447. \procedure{SetFAttr}{(var F; Attr: word)}{
  448. \var{SetFAttr} sets the file attributes of the file-variable \var{F}.
  449. \var{F} can be a untyped or typed file, or of type \var{Text}. \var{F} must
  450. have been assigned, but not opened. The attributes can be a sum of the
  451. following constants:
  452. \begin{itemize}
  453. \item \var{ReadOnly = 01h}
  454. \item \var{Hidden = 02h}
  455. \item \var{SysFile = 04h}
  456. \item \var{VolumeId = 08h}
  457. \item \var{Directory = 10h}
  458. \item \var{Archive = 20h}
  459. \item \var{AnyFile = 3fh}
  460. \end{itemize}
  461. }{Errors are reported in \var{DosError}.
  462. Under \linux the call exists, but is not implemented, i.e. it does nothing.}
  463. {\seep{GetFAttr}}
  464. \procedure{SetFTime}{(var F; Time: longint)}{
  465. \var{GetFTime} returns the modification time of a file,
  466. this time is encoded and must be encoded with \var{PackTime}.
  467. \var{F} must be a file type, which has been assigned, and
  468. opened.}{Errors are reported in \var{DosError}}
  469. {\seep{GetFTime}, \seep{PackTime},\seep{UnPackTime}}
  470. \procedure{SetIntVec}{(IntNo: byte; Vector: pointer)}{
  471. \var{SetIntVec} sets interrupt vector \var{IntNo} to \var{Vector}.
  472. \var{Vector} should point to an interrupt procedure.}{Under \linux, this
  473. call exists but is not implemented, the kernel manages all interrupts.}
  474. {\seep{GetIntVec}}
  475. \procedure{SetTime}{(hour,minute,second,sec100: word)}{
  476. \var{SetTime} sets the system's internal clock. The \var{Hour} parameter is
  477. on a 24-hour time scale.}{this call exists, but is not implemented on \linux,
  478. as setting the time is a root-only privilege.}
  479. {\seep{GetTime}, \seep{SetDate}}
  480. \procedure{SetVerify}{(verify: boolean)}{
  481. \var{SetVerify} sets the status of the verify flag under \dos. When
  482. \var{Verify} is \var{True}, then \dos checks data which are written to disk,
  483. by reading them after writing. If \var{Verify} is \var{False}, then data
  484. written to disk are not verified.}{Under \linux, Verify is always
  485. \var{True}.}{\seep{SetVerify}}
  486. \Procedure{SwapVectors}{
  487. \var{SwapVectors} swaps the contents of the internal table of interrupt
  488. vectors with the current contents of the interrupt vectors.
  489. This is called typically in before and after an \var{Exec} call.
  490. }{Under \linux this call does nothing, as the interrupt vectors are
  491. managed by the kernel.}{\seep{Exec}, \seep{SetIntVec}}
  492. \procedure{UnPackTime}{(p: longint; var T: datetime)}{
  493. \var{UnPackTime} converts the file-modification time in \var{p}
  494. to a \var{DateTime} record. The file-modification time can be
  495. returned by \var{GetFTime}, \var{FindFirst} or \var{FindNext} calls.}
  496. {None.}
  497. {\seep{GetFTime}, \seep{FindFirst}, \seep{FindNext}, \seep{PackTime}}
  498. For an example, see \seep{PackTime}.