“Init” Interface Procedure

  logical procedure qedit'userinit     (string,len,userspace,procspace);     byte array string;     integer len;     array userspace,procspace;     option external;  

The “Init” procedure is called once when the Interface configuration command is processed. The procedure can return a string of commands to be executed, and activate, deactivate, or initialize working storage for other interface procedures.

Parameters of “Init”

STRING is a byte array where the Init procedure can return the characters of a command line; there may be up to 256 characters. The string can contain multiple commands, if separated by semicolons. The STRING does not need to have any special terminating character, but the buffer is actually 257 characters long to allow room for a stop byte if you need it. (Note: this command line will be passed to the “Com” interface procedure.)

LEN is the number of command characters in the STRING. This variable must be set to the proper value by the Init procedure. In no case can it have a value greater than 256; this results in Qedit abort #112. Upon entry, this parameter has a value of 0 (see “Exit” interface below). The STRING will always be executed, if the LEN is greater than zero.

USERSPACE is a 10-word array that provides “global” storage for interface procedures; it can be used to pass parameters between the various interface procedures. The 10 words are initially set to binary zero and can be used for any purpose. EDIT/3000 places file numbers in the first two words of the USERSPACE and Qedit does not; therefore, it is possible for an interface routine to check whether it has been called from Qedit or Editor, by checking the first word of USERSPACE for zero (Qedit) or nonzero (HP Editor).

PROCSPACE is a 28-word array that is shared with the PROCEDURE command. The first 20 words are reserved for the user code and are initialized to zero. In Qedit/V only (not Qedit/iX), the USERSPACE is located directly before the PROCSPACE (i.e., they are contiguous in memory).

Following the 20 user words, PROCSPACE contains 8 words that hold context values and flags. The first word contains the number of words of DL space reserved for the PROCEDURE command (see Set DL). The second word contains the current language setting (0=SPL, 1=FTN, 2=COBOL, 3=undefined, 4=COBX, 5=JOB, 6=RPG, 7=TEXT, 8=PASC). These two words must not be modified. The other words are described below under “Alternate Activation”.

Here is a diagram of the USERSPACE and PROCSPACE:

        SPL                  FTN            ----------------        -9  | 0            |  1            |  USERSPACE   |        -1  | 9            |  10            ----------------         0  |              |  1            |  PROCSPACE   |            |              |        19  |              |  20            ----------------        20  |  DL SIZE     |  21        21  |  "Language"  |  22        22  |  Add plabel  |  23        23  |  Com plabel  |  24        24  |  Exit label  |  25        25  |  Mod plabel  |  26        26  |  flags       |  27        27  |  split index |  28            ----------------  

Return value: Return False to stop Qedit from loading the other procedures called for in the Interface command (alternate activation is not suppressed, see below). Return True to allow Qedit to load the procedures listed in the Interface command (“Add”, “Com”, “Exit”). If you are using the Alternate Activation method (below), return False to suppress Qedit’s loading the routines again. If Len is returned with a value greater than 0, the String commands will be executed, regardless of whether True or False is returned.

"Init" Interface Procedure