The following string types are defined for easy handling of filenames :
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 }
Under LINUX, these strings all have length 255.
{$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;
Under LINUX, the Fill array is replaced with the following:
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}
This is because the searching meachanism on Unix systems is substantially
different from DOS's, and the calls have to be mimicked.
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;
FileRec is used for internal representation of typed and untyped files.
Text files are handled by the following types :
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;
Remark that this is not binary compatible with the Turbo Pascal definition
of TextRec, since the sizes of the different fields are different.
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;
The registers type is used in the MSDos call.
DateTime = record
Year: Word;
Month: Word;
Day: Word;
Hour: Word;
Min: Word;
Sec: word;
End;
The DateTime type is used in PackTime and UnPackTime for
setting/reading file times with GetFTime and SetFTime.