Unlike in HYDRA, and because of the reverse pointers, the operation of moving a bank by re-linking from one data-structure to another one is a non-trivial operation. The routine ZSHUNT is provided to execute such an operation.
ZSHUNT may be used to extract either a single bank (IFLAG=0
)
or a whole linear structure (IFLAG=1
) from the old context,
for insertion into the new context as described by the parameters
LSUP and JB, which have the same significance as in MZLIFT.
CALL ZSHUNT (IXSTOR,!LSH, !LSUP,JB,IFLAG)
with
IXSTOR index of the store, zero for the primary store; IXDIV, the index of the division containing the bank to be shunted, may be given instead !LSH address of the bank or of the linear structure !LSUP if JB < 1: address of the new supporting bank if JB = 1: the new supporting link* JB if JB < 1: link bias in the new supporting bank if JB = 1: LSUP is the new supporting link, the origin-link in the bank at LSH will be made to point to it if JB = 2: detach without insertion IFLAG if IFLAG = 0: shunt the one single bank at LSH if IFLAG = 1: shunt the whole linear structure pointed to by LSHIf the bank or the structure to be re-linked is in fact inserted or added into an existing linear structure, both must be contained in the same division.
Examples:
Suppose we have the following data-structures to start with:
______ | | up | UA | <---.-------------.-------------. |______| | | | | | | | -3 | | | | | ______ ______ ______ | | | <-- | | <-- | | `----> | A1 | ---> | A2 | ---> | A3 | |______| |______| |______| and ______ | | up | UN | <---.-------------.-------------. |______| | | | | | | | -7 | | | | | ______ ______ ______ | | | <-- | | <-- | | `----> | N1 | ---> | N2 | ---> | N3 | |______| |______| |______| and ______ ______ ______ <--- | | <-- | | <-- | | LQMAIN ---> | X1 | ---> | X2 | ---> | X3 | |______| |______| |______|Any bank may support further dependent partial data-structures, the corresponding structural down-links are not changed by ZSHUNT.
In what follows the notation Lxx
is used to designate
a link pointing to bank xx
.
Examples:
CALL ZSHUNT (0,LA2,LUN,-7,0) gives: ______ | | | UA | <---.-------------. |______| | | | | | -3 | ______ ______ | | | <-- | | `----> | A1 | ---> | A3 | |______| |______| and ______ | | | UN | <---.-------------.-------------.-------------. |______| | | | | | | | | | -7 | ______ ______ ______ ______ | | | <-- | | <-- | | <-- | | `----> | A2 | ---> | N1 | ---> | N2 | ---> | N3 | |______| |______| |______| |______|
This moves a single bank (with is dependents, if any) out of
a linear structure, and inserts it at the head of the linear
structure supported by link -7
of the bank UN
.
CALL ZSHUNT (0,LA2,LUN,-7,1) gives: ______ | | | UA | |______| | -3 | ______ | | | `----> | A1 | |______| and ______ | | | UN | <--.-------------.-------------.------------------. |______| | | | | | | | | | -7 | ______ ______ ______ ______ | | | <-- | | <-- | | <- ... - | | `----> | A2 | ---> | A3 | ---> | N1 | -- ... -> | N3 | |______| |______| |______| |______|This is the same as example 1, except that the (partial) linear structure starting with bank
A2
is re-linked.
CALL ZSHUNT (0,LA2,LN2,0,0) gives: ______ | | | UN | <---.-------------.-------------.-------------. |______| | | | | | | | | | -7 | ______ ______ ______ ______ | | | <-- | | <-- | | <-- | | `----> | N1 | ---> | N2 | ---> | A2 | ---> | N3 | |______| |______| |______| |______|This is again like example 1, but the bank is inserted inside the linear structure, rather than ahead of it.
CALL ZSHUNT (0,LA2,LQMAIN,1,0) gives: 0 0 0 0 ^ ^ ^ ^ | | | | ______ ______ ______ ______ <---- | | <-- | | <-- | | <-- | | LQMAIN -----> | A2 | ---> | X1 | ---> | X2 | ---> | X3 | |______| |______| |______| |______|
This relinks bank A2 to be the first in the top-level linear
structure supported by LQMAIN
.
L = LQMAIN CALL ZSHUNT (0,LA2,L,1,0)has exactly the same effect as Example 4 above because,
LQMAIN
not being zero initially,
the origin-link of the bank pointed to by L
(and the up-link, but this is zero)
is used for the connection.
CALL ZSHUNT (0,LA1,LHEAD,1,1) gives: ______ | | | UA | |______| | -3 | ----> zero and 0 0 0 ^ ^ ^ | | | ______ ______ ______ <---- | | <-- | | <-- | | LHEAD -----> | A1 | ---> | A2 | ---> | A3 | |______| |______| |______|
supposing LHEAD=0
initially; this connects the linear structure
to the (structural) link LHEAD
, ie. the origin-link of the header bank A1
points back to the location of LHEAD
.
CALL ZSHUNT (0,LA1,LDUMMY,2,1) gives: ______ | | | UA | |______| | -3 | `----> zero and 0 0 0 ^ ^ ^ | | | ______ ______ ______ 0 <-- | | <-- | | <-- | | LA1 -----> | A1 | ---> | A2 | ---> | A3 | |______| |______| |______|This detaches the linear structure from its old context without inserting it into a new one. This should only be temporary, one should insert the floating structure into a new context by a second call to ZSHUNT not too much later.