Article View: gnu.g++.bug
Article #1339Internal compiler error report
From: Chris Lang
Date: Wed, 06 Jan 1993 09:00
Date: Wed, 06 Jan 1993 09:00
1030 lines
29423 bytes
29423 bytes
I have encountered an internal compiler error with gcc-2.3.3 and libg++-2.3.
I have attached the output from the compiler as well as all the files needed
to reproduce it (minus the standard headers from libg++-2.3).
Is this an already-known bug? If so, is there a solution or workaround that
doesn't involve waiting for the next patch to gcc? Thanks in advance.
-Chris Lang
--
Chris Lang | National Center for Manufacturing Sciences
chrisl@mirc00.ncms.org | 900 Victors Way, Suite 310
+1 313 995 0300 | Ann Arbor, MI 48108
--------------------------------- cut here ---------------------------------
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# make.out
# String.DirectoryEntry.AVLMap.cc
# String.DirectoryEntry.AVLMap.h
# String.DirectoryEntry.Map.h
# String.defs.h
# DirectoryEntry.defs.h
# DirectoryEntry.h
#
echo x - make.out
sed 's/^X//' >make.out << 'END-of-make.out'
Xgcc -c String.DirectoryEntry.AVLMap.cc
XString.DirectoryEntry.AVLMap.cc: In method `StringDirectoryEntryAVLMap::StringDirectoryEntryAVLMap (class StringDirectoryEntryAVLMap&)':
XString.DirectoryEntry.AVLMap.cc:577: Internal compiler error.
XString.DirectoryEntry.AVLMap.cc:577: Please report this to `bug-g++@prep.ai.mit.edu'.
X*** Error code 1
X
XStop.
END-of-make.out
echo x - String.DirectoryEntry.AVLMap.cc
sed 's/^X//' >String.DirectoryEntry.AVLMap.cc << 'END-of-String.DirectoryEntry.AVLMap.cc'
X// This may look like C code, but it is really -*- C++ -*-
X/*
XCopyright (C) 1988 Free Software Foundation
X written by Doug Lea (dl@rocky.oswego.edu)
X
XThis file is part of the GNU C++ Library. This library is free
Xsoftware; you can redistribute it and/or modify it under the terms of
Xthe GNU Library General Public License as published by the Free
XSoftware Foundation; either version 2 of the License, or (at your
Xoption) any later version. This library is distributed in the hope
Xthat it will be useful, but WITHOUT ANY WARRANTY; without even the
Ximplied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
XPURPOSE. See the GNU Library General Public License for more details.
XYou should have received a copy of the GNU Library General Public
XLicense along with this library; if not, write to the Free Software
XFoundation, 675 Mass Ave, Cambridge, MA 02139, USA.
X*/
X
X#ifdef __GNUG__
X#pragma implementation
X#endif
X#include <stream.h>
X#include "String.DirectoryEntry.AVLMap.h"
X
X
X/*
X constants & inlines for maintaining balance & thread status in tree nodes
X*/
X
X#define AVLBALANCEMASK 3
X#define AVLBALANCED 0
X#define AVLLEFTHEAVY 1
X#define AVLRIGHTHEAVY 2
X
X#define LTHREADBIT 4
X#define RTHREADBIT 8
X
X
Xstatic inline int bf(StringDirectoryEntryAVLNode* t)
X{
X return t->stat & AVLBALANCEMASK;
X}
X
Xstatic inline void set_bf(StringDirectoryEntryAVLNode* t, int b)
X{
X t->stat = (t->stat & ~AVLBALANCEMASK) | (b & AVLBALANCEMASK);
X}
X
X
Xstatic inline int rthread(StringDirectoryEntryAVLNode* t)
X{
X return t->stat & RTHREADBIT;
X}
X
Xstatic inline void set_rthread(StringDirectoryEntryAVLNode* t, int b)
X{
X if (b)
X t->stat |= RTHREADBIT;
X else
X t->stat &= ~RTHREADBIT;
X}
X
Xstatic inline int lthread(StringDirectoryEntryAVLNode* t)
X{
X return t->stat & LTHREADBIT;
X}
X
Xstatic inline void set_lthread(StringDirectoryEntryAVLNode* t, int b)
X{
X if (b)
X t->stat |= LTHREADBIT;
X else
X t->stat &= ~LTHREADBIT;
X}
X
X/*
X traversal primitives
X*/
X
X
XStringDirectoryEntryAVLNode* StringDirectoryEntryAVLMap::leftmost()
X{
X StringDirectoryEntryAVLNode* t = root;
X if (t != 0) while (t->lt != 0) t = t->lt;
X return t;
X}
X
XStringDirectoryEntryAVLNode* StringDirectoryEntryAVLMap::rightmost()
X{
X StringDirectoryEntryAVLNode* t = root;
X if (t != 0) while (t->rt != 0) t = t->rt;
X return t;
X}
X
XStringDirectoryEntryAVLNode* StringDirectoryEntryAVLMap::succ(StringDirectoryEntryAVLNode* t)
X{
X StringDirectoryEntryAVLNode* r = t->rt;
X if (!rthread(t)) while (!lthread(r)) r = r->lt;
X return r;
X}
X
XStringDirectoryEntryAVLNode* StringDirectoryEntryAVLMap::pred(StringDirectoryEntryAVLNode* t)
X{
X StringDirectoryEntryAVLNode* l = t->lt;
X if (!lthread(t)) while (!rthread(l)) l = l->rt;
X return l;
X}
X
X
XPix StringDirectoryEntryAVLMap::seek(String key)
X{
X StringDirectoryEntryAVLNode* t = root;
X if (t == 0)
X return 0;
X for (;;)
X {
X int cmp = StringCMP(key, t->item);
X if (cmp == 0)
X return Pix(t);
X else if (cmp < 0)
X {
X if (lthread(t))
X return 0;
X else
X t = t->lt;
X }
X else if (rthread(t))
X return 0;
X else
X t = t->rt;
X }
X}
X
X
X/*
X The combination of threads and AVL bits make adding & deleting
X interesting, but very awkward.
X
X We use the following statics to avoid passing them around recursively
X*/
X
Xstatic int _need_rebalancing; // to send back balance info from rec. calls
Xstatic String* _target_item; // add/del_item target
Xstatic StringDirectoryEntryAVLNode* _found_node; // returned added/deleted node
Xstatic int _already_found; // for deletion subcases
X
X
Xvoid StringDirectoryEntryAVLMap:: _add(StringDirectoryEntryAVLNode*& t)
X{
X int cmp = StringCMP(*_target_item, t->item);
X if (cmp == 0)
X {
X _found_node = t;
X return;
X }
X else if (cmp < 0)
X {
X if (lthread(t))
X {
X ++count;
X _found_node = new StringDirectoryEntryAVLNode(*_target_item, def);
X set_lthread(_found_node, 1);
X set_rthread(_found_node, 1);
X _found_node->lt = t->lt;
X _found_node->rt = t;
X t->lt = _found_node;
X set_lthread(t, 0);
X _need_rebalancing = 1;
X }
X else
X _add(t->lt);
X if (_need_rebalancing)
X {
X switch(bf(t))
X {
X case AVLRIGHTHEAVY:
X set_bf(t, AVLBALANCED);
X _need_rebalancing = 0;
X return;
X case AVLBALANCED:
X set_bf(t, AVLLEFTHEAVY);
X return;
X case AVLLEFTHEAVY:
X StringDirectoryEntryAVLNode* l = t->lt;
X if (bf(l) == AVLLEFTHEAVY)
X {
X if (rthread(l))
X t->lt = l;
X else
X t->lt = l->rt;
X set_lthread(t, rthread(l));
X l->rt = t;
X set_rthread(l, 0);
X set_bf(t, AVLBALANCED);
X set_bf(l, AVLBALANCED);
X t = l;
X _need_rebalancing = 0;
X }
X else
X {
X StringDirectoryEntryAVLNode* r = l->rt;
X set_rthread(l, lthread(r));
X if (lthread(r))
X l->rt = r;
X else
X l->rt = r->lt;
X r->lt = l;
X set_lthread(r, 0);
X set_lthread(t, rthread(r));
X if (rthread(r))
X t->lt = r;
X else
X t->lt = r->rt;
X r->rt = t;
X set_rthread(r, 0);
X if (bf(r) == AVLLEFTHEAVY)
X set_bf(t, AVLRIGHTHEAVY);
X else
X set_bf(t, AVLBALANCED);
X if (bf(r) == AVLRIGHTHEAVY)
X set_bf(l, AVLLEFTHEAVY);
X else
X set_bf(l, AVLBALANCED);
X set_bf(r, AVLBALANCED);
X t = r;
X _need_rebalancing = 0;
X return;
X }
X }
X }
X }
X else
X {
X if (rthread(t))
X {
X ++count;
X _found_node = new StringDirectoryEntryAVLNode(*_target_item, def);
X set_rthread(t, 0);
X set_lthread(_found_node, 1);
X set_rthread(_found_node, 1);
X _found_node->lt = t;
X _found_node->rt = t->rt;
X t->rt = _found_node;
X _need_rebalancing = 1;
X }
X else
X _add(t->rt);
X if (_need_rebalancing)
X {
X switch(bf(t))
X {
X case AVLLEFTHEAVY:
X set_bf(t, AVLBALANCED);
X _need_rebalancing = 0;
X return;
X case AVLBALANCED:
X set_bf(t, AVLRIGHTHEAVY);
X return;
X case AVLRIGHTHEAVY:
X StringDirectoryEntryAVLNode* r = t->rt;
X if (bf(r) == AVLRIGHTHEAVY)
X {
X if (lthread(r))
X t->rt = r;
X else
X t->rt = r->lt;
X set_rthread(t, lthread(r));
X r->lt = t;
X set_lthread(r, 0);
X set_bf(t, AVLBALANCED);
X set_bf(r, AVLBALANCED);
X t = r;
X _need_rebalancing = 0;
X }
X else
X {
X StringDirectoryEntryAVLNode* l = r->lt;
X set_lthread(r, rthread(l));
X if (rthread(l))
X r->lt = l;
X else
X r->lt = l->rt;
X l->rt = r;
X set_rthread(l, 0);
X set_rthread(t, lthread(l));
X if (lthread(l))
X t->rt = l;
X else
X t->rt = l->lt;
X l->lt = t;
X set_lthread(l, 0);
X if (bf(l) == AVLRIGHTHEAVY)
X set_bf(t, AVLLEFTHEAVY);
X else
X set_bf(t, AVLBALANCED);
X if (bf(l) == AVLLEFTHEAVY)
X set_bf(r, AVLRIGHTHEAVY);
X else
X set_bf(r, AVLBALANCED);
X set_bf(l, AVLBALANCED);
X t = l;
X _need_rebalancing = 0;
X return;
X }
X }
X }
X }
X}
X
X
XDirectoryEntry& StringDirectoryEntryAVLMap::operator [] (String item)
X{
X if (root == 0)
X {
X ++count;
X root = new StringDirectoryEntryAVLNode(item, def);
X set_rthread(root, 1);
X set_lthread(root, 1);
X return root->cont;
X }
X else
X {
X _target_item = &item;
X _need_rebalancing = 0;
X _add(root);
X return _found_node->cont;
X }
X}
X
X
Xvoid StringDirectoryEntryAVLMap::_del(StringDirectoryEntryAVLNode* par, StringDirectoryEntryAVLNode*& t)
X{
X int comp;
X if (_already_found)
X {
X if (rthread(t))
X comp = 0;
X else
X comp = 1;
X }
X else
X comp = StringCMP(*_target_item, t->item);
X if (comp == 0)
X {
X if (lthread(t) && rthread(t))
X {
X _found_node = t;
X if (t == par->lt)
X {
X set_lthread(par, 1);
X par->lt = t->lt;
X }
X else
X {
X set_rthread(par, 1);
X par->rt = t->rt;
X }
X _need_rebalancing = 1;
X return;
X }
X else if (lthread(t))
X {
X _found_node = t;
X StringDirectoryEntryAVLNode* s = succ(t);
X if (s != 0 && lthread(s))
X s->lt = t->lt;
X t = t->rt;
X _need_rebalancing = 1;
X return;
X }
X else if (rthread(t))
X {
X _found_node = t;
X StringDirectoryEntryAVLNode* p = pred(t);
X if (p != 0 && rthread(p))
X p->rt = t->rt;
X t = t->lt;
X _need_rebalancing = 1;
X return;
X }
X else // replace item & find someone deletable
X {
X StringDirectoryEntryAVLNode* p = pred(t);
X t->item = p->item;
X t->cont = p->cont;
X _already_found = 1;
X comp = -1; // fall through below to left
X }
X }
X
X if (comp < 0)
X {
X if (lthread(t))
X return;
X _del(t, t->lt);
X if (!_need_rebalancing)
X return;
X switch (bf(t))
X {
X case AVLLEFTHEAVY:
X set_bf(t, AVLBALANCED);
X return;
X case AVLBALANCED:
X set_bf(t, AVLRIGHTHEAVY);
X _need_rebalancing = 0;
X return;
X case AVLRIGHTHEAVY:
X StringDirectoryEntryAVLNode* r = t->rt;
X switch (bf(r))
X {
X case AVLBALANCED:
X if (lthread(r))
X t->rt = r;
X else
X t->rt = r->lt;
X set_rthread(t, lthread(r));
X r->lt = t;
X set_lthread(r, 0);
X set_bf(t, AVLRIGHTHEAVY);
X set_bf(r, AVLLEFTHEAVY);
X _need_rebalancing = 0;
X t = r;
X return;
X case AVLRIGHTHEAVY:
X if (lthread(r))
X t->rt = r;
X else
X t->rt = r->lt;
X set_rthread(t, lthread(r));
X r->lt = t;
X set_lthread(r, 0);
X set_bf(t, AVLBALANCED);
X set_bf(r, AVLBALANCED);
X t = r;
X return;
X case AVLLEFTHEAVY:
X StringDirectoryEntryAVLNode* l = r->lt;
X set_lthread(r, rthread(l));
X if (rthread(l))
X r->lt = l;
X else
X r->lt = l->rt;
X l->rt = r;
X set_rthread(l, 0);
X set_rthread(t, lthread(l));
X if (lthread(l))
X t->rt = l;
X else
X t->rt = l->lt;
X l->lt = t;
X set_lthread(l, 0);
X if (bf(l) == AVLRIGHTHEAVY)
X set_bf(t, AVLLEFTHEAVY);
X else
X set_bf(t, AVLBALANCED);
X if (bf(l) == AVLLEFTHEAVY)
X set_bf(r, AVLRIGHTHEAVY);
X else
X set_bf(r, AVLBALANCED);
X set_bf(l, AVLBALANCED);
X t = l;
X return;
X }
X }
X }
X else
X {
X if (rthread(t))
X return;
X _del(t, t->rt);
X if (!_need_rebalancing)
X return;
X switch (bf(t))
X {
X case AVLRIGHTHEAVY:
X set_bf(t, AVLBALANCED);
X return;
X case AVLBALANCED:
X set_bf(t, AVLLEFTHEAVY);
X _need_rebalancing = 0;
X return;
X case AVLLEFTHEAVY:
X StringDirectoryEntryAVLNode* l = t->lt;
X switch (bf(l))
X {
X case AVLBALANCED:
X if (rthread(l))
X t->lt = l;
X else
X t->lt = l->rt;
X set_lthread(t, rthread(l));
X l->rt = t;
X set_rthread(l, 0);
X set_bf(t, AVLLEFTHEAVY);
X set_bf(l, AVLRIGHTHEAVY);
X _need_rebalancing = 0;
X t = l;
X return;
X case AVLLEFTHEAVY:
X if (rthread(l))
X t->lt = l;
X else
X t->lt = l->rt;
X set_lthread(t, rthread(l));
X l->rt = t;
X set_rthread(l, 0);
X set_bf(t, AVLBALANCED);
X set_bf(l, AVLBALANCED);
X t = l;
X return;
X case AVLRIGHTHEAVY:
X StringDirectoryEntryAVLNode* r = l->rt;
X set_rthread(l, lthread(r));
X if (lthread(r))
X l->rt = r;
X else
X l->rt = r->lt;
X r->lt = l;
X set_lthread(r, 0);
X set_lthread(t, rthread(r));
X if (rthread(r))
X t->lt = r;
X else
X t->lt = r->rt;
X r->rt = t;
X set_rthread(r, 0);
X if (bf(r) == AVLLEFTHEAVY)
X set_bf(t, AVLRIGHTHEAVY);
X else
X set_bf(t, AVLBALANCED);
X if (bf(r) == AVLRIGHTHEAVY)
X set_bf(l, AVLLEFTHEAVY);
X else
X set_bf(l, AVLBALANCED);
X set_bf(r, AVLBALANCED);
X t = r;
X return;
X }
X }
X }
X}
X
X
X
Xvoid StringDirectoryEntryAVLMap::del(String item)
X{
X if (root == 0) return;
X _need_rebalancing = 0;
X _already_found = 0;
X _found_node = 0;
X _target_item = &item;
X _del(root, root);
X if (_found_node)
X {
X delete(_found_node);
X if (--count == 0)
X root = 0;
X }
X}
X
Xvoid StringDirectoryEntryAVLMap::_kill(StringDirectoryEntryAVLNode* t)
X{
X if (t != 0)
X {
X if (!lthread(t)) _kill(t->lt);
X if (!rthread(t)) _kill(t->rt);
X delete t;
X }
X}
X
X
XStringDirectoryEntryAVLMap::StringDirectoryEntryAVLMap(StringDirectoryEntryAVLMap& b) :StringDirectoryEntryMap(b.def)
X{
X root = 0;
X count = 0;
X for (Pix i = b.first(); i != 0; b.next(i))
X (*this)[b.key(i)] = b.contents(i);
X}
X
X
Xint StringDirectoryEntryAVLMap::OK()
X{
X int v = 1;
X if (root == 0)
X v = count == 0;
X else
X {
X int n = 1;
X StringDirectoryEntryAVLNode* trail = leftmost();
X StringDirectoryEntryAVLNode* t = succ(trail);
X while (t != 0)
X {
X ++n;
X v &= StringCMP(trail->item, t->item) < 0;
X trail = t;
X t = succ(t);
X }
X v &= n == count;
X }
X if (!v) error("invariant failure");
X return v;
X}
END-of-String.DirectoryEntry.AVLMap.cc
echo x - String.DirectoryEntry.AVLMap.h
sed 's/^X//' >String.DirectoryEntry.AVLMap.h << 'END-of-String.DirectoryEntry.AVLMap.h'
X// This may look like C code, but it is really -*- C++ -*-
X/*
XCopyright (C) 1988 Free Software Foundation
X written by Doug Lea (dl@rocky.oswego.edu)
X
XThis file is part of the GNU C++ Library. This library is free
Xsoftware; you can redistribute it and/or modify it under the terms of
Xthe GNU Library General Public License as published by the Free
XSoftware Foundation; either version 2 of the License, or (at your
Xoption) any later version. This library is distributed in the hope
Xthat it will be useful, but WITHOUT ANY WARRANTY; without even the
Ximplied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
XPURPOSE. See the GNU Library General Public License for more details.
XYou should have received a copy of the GNU Library General Public
XLicense along with this library; if not, write to the Free Software
XFoundation, 675 Mass Ave, Cambridge, MA 02139, USA.
X*/
X
X
X#ifndef _StringDirectoryEntryAVLMap_h
X#ifdef __GNUG__
X#pragma interface
X#endif
X#define _StringDirectoryEntryAVLMap_h 1
X
X#include "String.DirectoryEntry.Map.h"
X
Xstruct StringDirectoryEntryAVLNode
X{
X StringDirectoryEntryAVLNode* lt;
X StringDirectoryEntryAVLNode* rt;
X String item;
X DirectoryEntry cont;
X char stat;
X StringDirectoryEntryAVLNode(String h, DirectoryEntry& c,
X StringDirectoryEntryAVLNode* l=0, StringDirectoryEntryAVLNode* r=0);
X ~StringDirectoryEntryAVLNode();
X};
X
Xinline StringDirectoryEntryAVLNode::StringDirectoryEntryAVLNode(String h, DirectoryEntry& c,
X StringDirectoryEntryAVLNode* l, StringDirectoryEntryAVLNode* r)
X :item(h), cont(c), lt(l), rt(r), stat(0) {}
X
Xinline StringDirectoryEntryAVLNode::~StringDirectoryEntryAVLNode() {}
X
Xtypedef StringDirectoryEntryAVLNode* StringDirectoryEntryAVLNodePtr;
X
X
Xclass StringDirectoryEntryAVLMap : public StringDirectoryEntryMap
X{
Xprotected:
X StringDirectoryEntryAVLNode* root;
X
X StringDirectoryEntryAVLNode* leftmost();
X StringDirectoryEntryAVLNode* rightmost();
X StringDirectoryEntryAVLNode* pred(StringDirectoryEntryAVLNode* t);
X StringDirectoryEntryAVLNode* succ(StringDirectoryEntryAVLNode* t);
X void _kill(StringDirectoryEntryAVLNode* t);
X void _add(StringDirectoryEntryAVLNode*& t);
X void _del(StringDirectoryEntryAVLNode* p, StringDirectoryEntryAVLNode*& t);
X
Xpublic:
X StringDirectoryEntryAVLMap(DirectoryEntry& dflt);
X StringDirectoryEntryAVLMap(StringDirectoryEntryAVLMap& a);
X ~StringDirectoryEntryAVLMap();
X
X DirectoryEntry& operator [] (String key);
X
X void del(String key);
X
X Pix first();
X void next(Pix& i);
X String& key(Pix i);
X DirectoryEntry& contents(Pix i);
X
X Pix seek(String key);
X int contains(String key);
X
X void clear();
X
X Pix last();
X void prev(Pix& i);
X
X int OK();
X};
X
Xinline StringDirectoryEntryAVLMap::~StringDirectoryEntryAVLMap()
X{
X _kill(root);
X}
X
Xinline StringDirectoryEntryAVLMap::StringDirectoryEntryAVLMap(DirectoryEntry& dflt) :StringDirectoryEntryMap(dflt)
X{
X root = 0;
X}
X
Xinline Pix StringDirectoryEntryAVLMap::first()
X{
X return Pix(leftmost());
X}
X
Xinline Pix StringDirectoryEntryAVLMap::last()
X{
X return Pix(rightmost());
X}
X
Xinline void StringDirectoryEntryAVLMap::next(Pix& i)
X{
X if (i != 0) i = Pix(succ((StringDirectoryEntryAVLNode*)i));
X}
X
Xinline void StringDirectoryEntryAVLMap::prev(Pix& i)
X{
X if (i != 0) i = Pix(pred((StringDirectoryEntryAVLNode*)i));
X}
X
Xinline String& StringDirectoryEntryAVLMap::key(Pix i)
X{
X if (i == 0) error("null Pix");
X return ((StringDirectoryEntryAVLNode*)i)->item;
X}
X
Xinline DirectoryEntry& StringDirectoryEntryAVLMap::contents(Pix i)
X{
X if (i == 0) error("null Pix");
X return ((StringDirectoryEntryAVLNode*)i)->cont;
X}
X
Xinline void StringDirectoryEntryAVLMap::clear()
X{
X _kill(root);
X count = 0;
X root = 0;
X}
X
Xinline int StringDirectoryEntryAVLMap::contains(String key)
X{
X return seek(key) != 0;
X}
X
X#endif
END-of-String.DirectoryEntry.AVLMap.h
echo x - String.DirectoryEntry.Map.h
sed 's/^X//' >String.DirectoryEntry.Map.h << 'END-of-String.DirectoryEntry.Map.h'
X// This may look like C code, but it is really -*- C++ -*-
X/*
XCopyright (C) 1988 Free Software Foundation
X written by Doug Lea (dl@rocky.oswego.edu)
X
XThis file is part of the GNU C++ Library. This library is free
Xsoftware; you can redistribute it and/or modify it under the terms of
Xthe GNU Library General Public License as published by the Free
XSoftware Foundation; either version 2 of the License, or (at your
Xoption) any later version. This library is distributed in the hope
Xthat it will be useful, but WITHOUT ANY WARRANTY; without even the
Ximplied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
XPURPOSE. See the GNU Library General Public License for more details.
XYou should have received a copy of the GNU Library General Public
XLicense along with this library; if not, write to the Free Software
XFoundation, 675 Mass Ave, Cambridge, MA 02139, USA.
X*/
X
X
X#ifndef _StringDirectoryEntryMap_h
X#ifdef __GNUG__
X#pragma interface
X#endif
X#define _StringDirectoryEntryMap_h 1
X
X#include <Pix.h>
X#include "String.defs.h"
X#include "DirectoryEntry.defs.h"
X
Xclass StringDirectoryEntryMap
X{
Xprotected:
X int count;
X DirectoryEntry def;
X
Xpublic:
X StringDirectoryEntryMap(DirectoryEntry& dflt);
X virtual ~StringDirectoryEntryMap();
X
X int length(); // current number of items
X int empty();
X
X virtual int contains(String key); // is key mapped?
X
X virtual void clear(); // delete all items
X
X virtual DirectoryEntry& operator [] (String key) = 0; // access contents by key
X
X virtual void del(String key) = 0; // delete entry
X
X virtual Pix first() = 0; // Pix of first item or 0
X virtual void next(Pix& i) = 0; // advance to next or 0
X virtual String& key(Pix i) = 0; // access key at i
X virtual DirectoryEntry& contents(Pix i) = 0; // access contents at i
X
X virtual int owns(Pix i); // is i a valid Pix ?
X virtual Pix seek(String key); // Pix of key
X
X DirectoryEntry& dflt(); // access default val
X
X void error(const char* msg);
X virtual int OK() = 0; // rep invariant
X};
X
X
Xinline StringDirectoryEntryMap::~StringDirectoryEntryMap() {}
X
Xinline int StringDirectoryEntryMap::length()
X{
X return count;
X}
X
Xinline int StringDirectoryEntryMap::empty()
X{
X return count == 0;
X}
X
Xinline DirectoryEntry& StringDirectoryEntryMap::dflt()
X{
X return def;
X}
X
Xinline StringDirectoryEntryMap::StringDirectoryEntryMap(DirectoryEntry& dflt) :def(dflt)
X{
X count = 0;
X}
X
X#endif
END-of-String.DirectoryEntry.Map.h
echo x - String.defs.h
sed 's/^X//' >String.defs.h << 'END-of-String.defs.h'
X// This may look like C code, but it is really -*- C++ -*-
X/*
XCopyright (C) 1988 Free Software Foundation
X written by Doug Lea (dl@rocky.oswego.edu)
X
XThis file is part of the GNU C++ Library. This library is free
Xsoftware; you can redistribute it and/or modify it under the terms of
Xthe GNU Library General Public License as published by the Free
XSoftware Foundation; either version 2 of the License, or (at your
Xoption) any later version. This library is distributed in the hope
Xthat it will be useful, but WITHOUT ANY WARRANTY; without even the
Ximplied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
XPURPOSE. See the GNU Library General Public License for more details.
XYou should have received a copy of the GNU Library General Public
XLicense along with this library; if not, write to the Free Software
XFoundation, 675 Mass Ave, Cambridge, MA 02139, USA.
X*/
X
X
X#ifndef _Stringdefs_h
X#define _Stringdefs_h 1
X
X#include <String.h>
X
X// equality operator
X#ifndef StringEQ
X#define StringEQ(a, b) ((a) == (b))
X#endif
X
X// less-than-or-equal
X#ifndef StringLE
X#define StringLE(a, b) ((a) <= (b))
X#endif
X
X// comparison : less-than -> < 0; equal -> 0; greater-than -> > 0
X#ifndef StringCMP
X#define StringCMP(a, b) ( ((a) <= (b))? (((a) == (b))? 0 : -1) : 1 )
X#endif
X
X// hash function
X#ifndef StringHASH
Xextern unsigned int hash(String );
X#define StringHASH(x) hash(x)
X#endif
X
X// initial capacity for structures requiring one
X
X#ifndef DEFAULT_INITIAL_CAPACITY
X#define DEFAULT_INITIAL_CAPACITY 100
X#endif
X
X// HASHTABLE_TOO_CROWDED(COUNT, SIZE) is true iff a hash table with COUNT
X// elements and SIZE slots is too full, and should be resized.
X// This is so if available space is less than 1/8.
X
X#define HASHTABLE_TOO_CROWDED(COUNT, SIZE) ((SIZE) - ((SIZE) >> 3) <= (COUNT))
X
X#endif
END-of-String.defs.h
echo x - DirectoryEntry.defs.h
sed 's/^X//' >DirectoryEntry.defs.h << 'END-of-DirectoryEntry.defs.h'
X// This may look like C code, but it is really -*- C++ -*-
X/*
XCopyright (C) 1988 Free Software Foundation
X written by Doug Lea (dl@rocky.oswego.edu)
X
XThis file is part of the GNU C++ Library. This library is free
Xsoftware; you can redistribute it and/or modify it under the terms of
Xthe GNU Library General Public License as published by the Free
XSoftware Foundation; either version 2 of the License, or (at your
Xoption) any later version. This library is distributed in the hope
Xthat it will be useful, but WITHOUT ANY WARRANTY; without even the
Ximplied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
XPURPOSE. See the GNU Library General Public License for more details.
XYou should have received a copy of the GNU Library General Public
XLicense along with this library; if not, write to the Free Software
XFoundation, 675 Mass Ave, Cambridge, MA 02139, USA.
X*/
X
X
X#ifndef _DirectoryEntrydefs_h
X#define _DirectoryEntrydefs_h 1
X
X
X#include "DirectoryEntry.h"
X
X// equality operator
X#ifndef DirectoryEntryEQ
X#define DirectoryEntryEQ(a, b) ((a) == (b))
X#endif
X
X// less-than-or-equal
X#ifndef DirectoryEntryLE
X#define DirectoryEntryLE(a, b) ((a) <= (b))
X#endif
X
X// comparison : less-than -> < 0; equal -> 0; greater-than -> > 0
X#ifndef DirectoryEntryCMP
X#define DirectoryEntryCMP(a, b) ( ((a) <= (b))? (((a) == (b))? 0 : -1) : 1 )
X#endif
X
X// hash function
X#ifndef DirectoryEntryHASH
Xextern unsigned int hash(DirectoryEntry&);
X#define DirectoryEntryHASH(x) hash(x)
X#endif
X
X// initial capacity for structures requiring one
X
X#ifndef DEFAULT_INITIAL_CAPACITY
X#define DEFAULT_INITIAL_CAPACITY 100
X#endif
X
X// HASHTABLE_TOO_CROWDED(COUNT, SIZE) is true iff a hash table with COUNT
X// elements and SIZE slots is too full, and should be resized.
X// This is so if available space is less than 1/8.
X
X#define HASHTABLE_TOO_CROWDED(COUNT, SIZE) ((SIZE) - ((SIZE) >> 3) <= (COUNT))
X
X#endif
END-of-DirectoryEntry.defs.h
echo x - DirectoryEntry.h
sed 's/^X//' >DirectoryEntry.h << 'END-of-DirectoryEntry.h'
X// This may look like C code, but it is really -*- C++ -*-
X
X#ifndef _directory_h
X#define _directory_h
X
Xclass DirectoryEntry {
X private:
X long st;
X long len;
X String name;
X
X public:
X DirectoryEntry(const DirectoryEntry &de) {
X st = de.st;
X len = de.len;
X }
X DirectoryEntry(String s) { name = s; }
X long& length(void) { return len; }
X long& start(void) { return st; }
X};
X
X
X#endif
END-of-DirectoryEntry.h
exit
Technical Details
Message-ID:
<9301061900.AA14198@mirc00.ncms.org>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!mirc00.ncms.org!chrislShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!mirc00.ncms.org!chrisl From: chrisl@mirc00.ncms.org (Chris Lang) Subject: Internal compiler error report Message-ID: <9301061900.AA14198@mirc00.ncms.org> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Wed, 6 Jan 1993 09:00:18 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 1032