Re: [fpc-pascal] Currency constant wrongly stored in generated EXE?

2014-05-13 Thread Bruno Krayenbuhl
Lets restate the hole thing, considering unit ncon.pas and pexpr.pas units 
in FPC 2.6.4

compiler.

1° It is not possible, without using some ad hoc adjustements, to have
always an EXACT CURRENCY stored in a DOUBLE or EXTENDED because Double or
Extended being expressed as Sign*2^exp*Base2(n). Just start with 0.1 to see
what I mean.

2° trealconstnode class stores the currency_literal value to value_real
(type bestreal) then converts it to value_currency either in the
trealconstnode.create or sets it in pexpr.pas  function
factor(getaddr,typeonly:boolean) : tnode; just after {$ifdef
FPC_HAS_STR_CURRENCY}

3° c:=92233720368547; // The original problem
multiple operations involve *1 (OK per see) and /1 (not so good)
while parsing the constant to bestreal type before generating .EXE code.
(bestreal is Extended on Intel I386 and Up and Double on ARM).

4° The compiler will not compain about Currency_Value:=0.9 whereas the
max decimal precision is 0. for decimal part.

5° What I found is that only + or - operations on Currency's giving a
Currency will be generated with plain Int64 addition and subtractions.

Now what ?

It would be interesting that someone who has an ARM based machine/compiler 
do

some testing.

Since currency is a very good type for accounting, you know
Sum(Assets)-Sum(Liabilities)=Sum(Incomes)-Sum(Costs) - hopefully benefit 
and exact,

some workarounds must be found.
A basic way to circumvent the risks when absolutly necessary would be 
something like what is decribed next, not very Pascal clean I must admit :


- Insure that the compiler will not see a literal currency when assigning or
calculating  a precise value containing a literal currency value.

so short example, look at the ASM code generated.

var
c: currency;
lInt64:Int64 absolute c; // Avoid use of Currency
begin
 c:=0.9; // Accepted by the compiler ... and rounded to 1
 c:=0.99986; // Accepted by the compiler ... and rounded to 0.
 c:=0.99984; // Accepted by the compiler ... and rounded to 0.9998
 { The easy way but uses the FPU }
 c:=92233720368547; // - that might be wrongly evaluated by the Compiler 
(FPU usage) but nothing will be visible in the generated ASM regarding FPU 
evaluation, except in your case, an invalid HEX value

 c:=c+0.01; // - uses FPU
 writeln('c+0.01 with FPU=', c);
 { Clumsy but no FPU usage while compiling and executing }
 lInt64:=92233720368547; // - You can test but my bet is that it 
probably always correctly evaluated by the compiler

 lInt64:=lInt64+100; // Equivalent to c:=c+0.01
 writeln('c+0.01 indirect no FPU=', c);
 readln;
end;

Your subject has been interesting and I'll be careful now with rounding and 
Currency.


Regard Bruno.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] EventLog and error No member is provided to access property

2014-05-13 Thread silvioprog
Hello,
I'm trying to set a own instance in EventLog property of all apps
like TCustomHttpApplication, TCustomCGIApplication
and TCustomFCGIApplication, but, no success.

To get the error, try:

TMyHttpApplication = class(TCustomHttpApplication)
...

constructor TMyHttpApplication.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  EventLog := TMyEventLog.Create(Self);
...

I saw this code:

  TCustomWebApplication = Class(TCustomApplication)
...
  Public
Property EventLog: TEventLog read GetEventLog;

Seems good changing it to:

Property EventLog: TEventLog read GetEventLog write FEventLog;

So the code below will get my own instance instead of default instance:

function TCustomWebApplication.GetEventLog: TEventLog;
begin
  if not assigned(FEventLog) then
begin
FEventLog := TEventLog.Create(Nil);
FEventLog.Name:=Self.Name+'Logger';
FEventLog.Identification:=Title;
FEventLog.RegisterMessageFile(ParamStr(0));
FEventLog.LogType:=ltSystem;
FEventLog.Active:=True;
end;
  Result := FEventLog;
end;

Thank you!

P.S.: Lazarus 1.2.2 r44758 FPC 2.6.4 i386-win32-win32/win64

--
Silvio Clécio
My public projects - github.com/silvioprog
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] 2.6.4 RPM and Deb archives are still in preparation?

2014-05-13 Thread Mattias Gaertner
Hi,

The download mirrors shows The 2.6.4 RPM and Deb archives are
still in preparation.

Are they still?

For example:
http://www.freepascal.org/down/i386/linux-australia.var

Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] 2.6.4 RPM and Deb archives are still in preparation?

2014-05-13 Thread Tomas Hajny
On Wed, May 14, 2014 00:46, Mattias Gaertner wrote:


Hi,

 The download mirrors shows The 2.6.4 RPM and Deb archives are
 still in preparation.

 Are they still?

 For example:
 http://www.freepascal.org/down/i386/linux-australia.var

Good question, but I have an even better one - why the list still contains
the non-existing mirrors after I already tried to remove them from the
list. :-( We'll need to have a look at it...

Tomas


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] [ANN] Brook 3.0.0 release!

2014-05-13 Thread silvioprog
The Brook team is glad to announce the release 3.0.0.

This version was compiled and tested successfully with Free Pascal 2.6.4.
Here is the list of changes between version 2.6.4 and 3.0.0 of the Brook:

https://github.com/silvioprog/brookframework/compare/57f8e01868dbec9708129bc789940df2a93c1637...v3.0.0
(or
short URL here:http://goo.gl/kr9oX0)

The release is available for download on Github:

https://github.com/silvioprog/brookframework/releases/tag/v3.0.0

Or through the Latest Release button on the project home page:

http://silvioprog.github.io/brookframework/

Minimum requirements:

Free Pascal 2.6.4. If you prefer the Lazarus interface, choose the 1.2.2
version.

Enjoy!

-- 
Silvio Clécio
My public projects - github.com/silvioprog
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] How to get GO32 Unit file

2014-05-13 Thread nitinjain
Hi,

could you please tell me, from where I can download Go32 Unit file?


Nitin



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/How-to-get-GO32-Unit-file-tp5719211.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal