From 325530e630c68c7c10a2f4339f5b43434fcd0329 Mon Sep 17 00:00:00 2001 From: sc Date: Tue, 28 Nov 2000 14:19:35 +0000 Subject: Incorporation into IvyLeague Ccu -> Ivl ccu -> ivl Smart pointers disappear (too dangerous) Imakefile disappears (Makefile now) An empty cplus_bugs.h has been created locally --- utils/List.h | 205 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 104 insertions(+), 101 deletions(-) (limited to 'utils/List.h') diff --git a/utils/List.h b/utils/List.h index 5067da6..def2919 100644 --- a/utils/List.h +++ b/utils/List.h @@ -18,26 +18,26 @@ #include "cplus_bugs.h" #include -class CcuAllocator; +class IvlAllocator; -typedef void CcuListItem; -typedef void* CcuListIndex; +typedef void IvlListItem; +typedef void* IvlListIndex; #ifdef CPLUS_BUG20 -class CcuListLink; +class IvlListLink; #endif -class CcuList { -friend class CcuListIter; +class IvlList { +friend class IvlListIter; #ifndef CPLUS_BUG20 - class CcuListLink { - static CcuAllocator* ListLinkMem; + class IvlListLink { + static IvlAllocator* ListLinkMem; public: - CcuListItem* Entry; - CcuListLink* Next; - inline CcuListLink (CcuListItem* e, CcuListLink* n = 0) { Entry = e; Next = n ? n : this; } - CcuListLink* Previous (); + IvlListItem* Entry; + IvlListLink* Next; + inline IvlListLink (IvlListItem* e, IvlListLink* n = 0) { Entry = e; Next = n ? n : this; } + IvlListLink* Previous (); void* operator new (size_t); void operator delete (void*); }; @@ -49,155 +49,158 @@ public: private: - CcuListLink* LastLink; + IvlListLink* LastLink; list_status StatusFlag; - CcuListIndex InsertAfterLink (CcuListLink*, CcuListItem*); - CcuListIndex InsertBeforeLink (CcuListLink*, CcuListItem*); - CcuListItem* RemoveAfterLink (CcuListLink*); + IvlListIndex InsertAfterLink (IvlListLink*, IvlListItem*); + IvlListIndex InsertBeforeLink (IvlListLink*, IvlListItem*); + IvlListItem* RemoveAfterLink (IvlListLink*); public: -inline CcuList () : LastLink (0), StatusFlag (NoError) { } - CcuList (CcuListItem*); - CcuList (const CcuList&); - ~CcuList (); - CcuList& operator = (const CcuList&); +inline IvlList () : LastLink (0), StatusFlag (NoError) { } + IvlList (IvlListItem*); + IvlList (const IvlList&); + ~IvlList (); + IvlList& operator = (const IvlList&); inline list_status GetStatus () const { return StatusFlag; } inline int IsEmpty () const { return !LastLink; } - CcuListItem* First (); - CcuListItem* Last (); - CcuListItem* Nth (int n); + IvlListItem* First (); + IvlListItem* Last (); + IvlListItem* Nth (int n); int Length () const; - int Find (CcuListItem*, int* = 0) const; + int Find (IvlListItem*, int* = 0) const; - CcuListIndex Append (CcuListItem*); - CcuListIndex Prepend (CcuListItem*); -inline CcuList& operator << (CcuListItem* it) { Append (it); return *this; } + IvlListIndex Append (IvlListItem*); + IvlListIndex Prepend (IvlListItem*); +inline IvlList& operator << (IvlListItem* it) { Append (it); return *this; } - CcuListItem* RemoveFirst (); - CcuListItem* RemoveLast (); - int Remove (CcuListItem*, int = 1); - int Remove (int (*) (CcuListItem*), int = 1); + IvlListItem* RemoveFirst (); + IvlListItem* RemoveLast (); + int Remove (IvlListItem*, int = 1); + int Remove (int (*) (IvlListItem*), int = 1); void Clear (); - CcuListIndex InsertAfter (const CcuListIter&, CcuListItem*); - CcuListIndex InsertBefore (const CcuListIter&, CcuListItem*); - CcuListItem* RemoveAfter (const CcuListIter&); + IvlListIndex InsertAfter (const IvlListIter&, IvlListItem*); + IvlListIndex InsertBefore (const IvlListIter&, IvlListItem*); + IvlListItem* RemoveAfter (const IvlListIter&); }; -class CcuListIter { -friend class CcuList; +class IvlListIter { +friend class IvlList; public: enum listiter_status { Normal, StartOfList, EndOfList }; private: - const CcuList* TheList; + const IvlList* TheList; #ifdef CPLUS_BUG20 - CcuListLink* CurLink; + IvlListLink* CurLink; #else - CcuList::CcuListLink* CurLink; + IvlList::IvlListLink* CurLink; #endif listiter_status StatusFlag; public: -inline CcuListIter (const CcuList& l) : TheList (&l), CurLink (0), StatusFlag (StartOfList) { } - CcuListIter (const CcuList&, CcuListIndex); +inline IvlListIter (const IvlList& l) : TheList (&l), CurLink (0), StatusFlag (StartOfList) { } + IvlListIter (const IvlList&, IvlListIndex); inline void Reset () { CurLink = 0; StatusFlag = StartOfList; } -inline CcuListIter& operator = (const CcuList& l) { TheList = &l; CurLink = 0; StatusFlag = StartOfList; return *this; } -inline CcuListIter& operator = (const CcuListIter& li) { TheList = li.TheList; CurLink = li.CurLink; StatusFlag = li.StatusFlag; return *this; } - CcuListIter& operator ++ (); +inline IvlListIter& operator = (const IvlList& l) { TheList = &l; CurLink = 0; StatusFlag = StartOfList; return *this; } +inline IvlListIter& operator = (const IvlListIter& li) { TheList = li.TheList; CurLink = li.CurLink; StatusFlag = li.StatusFlag; return *this; } + IvlListIter& operator ++ (); #ifndef CPLUS_BUG16 - CcuListIter& operator ++ (int); + IvlListIter& operator ++ (int); #endif - CcuListItem* operator * () const; - int Find (CcuListItem*); + IvlListItem* operator * () const; + int Find (IvlListItem*); inline listiter_status GetStatus () const { return StatusFlag; } inline operator int () const { return StatusFlag == Normal; } }; #ifndef CPLUS_BUG19 -template class CcuListIterOf; +template class IvlListIterOf; -template class CcuListOf : public CcuList { +template class IvlListOf : public IvlList { public: -inline CcuListOf () : CcuList () {} -inline CcuListOf (ITEM* it) : CcuList (it) {} -inline ITEM* First () { return (ITEM*) (CcuList::First ()); } -inline ITEM* Last () { return (ITEM*) (CcuList::Last ()); } -inline ITEM* Nth (int n) { return (ITEM*) (CcuList::Nth (n)); } -inline int Find (ITEM* it, int* r = 0) const { return CcuList::Find (it, r); } - -inline CcuListIndex Append (ITEM* it) { return CcuList::Append (it); } -inline CcuListIndex Prepend (ITEM* it) { return CcuList::Prepend (it); } -inline CcuListOf& operator << (ITEM* it) { CcuList::Append (it); return *this; } - -inline ITEM* RemoveFirst () { return (ITEM*) (CcuList::RemoveFirst ()); } -inline ITEM* RemoveLast () { return (ITEM*) (CcuList::RemoveLast ()); } -inline int Remove (ITEM* it, int nb = 1) { return CcuList::Remove (it, nb); } -inline int Remove (int (*p) (ITEM*), int nb = 1) { return CcuList::Remove ((int (*) (void*)) p, nb); } - -inline CcuListIndex InsertAfter (const CcuListIterOf & li, ITEM*it) { return CcuList::InsertAfter (li, it); } -inline CcuListIndex InsertBefore (const CcuListIterOf & li, ITEM* it) { return CcuList::InsertBefore (li, it); } -inline ITEM* RemoveAfter (const CcuListIterOf & li) { return (ITEM*) CcuList::RemoveAfter (li); } +inline IvlListOf () : IvlList () {} +inline IvlListOf (ITEM* it) : IvlList (it) {} +inline ITEM* First () { return (ITEM*) (IvlList::First ()); } +inline ITEM* Last () { return (ITEM*) (IvlList::Last ()); } +inline ITEM* Nth (int n) { return (ITEM*) (IvlList::Nth (n)); } +inline int Find (ITEM* it, int* r = 0) const { return IvlList::Find (it, r); } + +inline IvlListIndex Append (ITEM* it) { return IvlList::Append (it); } +inline IvlListIndex Prepend (ITEM* it) { return IvlList::Prepend (it); } +inline IvlListOf& operator << (ITEM* it) { IvlList::Append (it); return *this; } + +inline ITEM* RemoveFirst () { return (ITEM*) (IvlList::RemoveFirst ()); } +inline ITEM* RemoveLast () { return (ITEM*) (IvlList::RemoveLast ()); } +inline int Remove (ITEM* it, int nb = 1) { return IvlList::Remove (it, nb); } +inline int Remove (int (*p) (ITEM*), int nb = 1) { return IvlList::Remove ((int (*) (void*)) p, nb); } + +inline IvlListIndex InsertAfter (const IvlListIterOf & li, ITEM*it) { return IvlList::InsertAfter (li, it); } +inline IvlListIndex InsertBefore (const IvlListIterOf & li, ITEM* it) { return IvlList::InsertBefore (li, it); } +inline ITEM* RemoveAfter (const IvlListIterOf & li) { return (ITEM*) IvlList::RemoveAfter (li); } }; -template class CcuListIterOf : public CcuListIter { +template class IvlListIterOf : public IvlListIter { public: -inline CcuListIterOf (const CcuListOf & l) : CcuListIter (l) { } -inline CcuListIterOf& operator = (const CcuListOf & l) { return (CcuListIterOf &) CcuListIter::operator = (l); } -inline CcuListIterOf& operator = (const CcuListIterOf & li) { return (CcuListIterOf &) CcuListIter::operator = (li); } -inline CcuListIterOf& operator ++ () { return (CcuListIterOf &) CcuListIter::operator ++ (); } -inline ITEM* operator * () const { return (ITEM*) CcuListIter::operator * (); } -inline int Find (ITEM* it) { return CcuListIter::Find (it); } +inline IvlListIterOf (const IvlListOf & l) : IvlListIter (l) { } +inline IvlListIterOf& operator = (const IvlListOf & l) { return (IvlListIterOf &) IvlListIter::operator = (l); } +inline IvlListIterOf& operator = (const IvlListIterOf & li) { return (IvlListIterOf &) IvlListIter::operator = (li); } +inline IvlListIterOf& operator ++ () { return (IvlListIterOf &) IvlListIter::operator ++ (); } +inline ITEM* operator * () const { return (ITEM*) IvlListIter::operator * (); } +inline int Find (ITEM* it) { return IvlListIter::Find (it); } }; #endif /* CPLUS_BUG19 */ -typedef CcuListItem CcuStackItem; +typedef IvlListItem IvlStackItem; /* CPLUS_BUG10 */ -class CcuStack : _private CcuList { +class IvlStack : _private IvlList { public: - CcuList :: Clear; - CcuList :: IsEmpty; - CcuList :: GetStatus; -inline void Push (CcuStackItem* p) { Prepend (p); } -inline CcuStackItem* Pop () { return RemoveFirst (); } -inline CcuStackItem* Top () { return First (); } + IvlList :: Clear; + IvlList :: IsEmpty; + IvlList :: GetStatus; +inline void Push (IvlStackItem* p) { Prepend (p); } +inline IvlStackItem* Pop () { return RemoveFirst (); } +inline IvlStackItem* Top () { return First (); } }; #ifndef CPLUS_BUG19 -template class CcuStackOf : public CcuStack { +template class IvlStackOf : public IvlStack { public: -inline void Push (ITEM* p) { CcuStack::Push (p); } -inline ITEM* Pop () { return (ITEM*) CcuStack::Pop (); } -inline ITEM* Top () { return (ITEM*) CcuStack::Top (); } -inline operator const CcuListOf & () { return *(CcuListOf *) this; } +inline void Push (ITEM* p) { IvlStack::Push (p); } +inline ITEM* Pop () { return (ITEM*) IvlStack::Pop (); } +inline ITEM* Top () { return (ITEM*) IvlStack::Top (); } +inline operator const IvlListOf & () { return *(IvlListOf *) this; } }; #endif /* CPLUS_BUG19 */ -typedef CcuListItem CcuQueueItem; +typedef IvlListItem IvlQueueItem; +#if 0 /* CPLUS_BUG10 */ -class CcuQueue : _private CcuList { +class IvlQueue : _private IvlList { public: - CcuList :: Clear; - CcuList :: IsEmpty; - CcuList :: GetStatus; -inline void Put (CcuQueueItem* p) { Append (p); } -inline CcuQueueItem* Get () { return RemoveFirst (); } -inline operator const CcuList& () { return *this; } + IvlList :: Clear; + IvlList :: IsEmpty; + IvlList :: GetStatus; +inline void Put (IvlQueueItem* p) { Append (p); } +inline IvlQueueItem* Get () { return RemoveFirst (); } +inline operator const IvlList& () { return *this; } }; #ifndef CPLUS_BUG19 -template class CcuQueueOf : public CcuQueue { +template class IvlQueueOf : public IvlQueue { public: -inline void Put (ITEM* p) { CcuQueue::Put (p); } -inline ITEM* Get () { return (ITEM*) CcuQueue::Get (); } -inline operator const CcuListOf & () { return *(CcuListOf *) this; } +inline void Put (ITEM* p) { IvlQueue::Put (p); } +inline ITEM* Get () { return (ITEM*) IvlQueue::Get (); } +inline operator const IvlListOf & () { return *(IvlListOf *) this; } }; #endif /* CPLUS_BUG19 */ +#endif /* 0 */ + #endif /* List_H_ */ -- cgit v1.1