Browse Source

Use single main file src/inc/varutils.pp for Windows and other OSes

Pierre Muller 1 year ago
parent
commit
8eb0d1eaed

+ 1 - 0
packages/rtl-objpas/fpmake.pp

@@ -81,6 +81,7 @@ begin
         AddInclude('varutilh.inc');
         AddInclude('varerror.inc');
         AddInclude('varutils.inc',VarUtilsOSes-[win32,win64]);
+        AddInclude('wvarutil.inc',[win32,win64]);
         AddInclude('cvarutil.inc');
       end;
 

+ 30 - 3
packages/rtl-objpas/src/inc/varutils.pp

@@ -14,6 +14,15 @@
  **********************************************************************}
 
 {$MODE ObjFPC}
+
+{$ifndef NO_SMART_LINK}
+{$smartlink on}
+{$endif}
+
+{$if defined (win32) or defined (win64)}
+{$define USE_WINDOWS_OLE_FUNCTIONS}
+{$endif}
+
 {$IFNDEF FPC_DOTTEDUNITS}
 Unit varutils;
 {$ENDIF}
@@ -21,9 +30,21 @@ Unit varutils;
 Interface
 
 {$IFDEF FPC_DOTTEDUNITS}
-Uses System.SysUtils, System.Variants;
+Uses
+  System.SysUtils,
+{$ifdef USE_WINDOWS_OLE_FUNCTIONS}
+  System.Types;
+{$else}
+  System.Variants;
+[$endif}
 {$ELSE}
-uses sysutils, variants;
+uses
+  sysutils,
+{$ifdef USE_WINDOWS_OLE_FUNCTIONS}
+  Types;
+{$else}
+  variants;
+[$endif}
 {$ENDIF}
 // Read definitions.
 
@@ -35,8 +56,14 @@ Implementation
 
 {$i cvarutil.inc}
 
-// Code common to non-win32 platforms.
+{$ifdef USE_WINDOWS_OLE_FUNCTIONS}
+// Code common to Windows OS platforms.
+
+{$i wvarutil.inc}
+{$else}
+// Code common to other platforms.
 
 {$i varutils.inc}
+{$endif}
 
 end.

+ 1 - 40
packages/rtl-objpas/src/win/varutils.pp → packages/rtl-objpas/src/win/wvarutil.inc

@@ -1,42 +1,3 @@
-{
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2000 by the Free Pascal development team
-
-    Interface and OS-dependent part of variant support
-
-    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.
-
- **********************************************************************}
-
-{$MODE ObjFPC}
-
-{$ifndef NO_SMART_LINK}
-{$smartlink on}
-{$endif}
-
-{$IFNDEF FPC_DOTTEDUNITS}
-Unit VarUtils;
-{$ENDIF FPC_DOTTEDUNITS}
-
-Interface
-
-{$IFDEF FPC_DOTTEDUNITS}
-Uses System.SysUtils,System.Types;
-{$ELSE FPC_DOTTEDUNITS}
-Uses sysutils,Types;
-{$ENDIF FPC_DOTTEDUNITS}
-
-{$i varutilh.inc}
-
-Implementation
-
-{$i cvarutil.inc}
-
 { ---------------------------------------------------------------------
     Windows external definitions.
   ---------------------------------------------------------------------}
@@ -78,4 +39,4 @@ function SafeArrayUnlock(psa: PVarArray): HRESULT; stdcall;external oleaut;
 function VarDateFromStr(const strIn: POleStr; alcid: DWORD; dwFlags: Longint; out dateOut: Double): HRESULT; stdcall; external oleaut; overload;
 function VarDateFromStr(const strIn: POleStr; alcid: DWORD; dwFlags: Longint; out dateOut: TDateTime): HRESULT; stdcall; external oleaut; overload;
 
-end.
+