Browse Source

* uses and resourcestrings moved to platform specific includes

git-svn-id: trunk@19327 -
Tomas Hajny 14 years ago
parent
commit
3bce487e30

+ 1 - 18
packages/fcl-process/src/process.pp

@@ -169,22 +169,7 @@ Var
 
 implementation
 
-{$ifdef WINDOWS}
-Uses
-  Windows;
-{$endif WINDOWS}
-{$ifdef UNIX}
-uses
-   ctypes,
-   UnixType,
-   Unix,
-   Baseunix;
-{$endif UNIX}
-
-Resourcestring
-  SNoCommandLine        = 'Cannot execute empty command-line';
-  SErrNoSuchProgram     = 'Executable not found: "%s"';
-  SErrNoTerminalProgram = 'Could not detect X-Terminal program';
+{$i process.inc}
 
 Procedure CommandToList(S : String; List : TStrings);
 
@@ -244,8 +229,6 @@ begin
     end;
 end;
 
-{$i process.inc}
-
 Constructor TProcess.Create (AOwner : TComponent);
 begin
   Inherited;

+ 15 - 2
packages/fcl-process/src/unix/process.inc

@@ -10,6 +10,19 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
  **********************************************************************}
+uses
+   ctypes,
+   UnixType,
+   Unix,
+   Baseunix;
+
+Resourcestring
+  SNoCommandLine        = 'Cannot execute empty command-line';
+  SErrNoSuchProgram     = 'Executable not found: "%s"';
+  SErrNoTerminalProgram = 'Could not detect X-Terminal program';
+  SErrCannotFork        = 'Failed to Fork process';
+  SErrCannotCreatePipes = 'Failed to create pipes';
+
 Const
   PriorityConstants : Array [TProcessPriority] of Integer =
                       (20,20,0,-20);
@@ -242,7 +255,7 @@ Procedure CreatePipes(Var HI,HO,HE : TPipePair; CE : Boolean);
 
    begin
     If not CreatePipeHandles(P[peRead],P[peWrite]) then
-      Raise EProcess.Create('Failed to create pipes');
+      Raise EProcess.Create(SErrCannotCreatePipes);
    end;
 
   Procedure ClosePair(Var P : TPipePair);
@@ -335,7 +348,7 @@ begin
         Pid:=fpfork;
 {$endif}
         if Pid<0 then
-          Raise EProcess.Create('Failed to Fork process');
+          Raise EProcess.Create(SErrCannotFork);
         if (PID>0) then
           begin
             // Parent process. Copy process information.

+ 12 - 1
packages/fcl-process/src/win/process.inc

@@ -11,6 +11,17 @@
 
  **********************************************************************}
 
+Uses
+  Windows;
+
+
+Resourcestring
+  SNoCommandLine        = 'Cannot execute empty command-line';
+  SErrCannotExecute     = 'Failed to execute %s : %d';
+{  SErrNoSuchProgram     = 'Executable not found: "%s"';
+  SErrNoTerminalProgram = 'Could not detect X-Terminal program';
+}
+
 Const
   PriorityConstants : Array [TProcessPriority] of Cardinal =
                       (HIGH_PRIORITY_CLASS,IDLE_PRIORITY_CLASS,
@@ -248,7 +259,7 @@ begin
       If Not CreateProcess (PName,PCommandLine,@FProcessAttributes,@FThreadAttributes,
                    FInheritHandles,FCreationFlags,FEnv,PDir,FStartupInfo,
                    fProcessInformation) then
-        Raise EProcess.CreateFmt('Failed to execute %s : %d',[FCommandLine,GetLastError]);
+        Raise EProcess.CreateFmt(SErrCannotExecute,[FCommandLine,GetLastError]);
       FProcessHandle:=FProcessInformation.hProcess;
       FThreadHandle:=FProcessInformation.hThread;
       FProcessID:=FProcessINformation.dwProcessID;

+ 12 - 1
packages/fcl-process/src/wince/process.inc

@@ -11,6 +11,17 @@
 
  **********************************************************************}
 
+Uses
+  Windows;
+
+
+Resourcestring
+  SNoCommandLine        = 'Cannot execute empty command-line';
+  SErrCannotExecute     = 'Failed to execute %s : %d';
+{  SErrNoSuchProgram     = 'Executable not found: "%s"';
+  SErrNoTerminalProgram = 'Could not detect X-Terminal program';
+}
+
 Const
   PriorityConstants : Array [TProcessPriority] of Cardinal =
                       (HIGH_PRIORITY_CLASS,IDLE_PRIORITY_CLASS,
@@ -207,7 +218,7 @@ begin
       If Not CreateProcess (PName,PCommandLine,@FProcessAttributes,@FThreadAttributes,
                    FInheritHandles,FCreationFlags,FEnv,PDir,@FStartupInfo,
                    fProcessInformation) then
-        Raise EProcess.CreateFmt('Failed to execute %s : %d',[FCommandLine,GetLastError]);
+        Raise EProcess.CreateFmt(SErrCannotExecute,[FCommandLine,GetLastError]);
       FProcessHandle:=FProcessInformation.hProcess;
       FThreadHandle:=FProcessInformation.hThread;
       FProcessID:=FProcessINformation.dwProcessID;