Article View: gnu.g++.bug
Article #1934g++ bug (part 2)
From: Ron Addie
Date: Mon, 01 May 1989 21:48
Date: Mon, 01 May 1989 21:48
612 lines
13764 bytes
13764 bytes
# This is part 2 of a two part message.
#
# To unbundle files into distribution package, on a Unix machine,
# go to the appropriate directory and sh this file
echo intDLList.h 1>&2
cat >intDLList.h <<'End of intDLList.h'
// This may look like C code, but it is really -*- C++ -*-
/*
Copyright (C) 1988 Free Software Foundation
written by Doug Lea (dl@rocky.oswego.edu)
This file is part of GNU CC.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY. No author or distributor
accepts responsibility to anyone for the consequences of using it
or for whether it serves any particular purpose or works at all,
unless he says so in writing. Refer to the GNU CC General Public
License for full details.
Everyone is granted permission to copy, modify and redistribute
GNU CC, but only under the conditions described in the
GNU CC General Public License. A copy of this license is
supposed to have been given to you along with GNU CC so you
can know your rights and responsibilities. It should be in a
file named COPYING. Among other things, the copyright notice
and this notice must be preserved on all copies.
*/
#ifndef _intDLList_h
#define _intDLList_h 1
#ifndef _intDLListNode_h
#define _intDLListNode_h 1
struct intDLListNode
{
intDLListNode* bk;
intDLListNode* fd;
int hd;
intDLListNode();
intDLListNode(int h,
intDLListNode* p = 0,
intDLListNode* n = 0);
~intDLListNode();
};
inline intDLListNode::intDLListNode() {}
inline intDLListNode::intDLListNode(int h, intDLListNode* p = 0,
intDLListNode* n = 0)
{
hd = h;
bk = p;
fd = n;
}
inline intDLListNode::~intDLListNode() {}
typedef intDLListNode* intDLListNodePtr;
#endif
class intDLListTrav;
class intDLList
{
friend class intDLListTrav;
intDLListNode* h;
public:
intDLList();
intDLList(intDLList& a);
~intDLList();
intDLList& operator = (intDLList& a);
int null();
int empty();
int valid();
const void* operator void* ();
int operator ! ();
int length();
void clear();
void prepend(int item);
void append(int item);
int& front();
int remove_front();
void del_front();
int& rear();
int remove_rear();
void del_rear();
void error(const char* msg);
};
class intDLListTrav
{
friend class intDLList;
intDLList* L;
intDLListNode* current;
public:
intDLListTrav(intDLList& l, int dir = 1);
~intDLListTrav();
int null();
int valid();
const void* operator void* ();
int operator ! ();
void advance(int dir = 1);
int& get();
void reset(int dir = 1);
void reset(intDLList& l, int dir = 1);
void insert_after(int item);
void insert_before(int item);
void del(int dir = 1);
};
extern void default_intDLList_error_handler(char*);
extern one_arg_error_handler_t intDLList_error_handler;
extern one_arg_error_handler_t
set_intDLList_error_handler(one_arg_error_handler_t f);
inline intDLList::~intDLList()
{
clear();
}
inline intDLList::intDLList()
{
h = 0;
}
inline int intDLList::null()
{
return h == 0;
}
inline int intDLList::empty()
{
return h == 0;
}
inline int intDLList::valid()
{
return h != 0;
}
inline const void* intDLList::operator void* ()
{
return (h == 0)? 0 : this;
}
inline int intDLList::operator ! ()
{
return h == 0;
}
inline int intDLList::length()
{
if (h == 0)
return 0;
else
{
int l = 1;
for (intDLListNode* p = h->fd; p != h; p = p->fd) ++l;
return l;
}
}
inline intDLListTrav::intDLListTrav(intDLList& a, int dir = 1)
{
L = &a;
if ((current = L->h) != 0 && dir < 0) current = current->bk;
}
inline void intDLListTrav::reset(intDLList& a, int dir = 1)
{
L = &a;
if ((current = L->h) != 0 && dir < 0) current = current->bk;
}
inline void intDLListTrav::reset(int dir = 1)
{
if ((current = L->h) != 0 && dir < 0) current = current->bk;
}
inline intDLListTrav::~intDLListTrav() {}
inline int intDLListTrav::null()
{
return current == 0;
}
inline int intDLListTrav::valid()
{
return current != 0;
}
inline const void* intDLListTrav::operator void* ()
{
return (current == 0)? 0 : this;
}
inline int intDLListTrav::operator ! ()
{
return (current == 0);
}
inline void intDLListTrav::advance(int dir = 1)
{
if (current != 0)
{
if (dir < 0)
current = (current == L->h)? 0 : current->bk;
else
current = (current == L->h->bk)? 0 : current->fd;
}
}
inline int& intDLListTrav::get()
{
if (current == 0)
(*intDLList_error_handler)("get from null traverser");
return current->hd;
}
inline int& intDLList::front()
{
if (h == 0)
error("front: empty list");
return h->hd;
}
inline int& intDLList::rear()
{
if (h == 0)
error("rear: empty list");
return h->bk->hd;
}
#endif
End of intDLList.h
echo intSLList.h 1>&2
cat >intSLList.h <<'End of intSLList.h'
// This may look like C code, but it is really -*- C++ -*-
/*
Copyright (C) 1988 Free Software Foundation
written by Doug Lea (dl@rocky.oswego.edu)
This file is part of GNU CC.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY. No author or distributor
accepts responsibility to anyone for the consequences of using it
or for whether it serves any particular purpose or works at all,
unless he says so in writing. Refer to the GNU CC General Public
License for full details.
Everyone is granted permission to copy, modify and redistribute
GNU CC, but only under the conditions described in the
GNU CC General Public License. A copy of this license is
supposed to have been given to you along with GNU CC so you
can know your rights and responsibilities. It should be in a
file named COPYING. Among other things, the copyright notice
and this notice must be preserved on all copies.
*/
#ifndef _intSLList_h
#define _intSLList_h 1
#ifndef _intSLListNode_h
#define _intSLListNode_h 1
struct intSLListNode
{
intSLListNode* tl;
int hd;
intSLListNode();
intSLListNode(int h, intSLListNode* t = 0);
~intSLListNode();
};
inline intSLListNode::intSLListNode() {}
inline intSLListNode::intSLListNode(int h, intSLListNode* t = 0)
{
hd = h;
tl = t;
}
inline intSLListNode::~intSLListNode() {}
typedef intSLListNode* intSLListNodePtr;
#endif
class intSLListTrav;
class intSLList
{
friend class intSLListTrav;
intSLListNode* last;
public:
intSLList();
intSLList(intSLList& a);
~intSLList();
intSLList& operator = (intSLList& a);
int null();
int empty();
int valid();
const void* operator void* ();
int operator ! ();
int length();
void clear();
void prepend(int item);
void append(int item);
int& front();
int& rear();
int remove_front();
int remove_front(int& item);
void del_front();
void error(const char* msg);
};
class intSLListTrav
{
friend class intSLList;
intSLList* L;
intSLListNode* current;
public:
intSLListTrav(intSLList& l);
~intSLListTrav();
int null();
int valid();
const void* operator void* ();
int operator ! ();
void advance();
int& get();
void reset();
void reset(intSLList& l);
void insert_after(int item);
};
class intSLStack : private intSLList
{
public:
intSLList::null();
intSLList::empty();
intSLList::clear();
intSLList::length();
intSLList::operator ! ();
intSLList::operator void*();
intSLList::error(const char* msg);
intSLStack();
intSLStack(intSLStack& a);
~intSLStack();
intSLStack& operator = (intSLStack& a);
void push(int item);
int pop();
int pop(int& x);
void del_top();
int& top();
};
class intSLQueue: private intSLList
{
public:
intSLList::null();
intSLList::empty();
intSLList::clear();
intSLList::length();
intSLList::operator ! ();
intSLList::operator void*();
intSLList::error(const char* msg);
intSLList::front();
intSLList::rear();
intSLList::del_front();
intSLQueue();
intSLQueue(intSLQueue& a);
~intSLQueue();
intSLQueue& operator = (intSLQueue& a);
void enq(int item);
int deq();
int deq(int& x);
};
extern void default_intSLList_error_handler(char*);
extern one_arg_error_handler_t intSLList_error_handler;
extern one_arg_error_handler_t
set_intSLList_error_handler(one_arg_error_handler_t f);
inline intSLList::~intSLList()
{
clear();
}
inline intSLList::intSLList()
{
last = 0;
}
inline int intSLList::null()
{
return last == 0;
}
inline int intSLList::empty()
{
return last == 0;
}
inline int intSLList::valid()
{
return last != 0;
}
inline const void* intSLList::operator void* ()
{
return (last == 0)? 0 : this;
}
inline int intSLList::operator ! ()
{
return last == 0;
}
inline int intSLList::length()
{
if (last == 0)
return 0;
else
{
int l = 1;
for (intSLListNode* p = last->tl; p != last; p = p->tl) ++l;
return l;
}
}
inline intSLListTrav::intSLListTrav(intSLList& a)
{
L = &a;
if (a.last == 0)
current = 0;
else
current = a.last->tl;
}
inline void intSLListTrav::reset()
{
if (L->last == 0) current = 0; else current = L->last->tl;
}
inline void intSLListTrav::reset(intSLList& a)
{
L = &a;
if (a.last == 0)
current = 0;
else
current = a.last->tl;
}
inline intSLListTrav::~intSLListTrav() {}
inline int intSLListTrav::null()
{
return current == 0;
}
inline int intSLListTrav::valid()
{
return current != 0;
}
inline const void* intSLListTrav::operator void* ()
{
return (current == 0)? 0 : this;
}
inline int intSLListTrav::operator ! ()
{
return (current == 0);
}
inline void intSLListTrav::advance()
{
if (current != 0)
{
current = (current == L->last)? 0 : current->tl;
}
}
inline int& intSLListTrav::get()
{
if (current == 0)
(*intSLList_error_handler)("get from null traverser");
return current->hd;
}
inline int& intSLList::front()
{
if (last == 0)
error("front: empty list");
return last->tl->hd;
}
inline int& intSLList::rear()
{
if (last == 0)
error("rear: empty list");
return last->hd;
}
inline intSLStack::intSLStack() {}
inline intSLStack::intSLStack(intSLStack& a) : (a) {}
inline intSLStack::~intSLStack() {}
inline intSLStack& intSLStack::operator = (intSLStack& a)
{
intSLList::operator = (a); return *this;
}
inline void intSLStack::push(int item)
{
intSLList::prepend(item);
}
inline void intSLStack::del_top()
{
intSLList::del_front();
}
inline int& intSLStack::top()
{
return intSLList::front();
}
inline int intSLStack::pop()
{
return intSLList::remove_front();
}
inline int intSLStack::pop(int& x)
{
return intSLList::remove_front(x);
}
inline intSLQueue::intSLQueue() {}
inline intSLQueue::intSLQueue(intSLQueue& a) : (a) {}
inline intSLQueue::~intSLQueue() {}
inline intSLQueue& intSLQueue::operator = (intSLQueue& a)
{
intSLList::operator = (a); return *this;
}
inline void intSLQueue::enq(int item)
{
intSLList::append(item);
}
inline int intSLQueue::deq()
{
return intSLList::remove_front();
}
inline int intSLQueue::deq(int& x)
{
return intSLList::remove_front(x);
}
#endif
End of intSLList.h
Technical Details
Message-ID:
<8905010648.AA02980@orion.trl.oz>Path:
arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!sirius.trl.oz.au!addieShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!sirius.trl.oz.au!addie From: addie@sirius.trl.oz.au (Ron Addie) Newsgroups: gnu.g++.bug Subject: g++ bug (part 2) Message-ID: <8905010648.AA02980@orion.trl.oz> Date: 1 May 89 21:48:03 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 612