lst.h (138185) | lst.h (138192) |
---|---|
1/* 2 * Copyright (c) 1988, 1989, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * Copyright (c) 1988, 1989 by Adam de Boor 5 * Copyright (c) 1989 by Berkeley Softworks 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by --- 23 unchanged lines hidden (view full) --- 32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * @(#)lst.h 8.2 (Berkeley) 4/28/95 | 1/* 2 * Copyright (c) 1988, 1989, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * Copyright (c) 1988, 1989 by Adam de Boor 5 * Copyright (c) 1989 by Berkeley Softworks 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by --- 23 unchanged lines hidden (view full) --- 32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * @(#)lst.h 8.2 (Berkeley) 4/28/95 |
40 * $FreeBSD: head/usr.bin/make/lst.h 138185 2004-11-29 08:38:16Z harti $ | 40 * $FreeBSD: head/usr.bin/make/lst.h 138192 2004-11-29 12:17:13Z harti $ |
41 */ 42 43/*- 44 * lst.h -- 45 * Header for using the list library 46 */ 47#ifndef _LST_H_ 48#define _LST_H_ --- 39 unchanged lines hidden (view full) --- 88 Boolean isOpen; /* true if list has been Lst_Open'ed */ 89 LstNode curPtr; /* current node, if open. NULL if 90 * *just* opened */ 91 LstNode prevPtr; /* Previous node, if open. Used by 92 * Lst_Remove */ 93}; 94typedef struct Lst *Lst; 95 | 41 */ 42 43/*- 44 * lst.h -- 45 * Header for using the list library 46 */ 47#ifndef _LST_H_ 48#define _LST_H_ --- 39 unchanged lines hidden (view full) --- 88 Boolean isOpen; /* true if list has been Lst_Open'ed */ 89 LstNode curPtr; /* current node, if open. NULL if 90 * *just* opened */ 91 LstNode prevPtr; /* Previous node, if open. Used by 92 * Lst_Remove */ 93}; 94typedef struct Lst *Lst; 95 |
96typedef int CompareProc(void *, void *); 97typedef int DoProc(void *, void *); 98typedef void *DuplicateProc(void *); 99typedef void FreeProc(void *); 100 |
|
96/* 97 * NOFREE can be used as the freeProc to Lst_Destroy when the elements are 98 * not to be freed. 99 * NOCOPY performs similarly when given as the copyProc to Lst_Duplicate. 100 */ | 101/* 102 * NOFREE can be used as the freeProc to Lst_Destroy when the elements are 103 * not to be freed. 104 * NOCOPY performs similarly when given as the copyProc to Lst_Duplicate. 105 */ |
101#define NOFREE ((void (*)(void *)) 0) 102#define NOCOPY ((void * (*)(void *)) 0) | 106#define NOFREE ((FreeProc *)NULL) 107#define NOCOPY ((DuplicateProc *)NULL) |
103 104#define LST_CONCNEW 0 /* create new LstNode's when using Lst_Concat */ 105#define LST_CONCLINK 1 /* relink LstNode's when using Lst_Concat */ 106 107/* 108 * Creation/destruction functions 109 */ 110/* Create a new list */ 111Lst Lst_Init(Boolean); 112/* Duplicate an existing list */ | 108 109#define LST_CONCNEW 0 /* create new LstNode's when using Lst_Concat */ 110#define LST_CONCLINK 1 /* relink LstNode's when using Lst_Concat */ 111 112/* 113 * Creation/destruction functions 114 */ 115/* Create a new list */ 116Lst Lst_Init(Boolean); 117/* Duplicate an existing list */ |
113Lst Lst_Duplicate(Lst, void * (*)(void *)); | 118Lst Lst_Duplicate(Lst, DuplicateProc *); |
114/* Destroy an old one */ | 119/* Destroy an old one */ |
115void Lst_Destroy(Lst, void (*)(void *)); | 120void Lst_Destroy(Lst, FreeProc *); |
116 117/* 118 * Functions to modify a list 119 */ 120/* Insert an element before another */ 121ReturnStatus Lst_Insert(Lst, LstNode, void *); 122/* Insert an element after another */ 123ReturnStatus Lst_Append(Lst, LstNode, void *); --- 19 unchanged lines hidden (view full) --- 143LstNode Lst_Succ(LstNode); 144/* Get datum from LstNode */ 145void * Lst_Datum(LstNode); 146 147/* 148 * Functions for entire lists 149 */ 150/* Find an element in a list */ | 121 122/* 123 * Functions to modify a list 124 */ 125/* Insert an element before another */ 126ReturnStatus Lst_Insert(Lst, LstNode, void *); 127/* Insert an element after another */ 128ReturnStatus Lst_Append(Lst, LstNode, void *); --- 19 unchanged lines hidden (view full) --- 148LstNode Lst_Succ(LstNode); 149/* Get datum from LstNode */ 150void * Lst_Datum(LstNode); 151 152/* 153 * Functions for entire lists 154 */ 155/* Find an element in a list */ |
151LstNode Lst_Find(Lst, void *, int (*)(void *, void *)); | 156LstNode Lst_Find(Lst, void *, CompareProc *); |
152/* Find an element starting from somewhere */ | 157/* Find an element starting from somewhere */ |
153LstNode Lst_FindFrom(Lst, LstNode, void *, int (*cProc)(void *, void *)); | 158LstNode Lst_FindFrom(Lst, LstNode, void *, CompareProc *); |
154/* 155 * See if the given datum is on the list. Returns the LstNode containing 156 * the datum 157 */ 158LstNode Lst_Member(Lst, void *); 159/* Apply a function to all elements of a lst */ | 159/* 160 * See if the given datum is on the list. Returns the LstNode containing 161 * the datum 162 */ 163LstNode Lst_Member(Lst, void *); 164/* Apply a function to all elements of a lst */ |
160void Lst_ForEach(Lst, int (*)(void *, void *), void *); | 165void Lst_ForEach(Lst, DoProc *, void *); |
161/* 162 * Apply a function to all elements of a lst starting from a certain point. 163 * If the list is circular, the application will wrap around to the 164 * beginning of the list again. 165 */ | 166/* 167 * Apply a function to all elements of a lst starting from a certain point. 168 * If the list is circular, the application will wrap around to the 169 * beginning of the list again. 170 */ |
166void Lst_ForEachFrom(Lst, LstNode, int (*)(void *, void *), void *); | 171void Lst_ForEachFrom(Lst, LstNode, DoProc *, void *); |
167/* 168 * these functions are for dealing with a list as a table, of sorts. 169 * An idea of the "current element" is kept and used by all the functions 170 * between Lst_Open() and Lst_Close(). 171 */ 172/* Open the list */ 173ReturnStatus Lst_Open(Lst); 174/* Next element please */ --- 34 unchanged lines hidden --- | 172/* 173 * these functions are for dealing with a list as a table, of sorts. 174 * An idea of the "current element" is kept and used by all the functions 175 * between Lst_Open() and Lst_Close(). 176 */ 177/* Open the list */ 178ReturnStatus Lst_Open(Lst); 179/* Next element please */ --- 34 unchanged lines hidden --- |