CALL

From ICE Enterprises
Jump to navigation Jump to search

Invoke a macro PROCEDURE or SUBROUTINE

<NAME>     Procedure or Subroutine to call
<arg 1:N>  Optional arguments

A macro PROCEDURE or SUBROUTINE is a place to put code that is called frequently
or a block of code to be executed in its own thread.  Each procedure/subroutine
begins with

  PROCEDURE <procedure-name> [ <arguments...> ]
  SUBROUTINE <subroutine-name> [ <arguments...> ]

where the <arguments> are optional.  The procedure ends with the word RETURN.
The format of the <arguments> is identical to that of the startmacro line of a
standard macro:  each argument has one letter indicating the type, a colon,
the argument name, and optionally, a default within square brackets immediately
following.

A PROCEDURE lives within the context of the current macro sharing all results.

A SUBROUTINE has its own macro context, meaning that its local parameter
definitions and results, are unique to it.  It cannot see the results from the
calling macro unless a GLOBAL statement is used within the subroutine.

Examples:
   The call to the procedure in this example will give a default to the
   result parameter when called with no argument and override the default
   parameter value when called with a string argument:
   
   !------------------------------------!
   startmacro
    call myproc
    call myproc "newString"
   endmacro
   
   procedure myproc s:stringin["default"]
     res stringin   ! This show a value of 'default' for the first call
                    ! and 'newString for the second call
   return
   !------------------------------------!
 
Switches:
  /BG  - execute a SUBROUTINE in a background thread

SEE ALSO:  RETURN, PROCEDURE, SUBROUTINE