diff --git a/rtl/amiga/dos.pp b/rtl/amiga/dos.pp index 78facb1811..d18d6364cd 100644 --- a/rtl/amiga/dos.pp +++ b/rtl/amiga/dos.pp @@ -33,53 +33,10 @@ Interface {$I os.inc} - Const - {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; - - {File Status} - fmclosed = $D7B0; - fminput = $D7B1; - fmoutput = $D7B2; - fminout = $D7B3; - - -Type - ComStr = String[255]; { size increased to be more compatible with Unix} - PathStr = String[255]; { size increased to be more compatible with Unix} - DirStr = String[255]; { size increased to be more compatible with Unix} - NameStr = String[255]; { size increased to be more compatible with Unix} - ExtStr = String[255]; { size increased to be more compatible with Unix} - - - -{ - filerec.inc contains the definition of the filerec. - textrec.inc contains the definition of the textrec. - It is in a separate file to make it available in other units without - having to use the DOS unit for it. -} -{$i filerec.inc} -{$i textrec.inc} - - -Type + FileNameLen = 255; +type SearchRec = Packed Record { watch out this is correctly aligned for all processors } { don't modify. } @@ -93,16 +50,6 @@ Type Name : String[255]; {name of found file} End; - - DateTime = packed record - Year: Word; - Month: Word; - Day: Word; - Hour: Word; - Min: Word; - Sec: word; - End; - registers = packed 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); @@ -110,59 +57,7 @@ Type 2 : (eax, ebx, ecx, edx, ebp, esi, edi : longint); end; - -Var - DosError : integer; - -{Interrupt} -Procedure Intr(intno: byte; var regs: registers); -Procedure MSDos(var regs: registers); - -{Info/Date/Time} -Function DosVersion: Word; -Procedure GetDate(var year, month, mday, wday: word); -Procedure GetTime(var hour, minute, second, sec100: word); -procedure SetDate(year,month,day: word); -Procedure SetTime(hour,minute,second,sec100: word); -Procedure UnpackTime(p: longint; var t: datetime); -Procedure PackTime(var t: datetime; var p: longint); - -{Exec} -Procedure Exec(const path: pathstr; const comline: comstr); -Function DosExitCode: word; - -{Disk} -Function DiskFree(drive: byte) : longint; -Function DiskSize(drive: byte) : longint; -Procedure FindFirst(path: pathstr; attr: word; var f: searchRec); -Procedure FindNext(var f: searchRec); -Procedure FindClose(Var f: SearchRec); - -{File} -Procedure GetFAttr(var f; var attr: word); -Procedure GetFTime(var f; var time: longint); -Function FSearch(path: pathstr; dirlist: string): pathstr; -Function FExpand(path: pathstr): pathstr; -Procedure FSplit(path: pathstr; var dir: dirstr; var name: namestr; var ext: extstr); - -{Environment} -Function EnvCount: longint; -Function EnvStr(index: integer): string; -Function GetEnv(envvar: string): string; - -{Misc} -Procedure SetFAttr(var f; attr: word); -Procedure SetFTime(var f; time: longint); -Procedure GetCBreak(var breakvalue: boolean); -Procedure SetCBreak(breakvalue: boolean); -Procedure GetVerify(var verify: boolean); -Procedure SetVerify(verify: boolean); - -{Do Nothing Functions} -Procedure SwapVectors; -Procedure GetIntVec(intno: byte; var vector: pointer); -Procedure SetIntVec(intno: byte; vector: pointer); -Procedure Keep(exitcode: word); +{$i dosh.inc} implementation @@ -1713,7 +1608,10 @@ End. { $Log$ - Revision 1.4 2002-09-07 16:01:16 peter + Revision 1.5 2004-02-09 12:03:16 michael + + Switched to single interface in dosh.inc + + Revision 1.4 2002/09/07 16:01:16 peter * old logs removed and tabs fixed } diff --git a/rtl/beos/dos.pp b/rtl/beos/dos.pp index fb727290fb..97892903f5 100644 --- a/rtl/beos/dos.pp +++ b/rtl/beos/dos.pp @@ -17,42 +17,13 @@ Unit Dos; Interface + {$goto on} Const - {Max FileName Length for files} FileNameLen=255; - {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; - - {File Status} - fmclosed = $D7B0; - fminput = $D7B1; - fmoutput = $D7B2; - fminout = $D7B3; - Type - ComStr = String[FileNameLen]; - PathStr = String[FileNameLen]; - DirStr = String[FileNameLen]; - NameStr = String[FileNameLen]; - ExtStr = String[FileNameLen]; - SearchRec = packed Record {Fill : array[1..21] of byte; Fill replaced with below} DirPtr : pointer; {directory pointer for reading directory} @@ -68,15 +39,6 @@ Type SearchDir : String[FileNameLen]; { path we are searching in } End; -{ - filerec.inc contains the definition of the filerec. - textrec.inc contains the definition of the textrec. - It is in a separate file to make it available in other units without - having to use the DOS unit for it. -} -{$i filerec.inc} -{$i textrec.inc} - Registers = packed 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); @@ -84,66 +46,9 @@ Type 2 : (eax, ebx, ecx, edx, ebp, esi, edi : longint); End; - DateTime = packed record - Year, - Month, - Day, - Hour, - Min, - Sec : word; - End; +{$i dosh.inc} -Var - DosError : integer; - - -{Info/Date/Time} -Function DosVersion: Word; -Procedure GetDate(var year, month, mday, wday: word); -Procedure GetTime(var hour, minute, second, sec100: word); -procedure SetDate(year,month,day: word); -Procedure SetTime(hour,minute,second,sec100: word); -Procedure UnpackTime(p: longint; var t: datetime); -Procedure PackTime(var t: datetime; var p: longint); - -{Exec} -Procedure Exec(const path: pathstr; const comline: comstr); -Function DosExitCode: word; - -{Disk} Procedure AddDisk(const path:string); -Function DiskFree(drive: byte) : int64; -Function DiskSize(drive: byte) : int64; -Procedure FindFirst(const path: pathstr; attr: word; var f: searchRec); -Procedure FindNext(var f: searchRec); -Procedure FindClose(Var f: SearchRec); - -{File} -Procedure GetFAttr(var f; var attr: word); -Procedure GetFTime(var f; var time: longint); -Function FSearch(const path: pathstr; dirlist: string): pathstr; -Function FExpand(const path: pathstr): pathstr; -Procedure FSplit(const path: pathstr; var dir: dirstr; var name: namestr; var ext: extstr); - -{Environment} -Function EnvCount: longint; -Function EnvStr(index: integer): string; -Function GetEnv (envvar: string): string; - -{Do Nothing Functions, no POSIX version} -Procedure Intr(intno: byte; var regs: registers); -Procedure MSDos(var regs: registers); -Procedure SwapVectors; -Procedure GetIntVec(intno: byte; var vector: pointer); -Procedure SetIntVec(intno: byte; vector: pointer); -Procedure Keep(exitcode: word); -Procedure SetFAttr(var f; attr: word); -Procedure SetFTime(var f; time: longint); -Procedure GetCBreak(var breakvalue: boolean); -Procedure SetCBreak(breakvalue: boolean); -Procedure GetVerify(var verify: boolean); -Procedure SetVerify(verify: boolean); - Implementation @@ -1060,7 +965,10 @@ finalization end. { $Log$ - Revision 1.5 2003-12-03 20:53:22 olle + Revision 1.6 2004-02-09 12:03:16 michael + + Switched to single interface in dosh.inc + + Revision 1.5 2003/12/03 20:53:22 olle * files are not pretended to have attr ARCHIVE anymore * files with attr READONLY and ARCHIVE are always returned by FindFirst etc * made code more conformant with unix/dos.pp diff --git a/rtl/emx/dos.pas b/rtl/emx/dos.pas index ce51b60064..5b1488d385 100644 --- a/rtl/emx/dos.pas +++ b/rtl/emx/dos.pas @@ -30,70 +30,38 @@ interface uses Strings, DosCalls; -const {Bit masks for CPU flags.} - fcarry = $0001; - fparity = $0004; - fauxiliary = $0010; - fzero = $0040; - fsign = $0080; - foverflow = $0800; +Const + FileNameLen = 255; + +Type + {Search record which is used by findfirst and findnext:} + searchrec=record + case boolean of + false: (handle:longint; {Used in os_OS2 mode} + FStat:PFileFindBuf3; + fill2:array[1..21-SizeOf(longint)-SizeOf(pointer)] of byte; + attr2:byte; + time2:longint; + size2:longint; + name2:string); {Filenames can be long in OS/2!} + true: (fill:array[1..21] of byte; + attr:byte; + time:longint; + size:longint; + name:string); {Filenames can be long in OS/2!} + end; - {Bit masks for file attributes.} - readonly = $01; - hidden = $02; - sysfile = $04; - volumeid = $08; - directory = $10; - archive = $20; - anyfile = $3F; - fmclosed = $D7B0; - fminput = $D7B1; - fmoutput = $D7B2; - fminout = $D7B3; + {Data structure for the registers needed by msdos and intr:} + registers=packed 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; -type {Some string types:} - comstr=string; {Filenames can be long in OS/2.} - pathstr=string; {String for pathnames.} - dirstr=string; {String for a directory} - namestr=string; {String for a filename.} - extstr=string[40]; {String for an extension. Can be 253 - characters long, in theory, but let's - say fourty will be enough.} - - {Search record which is used by findfirst and findnext:} - searchrec=record - case boolean of - false: (handle:longint; {Used in os_OS2 mode} - FStat:PFileFindBuf3; - fill2:array[1..21-SizeOf(longint)-SizeOf(pointer)] of byte; - attr2:byte; - time2:longint; - size2:longint; - name2:string); {Filenames can be long in OS/2!} - true: (fill:array[1..21] of byte; - attr:byte; - time:longint; - size:longint; - name:string); {Filenames can be long in OS/2!} - end; - -{$i filerec.inc} -{$i textrec.inc} - - {Data structure for the registers needed by msdos and intr:} - registers=packed 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; - - {Record for date and time:} - datetime=record - year,month,day,hour,min,sec:word; - end; +{$i dosh.inc} {Flags for the exec procedure: @@ -128,67 +96,23 @@ const (* For compatibility with VP/2, used for runflags in Exec procedure. *) ExecFlags: cardinal = ord (efwait); -var doserror:integer; - dosexitcode:word; - -procedure getdate(var year,month,day,dayofweek:word); -procedure gettime(var hour,minute,second,sec100:word); -function dosversion:word; -procedure setdate(year,month,day:word); -procedure settime(hour,minute,second,sec100:word); -procedure getcbreak(var breakvalue:boolean); -procedure setcbreak(breakvalue:boolean); -procedure getverify(var verify:boolean); -procedure setverify(verify : boolean); - -function DiskFree (Drive: byte) : int64; -function DiskSize (Drive: byte) : int64; - -procedure findfirst(const path:pathstr;attr:word;var f:searchRec); -procedure findnext(var f:searchRec); -procedure findclose(var f:searchRec); - -{Is a dummy:} -procedure swapvectors; - -{Not supported: -procedure getintvec(intno:byte;var vector:pointer); -procedure setintvec(intno:byte;vector:pointer); -procedure keep(exitcode:word); -} -procedure msdos(var regs:registers); -procedure intr(intno : byte;var regs:registers); - -procedure getfattr(var f;var attr:word); -procedure setfattr(var f;attr:word); - -function fsearch(path:pathstr;dirlist:string):pathstr; -procedure getftime(var f;var time:longint); -procedure setftime(var f;time:longint); -procedure packtime (var d:datetime; var time:longint); -procedure unpacktime (time:longint; var d:datetime); -function fexpand(const path:pathstr):pathstr; -procedure fsplit(path:pathstr;var dir:dirstr;var name:namestr; - var ext:extstr); -procedure exec(const path:pathstr;const comline:comstr); -function exec(path:pathstr;runflags:execrunflags;winflags:execwinflags; - const comline:comstr):longint; -function envcount:longint; -function envstr(index:longint) : string; -function GetEnvPChar (EnvVar: string): PChar; -function getenv(const envvar:string): string; +var + dosexitcode:word; implementation -var LastSR: SearchRec; - EnvC: longint; external name '_envc'; - EnvP: ppchar; external name '_environ'; +var + LastSR: SearchRec; + EnvC: longint; external name '_envc'; + EnvP: ppchar; external name '_environ'; -type TBA = array [1..SizeOf (SearchRec)] of byte; - PBA = ^TBA; +type + TBA = array [1..SizeOf (SearchRec)] of byte; + PBA = ^TBA; -const FindResvdMask = $00003737; {Allowed bits in attribute - specification for DosFindFirst call.} +const + FindResvdMask = $00003737; {Allowed bits in attribute + specification for DosFindFirst call.} {Import syscall to call it nicely from assembler procedures.} @@ -1248,7 +1172,10 @@ begin end. { $Log$ - Revision 1.8 2003-12-26 22:20:44 hajny + Revision 1.9 2004-02-09 12:03:16 michael + + Switched to single interface in dosh.inc + + Revision 1.8 2003/12/26 22:20:44 hajny * regcall fixes Revision 1.7 2003/10/25 22:45:37 hajny diff --git a/rtl/go32v2/dos.pp b/rtl/go32v2/dos.pp index e5e797cbab..a9d0a8a403 100644 --- a/rtl/go32v2/dos.pp +++ b/rtl/go32v2/dos.pp @@ -14,63 +14,16 @@ **********************************************************************} unit dos; + interface Uses Go32; - Const - {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; - - {File Status} - fmclosed = $D7B0; - fminput = $D7B1; - fmoutput = $D7B2; - fminout = $D7B3; - + FileNameLen = 255; Type -{ Needed for LFN Support } - ComStr = String[255]; - PathStr = String[255]; - DirStr = String[255]; - NameStr = String[255]; - ExtStr = String[255]; - -{ - filerec.inc contains the definition of the filerec. - textrec.inc contains the definition of the textrec. - It is in a separate file to make it available in other units without - having to use the DOS unit for it. -} -{$i filerec.inc} -{$i textrec.inc} - - DateTime = packed record - Year, - Month, - Day, - Hour, - Min, - Sec : word; - End; - searchrec = packed record fill : array[1..21] of byte; attr : byte; @@ -82,61 +35,7 @@ Type Registers = Go32.Registers; -Var - DosError : integer; - -{Interrupt} -Procedure Intr(intno: byte; var regs: registers); -Procedure MSDos(var regs: registers); - -{Info/Date/Time} -Function DosVersion: Word; -Procedure GetDate(var year, month, mday, wday: word); -Procedure GetTime(var hour, minute, second, sec100: word); -procedure SetDate(year,month,day: word); -Procedure SetTime(hour,minute,second,sec100: word); -Procedure UnpackTime(p: longint; var t: datetime); -Procedure PackTime(var t: datetime; var p: longint); - -{Exec} -Procedure Exec(const path: pathstr; const comline: comstr); -Function DosExitCode: word; - -{Disk} -Function DiskFree(drive: byte) : int64; -Function DiskSize(drive: byte) : int64; -Procedure FindFirst(const path: pathstr; attr: word; var f: searchRec); -Procedure FindNext(var f: searchRec); -Procedure FindClose(Var f: SearchRec); - -{File} -Procedure GetFAttr(var f; var attr: word); -Procedure GetFTime(var f; var time: longint); -Function FSearch(path: pathstr; dirlist: string): pathstr; -Function FExpand(const path: pathstr): pathstr; -Procedure FSplit(path: pathstr; var dir: dirstr; var name: namestr; var ext: extstr); -function GetShortName(var p : String) : boolean; -function GetLongName(var p : String) : boolean; - -{Environment} -Function EnvCount: longint; -Function EnvStr(index: integer): string; -Function GetEnv(envvar: string): string; - -{Misc} -Procedure SetFAttr(var f; attr: word); -Procedure SetFTime(var f; time: longint); -Procedure GetCBreak(var breakvalue: boolean); -Procedure SetCBreak(breakvalue: boolean); -Procedure GetVerify(var verify: boolean); -Procedure SetVerify(verify: boolean); - -{Do Nothing Functions} -Procedure SwapVectors; -Procedure GetIntVec(intno: byte; var vector: pointer); -Procedure SetIntVec(intno: byte; vector: pointer); -Procedure Keep(exitcode: word); - +{$i dosh.inc} implementation @@ -1047,7 +946,10 @@ End; end. { $Log$ - Revision 1.17 2004-01-06 00:58:35 florian + Revision 1.18 2004-02-09 12:03:16 michael + + Switched to single interface in dosh.inc + + Revision 1.17 2004/01/06 00:58:35 florian * fixed fsearch Revision 1.16 2003/10/03 21:46:25 peter diff --git a/rtl/inc/dosh.inc b/rtl/inc/dosh.inc new file mode 100644 index 0000000000..0fda4f3fbe --- /dev/null +++ b/rtl/inc/dosh.inc @@ -0,0 +1,121 @@ +{ + $Id$ + This file is part of the Free Pascal run time library. + Copyright (c) 1999-2000 by the Free Pascal development team. + + Dos unit for BP7 compatible RTL - Interface declarations + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program 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. + + **********************************************************************} + +Const + {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; + + {File Status} + fmclosed = $D7B0; + fminput = $D7B1; + fmoutput = $D7B2; + fminout = $D7B3; + + +Type +{ Needed for LFN Support } + ComStr = String[FileNameLen]; + PathStr = String[FileNameLen]; + DirStr = String[FileNameLen]; + NameStr = String[FileNameLen]; + ExtStr = String[FileNameLen]; + +{ + filerec.inc contains the definition of the filerec. + textrec.inc contains the definition of the textrec. + It is in a separate file to make it available in other units without + having to use the DOS unit for it. +} +{$i filerec.inc} +{$i textrec.inc} + + DateTime = packed record + Year, + Month, + Day, + Hour, + Min, + Sec : word; + End; + +Var + DosError : integer; + +{Interrupt} +Procedure Intr(intno: byte; var regs: registers); +Procedure MSDos(var regs: registers); + +{Info/Date/Time} +Function DosVersion: Word; +Procedure GetDate(var year, month, mday, wday: word); +Procedure GetTime(var hour, minute, second, sec100: word); +procedure SetDate(year,month,day: word); +Procedure SetTime(hour,minute,second,sec100: word); +Procedure UnpackTime(p: longint; var t: datetime); +Procedure PackTime(var t: datetime; var p: longint); + +{Exec} +Procedure Exec(const path: pathstr; const comline: comstr); +Function DosExitCode: word; + +{Disk} +Function DiskFree(drive: byte) : int64; +Function DiskSize(drive: byte) : int64; +Procedure FindFirst(const path: pathstr; attr: word; var f: searchRec); +Procedure FindNext(var f: searchRec); +Procedure FindClose(Var f: SearchRec); + +{File} +Procedure GetFAttr(var f; var attr: word); +Procedure GetFTime(var f; var time: longint); +Function FSearch(path: pathstr; dirlist: string): pathstr; +Function FExpand(const path: pathstr): pathstr; +Procedure FSplit(path: pathstr; var dir: dirstr; var name: namestr; var ext: extstr); +function GetShortName(var p : String) : boolean; +function GetLongName(var p : String) : boolean; + +{Environment} +Function EnvCount: longint; +Function EnvStr(index: integer): string; +Function GetEnv(envvar: string): string; + +{Misc} +Procedure SetFAttr(var f; attr: word); +Procedure SetFTime(var f; time: longint); +Procedure GetCBreak(var breakvalue: boolean); +Procedure SetCBreak(breakvalue: boolean); +Procedure GetVerify(var verify: boolean); +Procedure SetVerify(verify: boolean); + +{Do Nothing Functions} +Procedure SwapVectors; +Procedure GetIntVec(intno: byte; var vector: pointer); +Procedure SetIntVec(intno: byte; vector: pointer); +Procedure Keep(exitcode: word); diff --git a/rtl/netware/dos.pp b/rtl/netware/dos.pp index 6475389549..5c3f82fb95 100644 --- a/rtl/netware/dos.pp +++ b/rtl/netware/dos.pp @@ -25,59 +25,10 @@ unit dos; interface -Const - {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; - nwexeconly= $08; - directory = $10; - archive = $20; - sharable = $80; - anyfile = $3F; - - {File Status} - fmclosed = $D7B0; - fminput = $D7B1; - fmoutput = $D7B2; - fminout = $D7B3; - +Const + FileNameLen = 255; Type -{ Needed for LFN Support } - ComStr = String[255]; - PathStr = String[255]; - DirStr = String[255]; - NameStr = String[255]; - ExtStr = String[255]; - -{ - filerec.inc contains the definition of the filerec. - textrec.inc contains the definition of the textrec. - It is in a separate file to make it available in other units without - having to use the DOS unit for it. -} -{$i filerec.inc} -{$i textrec.inc} - - DateTime = packed record - Year, - Month, - Day, - Hour, - Min, - Sec : word; - End; - searchrec = packed record DirP : POINTER; { used for opendir } EntryP: POINTER; { and readdir } @@ -97,70 +48,7 @@ Type 2 : (eax, ebx, ecx, edx, ebp, esi, edi : longint); end; - -Var - DosError : integer; - - - -{Info/Date/Time} -Function DosVersion: Word; {ok} -Procedure GetDate(var year, month, mday, wday: word); {ok} -Procedure GetTime(var hour, minute, second, sec100: word); {ok} -procedure SetDate(year,month,day: word); {ok} -Procedure SetTime(hour,minute,second,sec100: word); {ok} -Procedure UnpackTime(p: longint; var t: datetime); {ok} -Procedure PackTime(var t: datetime; var p: longint); {ok} - -{Exec} -Procedure Exec(const path: pathstr; const comline: comstr); {ni} -Function DosExitCode: word; {ni} - -{Disk} -{$ifdef Int64} - Function DiskFree(drive: byte) : int64; {ok} - Function DiskSize(drive: byte) : int64; {ok} -{$else} - Function DiskFree(drive: byte) : longint; {ok} - Function DiskSize(drive: byte) : longint; {ok} -{$endif} - -{FincClose has to be called to avoid memory leaks} -Procedure FindFirst(const path: pathstr; attr: word; {ok} - var f: searchRec); -Procedure FindNext(var f: searchRec); {ok} -Procedure FindClose(Var f: SearchRec); {ok} - -{File} -Procedure GetFAttr(var f; var attr: word); {ok} -Procedure GetFTime(var f; var time: longint); {ok} -Function FSearch(path: pathstr; dirlist: string): pathstr; {ok} -Function FExpand(const path: pathstr): pathstr; {ok} -Procedure FSplit(path: pathstr; var dir: dirstr; var name: {untested} - namestr; var ext: extstr); - -{Environment} -Function EnvCount: longint; {ni} -Function EnvStr(index: integer): string; {ni} -Function GetEnv(envvar: string): string; {ok} - -{Misc} -Procedure SetFAttr(var f; attr: word); {ni} -Procedure SetFTime(var f; time: longint); {ni} -Procedure GetCBreak(var breakvalue: boolean); {ni} -Procedure SetCBreak(breakvalue: boolean); {ni} -Procedure GetVerify(var verify: boolean); {ni} -Procedure SetVerify(verify: boolean); {ni} - -{Do Nothing Functions} -Procedure SwapVectors; {ni} -Procedure GetIntVec(intno: byte; var vector: pointer); {ni} -Procedure SetIntVec(intno: byte; vector: pointer); {ni} -Procedure Keep(exitcode: word); {ni} - -Procedure Intr(intno: byte; var regs: registers); {ni} -Procedure MSDos(var regs: registers); {ni} - +{$i dosh.inc} implementation @@ -858,7 +746,10 @@ end; end. { $Log$ - Revision 1.6 2003-03-25 18:17:54 armin + Revision 1.7 2004-02-09 12:03:16 michael + + Switched to single interface in dosh.inc + + Revision 1.6 2003/03/25 18:17:54 armin * support for fcl, support for linking without debug info * renamed winsock2 to winsock for win32 compatinility * new sockets unit for netware diff --git a/rtl/os2/dos.pas b/rtl/os2/dos.pas index f719a617ae..c4443cc865 100644 --- a/rtl/os2/dos.pas +++ b/rtl/os2/dos.pas @@ -30,39 +30,12 @@ interface uses Strings, DosCalls; -const {Bit masks for CPU flags.} - fcarry = $0001; - fparity = $0004; - fauxiliary = $0010; - fzero = $0040; - fsign = $0080; - foverflow = $0800; +const + FileNameLen = 255; - {Bit masks for file attributes.} - readonly = $01; - hidden = $02; - sysfile = $04; - volumeid = $08; - directory = $10; - archive = $20; - anyfile = $3F; - - fmclosed = $D7B0; - fminput = $D7B1; - fmoutput = $D7B2; - fminout = $D7B3; - -type {Some string types:} - comstr=string; {Filenames can be long in OS/2.} - pathstr=string; {String for pathnames.} - dirstr=string; {String for a directory} - namestr=string; {String for a filename.} - extstr=string[40]; {String for an extension. Can be 253 - characters long, in theory, but let's - say fourty will be enough.} - - {Search record which is used by findfirst and findnext:} - searchrec=record +Type + {Search record which is used by findfirst and findnext:} + searchrec=record case boolean of false: (handle:longint; {Used in os_OS2 mode} FStat:PFileFindBuf3; @@ -78,9 +51,6 @@ type {Some string types:} name:string); {Filenames can be long in OS/2!} end; -{$i filerec.inc} -{$i textrec.inc} - {Data structure for the registers needed by msdos and intr:} registers=packed record case i:integer of @@ -90,11 +60,6 @@ type {Some string types:} 2:(eax,ebx,ecx,edx,ebp,esi,edi:longint); end; - {Record for date and time:} - datetime=record - year,month,day,hour,min,sec:word; - end; - {Flags for the exec procedure: Starting the program: @@ -128,56 +93,9 @@ const (* For compatibility with VP/2, used for runflags in Exec procedure. *) ExecFlags: cardinal = ord (efwait); -var doserror:integer; +var dosexitcode:word; -procedure getdate(var year,month,day,dayofweek:word); -procedure gettime(var hour,minute,second,sec100:word); -function dosversion:word; -procedure setdate(year,month,day:word); -procedure settime(hour,minute,second,sec100:word); -procedure getcbreak(var breakvalue:boolean); -procedure setcbreak(breakvalue:boolean); -procedure getverify(var verify:boolean); -procedure setverify(verify : boolean); - -function DiskFree (Drive: byte) : int64; -function DiskSize (Drive: byte) : int64; - -procedure findfirst(const path:pathstr;attr:word;var f:searchRec); -procedure findnext(var f:searchRec); -procedure findclose(var f:searchRec); - -{Is a dummy:} -procedure swapvectors; - -{Not supported: -procedure getintvec(intno:byte;var vector:pointer); -procedure setintvec(intno:byte;vector:pointer); -procedure keep(exitcode:word); -procedure msdos(var regs:registers); -procedure intr(intno : byte;var regs:registers); -} - -procedure getfattr(var f;var attr:word); -procedure setfattr(var f;attr:word); - -function fsearch(path:pathstr;dirlist:string):pathstr; -procedure getftime(var f;var time:longint); -procedure setftime(var f;time:longint); -procedure packtime (var d:datetime; var time:longint); -procedure unpacktime (time:longint; var d:datetime); -function fexpand(const path:pathstr):pathstr; -procedure fsplit(path:pathstr;var dir:dirstr;var name:namestr; - var ext:extstr); -procedure exec(const path:pathstr;const comline:comstr); -function exec(path:pathstr;runflags:execrunflags;winflags:execwinflags; - const comline:comstr):longint; -function envcount:longint; -function envstr(index:longint) : string; -function GetEnvPChar (EnvVar: string): PChar; -function getenv(const envvar:string): string; - implementation var LastSR: SearchRec; @@ -704,7 +622,10 @@ end; end. { $Log$ - Revision 1.33 2003-11-05 09:13:59 yuri + Revision 1.34 2004-02-09 12:03:16 michael + + Switched to single interface in dosh.inc + + Revision 1.33 2003/11/05 09:13:59 yuri * exec fix * unused units removed diff --git a/rtl/unix/dos.pp b/rtl/unix/dos.pp index 68b34cb6e5..3a1c9db89b 100644 --- a/rtl/unix/dos.pp +++ b/rtl/unix/dos.pp @@ -19,35 +19,6 @@ Const {Max FileName Length for files} FileNameLen=255; - {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; - - {File Status} - fmclosed = $D7B0; - fminput = $D7B1; - fmoutput = $D7B2; - fminout = $D7B3; - - -Type - ComStr = String[FileNameLen]; - PathStr = String[FileNameLen]; - DirStr = String[FileNameLen]; - NameStr = String[FileNameLen]; ExtStr = String[FileNameLen]; SearchRec = @@ -72,14 +43,6 @@ Type NamePos : Word; {end of path, start of name position} End; -{ - filerec.inc contains the definition of the filerec. - textrec.inc contains the definition of the textrec. - It is in a separate file to make it available in other units without - having to use the DOS unit for it. -} -{$i filerec.inc} -{$i textrec.inc} {$ifdef cpui386} Registers = packed record @@ -90,74 +53,15 @@ Type End; {$endif cpui386} - DateTime = packed record - Year, - Month, - Day, - Hour, - Min, - Sec : word; - End; +{$i dosh.inc} -Var - DosError : integer; - -{Utils} +{Extra Utils} function weekday(y,m,d : longint) : longint; Procedure UnixDateToDt(SecsPast: LongInt; Var Dt: DateTime); Function DTToUnixDate(DT: DateTime): LongInt; -{Info/Date/Time} -Function DosVersion: Word; -Procedure GetDate(var year, month, mday, wday: word); -Procedure GetTime(var hour, minute, second, sec100: word); -procedure SetDate(year,month,day: word); -Procedure SetTime(hour,minute,second,sec100: word); -Procedure UnpackTime(p: longint; var t: datetime); -Procedure PackTime(var t: datetime; var p: longint); - -{Exec} -Procedure Exec(const path: pathstr; const comline: comstr); -Function DosExitCode: word; - {Disk} Procedure AddDisk(const path:string); -Function DiskFree(drive: byte) : int64; -Function DiskSize(drive: byte) : int64; -Procedure FindFirst(const path: pathstr; attr: word; var f: searchRec); -Procedure FindNext(var f: searchRec); -Procedure FindClose(Var f: SearchRec); - -{File} -Procedure GetFAttr(var f; var attr: word); -Procedure GetFTime(var f; var time: longint); -Function FSearch(path: pathstr; dirlist: string): pathstr; -Function FExpand(const path: pathstr): pathstr; -Procedure FSplit(path: pathstr; var dir: dirstr; var name: namestr; var ext: extstr); - -{Environment} -Function EnvCount: longint; -Function EnvStr(index: integer): string; -Function GetEnv (envvar: string): string; - -{Do Nothing Functions, no Linux version} -{$ifdef cpui386} -Procedure Intr(intno: byte; var regs: registers); -Procedure MSDos(var regs: registers); -{$endif cpui386} -Procedure SwapVectors; -Procedure GetIntVec(intno: byte; var vector: pointer); -Procedure SetIntVec(intno: byte; vector: pointer); -Procedure Keep(exitcode: Word); - - -Procedure SetFAttr(var f; attr: word); -Procedure SetFTime(var f; time: longint); -Procedure GetCBreak(var breakvalue: boolean); -Procedure SetCBreak(breakvalue: boolean); -Procedure GetVerify(var verify: boolean); -Procedure SetVerify(verify: boolean); - Implementation @@ -906,7 +810,10 @@ End. { $Log$ - Revision 1.23 2004-01-31 16:15:14 florian + Revision 1.24 2004-02-09 12:03:16 michael + + Switched to single interface in dosh.inc + + Revision 1.23 2004/01/31 16:15:14 florian * packing of searchrec for arm fixed Revision 1.22 2003/12/29 21:15:04 jonas diff --git a/rtl/watcom/dos.pp b/rtl/watcom/dos.pp index dfa4cc229d..20818f29f6 100644 --- a/rtl/watcom/dos.pp +++ b/rtl/watcom/dos.pp @@ -21,56 +21,9 @@ Uses Const - {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; - - {File Status} - fmclosed = $D7B0; - fminput = $D7B1; - fmoutput = $D7B2; - fminout = $D7B3; - - + FileNameLen = 255; + Type -{ Needed for LFN Support } - ComStr = String[255]; - PathStr = String[255]; - DirStr = String[255]; - NameStr = String[255]; - ExtStr = String[255]; - -{ - filerec.inc contains the definition of the filerec. - textrec.inc contains the definition of the textrec. - It is in a separate file to make it available in other units without - having to use the DOS unit for it. -} -{$i filerec.inc} -{$i textrec.inc} - - DateTime = packed record - Year, - Month, - Day, - Hour, - Min, - Sec : word; - End; - searchrec = packed record fill : array[1..21] of byte; attr : byte; @@ -82,61 +35,7 @@ Type Registers = Watcom.Registers; -Var - DosError : integer; - -{Interrupt} -Procedure Intr(intno: byte; var regs: registers); -Procedure MSDos(var regs: registers); - -{Info/Date/Time} -Function DosVersion: Word; -Procedure GetDate(var year, month, mday, wday: word); -Procedure GetTime(var hour, minute, second, sec100: word); -procedure SetDate(year,month,day: word); -Procedure SetTime(hour,minute,second,sec100: word); -Procedure UnpackTime(p: longint; var t: datetime); -Procedure PackTime(var t: datetime; var p: longint); - -{Exec} -Procedure Exec(const path: pathstr; const comline: comstr); -Function DosExitCode: word; - -{Disk} -Function DiskFree(drive: byte) : int64; -Function DiskSize(drive: byte) : int64; -Procedure FindFirst(const path: pathstr; attr: word; var f: searchRec); -Procedure FindNext(var f: searchRec); -Procedure FindClose(Var f: SearchRec); - -{File} -Procedure GetFAttr(var f; var attr: word); -Procedure GetFTime(var f; var time: longint); -Function FSearch(path: pathstr; dirlist: string): pathstr; -Function FExpand(const path: pathstr): pathstr; -Procedure FSplit(path: pathstr; var dir: dirstr; var name: namestr; var ext: extstr); -function GetShortName(var p : String) : boolean; -function GetLongName(var p : String) : boolean; - -{Environment} -Function EnvCount: longint; -Function EnvStr(index: integer): string; -Function GetEnv(envvar: string): string; - -{Misc} -Procedure SetFAttr(var f; attr: word); -Procedure SetFTime(var f; time: longint); -Procedure GetCBreak(var breakvalue: boolean); -Procedure SetCBreak(breakvalue: boolean); -Procedure GetVerify(var verify: boolean); -Procedure SetVerify(verify: boolean); - -{Do Nothing Functions} -Procedure SwapVectors; -Procedure GetIntVec(intno: byte; var vector: pointer); -Procedure SetIntVec(intno: byte; vector: pointer); -Procedure Keep(exitcode: word); - +{$i dosh.inc} implementation @@ -1048,7 +947,10 @@ end. { $Log$ - Revision 1.4 2003-10-18 09:18:29 hajny + Revision 1.5 2004-02-09 12:03:16 michael + + Switched to single interface in dosh.inc + + Revision 1.4 2003/10/18 09:18:29 hajny * Wiktor Sywula: transfer_buffer changed to tb Revision 1.3 2003/10/03 21:59:28 peter diff --git a/rtl/win32/dos.pp b/rtl/win32/dos.pp index 3aa124fa16..334d9b19e7 100644 --- a/rtl/win32/dos.pp +++ b/rtl/win32/dos.pp @@ -17,58 +17,10 @@ unit dos; interface Const - Max_Path = 260; - - {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; - - {File Status} - fmclosed = $D7B0; - fminput = $D7B1; - fmoutput = $D7B2; - fminout = $D7B3; - + Max_Path = 260; + FileNameLen = 255; Type -{ Needed for Win95 LFN Support } - ComStr = String[255]; - PathStr = String[255]; - DirStr = String[255]; - NameStr = String[255]; - ExtStr = String[255]; - -{ - filerec.inc contains the definition of the filerec. - textrec.inc contains the definition of the textrec. - It is in a separate file to make it available in other units without - having to use the DOS unit for it. -} -{$i filerec.inc} -{$i textrec.inc} - - DateTime = packed record - Year, - Month, - Day, - Hour, - Min, - Sec : word; - End; - TWin32Handle = longint; PWin32FileTime = ^TWin32FileTime; @@ -111,60 +63,9 @@ Type 2 : (eax, ebx, ecx, edx, ebp, esi, edi : longint); end; -Var - DosError : integer; +{$i dosh.inc} -{Interrupt} -Procedure Intr(intno: byte; var regs: registers); -Procedure MSDos(var regs: registers); -{Info/Date/Time} -Function DosVersion: Word; -Procedure GetDate(var year, month, mday, wday: word); -Procedure GetTime(var hour, minute, second, sec100: word); -procedure SetDate(year,month,day: word); -Procedure SetTime(hour,minute,second,sec100: word); -Procedure UnpackTime(p: longint; var t: datetime); -Procedure PackTime(var t: datetime; var p: longint); - -{Exec} -Procedure Exec(const path: pathstr; const comline: comstr); -Function DosExitCode: word; - -{Disk} -Function DiskFree(drive: byte) : int64; -Function DiskSize(drive: byte) : int64; -Procedure FindFirst(const path: pathstr; attr: word; var f: searchRec); -Procedure FindNext(var f: searchRec); -Procedure FindClose(Var f: SearchRec); - -{File} -Procedure GetFAttr(var f; var attr: word); -Procedure GetFTime(var f; var time: longint); -Function FSearch(path: pathstr; dirlist: string): pathstr; -Function FExpand(const path: pathstr): pathstr; -Procedure FSplit(path: pathstr; var dir: dirstr; var name: namestr; var ext: extstr); -function GetShortName(var p : String) : boolean; -function GetLongName(var p : String) : boolean; - -{Environment} -Function EnvCount: longint; -Function EnvStr(index: integer): string; -Function GetEnv(envvar: string): string; - -{Misc} -Procedure SetFAttr(var f; attr: word); -Procedure SetFTime(var f; time: longint); -Procedure GetCBreak(var breakvalue: boolean); -Procedure SetCBreak(breakvalue: boolean); -Procedure GetVerify(var verify: boolean); -Procedure SetVerify(verify: boolean); - -{Do Nothing Functions} -Procedure SwapVectors; -Procedure GetIntVec(intno: byte; var vector: pointer); -Procedure SetIntVec(intno: byte; vector: pointer); -Procedure Keep(exitcode: word); Const { allow EXEC to inherited handles from calling process, @@ -1055,7 +956,10 @@ begin end. { $Log$ - Revision 1.22 2004-01-06 00:58:35 florian + Revision 1.23 2004-02-09 12:03:16 michael + + Switched to single interface in dosh.inc + + Revision 1.22 2004/01/06 00:58:35 florian * fixed fsearch Revision 1.21 2003/10/27 15:27:47 peter