=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/lst.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- src/usr.bin/make/lst.h 2001/05/03 13:41:07 1.19 +++ src/usr.bin/make/lst.h 2001/05/23 12:34:45 1.20 @@ -1,5 +1,8 @@ +#ifndef _LST_H_ +#define _LST_H_ + /* $OpenPackages$ */ -/* $OpenBSD: lst.h,v 1.19 2001/05/03 13:41:07 espie Exp $ */ +/* $OpenBSD: lst.h,v 1.20 2001/05/23 12:34:45 espie Exp $ */ /* $NetBSD: lst.h,v 1.7 1996/11/06 17:59:12 christos Exp $ */ /* @@ -46,10 +49,6 @@ * lst.h -- * Header for using the list library */ -#ifndef _LST_H_ -#define _LST_H_ - -#include "sprite.h" #include #ifdef __STDC__ #include @@ -58,19 +57,16 @@ /* These data structures are PRIVATE !!! * Here for efficiency, so that some functions can be recoded as inlines, * and so that lst headers don't need dynamic allocation most of the time. */ -typedef struct ListNode_ { +struct ListNode_ { struct ListNode_ *prevPtr; /* previous element in list */ struct ListNode_ *nextPtr; /* next in list */ void *datum; /* datum associated with this element */ -} *LstNode; +}; -typedef struct { - LstNode firstPtr; /* first node in list */ - LstNode lastPtr; /* last node in list */ -} LIST; +#ifndef LIST_TYPE +#include "lst_t.h" +#endif -typedef LIST *Lst; - typedef void (*SimpleProc)(void *); typedef int (*FindProc)(void *, void *); typedef int (*FindProcConst)(void *, const void *); @@ -137,7 +133,7 @@ extern void Lst_ForEachFrom(LstNode, ForEachProc, void *); extern void Lst_Every(Lst, SimpleProc); -extern ReturnStatus Lst_AddNew(Lst, void *); +extern bool Lst_AddNew(Lst, void *); /* * for using the list as a queue */ @@ -145,6 +141,12 @@ #define Lst_EnQueue Lst_AtEnd #define Lst_QueueNew Lst_AddNew +/* + * for using the list as a stack + */ +#define Lst_Push Lst_AtFront +#define Lst_Pop Lst_DeQueue + /* Remove an element from head of queue */ extern void * Lst_DeQueue(Lst); @@ -157,6 +159,7 @@ #define Lst_Rev(ln) ((ln)->prevPtr) +/* Inlines are preferable to macros here because of the type checking. */ #ifdef HAS_INLINES static INLINE LstNode Lst_FindConst(Lst l, FindProcConst cProc, const void *d)