I have compiled pascal-p5 1.3 and 1.4 with gpc-2007 on powermac g5
with osx 10.5.8, without errors.
But some of the example programs show errors, in both 1.3 and 1.4
versions, i include some test code at the end of message, sorry for the
multiple-items question, but seems better to sum up in asingle message.
I did't checked very deeply by now, without a real debugger is hard to
figure out, but can be the big endian g5 the problem? and can be the
pint rather than pcom?
I think would be usefull to have the sample programs with the relative
p-code included, (and the compiler itself in the spirit of the original
pascal-p family). This will be a quick first check for errors.
The effort to keep pascal-p compilers alive seems very good, these
compilers could be usefull on small diy systems, and in old systems as
well, maybe older then a ppc-g5.
thanks for attention
Greetings
[1] qsort.pas compile ok, run fail:
*** Runtime error [18]: Value out of range
This version of qsort run fine:
program qsort2(output); ( this version run fine in p5 )
const maxstr = 43;
type index = 1..maxstr;
strng = packed array[index] of char;
var a : strng;
{z : integer;}
i1, im : index; {++ pass this to sort }
procedure sort(var l, r: index); { use var, or fail}
var i, j : index;
x, w : char;
begin
i := l;
j := r;
x := a[(l+r) div 2]; { write(x,' '); }
repeat
while a[i] < x do i := i+1;
while x < a[j] do j := j-1;
if i <= j then begin
w := a[i]; a[i] := a[j]; a[j] := w;
i := i+1;
j := j-1
end
until i > j;
if l < j then sort(l, j);
if i < r then sort(i, r);
end;
begin
a := 'erhklhklgsdtsknsknskdlhfksghskhskeljefhjgkh';
{for z:=1 to maxstr do begin a[z]:=chr((91-z) mod 26); end;} {--
this z fail }
[3] This is another test program with the same (?) problem:
program j8(input,output);
type
st = packed array[1..5] of char;
var
a : integer;
c : char;
b : boolean;
f : real;
s : st;
procedure j1(var a: integer; var c: char; var b: boolean; var f :real;
var s:st );
begin
writeln('as vars : ',a:1,' ', c:1,' ', ord(b):1,' ',f:3:2,' ',s,' ');
end;
Hi, sorry for not seeing this sooner, I don't get back to this page a lot.
Your idea that it is due to big endian issues is a good one, I don't believe the code actually accounts (correctly) for big endian, mainly because I don't have a big endian system to check it on.
I'll see if I can go over your provided programs this weekend.
The idea about including the intermediate code is interesting. The original intent of providing it was to allow implementers to create an interpreter for the code and bootstrap it. I think it's much more likely that a bootstrapper would cross compile it or use the C code interpreter from P6.
However, its a simple and reasonable request, and I'll try to get to that.
Thanks for the feedback!
Scott Franco
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello
I have compiled pascal-p5 1.3 and 1.4 with gpc-2007 on powermac g5
with osx 10.5.8, without errors.
But some of the example programs show errors, in both 1.3 and 1.4
versions, i include some test code at the end of message, sorry for the
multiple-items question, but seems better to sum up in asingle message.
I did't checked very deeply by now, without a real debugger is hard to
figure out, but can be the big endian g5 the problem? and can be the
pint rather than pcom?
I think would be usefull to have the sample programs with the relative
p-code included, (and the compiler itself in the spirit of the original
pascal-p family). This will be a quick first check for errors.
The effort to keep pascal-p compilers alive seems very good, these
compilers could be usefull on small diy systems, and in old systems as
well, maybe older then a ppc-g5.
thanks for attention
Greetings
[1] qsort.pas compile ok, run fail:
*** Runtime error [18]: Value out of range
This version of qsort run fine:
program qsort2(output); ( this version run fine in p5 )
const maxstr = 43;
type index = 1..maxstr;
strng = packed array[index] of char;
var a : strng;
{z : integer;}
i1, im : index; {++ pass this to sort }
procedure sort(var l, r: index); { use var, or fail}
var i, j : index;
x, w : char;
begin
i := l;
j := r;
x := a[(l+r) div 2]; { write(x,' '); }
repeat
while a[i] < x do i := i+1;
while x < a[j] do j := j-1;
if i <= j then begin
w := a[i]; a[i] := a[j]; a[j] := w;
i := i+1;
j := j-1
end
until i > j;
if l < j then sort(l, j);
if i < r then sort(i, r);
end;
begin
a := 'erhklhklgsdtsknsknskdlhfksghskhskeljefhjgkh';
{for z:=1 to maxstr do begin a[z]:=chr((91-z) mod 26); end;} {--
this z fail }
end.
[2] This program show a problem in procedure calling param:
program testproc3(output);
var i, j : char;
procedure printv(var i1: char; j1: char); {++ var }
begin
writeln('caller: ',i,j);
writeln('called: ',i1,j1); { without var no values printed }
end;
procedure printc( i2: char; j2: char);
begin
writeln('caller: ',i,j);
writeln('called: ',i2,j2);
end;
begin
i:='a'; j:='b';
writeln('main: ',i,j);
printv(i, j); {err}
writeln('-----');
writeln('chars: ','c','d');
printc('c','d'); {error}
end.
RUN:
main: ab
caller: ab
called: a
chars: cd
caller: ab
called:
[3] This is another test program with the same (?) problem:
program j8(input,output);
type
st = packed array[1..5] of char;
var
a : integer;
c : char;
b : boolean;
f : real;
s : st;
procedure j1(var a: integer; var c: char; var b: boolean; var f :real;
var s:st );
begin
writeln('as vars : ',a:1,' ', c:1,' ', ord(b):1,' ',f:3:2,' ',s,' ');
end;
procedure j2( a: integer; c: char; b: boolean; f: real; s:st);
begin
writeln('as values : ',a:1,' ', c:1,' ', ord(b):1,' ',f:3:2,' ',s,' ');
end;
begin
a := 93;
c := 'k';
b := true;
f := 3.14;
s := 'alpha';
j1(a,c,b,f,s); (as var ok)
j2(a,c,b,f,s); (as values fail)
end.
RUN:
as vars : 93 k 1 3.14 alpha
as values : 93 0 3.14 alpha
[4] I run the test program standardp.pas with Pascal-P5 and
with gpc-2007 compiler, the difference file is:
diff P5/tests/standardp-out.txt gpc/tests_/standardp-out.txt
15c15
< 1
[5] fbench.pas: the errors are quite big, and some values are zero:
Stop the timer:
Marginal ray 47.08983575978 0.04179137248
Paraxial ray 47.09107747947 0.04177613733
Longitudinal spherical aberration: 0.00124171969
(Maximum permissible): 0.05305063269
Offense against sine condition (coma): 0.00004714562
(Maximum permissible): 0.00250000000
Axial chromatic aberration: 0.00000000000
(Maximum permissible): 0.05305063269
Hi, sorry for not seeing this sooner, I don't get back to this page a lot.
Your idea that it is due to big endian issues is a good one, I don't believe the code actually accounts (correctly) for big endian, mainly because I don't have a big endian system to check it on.
I'll see if I can go over your provided programs this weekend.
The idea about including the intermediate code is interesting. The original intent of providing it was to allow implementers to create an interpreter for the code and bootstrap it. I think it's much more likely that a bootstrapper would cross compile it or use the C code interpreter from P6.
However, its a simple and reasonable request, and I'll try to get to that.
Thanks for the feedback!
Scott Franco