Browse Source

* Dotted filenames for package fcl-extra

Michaël Van Canneyt 2 years ago
parent
commit
e55c2b0fb7

+ 3 - 0
packages/fcl-extra/namespaced/System.DaemonApp.pp

@@ -0,0 +1,3 @@
+unit System.DaemonApp;
+{$DEFINE FPC_DOTTEDUNITS}
+{$i daemonapp.pp}

+ 3 - 0
packages/fcl-extra/namespaced/System.Fileinfo.pp

@@ -0,0 +1,3 @@
+unit System.Fileinfo;
+{$DEFINE FPC_DOTTEDUNITS}
+{$i fileinfo.pp}

+ 3 - 0
packages/fcl-extra/namespaced/System.Win.ServiceManager.pas

@@ -0,0 +1,3 @@
+unit System.Win.ServiceManager;
+{$DEFINE FPC_DOTTEDUNITS}
+{$i ServiceManager.pas}

+ 7 - 0
packages/fcl-extra/namespaces.lst

@@ -0,0 +1,7 @@
+src/fileinfo.pp=namespaced/System.Fileinfo.pp
+{s*:src/}=namespaced/
+{i+:src/}
+src/win/ServiceManager.pas=namespaced/System.Win.ServiceManager.pas
+{s*:src/win/}=namespaced/
+{i+:src/win/}
+src/daemonapp.pp=namespaced/System.DaemonApp.pp

+ 7 - 0
packages/fcl-extra/src/daemonapp.pp

@@ -11,14 +11,21 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit daemonapp;
 unit daemonapp;
+{$ENDIF FPC_DOTTEDUNITS}
 
 
 {$mode objfpc}{$H+}
 {$mode objfpc}{$H+}
 
 
 interface
 interface
 
 
+{$IFDEF FPC_DOTTEDUNITS}
+uses
+  Fcl.CustApp, System.Classes, System.SysUtils, Fcl.EventLog, System.RtlConsts;
+{$ELSE FPC_DOTTEDUNITS}
 uses
 uses
   Custapp, Classes, SysUtils, eventlog, rtlconsts;
   Custapp, Classes, SysUtils, eventlog, rtlconsts;
+{$ENDIF FPC_DOTTEDUNITS}
 
 
 Type
 Type
   TCustomDaemon = Class;
   TCustomDaemon = Class;

+ 7 - 0
packages/fcl-extra/src/fileinfo.pp

@@ -13,14 +13,21 @@
 
 
  **********************************************************************}
  **********************************************************************}
 
 
+{$IFNDEF FPC_DOTTEDUNITS}
 unit FileInfo;
 unit FileInfo;
+{$ENDIF FPC_DOTTEDUNITS}
 
 
 {$mode objfpc}
 {$mode objfpc}
 {$h+}
 {$h+}
 interface
 interface
 
 
+{$IFDEF FPC_DOTTEDUNITS}
+uses
+  System.SysUtils, System.Classes,  System.Resources.Resource, System.Resources.VersionTypes, System.Resources.Version;
+{$ELSE FPC_DOTTEDUNITS}
 uses
 uses
   SysUtils, Classes,  resource, versiontypes, versionresource;
   SysUtils, Classes,  resource, versiontypes, versionresource;
+{$ENDIF FPC_DOTTEDUNITS}
 
 
 type
 type
   // Low level interface
   // Low level interface

+ 4 - 0
packages/fcl-extra/src/unix/daemonapp.inc

@@ -13,7 +13,11 @@
  **********************************************************************}
  **********************************************************************}
 { System dependent service stuff }
 { System dependent service stuff }
 
 
+{$IFDEF FPC_DOTTEDUNITS}
+uses UnixApi.Base;
+{$ELSE FPC_DOTTEDUNITS}
 uses baseunix;
 uses baseunix;
+{$ENDIF FPC_DOTTEDUNITS}
 
 
 Resourcestring
 Resourcestring
   SErrFailedToFork          = 'Failed to fork daemon process.';
   SErrFailedToFork          = 'Failed to fork daemon process.';

+ 13 - 5
packages/fcl-extra/src/win/ServiceManager.pas

@@ -13,12 +13,19 @@
  **********************************************************************}
  **********************************************************************}
 {$mode objfpc}
 {$mode objfpc}
 {$h+}
 {$h+}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit ServiceManager;
 unit ServiceManager;
+{$ENDIF FPC_DOTTEDUNITS}
 
 
 interface
 interface
 
 
+{$IFDEF FPC_DOTTEDUNITS}
+uses
+  WinApi.Windows, System.SysUtils, System.Classes, WinApi.Jedi.Winnt, WinApi.Jedi.Winsvc;
+{$ELSE FPC_DOTTEDUNITS}
 uses
 uses
   Windows, SysUtils, Classes, jwawinnt, jwawinsvc;
   Windows, SysUtils, Classes, jwawinnt, jwawinsvc;
+{$ENDIF FPC_DOTTEDUNITS}
 
 
 type
 type
 
 
@@ -699,7 +706,7 @@ begin
     Pargs:=StringsToPcharList(Args);
     Pargs:=StringsToPcharList(Args);
     end;
     end;
   Try
   Try
-    If not jwawinsvc.StartService(SHandle,Argc,PChar(PArgs)) then
+    If not {$IFDEF FPC_DOTTEDUNITS}WinApi.Jedi.WinSvc{$ELSE}jwawinsvc{$ENDIF}.StartService(SHandle,Argc,PChar(PArgs)) then
       RaiseLastOSError;
       RaiseLastOSError;
   Finally
   Finally
     If (PArgs<>Nil) then
     If (PArgs<>Nil) then
@@ -725,7 +732,7 @@ end;
 Procedure TServiceManager.LockServiceDatabase;
 Procedure TServiceManager.LockServiceDatabase;
 
 
 begin
 begin
-  FDBLock:=jwawinsvc.LockServiceDatabase(Handle);
+  FDBLock:={$IFDEF FPC_DOTTEDUNITS}WinApi.Jedi.WinSvc{$ELSE}jwawinsvc{$ENDIF}.LockServiceDatabase(Handle);
   If FDBLock=Nil then
   If FDBLock=Nil then
     RaiseLastOSError;
     RaiseLastOSError;
 end;
 end;
@@ -735,7 +742,7 @@ begin
   If (FDBLock<>Nil) then
   If (FDBLock<>Nil) then
     begin
     begin
     Try
     Try
-      If Not jwawinsvc.UnLockServiceDatabase(FDBLock) then
+      If Not {$IFDEF FPC_DOTTEDUNITS}WinApi.Jedi.WinSvc{$ELSE}jwawinsvc{$ENDIF}.UnLockServiceDatabase(FDBLock) then
         RaiseLastOSError;
         RaiseLastOSError;
     Finally
     Finally
       FDBLock:=Nil;
       FDBLock:=Nil;
@@ -750,12 +757,12 @@ Var
   BytesNeeded : DWord;
   BytesNeeded : DWord;
 
 
 begin
 begin
-  jwawinsvc.QueryServiceConfig(SHandle,Nil,0,BytesNeeded);
+  {$IFDEF FPC_DOTTEDUNITS}WinApi.Jedi.WinSvc{$ELSE}jwawinsvc{$ENDIF}.QueryServiceConfig(SHandle,Nil,0,BytesNeeded);
   If (GetLastError<>ERROR_INSUFFICIENT_BUFFER) then
   If (GetLastError<>ERROR_INSUFFICIENT_BUFFER) then
     RaiseLastOSError;
     RaiseLastOSError;
   GetMem(SvcCfg,BytesNeeded);
   GetMem(SvcCfg,BytesNeeded);
   Try
   Try
-    If Not jwawinsvc.QueryServiceConfig(SHandle,SvcCfg,BytesNeeded,BytesNeeded) then
+    If Not {$IFDEF FPC_DOTTEDUNITS}WinApi.Jedi.WinSvc{$ELSE}jwawinsvc{$ENDIF}.QueryServiceConfig(SHandle,SvcCfg,BytesNeeded,BytesNeeded) then
       RaiseLastOSError;
       RaiseLastOSError;
     With config,SvcCfg^ do
     With config,SvcCfg^ do
       begin
       begin
@@ -976,3 +983,4 @@ begin
 end;
 end;
 
 
 end.
 end.
+ 

+ 5 - 1
packages/fcl-extra/src/win/daemonapp.inc

@@ -13,7 +13,11 @@
  **********************************************************************}
  **********************************************************************}
 { Win32 implementation of service application }
 { Win32 implementation of service application }
 
 
+{$IFDEF FPC_DOTTEDUNITS}
+uses WinApi.Windows,WinApi.Jedi.Winsvc;
+{$ELSE FPC_DOTTEDUNITS}
 uses windows,jwawinsvc;
 uses windows,jwawinsvc;
+{$ENDIF FPC_DOTTEDUNITS}
 
 
 Const
 Const
   CM_SERVICE_CONTROL_CODE = WM_USER+1;
   CM_SERVICE_CONTROL_CODE = WM_USER+1;
@@ -345,7 +349,7 @@ begin
     if not GetClassInfoA(HInstance,AWClass.lpszClassName,TClass) then
     if not GetClassInfoA(HInstance,AWClass.lpszClassName,TClass) then
       begin
       begin
       AWClass.hInstance := HInstance;
       AWClass.hInstance := HInstance;
-      if Windows.RegisterClassA(AWClass) = 0 then
+      if {$IFDEF FPC_DOTTEDUNITS}WinApi.{$ENDIF}Windows.RegisterClassA(AWClass) = 0 then
         DaemonError(SErrWindowClass);
         DaemonError(SErrWindowClass);
       end;
       end;
     GUIHandle := CreateWindowA(AWClass.lpszClassName, PAnsiChar(Title),
     GUIHandle := CreateWindowA(AWClass.lpszClassName, PAnsiChar(Title),