RE: BASIC Accelerator 0.9公開 (2009-10-19 05:35 by ukimiku #46510)
Thanks for the Basic Accelerator. It compiles "amicable.bas" correctly, but does not compile "Julia.bas" in the same folder.
The Free Pascal Compiler says:
Free Pascal Compiler version 2.2.4 [2009/10/18] for i386
Copyright (c) 1993-2008 by Florian Klaempfl
NoName.lpr(38,9) Fatal: Syntax error, "EXCEPT" expected but "," found
Fatal: Compilation aborted
I include the intermediate program text:
program NoName;
{$MODE delphi}{$H+}
uses
Forms,SysUtils,fileutil,math,Dialogs,Controls,
base,base2,datalist,textfile,math2sub,arrays,
windows,winlib,
textfrm,locatefrm,affine,graphsys,gridaxes,graphlib,baslib;
var _T0:double;
var _A:double;
var _B:double;
var _LEFT:double;
var _RIGHT:double;
var _H:double;
var _PX:double;
var _PY:double;
var _U:double;
var _V:double;
var _X1:double;
var _Y1:double;
var _N:double;
var _X:double;
var _Y:double;
var __own1_00000:double;
var __own2_00001:double;
var __own1_00001:double;
var __own2_00002:double;
var __own1_00002:double;
var __own2_00003:double;
Label L19;
begin {Main Program}
init( true , true , false ,BMP801);
try
try
// LET t0=TIME
_T0 := mytime ;
// LET a=-0.2
_A := -0,2;
// LET b=0.75
_B := 0,75;
// LET left = -1.4 ! left
_LEFT := -1,3999999999999999;
// LET right = 1.4 ! right
_RIGHT := 1,3999999999999999;
// LET h = (right - left) ! height
_H := _RIGHT-(_LEFT);
// SET WINDOW left,right,-h/2,h/2
SetWindow(_LEFT,_RIGHT, - ((_H)/2),(_H)/2, false );
// DRAW axes
MyGraphSys.beam:=MyGraphSys.beam and (MyGraphSys.BeamMode=bmImmortal);
drawaxes2(1,1);MyGraphSys.beam:=MyGraphSys.beam and (MyGraphSys.BeamMode=bmImmortal);
// ASK PIXEL SIZE(left,-h/2;right,h/2) px,py
AskPixelsize(_LEFT, - ((_H)/2),_RIGHT,(_H)/2,_PX,_PY);
// LET px=px-1
_PX := _PX-1;
// LET py=py-1
_PY := _PY-1;
// SET POINT STYLE 1
setpointstyle(1, false );
// FOR u= left TO right step (right-left)/px
__own1_00000 := _RIGHT ;
__own2_00001 := (_RIGHT-(_LEFT))/(_PX) ;
_U := _LEFT ;
while sign(_U - __own1_00000) * sign(__own2_00001)<=0 do begin
// FOR v = -h/2 to h/2 step h/py
__own1_00001 := (_H)/2 ;
__own2_00002 := (_H)/(_PY) ;
_V := - ((_H)/2) ;
while sign(_V - __own1_00001) * sign(__own2_00002)<=0 do begin
// LET x1 = u
_X1 := _U;
// LET y1 = v
_Y1 := _V;
// FOR n = 1 TO 1000
__own1_00002 := 1000 ;
_N := 1 ;
while (_N <= __own1_00002) do begin
// LET x = x1
_X := _X1;
// LET y = y1
_Y := _Y1;
// LET x1 = x*x - y*y + a
_X1 := (_X)*(_X)-((_Y)*(_Y))+_A;
// LET y1 = 2 * x * y + b
_Y1 := (2*(_X))*(_Y)+_B;
// IF x1^2+y1^2>4 THEN EXIT FOR ! determine to divergent
if sqr(_X1)+sqr(_Y1)>4 then
begin
goto L19;
end
else
begin
end;
// NEXT n
_N := _N + 1 ;
end;L19:
// IF n>1000 THEN PLOT POINTS: u,v
if _N>1000 then
begin
PlotPoints([_U,_V]);
end
else
begin
end;
// NEXT v
_V := _V + __own2_00002 ;
end;
// NEXT u
_U := _U + __own2_00001 ;
end;
// PRINT TIME -t0
console.PRINT([],rsNone, false ,[mytime -(_T0), TNewLine.create ]);
// END
finally
end;
except
on E:ESTOP do;
on E:Exception do MessageDlg(EXMess(E,excode), mtError, [mbOK], 0);
end;
TextForm.StatusBar1.Panels[1].text:='Finished';Application.Run;
end.
RE: BASIC Accelerator 0.9公開 (2009-10-19 15:19 by shiraishikazuo #46520)
Decmal point "." is translated to ",".
The following is a concerned section.
// LET a=-0.2
_A := -0,2;
// LET b=0.75
_B := 0,75;
// LET left = -1.4 ! left
_LEFT := -1,3999999999999999;
// LET right = 1.4 ! right
_RIGHT := 1,3999999999999999;
These are the results of the code
function Format17(x:double):String;
begin
result:=SysUtils.Format('%.17g', [x]);
end;
It seemes that FPC's function 'Format' changes '.' to ',' on some localized edition of Windows.
RE: BASIC Accelerator 0.9公開 (2009-10-19 22:48 by ukimiku #46536)
Thanks. I use a German version of Windows vista (Finnish, Italien and French users will have the same problem if their Windows system is configured to use the pre-installed locale settings). I could change the number format to the English format in Windows regional settings, and now also "Julia.bas" compiles correctly. It is much faster now, over 12 times as fast as the interpreted version. Thanks, this is great! :)