[fpc-devel] FmtBCD unit improvements / bugs

LacaK lacak at zoznam.sk
Mon Mar 14 09:37:56 CET 2011


Hi,
I would like to ask somebody to look at these bug reports:

1. http://bugs.freepascal.org/view.php?id=18388
This bug report contains implementation of missing BcdToStrF function.
There is also discussion if FmtBCD unit is localized ... tests under 
Delphi (6,10) shows, that Delphi *uses* global variables 
DecimalSeparator (in StrToBCD, BCDToStr, BCDToStrF) and 
ThousandSeparator (in BCDToStrF).

2. http://bugs.freepascal.org/view.php?id=18807
If fix in bug report (1) will be applied, then I can continue by adding 
overloaded functions
TryStrToBCD, StrToBCD, BCDToStr with next parameter const Format: 
TFormatSettings (in style of TryStrToFloat etc. and also in Delphi 
compatible way)
and drop global variable DecimalPoint
and replace its using by either DefaultFormatSettings (when used 
function without Format parameter) or supplied Format parameter. So it 
will be something like this:

  function TryStrToBCD ( const aValue : FmtBCDStringtype;   // <--- here 
is not specified Format, so use DefaultFormatSettings
                           var BCD : tBCD ) : Boolean;
  begin
    Result:=TryStrToBCD(aValue, BCD, DefaultFormatSettings);
  end;

  function TryStrToBCD ( const aValue : FmtBCDStringtype;
                           var BCD : tBCD;
                         const Format: TFormatSettings  ) : Boolean;  // 
<--- here is explicitly specified Format, so use it
 ...
 //here use Format.DecimalSeparator , Format.ThousandSeparator
...

I would like if we make progress in this, because then we can continue 
with other task related to this.
Please let me know if you agree with this direction and if yes, then 
please apply fix in (1) and then I will prepare fix for (2)
Thanks
-Laco.




More information about the fpc-devel mailing list