pTAL Reference Manual (H06.03+)
LITERALs and DEFINEs
HP pTAL Reference Manual—523746-005
6-7
Passing Actual Parameters to DEFINEs
Passing Actual Parameters to DEFINEs
If the DEFINE declaration has formal parameters, supply the actual parameters when
you use the DEFINE identifier in a statement.
The number of actual parameters can be less than the number of formal parameters. If
actual parameters are missing, the corresponding formal parameters expand to empty
text. For each missing actual parameter, you can use a placeholder comma, as in
Example 6-5 on page 6-7.
If a DEFINE has formal parameters and you pass no actual parameters to the DEFINE,
you must specify an empty actual parameter list. You can include commas between the
list delimiters, but need not, as in Example 6-6 on page 6-7.
If the number of actual parameters exceeds the number of formal parameters, as in
Example 6-7 on page 6-7, the compiler issues an error.
If an actual parameter in a DEFINE invocation requires commas, enclose each comma
in apostrophes ('). An example is an actual parameter that is a parameter list, as in
Example 6-8 on page 6-7.
An actual parameter in a DEFINE invocation can include parentheses, as in
Example 6-9 on page 6-8.
Example 6-5. Fewer Actual Parameters Than Formal Parameters
INT PROC d (a, b, c) EXTENSIBLE; EXTERNAL;
DEFINE something (a, b, c) = d (a, b, c) #;
nothing := something ( , , c); ! Placeholder commas
Example 6-6. No Actual Parameters
DEFINE something (a, b, c) = anything and everything #;
nothing := something ( ); ! Empty parameter list
Example 6-7. More Actual Parameters Than Formal Parameters
DEFINE something (a, b, c) = anything and everything #;
nothing := something (a, b, c, d); ! Too many parameters
Example 6-8. Commas in an Actual Parameter
DEFINE varproc (proc1, param) = CALL proc1 (param) #;
varproc (myproc, i ',' j ',' k); ! Expands to:
! CALL myproc (i, j, k);










