From 45ecc78e147cd544be36a922c2bba609ad736c17 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 14 Mar 2009 22:51:58 +0000 Subject: FPC (Windows only) support for TntUnicodeUtils git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1638 b956fd51-792f-4845-bead-9b4dfca2ff2c --- .../lib/TntUnicodeControls/TntFormatStrUtils.pas | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'unicode/src/lib/TntUnicodeControls/TntFormatStrUtils.pas') diff --git a/unicode/src/lib/TntUnicodeControls/TntFormatStrUtils.pas b/unicode/src/lib/TntUnicodeControls/TntFormatStrUtils.pas index 2b409e4e..c6b65082 100644 --- a/unicode/src/lib/TntUnicodeControls/TntFormatStrUtils.pas +++ b/unicode/src/lib/TntUnicodeControls/TntFormatStrUtils.pas @@ -11,6 +11,10 @@ unit TntFormatStrUtils; +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$INCLUDE TntCompilers.inc} interface @@ -21,11 +25,14 @@ uses TntSysUtils; function GetCanonicalFormatStr(const _FormatString: WideString): WideString; + +{$IFNDEF FPC} {$IFNDEF COMPILER_9_UP} function ReplaceFloatingArgumentsInFormatString(const _FormatString: WideString; const Args: array of const {$IFDEF COMPILER_7_UP}; FormatSettings: PFormatSettings{$ENDIF}): WideString; {$ENDIF} +{$ENDIF} procedure CompareFormatStrings(FormatStr1, FormatStr2: WideString); function FormatStringsAreCompatible(FormatStr1, FormatStr2: WideString): Boolean; @@ -268,6 +275,7 @@ begin end; end; +{$IFNDEF FPC} {$IFNDEF COMPILER_9_UP} function ReplaceFloatingArgumentsInFormatString(const _FormatString: WideString; const Args: array of const @@ -318,6 +326,7 @@ begin end; end; {$ENDIF} +{$ENDIF} procedure GetFormatArgs(const _FormatString: WideString; FormatArgs: TTntStrings); var @@ -376,6 +385,15 @@ begin end; end; +function FormatSpecToObject(SpecType: TFormatSpecifierType): TObject; +begin + {$IFNDEF FPC} + Result := TObject(SpecType); + {$ELSE} + Result := Pointer(SpecType); + {$ENDIF} +end; + procedure UpdateTypeList(FormatArgs, TypeList: TTntStrings); var i: integer; @@ -406,13 +424,13 @@ begin if TypeList[RunningIndex] <> '' then begin // already exists in list, check for compatibility - if TypeList.Objects[RunningIndex] <> TObject(SpecType) then + if TypeList.Objects[RunningIndex] <> FormatSpecToObject(SpecType) then raise EFormatSpecError.CreateFmt(SMismatchedArgumentTypes, [RunningIndex, TypeList[RunningIndex], f]); end else begin // not in list so update it TypeList[RunningIndex] := f; - TypeList.Objects[RunningIndex] := TObject(SpecType); + TypeList.Objects[RunningIndex] := FormatSpecToObject(SpecType); end; end; end; -- cgit v1.2.3