123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827 |
- %
- % $Id$
- % This file is part of the FPC documentation.
- % Copyright (C) 1997, by Michael Van Canneyt
- %
- % The FPC documentation is free text; you can redistribute it and/or
- % modify it under the terms of the GNU Library General Public License as
- % published by the Free Software Foundation; either version 2 of the
- % License, or (at your option) any later version.
- %
- % The FPC Documentation is distributed in the hope that it will be useful,
- % but WITHOUT ANY WARRANTY; without even the implied warranty of
- % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- % Library General Public License for more details.
- %
- % You should have received a copy of the GNU Library General Public
- % License along with the FPC documentation; see the file COPYING.LIB. If not,
- % write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- % Boston, MA 02111-1307, USA.
- %
- \chapter{The DOS unit.}
- This chapter describes the \var{DOS} unit for Free pascal, both under \dos
- and \linux. The unit was first written for \dos by Florian kl\"ampfl.
- The unit was ported to \linux by Mark May\footnote{Current
- e-mail address \textsf{[email protected]}}, and enhanced by Micha\"el Van
- Canneyt.
- Under \linux, some of the functionality is lost, as it is either impossible
- or meaningless to implement it. Other than that,
- the functionality for both operating systems is the same.
- This chapter is divided in two sections.
- \begin{itemize}
- \item The first section lists the pre-defined constants, types and variables.
- \item The second section describes the functions which appear in the
- interface part of the DOS unit.
- \end{itemize}
- \section{Types, Variables, Constants}
- \subsection {Constants}
- The DOS unit implements the following constants:
- \begin{verbatim}
- {Bitmasks for CPU Flags}
- fcarry = $0001;
- fparity = $0004;
- fauxiliary = $0010;
- fzero = $0040;
- fsign = $0080;
- foverflow = $0800;
- {Bitmasks for file attribute}
- readonly = $01;
- hidden = $02;
- sysfile = $04;
- volumeid = $08;
- directory = $10;
- archive = $20;
- anyfile = $3F;
- fmclosed = $D7B0;
- fminput = $D7B1;
- fmoutput = $D7B2;
- fminout = $D7B3;
- \end{verbatim}
- \subsection{Types}
- The following string types are defined for easy handling of
- filenames :
- \begin{verbatim}
- ComStr = String[127]; { For command-lines }
- PathStr = String[79]; { For full path for file names }
- DirStr = String[67]; { For Directory and (DOS) drive string }
- NameStr = String[8]; { For Name of file }
- ExtStr = String[4]; { For Extension of file }
- \end{verbatim}
- Under \linux, these strings all have length 255.
- \begin{verbatim}
- {$PACKRECORDS 1}
- SearchRec = Record
- Fill : array[1..21] of byte;
- { Fill replaced with declarations below, for Linux}
- Attr : Byte; {attribute of found file}
- Time : LongInt; {last modify date of found file}
- Size : LongInt; {file size of found file}
- Reserved : Word; {future use}
- Name : String[255]; {name of found file}
- SearchSpec: String[255]; {search pattern}
- NamePos: Word; {end of path, start of name position}
- End;
- \end{verbatim}
- Under \linux, the \var{Fill} array is replaced with the following:
- \begin{verbatim}
- SearchNum: LongInt; {to track which search this is}
- SearchPos: LongInt; {directory position}
- DirPtr: LongInt; {directory pointer for reading directory}
- SearchType: Byte; {0=normal, 1=open will close}
- SearchAttr: Byte; {attribute we are searching for}
- Fill: Array[1..07] of Byte; {future use}
- \end{verbatim}
- This is because the searching meachanism on Unix systems is substantially
- different from \dos's, and the calls have to be mimicked.
- \begin{verbatim}
- const
- filerecnamelength = 255;
- type
- FileRec = Packed Record
- Handle,
- Mode,
- RecSize : longint;
- _private : array[1..32] of byte;
- UserData : array[1..16] of byte;
- name : array[0..filerecnamelength] of char;
- End;
- \end{verbatim}
- \var{FileRec} is used for internal representation of typed and untyped files.
- Text files are handled by the following types :
- \begin{verbatim}
- const
- TextRecNameLength = 256;
- TextRecBufSize = 256;
- type
- TextBuf = array[0..TextRecBufSize-1] of char;
- TextRec = Packed Record
- Handle,
- Mode,
- bufsize,
- _private,
- bufpos,
- bufend : longint;
- bufptr : ^textbuf;
- openfunc,
- inoutfunc,
- flushfunc,
- closefunc : pointer;
- UserData : array[1..16] of byte;
- name : array[0..textrecnamelength-1] of char;
- buffer : textbuf;
- End;
- \end{verbatim}
- Remark that this is not binary compatible with the Turbo Pascal definition
- of \var{TextRec}, since the sizes of the different fields are different.
- \begin{verbatim}
- Registers = record
- case i : integer of
- 0 : (ax,f1,bx,f2,cx,f3,dx,f4,bp,f5,si,
- f51,di,f6,ds,f7,es,f8,flags,fs,gs : word);
- 1 : (al,ah,f9,f10,bl,bh,f11,f12,
- cl,ch,f13,f14,dl,dh : byte);
- 2 : (eax, ebx, ecx, edx, ebp, esi, edi : longint);
- End;
- \end{verbatim}
- The \var{registers} type is used in the \var{MSDos} call.
- \begin{verbatim}
- DateTime = record
- Year: Word;
- Month: Word;
- Day: Word;
- Hour: Word;
- Min: Word;
- Sec: word;
- End;
- \end{verbatim}
- The \var{DateTime} type is used in \seep{PackTime} and \seep{UnPackTime} for
- setting/reading file times with \seep{GetFTime} and \seep{SetFTime}.
- \subsection{Variables}
- \begin{verbatim}
- DosError : integer;
- \end{verbatim}
- The \var{DosError} variable is used by the procedures in the \dos unit to
- report errors. It can have the following values :
- \begin{center}
- \begin{tabular}{cl}
- 2 & File not found. \\
- 3 & path not found. \\
- 5 & Access denied. \\
- 6 & Invalid handle. \\
- 8 & Not enough memory. \\
- 10 & Invalid environment. \\
- 11 & Invalid format. \\
- 18 & No more files.
- \end{tabular}
- \end{center}
- Other values are possible, but are not documented.
- %\begin{verbatim}
- % drivestr : array [0..26] of pchar;
- %\end{verbatim}
- %This variable is defined in the \linux version of the \dos unit. It is used
- %in the \seef{DiskFree} and \seef{DiskSize} calls.
- \section{Functions and Procedures}
- \begin{procedure}{AddDisk}
- \Declaration
- Procedure AddDisk (Const S : String);
- \Description
- \var{AddDisk} adds a filename \var{S} to the internal list of disks. It is
- implemented for \linux only.
- This list is used to determine which disks to use in the \seef{DiskFree}
- and \seef{DiskSize} calls.
- The \seef{DiskFree} and \seef{DiskSize} functions need a file on the
- specified drive, since this is required for the \var{statfs} system call.
- The names are added sequentially. The dos
- initialization code presets the first three disks to:
- \begin{itemize}
- \item \var{'.'} for the current drive,
- \item \var{'/fd0/.'} for the first floppy-drive.
- \item \var{'/fd1/.'} for the second floppy-drive.
- \item \var{'/'} for the first hard disk.
- \end{itemize}
- The first call to \var{AddDisk} will therefore add a name for the second
- harddisk, The second call for the third drive, and so on until 23 drives
- have been added (corresponding to drives \var{'D:'} to \var{'Z:'})
- \Errors
- None
- \SeeAlso
- \seef{DiskFree}, \seef{DiskSize}
- \end{procedure}
- \begin{function}{DiskFree}
- \Declaration
- Function DiskFree (Drive: byte) : longint;
- \Description
- \var{DiskFree} returns the number of free bytes on a disk. The parameter
- \var{Drive} indicates which disk should be checked. This parameter is 1 for
- floppy \var{a:}, 2 for floppy \var{b:}, etc. A value of 0 returns the free
- space on the current drive.
- Typically, the free space is the size of a disk block, multiplied by the
- number of free blocks on the disk.
- \textbf{For \linux only:}\\
- The \var{diskfree} and \var{disksize} functions need a file on the
- specified drive, since this is required for the \var{statfs} system call.
- These filenames are set in the initialization of the dos unit, and have
- been preset to :
- \begin{itemize}
- \item \var{'.'} for the current drive,
- \item \var{'/fd0/.'} for the first floppy-drive.
- \item \var{'/fd1/.'} for the second floppy-drive.
- \item \var{'/'} for the first hard disk.
- \end{itemize}
- There is room for 1-26 drives. You can add a drive with the
- \seep{AddDisk} procedure.
- These settings can be coded in \var{dos.pp}, in the initialization part.
- \Errors
- -1 when a failure occurs, or an invalid \var{drivenr} is given.
- \SeeAlso
- \seef{DiskSize}, \seep{AddDisk}
- \end{function}
- \latex{\inputlisting{dosex/ex6.pp}}
- \html{\input{dosex/ex6.tex}}
- \begin{function}{DiskSize}
- \Declaration
- Function DiskSize (Drive: byte) : longint;
- \Description
- \var{DiskSize} returns the total size (in bytes) of a disk. The parameter
- \var{Drive} indicates which disk should be checked. This parameter is 1 for
- floppy \var{a:}, 2 for floppy \var{b:}, etc. A value of 0 returns the size
- of the current drive.
- \textbf{For \linux only:}\\
- The \var{diskfree} and \var{disksize} functions need a file on the specified drive, since this
- is required for the \var{statfs} system call.
- These filenames are set in the initialization of the dos unit, and have
- been preset to :
- \begin{itemize}
- \item \var{'.'} for the current drive,
- \item \var{'/fd0/.'} for the first floppy-drive.
- \item \var{'/fd1/.'} for the second floppy-drive.
- \item \var{'/'} for the first hard disk.
- \end{itemize}
- There is room for 1-26 drives. You can add a drive with the
- \seep{AddDisk} procedure.
- These settings can be coded in \var{dos.pp}, in the initialization part.
- \Errors
- -1 when a failure occurs, or an invalid drive number is given.
- \SeeAlso
- \seef{DiskFree}, \seep{AddDisk}
- \end{function}
- For an example, see \seef{DiskFree}.
- \begin{function}{DosExitCode}
- \Declaration
- Function DosExitCode : Word;
- \Description
- \var{DosExitCode} contains (in the low byte) the exit-code of a program
- executed with the \var{Exec} call.
- \Errors
- None.
- \SeeAlso
- \seep{Exec}
- \end{function}
- \latex{\inputlisting{dosex/ex5.pp}}
- \html{\input{dosex/ex5.tex}}
- \begin{function}{DosVersion}
- \Declaration
- Function DosVersion : Word;
- \Description
- \var{DosVersion} returns the \dos version number. On \linux systems, it
- returns the Linux version (The first 2 numbers, e.g Linux version 2.1.76 will
- give you DosVersion 2.1)
- \Errors
- None.
- \SeeAlso
- \end{function}
- \latex{\inputlisting{dosex/ex1.pp}}
- \html{\input{dosex/ex1.tex}}
- \begin{function}{EnvCount}
- \Declaration
- Function EnvCount : longint;
- \Description
- \var{EnvCount} returns the number of environment variables.
- \Errors
- None.
- \SeeAlso
- \seef{EnvStr}, \seef{GetEnv}
- \end{function}
- \begin{function}{EnvStr}
- \Declaration
- Function EnvStr (Index: integer) : string;
- \Description
- \var{EnvStr} returns the \var{Index}-th \var{Name=Value} pair from the list
- of environment variables.
- The index of the first pair is zero.
- \Errors
- The length is limited to 255 characters. This may cause problems under
- \linux. The \linux unit solves this problem.
- \SeeAlso
- \seef{EnvCount}, \seef{GetEnv}
- \end{function}
- \latex{\inputlisting{dosex/ex13.pp}}
- \html{\input{dosex/ex13.tex}}
- \begin{procedure}{Exec}
- \Declaration
- Procedure Exec (const Path: pathstr; const ComLine: comstr);
- \Description
- \var{Exec} executes the program in \var{Path}, with the options given by
- \var{ComLine}.
- After the program has terminated, the procedure returns. The Exit value of
- the program can be consulted with the \var{DosExitCode} function.
- \Errors
- Errors are reported in \var{DosError}.
- \SeeAlso
- \seef{DosExitCode}
- \end{procedure}
- For an example, see \seef{DosExitCode}
- \begin{functionl}{FExpand}{Dos:FExpand}
- \Declaration
- Function FExpand (const path: pathstr) : pathstr;
- \Description
- \var{FExpand} takes its argument and expands it to a complete filename, i.e.
- a filename starting from the root directory of the current drive, prepended
- with the drive-letter (under \dos).
- The resulting name is converted to uppercase on \dos systems. Under \linux,
- the name is left as it is. (filenames are case sensitive under Unix)
- \Errors
- \seep{FSplit}
- \SeeAlso
- \inputlisting{dosex/ex5.pp}
- \end{functionl}
- \html{\input{dosex/ex5.tex}}
- \begin{procedure}{FindClose}
- \Declaration
- Procedure FindClose (Var F: SearchRec);
- \Description
- \textbf{\linux only}
- Under \linux, the \var{findfirst/findnext} calls have to be mimicked.
- An internal table of file descriptors is kept.
- When using different \var{searchrecs} at the same time,
- the system may run out of file descriptors for directories.
- The \linux implementation of the \dos unit therefore keeps a table of open
- directories, and when the table is full, closes one of the directories, and
- reopens another. This system is adequate but slow if you use a lot of
- \var{searchrecs}.
- So, to speed up the findfirst/findnext system, the \var{FindClose} call was
- implemented. When you don't need a \var{searchrec} any more, you can tell
- this to the \dos unit by issuing a \var{FindClose} call. The directory
- which is kept open for this \var{searchrec} is then closed, and the table slot
- freed.
- It is recommended to use the \linux call \var{Glob} when looking for files.
- \Errors
- None.
- \SeeAlso
- \seef{Glob}.
- \end{procedure}
- \begin{procedure}{FindFirst}
- \Declaration
- Procedure FindFirst (const Path: pathstr; Attr: word; var F: SearchRec);
- \Description
- \var{FindFirst} searches the file specified in \var{Path}, checks the
- atrributes specified in \var{Attr}. It returns a \var{SearchRec} record for
- further searching in \var{F}.
- \var{Path} can contain the wildcard characters \var{?} (matches any single
- character) and \var{*} (matches 0 ore more arbitrary characters). In this
- case \var{FindFirst} will return the first file which matches the specified
- criteria.
- If \var{DosError} is different from zero, no file(s) matching the criteria
- was(were) found.
- \Errors
- Errors are reported in DosError.
- \SeeAlso
- \seep{FindNext},
- \seep{FindClose}
- \end{procedure}
- \latex{\inputlisting{dosex/ex7.pp}}
- \html{\input{dosex/ex7.tex}}
- \begin{procedure}{FindNext}
- \Declaration
- Procedure FindNext (var f: searchRec);
- \Description
- \var{FindNext} takes as an argument a \var{SearchRec} from a previous
- \var{FindNext} call, or a \var{FindFirst} call, and tries to find another
- file which matches the criteria, specified in the \var{FindFirst} call.
- If \var{DosError} is different from zero, no more files matching the
- criteria were found.
- \Errors
- \var{DosError} is used to report errors.
- \SeeAlso
- \seep{FindFirst}, \seep{FindClose}
- \end{procedure}
- For an example, see \seep{FindFirst}.
- \begin{functionl}{FSearch}{Dos:FSearch}
- \Declaration
- Function FSearch (Path: pathstr; DirList: string) : pathstr;
- \Description
- \var{FSearch} searches the file \var{Path} in all directories listed in
- \var{DirList}. The full name of the found file is returned.
- \var{DirList} must be a list of directories, separated by semi-colons (or
- colons under \linux).
- When no file is found, an empty string is returned.
- \Errors
- None.
- \SeeAlso
- \seefl{FExpand}{Dos:FExpand}
- \end{functionl}
- \latex{\inputlisting{dosex/ex10.pp}}
- \html{\input{dosex/ex10.tex}}
-
- \begin{procedure}{FSplit}
- \Declaration
- Procedure FSplit (path: pathstr; \\ var dir: dirstr; var name: namestr;
- var ext: extstr);
- \Description
- \var{FSplit} splits a full file name into 3 parts : A \var{Path}, a
- \var{Name} and an extension (in \var{ext}.)
- Under \linux, the extension is taken to be all letters after the last dot
- (.).
- \Errors
- None.
- \SeeAlso
- \seefl{FSearch}{Dos:FSearch}
- \end{procedure}
- \latex{\inputlisting{dosex/ex12.pp}}
- \html{\input{dosex/ex12.tex}}
- \begin{procedure}{GetCBreak}
- \Declaration
- Procedure GetCBreak (var breakvalue: boolean);
- \Description
- \var{GetCBreak} gets the status of CTRL-Break checking under \dos.
- When \var{BreakValue} is \var{false}, then \dos only checks for the
- CTRL-Break key-press when I/O is performed. When it is set to \var{True},
- then a check is done at every system call.
- \Errors
- Under Linux, this exists but is
- not implemented, i.e. the call does nothing.
- \SeeAlso
- \seep{SetCBreak}
- \end{procedure}
- \begin{procedurel}{GetDate}{Dos:GetDate}
- \Declaration
- Procedure GetDate (var year, month, mday, wday: word);
- \Description
- \var{GetDate} returns the system's date. \var{Year} is a number in the range
- 1980..2099.\var{mday} is the day of the month,
- \var{wday} is the day of the week, starting with Sunday as day 0.
- \Errors
- None.
- \SeeAlso
- \seepl{GetTime}{Dos:GetTime},\seep{SetDate}
- \end{procedurel}
- \latex{\inputlisting{dosex/ex2.pp}}
- \html{\input{dosex/ex2.tex}}
- \begin{functionl}{GetEnv}{Dos:GetEnv}
- \Declaration
- Function GetEnv (EnvVar: String) : String;
- \Description
- \var{Getenv} returns the value of the environment variable \var{EnvVar}.
- Under \linux, case is important when looking for \var{EnvVar}.
- When there is no environment variable \var{EnvVar} defined, an empty
- string is returned.
- \Errors
- None.
- \SeeAlso
- \seef{EnvCount}, \seef{EnvStr}
- \end{functionl}
- \latex{\inputlisting{dosex/ex14.pp}}
- \html{\input{dosex/ex14.tex}}
- \begin{procedure}{GetFAttr}
- \Declaration
- Procedure GetFAttr (var F; var Attr: word);
- \Description
- \var{GetFAttr} returns the file attributes of the file-variable \var{f}.
- \var{F} can be a untyped or typed file, or of type \var{Text}. \var{f} must
- have been assigned, but not opened. The attributes can be examined with the
- following constants :
- \begin{itemize}
- \item \var{ReadOnly = 01h}
- \item \var{Hidden = 02h}
- \item \var{SysFile = 04h}
- \item \var{VolumeId = 08h}
- \item \var{Directory = 10h}
- \item \var{Archive = 20h}
- \item \var{AnyFile = 3fh}
- \end{itemize}
- Under \linux, supported attributes are:
- \begin{itemize}
- \item \var{Directory}
- \item \var{ReadOnly} if the current process doesn't have access to the file.
- \item \var{Hidden} for files whose name starts with a dot \var{('.')}.
- \end{itemize}
- \Errors
- Errors are reported in \var{DosError}
- \SeeAlso
- \seep{SetFAttr}
- \end{procedure}
- \latex{\inputlisting{dosex/ex8.pp}}
- \html{\input{dosex/ex8.tex}}
- \begin{procedure}{GetFTime}
- \Declaration
- Procedure GetFTime (var F; var Time: longint);
- \Description
- \var{GetFTime} returns the modification time of a file.
- This time is encoded and must be decoded with \var{UnPackTime}.
- \var{F} must be a file type, which has been assigned, and
- opened.
- \Errors
- Errors are reported in \var{DosError}
- \SeeAlso
- \seep{SetFTime}, \seep{PackTime},\seep{UnPackTime}
- \end{procedure}
- \latex{\inputlisting{dosex/ex9.pp}}
- \html{\input{dosex/ex9.tex}}
- \begin{procedure}{GetIntVec}
- \Declaration
- Procedure GetIntVec (IntNo: byte; var Vector: pointer);
- \Description
- \var{GetIntVec} returns the address of interrupt vector
- \var{IntNo}.
- \Errors
- None. Under \linux, this call exists bout isn't implemented,
- i.e. it does nothing.
- \SeeAlso
- \seep{SetIntVec}
- \end{procedure}
- \begin{procedurel}{GetTime}{Dos:GetTime}
- \Declaration
- Procedure GetTime (var hour, minute, second, sec100: word);
- \Description
- \var{GetTime} returns the system's time. \var{Hour} is a on a 24-hour time
- scale. \var{sec100} is in hundredth of a
- second.
- \Errors
- None.
- \SeeAlso
- \seepl{GetDate}{Dos:GetDate},
- \seep{SetTime}
- \end{procedurel}
- \latex{\inputlisting{dosex/ex3.pp}}
- \html{\input{dosex/ex3.tex}}
- \begin{procedure}{GetVerify}
- \Declaration
- Procedure GetVerify (var verify: boolean);
- \Description
- \var{GetVerify} returns the status of the verify flag under \dos. When
- \var{Verify} is \var{True}, then \dos checks data which are written to disk,
- by reading them after writing. If \var{Verify} is \var{False}, then data
- written to disk are not verified.
- \Errors
- Under \linux, Verify is always
- \var{True}.
- \SeeAlso
- \seep{SetVerify}
- \end{procedure}
- \begin{procedure}{Intr}
- \Declaration
- Procedure Intr (IntNo: byte; var Regs: registers);
- \Description
- \var{Intr} executes a software interrupt number \var{IntNo} (must be between
- 0 and 255), with processor registers set to \var{Regs}. After the interrupt call
- returned, the processor registers are saved in \var{Regs}.
- \Errors
- Under \linux this call does nothing, because interrupts are managed by the
- kernel. The only allowed interrupt is 80h, the kernel entry interrupt.
- \SeeAlso
- \seep{MSDos}, see the \linux unit.
- \end{procedure}
- \begin{procedure}{Keep}
- \Declaration
- Procedure Keep (ExitCode: word);
- \Description
- \var{Keep} terminates the program, but stays in memory. This is used for TSR
- (Terminate Stay Resident) programs which catch some interrupt.
- \var{ExitCode} is the same parameter as the \var{Halt} function takes.
- \Errors
- Under \linux, this call does nothing.
- \SeeAlso
- \seem{Halt}{}
- \end{procedure}
- \begin{procedure}{MSDos}
- \Declaration
- Procedure MSDos (var regs: registers);
- \Description
- \var{MSDos} executes an MS-\dos call (int 21h). This is the same as doing a
- \var{Intr} call with an interrupt number of 21h.
- \Errors
- None.
- \SeeAlso
- \seep{Intr}
- \end{procedure}
- \begin{procedure}{PackTime}
- \Declaration
- Procedure PackTime (var T: datetime; var P: longint);
- \Description
- \var{UnPackTime} converts the date and time specified in \var{T}
- to a packed-time format which can be fed to \var{SetFTime}.
- \Errors
- None.
- \SeeAlso
- \seep{SetFTime}, \seep{FindFirst}, \seep{FindNext}, \seep{UnPackTime}
- \end{procedure}
- \latex{\inputlisting{dosex/ex4.pp}}
- \html{\input{dosex/ex4.tex}}
- \begin{procedure}{SetCBreak}
- \Declaration
- Procedure SetCBreak (breakvalue: boolean);
- \Description
- \var{SetCBreak} sets the status of CTRL-Break checking under \dos.
- When \var{BreakValue} is \var{false}, then \dos only checks for the
- CTRL-Break key-press when I/O is performed. When it is set to \var{True},
- then a check is done at every system call.
- \Errors
- Under Linux, this call exists
- but is not implemented, i.e. it does nothing.
- \SeeAlso
- \seep{GetCBreak}
- \end{procedure}
- \begin{procedure}{SetDate}
- \Declaration
- Procedure SetDate (year,month,day: word);
- \Description
- \var{SetDate} sets the system's internal date. \var{Year} is a number
- between 1980 and 2099.
- \Errors
- On a \linux machine, this is not implemented (allthough a procedure
- exists, it just doesn't do anything. The setting of the date is a
- root-only privilege, and is hence not implemented.
- \SeeAlso
- \seep{GetDate},
- \seep{SetTime}
- \end{procedure}
- \begin{procedure}{SetFAttr}
- \Declaration
- Procedure SetFAttr (var F; Attr: word);
- \Description
- \var{SetFAttr} sets the file attributes of the file-variable \var{F}.
- \var{F} can be a untyped or typed file, or of type \var{Text}. \var{F} must
- have been assigned, but not opened. The attributes can be a sum of the
- following constants:
- \begin{itemize}
- \item \var{ReadOnly = 01h}
- \item \var{Hidden = 02h}
- \item \var{SysFile = 04h}
- \item \var{VolumeId = 08h}
- \item \var{Directory = 10h}
- \item \var{Archive = 20h}
- \item \var{AnyFile = 3fh}
- \end{itemize}
- \Errors
- Errors are reported in \var{DosError}.
- Under \linux the call exists, but is not implemented, i.e. it does nothing.
- \SeeAlso
- \seep{GetFAttr}
- \end{procedure}
- \begin{procedure}{SetFTime}
- \Declaration
- Procedure SetFTime (var F; Time: longint);
- \Description
- \var{SetFTime} sets the modification time of a file,
- this time is encoded and must be encoded with \var{PackTime}.
- \var{F} must be a file type, which has been assigned, and
- opened.
- \Errors
- Errors are reported in \var{DosError}
- \SeeAlso
- \seep{GetFTime}, \seep{PackTime},\seep{UnPackTime}
- \end{procedure}
- \begin{procedure}{SetIntVec}
- \Declaration
- Procedure SetIntVec (IntNo: byte; Vector: pointer);
- \Description
- \var{SetIntVec} sets interrupt vector \var{IntNo} to \var{Vector}.
- \var{Vector} should point to an interrupt procedure.
- \Errors
- Under \linux, this
- call exists but is not implemented, the kernel manages all interrupts.
- \SeeAlso
- \seep{GetIntVec}
- \end{procedure}
- \begin{procedure}{SetTime}
- \Declaration
- Procedure SetTime (hour,minute,second,sec100: word);
- \Description
- \var{SetTime} sets the system's internal clock. The \var{Hour} parameter is
- on a 24-hour time scale.
- \Errors
- this call exists, but is not implemented on \linux,
- as setting the time is a root-only privilege.
- \SeeAlso
- \seep{GetTime}, \seep{SetDate}
- \end{procedure}
- \begin{procedure}{SetVerify}
- \Declaration
- Procedure SetVerify (verify: boolean);
- \Description
- \var{SetVerify} sets the status of the verify flag under \dos. When
- \var{Verify} is \var{True}, then \dos checks data which are written to disk,
- by reading them after writing. If \var{Verify} is \var{False}, then data
- written to disk are not verified.
- \Errors
- Under \linux, Verify is always
- \var{True}.
- \SeeAlso
- \seep{SetVerify}
- \end{procedure}
- \begin{procedure}{SwapVectors}
- \Declaration
- Procedure SwapVectors ;
- \Description
- \var{SwapVectors} swaps the contents of the internal table of interrupt
- vectors with the current contents of the interrupt vectors.
- This is called typically in before and after an \var{Exec} call.
- \Errors
- Under \linux this call does nothing, as the interrupt vectors are
- managed by the kernel.
- \SeeAlso
- \seep{Exec}, \seep{SetIntVec}
- \end{procedure}
- \begin{procedure}{UnPackTime}
- \Declaration
- Procedure UnPackTime (p: longint; var T: datetime);
- \Description
- \var{UnPackTime} converts the file-modification time in \var{p}
- to a \var{DateTime} record. The file-modification time can be
- returned by \var{GetFTime}, \var{FindFirst} or \var{FindNext} calls.
- \Errors
- None.
- \SeeAlso
- \seep{GetFTime}, \seep{FindFirst}, \seep{FindNext}, \seep{PackTime}
- \end{procedure}
- For an example, see \seep{PackTime}.
|