Alternate Activation
To allow more flexibility in the use of interface routines and to reduce the system overhead (three calls to LOADPROC take a considerable time), Qedit provides an alternate method for activating interface routines. This method requires only one call to LOADPROC, and also allows you to disable and enable each interface routine dynamically, or even switch interface routines.
This alternate method uses three communication words beyond the end of the PROCSPACE. The 3rd, 4th and 5th words after the PROCSPACE contain the “plabels” for the Qedit interface procedures. When the “plabel” word is a binary zero, the interface routine is disabled. When it is nonzero, the routine is enabled and the word is used to do a “PCAL 0″ to that routine.
The global space for user PROCEDUREs and Interface routines is laid out as follows (remember, FORTRAN tables start at 1, SPL at 0):
SPL references | Contains | FORTRAN references |
procspace(-10:-1) | the Userspace | userspace(1) to (10) |
procspace(0) to (19) | the Procspace | procspace(1) to (20) |
procspace(20) | words of DL | procspace(21) |
procspace(21) | “language” | procspace(22) |
procspace(22) | plabel of Add | procspace(23) |
procspace(23) | plabel of Com | procspace(24) |
procspace(24) | plabel of Exit | procspace(25) |
procspace(25) | plabel of Mod | procspace(26) |
procspace(26) | flags | procspace(27) |
procspace(27) | split index | procspace(28) |
Because the four “plabel” words are accessible to a user PROCEDURE, as well as to the Init interface routine, it is possible for one routine to enable all three interface routines. This is done by including in the source code of the procedure at least one “dummy” reference to each routine (e.g., procspace(23) := @int’command in SPL). This dummy reference forces MPE to load the procedure at the same time that it loads the first routine.
With this approach, it is possible for the names of the interface routines to be arbitrary. In fact, you can have several sets of interface routines and switch them dynamically. Here is an extract from an SPL procedure to show how to define the interface routine and then link it to Qedit:
procedure example'command (string,length,userspace,procspace); byte array string; integer length; array userspace,procspace; option external; procspace(23) := @example'command;