From 8eb0d1eaed1b9322706cbb199c093005b1839d43 Mon Sep 17 00:00:00 2001 From: Pierre Muller Date: Wed, 10 Jul 2024 07:44:11 +0000 Subject: [PATCH] Use single main file src/inc/varutils.pp for Windows and other OSes --- packages/rtl-objpas/fpmake.pp | 1 + packages/rtl-objpas/src/inc/varutils.pp | 33 +++++++++++++-- .../src/win/{varutils.pp => wvarutil.inc} | 41 +------------------ 3 files changed, 32 insertions(+), 43 deletions(-) rename packages/rtl-objpas/src/win/{varutils.pp => wvarutil.inc} (77%) diff --git a/packages/rtl-objpas/fpmake.pp b/packages/rtl-objpas/fpmake.pp index 75ef11e2c9..a22ebe02b7 100644 --- a/packages/rtl-objpas/fpmake.pp +++ b/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; diff --git a/packages/rtl-objpas/src/inc/varutils.pp b/packages/rtl-objpas/src/inc/varutils.pp index 8807f90ab8..f9f2f57d7f 100644 --- a/packages/rtl-objpas/src/inc/varutils.pp +++ b/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. diff --git a/packages/rtl-objpas/src/win/varutils.pp b/packages/rtl-objpas/src/win/wvarutil.inc similarity index 77% rename from packages/rtl-objpas/src/win/varutils.pp rename to packages/rtl-objpas/src/win/wvarutil.inc index ee39b9d3fc..a18a9863e3 100644 --- a/packages/rtl-objpas/src/win/varutils.pp +++ b/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. +