Переглянути джерело

* implemented fpc_WideStr_Currency, fpc_chararray_Currency, fpc_Val_Currency_WideStr.

git-svn-id: trunk@5861 -
yury 18 роки тому
батько
коміт
adae4e9976
3 змінених файлів з 43 додано та 0 видалено
  1. 3 0
      rtl/inc/compproc.inc
  2. 14 0
      rtl/inc/sstrings.inc
  3. 26 0
      rtl/inc/wstrings.inc

+ 3 - 0
rtl/inc/compproc.inc

@@ -105,9 +105,11 @@ procedure fpc_WideStr_uint(v : valuint;Len : SizeInt; out S : WideString); compi
 {$endif CPU64}
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 procedure fpc_WideStr_Float(d : ValReal;len,fr,rt : SizeInt;out s : WideString); compilerproc;
+procedure fpc_WideStr_Currency(c : Currency;len,fr : SizeInt;out s : WideString);compilerproc;
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 
 procedure fpc_chararray_Float(d : ValReal;len,fr,rt : SizeInt;out a : array of char); compilerproc;
+procedure fpc_chararray_Currency(c : Currency;len,fr : SizeInt;out a : array of char);compilerproc;
 
 { Val() support }
 Function fpc_Val_Real_ShortStr(const s : shortstring; out code : ValSInt): ValReal; compilerproc;
@@ -124,6 +126,7 @@ Function fpc_Val_Currency_AnsiStr(Const S : AnsiString; out Code : ValSInt): Cur
 Function fpc_Val_Real_WideStr(Const S : WideString; out Code : ValSInt): ValReal; compilerproc;
 Function fpc_Val_UInt_WideStr (Const S : WideString; out Code : ValSInt): ValUInt; compilerproc;
 Function fpc_Val_SInt_WideStr (DestSize: SizeInt; Const S : WideString; out Code : ValSInt): ValSInt; compilerproc;
+Function fpc_Val_Currency_WideStr(Const S : WideString; out Code : ValSInt): Currency; compilerproc;
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 {$ifndef CPU64}
 Function fpc_val_int64_shortstr(Const S: ShortString; out Code: ValSInt): Int64; compilerproc;

+ 14 - 0
rtl/inc/sstrings.inc

@@ -627,6 +627,20 @@ begin
 end;
 
 
+procedure fpc_chararray_Currency(c : Currency;len,fr : SizeInt;out a : array of char);compilerproc;
+var
+  ss : shortstring;
+  maxlen : SizeInt;
+begin
+  str(c:len:fr,ss);
+  if length(ss)<high(a)+1 then
+    maxlen:=length(ss)
+  else
+    maxlen:=high(a)+1;
+  move(ss[1],pchar(@a)^,maxlen);
+end;
+
+
 {*****************************************************************************
                            Val() Functions
 *****************************************************************************}

+ 26 - 0
rtl/inc/wstrings.inc

@@ -1138,6 +1138,23 @@ begin
 end;
 
 
+Function fpc_Val_Currency_WideStr(Const S : WideString; out Code : ValSInt): Currency; [public, alias:'FPC_VAL_CURRENCY_WIDESTR']; compilerproc;
+Var
+  SS : String;
+begin
+  if length(S) > 255 then
+    begin
+      fpc_Val_Currency_WideStr:=0;
+      code := 256;
+    end
+  else
+    begin
+      SS := S;
+      Val(SS,fpc_Val_Currency_WideStr,code);
+    end;
+end;
+
+
 Function fpc_Val_UInt_WideStr (Const S : WideString; out Code : ValSInt): ValUInt; [public, alias:'FPC_VAL_UINT_WIDESTR']; compilerproc;
 Var
   SS : ShortString;
@@ -1211,6 +1228,15 @@ begin
 end;
 
 
+procedure fpc_WideStr_Currency(c : Currency;len,fr : SizeInt;out s : WideString);compilerproc;
+var
+  ss : shortstring;
+begin
+  str(c:len:fr,ss);
+  s:=ss;
+end;
+
+
 Procedure fpc_WideStr_SInt(v : ValSint; Len : SizeInt; out S : WideString);compilerproc;
 Var
   SS : ShortString;