From 5dfa5ca37d9bcd458161c75b282b1d2c6680050a Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Tue, 5 May 1998 18:06:58 +0000 Subject: [PATCH] rearranged to allow compilation by g++ 2.8.1 --- src/cxxTemplates/tsDLList.h | 101 +++++++++++++++++++---------- src/cxxTemplates/tsSLList.h | 15 +++-- src/libCom/cxxTemplates/tsDLList.h | 101 +++++++++++++++++++---------- src/libCom/cxxTemplates/tsSLList.h | 15 +++-- 4 files changed, 156 insertions(+), 76 deletions(-) diff --git a/src/cxxTemplates/tsDLList.h b/src/cxxTemplates/tsDLList.h index aca80fc7f..a06e60398 100644 --- a/src/cxxTemplates/tsDLList.h +++ b/src/cxxTemplates/tsDLList.h @@ -31,6 +31,9 @@ * * History * $Log$ + * Revision 1.10 1998/02/05 23:28:21 jhill + * fixed hp sompiler warnings + * * Revision 1.9 1997/06/13 09:21:52 jhill * fixed compiler compatibility problems * @@ -157,11 +160,14 @@ public: *this = addList; } else { + tsDLNode *pLastNode = this->pLast; + tsDLNode *pAddListFirstNode = addList.pFirst; + // // add addList to the end of this // - this->pLast->tsDLNode::pNext = addList.pFirst; - addList.pFirst->tsDLNode::pPrev = addList.pLast; + pLastNode->pNext = addList.pFirst; + pAddListFirstNode->pPrev = addList.pLast; this->pLast = addList.pLast; this->itemCount += addList.itemCount; } @@ -178,11 +184,14 @@ public: // void add (T &item) { - item.tsDLNode::pNext = 0; - item.tsDLNode::pPrev = this->pLast; + tsDLNode &node = item; + + node.pNext = 0; + node.pPrev = this->pLast; if (this->itemCount) { - this->pLast->tsDLNode::pNext = &item; + tsDLNode *pLastNode = this->pLast; + pLastNode->pNext = &item; } else { this->pFirst = &item; @@ -213,12 +222,16 @@ public: // void insertAfter (T &item, T &itemBefore) { - item.tsDLNode::pPrev = &itemBefore; - item.tsDLNode::pNext = itemBefore.tsDLNode::pNext; - itemBefore.tsDLNode::pNext = &item; + tsDLNode &node = item; + tsDLNode &nodeBefore = itemBefore; - if (item.tsDLNode::pNext) { - item.tsDLNode::pNext->tsDLNode::pPrev = &item; + node.pPrev = &itemBefore; + node.pNext = nodeBefore.pNext; + nodeBefore.pNext = &item; + + if (node.pNext) { + tsDLNode *pNextNode = node.pNext; + pNextNode->pPrev = &item; } else { this->pLast = &item; @@ -233,12 +246,16 @@ public: // void insertBefore (T &item, T &itemAfter) { - item.tsDLNode::pNext = &itemAfter; - item.tsDLNode::pPrev = itemAfter.tsDLNode::pPrev; - itemAfter.tsDLNode::pPrev = &item; + tsDLNode &node = item; + tsDLNode &nodeAfter = itemAfter; - if (item.tsDLNode::pPrev) { - item.tsDLNode::pPrev->tsDLNode::pNext = &item; + node.pNext = &itemAfter; + node.pPrev = nodeAfter.pPrev; + nodeAfter.pPrev = &item; + + if (node.pPrev) { + tsDLNode *pPrevNode = node.pPrev; + pPrevNode->pNext = &item; } else { this->pFirst = &item; @@ -252,20 +269,22 @@ public: // void remove (T &item) { + tsDLNode &node = item; + if (this->pLast == &item) { - this->pLast = item.tsDLNode::pPrev; + this->pLast = node.pPrev; } else { - item.tsDLNode::pNext->tsDLNode::pPrev = - item.tsDLNode::pPrev; + tsDLNode *pNextNode = node.pNext; + pNextNode->pPrev = node.pPrev; } if (this->pFirst == &item) { - this->pFirst = item.tsDLNode::pNext; + this->pFirst = node.pNext; } else { - item.tsDLNode::pPrev->tsDLNode::pNext = - item.tsDLNode::pNext; + tsDLNode *pPrevNode = node.pPrev; + pPrevNode->pNext = node.pNext; } this->itemCount--; @@ -285,11 +304,13 @@ public: // void push (T &item) { - item.tsDLNode::pPrev = 0; - item.tsDLNode::pNext = this->pFirst; + tsDLNode &node = item; + node.pPrev = 0; + node.pNext = this->pFirst; if (this->itemCount) { - this->pFirst->tsDLNode::pPrev = &item; + tsDLNode *pFirstNode = this->pFirst; + pFirstNode->pPrev = &item; } else { this->pLast = &item; @@ -393,7 +414,8 @@ public: // T *operator ++ () { - return this->pEntry = this->pEntry->tsDLNode::pNext; + tsDLNode *pNode = this->pEntry; + return this->pEntry = pNode->pNext; } // @@ -402,7 +424,8 @@ public: T *operator ++ (int) { T *pE = this->pEntry; - this->pEntry = this->pEntry->tsDLNode::pNext; + tsDLNode *pNode = this->pEntry; + this->pEntry = pNode->pNext; return pE; } @@ -411,7 +434,8 @@ public: // T *operator -- () { - return this->pEntry = pEntry->tsDLNode::pPrev; + tsDLNode *pEntryNode = pEntry; + return this->pEntry = pEntryNode->pPrev; } // @@ -420,7 +444,8 @@ public: T *operator -- (int) { T *pE = this->pEntry; - this->pEntry = pEntry->tsDLNode::pPrev; + tsDLNode *pEntryNode = pEntry; + this->pEntry = pEntryNode->pPrev; return pE; } private: @@ -467,7 +492,8 @@ public: pCur = this->pList->pFirst; } else { - pCur = pCur->tsDLNode::pNext; + tsDLNode *pCurNode = pCur; + pCur = pCurNode->pNext; } this->pCurrent = pCur; return pCur; @@ -480,7 +506,8 @@ public: pCur = this->pList->pLast; } else { - pCur = pCur->tsDLNode::pPrev; + tsDLNode *pCurNode = pCur; + pCur = pCurNode->pPrev; } this->pCurrent = pCur; return pCur; @@ -547,11 +574,13 @@ public: } T * next () { - return this->tsDLIter::next(); + tsDLIter &iterBase = *this; + return iterBase.next(); } T * first() { - return this->tsDLIter::first(); + tsDLIter &iterBase = *this; + return iterBase.first(); } // @@ -568,6 +597,8 @@ public: T *pCur = this->pCurrent; if (pCur) { + tsDLNode *pCurNode = pCur; + // // strip const (we didnt declare the // list const in the constructor) @@ -578,7 +609,7 @@ public: // // Move this->pCurrent to the previous item // - this->pCurrent = pCur->tsDLNode::pPrev; + this->pCurrent = pCurNode->pPrev; // // delete current item @@ -649,6 +680,8 @@ public: T *pCur = this->pCurrent; if (pCur) { + tsDLNode *pCurNode = pCur; + // // strip const (we didnt declare the // list const in the constructor) @@ -660,7 +693,7 @@ public: // Move this->pCurrent to the item after the // item being deleted // - this->pCurrent = pCur->tsDLNode::pNext; + this->pCurrent = pCurNode->pNext; // // delete current item diff --git a/src/cxxTemplates/tsSLList.h b/src/cxxTemplates/tsSLList.h index 0fe397a8b..9dad74527 100644 --- a/src/cxxTemplates/tsSLList.h +++ b/src/cxxTemplates/tsSLList.h @@ -31,6 +31,9 @@ * * History * $Log$ + * Revision 1.10 1998/02/18 22:53:13 jhill + * fixed gnu warning + * * Revision 1.9 1998/02/05 23:28:21 jhill * fixed hp sompiler warnings * @@ -107,7 +110,8 @@ public: // void insert (T &item, tsSLNode &itemBefore) { - item.tsSLNode::pNext = itemBefore.pNext; + tsSLNode &node = item; + node.pNext = itemBefore.pNext; itemBefore.pNext = &item; } @@ -127,9 +131,11 @@ public: // void remove (tsSLNode &itemBefore) { - T *pItem = itemBefore.tsSLNode::pNext; + tsSLNode &nodeBefore = itemBefore; + T *pItem = nodeBefore.pNext; if (pItem) { - itemBefore.tsSLNode::pNext = pItem->tsSLNode::pNext; + tsSLNode *pNode = pItem; + nodeBefore.pNext = pNode->pNext; } } @@ -138,7 +144,8 @@ public: // T * get() { - T *pItem = this->tsSLNode::pNext; + tsSLNode *pThisNode = this; + T *pItem = pThisNode->pNext; this->remove(*this); return pItem; } diff --git a/src/libCom/cxxTemplates/tsDLList.h b/src/libCom/cxxTemplates/tsDLList.h index aca80fc7f..a06e60398 100644 --- a/src/libCom/cxxTemplates/tsDLList.h +++ b/src/libCom/cxxTemplates/tsDLList.h @@ -31,6 +31,9 @@ * * History * $Log$ + * Revision 1.10 1998/02/05 23:28:21 jhill + * fixed hp sompiler warnings + * * Revision 1.9 1997/06/13 09:21:52 jhill * fixed compiler compatibility problems * @@ -157,11 +160,14 @@ public: *this = addList; } else { + tsDLNode *pLastNode = this->pLast; + tsDLNode *pAddListFirstNode = addList.pFirst; + // // add addList to the end of this // - this->pLast->tsDLNode::pNext = addList.pFirst; - addList.pFirst->tsDLNode::pPrev = addList.pLast; + pLastNode->pNext = addList.pFirst; + pAddListFirstNode->pPrev = addList.pLast; this->pLast = addList.pLast; this->itemCount += addList.itemCount; } @@ -178,11 +184,14 @@ public: // void add (T &item) { - item.tsDLNode::pNext = 0; - item.tsDLNode::pPrev = this->pLast; + tsDLNode &node = item; + + node.pNext = 0; + node.pPrev = this->pLast; if (this->itemCount) { - this->pLast->tsDLNode::pNext = &item; + tsDLNode *pLastNode = this->pLast; + pLastNode->pNext = &item; } else { this->pFirst = &item; @@ -213,12 +222,16 @@ public: // void insertAfter (T &item, T &itemBefore) { - item.tsDLNode::pPrev = &itemBefore; - item.tsDLNode::pNext = itemBefore.tsDLNode::pNext; - itemBefore.tsDLNode::pNext = &item; + tsDLNode &node = item; + tsDLNode &nodeBefore = itemBefore; - if (item.tsDLNode::pNext) { - item.tsDLNode::pNext->tsDLNode::pPrev = &item; + node.pPrev = &itemBefore; + node.pNext = nodeBefore.pNext; + nodeBefore.pNext = &item; + + if (node.pNext) { + tsDLNode *pNextNode = node.pNext; + pNextNode->pPrev = &item; } else { this->pLast = &item; @@ -233,12 +246,16 @@ public: // void insertBefore (T &item, T &itemAfter) { - item.tsDLNode::pNext = &itemAfter; - item.tsDLNode::pPrev = itemAfter.tsDLNode::pPrev; - itemAfter.tsDLNode::pPrev = &item; + tsDLNode &node = item; + tsDLNode &nodeAfter = itemAfter; - if (item.tsDLNode::pPrev) { - item.tsDLNode::pPrev->tsDLNode::pNext = &item; + node.pNext = &itemAfter; + node.pPrev = nodeAfter.pPrev; + nodeAfter.pPrev = &item; + + if (node.pPrev) { + tsDLNode *pPrevNode = node.pPrev; + pPrevNode->pNext = &item; } else { this->pFirst = &item; @@ -252,20 +269,22 @@ public: // void remove (T &item) { + tsDLNode &node = item; + if (this->pLast == &item) { - this->pLast = item.tsDLNode::pPrev; + this->pLast = node.pPrev; } else { - item.tsDLNode::pNext->tsDLNode::pPrev = - item.tsDLNode::pPrev; + tsDLNode *pNextNode = node.pNext; + pNextNode->pPrev = node.pPrev; } if (this->pFirst == &item) { - this->pFirst = item.tsDLNode::pNext; + this->pFirst = node.pNext; } else { - item.tsDLNode::pPrev->tsDLNode::pNext = - item.tsDLNode::pNext; + tsDLNode *pPrevNode = node.pPrev; + pPrevNode->pNext = node.pNext; } this->itemCount--; @@ -285,11 +304,13 @@ public: // void push (T &item) { - item.tsDLNode::pPrev = 0; - item.tsDLNode::pNext = this->pFirst; + tsDLNode &node = item; + node.pPrev = 0; + node.pNext = this->pFirst; if (this->itemCount) { - this->pFirst->tsDLNode::pPrev = &item; + tsDLNode *pFirstNode = this->pFirst; + pFirstNode->pPrev = &item; } else { this->pLast = &item; @@ -393,7 +414,8 @@ public: // T *operator ++ () { - return this->pEntry = this->pEntry->tsDLNode::pNext; + tsDLNode *pNode = this->pEntry; + return this->pEntry = pNode->pNext; } // @@ -402,7 +424,8 @@ public: T *operator ++ (int) { T *pE = this->pEntry; - this->pEntry = this->pEntry->tsDLNode::pNext; + tsDLNode *pNode = this->pEntry; + this->pEntry = pNode->pNext; return pE; } @@ -411,7 +434,8 @@ public: // T *operator -- () { - return this->pEntry = pEntry->tsDLNode::pPrev; + tsDLNode *pEntryNode = pEntry; + return this->pEntry = pEntryNode->pPrev; } // @@ -420,7 +444,8 @@ public: T *operator -- (int) { T *pE = this->pEntry; - this->pEntry = pEntry->tsDLNode::pPrev; + tsDLNode *pEntryNode = pEntry; + this->pEntry = pEntryNode->pPrev; return pE; } private: @@ -467,7 +492,8 @@ public: pCur = this->pList->pFirst; } else { - pCur = pCur->tsDLNode::pNext; + tsDLNode *pCurNode = pCur; + pCur = pCurNode->pNext; } this->pCurrent = pCur; return pCur; @@ -480,7 +506,8 @@ public: pCur = this->pList->pLast; } else { - pCur = pCur->tsDLNode::pPrev; + tsDLNode *pCurNode = pCur; + pCur = pCurNode->pPrev; } this->pCurrent = pCur; return pCur; @@ -547,11 +574,13 @@ public: } T * next () { - return this->tsDLIter::next(); + tsDLIter &iterBase = *this; + return iterBase.next(); } T * first() { - return this->tsDLIter::first(); + tsDLIter &iterBase = *this; + return iterBase.first(); } // @@ -568,6 +597,8 @@ public: T *pCur = this->pCurrent; if (pCur) { + tsDLNode *pCurNode = pCur; + // // strip const (we didnt declare the // list const in the constructor) @@ -578,7 +609,7 @@ public: // // Move this->pCurrent to the previous item // - this->pCurrent = pCur->tsDLNode::pPrev; + this->pCurrent = pCurNode->pPrev; // // delete current item @@ -649,6 +680,8 @@ public: T *pCur = this->pCurrent; if (pCur) { + tsDLNode *pCurNode = pCur; + // // strip const (we didnt declare the // list const in the constructor) @@ -660,7 +693,7 @@ public: // Move this->pCurrent to the item after the // item being deleted // - this->pCurrent = pCur->tsDLNode::pNext; + this->pCurrent = pCurNode->pNext; // // delete current item diff --git a/src/libCom/cxxTemplates/tsSLList.h b/src/libCom/cxxTemplates/tsSLList.h index 0fe397a8b..9dad74527 100644 --- a/src/libCom/cxxTemplates/tsSLList.h +++ b/src/libCom/cxxTemplates/tsSLList.h @@ -31,6 +31,9 @@ * * History * $Log$ + * Revision 1.10 1998/02/18 22:53:13 jhill + * fixed gnu warning + * * Revision 1.9 1998/02/05 23:28:21 jhill * fixed hp sompiler warnings * @@ -107,7 +110,8 @@ public: // void insert (T &item, tsSLNode &itemBefore) { - item.tsSLNode::pNext = itemBefore.pNext; + tsSLNode &node = item; + node.pNext = itemBefore.pNext; itemBefore.pNext = &item; } @@ -127,9 +131,11 @@ public: // void remove (tsSLNode &itemBefore) { - T *pItem = itemBefore.tsSLNode::pNext; + tsSLNode &nodeBefore = itemBefore; + T *pItem = nodeBefore.pNext; if (pItem) { - itemBefore.tsSLNode::pNext = pItem->tsSLNode::pNext; + tsSLNode *pNode = pItem; + nodeBefore.pNext = pNode->pNext; } } @@ -138,7 +144,8 @@ public: // T * get() { - T *pItem = this->tsSLNode::pNext; + tsSLNode *pThisNode = this; + T *pItem = pThisNode->pNext; this->remove(*this); return pItem; }