UP

If “N” is a node key and 0 ≤ n ≤ 15 then
N(NODE__FETCH{=0}+n;==>;K) copies the key in slot n of node N to K.

N(NODE__SWAP{=16}+n;K==>;L) copies K to slot n of N and returns in L the old contents of slot n.

{arcane}If either (N is the domain root of the returnee and n is 14 or 15 {(p1,worsejump48)}) or N is the returnee’s general registers node {(p1,worsejump49)}, the jumper will trap.

N(NODE__WRITE_DATA{=45}, (4,fx), (4,lx), data; ==> c;) stores data keys into the node.

Fx is the first slot number to be stored into, and lx is the last slot number to be stored into. If these are not both < 16, c=1 and the node is unchanged. Slot 0 is considered to follow slot 15.

“Data” consists of a sequence of 16-byte values, one for each slot to be changed, in order. Each slot will receive a data key with the corresponding value mod 25611. If any value is not less than 25611 {11 bytes} then c=2. Otherwise c=0.

{arcane}Fine print: the situations of (p1,worsejump48) and (p1,worsejump49) are possible.

N(NODE__MAKE_type_KEY,((1,b1));==>;K) puts in K a key of the designated type, where type is FETCH, SEGMENT, METER, or NODE. K designates the same node as N. b1 is placed in the databyte of the new key unless type is METER, in which case b1 is ignored.

If K is a node key, fetch key, sense key, segment key or meter key to N’s node, then N(NODE__COMPARE{=38};K==>c;) returns 0 in c, and 1 otherwise.

{ni}This call should return the data byte of K as well!

N(NODE__CLEAR{=39};==>;) clears the node to empty keys. (Equivalent to N(NODE__WRITE_DATA, (4, 1), (260, 0);==>;).)

N(NODE__DATA_BYTE{=40};==>c;) returns the databyte of N in c.

N(kt;==>c;) returns 3 in c.

These values without the underscores are in the macro NODEDEFS in the library DOMAIN. NODE__FETCH=0, NODE__SWAP=16,
NODE__MAKE_FETCH_KEY=32, NODE__MAKE_SEGMENT_KEY=33, NODE__MAKE_METER_KEY=34, NODE__MAKE_NODE_KEY=35, NODE__COMPARE=38, NODE__CLEAR=39, NODE__DATA_BYTE=40, NODE__WRITE_DATA=45.

Design Note:

The following would provide an efficient semephore function:

If slot n of a NODE holds a resume key EX then NODE(64+n;=>0;) forks EX thus: EX(0;). Otherwise the caller’s return key is placed in slot n and the caller remains waiting. See (jmeet) for a similar available function.