TAL Reference Manual

Procedures
TAL Reference Manual526371-001
13-13
Examples of Formal Parameter Specification
For information on using the PROC(32) parameter type, see Section 17, Mixed-
Language Programs, in the
TAL Programmers Guide.
Examples of Formal Parameter Specification
1. This example shows a function that has two formal parameters, of which one is a
value parameter and the other is a reference parameter. The compiler treats VAR1
as if it were a simple variable and treats VAR 2 as if it were a simple pointer:
INT PROC mult (var1, var2);
INT var1, !Declare value parameter
.var2; !Declare reference parameter
BEGIN
var2 := var2 + var1; !Manipulate parameters
END;
2. This example shows a procedure that declares a reference structure as a formal
reference parameter:
STRUCT template (*); !Template structure
BEGIN
INT a;
INT b;
END;
PROC p (ref_struct);
STRUCT ref_struct (template);
BEGIN
!Lots of code
END;
Procedure Body
A procedure body can contain local declarations, subprocedure declarations, and
statements.
BEGIN
;
local-decl
;
subproc-decl
;
END
statement
;
VST1309.vsd