* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* %sccs.include.redist.c%
* @(#)lstInt.h 5.4 (Berkeley) %G%
* Internals for the list library
typedef struct ListNode
{
struct ListNode
*prevPtr
; /* previous element in list */
struct ListNode
*nextPtr
; /* next in list */
short useCount
:8, /* Count of functions using the node.
* node may not be deleted until count
flags
:8; /* Node status flags */
ClientData datum
; /* datum associated with this element */
* Flags required for synchronization
#define LN_DELETED 0x0001 /* List node should be removed when done */
#define NilListNode ((ListNode)-1)
Head
, Middle
, Tail
, Unknown
ListNode firstPtr
; /* first node in list */
ListNode lastPtr
; /* last node in list */
Boolean isCirc
; /* true if the list should be considered
* fields for sequential access
Where atEnd
; /* Where in the list the last access was */
Boolean isOpen
; /* true if list has been Lst_Open'ed */
ListNode curPtr
; /* current node, if open. NilListNode if
ListNode prevPtr
; /* Previous node, if open. Used by
#define NilList ((List)-1)
* Allocate a pointer-typedef structure 'ptype' into the variable 'var'
#define PAlloc(var,ptype) var = (ptype) malloc (sizeof (*var))
* Return TRUE if the list l is valid
#define LstValid(l) (((Lst)l == NILLST) ? FALSE : TRUE)
* LstNodeValid (ln, l) --
* Return TRUE if the LstNode ln is valid with respect to l
#define LstNodeValid(ln, l) ((((LstNode)ln) == NILLNODE) ? FALSE : TRUE)
* TRUE if the list l is empty.
#define LstIsEmpty(l) (((List)l)->firstPtr == NilListNode)