Browse Source

* TFormatSettings implementation, stage 3 (final)

git-svn-id: trunk@5899 -
michael 18 years ago
parent
commit
fcce3195b6
3 changed files with 84 additions and 76 deletions
  1. 10 10
      rtl/objpas/sysutils/sysformt.inc
  2. 73 66
      rtl/objpas/sysutils/sysstr.inc
  3. 1 0
      rtl/objpas/sysutils/sysstrh.inc

+ 10 - 10
rtl/objpas/sysutils/sysformt.inc

@@ -239,33 +239,33 @@ begin
               end;
               end;
         'E' : begin
         'E' : begin
               if CheckArg(vtCurrency,false) then
               if CheckArg(vtCurrency,false) then
-                ToAdd:=FloatToStrF(Args[doarg].VCurrency^,ffexponent,Prec,3)
+                ToAdd:=FloatToStrF(Args[doarg].VCurrency^,ffexponent,Prec,3,FormatSettings)
               else if CheckArg(vtExtended,true) then
               else if CheckArg(vtExtended,true) then
-                ToAdd:=FloatToStrF(Args[doarg].VExtended^,ffexponent,Prec,3);
+                ToAdd:=FloatToStrF(Args[doarg].VExtended^,ffexponent,Prec,3,FormatSettings);
               end;
               end;
         'F' : begin
         'F' : begin
               if CheckArg(vtCurrency,false) then
               if CheckArg(vtCurrency,false) then
-                ToAdd:=FloatToStrF(Args[doarg].VCurrency^,ffFixed,9999,Prec)
+                ToAdd:=FloatToStrF(Args[doarg].VCurrency^,ffFixed,9999,Prec,FormatSettings)
               else if CheckArg(vtExtended,true) then
               else if CheckArg(vtExtended,true) then
-                ToAdd:=FloatToStrF(Args[doarg].VExtended^,ffFixed,9999,Prec);
+                ToAdd:=FloatToStrF(Args[doarg].VExtended^,ffFixed,9999,Prec,FormatSettings);
               end;
               end;
         'G' : begin
         'G' : begin
               if CheckArg(vtCurrency,false) then
               if CheckArg(vtCurrency,false) then
-                ToAdd:=FloatToStrF(Args[doarg].VCurrency^,ffGeneral,Prec,3)
+                ToAdd:=FloatToStrF(Args[doarg].VCurrency^,ffGeneral,Prec,3,FormatSettings)
               else if CheckArg(vtExtended,true) then
               else if CheckArg(vtExtended,true) then
-                ToAdd:=FloatToStrF(Args[doarg].VExtended^,ffGeneral,Prec,3);
+                ToAdd:=FloatToStrF(Args[doarg].VExtended^,ffGeneral,Prec,3,FormatSettings);
               end;
               end;
         'N' : begin
         'N' : begin
               if CheckArg(vtCurrency,false) then
               if CheckArg(vtCurrency,false) then
-                ToAdd:=FloatToStrF(Args[doarg].VCurrency^,ffNumber,9999,Prec)
+                ToAdd:=FloatToStrF(Args[doarg].VCurrency^,ffNumber,9999,Prec,FormatSettings)
               else if CheckArg(vtExtended,true) then
               else if CheckArg(vtExtended,true) then
-                ToAdd:=FloatToStrF(Args[doarg].VExtended^,ffNumber,9999,Prec);
+                ToAdd:=FloatToStrF(Args[doarg].VExtended^,ffNumber,9999,Prec,FormatSettings);
               end;
               end;
         'M' : begin
         'M' : begin
               if CheckArg(vtExtended,false) then
               if CheckArg(vtExtended,false) then
-                ToAdd:=FloatToStrF(Args[doarg].VExtended^,ffCurrency,9999,Prec)
+                ToAdd:=FloatToStrF(Args[doarg].VExtended^,ffCurrency,9999,Prec,FormatSettings)
               else if CheckArg(vtCurrency,true) then
               else if CheckArg(vtCurrency,true) then
-                ToAdd:=FloatToStrF(Args[doarg].VCurrency^,ffCurrency,9999,Prec);
+                ToAdd:=FloatToStrF(Args[doarg].VCurrency^,ffCurrency,9999,Prec,FormatSettings);
               end;
               end;
         'S' : begin
         'S' : begin
                 if CheckArg(vtString,false) then
                 if CheckArg(vtString,false) then

+ 73 - 66
rtl/objpas/sysutils/sysstr.inc

@@ -903,7 +903,7 @@ begin
   Setlength(F,fmtlen);
   Setlength(F,fmtlen);
   if fmtlen > 0 then
   if fmtlen > 0 then
     Move(fmt,F[1],fmtlen);
     Move(fmt,F[1],fmtlen);
-  S:=Format (F,Args);
+  S:=Format (F,Args,FormatSettings);
   If Cardinal(Length(S))<Buflen then
   If Cardinal(Length(S))<Buflen then
     Result:=Length(S)
     Result:=Length(S)
   else
   else
@@ -922,7 +922,7 @@ end;
 Procedure FmtStr(Var Res: string; const Fmt : string; Const args: Array of const; Const FormatSettings: TFormatSettings);
 Procedure FmtStr(Var Res: string; const Fmt : string; Const args: Array of const; Const FormatSettings: TFormatSettings);
 
 
 begin
 begin
-  Res:=Format(fmt,Args);
+  Res:=Format(fmt,Args,FormatSettings);
 end;
 end;
 
 
 Procedure FmtStr(Var Res: String; Const Fmt : String; Const args: Array of const);
 Procedure FmtStr(Var Res: String; Const Fmt : String; Const args: Array of const);
@@ -941,7 +941,7 @@ end;
 Function StrFmt(Buffer,Fmt : PChar; Const Args: Array of const; Const FormatSettings: TFormatSettings): PChar; 
 Function StrFmt(Buffer,Fmt : PChar; Const Args: Array of const; Const FormatSettings: TFormatSettings): PChar; 
 
 
 begin
 begin
-  Buffer[FormatBuf(Buffer^,Maxint,Fmt^,strlen(fmt),args)]:=#0;
+  Buffer[FormatBuf(Buffer^,Maxint,Fmt^,strlen(fmt),args,FormatSettings)]:=#0;
   Result:=Buffer;
   Result:=Buffer;
 end;
 end;
 
 
@@ -954,7 +954,7 @@ end;
 Function StrLFmt(Buffer : PCHar; Maxlen : Cardinal;Fmt : PChar; Const args: Array of const; Const FormatSettings: TFormatSettings) : Pchar;
 Function StrLFmt(Buffer : PCHar; Maxlen : Cardinal;Fmt : PChar; Const args: Array of const; Const FormatSettings: TFormatSettings) : Pchar;
 
 
 begin
 begin
-  Buffer[FormatBuf(Buffer^,MaxLen,Fmt^,strlen(fmt),args)]:=#0;
+  Buffer[FormatBuf(Buffer^,MaxLen,Fmt^,strlen(fmt),args,FormatSettings)]:=#0;
   Result:=Buffer;
   Result:=Buffer;
 end;
 end;
 
 
@@ -967,7 +967,7 @@ end;
 Function StrToFloat(Const S : String; Const FormatSettings: TFormatSettings) : Extended;
 Function StrToFloat(Const S : String; Const FormatSettings: TFormatSettings) : Extended;
 
 
 Begin
 Begin
-  If Not TextToFloat(Pchar(S),Result) then
+  If Not TextToFloat(Pchar(S),Result,FormatSettings) then
     Raise EConvertError.createfmt(SInValidFLoat,[S]);
     Raise EConvertError.createfmt(SInValidFLoat,[S]);
 End;
 End;
 
 
@@ -980,7 +980,7 @@ end;
 Function StrToFloatDef(Const S: String; Const Default: Extended; Const FormatSettings: TFormatSettings): Extended;
 Function StrToFloatDef(Const S: String; Const Default: Extended; Const FormatSettings: TFormatSettings): Extended;
 
 
 begin
 begin
-   if not TextToFloat(PChar(S),Result,fvExtended) then
+   if not TextToFloat(PChar(S),Result,fvExtended,FormatSettings) then
      Result:=Default;
      Result:=Default;
 end;
 end;
 
 
@@ -992,7 +992,7 @@ Var
 
 
 Begin
 Begin
   S:=StrPas(Buffer);
   S:=StrPas(Buffer);
-  P:=Pos(DecimalSeparator,S);
+  P:=Pos(FormatSettings.DecimalSeparator,S);
   If (P<>0) Then
   If (P<>0) Then
     S[P] := '.';
     S[P] := '.';
   Val(trim(S),Value,E);
   Val(trim(S),Value,E);
@@ -1022,13 +1022,13 @@ Var
 
 
 Begin
 Begin
   S:=StrPas(Buffer);
   S:=StrPas(Buffer);
-  P:=Pos(ThousandSeparator,S);
+  P:=Pos(FormatSettings.ThousandSeparator,S);
   While (P<>0) do
   While (P<>0) do
     begin
     begin
     Delete(S,P,1);
     Delete(S,P,1);
-    P:=Pos(ThousandSeparator,S);
+    P:=Pos(FormatSettings.ThousandSeparator,S);
     end;
     end;
-  P:=Pos(DecimalSeparator,S);
+  P:=Pos(FormatSettings.DecimalSeparator,S);
   If (P<>0) Then
   If (P<>0) Then
     S[P] := '.';
     S[P] := '.';
   case ValueType of
   case ValueType of
@@ -1064,7 +1064,7 @@ end;
 
 
 Function TryStrToFloat(Const S : String; Var Value: Single; Const FormatSettings: TFormatSettings): Boolean;
 Function TryStrToFloat(Const S : String; Var Value: Single; Const FormatSettings: TFormatSettings): Boolean;
 Begin
 Begin
-  Result := TextToFloat(PChar(S), Value, fvSingle);
+  Result := TextToFloat(PChar(S), Value, fvSingle,FormatSettings);
 End;
 End;
 
 
 Function TryStrToFloat(Const S : String; Var Value: Double): Boolean;
 Function TryStrToFloat(Const S : String; Var Value: Double): Boolean;
@@ -1075,7 +1075,7 @@ end;
 
 
 Function TryStrToFloat(Const S : String; Var Value: Double; Const FormatSettings: TFormatSettings): Boolean;
 Function TryStrToFloat(Const S : String; Var Value: Double; Const FormatSettings: TFormatSettings): Boolean;
 Begin
 Begin
-  Result := TextToFloat(PChar(S), Value, fvDouble);
+  Result := TextToFloat(PChar(S), Value, fvDouble,FormatSettings);
 End;
 End;
 
 
 {$ifdef FPC_HAS_TYPE_EXTENDED}
 {$ifdef FPC_HAS_TYPE_EXTENDED}
@@ -1087,7 +1087,7 @@ end;
 
 
 Function TryStrToFloat(Const S : String; Var Value: Extended; Const FormatSettings: TFormatSettings): Boolean;
 Function TryStrToFloat(Const S : String; Var Value: Extended; Const FormatSettings: TFormatSettings): Boolean;
 Begin
 Begin
-  Result := TextToFloat(PChar(S), Value);
+  Result := TextToFloat(PChar(S), Value,FormatSettings);
 End;
 End;
 {$endif FPC_HAS_TYPE_EXTENDED}
 {$endif FPC_HAS_TYPE_EXTENDED}
 
 
@@ -1099,12 +1099,14 @@ const
   maxdigits = 14;
   maxdigits = 14;
 {$endif}
 {$endif}
 
 
-Function FloatToStrFIntl(const Value; format: TFloatFormat; Precision, Digits: Integer; ValueType: TFloatValue): String;
+Function FloatToStrFIntl(const Value; format: TFloatFormat; Precision, Digits: Integer; ValueType: TFloatValue; Const FormatSettings: TFormatSettings): String;
 Var
 Var
   P: Integer;
   P: Integer;
   Negative, TooSmall, TooLarge: Boolean;
   Negative, TooSmall, TooLarge: Boolean;
-
+  DS: Char;
+  
 Begin
 Begin
+  DS:=FormatSettings.DecimalSeparator;
   Case format Of
   Case format Of
 
 
     ffGeneral:
     ffGeneral:
@@ -1140,13 +1142,13 @@ Begin
           end;
           end;
           P := Pos('.', Result);
           P := Pos('.', Result);
           if P<>0 then
           if P<>0 then
-            Result[P] := DecimalSeparator;
+            Result[P] := DS;
           TooLarge :=(P > Precision + 1) or (Pos('E', Result)<>0);
           TooLarge :=(P > Precision + 1) or (Pos('E', Result)<>0);
         End;
         End;
 
 
         If TooSmall Or TooLarge Then
         If TooSmall Or TooLarge Then
           begin
           begin
-            Result := FloatToStrFIntl(Value, ffExponent, Precision, Digits, ValueType);
+            Result := FloatToStrFIntl(Value, ffExponent, Precision, Digits, ValueType,FormatSettings);
             // Strip unneeded zeroes.
             // Strip unneeded zeroes.
             P:=Pos('E',result)-1;
             P:=Pos('E',result)-1;
             If P<>-1 then
             If P<>-1 then
@@ -1159,7 +1161,7 @@ Begin
                     system.Delete(Result,P,1);
                     system.Delete(Result,P,1);
                     Dec(P);
                     Dec(P);
                   end;
                   end;
-                If (P>0) and (Result[P]=DecimalSeparator) Then
+                If (P>0) and (Result[P]=DS) Then
                   begin
                   begin
                     system.Delete(Result,P,1);
                     system.Delete(Result,P,1);
                     Dec(P);
                     Dec(P);
@@ -1183,7 +1185,7 @@ Begin
             P := Length(Result);
             P := Length(Result);
             While (P>0) and (Result[P] = '0') Do
             While (P>0) and (Result[P] = '0') Do
               Dec(P);
               Dec(P);
-            If (P>0) and (Result[P]=DecimalSeparator) Then
+            If (P>0) and (Result[P]=DS) Then
               Dec(P);
               Dec(P);
             SetLength(Result, P);
             SetLength(Result, P);
           end;
           end;
@@ -1211,9 +1213,9 @@ Begin
         while Result[1] = ' ' do
         while Result[1] = ' ' do
           System.Delete(Result, 1, 1);
           System.Delete(Result, 1, 1);
         if Result[1] = '-' then
         if Result[1] = '-' then
-          Result[3] := DecimalSeparator
+          Result[3] := DS
         else
         else
-          Result[2] := DecimalSeparator;
+          Result[2] := DS;
         if Digits < 4 then
         if Digits < 4 then
           begin
           begin
             P:=Pos('E',Result);
             P:=Pos('E',Result);
@@ -1256,7 +1258,7 @@ Begin
         If Result[1] = ' ' Then
         If Result[1] = ' ' Then
           System.Delete(Result, 1, 1);
           System.Delete(Result, 1, 1);
         P := Pos('.', Result);
         P := Pos('.', Result);
-        If P <> 0 Then Result[P] := DecimalSeparator;
+        If P <> 0 Then Result[P] := DS;
       End;
       End;
 
 
     ffNumber:
     ffNumber:
@@ -1281,13 +1283,13 @@ Begin
         If Result[1] = ' ' Then System.Delete(Result, 1, 1);
         If Result[1] = ' ' Then System.Delete(Result, 1, 1);
         P := Pos('.', Result);
         P := Pos('.', Result);
         If P <> 0 Then
         If P <> 0 Then
-          Result[P] := DecimalSeparator
+          Result[P] := DS
         else
         else
           P := Length(Result)+1;
           P := Length(Result)+1;
         Dec(P, 3);
         Dec(P, 3);
         While (P > 1) Do
         While (P > 1) Do
         Begin
         Begin
-          If Result[P - 1] <> '-' Then Insert(ThousandSeparator, Result, P);
+          If Result[P - 1] <> '-' Then Insert(FormatSettings.ThousandSeparator, Result, P);
           Dec(P, 3);
           Dec(P, 3);
         End;
         End;
       End;
       End;
@@ -1295,7 +1297,7 @@ Begin
     ffCurrency:
     ffCurrency:
 
 
       Begin
       Begin
-        If Digits = -1 Then Digits := CurrencyDecimals
+        If Digits = -1 Then Digits := FormatSettings.CurrencyDecimals
         Else If Digits > 18 Then Digits := 18;
         Else If Digits > 18 Then Digits := 18;
         case ValueType of
         case ValueType of
           fvDouble:
           fvDouble:
@@ -1315,37 +1317,37 @@ Begin
         if Negative then
         if Negative then
           System.Delete(Result, 1, 1);
           System.Delete(Result, 1, 1);
         P := Pos('.', Result);
         P := Pos('.', Result);
-        If P <> 0 Then Result[P] := DecimalSeparator;
+        If P <> 0 Then Result[P] := DS;
         Dec(P, 3);
         Dec(P, 3);
         While (P > 1) Do
         While (P > 1) Do
         Begin
         Begin
-          Insert(ThousandSeparator, Result, P);
+          Insert(FormatSettings.ThousandSeparator, Result, P);
           Dec(P, 3);
           Dec(P, 3);
         End;
         End;
 
 
         If Not Negative Then
         If Not Negative Then
         Begin
         Begin
-          Case CurrencyFormat Of
-            0: Result := CurrencyString + Result;
-            1: Result := Result + CurrencyString;
-            2: Result := CurrencyString + ' ' + Result;
-            3: Result := Result + ' ' + CurrencyString;
+          Case FormatSettings.CurrencyFormat Of
+            0: Result := FormatSettings.CurrencyString + Result;
+            1: Result := Result + FormatSettings.CurrencyString;
+            2: Result := FormatSettings.CurrencyString + ' ' + Result;
+            3: Result := Result + ' ' + FormatSettings.CurrencyString;
           End
           End
         End
         End
         Else
         Else
         Begin
         Begin
           Case NegCurrFormat Of
           Case NegCurrFormat Of
-            0: Result := '(' + CurrencyString + Result + ')';
-            1: Result := '-' + CurrencyString + Result;
-            2: Result := CurrencyString + '-' + Result;
-            3: Result := CurrencyString + Result + '-';
-            4: Result := '(' + Result + CurrencyString + ')';
-            5: Result := '-' + Result + CurrencyString;
-            6: Result := Result + '-' + CurrencyString;
-            7: Result := Result + CurrencyString + '-';
-            8: Result := '-' + Result + ' ' + CurrencyString;
-            9: Result := '-' + CurrencyString + ' ' + Result;
-            10: Result := CurrencyString + ' ' + Result + '-';
+            0: Result := '(' + FormatSettings.CurrencyString + Result + ')';
+            1: Result := '-' + FormatSettings.CurrencyString + Result;
+            2: Result := FormatSettings.CurrencyString + '-' + Result;
+            3: Result := FormatSettings.CurrencyString + Result + '-';
+            4: Result := '(' + Result + FormatSettings.CurrencyString + ')';
+            5: Result := '-' + Result + FormatSettings.CurrencyString;
+            6: Result := Result + '-' + FormatSettings.CurrencyString;
+            7: Result := Result + FormatSettings.CurrencyString + '-';
+            8: Result := '-' + Result + ' ' + FormatSettings.CurrencyString;
+            9: Result := '-' + FormatSettings.CurrencyString + ' ' + Result;
+            10: Result := FormatSettings.CurrencyString + ' ' + Result + '-';
           End;
           End;
         End;
         End;
       End;
       End;
@@ -1356,7 +1358,7 @@ End;
 {$ifdef FPC_HAS_TYPE_EXTENDED}
 {$ifdef FPC_HAS_TYPE_EXTENDED}
 Function FloatToStr(Value: Extended; Const FormatSettings: TFormatSettings): String;
 Function FloatToStr(Value: Extended; Const FormatSettings: TFormatSettings): String;
 Begin
 Begin
-  Result := FloatToStrFIntl(Value, ffGeneral, 15, 0, fvExtended);
+  Result := FloatToStrFIntl(Value, ffGeneral, 15, 0, fvExtended,FormatSettings);
 End;
 End;
 
 
 
 
@@ -1370,7 +1372,7 @@ end;
 
 
 Function FloatToStr(Value: Currency; Const FormatSettings: TFormatSettings): String;
 Function FloatToStr(Value: Currency; Const FormatSettings: TFormatSettings): String;
 Begin
 Begin
-  Result := FloatToStrFIntl(Value, ffGeneral, 15, 0, fvCurrency);
+  Result := FloatToStrFIntl(Value, ffGeneral, 15, 0, fvCurrency,FormatSettings);
 End;
 End;
 
 
 
 
@@ -1386,7 +1388,7 @@ var
   e: Extended;
   e: Extended;
 Begin
 Begin
   e := Value;
   e := Value;
-  Result := FloatToStrFIntl(e, ffGeneral, 15, 0, fvDouble);
+  Result := FloatToStrFIntl(e, ffGeneral, 15, 0, fvDouble,FormatSettings);
 End;
 End;
 
 
 
 
@@ -1402,7 +1404,7 @@ var
   e: Extended;
   e: Extended;
 Begin
 Begin
   e := Value;
   e := Value;
-  Result := FloatToStrFIntl(e, ffGeneral, 15, 0, fvSingle);
+  Result := FloatToStrFIntl(e, ffGeneral, 15, 0, fvSingle,FormatSettings);
 End;
 End;
 
 
 
 
@@ -1418,7 +1420,7 @@ var
   e: Extended;
   e: Extended;
 Begin
 Begin
   e := Value;
   e := Value;
-  Result := FloatToStrFIntl(e, ffGeneral, 15, 0, fvComp);
+  Result := FloatToStrFIntl(e, ffGeneral, 15, 0, fvComp,FormatSettings);
 End;
 End;
 
 
 
 
@@ -1442,7 +1444,7 @@ var
 
 
 Begin
 Begin
   e := Comp(Value);
   e := Comp(Value);
-  Result := FloatToStrFIntl(e, ffGeneral, 15, 0, fvComp);
+  Result := FloatToStrFIntl(e, ffGeneral, 15, 0, fvComp,FormatSettings);
 End;
 End;
 {$endif FPC_COMP_IS_INT64}
 {$endif FPC_COMP_IS_INT64}
 
 
@@ -1451,7 +1453,7 @@ Function FloatToText(Buffer: PChar; Value: Extended; format: TFloatFormat; Preci
 Var
 Var
   Tmp: String[40];
   Tmp: String[40];
 Begin
 Begin
-  Tmp := FloatToStrF(Value, format, Precision, Digits);
+  Tmp := FloatToStrF(Value, format, Precision, Digits,FormatSettings);
   Result := Length(Tmp);
   Result := Length(Tmp);
   Move(Tmp[1], Buffer[0], Result);
   Move(Tmp[1], Buffer[0], Result);
 End;
 End;
@@ -1467,7 +1469,7 @@ end;
 {$ifdef FPC_HAS_TYPE_EXTENDED}
 {$ifdef FPC_HAS_TYPE_EXTENDED}
 Function FloatToStrF(Value: Extended; format: TFloatFormat; Precision, Digits: Integer; Const FormatSettings: TFormatSettings): String;
 Function FloatToStrF(Value: Extended; format: TFloatFormat; Precision, Digits: Integer; Const FormatSettings: TFormatSettings): String;
 begin
 begin
-  Result := FloatToStrFIntl(value,format,precision,digits,fvExtended);
+  Result := FloatToStrFIntl(value,format,precision,digits,fvExtended,FormatSettings);
 end;
 end;
 
 
 
 
@@ -1481,7 +1483,7 @@ end;
 
 
 Function FloatToStrF(Value: Currency; format: TFloatFormat; Precision, Digits: Integer; Const FormatSettings: TFormatSettings): String;
 Function FloatToStrF(Value: Currency; format: TFloatFormat; Precision, Digits: Integer; Const FormatSettings: TFormatSettings): String;
 begin
 begin
-  Result := FloatToStrFIntl(value,format,precision,digits,fvCurrency);
+  Result := FloatToStrFIntl(value,format,precision,digits,fvCurrency,FormatSettings);
 end;
 end;
 
 
 
 
@@ -1497,7 +1499,7 @@ var
   e: Extended;
   e: Extended;
 begin
 begin
   e := Value;
   e := Value;
-  result := FloatToStrFIntl(e,format,precision,digits,fvDouble);
+  result := FloatToStrFIntl(e,format,precision,digits,fvDouble,FormatSettings);
 end;
 end;
 
 
 
 
@@ -1514,7 +1516,7 @@ var
   e: Extended;
   e: Extended;
 begin
 begin
   e:=Value;
   e:=Value;
-  result := FloatToStrFIntl(e,format,precision,digits,fvSingle);
+  result := FloatToStrFIntl(e,format,precision,digits,fvSingle,FormatSettings);
 end;
 end;
 
 
 
 
@@ -1531,7 +1533,7 @@ var
   e: Extended;
   e: Extended;
 begin
 begin
   e := Value;
   e := Value;
-  Result := FloatToStrFIntl(e,format,precision,digits,fvComp);
+  Result := FloatToStrFIntl(e,format,precision,digits,fvComp,FormatSettings);
 end;
 end;
 
 
 
 
@@ -1549,7 +1551,7 @@ var
   e: Extended;
   e: Extended;
 begin
 begin
   e := Comp(Value);
   e := Comp(Value);
-  result := FloatToStrFIntl(e,format,precision,digits,fvComp);
+  result := FloatToStrFIntl(e,format,precision,digits,fvComp,FormatSettings);
 end;
 end;
 
 
 
 
@@ -1564,14 +1566,14 @@ end;
 Function CurrToStrF(Value: Currency; Format: TFloatFormat; Digits: Integer; Const FormatSettings: TFormatSettings): string;
 Function CurrToStrF(Value: Currency; Format: TFloatFormat; Digits: Integer; Const FormatSettings: TFormatSettings): string;
 
 
 begin
 begin
-  result:=FloatToStrF(Value,Format,19,Digits);
+  result:=FloatToStrF(Value,Format,19,Digits,FormatSettings);
 end;
 end;
 
 
 
 
 Function CurrToStrF(Value: Currency; Format: TFloatFormat; Digits: Integer): string;
 Function CurrToStrF(Value: Currency; Format: TFloatFormat; Digits: Integer): string;
 
 
 begin
 begin
-  Result:=CurrToStrF(Value,Format,Digits);
+  Result:=CurrToStrF(Value,Format,Digits,DefaultFormatSettings);
 end;
 end;
 
 
 
 
@@ -1697,9 +1699,14 @@ begin
     Result:=false;
     Result:=false;
 end;
 end;
 
 
-
 Function FloatToTextFmt(Buffer: PChar; Value: Extended; format: PChar): Integer;
 Function FloatToTextFmt(Buffer: PChar; Value: Extended; format: PChar): Integer;
 
 
+begin
+  Result:=FloatToTextFmt(Buffer,Value,Format,DefaultFormatSettings);
+end;
+
+Function FloatToTextFmt(Buffer: PChar; Value: Extended; format: PChar;FormatSettings : TFormatSettings): Integer;
+
 Var
 Var
   Digits: String[40];                         { String Of Digits                 }
   Digits: String[40];                         { String Of Digits                 }
   Exponent: String[8];                        { Exponent strin                   }
   Exponent: String[8];                        { Exponent strin                   }
@@ -2075,7 +2082,7 @@ Var
                     Begin
                     Begin
                     If (DigitExponent Mod 3 = 0) And (DigitExponent>0) Then
                     If (DigitExponent Mod 3 = 0) And (DigitExponent>0) Then
                       Begin
                       Begin
-                      Buf[0] := ThousandSeparator;
+                      Buf[0] := FormatSettings.ThousandSeparator;
                       Inc(Buf);
                       Inc(Buf);
                       End;
                       End;
                     Dec(DigitExponent);
                     Dec(DigitExponent);
@@ -2086,13 +2093,13 @@ Var
               If (Digits[Dig]<>' ') Then
               If (Digits[Dig]<>' ') Then
                 Begin
                 Begin
                 If (Digits[Dig]='.') Then
                 If (Digits[Dig]='.') Then
-                  Buf[0] := DecimalSeparator
+                  Buf[0] := FormatSettings.DecimalSeparator
                 Else
                 Else
                   Buf[0] := Digits[Dig];
                   Buf[0] := Digits[Dig];
                 Inc(Buf);
                 Inc(Buf);
                 If thousand And (DigitExponent Mod 3 = 0) And (DigitExponent > 0) Then
                 If thousand And (DigitExponent Mod 3 = 0) And (DigitExponent > 0) Then
                   Begin
                   Begin
-                  Buf[0] := ThousandSeparator;
+                  Buf[0] := FormatSettings.ThousandSeparator;
                   Inc(Buf);
                   Inc(Buf);
                   End;
                   End;
                 End;
                 End;
@@ -2158,13 +2165,13 @@ Begin
     GetSectionRange(3);
     GetSectionRange(3);
   If FmtStart = Nil Then
   If FmtStart = Nil Then
     Begin
     Begin
-    Result := FloatToText(Buffer, Value, ffGeneral, 15, 4);
+    Result := FloatToText(Buffer, Value, ffGeneral, 15, 4, FormatSettings);
     End
     End
   Else
   Else
     Begin
     Begin
     GetFormatOptions;
     GetFormatOptions;
     If (ExpFmt = 0) And (Abs(Value) >= 1E18) Then
     If (ExpFmt = 0) And (Abs(Value) >= 1E18) Then
-      Result := FloatToText(Buffer, Value, ffGeneral, 15, 4)
+      Result := FloatToText(Buffer, Value, ffGeneral, 15, 4, FormatSettings)
     Else
     Else
       Begin
       Begin
       FloatToStr;
       FloatToStr;
@@ -2301,7 +2308,7 @@ Var
   buf : Array[0..1024] of char;
   buf : Array[0..1024] of char;
 
 
 Begin
 Begin
-  Buf[FloatToTextFmt(@Buf[0],Value,Pchar(Format))]:=#0;
+  Buf[FloatToTextFmt(@Buf[0],Value,Pchar(Format),FormatSettings)]:=#0;
   Result:=StrPas(@Buf[0]);
   Result:=StrPas(@Buf[0]);
 End;
 End;
 
 
@@ -2313,7 +2320,7 @@ end;
 
 
 Function FormatCurr(const Format: string; Value: Currency; Const FormatSettings: TFormatSettings): string;
 Function FormatCurr(const Format: string; Value: Currency; Const FormatSettings: TFormatSettings): string;
 begin
 begin
-  Result := FormatFloat(Format, Value);
+  Result := FormatFloat(Format, Value,FormatSettings);
 end;
 end;
 
 
 function FormatCurr(const Format: string; Value: Currency): string;
 function FormatCurr(const Format: string; Value: Currency): string;

+ 1 - 0
rtl/objpas/sysutils/sysstrh.inc

@@ -196,6 +196,7 @@ function TryStrToBool(const S: string; out Value: Boolean): Boolean;
 
 
 function LastDelimiter(const Delimiters, S: string): Integer;
 function LastDelimiter(const Delimiters, S: string): Integer;
 function StringReplace(const S, OldPattern, NewPattern: string;  Flags: TReplaceFlags): string;
 function StringReplace(const S, OldPattern, NewPattern: string;  Flags: TReplaceFlags): string;
+Function FloatToTextFmt(Buffer: PChar; Value: Extended; format: PChar; FormatSettings : TFormatSettings): Integer;
 Function FloatToTextFmt(Buffer: PChar; Value: Extended; format: PChar): Integer;
 Function FloatToTextFmt(Buffer: PChar; Value: Extended; format: PChar): Integer;
 Procedure FloatToDecimal(Out Result: TFloatRec; const Value; ValueType: TFloatValue; Precision, Decimals : integer);
 Procedure FloatToDecimal(Out Result: TFloatRec; const Value; ValueType: TFloatValue; Precision, Decimals : integer);
 Procedure FloatToDecimal(Out Result: TFloatRec; Value: Extended; Precision, Decimals : integer);
 Procedure FloatToDecimal(Out Result: TFloatRec; Value: Extended; Precision, Decimals : integer);