Browse Source

* Convert array of jsvalue to array of const where appropriate

michael 4 years ago
parent
commit
aa33897aa3

+ 2 - 2
packages/fcl-base/custapp.pas

@@ -89,7 +89,7 @@ Type
     procedure GetEnvironmentList(List: TStrings; NamesOnly: Boolean); virtual; abstract;
     procedure GetEnvironmentList(List: TStrings; NamesOnly: Boolean); virtual; abstract;
     procedure GetEnvironmentList(List: TStrings); virtual;
     procedure GetEnvironmentList(List: TStrings); virtual;
     procedure Log(EventType: TEventType; const Msg: String);
     procedure Log(EventType: TEventType; const Msg: String);
-    procedure Log(EventType: TEventType; const Fmt: String; const Args: Array of string);
+    procedure Log(EventType: TEventType; const Fmt: String; const Args: Array of const);
     // Delphi properties
     // Delphi properties
     property ExeName: string read GetExeName;
     property ExeName: string read GetExeName;
     property Terminated: Boolean read FTerminated;
     property Terminated: Boolean read FTerminated;
@@ -618,7 +618,7 @@ begin
 end;
 end;
 
 
 procedure TCustomApplication.Log(EventType: TEventType; const Fmt: String;
 procedure TCustomApplication.Log(EventType: TEventType; const Fmt: String;
-  const Args: array of string);
+  const Args: array of const);
 begin
 begin
   try
   try
     Log(EventType, Format(Fmt, Args));
     Log(EventType, Format(Fmt, Args));

+ 1 - 1
packages/fcl-base/fpexprpars.pas

@@ -874,7 +874,7 @@ begin
   Raise EExprParser.Create(Msg);
   Raise EExprParser.Create(Msg);
 end;
 end;
 
 
-Procedure RaiseParserError(Fmt : String; Args : Array of JSValue);
+Procedure RaiseParserError(Fmt : String; Args : Array of Const);
 begin
 begin
   Raise EExprParser.CreateFmt(Fmt,Args);
   Raise EExprParser.CreateFmt(Fmt,Args);
 end;
 end;

+ 4 - 4
packages/fcl-db/db.pas

@@ -1774,8 +1774,8 @@ Const
 
 
 Procedure DatabaseError (Const Msg : String); overload;
 Procedure DatabaseError (Const Msg : String); overload;
 Procedure DatabaseError (Const Msg : String; Comp : TComponent); overload;
 Procedure DatabaseError (Const Msg : String; Comp : TComponent); overload;
-Procedure DatabaseErrorFmt (Const Fmt : String; Const Args : Array Of JSValue); overload;
-Procedure DatabaseErrorFmt (Const Fmt : String; Const Args : Array Of JSValue; Comp : TComponent); overload;
+Procedure DatabaseErrorFmt (Const Fmt : String; Const Args : Array Of Const); overload;
+Procedure DatabaseErrorFmt (Const Fmt : String; Const Args : Array Of Const; Comp : TComponent); overload;
 Function ExtractFieldName(Const Fields: String; var Pos: Integer): String;
 Function ExtractFieldName(Const Fields: String; var Pos: Integer): String;
 
 
 // function SkipComments(var p: PChar; EscapeSlash, EscapeRepeat : Boolean) : boolean;
 // function SkipComments(var p: PChar; EscapeSlash, EscapeRepeat : Boolean) : boolean;
@@ -1805,13 +1805,13 @@ begin
     DatabaseError(Msg);
     DatabaseError(Msg);
 end;
 end;
 
 
-Procedure DatabaseErrorFmt (Const Fmt : String; Const Args : Array Of JSValue);
+Procedure DatabaseErrorFmt (Const Fmt : String; Const Args : Array Of Const);
 
 
 begin
 begin
   Raise EDatabaseError.CreateFmt(Fmt,Args);
   Raise EDatabaseError.CreateFmt(Fmt,Args);
 end;
 end;
 
 
-Procedure DatabaseErrorFmt (Const Fmt : String; Const Args : Array Of JSValue;
+Procedure DatabaseErrorFmt (Const Fmt : String; Const Args : Array Of Const;
                             Comp : TComponent);
                             Comp : TComponent);
 begin
 begin
   if assigned(comp) then
   if assigned(comp) then

+ 2 - 3
packages/fcl-json/fpjson.pp

@@ -116,7 +116,7 @@ Type
     class procedure SetCompressedJSON(AValue: Boolean); {$IFNDEF PAS2JS}static;{$ENDIF}
     class procedure SetCompressedJSON(AValue: Boolean); {$IFNDEF PAS2JS}static;{$ENDIF}
   protected
   protected
     Class Procedure DoError(Const Msg : String);
     Class Procedure DoError(Const Msg : String);
-    Class Procedure DoError(Const Fmt : String; const Args : Array of {$IFDEF PAS2JS}jsvalue{$else}Const{$ENDIF});
+    Class Procedure DoError(Const Fmt : String; const Args : Array of Const);
     Function DoFindPath(Const APath : TJSONStringType; Out NotFound : TJSONStringType) : TJSONdata; virtual;
     Function DoFindPath(Const APath : TJSONStringType; Out NotFound : TJSONStringType) : TJSONdata; virtual;
     function GetAsBoolean: Boolean; virtual; abstract;
     function GetAsBoolean: Boolean; virtual; abstract;
     function GetAsFloat: TJSONFloat; virtual; abstract;
     function GetAsFloat: TJSONFloat; virtual; abstract;
@@ -1467,8 +1467,7 @@ begin
   Raise EJSON.Create(Msg);
   Raise EJSON.Create(Msg);
 end;
 end;
 
 
-class procedure TJSONData.DoError(const Fmt: String;
-  const Args: array of {$IFDEF PAS2JS}jsvalue{$else}Const{$ENDIF});
+class procedure TJSONData.DoError(const Fmt: String; const Args: array of Const);
 begin
 begin
   Raise EJSON.CreateFmt(Fmt,Args);
   Raise EJSON.CreateFmt(Fmt,Args);
 end;
 end;

+ 2 - 2
packages/fpcunit/fpcunit.pas

@@ -65,7 +65,7 @@ type
     Class var AssertCount : Integer;
     Class var AssertCount : Integer;
   public
   public
     class procedure Fail(const AMessage: string);
     class procedure Fail(const AMessage: string);
-    class procedure Fail(const AFmt: string; Args : Array of string);
+    class procedure Fail(const AFmt: string; Args : Array of const);
     class procedure FailEquals(const expected, actual: string; const ErrorMsg: string = '');
     class procedure FailEquals(const expected, actual: string; const ErrorMsg: string = '');
     class procedure FailNotEquals(const expected, actual: string; const ErrorMsg: string = '');
     class procedure FailNotEquals(const expected, actual: string; const ErrorMsg: string = '');
 
 
@@ -1099,7 +1099,7 @@ begin
   raise EAssertionFailedError.Create(AMessage);
   raise EAssertionFailedError.Create(AMessage);
 end;
 end;
 
 
-class procedure TAssert.Fail(const AFmt: string; Args: array of string);
+class procedure TAssert.Fail(const AFmt: string; Args: array of Const);
 begin
 begin
   Inc(AssertCount);
   Inc(AssertCount);
   raise EAssertionFailedError.CreateFmt(AFmt,Args);
   raise EAssertionFailedError.CreateFmt(AFmt,Args);

+ 8 - 8
packages/rtl/classes.pas

@@ -304,10 +304,10 @@ type
     function ToStringArray: TStringDynArray; overload;
     function ToStringArray: TStringDynArray; overload;
     function ToStringArray(aStart,aEnd : Integer): TStringDynArray; overload;
     function ToStringArray(aStart,aEnd : Integer): TStringDynArray; overload;
     function Add(const S: string): Integer; virtual; overload;
     function Add(const S: string): Integer; virtual; overload;
-    function Add(const Fmt : string; const Args : Array of JSValue): Integer; overload;
-    function AddFmt(const Fmt : string; const Args : Array of JSValue): Integer;
+    function Add(const Fmt : string; const Args : Array of const): Integer; overload;
+    function AddFmt(const Fmt : string; const Args : Array of const): Integer;
     function AddObject(const S: string; AObject: TObject): Integer; virtual; overload;
     function AddObject(const S: string; AObject: TObject): Integer; virtual; overload;
-    function AddObject(const Fmt: string; Args : Array of JSValue; AObject: TObject): Integer; overload;
+    function AddObject(const Fmt: string; Args : Array of const; AObject: TObject): Integer; overload;
     procedure Append(const S: string);
     procedure Append(const S: string);
     procedure AddStrings(TheStrings: TStrings); overload; virtual;
     procedure AddStrings(TheStrings: TStrings); overload; virtual;
     procedure AddStrings(TheStrings: TStrings; ClearFirst : Boolean); overload;
     procedure AddStrings(TheStrings: TStrings; ClearFirst : Boolean); overload;
@@ -1307,7 +1307,7 @@ type
     procedure CheckToken(T: TParserToken);
     procedure CheckToken(T: TParserToken);
     procedure CheckTokenSymbol(const S: string);
     procedure CheckTokenSymbol(const S: string);
     procedure Error(const Ident: string);
     procedure Error(const Ident: string);
-    procedure ErrorFmt(const Ident: string; const Args: array of JSValue);
+    procedure ErrorFmt(const Ident: string; const Args: array of const);
     procedure ErrorStr(const Message: string);
     procedure ErrorStr(const Message: string);
     procedure HexToBinary(Stream: TStream);
     procedure HexToBinary(Stream: TStream);
     function NextToken: TParserToken;
     function NextToken: TParserToken;
@@ -3426,13 +3426,13 @@ begin
 end;
 end;
 
 
 
 
-function TStrings.Add(const Fmt: string; const Args: array of JSValue): Integer;
+function TStrings.Add(const Fmt: string; const Args: array of const): Integer;
 
 
 begin
 begin
   Result:=Add(Format(Fmt,Args));
   Result:=Add(Format(Fmt,Args));
 end;
 end;
 
 
-function TStrings.AddFmt(const Fmt: string; const Args: array of JSValue): Integer;
+function TStrings.AddFmt(const Fmt: string; const Args: array of const): Integer;
 
 
 begin
 begin
   Result:=Add(Format(Fmt,Args));
   Result:=Add(Format(Fmt,Args));
@@ -3446,7 +3446,7 @@ begin
   Objects[result]:=AObject;
   Objects[result]:=AObject;
 end;
 end;
 
 
-function TStrings.AddObject(const Fmt: string; Args: array of JSValue; AObject: TObject): Integer;
+function TStrings.AddObject(const Fmt: string; Args: array of const; AObject: TObject): Integer;
 
 
 begin
 begin
   Result:=AddObject(Format(Fmt,Args),AObject);
   Result:=AddObject(Format(Fmt,Args),AObject);
@@ -10396,7 +10396,7 @@ begin
   ErrorStr(Ident);
   ErrorStr(Ident);
 end;
 end;
 
 
-procedure TParser.ErrorFmt(const Ident: string; const Args: array of JSValue);
+procedure TParser.ErrorFmt(const Ident: string; const Args: array of const);
 begin
 begin
   ErrorStr(Format(Ident,Args));
   ErrorStr(Format(Ident,Args));
 end;
 end;

+ 2 - 2
packages/rtl/contnrs.pas

@@ -383,7 +383,7 @@ Type
     Function AddItem(ABucket: Integer; AItem, AData: JSValue): JSValue; virtual;
     Function AddItem(ABucket: Integer; AItem, AData: JSValue): JSValue; virtual;
     Function BucketFor(AItem: JSValue): Integer; virtual; abstract;
     Function BucketFor(AItem: JSValue): Integer; virtual; abstract;
     Function DeleteItem(ABucket: Integer; AIndex: Integer): JSValue; virtual;
     Function DeleteItem(ABucket: Integer; AIndex: Integer): JSValue; virtual;
-    Procedure Error(Msg : String; Args : Array of JSValue);
+    Procedure Error(Msg : String; Args : Array of Const);
     Function FindItem(AItem: JSValue; out ABucket, AIndex: Integer): Boolean; virtual;
     Function FindItem(AItem: JSValue; out ABucket, AIndex: Integer): Boolean; virtual;
     property Buckets: TBucketArray read FBuckets;
     property Buckets: TBucketArray read FBuckets;
     property BucketCount: Integer read GetBucketCount write SetBucketCount;
     property BucketCount: Integer read GetBucketCount write SetBucketCount;
@@ -1693,7 +1693,7 @@ begin
   Dec(FBuckets[ABucket].Count);
   Dec(FBuckets[ABucket].Count);
 end;
 end;
 
 
-Procedure TCustomBucketList.Error(Msg: String; Args: array of JSValue);
+Procedure TCustomBucketList.Error(Msg: String; Args: array of Const);
 begin
 begin
   raise ElistError.CreateFmt(Msg,Args);
   raise ElistError.CreateFmt(Msg,Args);
 end;
 end;

+ 67 - 42
packages/rtl/sysutils.pas

@@ -114,9 +114,9 @@ type
       LogMessageOnCreate : Boolean;
       LogMessageOnCreate : Boolean;
   Public
   Public
     constructor Create(const Msg: String); reintroduce;
     constructor Create(const Msg: String); reintroduce;
-    constructor CreateFmt(const Msg: string; const Args: array of jsvalue);
+    constructor CreateFmt(const Msg: string; const Args: array of const);
     constructor CreateHelp(const Msg: String; AHelpContext: Integer);
     constructor CreateHelp(const Msg: String; AHelpContext: Integer);
-    constructor CreateFmtHelp(const Msg: string; const Args: array of jsvalue; AHelpContext: Integer);
+    constructor CreateFmtHelp(const Msg: string; const Args: array of const; AHelpContext: Integer);
     function ToString: String; override;
     function ToString: String; override;
     property HelpContext: Integer read fHelpContext write fHelpContext;
     property HelpContext: Integer read fHelpContext write fHelpContext;
     property Message: String read fMessage write fMessage;
     property Message: String read fMessage write fMessage;
@@ -250,8 +250,8 @@ function AnsiSameText(const s1, s2: String): Boolean; assembler;
 function AnsiCompareStr(const s1, s2: String): Integer;
 function AnsiCompareStr(const s1, s2: String): Integer;
 procedure AppendStr(var Dest: String; const S: string);
 procedure AppendStr(var Dest: String; const S: string);
 
 
-function Format(const Fmt: String; const Args: array of JSValue): String;
-function Format(const Fmt: String; const Args: array of JSValue; const aSettings : TFormatSettings): String;
+function Format(const Fmt: String; const Args: array of const): String;
+function Format(const Fmt: String; const Args: array of const; const aSettings : TFormatSettings): String;
 
 
 function BytesOf(const AVal: string): TBytes;
 function BytesOf(const AVal: string): TBytes;
 function StringOf(const ABytes: TBytes): string;
 function StringOf(const ABytes: TBytes): string;
@@ -696,10 +696,10 @@ Type
     Class Function Create(const AValue: array of Char; StartIndex: SizeInt; ALen: SizeInt): string; overload; static;
     Class Function Create(const AValue: array of Char; StartIndex: SizeInt; ALen: SizeInt): string; overload; static;
     Class Function EndsText(const ASubText, AText: string): Boolean; static;
     Class Function EndsText(const ASubText, AText: string): Boolean; static;
     Class Function Equals(const a: string; const b: string): Boolean; overload; static;
     Class Function Equals(const a: string; const b: string): Boolean; overload; static;
-    Class Function Format(const AFormat: string; const args: array of JSValue): string; overload; static;
+    Class Function Format(const AFormat: string; const args: array of const): string; overload; static;
     Class Function IsNullOrEmpty(const AValue: string): Boolean; static;
     Class Function IsNullOrEmpty(const AValue: string): Boolean; static;
     Class Function IsNullOrWhiteSpace(const AValue: string): Boolean; static;
     Class Function IsNullOrWhiteSpace(const AValue: string): Boolean; static;
-    Class Function Join(const Separator: string; const Values: array of JSValue): string; overload; static;
+    Class Function Join(const Separator: string; const Values: array of const): string; overload; static;
     Class Function Join(const Separator: string; const Values: array of string): string; overload; static;
     Class Function Join(const Separator: string; const Values: array of string): string; overload; static;
     Class Function Join(const Separator: string; const Values: array of string; StartIndex: SizeInt; ACount: SizeInt): string; overload; static;
     Class Function Join(const Separator: string; const Values: array of string; StartIndex: SizeInt; ACount: SizeInt): string; overload; static;
     Class Function LowerCase(const S: string): string; overload; static; inline;
     Class Function LowerCase(const S: string): string; overload; static; inline;
@@ -722,7 +722,7 @@ Type
     Function EndsWith(const AValue: string): Boolean; overload; inline;
     Function EndsWith(const AValue: string): Boolean; overload; inline;
     Function EndsWith(const AValue: string; IgnoreCase: Boolean): Boolean; overload;
     Function EndsWith(const AValue: string; IgnoreCase: Boolean): Boolean; overload;
     Function Equals(const AValue: string): Boolean; overload;
     Function Equals(const AValue: string): Boolean; overload;
-    Function Format(const args: array of jsValue): string; overload;
+    Function Format(const args: array of const): string; overload;
     Function GetHashCode: Integer;
     Function GetHashCode: Integer;
     Function IndexOf(AValue: Char): SizeInt; overload; inline;
     Function IndexOf(AValue: Char): SizeInt; overload; inline;
     Function IndexOf(const AValue: string): SizeInt; overload; inline;
     Function IndexOf(const AValue: string): SizeInt; overload; inline;
@@ -2536,13 +2536,13 @@ Begin
     RemoveLeadingNegativeSign(Result,DS,TS);
     RemoveLeadingNegativeSign(Result,DS,TS);
 end;
 end;
 
 
-function Format(const Fmt: String; const Args: array of JSValue): String;
+function Format(const Fmt: String; const Args: array of const): String;
 
 
 begin
 begin
   Result:=Format(Fmt,Args,FormatSettings)
   Result:=Format(Fmt,Args,FormatSettings)
 end;
 end;
 
 
-function Format(const Fmt: String; const Args: array of JSValue  ; const aSettings : TFormatSettings): String;
+function Format(const Fmt: String; const Args: array of Const; const aSettings : TFormatSettings): String;
 
 
 Var ChPos,OldPos,ArgPos,DoArg,Len : SizeInt;
 Var ChPos,OldPos,ArgPos,DoArg,Len : SizeInt;
     Hs,ToAdd : String;
     Hs,ToAdd : String;
@@ -2591,10 +2591,12 @@ Var ChPos,OldPos,ArgPos,DoArg,Len : SizeInt;
 
 
         ArgPos:=ArgN+1;
         ArgPos:=ArgN+1;
 
 
-        if IsNumber(Args[ArgN]) and IsInteger(Args[ArgN]) then
-          Value:=Integer(Args[ArgN])
+        case Args[ArgN].Vtype of
+           vtInteger: Value := Args[ArgN].VInteger;
+           vtNativeInt: Value := Args[ArgN].VNativeInt;
         else
         else
           DoFormatError(feInvalidFormat,Fmt);
           DoFormatError(feInvalidFormat,Fmt);
+        end;
         Inc(ChPos);
         Inc(ChPos);
         end
         end
       else
       else
@@ -2682,7 +2684,7 @@ Var ChPos,OldPos,ArgPos,DoArg,Len : SizeInt;
   end;
   end;
 
 
 
 
-  function Checkarg (AT : TJSValueType; err:boolean):boolean;
+  function Checkarg (AT : Integer; err:boolean):boolean;
   {
   {
     Check if argument INDEX is of correct type (AT)
     Check if argument INDEX is of correct type (AT)
     If Index=-1, ArgPos is used, and argpos is augmented with 1
     If Index=-1, ArgPos is used, and argpos is augmented with 1
@@ -2695,7 +2697,7 @@ Var ChPos,OldPos,ArgPos,DoArg,Len : SizeInt;
     else
     else
       DoArg:=Index;
       DoArg:=Index;
     ArgPos:=DoArg+1;
     ArgPos:=DoArg+1;
-    If (Doarg>High(Args)) or (GetValueTYpe(Args[Doarg])<>AT) then
+    If (Doarg>High(Args)) or (Args[Doarg].VType<>AT) then
      begin
      begin
        if err then
        if err then
         DoFormatError(feInvalidArgindex,Fmt);
         DoFormatError(feInvalidArgindex,Fmt);
@@ -2725,8 +2727,10 @@ begin
 {$endif}
 {$endif}
       Case FChar of
       Case FChar of
         'D' : begin
         'D' : begin
-              Checkarg(jvtinteger,true);
-              toAdd:=IntToStr(NativeInt(Args[DoArg]));
+              if Checkarg(vtinteger,false) then
+                toAdd:=IntToStr(Args[DoArg].VInteger)
+              else if CheckArg(vtNativeInt,True) then
+                toAdd:=IntToStr(Args[DoArg].VNativeInt);
               Width:=Abs(width);
               Width:=Abs(width);
               Index:=Prec-Length(ToAdd);
               Index:=Prec-Length(ToAdd);
               If ToAdd[1]<>'-' then
               If ToAdd[1]<>'-' then
@@ -2736,52 +2740,73 @@ begin
                 Insert(StringOfChar('0',Index+1),toadd,2);
                 Insert(StringOfChar('0',Index+1),toadd,2);
               end;
               end;
         'U' : begin
         'U' : begin
-              Checkarg(jvtinteger,True);
-              if NativeInt(Args[Doarg])<0 then
-                DoFormatError(feInvalidArgindex,Fmt);
-              Toadd:=IntToStr(NativeInt(Args[Doarg]));
+              if Checkarg(vtinteger,false) then
+                toAdd:=IntToStr(Cardinal(Args[DoArg].VInteger))
+              else if CheckArg(vtNativeInt,True) then
+                toAdd:=IntToStr(NativeUInt(Args[DoArg].VNativeInt));
               Width:=Abs(width);
               Width:=Abs(width);
               Index:=Prec-Length(ToAdd);
               Index:=Prec-Length(ToAdd);
               ToAdd:=StringOfChar('0',Index)+ToAdd
               ToAdd:=StringOfChar('0',Index)+ToAdd
               end;
               end;
         'E' : begin
         'E' : begin
-              if CheckArg(jvtFloat,false) or CheckArg(jvtInteger,True) then
-                ToAdd:=FloatToStrF(Double(Args[doarg]),ffFixed,9999,Prec,aSettings);
+              if CheckArg(vtCurrency,false) then
+                ToAdd:=FloatToStrF(Args[doarg].VCurrency,ffExponent,3,Prec,aSettings)
+              else if CheckArg(vtExtended,True) then
+                ToAdd:=FloatToStrF(Args[doarg].VExtended,ffExponent,3,Prec,aSettings);
               end;
               end;
         'F' : begin
         'F' : begin
-              if CheckArg(jvtFloat,false) or CheckArg(jvtInteger,True) then
-                ToAdd:=FloatToStrF(Double(Args[doarg]),ffFixed,9999,Prec,aSettings);
+              if CheckArg(vtCurrency,false) then
+                ToAdd:=FloatToStrF(Args[doarg].VCurrency,ffFixed,9999,Prec,aSettings)
+              else if CheckArg(vtExtended,True) then
+                ToAdd:=FloatToStrF(Args[doarg].VExtended,ffFixed,9999,Prec,aSettings);
               end;
               end;
         'G' : begin
         'G' : begin
-              if CheckArg(jvtFloat,false) or CheckArg(jvtInteger,True) then
-                ToAdd:=FloatToStrF(Double(Args[doarg]),ffGeneral,Prec,3,aSettings);
+              if CheckArg(vtCurrency,false) then
+                ToAdd:=FloatToStrF(Args[doarg].VCurrency,ffGeneral,Prec,3,aSettings)
+              else if CheckArg(vtExtended,True) then
+                ToAdd:=FloatToStrF(Args[doarg].VExtended,ffGeneral,Prec,3,aSettings);
               end;
               end;
         'N' : begin
         'N' : begin
-              if CheckArg(jvtFloat,false) or CheckArg(jvtInteger,True) then
-                ToAdd:=FloatToStrF(Double(Args[doarg]),ffNumber,9999,Prec,aSettings);
+              if CheckArg(vtCurrency,false) then
+                ToAdd:=FloatToStrF(Args[doarg].VCurrency,ffNumber,9999,Prec,aSettings)
+              else if CheckArg(vtExtended,True) then
+                ToAdd:=FloatToStrF(Args[doarg].VExtended,ffNumber,9999,Prec,aSettings);
               end;
               end;
         'M' : begin
         'M' : begin
-              if CheckArg(jvtFloat,false) or CheckArg(jvtInteger,True) then
-                ToAdd:=FloatToStrF(Double(Args[doarg]),ffCurrency,9999,Prec,aSettings);
+              if CheckArg(vtCurrency,false) then
+                ToAdd:=FloatToStrF(Args[doarg].VCurrency,ffCurrency,9999,Prec,aSettings)
+              else if CheckArg(vtExtended,True) then
+                ToAdd:=FloatToStrF(Args[doarg].VExtended,ffCurrency,9999,Prec,aSettings);
               end;
               end;
         'S' : begin
         'S' : begin
-              CheckArg(jvtString,true);
-              hs:=String(Args[doarg]);
+              if CheckArg(vtUnicodeString,false) then
+                hs:=Args[doarg].VUnicodeString
+              else if CheckArg(vtWideChar,True) then
+                hs:=Args[doarg].VWideChar;
               Index:=Length(hs);
               Index:=Length(hs);
               If (Prec<>-1) and (Index>Prec) then
               If (Prec<>-1) and (Index>Prec) then
                 Index:=Prec;
                 Index:=Prec;
               ToAdd:=Copy(hs,1,Index);
               ToAdd:=Copy(hs,1,Index);
               end;
               end;
         'P' : Begin
         'P' : Begin
-              CheckArg(jvtInteger,true);
-              ToAdd:=IntToHex(NativeInt(Args[DoArg]),31);
+              if CheckArg(vtInteger,false) then
+                ToAdd:=IntToHex(Args[DoArg].VInteger,8)
+              else if CheckArg(vtInteger,true) then
+                ToAdd:=IntToHex(Args[DoArg].VNativeInt,16);
               end;
               end;
         'X' : begin
         'X' : begin
-              Checkarg(jvtinteger,true);
-              vq:=nativeInt(Args[Doarg]);
-              index:=31; // May need to adjust to NativeInt
+              if Checkarg(vtinteger,false) then
+                begin
+                vq:=Args[Doarg].VInteger;
+                Index:=16;
+                end
+              else if Checkarg(vtNativeint,True) then
+                begin
+                vq:=Args[Doarg].VNativeInt;
+                index:=31; // May need to adjust to NativeInt
+                end;
               If Prec>index then
               If Prec>index then
-                ToAdd:=IntToHex(NativeInt(vq),index)
+                ToAdd:=IntToHex(vq,index)
               else
               else
                 begin
                 begin
                 // determine minimum needed number of hex digits.
                 // determine minimum needed number of hex digits.
@@ -2902,7 +2927,7 @@ begin
     Writeln('Created exception ',ClassName,' with message: ',Msg);
     Writeln('Created exception ',ClassName,' with message: ',Msg);
 end;
 end;
 
 
-constructor Exception.CreateFmt(const Msg: string; const Args: array of jsvalue
+constructor Exception.CreateFmt(const Msg: string; const Args: array of Const
   );
   );
 begin
 begin
   //writeln('Exception.CreateFmt START ',ClassName,' "',Msg,'" Args=',Args);
   //writeln('Exception.CreateFmt START ',ClassName,' "',Msg,'" Args=',Args);
@@ -2917,7 +2942,7 @@ begin
 end;
 end;
 
 
 constructor Exception.CreateFmtHelp(const Msg: string;
 constructor Exception.CreateFmtHelp(const Msg: string;
-  const Args: array of jsvalue; AHelpContext: Integer);
+  const Args: array of Const; AHelpContext: Integer);
 begin
 begin
   Create(Format(Msg,Args));
   Create(Format(Msg,Args));
   fHelpContext:=AHelpContext;
   fHelpContext:=AHelpContext;
@@ -5615,7 +5640,7 @@ begin
 end;
 end;
 
 
 
 
-class function TStringHelper.Format(const AFormat: string; const args: array of JSValue): string;
+class function TStringHelper.Format(const AFormat: string; const args: array of const): string;
 begin
 begin
   Result:=Sysutils.Format(AFormat,Args);
   Result:=Sysutils.Format(AFormat,Args);
 end;
 end;
@@ -5633,7 +5658,7 @@ begin
 end;
 end;
 
 
 
 
-class function TStringHelper.Join(const Separator: string; const Values: array of JSValue): string;
+class function TStringHelper.Join(const Separator: string; const Values: array of const): string;
 
 
 begin
 begin
   Result:=TJSArray(Values).Join(Separator);
   Result:=TJSArray(Values).Join(Separator);
@@ -5846,7 +5871,7 @@ begin
 end;
 end;
 
 
 
 
-function TStringHelper.Format(const args: array of jsValue): string;
+function TStringHelper.Format(const args: array of const): string;
 
 
 begin
 begin
   Result:=Sysutils.Format(Self,Args);
   Result:=Sysutils.Format(Self,Args);