pTAL Reference Manual (G06.24+, H06.09+, J06.03+)

Example 202 Function With Value and Reference Formal Parameters
PROC mult (var1, var2);
INT var1, ! Value parameter
.var2; ! Reference parameter
BEGIN
var2 := var2 + var1; ! Manipulate parameters
END;
Example 203 Reference Structure as a Formal Reference Parameter
STRUCT template (*); ! Template structure
BEGIN
INT a;
INT b;
END;
PROC .EXT p;
STRUCT ref_struct (template);
BEGIN
! Lots of code
END;
Topics:
Using STRUCT as a Formal Parameter (page 255)
Passing an Extended Address Parameter to a Non-EXTENDED Reference Parameter (page 255)
Using the PROC Formal Parameter (page 256)
Referencing Parameters (page 256)
Using STRUCT as a Formal Parameter
You cannot declare a definition STRUCT as a formal parameter. You can, however, achieve the
same effect by using a referral STRUCT as a formal parameter, and having it reference a previously
declared structure.
Example 204 Using a Referral STRUCT as a Formal Parameter
INT .EXT ea;
INT .EXT32 e32a;
INT .EXT64 e64a;
PROC p(a);
INT .a;
BEGIN
...
END;
...
p(ea); ! OKAY
p(e32a); ! OKAY
p(e64a); ! ERROR: EXT64ADDR not assignment compatible with WADDR.
Passing an Extended Address Parameter to a Non-EXTENDED Reference Parameter
You can pass a variable declared with a .EXT or .EXT32 indirection symbol to a formal parameter
declared with a . indirection symbol. pTAL converts the extended address to a BADDR or WADDR,
as appropriate. In the following example, pTAL converts the extended address of I to a WADDR
address:
Formal Parameter Specification 255