8.6.2.1 RXFNC — The External Function Exit Handler
The RXFNC system exit handler provides hooks for external
functions.  It has only one subfunction; RXFNCCAL, which allows an
application  program to intervene and handle any external function
or subroutine.

Do not confuse this exit handler with the external function
routines which allow you to define new REXX, semi-built-in
functions.  The exit handler is called for all invocations of
external routines, and can be called for function names which you
were unaware of.

The parameter ParmBlock for RXFNCCAL is defined as:

     typedef struct {
           typedef struct {
              unsigned int rxfferr:1 ;
              unsigned int rxffnfnd1 ;
              unsigned int rxffsub: 1;
           } rxfnc_flags ;
           unsigned char *rxfnc_address ;
           unsigned short rxfnc_addressl ;
           unsigned char *rxfnc_que ;
           unsigned short rxfnc_quel ;
           unsigned short rxfnc_argc;
           RXSTRING *rxfnc_argv ;
           RXSTRING rxfnc_retc ;
     } RXFNCCAL_PARM ;

The significance of each variable is:
     [rxfnc_flags.rxfferr]
          Is an output parameter that is set on return in order to
          inform the interpreter that the function or subroutine
          was incorrectly called, and thus the SYNTAX condition
          should be raised.
     [rxfnc_flags.rxffnfnd]
          Is an output parameter that tells the interpreter that
          the function was not found.  Note the inconsistency: it
          is only effective if tthe exit handler returns
          RXEXIT_HANDLED, which looks like a logic contradiction
          to setting the not-found flag.
     [rxfnc_flags.rxffsub]
          Is an input parameter that tells the exit handler
          whether it was called for a function or subroutine call.
          If set, the call being handled is a subroutine call and
          returning a value is optional; else it was called for a
          function, and must return a value in rxfnc_retc if
          RXEXIT_HANDLED is to be returned.
     [rxfnc_name]
          Is a pointer to the name of the function or subroutine
          to be handled, stored as a character array.  This is an
          input parameter, and its length is given by the
          rxfnc_namel parameter.
     [rxfnc_namel]
          Holds the length of rxfnc_name. Note that the last
          character is the letter ell, not the number one.
     [rxfnc_que]
          Points to a character array holding the name of the
          currently active queue.  This is an input parameter.
          The length of this name is given by the rxfnc_quel
          field.
     [rxfnc_que1]
          Holds the length of rxfnc_que. Note that the last
          character is the letter ell, not the number one.
     [rxfnc_argc]
          Is the number of arguments passed to the function or
          subroutine.  It defines the size of the array pointed to
          by the rxfnc_argv field.
     [rxfnc_argv]
          Points to an array holding the parameters for the
          routines. The size of this array is given by the
          rxfnc_argc field.  If rxfnc_argc is zero, the value of
          rxfnc_argv is undefined.
     [rxfnc_retc]
          Holds an RXSTRING structure suitable for storing the
          return value of the handler.  It is the responsibility
          of ht ehandler to allocate space for the contents of
          this string (i.e. the array pointed to by the
          rxfnc_retc.strptr).


PREV NEXT