/* * 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. */ extern "C" CppList NewCppList(); extern "C" void DelCppList(CppList l); extern "C" void DelCppListNodesOnly(CppList l); extern "C" void PutCppList(CppList l, CppListElem e); extern "C" CppListElem PullCppList(CppList l); extern "C" void PushCppList(CppList l, CppListElem e); extern "C" CppListElem PopCppList(CppList l); extern "C" CppListElem GetNthCppList(CppList l, int n); extern "C" CppListElem DelNthCppList(CppList l, int n); extern "C" bool InCppList(CppList l, CppListElem e); extern "C" int CppListLen(CppList l); extern "C" CppListElem EnumCppList(CppList l); extern "C" void ResetCppListEnum(CppList l); extern "C" void PrintCppList(CppList l); extern "C" AuxCppListElem NewAuxCppListElem(char *name, struct Sym *sym); #endif