diff --git a/packages/fcl-process/src/process.pp b/packages/fcl-process/src/process.pp index e3f413cc36..179482efa7 100644 --- a/packages/fcl-process/src/process.pp +++ b/packages/fcl-process/src/process.pp @@ -40,6 +40,13 @@ Type TProcessOptions = set of TProcessOption; TStartupOptions = set of TStartupOption; + TRunCommandEventCode = (RunCommandIdle,RunCommandReadOutput,RunCommandFinished,RunCommandException); + TOnRunCommandEvent = procedure(Sender,Context : TObject;Status:TRunCommandEventCode;const Message:string) of object; + EProcess = Class(Exception); + + {$ifdef UNIX} + TProcessForkEvent = procedure(Sender : TObject) of object; + {$endif UNIX} {$macro on} {define processunicodestring} diff --git a/packages/fcl-process/src/processbody.inc b/packages/fcl-process/src/processbody.inc index 71211b48b1..89ca3fbfd9 100644 --- a/packages/fcl-process/src/processbody.inc +++ b/packages/fcl-process/src/processbody.inc @@ -40,13 +40,6 @@ Type TProcessStringList = TStringList; {$endif} - {$ifdef UNIX} - TProcessForkEvent = procedure(Sender : TObject) of object; - {$endif UNIX} - - TRunCommandEventCode = (RunCommandIdle,RunCommandFinished,RunCommandException); - TOnRunCommandEvent = procedure(Sender : TObject;Status:TRunCommandEventCode;const Message:string) of object; - { TProcess } TProcessnamemacro = Class (TComponent) @@ -103,7 +96,7 @@ Type procedure SetEnvironment(const Value: TProcessStrings); Procedure ConvertCommandLine; function PeekExitStatus: Boolean; - Procedure IntOnIdleSleep(Sender : TObject;Status:TRunCommandEventCode;const Message:String); + Procedure IntOnIdleSleep(Sender,Context : TObject;Status:TRunCommandEventCode;const Message:String); Protected FRunning : Boolean; FExitCode : Cardinal; @@ -174,7 +167,6 @@ Type end; TProcessClass = Class of TProcessnamemacro; - EProcess = Class(Exception); Procedure CommandToList(S : TProcessString; List : TProcessStrings); @@ -532,7 +524,7 @@ begin end; end; -procedure TProcessnamemacro.IntOnIdleSleep(Sender : TObject;status:TRunCommandEventCode;const message:string); +procedure TProcessnamemacro.IntOnIdleSleep(Sender,Context : TObject;status:TRunCommandEventCode;const message:string); begin if status=RunCommandIdle then sleep(FRunCommandSleepTime); @@ -571,7 +563,7 @@ begin gotoutputstderr:=ReadInputStream(StdErr,StdErrBytesRead,StdErrLength,StdErrString,1); if not gotoutput and not gotoutputstderr and Assigned(FOnRunCommandEvent) Then - FOnRunCommandEvent(self,RunCommandIdle,''); + FOnRunCommandEvent(self,Nil,RunCommandIdle,''); end; // Get left output after end of execution ReadInputStream(output,BytesRead,OutputLength,OutputString,250); @@ -582,7 +574,7 @@ begin anexitstatus:=exitstatus; result:=0; // we came to here, document that. if Assigned(FOnRunCommandEvent) then // allow external apps to react to that and finish GUI - FOnRunCommandEvent(self,RunCommandFinished,''); + FOnRunCommandEvent(self,Nil,RunCommandFinished,''); except on e : Exception do @@ -591,7 +583,7 @@ begin setlength(outputstring,BytesRead); setlength(stderrstring,StderrBytesRead); if Assigned(FOnRunCommandEvent) then - FOnRunCommandEvent(self,RunCommandException,e.Message); + FOnRunCommandEvent(self,Nil,RunCommandException,e.Message); end; end; end; diff --git a/packages/fcl-process/src/processunicode.pp b/packages/fcl-process/src/processunicode.pp index 6b27be5464..6bfbc0d9fa 100644 --- a/packages/fcl-process/src/processunicode.pp +++ b/packages/fcl-process/src/processunicode.pp @@ -29,10 +29,17 @@ Type TProcessPriority = process.TProcessPriority; TProcessOptions = process.TProcessOptions; TStartupOptions = process.TStartupOptions; + {$ifdef UNIX} + TProcessForkEvent = Process.TProcessForkEvent; + {$endif UNIX} + + TRunCommandEventCode = Process.TRunCommandEventCode; + TOnRunCommandEvent = Process.TOnRunCommandEvent; + EProcess = Process.EProcess; {$macro on} {$define processunicodestring} -{$define TProcessnamemacro:=TProcessUnicode} +{$define TProcessnamemacro:=TProcess} {$i processbody.inc} end. diff --git a/rtl/linux/aarch64/stat.inc b/rtl/linux/aarch64/stat.inc index 6d69441361..aaa42f117e 100644 --- a/rtl/linux/aarch64/stat.inc +++ b/rtl/linux/aarch64/stat.inc @@ -24,8 +24,6 @@ {$PACKRECORDS C} stat = record - case integer of - 0 : ( st_dev : cULong; st_ino : cULong; st_mode : cUInt; @@ -46,27 +44,4 @@ st_ctime_nsec : cULong; __unused4a : cUInt; __unused5a : cUInt; - ); - 1 : ( - dev : cULong deprecated; - ino : cULong deprecated; - mode : cUInt deprecated; - nlink : cUInt deprecated; - uid : cUInt deprecated; - gid : cUInt deprecated; - rdev : cULong deprecated; - __pad1b : cULong deprecated; - size : cLong deprecated; - blksize : cInt deprecated; - __pad2b : cInt deprecated; - blocks : cLong deprecated; - atime : cLong deprecated; - atime_nsec : cULong deprecated; - mtime : cLong deprecated; - mtime_nsec : cULong deprecated; - ctime : cLong deprecated; - ctime_nsec : cULong deprecated; - __unused4b : cUInt deprecated; - __unused5b : cUInt deprecated; - ); end; diff --git a/rtl/linux/arm/stat.inc b/rtl/linux/arm/stat.inc index 9ff252c5d8..6f4d028bec 100644 --- a/rtl/linux/arm/stat.inc +++ b/rtl/linux/arm/stat.inc @@ -13,29 +13,7 @@ **********************************************************************} Stat = record // No unix typing because of differences - case byte of - 0: - (dev : culonglong deprecated; - __pad0 : array[0..3] of cuchar deprecated; - __st_ino : culong deprecated; - mode : cuint deprecated; - nlink : cuint deprecated; - uid : culong deprecated; - gid : culong deprecated; - rdev : culonglong deprecated; - __pad3 : array[0..3] of cuchar deprecated; - size : culonglong deprecated; - blksize: culong deprecated; - blocks : culonglong deprecated; - atime : culong deprecated; - atime_nsec : culong deprecated; - mtime : culong deprecated; - mtime_nsec : culong deprecated; - ctime : culong deprecated; - ctime_nsec : culong deprecated; - ino : culonglong deprecated;); - 1: - (st_dev : culonglong; + st_dev : culonglong; __pad0_ : array[0..3] of cuchar; __st_ino_ : culong; st_mode : cuint; @@ -53,6 +31,6 @@ st_mtime_nsec : culong; st_ctime : culong; st_ctime_nsec : culong; - st_ino : culonglong); + st_ino : culonglong; end; diff --git a/rtl/linux/i386/stat.inc b/rtl/linux/i386/stat.inc index 27f1b39baa..51ceb546b2 100644 --- a/rtl/linux/i386/stat.inc +++ b/rtl/linux/i386/stat.inc @@ -15,29 +15,7 @@ {$ifndef FPC_USE_LIBC} // kernel record Stat = packed record - case byte of - 0: - (dev : qword deprecated; - __pad0 : array[0..3] of byte deprecated; - __ino : cardinal deprecated; - mode : cardinal deprecated; - nlink : cardinal deprecated; - uid : cardinal deprecated; - gid : cardinal deprecated; - rdev : qword deprecated; - __pad3 : array[0..3] of byte deprecated; - size : qword deprecated; - blksize : cardinal deprecated; - blocks : qword deprecated; - atime : cardinal deprecated; - atime_nsec : cardinal deprecated; - mtime : cardinal deprecated; - mtime_nsec : cardinal deprecated; - ctime : cardinal deprecated; - ctime_nsec : cardinal deprecated; - ino : qword deprecated); - 1: // Unix typing will be reintroduced. - (st_dev : qword; + st_dev : qword; __pad0_ : array[0..3] of byte; __st_ino_, st_mode, @@ -55,7 +33,7 @@ st_mtime_nsec, st_ctime, st_ctime_nsec : cardinal; - st_ino : qword); + st_ino : qword; end; {$else} @@ -66,27 +44,7 @@ {$ifdef fs32bit} Stat = Record - case byte of - 0:(dev: cuLong deprecated; - ino: cuLong deprecated; - mode: cuShort deprecated; - nlink: cuShort deprecated; - uid: cuShort deprecated; - gid: cuShort deprecated; - rdev: cuLong deprecated; - size: cuLong deprecated; - blksize: cuLong deprecated; - blocks: cuLong deprecated; - atime: cuLong deprecated; - atime_nsec: cuLong deprecated; - mtime: cuLong deprecated; - mtime_nsec: cuLong deprecated; - ctime: cuLong deprecated; - ctime_nsec: cuLong deprecated; - __unused4: cuLong deprecated; - __unused5: cuLong deprecated); - - 1:(st_dev: cuLong; + st_dev: cuLong; st_ino: cuLong; st_mode: cuShort; st_nlink: cuShort; @@ -103,44 +61,13 @@ st_ctime: cuLong; st_ctime_nsec: cuLong; __unused4_: cuLong; - __unused5_: cuLong); + __unused5_: cuLong; end; {$else} // 64 bit stat Stat = record - case Byte of - 0 :(dev: cuLongLong deprecated; - __pad0: array[0..3] of cuChar deprecated; - - __ino: cuLong deprecated; - - mode: cuInt deprecated; - nlink: cuInt deprecated; - - uid: cuLong deprecated; - gid: cuLong deprecated; - - rdev: cuLongLong deprecated; - __pad3: array[0..3] of cuChar deprecated; - - size: cLongLong deprecated; - blksize: cuLong deprecated; - - blocks: cuLongLong deprecated; //* Number 512-byte blocks allocated. */ - - atime: cuLong deprecated; - atime_nsec: cuLong deprecated; - - mtime: cuLong deprecated; - mtime_nsec: cuInt deprecated; - - ctime: cuLong deprecated; - ctime_nsec: cuLong deprecated; - - ino: cuLongLong deprecated); - - 1 :(st_dev: cuLongLong; + st_dev: cuLongLong; __pad0_: array[0..3] of cuChar; __st_ino: cuLong; @@ -168,7 +95,7 @@ st_ctime: cuLong; st_ctime_nsec: cuLong; - st_ino: cuLongLong); + st_ino: cuLongLong; end; {$endif} diff --git a/rtl/linux/m68k/stat.inc b/rtl/linux/m68k/stat.inc index cb0c9bab73..43a077ba0c 100644 --- a/rtl/linux/m68k/stat.inc +++ b/rtl/linux/m68k/stat.inc @@ -13,29 +13,7 @@ **********************************************************************} Stat = packed record // No unix typing because of differences - case byte of - 0: - (dev : qword; - __pad0 : array[0..1] of byte; - __ino, - mode, - nlink, - uid, - gid : cardinal; - rdev : qword; - __pad3 : array[0..1] of byte; - size : qword; - blksize : cardinal; - blocks : qword; - atime, - atime_nsec, - mtime, - mtime_nsec, - ctime, - ctime_nsec : cardinal; - ino : qword); - 1: - (st_dev : qword; + st_dev : qword; __pad0_ : array[0..1] of byte; __st_ino_, st_mode, @@ -53,5 +31,5 @@ st_mtime_nsec, st_ctime, st_ctime_nsec : cardinal; - st_ino : qword); + st_ino : qword; end; diff --git a/rtl/linux/powerpc/stat.inc b/rtl/linux/powerpc/stat.inc index fbcc1ec252..4d5a77ff3c 100644 --- a/rtl/linux/powerpc/stat.inc +++ b/rtl/linux/powerpc/stat.inc @@ -26,30 +26,7 @@ {$IFNDEF FPC_USE_LIBC} Stat = record // No unix typing because of differences - case byte of - 0: - (dev : culonglong deprecated; - ino : culonglong deprecated; - mode : cuint deprecated; - nlink : cuint deprecated; - uid : cuint deprecated; - gid : cuint deprecated; - rdev : culonglong deprecated; - __pad2 : cushort deprecated; - size : clonglong deprecated; - blksize: clong deprecated; - - blocks : clonglong deprecated; - atime : clong deprecated; - atime_nsec : culong deprecated; - mtime : clong deprecated; - mtime_nsec : culong deprecated; - ctime : clong deprecated; - __unused3 : culong deprecated; - __unused4 : culong deprecated; - __unused5 : culong deprecated;); - 1: - (st_dev : culonglong; + st_dev : culonglong; st_ino : culonglong; st_mode : cuint; st_nlink : cuint; @@ -68,7 +45,7 @@ st_ctime : clong; __unused3_ : culong; __unused4_ : culong; - __unused5_ : culong;); + __unused5_ : culong; end; {$ELSE FPC_USE_LIBC} @@ -78,8 +55,6 @@ { i.e. powerpc kernel sources (2.6.20-15) /include/asm-powerpc/stat.h, stat64 struct } stat = record - case byte of - 0: ( st_dev : cULongLong; st_ino : cULongLong; st_mode : cUInt; @@ -98,27 +73,7 @@ st_ctime, st_ctime_nsec, __unused4, - __unused5 : cULong); - 1: ( - dev : cULongLong deprecated; - ino : cULongLong deprecated; - mode : cUInt deprecated; - nlink : cUInt deprecated; - uid : cUInt deprecated; - gid : cUInt deprecated; - rdev : cULongLong deprecated; - __pad2_: cUShort deprecated; - size : cLongLong deprecated; - blksize: cInt deprecated; - blocks : cULongLong deprecated; - atime, - __unused1_dummy, - mtime, - __unused2_dummy, - ctime, - __unused3_dummy, - __unused4_dummy, - __unused5_dummy : cULong deprecated); + __unused5 : cULong; end; {$ENDIF FPC_USE_LIBC} diff --git a/rtl/linux/powerpc64/stat.inc b/rtl/linux/powerpc64/stat.inc index 10e21c049f..cfe8ded403 100644 --- a/rtl/linux/powerpc64/stat.inc +++ b/rtl/linux/powerpc64/stat.inc @@ -24,8 +24,6 @@ {$PACKRECORDS C} stat = record - case integer of - 0 : ( st_dev : cULong; st_ino : cULong; { wrongly defined in RTL? } st_nlink : cULong; { wrongly defined in RTL? } @@ -45,25 +43,5 @@ st_mtime_nsec : cULong; st_ctime : cULong; st_ctime_nsec : cULong; - __unused : array[0..2] of cULong - ); - 1 : ( - dev : cULong deprecated; - ino : cULong deprecated; - nlink : cULong deprecated; - mode : mode_t deprecated; - uid : uid_t deprecated; - gid : gid_t deprecated; - rdev : cULong deprecated; - size : off_t deprecated; - blksize, - blocks, - atime, - atime_nsec, - mtime, - mtime_nsec, - ctime, - ctime_nsec : cULong deprecated; - __unused_dummy : array[0..2] of cULong deprecated; - ); + __unused : array[0..2] of cULong; end; diff --git a/rtl/linux/x86_64/stat.inc b/rtl/linux/x86_64/stat.inc index 5972b3f2ff..dd682d2dd7 100644 --- a/rtl/linux/x86_64/stat.inc +++ b/rtl/linux/x86_64/stat.inc @@ -15,30 +15,7 @@ {$ifndef FPC_USE_LIBC} // kernel record stat = packed record // No unix typing because of differences - case byte of - 0: - (dev, - ino, - nlink : qword deprecated; - - mode, - uid, - gid, - __pad0 : cardinal deprecated; - rdev : qword deprecated; - size, - blksize, - blocks : int64 deprecated; - - atime, - atime_nsec, - mtime, - mtime_nsec, - ctime, - ctime_nsec : qword deprecated; - __unused : array[0..2] of qword deprecated); - 1: - (st_dev, + st_dev, st_ino, st_nlink : qword; @@ -57,7 +34,7 @@ st_mtime_nsec, st_ctime, st_ctime_nsec : qword; - __unused2 : array[0..2] of qword;); + __unused2 : array[0..2] of qword; end; {$else} @@ -66,29 +43,7 @@ // god from /usr/include/asm-x86_64 some -dev of linux-headers must be installed Stat = record - case Byte of - 0:(dev: cuLong deprecated; - ino: cuLong deprecated; - nlink: cuLong deprecated; - - mode: cuInt deprecated; - uid: cuInt deprecated; - gid: cuInt deprecated; - __pad0: cuInt deprecated; - rdev: cuLong deprecated; - size: cLong deprecated; - blksize: cLong deprecated; - blocks: cLong deprecated; //* Number 512-byte blocks allocated. */ - - atime: cuLong deprecated; - atime_nsec: cuLong deprecated; - mtime: cuLong deprecated; - mtime_nsec: cuLong deprecated; - ctime: cuLong deprecated; - ctime_nsec: cuLong deprecated; - __unused: array[0..2] of cLong deprecated;); - - 1:(st_dev: cuLong; + st_dev: cuLong; st_ino: cuLong; st_nlink: cuLong; @@ -107,7 +62,7 @@ st_mtime_nsec: cuLong; st_ctime: cuLong; st_ctime_nsec: cuLong; - __unused2: array[0..2] of cLong); + __unused2: array[0..2] of cLong; end; {$endif}