Annotation of 43BSDReno/usr.bin/make/lst.lib/lstInt.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * This code is derived from software contributed to Berkeley by
                      6:  * Adam de Boor.
                      7:  *
                      8:  * Redistribution and use in source and binary forms are permitted
                      9:  * provided that: (1) source distributions retain this entire copyright
                     10:  * notice and comment, and (2) distributions including binaries display
                     11:  * the following acknowledgement:  ``This product includes software
                     12:  * developed by the University of California, Berkeley and its contributors''
                     13:  * in the documentation or other materials provided with the distribution
                     14:  * and in all advertising materials mentioning features or use of this
                     15:  * software. Neither the name of the University nor the names of its
                     16:  * contributors may be used to endorse or promote products derived
                     17:  * from this software without specific prior written permission.
                     18:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
                     19:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
                     20:  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     21:  *
                     22:  *     @(#)lstInt.h    5.3 (Berkeley) 6/1/90
                     23:  */
                     24: 
                     25: /*-
                     26:  * lstInt.h --
                     27:  *     Internals for the list library
                     28:  */
                     29: #ifndef _LSTINT_H_
                     30: #define _LSTINT_H_
                     31: 
                     32: #include         "lst.h"
                     33: 
                     34: typedef struct ListNode {
                     35:        struct ListNode *prevPtr;   /* previous element in list */
                     36:        struct ListNode *nextPtr;   /* next in list */
                     37:        short           useCount:8, /* Count of functions using the node.
                     38:                                     * node may not be deleted until count
                     39:                                     * goes to 0 */
                     40:                        flags:8;    /* Node status flags */
                     41:        ClientData      datum;      /* datum associated with this element */
                     42: } *ListNode;
                     43: /*
                     44:  * Flags required for synchronization
                     45:  */
                     46: #define LN_DELETED     0x0001      /* List node should be removed when done */
                     47: 
                     48: #define NilListNode    ((ListNode)-1)
                     49: 
                     50: typedef enum {
                     51:     Head, Middle, Tail, Unknown
                     52: } Where;
                     53: 
                     54: typedef struct {
                     55:        ListNode        firstPtr; /* first node in list */
                     56:        ListNode        lastPtr;  /* last node in list */
                     57:        Boolean         isCirc;   /* true if the list should be considered
                     58:                                   * circular */
                     59: /*
                     60:  * fields for sequential access
                     61:  */
                     62:        Where           atEnd;    /* Where in the list the last access was */
                     63:        Boolean         isOpen;   /* true if list has been Lst_Open'ed */
                     64:        ListNode        curPtr;   /* current node, if open. NilListNode if
                     65:                                   * *just* opened */
                     66:        ListNode        prevPtr;  /* Previous node, if open. Used by
                     67:                                   * Lst_Remove */
                     68: } *List;
                     69: 
                     70: #define NilList                ((List)-1)
                     71: 
                     72: /*
                     73:  * PAlloc (var, ptype) --
                     74:  *     Allocate a pointer-typedef structure 'ptype' into the variable 'var'
                     75:  */
                     76: #define        PAlloc(var,ptype)       var = (ptype) Malloc (sizeof (*var))
                     77: 
                     78: /*
                     79:  * LstValid (l) --
                     80:  *     Return TRUE if the list l is valid
                     81:  */
                     82: #define LstValid(l)    (((Lst)l == NILLST) ? FALSE : TRUE)
                     83: 
                     84: /*
                     85:  * LstNodeValid (ln, l) --
                     86:  *     Return TRUE if the LstNode ln is valid with respect to l
                     87:  */
                     88: #define LstNodeValid(ln, l)    ((((LstNode)ln) == NILLNODE) ? FALSE : TRUE)
                     89: 
                     90: /*
                     91:  * LstIsEmpty (l) --
                     92:  *     TRUE if the list l is empty.
                     93:  */
                     94: #define LstIsEmpty(l)  (((List)l)->firstPtr == NilListNode)
                     95: 
                     96: #endif _LSTINT_H_

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.