mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 00:50:28 +02:00
* splitted in 2 files, one fpc mode and other tp mode
This commit is contained in:
parent
624e5bd699
commit
c8cb58038b
84
tests/test/cg/taddr1.pp
Normal file
84
tests/test/cg/taddr1.pp
Normal file
@ -0,0 +1,84 @@
|
||||
{****************************************************************}
|
||||
{ CODE GENERATOR TEST PROGRAM }
|
||||
{****************************************************************}
|
||||
{ NODE TESTED : secondaddr() }
|
||||
{****************************************************************}
|
||||
{ PRE-REQUISITES: secondload() }
|
||||
{ secondassign() }
|
||||
{ secondcalln() }
|
||||
{****************************************************************}
|
||||
{ DEFINES: }
|
||||
{****************************************************************}
|
||||
{ REMARKS: }
|
||||
{****************************************************************}
|
||||
program taddr;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode fpc}
|
||||
{$endif}
|
||||
|
||||
procedure testprocvar;
|
||||
begin
|
||||
WriteLn('Hello world!');
|
||||
end;
|
||||
|
||||
type
|
||||
tmyobj = object
|
||||
procedure writeit;
|
||||
end;
|
||||
|
||||
|
||||
procedure tmyobj.writeit;
|
||||
begin
|
||||
WriteLn('Salutations!');
|
||||
end;
|
||||
|
||||
|
||||
const
|
||||
chararray : array[0..7] of char =
|
||||
('A',
|
||||
'B',
|
||||
'C',
|
||||
'D',
|
||||
'E',
|
||||
'F',
|
||||
'G',
|
||||
#0
|
||||
);
|
||||
|
||||
var
|
||||
procptr: procedure;
|
||||
pcharptr : pchar;
|
||||
plongint : ^longint;
|
||||
long: longint;
|
||||
ptr: pointer;
|
||||
begin
|
||||
{ Test procedure variable }
|
||||
procptr:=@testprocvar;
|
||||
Write('Value should be ''Hello world!''...');
|
||||
procptr;
|
||||
{ Test normal variable }
|
||||
pcharptr := @chararray;
|
||||
Inc(pcharptr,2);
|
||||
Write('Value should be ''CDEFG''...');
|
||||
WriteLn(pcharptr);
|
||||
long := $F0F0;
|
||||
plongint := @long;
|
||||
Write('Value should be 61680...');
|
||||
WriteLn(plongint^);
|
||||
{ Test method pointers }
|
||||
{ PROCVARLOAD = TRUE testing }
|
||||
{ Write('Value should be ''Salutations!''...');}
|
||||
ptr:=@tmyobj.writeit;
|
||||
{ ptr;}
|
||||
end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 2002-04-22 16:33:40 peter
|
||||
* splitted in 2 files, one fpc mode and other tp mode
|
||||
|
||||
Revision 1.1 2001/06/30 02:00:30 carl
|
||||
+ secondaddr() testing
|
||||
|
||||
}
|
@ -13,6 +13,9 @@
|
||||
{****************************************************************}
|
||||
program taddr;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode tp}
|
||||
{$endif}
|
||||
|
||||
procedure testprocvar;
|
||||
begin
|
||||
@ -51,7 +54,7 @@ var
|
||||
ptr: pointer;
|
||||
begin
|
||||
{ Test procedure variable }
|
||||
procptr:={$ifdef FPC}@{$endif}testprocvar;
|
||||
procptr:=testprocvar;
|
||||
Write('Value should be ''Hello world!''...');
|
||||
procptr;
|
||||
{ Test normal variable }
|
||||
@ -72,7 +75,10 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 2001-06-30 02:00:30 carl
|
||||
Revision 1.1 2002-04-22 16:33:40 peter
|
||||
* splitted in 2 files, one fpc mode and other tp mode
|
||||
|
||||
Revision 1.1 2001/06/30 02:00:30 carl
|
||||
+ secondaddr() testing
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user