VMS Help
PASCAL, Declaration Section, Routine Declaration, formal_parameter_list

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

  A formal parameter is located  in  the  header  of  the  routine
  declaration,   and   consists   of   input   parameters,  output
  parameters,  and  routine  parameters.   A  routine  uses  input
  parameters to obtain values; it uses output parameters to return
  values; and it uses routine parameters to call  another  routine
  named by a formal parameter.

  The formal parameter establishes the semantics, the  data  type,
  and  the  required  passing mechanism of the parameter.  See the
  "Compaq Pascal Language Reference Manual" for  more  information
  on parameter passing mechanisms.

  Syntax:

     [[({ {value-parameter-spec | variable-parameter-spec |
           routine-parameter-spec | foreign parameter-spec} };...)]]

  The specific format depends on the semantics  (value,  variable,
  routine, or foreign) of the formal parameter you are declaring.

  A formal value parameter represents a local variable within  the
  called  routine.   When you specify value semantics, the address
  of the actual parameter is passed to the called  routine,  which
  then  copies  the  value  from  the specified address to its own
  local storage.  The routine then uses this copy.   The  copy  is
  not   retained  when  control  returns  to  the  calling  block.
  Therefore, if the called routine assigns  a  new  value  to  the
  formal  parameter,  the  change is not reflected in the value of
  the actual parameter.

  Syntax:

     {identifier},... : [[attribute-list]]
        {type-id | conformant-parameter-syntax |
                        undiscriminated-schema-name}
        [[:= [[mechanism-specifier]] default-value]]

  A formal  variable  parameter  represents  another  name  for  a
  variable  in  the calling block.  It is preceded by the reserved
  word VAR.  When you specify variable semantics, the  address  of
  the  actual  parameter  is  passed  to  the  called routine.  In
  contrast  to  value  semantics,  the  called  routine   directly
  accesses  the  actual parameter.  Thus, the routine can assign a
  new value to the  formal  parameter  during  execution  and  the
  changed value is reflected immediately in the calling block (the
  value of the actual parameter changes).

  Syntax:

     VAR {identifier},... : [[attribute-list]]
         {type-id | conformant-parameter-syntax |
                         undiscriminated-schema-name}
         [[:= [[mechanism-specifier]] default-value]]

  To write a routine that invokes another routine whose effect  is
  not  determined  until  the  program  is  executed,  use routine
  parameters.  To declare a procedure or a function  as  a  formal
  parameter  to  another  routine,  you  must  include  a complete
  routine heading in the formal  parameter  list.   You  can  also
  associate a foreign mechanism specifier and a default value with
  a formal procedure or function parameter.

  Syntax:

     [[attribute-list]] PROCEDURE procedure-id [[formal-parameter-list]]
            [[ := [[mechanism-specifier]] default-value ]]

  or

     [[attribute-list]] FUNCTION function-id [[formal-parameter-list]] :
           [[attribute-list]] result-type-id
           [[ := [[mechanism-specifier]] default-value ]]

  When declaring an external routine (one written  in  a  language
  other  than  Pascal)  that is called by a Compaq Pascal routine,
  you must specify not only the correct semantics but the  correct
  mechanism  as  well.   To  allow  you  to  obtain  these passing
  mechanisms, Compaq Pascal provides foreign mechanism  specifiers
  and the passing mechanism attributes.

  See the "Compaq Pascal Language Reference Manual"  for  complete
  details on formal parameter semantics.

  Additional Information (explode) :

  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.