/* lnksiz.f -- translated by f2c (version 19980913). You must link the resulting object file with the libraries: -lf2c -lm (in that order) */ #include "f2c.h" /* $Procedure LNKSIZ ( LNK, size ) */ integer lnksiz_(integer *pool) { /* System generated locals */ integer ret_val; /* $ Abstract */ /* Return the size of a doubly linked list pool. */ /* $ Copyright */ /* Copyright (1995), California Institute of Technology. */ /* U.S. Government sponsorship acknowledged. */ /* $ Required_Reading */ /* LNK */ /* $ Keywords */ /* LIST */ /* $ Declarations */ /* $ Brief_I/O */ /* Variable I/O Description */ /* -------- --- -------------------------------------------------- */ /* POOL I A doubly linked list pool. */ /* LBPOOL P Lower bound of pool column indices. */ /* The function returns the size of the pool. */ /* $ Detailed_Input */ /* POOL is a doubly linked list pool. */ /* $ Detailed_Output */ /* The function returns the size (total number of nodes) of the pool. */ /* $ 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 */ /* Error free. */ /* $ Files */ /* None. */ /* $ Particulars */ /* This routine allows an application program to determine the size */ /* of a doubly linked list pool at run-time, without having to rely */ /* on knowledge of the internals of the doubly linked list pool */ /* structure. */ /* $ Examples */ /* 1) Let POOL be a doubly linked list pool. The total number of */ /* nodes in a doubly linked list pool is set when the pool is */ /* initialized by LNKINI. This number is returned by LNKSIZ: */ /* C */ /* C This sequence of calls will assign the value 100 */ /* C to the variable SIZE: */ /* C */ /* CALL LNKINI ( 100, POOL ) */ /* SIZE = LNKSIZ ( POOL ) */ /* $ Restrictions */ /* 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) */ /* W.L. Taber (JPL) */ /* $ Version */ /* - SPICELIB Version 1.0.0, 19-DEC-1995 (NJB) (WLT) */ /* -& */ /* $ Index_Entries */ /* return size of linked list */ /* -& */ /* Local parameters */ /* The control area contains 3 elements. They are: */ /* The "size" of the pool, that is, the number */ /* of nodes in the pool. */ /* The number of free nodes in the pool. */ /* The "free pointer," which is the column index of the first free */ /* node. */ /* Parameters defining the row and column indices of these control */ /* elements are given below. */ /* Each assigned node consists of a backward pointer and a forward */ /* pointer. */ /* +-------------+ +-------------+ +-------------+ */ /* | forward--> | | forward--> | | forward--> | */ /* +-------------+ ... +-------------+ ... +-------------+ */ /* | <--backward | | <--backward | | <--backward | */ /* +-------------+ +-------------+ +-------------+ */ /* node 1 node I node SIZE */ /* Free nodes say that that's what they are. The way they say it */ /* is by containing the value FREE in their backward pointers. */ /* Needless to say, FREE is a value that cannot be a valid pointer. */ /* Grab the pool size from the control area. */ ret_val = pool[10]; return ret_val; } /* lnksiz_ */