/* * Definition of a generic list. * * Note well -- this list differs significantly from ./list.h, which is used * for run-time list values in the interpreter. This "Cpp" list is the ANSI C * parallel to the C++ list defined in ./list++.h. The two list types could be * merged, but for historical reasons they are not at this point. So be it for * now. * * The visible list functions are: * * CppList NewCppList() * PutCppList(CppList l, CppListElem e) * CppListElem PullCppList(CppList l) * PushCppList(CppList l, CppListElem e) * CppListElem PopCppList(CppList l) * CppListElem GetNthCppList(CppList l, int n) * CppListElem DelNthCppList(CppList l, int n) * int CppListLen(CppList l) * CppListElem EnumCppList(CppList l) * ResetCppListEnum(l) * PrintCppList(list l) * * * CppList elements have the following opaque structure: * * CppListElem Data; * CppList Next; * CppList Prev; * */ #ifndef cppListIncluded #define cppListIncluded #include "std-macros.h" typedef char *CppListElem; typedef struct AuxCppListElemStruct { char *Data; struct Sym *AuxData; } *AuxCppListElem; typedef struct CppListItemStruct { CppListElem Data; struct CppListItemStruct *Next; struct CppListItemStruct *Prev; } *CppListItem; typedef struct CppListStruct { CppListItem First; CppListItem Last; int Size; CppListItem EnumState; } *CppList; /* * Visible functions. */ CppList NewCppList(); void DelCppList(/* CppList l */); void DelCppListNodesOnly(/* CppList l */); void PutCppList(/* CppList l, CppListElem e */); CppListElem PullCppList(/* CppList l */); void PushCppList(/* CppList l, CppListElem e */); CppListElem PopCppList(/* CppList l */); CppListElem GetNthCppList(/* CppList l, int n */); CppListElem DelNthCppList(/* CppList l, int n */); bool InCppList(/* CppList l, CppListElem e */); int CppListLen(/* CppList l */); CppListElem EnumCppList(/* CppList l */); void ResetCppListEnum(/* l */); void PrintCppList(/* list l */); AuxCppListElem NewAuxCppListElem(/* char *name, struct Sym *sym */); #endif