aboutsummaryrefslogtreecommitdiffstats
path: root/unicode/src/lib/TntUnicodeControls/TntFormatStrUtils.pas
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-03-14 22:51:58 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-03-14 22:51:58 +0000
commit45ecc78e147cd544be36a922c2bba609ad736c17 (patch)
tree57cbfb33ca2d4890f22eed3f11d2ac39f1be3505 /unicode/src/lib/TntUnicodeControls/TntFormatStrUtils.pas
parentdc62978bd7c88883cf27593ad229bbded84aa2c9 (diff)
downloadusdx-45ecc78e147cd544be36a922c2bba609ad736c17.tar.gz
usdx-45ecc78e147cd544be36a922c2bba609ad736c17.tar.xz
usdx-45ecc78e147cd544be36a922c2bba609ad736c17.zip
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
Diffstat (limited to 'unicode/src/lib/TntUnicodeControls/TntFormatStrUtils.pas')
-rw-r--r--unicode/src/lib/TntUnicodeControls/TntFormatStrUtils.pas22
1 files changed, 20 insertions, 2 deletions
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;