RTL custom interface types as records

This commit is contained in:
Michael Schimmel
2025-12-11 14:22:09 +01:00
parent 3ed5a4011f
commit 18dde168fd
13 changed files with 918 additions and 84 deletions
+11 -1
View File
@@ -101,6 +101,8 @@ type
class function Add_Ordinal_Float_Float(A: Int64; B: Double): Double; static;
[TRtlExport('+', True)]
class function Add_Float_Ordinal_Float(A: Double; B: Int64): Double; static;
[TRtlExport('+', True)]
class function Add_Text_Text_Text(const A: String; const B: String): String; static;
// Subtract
[TRtlExport('-', True)]
@@ -249,7 +251,10 @@ class function TRtlFunctions.Add(const Args: TArray<TDataValue>): TDataValue;
begin
if Length(Args) <> 2 then
raise EArgumentException.Create('Operator + requires 2 arguments.');
Result := Args[0].AsScalar + Args[1].AsScalar;
if (Args[0].Kind = vkText) and (Args[1].Kind = vkText) then
Result := Args[0].AsText + Args[1].AsText
else
Result := Args[0].AsScalar + Args[1].AsScalar;
end;
class function TRtlFunctions.Subtract(const Args: TArray<TDataValue>): TDataValue;
@@ -915,6 +920,11 @@ begin
Result := System.Abs(A);
end;
class function TRtlFunctions.Add_Text_Text_Text(const A: String; const B: String): String;
begin
Result := A + B;
end;
class function TRtlFunctions.Round_Ordinal_Ordinal(A: Int64): Int64;
begin
Result := A;