mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-06 20:47:53 +02:00

of the jdk15 unit in that case) * adjusted testall.sh script so it can also be used to test class files compiled for Android (still with the JVM though) git-svn-id: branches/jvmbackend@19835 -
54 lines
1.3 KiB
ObjectPascal
54 lines
1.3 KiB
ObjectPascal
program tpvarglobal;
|
|
|
|
{$mode objfpc}
|
|
|
|
uses
|
|
{$ifdef java}jdk15{$else}androidr14{$endif};
|
|
|
|
type
|
|
tmprec = record
|
|
b: byte;
|
|
end;
|
|
|
|
tmypvar = function(x: longint; w: word; r: tmprec; var ro: tmprec): shortstring;
|
|
|
|
function test(x: longint; w: word; r: tmprec; var ro: tmprec): shortstring;
|
|
begin
|
|
jlsystem.fout.print('x: ');
|
|
jlsystem.fout.println(x);
|
|
jlsystem.fout.print('w: ');
|
|
jlsystem.fout.println(w);
|
|
jlsystem.fout.print('r.b: ');
|
|
jlsystem.fout.println(r.b);
|
|
jlsystem.fout.print('ro.b: ');
|
|
jlsystem.fout.println(ro.b);
|
|
if x<>1 then
|
|
raise jlexception.create('x wrong on input');
|
|
if w<>$ffff then
|
|
raise jlexception.create('w wrong on input');
|
|
if r.b<>21 then
|
|
raise jlexception.create('r.b wrong on input');
|
|
if ro.b<>42 then
|
|
raise jlexception.create('ro.b wrong on input');
|
|
r.b:=123;
|
|
ro.b:=123;
|
|
result:='abc';
|
|
end;
|
|
|
|
var
|
|
mypvar: tmypvar;
|
|
r, ro: tmprec;
|
|
res: shortstring;
|
|
begin
|
|
r.b:=21;
|
|
ro.b:=42;
|
|
mypvar:=@test;
|
|
res:=mypvar(1,$ffff,r,ro);
|
|
if r.b<>21 then
|
|
raise jlexception.create('r changed');
|
|
if ro.b<>123 then
|
|
raise jlexception.create('ro not changed');
|
|
if res<>'abc' then
|
|
raise jlexception.create('result wrong');
|
|
end.
|