dos.tex 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827
  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. \begin{procedure}{AddDisk}
  185. \Declaration
  186. Procedure AddDisk (Const S : String);
  187. \Description
  188. \var{AddDisk} adds a filename \var{S} to the internal list of disks. It is
  189. implemented for \linux only.
  190. This list is used to determine which disks to use in the \seef{DiskFree}
  191. and \seef{DiskSize} calls.
  192. The \seef{DiskFree} and \seef{DiskSize} functions need a file on the
  193. specified drive, since this is required for the \var{statfs} system call.
  194. The names are added sequentially. The dos
  195. initialization code presets the first three disks to:
  196. \begin{itemize}
  197. \item \var{'.'} for the current drive,
  198. \item \var{'/fd0/.'} for the first floppy-drive.
  199. \item \var{'/fd1/.'} for the second floppy-drive.
  200. \item \var{'/'} for the first hard disk.
  201. \end{itemize}
  202. The first call to \var{AddDisk} will therefore add a name for the second
  203. harddisk, The second call for the third drive, and so on until 23 drives
  204. have been added (corresponding to drives \var{'D:'} to \var{'Z:'})
  205. \Errors
  206. None
  207. \SeeAlso
  208. \seef{DiskFree}, \seef{DiskSize}
  209. \end{procedure}
  210. \begin{function}{DiskFree}
  211. \Declaration
  212. Function DiskFree (Drive: byte) : longint;
  213. \Description
  214. \var{DiskFree} returns the number of free bytes on a disk. The parameter
  215. \var{Drive} indicates which disk should be checked. This parameter is 1 for
  216. floppy \var{a:}, 2 for floppy \var{b:}, etc. A value of 0 returns the free
  217. space on the current drive.
  218. Typically, the free space is the size of a disk block, multiplied by the
  219. number of free blocks on the disk.
  220. \textbf{For \linux only:}\\
  221. The \var{diskfree} and \var{disksize} functions need a file on the
  222. specified drive, since this is required for the \var{statfs} system call.
  223. These filenames are set in the initialization of the dos unit, and have
  224. been preset to :
  225. \begin{itemize}
  226. \item \var{'.'} for the current drive,
  227. \item \var{'/fd0/.'} for the first floppy-drive.
  228. \item \var{'/fd1/.'} for the second floppy-drive.
  229. \item \var{'/'} for the first hard disk.
  230. \end{itemize}
  231. There is room for 1-26 drives. You can add a drive with the
  232. \seep{AddDisk} procedure.
  233. These settings can be coded in \var{dos.pp}, in the initialization part.
  234. \Errors
  235. -1 when a failure occurs, or an invalid \var{drivenr} is given.
  236. \SeeAlso
  237. \seef{DiskSize}, \seep{AddDisk}
  238. \end{function}
  239. \latex{\inputlisting{dosex/ex6.pp}}
  240. \html{\input{dosex/ex6.tex}}
  241. \begin{function}{DiskSize}
  242. \Declaration
  243. Function DiskSize (Drive: byte) : longint;
  244. \Description
  245. \var{DiskSize} returns the total size (in bytes) of a disk. The parameter
  246. \var{Drive} indicates which disk should be checked. This parameter is 1 for
  247. floppy \var{a:}, 2 for floppy \var{b:}, etc. A value of 0 returns the size
  248. of the current drive.
  249. \textbf{For \linux only:}\\
  250. The \var{diskfree} and \var{disksize} functions need a file on the specified drive, since this
  251. is required for the \var{statfs} system call.
  252. These filenames are set in the initialization of the dos unit, and have
  253. been preset to :
  254. \begin{itemize}
  255. \item \var{'.'} for the current drive,
  256. \item \var{'/fd0/.'} for the first floppy-drive.
  257. \item \var{'/fd1/.'} for the second floppy-drive.
  258. \item \var{'/'} for the first hard disk.
  259. \end{itemize}
  260. There is room for 1-26 drives. You can add a drive with the
  261. \seep{AddDisk} procedure.
  262. These settings can be coded in \var{dos.pp}, in the initialization part.
  263. \Errors
  264. -1 when a failure occurs, or an invalid drive number is given.
  265. \SeeAlso
  266. \seef{DiskFree}, \seep{AddDisk}
  267. \end{function}
  268. For an example, see \seef{DiskFree}.
  269. \begin{function}{DosExitCode}
  270. \Declaration
  271. Function DosExitCode : Word;
  272. \Description
  273. \var{DosExitCode} contains (in the low byte) the exit-code of a program
  274. executed with the \var{Exec} call.
  275. \Errors
  276. None.
  277. \SeeAlso
  278. \seep{Exec}
  279. \end{function}
  280. \latex{\inputlisting{dosex/ex5.pp}}
  281. \html{\input{dosex/ex5.tex}}
  282. \begin{function}{DosVersion}
  283. \Declaration
  284. Function DosVersion : Word;
  285. \Description
  286. \var{DosVersion} returns the \dos version number. On \linux systems, it
  287. returns the Linux version (The first 2 numbers, e.g Linux version 2.1.76 will
  288. give you DosVersion 2.1)
  289. \Errors
  290. None.
  291. \SeeAlso
  292. \end{function}
  293. \latex{\inputlisting{dosex/ex1.pp}}
  294. \html{\input{dosex/ex1.tex}}
  295. \begin{function}{EnvCount}
  296. \Declaration
  297. Function EnvCount : longint;
  298. \Description
  299. \var{EnvCount} returns the number of environment variables.
  300. \Errors
  301. None.
  302. \SeeAlso
  303. \seef{EnvStr}, \seef{GetEnv}
  304. \end{function}
  305. \begin{function}{EnvStr}
  306. \Declaration
  307. Function EnvStr (Index: integer) : string;
  308. \Description
  309. \var{EnvStr} returns the \var{Index}-th \var{Name=Value} pair from the list
  310. of environment variables.
  311. The index of the first pair is zero.
  312. \Errors
  313. The length is limited to 255 characters. This may cause problems under
  314. \linux. The \linux unit solves this problem.
  315. \SeeAlso
  316. \seef{EnvCount}, \seef{GetEnv}
  317. \end{function}
  318. \latex{\inputlisting{dosex/ex13.pp}}
  319. \html{\input{dosex/ex13.tex}}
  320. \begin{procedure}{Exec}
  321. \Declaration
  322. Procedure Exec (const Path: pathstr; const ComLine: comstr);
  323. \Description
  324. \var{Exec} executes the program in \var{Path}, with the options given by
  325. \var{ComLine}.
  326. After the program has terminated, the procedure returns. The Exit value of
  327. the program can be consulted with the \var{DosExitCode} function.
  328. \Errors
  329. Errors are reported in \var{DosError}.
  330. \SeeAlso
  331. \seef{DosExitCode}
  332. \end{procedure}
  333. For an example, see \seef{DosExitCode}
  334. \begin{functionl}{FExpand}{Dos:FExpand}
  335. \Declaration
  336. Function FExpand (const path: pathstr) : pathstr;
  337. \Description
  338. \var{FExpand} takes its argument and expands it to a complete filename, i.e.
  339. a filename starting from the root directory of the current drive, prepended
  340. with the drive-letter (under \dos).
  341. The resulting name is converted to uppercase on \dos systems. Under \linux,
  342. the name is left as it is. (filenames are case sensitive under Unix)
  343. \Errors
  344. \seep{FSplit}
  345. \SeeAlso
  346. \inputlisting{dosex/ex5.pp}
  347. \end{functionl}
  348. \html{\input{dosex/ex5.tex}}
  349. \begin{procedure}{FindClose}
  350. \Declaration
  351. Procedure FindClose (Var F: SearchRec);
  352. \Description
  353. \textbf{\linux only}
  354. Under \linux, the \var{findfirst/findnext} calls have to be mimicked.
  355. An internal table of file descriptors is kept.
  356. When using different \var{searchrecs} at the same time,
  357. the system may run out of file descriptors for directories.
  358. The \linux implementation of the \dos unit therefore keeps a table of open
  359. directories, and when the table is full, closes one of the directories, and
  360. reopens another. This system is adequate but slow if you use a lot of
  361. \var{searchrecs}.
  362. So, to speed up the findfirst/findnext system, the \var{FindClose} call was
  363. implemented. When you don't need a \var{searchrec} any more, you can tell
  364. this to the \dos unit by issuing a \var{FindClose} call. The directory
  365. which is kept open for this \var{searchrec} is then closed, and the table slot
  366. freed.
  367. It is recommended to use the \linux call \var{Glob} when looking for files.
  368. \Errors
  369. None.
  370. \SeeAlso
  371. \seef{Glob}.
  372. \end{procedure}
  373. \begin{procedure}{FindFirst}
  374. \Declaration
  375. Procedure FindFirst (const Path: pathstr; Attr: word; var F: SearchRec);
  376. \Description
  377. \var{FindFirst} searches the file specified in \var{Path}, checks the
  378. atrributes specified in \var{Attr}. It returns a \var{SearchRec} record for
  379. further searching in \var{F}.
  380. \var{Path} can contain the wildcard characters \var{?} (matches any single
  381. character) and \var{*} (matches 0 ore more arbitrary characters). In this
  382. case \var{FindFirst} will return the first file which matches the specified
  383. criteria.
  384. If \var{DosError} is different from zero, no file(s) matching the criteria
  385. was(were) found.
  386. \Errors
  387. Errors are reported in DosError.
  388. \SeeAlso
  389. \seep{FindNext},
  390. \seep{FindClose}
  391. \end{procedure}
  392. \latex{\inputlisting{dosex/ex7.pp}}
  393. \html{\input{dosex/ex7.tex}}
  394. \begin{procedure}{FindNext}
  395. \Declaration
  396. Procedure FindNext (var f: searchRec);
  397. \Description
  398. \var{FindNext} takes as an argument a \var{SearchRec} from a previous
  399. \var{FindNext} call, or a \var{FindFirst} call, and tries to find another
  400. file which matches the criteria, specified in the \var{FindFirst} call.
  401. If \var{DosError} is different from zero, no more files matching the
  402. criteria were found.
  403. \Errors
  404. \var{DosError} is used to report errors.
  405. \SeeAlso
  406. \seep{FindFirst}, \seep{FindClose}
  407. \end{procedure}
  408. For an example, see \seep{FindFirst}.
  409. \begin{functionl}{FSearch}{Dos:FSearch}
  410. \Declaration
  411. Function FSearch (Path: pathstr; DirList: string) : pathstr;
  412. \Description
  413. \var{FSearch} searches the file \var{Path} in all directories listed in
  414. \var{DirList}. The full name of the found file is returned.
  415. \var{DirList} must be a list of directories, separated by semi-colons (or
  416. colons under \linux).
  417. When no file is found, an empty string is returned.
  418. \Errors
  419. None.
  420. \SeeAlso
  421. \seefl{FExpand}{Dos:FExpand}
  422. \end{functionl}
  423. \latex{\inputlisting{dosex/ex10.pp}}
  424. \html{\input{dosex/ex10.tex}}
  425. \begin{procedure}{FSplit}
  426. \Declaration
  427. Procedure FSplit (path: pathstr; \\ var dir: dirstr; var name: namestr;
  428. var ext: extstr);
  429. \Description
  430. \var{FSplit} splits a full file name into 3 parts : A \var{Path}, a
  431. \var{Name} and an extension (in \var{ext}.)
  432. Under \linux, the extension is taken to be all letters after the last dot
  433. (.).
  434. \Errors
  435. None.
  436. \SeeAlso
  437. \seefl{FSearch}{Dos:FSearch}
  438. \end{procedure}
  439. \latex{\inputlisting{dosex/ex12.pp}}
  440. \html{\input{dosex/ex12.tex}}
  441. \begin{procedure}{GetCBreak}
  442. \Declaration
  443. Procedure GetCBreak (var breakvalue: boolean);
  444. \Description
  445. \var{GetCBreak} gets the status of CTRL-Break checking under \dos.
  446. When \var{BreakValue} is \var{false}, then \dos only checks for the
  447. CTRL-Break key-press when I/O is performed. When it is set to \var{True},
  448. then a check is done at every system call.
  449. \Errors
  450. Under Linux, this exists but is
  451. not implemented, i.e. the call does nothing.
  452. \SeeAlso
  453. \seep{SetCBreak}
  454. \end{procedure}
  455. \begin{procedurel}{GetDate}{Dos:GetDate}
  456. \Declaration
  457. Procedure GetDate (var year, month, mday, wday: word);
  458. \Description
  459. \var{GetDate} returns the system's date. \var{Year} is a number in the range
  460. 1980..2099.\var{mday} is the day of the month,
  461. \var{wday} is the day of the week, starting with Sunday as day 0.
  462. \Errors
  463. None.
  464. \SeeAlso
  465. \seepl{GetTime}{Dos:GetTime},\seep{SetDate}
  466. \end{procedurel}
  467. \latex{\inputlisting{dosex/ex2.pp}}
  468. \html{\input{dosex/ex2.tex}}
  469. \begin{functionl}{GetEnv}{Dos:GetEnv}
  470. \Declaration
  471. Function GetEnv (EnvVar: String) : String;
  472. \Description
  473. \var{Getenv} returns the value of the environment variable \var{EnvVar}.
  474. Under \linux, case is important when looking for \var{EnvVar}.
  475. When there is no environment variable \var{EnvVar} defined, an empty
  476. string is returned.
  477. \Errors
  478. None.
  479. \SeeAlso
  480. \seef{EnvCount}, \seef{EnvStr}
  481. \end{functionl}
  482. \latex{\inputlisting{dosex/ex14.pp}}
  483. \html{\input{dosex/ex14.tex}}
  484. \begin{procedure}{GetFAttr}
  485. \Declaration
  486. Procedure GetFAttr (var F; var Attr: word);
  487. \Description
  488. \var{GetFAttr} returns the file attributes of the file-variable \var{f}.
  489. \var{F} can be a untyped or typed file, or of type \var{Text}. \var{f} must
  490. have been assigned, but not opened. The attributes can be examined with the
  491. following constants :
  492. \begin{itemize}
  493. \item \var{ReadOnly = 01h}
  494. \item \var{Hidden = 02h}
  495. \item \var{SysFile = 04h}
  496. \item \var{VolumeId = 08h}
  497. \item \var{Directory = 10h}
  498. \item \var{Archive = 20h}
  499. \item \var{AnyFile = 3fh}
  500. \end{itemize}
  501. Under \linux, supported attributes are:
  502. \begin{itemize}
  503. \item \var{Directory}
  504. \item \var{ReadOnly} if the current process doesn't have access to the file.
  505. \item \var{Hidden} for files whose name starts with a dot \var{('.')}.
  506. \end{itemize}
  507. \Errors
  508. Errors are reported in \var{DosError}
  509. \SeeAlso
  510. \seep{SetFAttr}
  511. \end{procedure}
  512. \latex{\inputlisting{dosex/ex8.pp}}
  513. \html{\input{dosex/ex8.tex}}
  514. \begin{procedure}{GetFTime}
  515. \Declaration
  516. Procedure GetFTime (var F; var Time: longint);
  517. \Description
  518. \var{GetFTime} returns the modification time of a file.
  519. This time is encoded and must be decoded with \var{UnPackTime}.
  520. \var{F} must be a file type, which has been assigned, and
  521. opened.
  522. \Errors
  523. Errors are reported in \var{DosError}
  524. \SeeAlso
  525. \seep{SetFTime}, \seep{PackTime},\seep{UnPackTime}
  526. \end{procedure}
  527. \latex{\inputlisting{dosex/ex9.pp}}
  528. \html{\input{dosex/ex9.tex}}
  529. \begin{procedure}{GetIntVec}
  530. \Declaration
  531. Procedure GetIntVec (IntNo: byte; var Vector: pointer);
  532. \Description
  533. \var{GetIntVec} returns the address of interrupt vector
  534. \var{IntNo}.
  535. \Errors
  536. None. Under \linux, this call exists bout isn't implemented,
  537. i.e. it does nothing.
  538. \SeeAlso
  539. \seep{SetIntVec}
  540. \end{procedure}
  541. \begin{procedurel}{GetTime}{Dos:GetTime}
  542. \Declaration
  543. Procedure GetTime (var hour, minute, second, sec100: word);
  544. \Description
  545. \var{GetTime} returns the system's time. \var{Hour} is a on a 24-hour time
  546. scale. \var{sec100} is in hundredth of a
  547. second.
  548. \Errors
  549. None.
  550. \SeeAlso
  551. \seepl{GetDate}{Dos:GetDate},
  552. \seep{SetTime}
  553. \end{procedurel}
  554. \latex{\inputlisting{dosex/ex3.pp}}
  555. \html{\input{dosex/ex3.tex}}
  556. \begin{procedure}{GetVerify}
  557. \Declaration
  558. Procedure GetVerify (var verify: boolean);
  559. \Description
  560. \var{GetVerify} returns the status of the verify flag under \dos. When
  561. \var{Verify} is \var{True}, then \dos checks data which are written to disk,
  562. by reading them after writing. If \var{Verify} is \var{False}, then data
  563. written to disk are not verified.
  564. \Errors
  565. Under \linux, Verify is always
  566. \var{True}.
  567. \SeeAlso
  568. \seep{SetVerify}
  569. \end{procedure}
  570. \begin{procedure}{Intr}
  571. \Declaration
  572. Procedure Intr (IntNo: byte; var Regs: registers);
  573. \Description
  574. \var{Intr} executes a software interrupt number \var{IntNo} (must be between
  575. 0 and 255), with processor registers set to \var{Regs}. After the interrupt call
  576. returned, the processor registers are saved in \var{Regs}.
  577. \Errors
  578. Under \linux this call does nothing, because interrupts are managed by the
  579. kernel. The only allowed interrupt is 80h, the kernel entry interrupt.
  580. \SeeAlso
  581. \seep{MSDos}, see the \linux unit.
  582. \end{procedure}
  583. \begin{procedure}{Keep}
  584. \Declaration
  585. Procedure Keep (ExitCode: word);
  586. \Description
  587. \var{Keep} terminates the program, but stays in memory. This is used for TSR
  588. (Terminate Stay Resident) programs which catch some interrupt.
  589. \var{ExitCode} is the same parameter as the \var{Halt} function takes.
  590. \Errors
  591. Under \linux, this call does nothing.
  592. \SeeAlso
  593. \seem{Halt}{}
  594. \end{procedure}
  595. \begin{procedure}{MSDos}
  596. \Declaration
  597. Procedure MSDos (var regs: registers);
  598. \Description
  599. \var{MSDos} executes an MS-\dos call (int 21h). This is the same as doing a
  600. \var{Intr} call with an interrupt number of 21h.
  601. \Errors
  602. None.
  603. \SeeAlso
  604. \seep{Intr}
  605. \end{procedure}
  606. \begin{procedure}{PackTime}
  607. \Declaration
  608. Procedure PackTime (var T: datetime; var P: longint);
  609. \Description
  610. \var{UnPackTime} converts the date and time specified in \var{T}
  611. to a packed-time format which can be fed to \var{SetFTime}.
  612. \Errors
  613. None.
  614. \SeeAlso
  615. \seep{SetFTime}, \seep{FindFirst}, \seep{FindNext}, \seep{UnPackTime}
  616. \end{procedure}
  617. \latex{\inputlisting{dosex/ex4.pp}}
  618. \html{\input{dosex/ex4.tex}}
  619. \begin{procedure}{SetCBreak}
  620. \Declaration
  621. Procedure SetCBreak (breakvalue: boolean);
  622. \Description
  623. \var{SetCBreak} sets the status of CTRL-Break checking under \dos.
  624. When \var{BreakValue} is \var{false}, then \dos only checks for the
  625. CTRL-Break key-press when I/O is performed. When it is set to \var{True},
  626. then a check is done at every system call.
  627. \Errors
  628. Under Linux, this call exists
  629. but is not implemented, i.e. it does nothing.
  630. \SeeAlso
  631. \seep{GetCBreak}
  632. \end{procedure}
  633. \begin{procedure}{SetDate}
  634. \Declaration
  635. Procedure SetDate (year,month,day: word);
  636. \Description
  637. \var{SetDate} sets the system's internal date. \var{Year} is a number
  638. between 1980 and 2099.
  639. \Errors
  640. On a \linux machine, this is not implemented (allthough a procedure
  641. exists, it just doesn't do anything. The setting of the date is a
  642. root-only privilege, and is hence not implemented.
  643. \SeeAlso
  644. \seep{GetDate},
  645. \seep{SetTime}
  646. \end{procedure}
  647. \begin{procedure}{SetFAttr}
  648. \Declaration
  649. Procedure SetFAttr (var F; Attr: word);
  650. \Description
  651. \var{SetFAttr} sets the file attributes of the file-variable \var{F}.
  652. \var{F} can be a untyped or typed file, or of type \var{Text}. \var{F} must
  653. have been assigned, but not opened. The attributes can be a sum of the
  654. following constants:
  655. \begin{itemize}
  656. \item \var{ReadOnly = 01h}
  657. \item \var{Hidden = 02h}
  658. \item \var{SysFile = 04h}
  659. \item \var{VolumeId = 08h}
  660. \item \var{Directory = 10h}
  661. \item \var{Archive = 20h}
  662. \item \var{AnyFile = 3fh}
  663. \end{itemize}
  664. \Errors
  665. Errors are reported in \var{DosError}.
  666. Under \linux the call exists, but is not implemented, i.e. it does nothing.
  667. \SeeAlso
  668. \seep{GetFAttr}
  669. \end{procedure}
  670. \begin{procedure}{SetFTime}
  671. \Declaration
  672. Procedure SetFTime (var F; Time: longint);
  673. \Description
  674. \var{SetFTime} sets the modification time of a file,
  675. this time is encoded and must be encoded with \var{PackTime}.
  676. \var{F} must be a file type, which has been assigned, and
  677. opened.
  678. \Errors
  679. Errors are reported in \var{DosError}
  680. \SeeAlso
  681. \seep{GetFTime}, \seep{PackTime},\seep{UnPackTime}
  682. \end{procedure}
  683. \begin{procedure}{SetIntVec}
  684. \Declaration
  685. Procedure SetIntVec (IntNo: byte; Vector: pointer);
  686. \Description
  687. \var{SetIntVec} sets interrupt vector \var{IntNo} to \var{Vector}.
  688. \var{Vector} should point to an interrupt procedure.
  689. \Errors
  690. Under \linux, this
  691. call exists but is not implemented, the kernel manages all interrupts.
  692. \SeeAlso
  693. \seep{GetIntVec}
  694. \end{procedure}
  695. \begin{procedure}{SetTime}
  696. \Declaration
  697. Procedure SetTime (hour,minute,second,sec100: word);
  698. \Description
  699. \var{SetTime} sets the system's internal clock. The \var{Hour} parameter is
  700. on a 24-hour time scale.
  701. \Errors
  702. this call exists, but is not implemented on \linux,
  703. as setting the time is a root-only privilege.
  704. \SeeAlso
  705. \seep{GetTime}, \seep{SetDate}
  706. \end{procedure}
  707. \begin{procedure}{SetVerify}
  708. \Declaration
  709. Procedure SetVerify (verify: boolean);
  710. \Description
  711. \var{SetVerify} sets the status of the verify flag under \dos. When
  712. \var{Verify} is \var{True}, then \dos checks data which are written to disk,
  713. by reading them after writing. If \var{Verify} is \var{False}, then data
  714. written to disk are not verified.
  715. \Errors
  716. Under \linux, Verify is always
  717. \var{True}.
  718. \SeeAlso
  719. \seep{SetVerify}
  720. \end{procedure}
  721. \begin{procedure}{SwapVectors}
  722. \Declaration
  723. Procedure SwapVectors ;
  724. \Description
  725. \var{SwapVectors} swaps the contents of the internal table of interrupt
  726. vectors with the current contents of the interrupt vectors.
  727. This is called typically in before and after an \var{Exec} call.
  728. \Errors
  729. Under \linux this call does nothing, as the interrupt vectors are
  730. managed by the kernel.
  731. \SeeAlso
  732. \seep{Exec}, \seep{SetIntVec}
  733. \end{procedure}
  734. \begin{procedure}{UnPackTime}
  735. \Declaration
  736. Procedure UnPackTime (p: longint; var T: datetime);
  737. \Description
  738. \var{UnPackTime} converts the file-modification time in \var{p}
  739. to a \var{DateTime} record. The file-modification time can be
  740. returned by \var{GetFTime}, \var{FindFirst} or \var{FindNext} calls.
  741. \Errors
  742. None.
  743. \SeeAlso
  744. \seep{GetFTime}, \seep{FindFirst}, \seep{FindNext}, \seep{PackTime}
  745. \end{procedure}
  746. For an example, see \seep{PackTime}.