From 4401ddfaa20d87492442cb7656c37d13b75995d7 Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 16 Jun 2008 15:00:46 +0000 Subject: Delphi 7 compatibility fix: - "in"-operator does not work with WideChar operands, e.g. "mychar in ['a..z'] - FPC_VERSION/RELEASE/PATCH (e.g. {$IF FPC_VERSION > 2}) must be defined as constants because delphi 7 does not care about {$IFDEF FPC} sections and complains about undefined constant expressions. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1150 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UConfig.pas | 48 +++++++++++++------------------------------ 1 file changed, 14 insertions(+), 34 deletions(-) (limited to 'Game/Code/Classes/UConfig.pas') diff --git a/Game/Code/Classes/UConfig.pas b/Game/Code/Classes/UConfig.pas index 4f87115a..46ba2e74 100644 --- a/Game/Code/Classes/UConfig.pas +++ b/Game/Code/Classes/UConfig.pas @@ -59,6 +59,7 @@ interface {$IFDEF FPC} {$MODE Delphi} + {$MACRO ON} // for evaluation of FPC_VERSION/RELEASE/PATCH {$ENDIF} {$I switches.inc} @@ -106,41 +107,15 @@ const USDX_STRING = 'UltraStar Deluxe'; (* - * FPC_VERSION is already defined as a macro by FPC itself. - * You should use the built-in macros - * FPC_VERSION (=PPC_MAJOR) - * FPC_RELEASE (=PPC_MINOR) - * FPC_PATCH (=PPC_RELEASE) - * instead of the PPC_* ones defined here. - * This way Windows users do not need to set this. - * - * Note: It might be necessary to enable macros ({$MACRO ON} or -Sm) - * first if you want to use the FPC_* macros. - * In FPC 2.2.0 they work even without macros being enabled but - * this might be different in other versions. - * - * Example (Check for version >= 2.0.1): - * {$IF (FPC_VERSION > 2) or ((FPC_VERSION = 2) and - * ( (FPC_RELEASE > 0) or ((FPC_RELEASE = 0) and - * (FPC_PATCH >= 1)) ))} - * {$DEFINE FPC_VER_201_PLUS} - * {$ENDIF} - * - * IMPORTANT: do NOT check this way: - * {$IF (FPC_VERSION >= 2) and (FPC_RELEASE >= 0) and (FPC_PATCH >= 1)} - * ... - * In this case version 3.0.0 does not match because Patch 0 is less than 1. + * FPC version numbers are already defined as built-in macros: + * FPC_VERSION (MAJOR) + * FPC_RELEASE (MINOR) + * FPC_PATCH (RELEASE) + * Since FPC_VERSION is already defined, we will use FPC_VERSION_INT as + * composed version number. *) - - //PPC_VERSION_MAJOR = @PPC_VERSION_MAJOR@; - //PPC_VERSION_MINOR = @PPC_VERSION_MINOR@; - //PPC_VERSION_RELEASE = @PPC_VERSION_RELEASE@; - //PPC_VERSION = (PPC_VERSION_MAJOR * VERSION_MAJOR) + - // (PPC_VERSION_MINOR * VERSION_MINOR) + - // (PPC_VERSION_RELEASE * VERSION_RELEASE); - - {$IFDEF Delphi} - // Delphi evaluates every $IF-directive even if it is disabled by a surrounding + {$IFNDEF FPC} + // Delphi 7 evaluates every $IF-directive even if it is disabled by a surrounding // $IF or $IFDEF so the follwing will give you an error in delphi: // {$IFDEF FPC}{$IF (FPC_VERSION > 2)}...{$IFEND}{$ENDIF} // The reason for this error is that FPC_VERSION is not a valid constant. @@ -149,6 +124,11 @@ const FPC_RELEASE = 0; FPC_PATCH = 0; {$ENDIF} + + FPC_VERSION_INT = (FPC_VERSION * VERSION_MAJOR) + + (FPC_RELEASE * VERSION_MINOR) + + (FPC_PATCH * VERSION_RELEASE); + {$IFDEF HaveFFMpeg} -- cgit v1.2.3