Formal Parameter Declarations
Most VMS Pascal formal parameter declarations are acceptable to EQUEL. Declared formal parameters are treated as local variables by EQUEL. Note that host code is not allowed in an EQUEL formal parameter section; therefore, all formal parameters to a procedure or function known to EQUEL must be preceded by the ## mark.
An EQUEL/Pascal formal parameter declaration has the following syntax:
formal_param_section {; formal_param_section}
where formal_param_section is:
formal_var | formal_routine [:= [%mechanism] default_value]
A formal_var has the syntax:
[var | %mechanism] identifier {, identifier} : typename_or_schema
where typename_or_schema is one of the following:
type_name
varying [upper_bound_identifier] of type_name
packed array [schema_dimensions] of typename_or_schema
array [schema_dimensions {; schema_dimensions}] of
typename_or_schema
where schema_dimensions is:
lower_bound_identifier .. upper_bound_identifier : scalar_type_name
A formal_routine has the syntax:
[%mechanism] routine_header
where routine_header is one of the following:
procedure proc_name ( [formal_parameter_declaration] )
function func_name ( [formal_parameter_declaration] ) :
return_type_name
In a subprogram declaration, the syntax of a formal parameter declaration is:
procedure proc_name ( formal_parameter_declaration );
...
or:
function func_name ( formal_parameter_declaration ) : return_type_name;
...
Syntax Notes:
1. The EQUEL preprocessor ignores the names of procedures and functions used as formal parameters, but checks their formal parameters for legality.
2. The default_value is not parsed by the preprocessor. Consequently, any default value is accepted, even if it later causes a Pascal compiler error. For example, both of the following parameter default values are accepted, even though only the first is legal in Pascal:
## procedure Load_Table
## (clear_it: Boolean := TRUE;
## var is_error: Boolean := 'FALSE');
...
3. Any mechanism specification is ignored.
The following example contains formal parameter declarations:
## function GetEquelError( buf:varying[ub] of Char )
## : Boolean;
## procedure HandleError( procedure errorHandle(err : Integer);
## var errNum : Integer );
## function DoAppend( emp_id, floor : Integer;
## name : varying[ub] of Char;
## salary : Real ) : Integer;