| lnkfsl |
|
Table of contents
Procedure
LNKFSL ( LNK, free sublist of a list )
SUBROUTINE LNKFSL ( HEAD, TAIL, POOL )
Abstract
Free a specified sublist in a list.
Required_Reading
None.
Keywords
LIST
Declarations
IMPLICIT NONE
INTEGER LBPOOL
PARAMETER ( LBPOOL = -5 )
INTEGER HEAD
INTEGER TAIL
INTEGER POOL ( 2, LBPOOL : * )
Brief_I/O
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
HEAD,
TAIL I Head and tail nodes of a sublist to be freed.
POOL I-O A doubly linked list pool.
Detailed_Input
HEAD,
TAIL are, respectively, the head and tail nodes of a
sublist to be extracted.
POOL is a doubly linked list pool.
Detailed_Output
POOL is the input pool, with the following
modifications:
-- All of the nodes of the sublist bounded by
HEAD and by TAIL have now been returned to
the free list.
If on input, HEAD was preceded by the node
PREV, and tail was followed by the node
NEXT, then on output
-- The successor of PREV is NEXT.
-- The predecessor of NEXT is PREV.
Parameters
LBPOOL is the lower bound of the column indices of the POOL
array. The columns indexed LBPOOL to 0 are reserved
as a control area for the pool.
Exceptions
1) If either of HEAD or TAIL are not valid node numbers, the
error SPICE(INVALIDNODE) is signaled. POOL will not be
modified.
2) If either of HEAD or TAIL are valid node numbers but are not
allocated, the error SPICE(UNALLOCATEDNODE) is signaled. POOL
will not be modified.
3) If TAIL cannot be reached by forward traversal of the list
containing HEAD, the error SPICE(INVALIDSUBLIST) is signaled.
POOL will not be modified.
Files
None.
Particulars
Deleting a sublist from a list returns all of the nodes in
the sublist to the free list.
To remove a sublist from a list and retain the sublist
as a second list, use the routine LNKXSL ( LNK, extract
sublist ).
Examples
1) Let POOL be a doubly linked list pool containing the list
1002 <--> 3 <--> 7 <--> 88 <--> 2
To delete the sublist
3 <--> 7 <--> 88
the call
CALL LNKFSL ( 3, 88, POOL )
can be used. The resulting list will be:
1002 <--> 2
The nodes 3, 7, and 88 will now be on the free list.
2) Let POOL be a doubly linked list pool containing the list
1002 <--> 3 <--> 7 <--> 88 <--> 2
To free the entire list, the call
CALL LNKFSL ( 1002, 2, POOL )
should be used.
Restrictions
1) Linked list pools must be initialized via the routine
LNKINI. Failure to initialize a linked list pool
will almost certainly lead to confusing results.
Literature_References
None.
Author_and_Institution
N.J. Bachman (JPL)
J. Diaz del Rio (ODC Space)
W.L. Taber (JPL)
Version
SPICELIB Version 1.0.1, 24-NOV-2021 (JDR)
Edited the header to comply with NAIF standard.
SPICELIB Version 1.0.0, 19-DEC-1995 (NJB) (WLT)
|
Fri Dec 31 18:36:31 2021