getnbr |
Class: B |
(legend) |
Operand Stack | Heap | Condition Codes |
|
N/A |
1 = success 0 = fail |
Get the address of the neighbor specified by the value on top of the stack.
All neighbors are stored in a list. The value specifies which position in the
list
to get.
The
value
must
be between
0 and
numnbrs
-1.
Note: There is no synchronization between a call to numnbrs
and
subsequent calls to getnbr
, nor between two calls
to getnbr
.
Since the neighbor list is dynamic, calling getnbr
may fail or
may return the same neighbor using two different indices. Failure is indicated
by the condition code being set to 0.
The suggested way of iterating through all neighbors is to take a snapshot of the neighbor list by calling numnbrs, then immediately calling getnbr to push the entire list onto the stack.