2 // Special g++ Options: -w
5 //# 1 "GctSymbol.GctSymbol.CHMap.cc"
6 // This may look like C code, but it is really -*- C++ -*-
8 Copyright (C) 1988 Free Software Foundation
9 written by Doug Lea (dl@rocky.oswego.edu)
11 This file is part of the GNU C++ Library. This library is free
12 software; you can redistribute it and/or modify it under the terms of
13 the GNU Library General Public License as published by the Free
14 Software Foundation; either version 2 of the License, or (at your
15 option) any later version. This library is distributed in the hope
16 that it will be useful, but WITHOUT ANY WARRANTY; without even the
17 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18 PURPOSE. See the GNU Library General Public License for more details.
19 You should have received a copy of the GNU Library General Public
20 License along with this library; if not, write to the Free Software
21 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
25 //#pragma implementation
27 //# 1 "GctSymbol.GctSymbol.CHMap.h" 1
28 // This may look like C code, but it is really -*- C++ -*-
30 Copyright (C) 1988 Free Software Foundation
31 written by Doug Lea (dl@rocky.oswego.edu)
33 This file is part of the GNU C++ Library. This library is free
34 software; you can redistribute it and/or modify it under the terms of
35 the GNU Library General Public License as published by the Free
36 Software Foundation; either version 2 of the License, or (at your
37 option) any later version. This library is distributed in the hope
38 that it will be useful, but WITHOUT ANY WARRANTY; without even the
39 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
40 PURPOSE. See the GNU Library General Public License for more details.
41 You should have received a copy of the GNU Library General Public
42 License along with this library; if not, write to the Free Software
43 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
53 //# 1 "GctSymbol.GctSymbol.Map.h" 1
54 // This may look like C code, but it is really -*- C++ -*-
56 Copyright (C) 1988 Free Software Foundation
57 written by Doug Lea (dl@rocky.oswego.edu)
59 This file is part of the GNU C++ Library. This library is free
60 software; you can redistribute it and/or modify it under the terms of
61 the GNU Library General Public License as published by the Free
62 Software Foundation; either version 2 of the License, or (at your
63 option) any later version. This library is distributed in the hope
64 that it will be useful, but WITHOUT ANY WARRANTY; without even the
65 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
66 PURPOSE. See the GNU Library General Public License for more details.
67 You should have received a copy of the GNU Library General Public
68 License along with this library; if not, write to the Free Software
69 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
79 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/Pix.h" 1
85 //# 26 "GctSymbol.GctSymbol.Map.h" 2
87 //# 1 "GctSymbol.defs.h" 1
88 // This may look like C code, but it is really -*- C++ -*-
90 Copyright (C) 1988 Free Software Foundation
91 written by Doug Lea (dl@rocky.oswego.edu)
93 This file is part of the GNU C++ Library. This library is free
94 software; you can redistribute it and/or modify it under the terms of
95 the GNU Library General Public License as published by the Free
96 Software Foundation; either version 2 of the License, or (at your
97 option) any later version. This library is distributed in the hope
98 that it will be useful, but WITHOUT ANY WARRANTY; without even the
99 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
100 PURPOSE. See the GNU Library General Public License for more details.
101 You should have received a copy of the GNU Library General Public
102 License along with this library; if not, write to the Free Software
103 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
112 //# 1 "../../GctSymbol.h" 1
120 // Expects to be included by Gct.h
122 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
132 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
135 // $Date: 1994/05/16 09:13:02 $
139 //# 25 "../../GctSymbol.h" 2
141 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 1
142 // This may look like C code, but it is really -*- C++ -*-
144 Copyright (C) 1988 Free Software Foundation
145 written by Doug Lea (dl@rocky.oswego.edu)
147 This file is part of the GNU C++ Library. This library is free
148 software; you can redistribute it and/or modify it under the terms of
149 the GNU Library General Public License as published by the Free
150 Software Foundation; either version 2 of the License, or (at your
151 option) any later version. This library is distributed in the hope
152 that it will be useful, but WITHOUT ANY WARRANTY; without even the
153 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
154 PURPOSE. See the GNU Library General Public License for more details.
155 You should have received a copy of the GNU Library General Public
156 License along with this library; if not, write to the Free Software
157 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
167 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stream.h" 1
171 // Compatibility with old library.
174 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
175 // This is part of the iostream library, providing -*- C++ -*- input/output.
176 // Copyright (C) 1991 Per Bothner.
178 // This library is free software; you can redistribute it and/or
179 // modify it under the terms of the GNU Library General Public
180 // License as published by the Free Software Foundation; either
181 // version 2 of the License, or (at your option) any later version.
183 // This library is distributed in the hope that it will be useful,
184 // but WITHOUT ANY WARRANTY; without even the implied warranty of
185 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
186 // Library General Public License for more details.
188 // You should have received a copy of the GNU Library General Public
189 // License along with this library; if not, write to the Free
190 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
199 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/streambuf.h" 1
200 // This is part of the iostream library, providing -*- C++ -*- input/output.
201 // Copyright (C) 1991 Per Bothner.
203 // This library is free software; you can redistribute it and/or
204 // modify it under the terms of the GNU Library General Public
205 // License as published by the Free Software Foundation; either
206 // version 2 of the License, or (at your option) any later version.
208 // This library is distributed in the hope that it will be useful,
209 // but WITHOUT ANY WARRANTY; without even the implied warranty of
210 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
211 // Library General Public License for more details.
213 // You should have received a copy of the GNU Library General Public
214 // License along with this library; if not, write to the Free
215 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
224 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 1
231 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/mips/lib/gcc/decstatn/cygnus-1.96/include/stddef.h" 1
238 /* This avoids lossage on Sunos but only if stdtypes.h comes first.
239 There's no way to win with the other order! Sun lossage. */
241 /* In case nobody has defined these types, but we aren't running under
242 GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
243 __WCHAR_TYPE__ have reasonable values. This can happen if the
244 parts of GCC is compiled by an older compiler, that actually
245 include gstddef.h, such as collect2. */
247 /* Signed type of difference of two pointers. */
262 typedef long int ptrdiff_t;
269 /* Unsigned type of `sizeof' something. */
284 typedef unsigned int size_t;
291 /* Data type for wide chars. */
315 /* A null pointer constant. */
320 /* Offset of member MEMBER in a struct of type TYPE. */
326 //# 7 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 2
333 //# 25 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/streambuf.h" 2
350 class ostream; class streambuf;
352 typedef long streamoff, streampos;
354 struct _ios_fields { // The data members of an ios.
358 unsigned long _flags;
360 unsigned char _state;
361 unsigned short _precision;
365 enum state_value { _good = 0, _eof = 1, _fail = 2, _bad = 4 };
368 class ios : public _ios_fields {
370 enum io_state { goodbit=0, eofbit=1, failbit=2, badbit=4 };
379 enum seek_dir { beg, cur, end};
380 enum { skipws=01, left=02, right=04, internal=010,
381 dec=020, oct=040, hex=0100,
382 showbase=0200, showpoint=0400, uppercase=01000, showpos=02000,
383 scientific=04000, fixed=0100000, unitbuf=020000, stdio=040000,
384 dont_close=0x80000000 //Don't close streambuf when destroying stream
387 ostream* tie() { return _tie; }
388 ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; }
390 // Methods to change the format state.
391 char fill() { return _fill; }
392 char fill(char newf) { char oldf = _fill; _fill = newf; return oldf; }
393 unsigned long flags() { return _flags; }
394 unsigned long flags(unsigned long new_val) {
395 unsigned long old_val = _flags; _flags = new_val; return old_val; }
396 unsigned short precision() { return _precision; }
397 unsigned short precision(int newp) {
398 unsigned short oldp = _precision; _precision = (unsigned short)newp;
400 unsigned long setf(unsigned long val) {
401 unsigned long oldbits = _flags;
402 _flags |= val; return oldbits; }
403 unsigned long setf(unsigned long val, unsigned long mask) {
404 unsigned long oldbits = _flags;
405 _flags = (_flags & ~mask) | (val & mask); return oldbits; }
406 unsigned long unsetf(unsigned long mask) {
407 unsigned long oldbits = _flags & mask;
408 _flags &= ~mask; return oldbits; }
409 long width() { return _width; }
410 long width(long val) { long save = _width; _width = val; return save; }
412 static const unsigned long basefield;
413 static const unsigned long adjustfield;
414 static const unsigned long floatfield;
416 streambuf* rdbuf() { return _strbuf; }
417 void clear(int state = 0) { _state = state; }
418 int good() { return _state == 0; }
419 int eof() { return _state & ios::eofbit; }
420 int fail() { return _state & (ios::badbit|ios::failbit); }
421 int bad() { return _state & ios::badbit; }
422 int rdstate() { return _state; }
423 void set(int flag) { _state |= flag; }
424 operator void*() { return fail() ? (void*)0 : (void*)this; }
425 int operator!() { return fail(); }
428 void unset(state_value flag) { _state &= ~flag; }
436 ios(streambuf*sb) { _strbuf=sb; _state=0; _width=0; _fill=' ';
437 _flags=ios::skipws; _precision=6; }
443 typedef ios::seek_dir _seek_dir;
446 // Magic numbers and bits for the _flags field.
447 // The magic numbers use the high-order bits of _flags;
448 // the remaining bits are abailable for variable flags.
449 // Note: The magic numbers must all be negative if stdio
450 // emulation is desired.
467 // NOTE: If this is changed, also change __FILE in stdio/stdio.h!
468 int _flags; /* High-order word is _IO_MAGIC; rest is flags. */
469 char* _gptr; /* Current get pointer */
470 char* _egptr; /* End of get area. */
471 char* _eback; /* Start of putback+get area. */
472 char* _pbase; /* Start of put area. */
473 char* _pptr; /* Current put pointer. */
474 char* _epptr; /* End of put area. */
475 char* _base; /* Start of reserve area. */
476 char* _ebuf; /* End of reserve area. */
477 struct streambuf *_chain;
480 struct streambuf : private __streambuf {
482 friend class istream;
483 friend class ostream;
485 static streambuf* _list_all; /* List of open streambufs. */
486 streambuf*& xchain() { return _chain; }
489 char* gptr() const { return _gptr; }
490 char* pptr() const { return _pptr; }
491 char* egptr() const { return _egptr; }
492 char* epptr() const { return _epptr; }
493 char* pbase() const { return _pbase; }
494 char* eback() const { return _eback; }
495 char* ebuf() const { return _ebuf; }
496 char* base() const { return _base; }
497 void xput_char(char c) { *_pptr++ = c; }
498 int xflags() { return _flags; }
499 int xflags(int f) { int fl = _flags; _flags = f; return fl; }
500 void xsetflags(int f) { _flags |= f; }
501 void gbump(int n) { _gptr += n; }
502 void pbump(int n) { _pptr += n; }
503 void setb(char* b, char* eb, int a=0);
504 void setp(char* p, char* ep) { _pbase=_pptr=p; _epptr=ep; }
505 void setg(char* eb, char* g, char *eg) { _eback=eb; _gptr=g; _egptr=eg; }
507 static int flush_all();
508 static void flush_all_linebuffered(); // Flush all line buffered files.
509 virtual int underflow(); // Leave public for now
510 virtual int overflow(int c = (-1) ); // Leave public for now
511 virtual int doallocate();
512 virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
513 virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out);
514 int sputbackc(char c);
517 virtual ~streambuf();
518 int unbuffered() { return _flags & 2 ? 1 : 0; }
519 int linebuffered() { return _flags & 0x4000 ? 1 : 0; }
520 void unbuffered(int i)
521 { if (i) _flags |= 2 ; else _flags &= ~2 ; }
522 void linebuffered(int i)
523 { if (i) _flags |= 0x4000 ; else _flags &= ~0x4000 ; }
525 if (base() || unbuffered()) return 0;
526 else return doallocate(); }
528 virtual int pbackfail(int c);
529 virtual int ungetfail();
530 virtual streambuf* setbuf(char* p, int len);
531 int in_avail() { return _egptr - _gptr; }
532 int out_waiting() { return _pptr - _pbase; }
533 virtual int sputn(const char* s, int n);
534 virtual int sgetn(char* s, int n);
535 long sgetline(char* buf, size_t n, char delim, int putback_delim);
537 if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
538 else return *(unsigned char*)_gptr++; }
540 if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
541 else return *(unsigned char*)_gptr; }
543 if (++_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
544 else return *(unsigned char*)_gptr; }
546 if (_pptr >= _epptr) return overflow(c);
547 return *_pptr++ = c, (unsigned char)c; }
548 int vscan(char const *fmt0, char* ap);
549 int vform(char const *fmt0, char* ap);
552 struct __file_fields {
562 class filebuf : public streambuf {
563 struct __file_fields _fb;
568 filebuf(int fd, char* p, int len);
570 filebuf* attach(int fd);
571 filebuf* open(const char *filename, const char *mode);
572 filebuf* open(const char *filename, int mode, int prot = 0664);
573 virtual int underflow();
574 virtual int overflow(int c = (-1) );
575 int is_open() { return _fb._fileno >= 0; }
576 int fd() { return is_open() ? _fb._fileno : (-1) ; }
578 virtual int doallocate();
579 virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
580 int sputn(const char* s, int n);
581 int sgetn(char* s, int n);
582 protected: // See documentation in filebuf.C.
583 virtual int pbackfail(int c);
585 int is_reading() { return eback() != egptr(); }
586 char* cur_ptr() { return is_reading() ? gptr() : pptr(); }
587 /* System's idea of pointer */
588 char* file_ptr() { return _fb._save_gptr ? _fb._save_egptr : egptr(); }
590 // Low-level operations (Usually invoke system calls.)
591 virtual int sys_read(char* buf, size_t size);
592 virtual long sys_seek(long , _seek_dir);
593 virtual long sys_write(const void*, long);
594 virtual int sys_stat(void*); // Actually, a (struct stat*)
595 virtual int sys_close();
599 inline int ios::readable() { return rdbuf()->_flags & 4 ; }
600 inline int ios::writable() { return rdbuf()->_flags & 8 ; }
601 inline int ios::is_open() {return rdbuf()->_flags & 4 +8 ;}
606 //# 25 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 2
609 class istream; class ostream;
610 typedef istream& (*__imanip)(istream&);
611 typedef ostream& (*__omanip)(ostream&);
613 extern istream& ws(istream& ins);
614 extern ostream& flush(ostream& outs);
615 extern ostream& endl(ostream& outs);
616 extern ostream& ends(ostream& outs);
618 class ostream : public ios
623 ostream(streambuf* sb, ostream* tied=((void *)0) );
626 int opfx() { if (!good()) return 0; if (_tie) _tie->flush(); return 1; }
627 void osfx() { if (flags() & (ios::unitbuf|ios::stdio))
629 streambuf* ostreambuf() const { return _strbuf; }
631 ostream& put(char c);
632 ostream& write(const char *s, int n);
633 ostream& write(const unsigned char *s, int n) { return write((char*)s, n);}
634 ostream& write(const void *s, int n) { return write((char*)s, n);}
635 ostream& seekp(streampos);
636 ostream& seekp(streamoff, _seek_dir);
638 ostream& form(const char *format ...);
639 ostream& vform(const char *format, char* args);
642 ostream& operator<<(ostream&, char c);
643 ostream& operator<<(ostream& os, unsigned char c) { return os << (char)c; }
644 //ostream& operator<<(ostream &os, signed char c) { return os << (char)c; }
645 extern ostream& operator<<(ostream&, const char *s);
646 inline ostream& operator<<(ostream& os, const unsigned char *s)
647 { return os << (const char*)s; }
648 //inline ostream& operator<<(ostream& os, const signed char *s)
649 //{ return os << (const char*)s; }
650 ostream& operator<<(ostream&, void *p);
651 ostream& operator<<(ostream&, int n);
652 ostream& operator<<(ostream&, long n);
653 ostream& operator<<(ostream&, unsigned int n);
654 ostream& operator<<(ostream&, unsigned long n);
655 ostream& operator<<(ostream& os, short n) {return os << (int)n;}
656 ostream& operator<<(ostream& os, unsigned short n)
657 {return os << (unsigned int)n;}
658 ostream& operator<<(ostream&, float n);
659 ostream& operator<<(ostream&, double n);
660 ostream& operator<<(ostream& os, __omanip func) { return (*func)(os); }
661 ostream& operator<<(ostream&, streambuf*);
663 class istream : public ios
668 istream(streambuf* sb, ostream*tied=((void *)0) );
670 streambuf* istreambuf() const { return _strbuf; }
671 istream& get(char& c);
672 istream& get(unsigned char& c);
673 istream& read(char *ptr, int n);
674 istream& read(unsigned char *ptr, int n) { return read((char*)ptr, n); }
675 istream& read(void *ptr, int n) { return read((char*)ptr, n); }
676 int get() { return _strbuf->sbumpc(); }
677 istream& getline(char* ptr, int len, char delim = '\n');
678 istream& get(char* ptr, int len, char delim = '\n');
679 istream& gets(char **s, char delim = '\n');
681 if (!good()) { set(ios::failbit); return 0; }
682 if (_tie && (need == 0 || rdbuf()->in_avail())) ; //??? THIS LINE IS QUESTIONABLE */
683 if (!need && (flags() & ios::skipws) && !ws(*this)) return 0;
686 int ipfx0() { // Optimized version of ipfx(0).
687 if (!good()) { set(ios::failbit); return 0; }
688 if (_tie) _tie->flush();
689 if ((flags() & ios::skipws) && !ws(*this)) return 0;
692 int ipfx1() { // Optimized version of ipfx(1).
693 if (!good()) { set(ios::failbit); return 0; }
694 if (_tie && rdbuf()->in_avail() == 0) _tie->flush();
697 size_t gcount() { return _gcount; }
698 istream& seekg(streampos);
699 istream& seekg(streamoff, _seek_dir);
701 istream& putback(char ch) {
702 if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit);
705 if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit);
708 istream& unget(char ch) { return putback(ch); }
713 istream& operator>>(istream&, char*);
714 istream& operator>>(istream& is, unsigned char* p) { return is >> (char*)p; }
715 //istream& operator>>(istream& is, signed char* p) { return is >> (char*)p; }
716 istream& operator>>(istream&, char& c);
717 istream& operator>>(istream&, unsigned char& c);
718 //istream& operator>>(istream&, signed char& c);
719 istream& operator>>(istream&, int&);
720 istream& operator>>(istream&, long&);
721 istream& operator>>(istream&, short&);
722 istream& operator>>(istream&, unsigned int&);
723 istream& operator>>(istream&, unsigned long&);
724 istream& operator>>(istream&, unsigned short&);
725 istream& operator>>(istream&, float&);
726 istream& operator>>(istream&, double&);
727 istream& operator>>(istream& is, __imanip func) { return (*func)(is); }
729 class iostream : public ios {
733 operator istream&() { return *(istream*)this; }
734 operator ostream&() { return *(ostream*)this; }
736 // NOTE: These duplicate istream methods.
737 istream& get(char& c) { return ((istream*)this)->get(c); }
738 istream& get(unsigned char& c) { return ((istream*)this)->get(c); }
739 istream& read(char *ptr, int n) { return ((istream*)this)->read(ptr, n); }
740 istream& read(unsigned char *ptr, int n)
741 { return ((istream*)this)->read((char*)ptr, n); }
742 istream& read(void *ptr, int n)
743 { return ((istream*)this)->read((char*)ptr, n); }
744 int get() { return _strbuf->sbumpc(); }
745 istream& getline(char* ptr, int len, char delim = '\n')
746 { return ((istream*)this)->getline(ptr, len, delim); }
747 istream& get(char* ptr, int len, char delim = '\n')
748 { return ((istream*)this)->get(ptr, len, delim); }
749 istream& gets(char **s, char delim = '\n')
750 { return ((istream*)this)->gets(s, delim); }
751 int ipfx(int need) { return ((istream*)this)->ipfx(need); }
752 int ipfx0() { return ((istream*)this)->ipfx0(); }
753 int ipfx1() { return ((istream*)this)->ipfx1(); }
754 size_t gcount() { return _gcount; }
755 istream& putback(char ch) { return ((istream*)this)->putback(ch); }
756 istream& unget() { return ((istream*)this)->unget(); }
757 istream& seekg(streampos pos) { return ((istream*)this)->seekg(pos); }
758 istream& seekg(streamoff off, _seek_dir dir)
759 { return ((istream*)this)->seekg(off, dir); }
760 streampos tellg() { return ((istream*)this)->tellg(); }
762 istream& unget(char ch) { return putback(ch); }
765 // NOTE: These duplicate ostream methods.
766 int opfx() { return ((ostream*)this)->opfx(); }
767 void osfx() { ((ostream*)this)->osfx(); }
768 ostream& flush() { return ((ostream*)this)->flush(); }
769 ostream& put(char c) { return ((ostream*)this)->put(c); }
770 ostream& write(const char *s, int n)
771 { return ((ostream*)this)->write(s, n); }
772 ostream& write(const unsigned char *s, int n)
773 { return ((ostream*)this)->write((char*)s, n); }
774 ostream& write(const void *s, int n)
775 { return ((ostream*)this)->write((char*)s, n); }
776 ostream& form(const char *format ...);
777 ostream& vform(const char *format, char* args)
778 { return ((ostream*)this)->vform(format, args); }
779 ostream& seekp(streampos pos) { return ((ostream*)this)->seekp(pos); }
780 ostream& seekp(streamoff off, _seek_dir dir)
781 { return ((ostream*)this)->seekp(off, dir); }
782 streampos tellp() { return ((ostream*)this)->tellp(); }
786 extern ostream cout, cerr, clog; // clog->rdbuf() == cerr->rdbuf()
788 inline ostream& ostream::put(char c) { _strbuf->sputc(c); return *this; }
790 struct Iostream_init { } ; // Compatibility hack for AT&T libraray.
793 //# 7 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stream.h" 2
796 extern char* form(char*, ...);
798 extern char* dec(long, int=0);
799 extern char* dec(int, int=0);
800 extern char* dec(unsigned long, int=0);
801 extern char* dec(unsigned int, int=0);
803 extern char* hex(long, int=0);
804 extern char* hex(int, int=0);
805 extern char* hex(unsigned long, int=0);
806 extern char* hex(unsigned int, int=0);
808 extern char* oct(long, int=0);
809 extern char* oct(int, int=0);
810 extern char* oct(unsigned long, int=0);
811 extern char* oct(unsigned int, int=0);
813 inline istream& WS(istream& str) { return ws(str); }
816 //# 26 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 2
818 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/Regex.h" 1
819 // This may look like C code, but it is really -*- C++ -*-
821 Copyright (C) 1988 Free Software Foundation
822 written by Doug Lea (dl@rocky.oswego.edu)
824 This file is part of the GNU C++ Library. This library is free
825 software; you can redistribute it and/or modify it under the terms of
826 the GNU Library General Public License as published by the Free
827 Software Foundation; either version 2 of the License, or (at your
828 option) any later version. This library is distributed in the hope
829 that it will be useful, but WITHOUT ANY WARRANTY; without even the
830 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
831 PURPOSE. See the GNU Library General Public License for more details.
832 You should have received a copy of the GNU Library General Public
833 License along with this library; if not, write to the Free Software
834 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
850 struct re_pattern_buffer; // defined elsewhere
857 Regex(const Regex&) {} // no X(X&)
858 void operator = (const Regex&) {} // no assignment
861 re_pattern_buffer* buf;
868 const char* transtable = 0);
872 int match(const char* s, int len, int pos = 0) const;
873 int search(const char* s, int len,
874 int& matchlen, int startpos = 0) const;
875 int match_info(int& start, int& length, int nth = 0) const;
877 int OK() const; // representation invariant
880 // some built in regular expressions
882 extern const Regex RXwhite; // = "[ \n\t\r\v\f]+"
883 extern const Regex RXint; // = "-?[0-9]+"
884 extern const Regex RXdouble; // = "-?\\(\\([0-9]+\\.[0-9]*\\)\\|
885 // \\([0-9]+\\)\\|\\(\\.[0-9]+\\)\\)
886 // \\([eE][---+]?[0-9]+\\)?"
887 extern const Regex RXalpha; // = "[A-Za-z]+"
888 extern const Regex RXlowercase; // = "[a-z]+"
889 extern const Regex RXuppercase; // = "[A-Z]+"
890 extern const Regex RXalphanum; // = "[0-9A-Za-z]+"
891 extern const Regex RXidentifier; // = "[A-Za-z_][A-Za-z0-9_]*"
895 //# 27 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 2
898 struct StrRep // internal String representations
900 unsigned short len; // string length
901 unsigned short sz; // allocated space
902 char s[1]; // the string starts here
903 // (at least 1 char for trailing null)
904 // allocated & expanded via non-public fcts
907 // primitive ops on StrReps -- nearly all String fns go through these.
909 StrRep* Salloc(StrRep*, const char*, int, int);
910 StrRep* Scopy(StrRep*, StrRep*);
911 StrRep* Sresize(StrRep*, int);
912 StrRep* Scat(StrRep*, const char*, int, const char*, int);
913 StrRep* Scat(StrRep*, const char*, int,const char*,int, const char*,int);
914 StrRep* Sprepend(StrRep*, const char*, int);
915 StrRep* Sreverse(StrRep*, StrRep*);
916 StrRep* Supcase(StrRep*, StrRep*);
917 StrRep* Sdowncase(StrRep*, StrRep*);
918 StrRep* Scapitalize(StrRep*, StrRep*);
920 // These classes need to be defined in the order given
930 String& S; // The String I'm a substring of
931 unsigned short pos; // starting position in S's rep
932 unsigned short len; // length of substring
934 void assign(StrRep*, const char*, int = -1);
935 SubString(String& x, int p, int l);
936 SubString(const SubString& x);
940 // Note there are no public constructors. SubStrings are always
941 // created via String operations
945 void operator = (const String& y);
946 void operator = (const SubString& y);
947 void operator = (const char* t);
948 void operator = (char c);
950 // return 1 if target appears anywhere in SubString; else 0
952 int contains(char c) const;
953 int contains(const String& y) const;
954 int contains(const SubString& y) const;
955 int contains(const char* t) const;
956 int contains(const Regex& r) const;
958 // return 1 if target matches entire SubString
960 int matches(const Regex& r) const;
964 friend ostream& operator<<(ostream& s, const SubString& x);
968 unsigned int length() const;
970 const char* chars() const;
979 friend class SubString;
982 StrRep* rep; // Strings are pointers to their representations
984 // some helper functions
986 int search(int, int, const char*, int = -1) const;
987 int search(int, int, char) const;
988 int match(int, int, int, const char*, int = -1) const;
989 int _gsub(const char*, int, const char* ,int);
990 int _gsub(const Regex&, const char*, int);
991 SubString _substr(int, int);
995 // constructors & assignment
998 String(const String& x);
999 String(const SubString& x);
1000 String(const char* t);
1001 String(const char* t, int len);
1006 void operator = (const String& y);
1007 void operator = (const char* y);
1008 void operator = (char c);
1009 void operator = (const SubString& y);
1013 void operator += (const String& y);
1014 void operator += (const SubString& y);
1015 void operator += (const char* t);
1016 void operator += (char c);
1018 void prepend(const String& y);
1019 void prepend(const SubString& y);
1020 void prepend(const char* t);
1021 void prepend(char c);
1024 // procedural versions:
1025 // concatenate first 2 args, store result in last arg
1027 friend void cat(const String&, const String&, String&);
1028 friend void cat(const String&, const SubString&, String&);
1029 friend void cat(const String&, const char*, String&);
1030 friend void cat(const String&, char, String&);
1032 friend void cat(const SubString&, const String&, String&);
1033 friend void cat(const SubString&, const SubString&, String&);
1034 friend void cat(const SubString&, const char*, String&);
1035 friend void cat(const SubString&, char, String&);
1037 friend void cat(const char*, const String&, String&);
1038 friend void cat(const char*, const SubString&, String&);
1039 friend void cat(const char*, const char*, String&);
1040 friend void cat(const char*, char, String&);
1042 // double concatenation, by request. (yes, there are too many versions,
1043 // but if one is supported, then the others should be too...)
1044 // Concatenate first 3 args, store in last arg
1046 friend void cat(const String&,const String&, const String&,String&);
1047 friend void cat(const String&,const String&,const SubString&,String&);
1048 friend void cat(const String&,const String&, const char*, String&);
1049 friend void cat(const String&,const String&, char, String&);
1050 friend void cat(const String&,const SubString&,const String&,String&);
1051 friend void cat(const String&,const SubString&,const SubString&,String&);
1052 friend void cat(const String&,const SubString&, const char*, String&);
1053 friend void cat(const String&,const SubString&, char, String&);
1054 friend void cat(const String&,const char*, const String&, String&);
1055 friend void cat(const String&,const char*, const SubString&, String&);
1056 friend void cat(const String&,const char*, const char*, String&);
1057 friend void cat(const String&,const char*, char, String&);
1059 friend void cat(const char*, const String&, const String&,String&);
1060 friend void cat(const char*,const String&,const SubString&,String&);
1061 friend void cat(const char*,const String&, const char*, String&);
1062 friend void cat(const char*,const String&, char, String&);
1063 friend void cat(const char*,const SubString&,const String&,String&);
1064 friend void cat(const char*,const SubString&,const SubString&,String&);
1065 friend void cat(const char*,const SubString&, const char*, String&);
1066 friend void cat(const char*,const SubString&, char, String&);
1067 friend void cat(const char*,const char*, const String&, String&);
1068 friend void cat(const char*,const char*, const SubString&, String&);
1069 friend void cat(const char*,const char*, const char*, String&);
1070 friend void cat(const char*,const char*, char, String&);
1073 // searching & matching
1075 // return position of target in string or -1 for failure
1077 int index(char c, int startpos = 0) const;
1078 int index(const String& y, int startpos = 0) const;
1079 int index(const SubString& y, int startpos = 0) const;
1080 int index(const char* t, int startpos = 0) const;
1081 int index(const Regex& r, int startpos = 0) const;
1083 // return 1 if target appears anyhere in String; else 0
1085 int contains(char c) const;
1086 int contains(const String& y) const;
1087 int contains(const SubString& y) const;
1088 int contains(const char* t) const;
1089 int contains(const Regex& r) const;
1091 // return 1 if target appears anywhere after position pos
1092 // (or before, if pos is negative) in String; else 0
1094 int contains(char c, int pos) const;
1095 int contains(const String& y, int pos) const;
1096 int contains(const SubString& y, int pos) const;
1097 int contains(const char* t, int pos) const;
1098 int contains(const Regex& r, int pos) const;
1100 // return 1 if target appears at position pos in String; else 0
1102 int matches(char c, int pos = 0) const;
1103 int matches(const String& y, int pos = 0) const;
1104 int matches(const SubString& y, int pos = 0) const;
1105 int matches(const char* t, int pos = 0) const;
1106 int matches(const Regex& r, int pos = 0) const;
1108 // return number of occurences of target in String
1110 int freq(char c) const;
1111 int freq(const String& y) const;
1112 int freq(const SubString& y) const;
1113 int freq(const char* t) const;
1115 // SubString extraction
1117 // Note that you can't take a substring of a const String, since
1118 // this leaves open the possiblility of indirectly modifying the
1119 // String through the SubString
1121 SubString at(int pos, int len);
1122 SubString operator () (int pos, int len); // synonym for at
1124 SubString at(const String& x, int startpos = 0);
1125 SubString at(const SubString& x, int startpos = 0);
1126 SubString at(const char* t, int startpos = 0);
1127 SubString at(char c, int startpos = 0);
1128 SubString at(const Regex& r, int startpos = 0);
1130 SubString before(int pos);
1131 SubString before(const String& x, int startpos = 0);
1132 SubString before(const SubString& x, int startpos = 0);
1133 SubString before(const char* t, int startpos = 0);
1134 SubString before(char c, int startpos = 0);
1135 SubString before(const Regex& r, int startpos = 0);
1137 SubString through(int pos);
1138 SubString through(const String& x, int startpos = 0);
1139 SubString through(const SubString& x, int startpos = 0);
1140 SubString through(const char* t, int startpos = 0);
1141 SubString through(char c, int startpos = 0);
1142 SubString through(const Regex& r, int startpos = 0);
1144 SubString from(int pos);
1145 SubString from(const String& x, int startpos = 0);
1146 SubString from(const SubString& x, int startpos = 0);
1147 SubString from(const char* t, int startpos = 0);
1148 SubString from(char c, int startpos = 0);
1149 SubString from(const Regex& r, int startpos = 0);
1151 SubString after(int pos);
1152 SubString after(const String& x, int startpos = 0);
1153 SubString after(const SubString& x, int startpos = 0);
1154 SubString after(const char* t, int startpos = 0);
1155 SubString after(char c, int startpos = 0);
1156 SubString after(const Regex& r, int startpos = 0);
1161 // delete len chars starting at pos
1162 void del(int pos, int len);
1164 // delete the first occurrence of target after startpos
1166 void del(const String& y, int startpos = 0);
1167 void del(const SubString& y, int startpos = 0);
1168 void del(const char* t, int startpos = 0);
1169 void del(char c, int startpos = 0);
1170 void del(const Regex& r, int startpos = 0);
1172 // global substitution: substitute all occurrences of pat with repl
1174 int gsub(const String& pat, const String& repl);
1175 int gsub(const SubString& pat, const String& repl);
1176 int gsub(const char* pat, const String& repl);
1177 int gsub(const char* pat, const char* repl);
1178 int gsub(const Regex& pat, const String& repl);
1180 // friends & utilities
1182 // split string into array res at separators; return number of elements
1184 friend int split(const String& x, String res[], int maxn,
1186 friend int split(const String& x, String res[], int maxn,
1189 friend String common_prefix(const String& x, const String& y,
1191 friend String common_suffix(const String& x, const String& y,
1193 friend String replicate(char c, int n);
1194 friend String replicate(const String& y, int n);
1195 friend String join(String src[], int n, const String& sep);
1197 // simple builtin transformations
1199 friend String reverse(const String& x);
1200 friend String upcase(const String& x);
1201 friend String downcase(const String& x);
1202 friend String capitalize(const String& x);
1204 // in-place versions of above
1211 // element extraction
1213 char& operator [] (int i);
1214 char elem(int i) const;
1215 char firstchar() const;
1216 char lastchar() const;
1220 operator const char*() const;
1221 const char* chars() const;
1226 friend ostream& operator<<(ostream& s, const String& x);
1227 friend ostream& operator<<(ostream& s, const SubString& x);
1228 friend istream& operator>>(istream& s, String& x);
1230 friend int readline(istream& s, String& x,
1231 char terminator = '\n',
1232 int discard_terminator = 1);
1236 unsigned int length() const;
1239 // preallocate some space for String
1240 void alloc(int newsize);
1242 // report current allocation (not length!)
1244 int allocation() const;
1247 volatile void error(const char* msg) const;
1252 typedef String StrTmp; // for backward compatibility
1256 int compare(const String& x, const String& y);
1257 int compare(const String& x, const SubString& y);
1258 int compare(const String& x, const char* y);
1259 int compare(const SubString& x, const String& y);
1260 int compare(const SubString& x, const SubString& y);
1261 int compare(const SubString& x, const char* y);
1262 int fcompare(const String& x, const String& y); // ignore case
1264 extern StrRep _nilStrRep;
1265 extern String _nilString;
1269 String operator + (const String& x, const String& y);
1270 String operator + (const String& x, const SubString& y);
1271 String operator + (const String& x, const char* y);
1272 String operator + (const String& x, char y);
1273 String operator + (const SubString& x, const String& y);
1274 String operator + (const SubString& x, const SubString& y);
1275 String operator + (const SubString& x, const char* y);
1276 String operator + (const SubString& x, char y);
1277 String operator + (const char* x, const String& y);
1278 String operator + (const char* x, const SubString& y);
1280 int operator==(const String& x, const String& y);
1281 int operator!=(const String& x, const String& y);
1282 int operator> (const String& x, const String& y);
1283 int operator>=(const String& x, const String& y);
1284 int operator< (const String& x, const String& y);
1285 int operator<=(const String& x, const String& y);
1286 int operator==(const String& x, const SubString& y);
1287 int operator!=(const String& x, const SubString& y);
1288 int operator> (const String& x, const SubString& y);
1289 int operator>=(const String& x, const SubString& y);
1290 int operator< (const String& x, const SubString& y);
1291 int operator<=(const String& x, const SubString& y);
1292 int operator==(const String& x, const char* t);
1293 int operator!=(const String& x, const char* t);
1294 int operator> (const String& x, const char* t);
1295 int operator>=(const String& x, const char* t);
1296 int operator< (const String& x, const char* t);
1297 int operator<=(const String& x, const char* t);
1298 int operator==(const SubString& x, const String& y);
1299 int operator!=(const SubString& x, const String& y);
1300 int operator> (const SubString& x, const String& y);
1301 int operator>=(const SubString& x, const String& y);
1302 int operator< (const SubString& x, const String& y);
1303 int operator<=(const SubString& x, const String& y);
1304 int operator==(const SubString& x, const SubString& y);
1305 int operator!=(const SubString& x, const SubString& y);
1306 int operator> (const SubString& x, const SubString& y);
1307 int operator>=(const SubString& x, const SubString& y);
1308 int operator< (const SubString& x, const SubString& y);
1309 int operator<=(const SubString& x, const SubString& y);
1310 int operator==(const SubString& x, const char* t);
1311 int operator!=(const SubString& x, const char* t);
1312 int operator> (const SubString& x, const char* t);
1313 int operator>=(const SubString& x, const char* t);
1314 int operator< (const SubString& x, const char* t);
1315 int operator<=(const SubString& x, const char* t);
1320 // status reports, needed before defining other things
1322 inline unsigned int String::length() const { return rep->len; }
1323 inline int String::empty() const { return rep->len == 0; }
1324 inline const char* String::chars() const { return &(rep->s[0]); }
1325 inline int String::allocation() const { return rep->sz; }
1326 inline void String::alloc(int newsize) { rep = Sresize(rep, newsize); }
1328 inline unsigned int SubString::length() const { return len; }
1329 inline int SubString::empty() const { return len == 0; }
1330 inline const char* SubString::chars() const { return &(S.rep->s[pos]); }
1335 inline String::String()
1336 : rep(&_nilStrRep) {}
1337 inline String::String(const String& x)
1338 : rep(Scopy(0, x.rep)) {}
1339 inline String::String(const char* t)
1340 : rep(Salloc(0, t, -1, -1)) {}
1341 inline String::String(const char* t, int tlen)
1342 : rep(Salloc(0, t, tlen, tlen)) {}
1343 inline String::String(const SubString& y)
1344 : rep(Salloc(0, y.chars(), y.length(), y.length())) {}
1345 inline String::String(char c)
1346 : rep(Salloc(0, &c, 1, 1)) {}
1348 inline String::~String() { if (rep != &_nilStrRep) delete rep; }
1350 inline SubString::SubString(const SubString& x)
1351 :S(x.S), pos(x.pos), len(x.len) {}
1352 inline SubString::SubString(String& x, int first, int l)
1353 :S(x), pos(first), len(l) {}
1355 inline SubString::~SubString() {}
1359 inline void String::operator = (const String& y)
1361 rep = Scopy(rep, y.rep);
1364 inline void String::operator=(const char* t)
1366 rep = Salloc(rep, t, -1, -1);
1369 inline void String::operator=(const SubString& y)
1371 rep = Salloc(rep, y.chars(), y.length(), y.length());
1374 inline void String::operator=(char c)
1376 rep = Salloc(rep, &c, 1, 1);
1380 inline void SubString::operator = (const char* ys)
1385 inline void SubString::operator = (char ch)
1390 inline void SubString::operator = (const String& y)
1392 assign(y.rep, y.chars(), y.length());
1395 inline void SubString::operator = (const SubString& y)
1397 assign(y.S.rep, y.chars(), y.length());
1400 // Zillions of cats...
1402 inline void cat(const String& x, const String& y, String& r)
1404 r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
1407 inline void cat(const String& x, const SubString& y, String& r)
1409 r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
1412 inline void cat(const String& x, const char* y, String& r)
1414 r.rep = Scat(r.rep, x.chars(), x.length(), y, -1);
1417 inline void cat(const String& x, char y, String& r)
1419 r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1);
1422 inline void cat(const SubString& x, const String& y, String& r)
1424 r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
1427 inline void cat(const SubString& x, const SubString& y, String& r)
1429 r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
1432 inline void cat(const SubString& x, const char* y, String& r)
1434 r.rep = Scat(r.rep, x.chars(), x.length(), y, -1);
1437 inline void cat(const SubString& x, char y, String& r)
1439 r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1);
1442 inline void cat(const char* x, const String& y, String& r)
1444 r.rep = Scat(r.rep, x, -1, y.chars(), y.length());
1447 inline void cat(const char* x, const SubString& y, String& r)
1449 r.rep = Scat(r.rep, x, -1, y.chars(), y.length());
1452 inline void cat(const char* x, const char* y, String& r)
1454 r.rep = Scat(r.rep, x, -1, y, -1);
1457 inline void cat(const char* x, char y, String& r)
1459 r.rep = Scat(r.rep, x, -1, &y, 1);
1462 inline void cat(const String& a, const String& x, const String& y, String& r)
1464 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
1467 inline void cat(const String& a, const String& x, const SubString& y, String& r)
1469 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
1472 inline void cat(const String& a, const String& x, const char* y, String& r)
1474 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1);
1477 inline void cat(const String& a, const String& x, char y, String& r)
1479 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), &y, 1);
1482 inline void cat(const String& a, const SubString& x, const String& y, String& r)
1484 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
1487 inline void cat(const String& a, const SubString& x, const SubString& y, String& r)
1489 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
1492 inline void cat(const String& a, const SubString& x, const char* y, String& r)
1494 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1);
1497 inline void cat(const String& a, const SubString& x, char y, String& r)
1499 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), &y, 1);
1502 inline void cat(const String& a, const char* x, const String& y, String& r)
1504 r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y.chars(), y.length());
1507 inline void cat(const String& a, const char* x, const SubString& y, String& r)
1509 r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y.chars(), y.length());
1512 inline void cat(const String& a, const char* x, const char* y, String& r)
1514 r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y, -1);
1517 inline void cat(const String& a, const char* x, char y, String& r)
1519 r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, &y, 1);
1523 inline void cat(const char* a, const String& x, const String& y, String& r)
1525 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
1528 inline void cat(const char* a, const String& x, const SubString& y, String& r)
1530 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
1533 inline void cat(const char* a, const String& x, const char* y, String& r)
1535 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1);
1538 inline void cat(const char* a, const String& x, char y, String& r)
1540 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), &y, 1);
1543 inline void cat(const char* a, const SubString& x, const String& y, String& r)
1545 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
1548 inline void cat(const char* a, const SubString& x, const SubString& y, String& r)
1550 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
1553 inline void cat(const char* a, const SubString& x, const char* y, String& r)
1555 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1);
1558 inline void cat(const char* a, const SubString& x, char y, String& r)
1560 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), &y, 1);
1563 inline void cat(const char* a, const char* x, const String& y, String& r)
1565 r.rep = Scat(r.rep, a, -1, x, -1, y.chars(), y.length());
1568 inline void cat(const char* a, const char* x, const SubString& y, String& r)
1570 r.rep = Scat(r.rep, a, -1, x, -1, y.chars(), y.length());
1573 inline void cat(const char* a, const char* x, const char* y, String& r)
1575 r.rep = Scat(r.rep, a, -1, x, -1, y, -1);
1578 inline void cat(const char* a, const char* x, char y, String& r)
1580 r.rep = Scat(r.rep, a, -1, x, -1, &y, 1);
1584 // operator versions
1586 inline void String::operator +=(const String& y)
1588 cat(*this, y, *this);
1591 inline void String::operator +=(const SubString& y)
1593 cat(*this, y, *this);
1596 inline void String::operator += (const char* y)
1598 cat(*this, y, *this);
1601 inline void String:: operator +=(char y)
1603 cat(*this, y, *this);
1606 // constructive concatenation
1610 inline String operator + (const String& x, const String& y) return r;
1615 inline String operator + (const String& x, const SubString& y) return r;
1620 inline String operator + (const String& x, const char* y) return r;
1625 inline String operator + (const String& x, char y) return r;
1630 inline String operator + (const SubString& x, const String& y) return r;
1635 inline String operator + (const SubString& x, const SubString& y) return r;
1640 inline String operator + (const SubString& x, const char* y) return r;
1645 inline String operator + (const SubString& x, char y) return r;
1650 inline String operator + (const char* x, const String& y) return r;
1655 inline String operator + (const char* x, const SubString& y) return r;
1660 inline String reverse(const String& x) return r;
1662 r.rep = Sreverse(x.rep, r.rep);
1665 inline String upcase(const String& x) return r;
1667 r.rep = Supcase(x.rep, r.rep);
1670 inline String downcase(const String& x) return r;
1672 r.rep = Sdowncase(x.rep, r.rep);
1675 inline String capitalize(const String& x) return r;
1677 r.rep = Scapitalize(x.rep, r.rep);
1680 //# 883 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h"
1685 inline void String::prepend(const String& y)
1687 rep = Sprepend(rep, y.chars(), y.length());
1690 inline void String::prepend(const char* y)
1692 rep = Sprepend(rep, y, -1);
1695 inline void String::prepend(char y)
1697 rep = Sprepend(rep, &y, 1);
1700 inline void String::prepend(const SubString& y)
1702 rep = Sprepend(rep, y.chars(), y.length());
1705 // misc transformations
1708 inline void String::reverse()
1710 rep = Sreverse(rep, rep);
1714 inline void String::upcase()
1716 rep = Supcase(rep, rep);
1720 inline void String::downcase()
1722 rep = Sdowncase(rep, rep);
1726 inline void String::capitalize()
1728 rep = Scapitalize(rep, rep);
1731 // element extraction
1733 inline char& String::operator [] (int i)
1735 if (((unsigned)i) >= length()) error("invalid index");
1739 inline char String::elem (int i) const
1741 if (((unsigned)i) >= length()) error("invalid index");
1745 inline char String::firstchar() const
1750 inline char String::lastchar() const
1752 return elem(length() - 1);
1757 inline int String::index(char c, int startpos) const
1759 return search(startpos, length(), c);
1762 inline int String::index(const char* t, int startpos) const
1764 return search(startpos, length(), t);
1767 inline int String::index(const String& y, int startpos) const
1769 return search(startpos, length(), y.chars(), y.length());
1772 inline int String::index(const SubString& y, int startpos) const
1774 return search(startpos, length(), y.chars(), y.length());
1777 inline int String::index(const Regex& r, int startpos) const
1779 int unused; return r.search(chars(), length(), unused, startpos);
1782 inline int String::contains(char c) const
1784 return search(0, length(), c) >= 0;
1787 inline int String::contains(const char* t) const
1789 return search(0, length(), t) >= 0;
1792 inline int String::contains(const String& y) const
1794 return search(0, length(), y.chars(), y.length()) >= 0;
1797 inline int String::contains(const SubString& y) const
1799 return search(0, length(), y.chars(), y.length()) >= 0;
1802 inline int String::contains(char c, int p) const
1804 return match(p, length(), 0, &c, 1) >= 0;
1807 inline int String::contains(const char* t, int p) const
1809 return match(p, length(), 0, t) >= 0;
1812 inline int String::contains(const String& y, int p) const
1814 return match(p, length(), 0, y.chars(), y.length()) >= 0;
1817 inline int String::contains(const SubString& y, int p) const
1819 return match(p, length(), 0, y.chars(), y.length()) >= 0;
1822 inline int String::contains(const Regex& r) const
1824 int unused; return r.search(chars(), length(), unused, 0) >= 0;
1827 inline int String::contains(const Regex& r, int p) const
1829 return r.match(chars(), length(), p) >= 0;
1833 inline int String::matches(const SubString& y, int p) const
1835 return match(p, length(), 1, y.chars(), y.length()) >= 0;
1838 inline int String::matches(const String& y, int p) const
1840 return match(p, length(), 1, y.chars(), y.length()) >= 0;
1843 inline int String::matches(const char* t, int p) const
1845 return match(p, length(), 1, t) >= 0;
1848 inline int String::matches(char c, int p) const
1850 return match(p, length(), 1, &c, 1) >= 0;
1853 inline int String::matches(const Regex& r, int p) const
1855 int l = (p < 0)? -p : length() - p;
1856 return r.match(chars(), length(), p) == l;
1860 inline int SubString::contains(const char* t) const
1862 return S.search(pos, pos+len, t) >= 0;
1865 inline int SubString::contains(const String& y) const
1867 return S.search(pos, pos+len, y.chars(), y.length()) >= 0;
1870 inline int SubString::contains(const SubString& y) const
1872 return S.search(pos, pos+len, y.chars(), y.length()) >= 0;
1875 inline int SubString::contains(char c) const
1877 return S.search(pos, pos+len, 0, c) >= 0;
1880 inline int SubString::contains(const Regex& r) const
1882 int unused; return r.search(chars(), len, unused, 0) >= 0;
1885 inline int SubString::matches(const Regex& r) const
1887 return r.match(chars(), len, 0) == len;
1891 inline int String::gsub(const String& pat, const String& r)
1893 return _gsub(pat.chars(), pat.length(), r.chars(), r.length());
1896 inline int String::gsub(const SubString& pat, const String& r)
1898 return _gsub(pat.chars(), pat.length(), r.chars(), r.length());
1901 inline int String::gsub(const Regex& pat, const String& r)
1903 return _gsub(pat, r.chars(), r.length());
1906 inline int String::gsub(const char* pat, const String& r)
1908 return _gsub(pat, -1, r.chars(), r.length());
1911 inline int String::gsub(const char* pat, const char* r)
1913 return _gsub(pat, -1, r, -1);
1918 inline ostream& operator<<(ostream& s, const String& x)
1920 s << x.chars(); return s;
1923 // a zillion comparison operators
1925 inline int operator==(const String& x, const String& y)
1927 return compare(x, y) == 0;
1930 inline int operator!=(const String& x, const String& y)
1932 return compare(x, y) != 0;
1935 inline int operator>(const String& x, const String& y)
1937 return compare(x, y) > 0;
1940 inline int operator>=(const String& x, const String& y)
1942 return compare(x, y) >= 0;
1945 inline int operator<(const String& x, const String& y)
1947 return compare(x, y) < 0;
1950 inline int operator<=(const String& x, const String& y)
1952 return compare(x, y) <= 0;
1955 inline int operator==(const String& x, const SubString& y)
1957 return compare(x, y) == 0;
1960 inline int operator!=(const String& x, const SubString& y)
1962 return compare(x, y) != 0;
1965 inline int operator>(const String& x, const SubString& y)
1967 return compare(x, y) > 0;
1970 inline int operator>=(const String& x, const SubString& y)
1972 return compare(x, y) >= 0;
1975 inline int operator<(const String& x, const SubString& y)
1977 return compare(x, y) < 0;
1980 inline int operator<=(const String& x, const SubString& y)
1982 return compare(x, y) <= 0;
1985 inline int operator==(const String& x, const char* t)
1987 return compare(x, t) == 0;
1990 inline int operator!=(const String& x, const char* t)
1992 return compare(x, t) != 0;
1995 inline int operator>(const String& x, const char* t)
1997 return compare(x, t) > 0;
2000 inline int operator>=(const String& x, const char* t)
2002 return compare(x, t) >= 0;
2005 inline int operator<(const String& x, const char* t)
2007 return compare(x, t) < 0;
2010 inline int operator<=(const String& x, const char* t)
2012 return compare(x, t) <= 0;
2015 inline int operator==(const SubString& x, const String& y)
2017 return compare(y, x) == 0;
2020 inline int operator!=(const SubString& x, const String& y)
2022 return compare(y, x) != 0;
2025 inline int operator>(const SubString& x, const String& y)
2027 return compare(y, x) < 0;
2030 inline int operator>=(const SubString& x, const String& y)
2032 return compare(y, x) <= 0;
2035 inline int operator<(const SubString& x, const String& y)
2037 return compare(y, x) > 0;
2040 inline int operator<=(const SubString& x, const String& y)
2042 return compare(y, x) >= 0;
2045 inline int operator==(const SubString& x, const SubString& y)
2047 return compare(x, y) == 0;
2050 inline int operator!=(const SubString& x, const SubString& y)
2052 return compare(x, y) != 0;
2055 inline int operator>(const SubString& x, const SubString& y)
2057 return compare(x, y) > 0;
2060 inline int operator>=(const SubString& x, const SubString& y)
2062 return compare(x, y) >= 0;
2065 inline int operator<(const SubString& x, const SubString& y)
2067 return compare(x, y) < 0;
2070 inline int operator<=(const SubString& x, const SubString& y)
2072 return compare(x, y) <= 0;
2075 inline int operator==(const SubString& x, const char* t)
2077 return compare(x, t) == 0;
2080 inline int operator!=(const SubString& x, const char* t)
2082 return compare(x, t) != 0;
2085 inline int operator>(const SubString& x, const char* t)
2087 return compare(x, t) > 0;
2090 inline int operator>=(const SubString& x, const char* t)
2092 return compare(x, t) >= 0;
2095 inline int operator<(const SubString& x, const char* t)
2097 return compare(x, t) < 0;
2100 inline int operator<=(const SubString& x, const char* t)
2102 return compare(x, t) <= 0;
2106 // a helper needed by at, before, etc.
2108 inline SubString String::_substr(int first, int l)
2110 if (first >= length() ) // ??? THIS LINE IS QUESTIONABLE
2111 return SubString(_nilString, 0, 0) ;
2113 return SubString(*this, first, l);
2120 //# 26 "../../GctSymbol.h" 2
2123 //# 1 "../../../../../../mips/include/Gct/Object/GctHashObject.h" 1
2129 // GctHashObject class (is abstract)
2131 // Expects to be included by Object.h or where needed explicitly.
2133 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2143 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2146 // $Date: 1994/05/16 09:13:02 $
2148 //# 1 "../../../../../../mips/include/Gct/Object/GctObject.h" 1
2154 // GctObject class (is abstract)
2156 // Expects to be included by Object.h or where needed explicitly.
2158 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2168 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2171 // $Date: 1994/05/16 09:13:02 $
2173 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
2179 // tostrstream class
2181 // A terminated oststream - an ostsrstream that auto-terminates on str()
2183 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2193 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2196 // $Date: 1994/05/16 09:13:02 $
2198 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/strstream.h" 1
2199 // This is part of the iostream library, providing input/output for C++.
2200 // Copyright (C) 1991 Per Bothner.
2202 // This library is free software; you can redistribute it and/or
2203 // modify it under the terms of the GNU Library General Public
2204 // License as published by the Free Software Foundation; either
2205 // version 2 of the License, or (at your option) any later version.
2207 // This library is distributed in the hope that it will be useful,
2208 // but WITHOUT ANY WARRANTY; without even the implied warranty of
2209 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2210 // Library General Public License for more details.
2212 // You should have received a copy of the GNU Library General Public
2213 // License along with this library; if not, write to the Free
2214 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2221 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
2222 // This is part of the iostream library, providing -*- C++ -*- input/output.
2223 // Copyright (C) 1991 Per Bothner.
2225 // This library is free software; you can redistribute it and/or
2226 // modify it under the terms of the GNU Library General Public
2227 // License as published by the Free Software Foundation; either
2228 // version 2 of the License, or (at your option) any later version.
2230 // This library is distributed in the hope that it will be useful,
2231 // but WITHOUT ANY WARRANTY; without even the implied warranty of
2232 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2233 // Library General Public License for more details.
2235 // You should have received a copy of the GNU Library General Public
2236 // License along with this library; if not, write to the Free
2237 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2239 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2241 //# 23 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/strstream.h" 2
2244 class strstreambuf : public streambuf {
2245 size_t *lenp; /* current (logical) length (i.e. valid data bytes) */
2246 size_t *sizep; /* allocated (physical) buffer size */
2253 virtual int overflow(int = (-1) );
2256 strstreambuf(int initial);
2257 strstreambuf(char *ptr, int size, char *pstart = ((void *)0) );
2259 int frozen() { return _frozen; }
2260 void freeze(int n=1) { _frozen = n != 0; }
2265 class istrstream : public istream {
2268 istrstream(char*, int);
2269 strstreambuf* rdbuf() { return (strstreambuf*)_strbuf; }
2272 class ostrstream : public ostream {
2275 ostrstream(char *cp, int n, int mode=ios::out);
2276 size_t pcount() { return ((strstreambuf*)_strbuf)->pcount(); }
2277 char *str() { return ((strstreambuf*)_strbuf)->str(); }
2278 void freeze(int n = 1) { ((strstreambuf*)_strbuf)->freeze(n); }
2279 int frozen() { return ((strstreambuf*)_strbuf)->frozen(); }
2280 strstreambuf* rdbuf() { return (strstreambuf*)_strbuf; }
2284 //# 25 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 2
2288 // tostrstream class
2290 // An isteam class that doesn't have that nasty skipws parameter that
2291 // you have to remember to set. This class simply provides the istream
2292 // functionality with a set of constructors which defaults skipws to
2293 // FALSE (instead of defaulting to TRUE as is the case with plain istream).
2295 class tostrstream: public ostrstream {
2297 tostrstream(): ostrstream()
2299 // This constructor defines cp as the buffer to use for the
2300 // stream (instead of one of its own devising); it does NOT
2301 // initialize the ostrstream to contain cp (of length n).
2302 tostrstream(char *cp, int n, int mode=ios::out): ostrtream(cp, n, mode) // ERROR -
2306 char *s = ostrstream::str();
2307 s[ostrstream::pcount()] = '\0';
2313 //# 25 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
2316 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 1
2322 // GttObject class (is abstract)
2324 // Expects to be included where needed explicitly.
2326 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2336 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2339 // $Date: 1994/05/16 09:13:02 $
2341 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
2343 //# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
2345 //# 25 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
2348 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 1
2354 // GttErrorHandler class
2356 // Expects to be included by Gtt.h
2358 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2368 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2371 // $Date: 1994/05/16 09:13:02 $
2373 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
2381 //# 25 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
2384 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 1
2390 // Fake up a libstuff++
2392 // This is done as a complete and utter hack; this library has no function
2393 // at all being in the boot area; it is here solely in order to provide a
2394 // libstuff++ against which the Makefiles can resolve link lines.
2396 // The only reason that this is done is to allow the STANDARD_C++_LIBRARIES
2397 // as provided by the Makefile templates in the boot area to be the same
2398 // ones that are used by the tools outside this hierarchy.
2400 // The tools outside this hierarchy use a different libstuff++; one that is
2401 // written in C++. This one is not written in C++ in order to be simpler.
2411 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2414 // $Date: 1994/05/16 09:13:02 $
2417 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 1
2426 * $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2429 * $Date: 1994/05/16 09:13:02 $
2432 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/ansi.h" 1
2438 * ANSI Compiler Support
2441 * University of California, Berkeley
2444 * ANSI compatible compilers are supposed to define the preprocessor
2445 * directive __STDC__. Based on this directive, this file defines
2446 * certain ANSI specific macros.
2449 * Used in function prototypes. Example:
2451 * ARGS((char *blah, double threshold));
2455 * $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2458 * $Date: 1994/05/16 09:13:02 $
2462 * University of California, Berkeley
2465 /* Function prototypes */
2493 //# 15 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 2
2498 * If g++, then we stub out part of this thing and let the C++ types take
2499 * over and do the same job; some compatibility must be given however
2503 * Use the GNU libg++ definition
2505 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
2513 //# 26 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 2
2515 //# 35 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h"
2519 * Make various pieces of C code that use the old ``Boolean''
2520 * be compatible by faking up the definition of Boolean using
2521 * the new bool type.
2525 //# 58 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h"
2528 typedef long FitAny; /* can fit any integral type */
2531 * typedef char *String; - DO NOT USE THIS - it conflicts with C++
2532 * typedef char **Stringv; - just use char* and char** instead.
2533 * - void* can be used for arbitrary pointers
2539 extern int nocase_strcmp (char *, char *) ;
2540 extern int nocase_strncmp (char *, char *, int) ;
2542 extern bool nocase_strequal (char *, char *) ;
2543 extern bool nocase_strnequal (char *, char *, int) ;
2545 extern bool lead_strequal (char *, char *) ;
2546 extern bool nocase_lead_strequal (char *, char *) ;
2548 extern int strhash (char *, int) ;
2549 extern int nocase_strhash (char *, int) ;
2551 extern int sign (int) ;
2554 * Some useful macros.
2585 //# 33 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
2590 // This is here because we wish to provide externs for the two
2591 // functions btoa(bool, unsigned = 0) and operator<<(ostream&, bool)
2592 // because they are not provided in bool.h.
2594 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
2602 //# 41 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
2604 extern const char *stringify(bool b);
2605 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
2606 // This is part of the iostream library, providing -*- C++ -*- input/output.
2607 // Copyright (C) 1991 Per Bothner.
2609 // This library is free software; you can redistribute it and/or
2610 // modify it under the terms of the GNU Library General Public
2611 // License as published by the Free Software Foundation; either
2612 // version 2 of the License, or (at your option) any later version.
2614 // This library is distributed in the hope that it will be useful,
2615 // but WITHOUT ANY WARRANTY; without even the implied warranty of
2616 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2617 // Library General Public License for more details.
2619 // You should have received a copy of the GNU Library General Public
2620 // License along with this library; if not, write to the Free
2621 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2623 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2625 //# 43 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
2627 extern ostream& operator<<(ostream&, bool);
2629 // Should this be kept separate? bool isn't, but then is
2630 // included here only to define ostream& operator<<(ostream&, bool)
2631 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/unit.h" 1
2639 // Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU)
2642 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2645 // $Date: 1994/05/16 09:13:02 $
2650 // This _looks_ silly, but it has an important theoretical basis in category
2651 // theory. For the pragmatic reason for its existence, see the example below.
2657 extern const char *stringify(unit u);
2659 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
2660 // This is part of the iostream library, providing -*- C++ -*- input/output.
2661 // Copyright (C) 1991 Per Bothner.
2663 // This library is free software; you can redistribute it and/or
2664 // modify it under the terms of the GNU Library General Public
2665 // License as published by the Free Software Foundation; either
2666 // version 2 of the License, or (at your option) any later version.
2668 // This library is distributed in the hope that it will be useful,
2669 // but WITHOUT ANY WARRANTY; without even the implied warranty of
2670 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2671 // Library General Public License for more details.
2673 // You should have received a copy of the GNU Library General Public
2674 // License along with this library; if not, write to the Free
2675 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2677 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2679 //# 28 "/sandbox/wbaker/wbaker0/source/mips/include/unit.h" 2
2681 extern ostream& operator<<(ostream&, unit);
2684 // A unit is used in cases where the type signature of an overloaded
2685 // function must be differentiated in some stronger way than can be
2686 // denoted unambiguously in the C++ syntax. This enum is used to give
2687 // one of the functions a different type signature, thereby allowing
2690 // The use of ``unit'' instead of int or bool is important because a unit
2691 // has only one possible value; therefore it adds no more information to
2692 // the code. For example, say a bool was used instead, then in the testing
2693 // phase, would have to ask: what if TRUE was given, what if FALSE was given.
2694 // The problem is compounded if char or int is used.
2700 // ID(); // construct a null ID
2701 // ID(unit); // alloc a ID with a new id
2703 // static unsigned high_water;
2707 // Try working this example save that ID implements all of the generic
2708 // features of the identifier object, but the high_water is stored
2709 // in the heir. That is what originally motivated the creation of unit.
2713 //# 48 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
2717 // In the spirit of the standard GNU error handler functions
2719 // typedef void (*one_arg_error_handler_t)(const char*);
2720 // a one argument error handler function pointer
2721 // typedef void (*two_arg_error_handler_t)(const char*, const char*);
2722 // a two argument error handler function pointer
2726 // typedef void (*zero_arg_error_handler_t)();
2727 // a zero argument error handler function pointer
2729 typedef void (*zero_arg_error_handler_t)();
2732 // In the spirit of the default GNU error handler functions
2734 // extern void default_one_arg_error_handler(const char *message);
2735 // print out message on stderr, and do the default thing (abort)
2736 // extern void default_two_arg_error_handler(const char *kind, const char *message);
2737 // print out kind and message on stderr, and do the default thing (abort)
2741 // extern void default_zero_arg_error_handler(const char *message);
2742 // do the default thing (abort)
2744 extern void default_zero_arg_error_handler();
2746 // Guaranteed to exit (1)
2747 extern void exit_zero_arg_error_handler();
2748 extern void exit_one_arg_error_handler(const char *message);
2749 extern void exit_two_arg_error_handler(const char *kind, const char *message);
2751 // Guaranteed to abort()
2752 extern void abort_zero_arg_error_handler();
2753 extern void abort_one_arg_error_handler(const char *message);
2754 extern void abort_two_arg_error_handler(const char *kind, const char *message);
2757 // In the spirit of the standard GNU error handlers
2759 // extern void verbose_File_error_handler(const char*);
2760 // perror and set errno = 0
2761 // extern void quiet_File_error_handler(const char*);
2763 // extern void fatal_File_error_handler(const char*);
2764 // perror and exit 1
2768 // extern void preserve_File_error_handler(const char *message);
2769 // no perror, no assignment to errno.
2771 extern void preserve_File_error_handler(const char *message);
2774 //# 27 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
2776 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
2778 //# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
2780 //# 28 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
2784 // It is expected that this will be virtually multiply inherited
2785 // into all of the classes that need error reporting services.
2787 // The typical way to have that done is by inheriting the GttObject
2788 // as a virtual base class.
2792 // GttErrorHandler class
2794 class GttErrorHandler {
2797 GttErrorHandler(const char *program);
2798 virtual ~GttErrorHandler();
2802 // - an unacceptable, but expected and recoverable condition
2803 // was was detected (but the test fails)
2804 // - errors are for ``the expected environment was not found''
2805 // rather than for ``file couldn't be opened''
2806 // - these messages cannot be shut off
2807 // - the error handler determines the recovery action
2808 // TODO - one day exceptions will be used here
2810 static void error(const char *message);
2811 static void error(tostrstream& message);
2813 static void error(const char *function, const char *message);
2814 static void error(const char *function, tostrstream& message);
2816 static void error(const char *class_name, const char *method, const char *message);
2817 static void error(const char *class_name, const char *method, tostrstream& message);
2821 // - an unacceptable and unexpected error was detected
2822 // the data invariants were violated, there is no recovery
2823 // - these messages cannot be shut off
2824 // - the error handler determines the recovery action
2825 // TODO - one day exceptions will be used here
2827 static void fatal(const char *message);
2828 static void fatal(tostrstream& message);
2830 static void fatal(const char *function, const char *message);
2831 static void fatal(const char *function, tostrstream& message);
2833 static void fatal(const char *class_name, const char *method, const char *message);
2834 static void fatal(const char *class_name, const char *method, tostrstream& message);
2837 // Two underscores are used here in order to prevent confusion of these
2838 // private variables with any of the heir's private variables. Note that
2839 // access control is different than visibility in C++, so all the variable
2840 // names in a class hierarchy must be unique.
2843 static bool __partial_init;
2844 static void __partial_initialize();
2845 static bool __full_init;
2846 static void __full_initialize(const char *program);
2847 static char *__program;
2849 static void __handle_error();
2850 static void __handle_fatal();
2851 static void __add_newline(const char *message);
2853 static bool __output_valid();
2854 static ostream *__output;
2858 //# 27 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
2862 // GttObject class (is abstract)
2864 class GttObject: virtual public GttErrorHandler {
2867 GttObject(const GttObject&);
2868 virtual ~GttObject(); // ensure descendants have virtual destructors
2874 // The value typically persists only long enough for an i/o operation
2875 // to be performed (see the defintion of output via operator<<(... ) below)
2876 virtual const char *stringify();
2878 // This is the buffer into which the printed representation of this
2879 // object will be put when the time comes. It is associated with the
2880 // object so it will never go away (so long as the object exists).
2881 // Use a pointer so that you only pay for the space when I/O is used
2882 tostrstream *stringbuf;
2883 void clear_stringbuf();
2889 // The global data invariant for the whole object (heirs included).
2890 // This OK function will call the local invariant function ok() if
2891 // necessary and in addition the OK functions of the heirs
2892 // This is expected to compute the data invariant of the object.
2893 // It will execute GctErrorHandler::fatal if there is wrong.
2894 virtual void OK() const;
2900 // This function computes the invariant which is local to this object.
2901 // It does not call any of the ancestor's OK() or ok() functions.
2902 // It is not a virtual function so that it can be called from within a
2903 // constructor with impunity. Thus this function MUST NOT call any
2904 // virtual functions either; it should call them by their full name if
2905 // that is necessary. The global OK() function will call this function
2908 // This function must NOT NEVER EVER be made virtual.
2915 // This must return a static (constant) string which is the name
2916 // of the class being declared. By convention, not all classes
2917 // must have one of these, but the major root abstract class must
2918 // have one in order to allow the stringify() to work approximately
2920 virtual const char *class_name() const = 0;
2923 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
2924 // This is part of the iostream library, providing -*- C++ -*- input/output.
2925 // Copyright (C) 1991 Per Bothner.
2927 // This library is free software; you can redistribute it and/or
2928 // modify it under the terms of the GNU Library General Public
2929 // License as published by the Free Software Foundation; either
2930 // version 2 of the License, or (at your option) any later version.
2932 // This library is distributed in the hope that it will be useful,
2933 // but WITHOUT ANY WARRANTY; without even the implied warranty of
2934 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2935 // Library General Public License for more details.
2937 // You should have received a copy of the GNU Library General Public
2938 // License along with this library; if not, write to the Free
2939 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2941 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2943 //# 91 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
2945 extern ostream& operator<<(ostream&, GttObject&);
2947 // There may be other X& operator<<(X&, GttObject&) defined in the
2948 // packages defining class X. For example see the definition of
2949 // GttUnitObject& operator<<(GttUnitObject&, GttObject&) in Unit.
2952 //# 27 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
2955 //# 1 "../../../../../../mips/include/Gct/GctErrorHandler.h" 1
2961 // GctErrorHandler class
2963 // Expects to be included by Gct.h
2965 // Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU)
2975 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2978 // $Date: 1994/05/16 09:13:02 $
2980 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
2988 //# 25 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
2990 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 1
2991 // This may look like C code, but it is really -*- C++ -*-
2993 Copyright (C) 1988 Free Software Foundation
2994 written by Doug Lea (dl@rocky.oswego.edu)
2996 This file is part of the GNU C++ Library. This library is free
2997 software; you can redistribute it and/or modify it under the terms of
2998 the GNU Library General Public License as published by the Free
2999 Software Foundation; either version 2 of the License, or (at your
3000 option) any later version. This library is distributed in the hope
3001 that it will be useful, but WITHOUT ANY WARRANTY; without even the
3002 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
3003 PURPOSE. See the GNU Library General Public License for more details.
3004 You should have received a copy of the GNU Library General Public
3005 License along with this library; if not, write to the Free Software
3006 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
3010 //# 1321 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h"
3012 //# 26 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
3014 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
3015 // This is part of the iostream library, providing -*- C++ -*- input/output.
3016 // Copyright (C) 1991 Per Bothner.
3018 // This library is free software; you can redistribute it and/or
3019 // modify it under the terms of the GNU Library General Public
3020 // License as published by the Free Software Foundation; either
3021 // version 2 of the License, or (at your option) any later version.
3023 // This library is distributed in the hope that it will be useful,
3024 // but WITHOUT ANY WARRANTY; without even the implied warranty of
3025 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3026 // Library General Public License for more details.
3028 // You should have received a copy of the GNU Library General Public
3029 // License along with this library; if not, write to the Free
3030 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3032 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
3034 //# 27 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
3037 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 1
3039 //# 107 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h"
3041 //# 29 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
3043 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
3045 //# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
3047 //# 30 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
3050 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 1
3052 //# 98 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h"
3054 //# 32 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
3058 // It is expected that this will be virtually multiply inherited
3059 // into all of the classes that need error reporting services.
3061 // The typical way to have that done is by inheriting the GctObject
3062 // as a virtual base class.
3066 // GctErrorHandler class
3069 // NOTE - virtual public GttObject should be MI into GctObject - but that
3070 // causes g++ 1.96 to segfault; so we must inherit GttObject here and use SI
3072 class GctErrorHandler: virtual public GttObject {
3075 GctErrorHandler(const String& program);
3076 virtual ~GctErrorHandler();
3079 // Debugging messages
3080 // - these are turned off for production code.
3081 // - these messages can be shut off
3083 static void debug(const char *message);
3084 static void debug(tostrstream& message);
3086 static void debug(const char *function, const char *message);
3087 static void debug(const char *function, tostrstream& message);
3089 static void debug(const char *class_name, const char *method, const char *message);
3090 static void debug(const char *class_name, const char *method, tostrstream& message);
3092 static bool debug(); // current debug switch
3093 static void debug(bool value); // change the debug switch
3096 // Informational messages
3097 // - these correspond to a ``verbose'' mode
3098 // - these are not errors, just chatty progress reports
3099 // - these messages can be shut off
3101 static void note(const char *message);
3102 static void note(tostrstream& message);
3104 static void note(const char *function, const char *message);
3105 static void note(const char *function, tostrstream& message);
3107 static void note(const char *class_name, const char *method, const char *message);
3108 static void note(const char *class_name, const char *method, tostrstream& message);
3110 static bool note(); // current note switch
3111 static void note(bool value); // change the note switch
3115 // - warnings are system-recoverable errors
3116 // - the system has noticed something and taken some
3117 // corrective action
3118 // - these messages can be shut off
3120 static void warning(const char *message);
3121 static void warning(tostrstream& message);
3123 static void warning(const char *function, const char *message);
3124 static void warning(const char *function, tostrstream& message);
3126 static void warning(const char *class_name, const char *method, const char *message);
3127 static void warning(const char *class_name, const char *method, tostrstream& message);
3129 static bool warning(); // current warning switch
3130 static void warning(bool value); // change the warning switch
3134 // - an unacceptable, but expected and recoverable
3135 // condition was was detected
3136 // - errors are for ``the expected environment was not found''
3137 // rather than for ``file couldn't be opened''
3138 // - these messages cannot be shut off
3139 // - the error handler determines the recovery action
3140 // TODO - one day exceptions will be used here
3142 static void error(const char *message);
3143 static void error(tostrstream& message);
3145 static void error(const char *function, const char *message);
3146 static void error(const char *function, tostrstream& message);
3148 static void error(const char *class_name, const char *method, const char *message);
3149 static void error(const char *class_name, const char *method, tostrstream& message);
3151 // can't turn off errors - no ``static void error(bool value);''
3152 static zero_arg_error_handler_t error(); // current error handler
3153 static void error(zero_arg_error_handler_t handler);// change the error handler
3155 static void error_is_lib_error_handler(); // change the error handler
3156 static void error_is_exit(); // change the error handler
3158 // Describes the fatal handler - WATCHOUT - implicitly uses AllocRing
3159 static const char *error_handler_description();
3163 // - an unacceptable and unexpected error was detected
3164 // the data invariants were violated, there is no recovery
3165 // - these messages cannot be shut off
3166 // - the error handler determines the recovery action
3167 // TODO - one day exceptions will be used here
3169 static void fatal(const char *message);
3170 static void fatal(tostrstream& message);
3172 static void fatal(const char *function, const char *message);
3173 static void fatal(const char *function, tostrstream& message);
3175 static void fatal(const char *class_name, const char *method, const char *message);
3176 static void fatal(const char *class_name, const char *method, tostrstream& message);
3178 // can't turn off fatals - no ``static void fatal(bool value);''
3179 static zero_arg_error_handler_t fatal(); // return the fatal handler
3180 static void fatal(zero_arg_error_handler_t handler); // change the fatal handler
3182 static void fatal_is_exit(); // change the fatal handler
3183 static void fatal_is_abort(); // change the fatal handler
3185 // Describes the fatal handler - WATCHOUT - implicitly uses AllocRing
3186 static const char *fatal_handler_description();
3189 // Two underscores are used here in order to prevent confusion of these
3190 // private variables with any of the heir's private variables. Note that
3191 // access control is different than visibility in C++, so all the variable
3192 // names in a class hierarchy must be unique.
3194 static bool __debug;
3196 static bool __warning;
3197 static void (*__error_handler)(); // can't turn off errors
3198 static void (*__fatal_handler)(); // can't turn off fatals
3200 static bool __partial_init;
3201 static void __partial_initialize();
3202 static bool __full_init;
3203 static void __full_initialize(const char *program);
3204 static char *__program;
3206 static void __handle_error();
3207 static void __handle_fatal();
3208 static void __add_newline(const char *message);
3209 static void __message_switch(bool value, bool& flag, const char *description);
3210 static void __message_switch(bool value, bool& flag);
3211 static const char *__describe_handler(zero_arg_error_handler_t handler);
3213 static bool __output_valid();
3214 static ostream *__output;
3217 const char *class_name() const;
3222 //# 29 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
3226 // GctObject class (is abstract)
3228 class GctObject: virtual public GctErrorHandler /*, virtual public GttObject*/ {
3231 GctObject(const GctObject&);
3232 virtual ~GctObject(); // ensure descendants have virtual destructors
3238 // The value typically persists only long enough for an i/o operation
3239 // to be performed (see the defintion of output via operator<<(... ) below)
3240 virtual const char *stringify();
3242 // This is the buffer into which the printed representation of this
3243 // object will be put when the time comes. It is associated with the
3244 // object so it will never go away (so long as the object exists).
3245 // Use a pointer so that you only pay for the space when I/O is used
3246 tostrstream *stringbuf;
3247 void clear_stringbuf();
3251 // Consistency (global consistency)
3253 // The global data invariant for the whole object (heirs included).
3254 // This OK function will call the local invariant function ok() if
3255 // necessary and in addition the OK functions of the heirs
3256 // This is expected to compute the data invariant of the object.
3257 // It will execute GctErrorHandler::fatal if there is wrong.
3258 virtual void OK() const;
3262 // consistency (local consistency)
3264 // This function computes the invariant which is local to this object.
3265 // It does not call any of the ancestor's OK() or ok() functions.
3266 // It is not a virtual function so that it can be called from within a
3267 // constructor with impunity. Thus this function MUST NOT call any
3268 // virtual functions either; it should call them by their full name if
3269 // that is necessary. The global OK() function will call this function
3272 // This function must NOT NEVER EVER be made virtual.
3278 // This must return a static (constant) string which is the name
3279 // of the class being declared. By convention, not all classes
3280 // must have one of these, but the major root abstract class must
3281 // have one in order to allow the stringify() to work approximately
3283 virtual const char *class_name() const = 0;
3287 // The ``id'' of this object
3289 // NOTE - we explicitly allow the situation where this function
3290 // can return the address of the object - the ``this'' pointer
3291 // instead of a computed id field (the __object_id field below).
3293 // This function is protected because we don't want too much dependence
3294 // on this notion of object identity. I want to be able to rip it
3295 // out if it becomes to cumbersome.
3296 unsigned objectId() const;
3301 // NOTE - Normally this would be implemented by the `this' pointer.
3302 // TODO - remove this for production code
3304 // However, in order to make the test suites run on all machines, we
3305 // make this into a symbolic id that is maintained with each object.
3306 // Thus the valid outputs are always consistent across all machines.
3307 unsigned __object_id;
3308 static unsigned __next_id;
3311 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
3312 // This is part of the iostream library, providing -*- C++ -*- input/output.
3313 // Copyright (C) 1991 Per Bothner.
3315 // This library is free software; you can redistribute it and/or
3316 // modify it under the terms of the GNU Library General Public
3317 // License as published by the Free Software Foundation; either
3318 // version 2 of the License, or (at your option) any later version.
3320 // This library is distributed in the hope that it will be useful,
3321 // but WITHOUT ANY WARRANTY; without even the implied warranty of
3322 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3323 // Library General Public License for more details.
3325 // You should have received a copy of the GNU Library General Public
3326 // License along with this library; if not, write to the Free
3327 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3329 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
3331 //# 117 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
3333 extern ostream& operator<<(ostream&, GctObject&);
3336 //# 25 "../../../../../../mips/include/Gct/Object/GctHashObject.h" 2
3340 // GctHashObject class (is abstract)
3342 class GctHashObject: virtual public GctObject {
3345 GctHashObject(const GctHashObject&);
3351 virtual unsigned hash() const;
3355 //# 28 "../../GctSymbol.h" 2
3361 class GctSymbol: virtual public GctHashObject, String {
3363 GctSymbol(); // vacuous symbol required for genclass usage
3364 GctSymbol(const char*);
3365 GctSymbol(const String&);
3366 GctSymbol(const GctSymbol&);
3368 operator const char *() const;
3370 bool operator==(const GctSymbol&) const;
3371 bool operator!=(const GctSymbol&) const;
3373 bool operator<=(const GctSymbol&) const;
3374 bool operator<(const GctSymbol&) const;
3375 bool operator>=(const GctSymbol&) const;
3376 bool operator>(const GctSymbol&) const;
3378 unsigned hash() const;
3381 const char *stringify();
3386 const char *class_name() const;
3389 extern unsigned hash(GctSymbol&); // genclass support (no const)
3394 // Note - none of the String operators save for operator const char *()
3395 // are String member functions, instead, they are anonymous functions
3396 // which work by overloading.
3403 GctSymbol::operator const char *() const
3410 return String::operator const char *();
3414 GctSymbol::operator==(const GctSymbol& other) const
3421 return (bool)::operator==(*this, other);
3425 GctSymbol::operator!=(const GctSymbol& other) const
3432 return (bool)::operator!=(*this, other);
3436 GctSymbol::operator<=(const GctSymbol& other) const
3443 return (bool)::operator<=(*this, other);
3447 GctSymbol::operator<(const GctSymbol& other) const
3454 return (bool)::operator<(*this, other);
3458 GctSymbol::operator>=(const GctSymbol& other) const
3465 return (bool)::operator>=(*this, other);
3469 GctSymbol::operator>(const GctSymbol& other) const
3476 return (bool)::operator>(*this, other);
3480 //# 25 "GctSymbol.defs.h" 2
3483 // equality operator
3488 // less-than-or-equal
3493 // comparison : less-than -> 0
3500 extern unsigned int hash(GctSymbol&);
3504 // initial capacity for structures requiring one
3512 //# 27 "GctSymbol.GctSymbol.Map.h" 2
3515 class GctSymbolGctSymbolMap
3522 GctSymbolGctSymbolMap(GctSymbol& dflt);
3523 virtual ~GctSymbolGctSymbolMap();
3525 int length(); // current number of items
3528 virtual int contains(GctSymbol& key); // is key mapped?
3530 virtual void clear(); // delete all items
3532 virtual GctSymbol& operator [] (GctSymbol& key) = 0; // access contents by key
3534 virtual void del(GctSymbol& key) = 0; // delete entry
3536 virtual Pix first() = 0; // Pix of first item or 0
3537 virtual void next(Pix& i) = 0; // advance to next or 0
3538 virtual GctSymbol& key(Pix i) = 0; // access key at i
3539 virtual GctSymbol& contents(Pix i) = 0; // access contents at i
3541 virtual int owns(Pix i); // is i a valid Pix ?
3542 virtual Pix seek(GctSymbol& key); // Pix of key
3544 GctSymbol& dflt(); // access default val
3546 void error(const char* msg);
3547 virtual int OK() = 0; // rep invariant
3552 inline GctSymbolGctSymbolMap::~GctSymbolGctSymbolMap() {}
3554 inline int GctSymbolGctSymbolMap::length()
3559 inline int GctSymbolGctSymbolMap::empty()
3564 inline GctSymbol& GctSymbolGctSymbolMap::dflt()
3569 inline GctSymbolGctSymbolMap::GctSymbolGctSymbolMap(GctSymbol& dflt) :def(dflt)
3577 //# 26 "GctSymbol.GctSymbol.CHMap.h" 2
3583 struct GctSymbolGctSymbolCHNode
3585 GctSymbolGctSymbolCHNode* tl;
3588 GctSymbolGctSymbolCHNode();
3589 GctSymbolGctSymbolCHNode(GctSymbol& h, GctSymbol& c, GctSymbolGctSymbolCHNode* t = 0);
3590 ~GctSymbolGctSymbolCHNode();
3595 inline GctSymbolGctSymbolCHNode::GctSymbolGctSymbolCHNode() {}
3597 inline GctSymbolGctSymbolCHNode::GctSymbolGctSymbolCHNode(GctSymbol& h, GctSymbol& c, GctSymbolGctSymbolCHNode* t)
3598 : hd(h), cont(c), tl(t) {}
3600 inline GctSymbolGctSymbolCHNode::~GctSymbolGctSymbolCHNode() {}
3605 typedef GctSymbolGctSymbolCHNode* GctSymbolGctSymbolCHNodePtr;
3610 class GctSymbolGctSymbolCHMap : public GctSymbolGctSymbolMap
3613 GctSymbolGctSymbolCHNode** tab;
3617 GctSymbolGctSymbolCHMap(GctSymbol& dflt,unsigned int sz=100 );
3618 GctSymbolGctSymbolCHMap(GctSymbolGctSymbolCHMap& a);
3619 ~GctSymbolGctSymbolCHMap();
3621 GctSymbol& operator [] (GctSymbol& key);
3623 void del(GctSymbol& key);
3627 GctSymbol& key(Pix i);
3628 GctSymbol& contents(Pix i);
3630 Pix seek(GctSymbol& key);
3631 int contains(GctSymbol& key);
3639 inline GctSymbolGctSymbolCHMap::~GctSymbolGctSymbolCHMap()
3645 inline int GctSymbolGctSymbolCHMap::contains(GctSymbol& key)
3647 return seek(key) != 0;
3650 inline GctSymbol& GctSymbolGctSymbolCHMap::key(Pix p)
3652 if (p == 0) error("null Pix");
3653 return ((GctSymbolGctSymbolCHNode*)p)->hd;
3656 inline GctSymbol& GctSymbolGctSymbolCHMap::contents(Pix p)
3658 if (p == 0) error("null Pix");
3659 return ((GctSymbolGctSymbolCHNode*)p)->cont;
3665 //# 22 "GctSymbol.GctSymbol.CHMap.cc" 2
3668 // The nodes are linked together serially via a version
3669 // of a trick used in some vtables: odd pointers are
3670 // actually links to the next table entry.
3671 // Not terrible, but not wonderful either
3673 static inline int goodCHptr(GctSymbolGctSymbolCHNode* t)
3675 return ((((unsigned)t) & 1) == 0);
3678 static inline GctSymbolGctSymbolCHNode* index_to_CHptr(int i)
3680 return (GctSymbolGctSymbolCHNode*)((i << 1) + 1);
3683 static inline int CHptr_to_index(GctSymbolGctSymbolCHNode* t)
3685 return ( ((unsigned) t) >> 1);
3688 GctSymbolGctSymbolCHMap::GctSymbolGctSymbolCHMap(GctSymbol& dflt, unsigned int sz)
3689 :GctSymbolGctSymbolMap(dflt)
3691 tab = (GctSymbolGctSymbolCHNode**)(new GctSymbolGctSymbolCHNodePtr[size = sz]);
3692 for (unsigned int i = 0; i < size; ++i) tab[i] = index_to_CHptr(i+1);
3696 GctSymbolGctSymbolCHMap::GctSymbolGctSymbolCHMap(GctSymbolGctSymbolCHMap& a) :GctSymbolGctSymbolMap(a.def)
3698 tab = (GctSymbolGctSymbolCHNode**)(new GctSymbolGctSymbolCHNodePtr[size = a.size]);
3699 for (unsigned int i = 0; i < size; ++i) tab[i] = index_to_CHptr(i+1);
3701 for (Pix p = a.first(); p; a.next(p)) (*this)[a.key(p)] = a.contents(p); // gets bogus error - type `GctSymbol' is derived from private `String'