5 //# 1 "GctSymbol.GctSymbol.CHMap.cc"
6 // This may look like C code, but it is really -*- C++ -*-
8 Copyright (C) 1988, 2000, 2002 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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)
135 //# 25 "../../GctSymbol.h" 2
137 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 1
138 // This may look like C code, but it is really -*- C++ -*-
140 Copyright (C) 1988 Free Software Foundation
141 written by Doug Lea (dl@rocky.oswego.edu)
143 This file is part of the GNU C++ Library. This library is free
144 software; you can redistribute it and/or modify it under the terms of
145 the GNU Library General Public License as published by the Free
146 Software Foundation; either version 2 of the License, or (at your
147 option) any later version. This library is distributed in the hope
148 that it will be useful, but WITHOUT ANY WARRANTY; without even the
149 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
150 PURPOSE. See the GNU Library General Public License for more details.
151 You should have received a copy of the GNU Library General Public
152 License along with this library; if not, write to the Free Software
153 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
163 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stream.h" 1
167 // Compatibility with old library.
170 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
171 // This is part of the iostream library, providing -*- C++ -*- input/output.
172 // Copyright (C) 1991 Per Bothner.
174 // This library is free software; you can redistribute it and/or
175 // modify it under the terms of the GNU Library General Public
176 // License as published by the Free Software Foundation; either
177 // version 2 of the License, or (at your option) any later version.
179 // This library is distributed in the hope that it will be useful,
180 // but WITHOUT ANY WARRANTY; without even the implied warranty of
181 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
182 // Library General Public License for more details.
184 // You should have received a copy of the GNU Library General Public
185 // License along with this library; if not, write to the Free
186 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
195 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/streambuf.h" 1
196 // This is part of the iostream library, providing -*- C++ -*- input/output.
197 // Copyright (C) 1991 Per Bothner.
199 // This library is free software; you can redistribute it and/or
200 // modify it under the terms of the GNU Library General Public
201 // License as published by the Free Software Foundation; either
202 // version 2 of the License, or (at your option) any later version.
204 // This library is distributed in the hope that it will be useful,
205 // but WITHOUT ANY WARRANTY; without even the implied warranty of
206 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
207 // Library General Public License for more details.
209 // You should have received a copy of the GNU Library General Public
210 // License along with this library; if not, write to the Free
211 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
220 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 1
227 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/mips/lib/gcc/decstatn/cygnus-1.96/include/stddef.h" 1
234 /* This avoids lossage on Sunos but only if stdtypes.h comes first.
235 There's no way to win with the other order! Sun lossage. */
237 /* In case nobody has defined these types, but we aren't running under
238 GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
239 __WCHAR_TYPE__ have reasonable values. This can happen if the
240 parts of GCC is compiled by an older compiler, that actually
241 include gstddef.h, such as collect2. */
243 /* Signed type of difference of two pointers. */
258 typedef long int ptrdiff_t;
265 /* Unsigned type of `sizeof' something. */
280 typedef unsigned int size_t;
287 /* Data type for wide chars. */
310 /* A null pointer constant. */
315 /* Offset of member MEMBER in a struct of type TYPE. */
321 //# 7 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 2
328 //# 25 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/streambuf.h" 2
345 class ostream; class streambuf;
347 typedef long streamoff, streampos;
349 struct _ios_fields { // The data members of an ios.
353 unsigned long _flags;
355 unsigned char _state;
356 unsigned short _precision;
360 enum state_value { _good = 0, _eof = 1, _fail = 2, _bad = 4 };
363 class ios : public _ios_fields {
365 enum io_state { goodbit=0, eofbit=1, failbit=2, badbit=4 };
374 enum seek_dir { beg, cur, end};
375 enum { skipws=01, left=02, right=04, internal=010,
376 dec=020, oct=040, hex=0100,
377 showbase=0200, showpoint=0400, uppercase=01000, showpos=02000,
378 scientific=04000, fixed=0100000, unitbuf=020000, stdio=040000,
379 dont_close=0x80000000 //Don't close streambuf when destroying stream
382 ostream* tie() { return _tie; }
383 ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; }
385 // Methods to change the format state.
386 char fill() { return _fill; }
387 char fill(char newf) { char oldf = _fill; _fill = newf; return oldf; }
388 unsigned long flags() { return _flags; }
389 unsigned long flags(unsigned long new_val) {
390 unsigned long old_val = _flags; _flags = new_val; return old_val; }
391 unsigned short precision() { return _precision; }
392 unsigned short precision(int newp) {
393 unsigned short oldp = _precision; _precision = (unsigned short)newp;
395 unsigned long setf(unsigned long val) {
396 unsigned long oldbits = _flags;
397 _flags |= val; return oldbits; }
398 unsigned long setf(unsigned long val, unsigned long mask) {
399 unsigned long oldbits = _flags;
400 _flags = (_flags & ~mask) | (val & mask); return oldbits; }
401 unsigned long unsetf(unsigned long mask) {
402 unsigned long oldbits = _flags & mask;
403 _flags &= ~mask; return oldbits; }
404 long width() { return _width; }
405 long width(long val) { long save = _width; _width = val; return save; }
407 static const unsigned long basefield;
408 static const unsigned long adjustfield;
409 static const unsigned long floatfield;
411 streambuf* rdbuf() { return _strbuf; }
412 void clear(int state = 0) { _state = state; }
413 int good() { return _state == 0; }
414 int eof() { return _state & ios::eofbit; }
415 int fail() { return _state & (ios::badbit|ios::failbit); }
416 int bad() { return _state & ios::badbit; }
417 int rdstate() { return _state; }
418 void set(int flag) { _state |= flag; }
419 operator void*() { return fail() ? (void*)0 : (void*)this; }
420 int operator!() { return fail(); }
423 void unset(state_value flag) { _state &= ~flag; }
431 ios(streambuf*sb) { _strbuf=sb; _state=0; _width=0; _fill=' ';
432 _flags=ios::skipws; _precision=6; }
438 typedef ios::seek_dir _seek_dir;
441 // Magic numbers and bits for the _flags field.
442 // The magic numbers use the high-order bits of _flags;
443 // the remaining bits are abailable for variable flags.
444 // Note: The magic numbers must all be negative if stdio
445 // emulation is desired.
462 // NOTE: If this is changed, also change __FILE in stdio/stdio.h!
463 int _flags; /* High-order word is _IO_MAGIC; rest is flags. */
464 char* _gptr; /* Current get pointer */
465 char* _egptr; /* End of get area. */
466 char* _eback; /* Start of putback+get area. */
467 char* _pbase; /* Start of put area. */
468 char* _pptr; /* Current put pointer. */
469 char* _epptr; /* End of put area. */
470 char* _base; /* Start of reserve area. */
471 char* _ebuf; /* End of reserve area. */
472 struct streambuf *_chain;
475 struct streambuf : private __streambuf {
477 friend class istream;
478 friend class ostream;
480 static streambuf* _list_all; /* List of open streambufs. */
481 streambuf*& xchain() { return _chain; }
484 char* gptr() const { return _gptr; }
485 char* pptr() const { return _pptr; }
486 char* egptr() const { return _egptr; }
487 char* epptr() const { return _epptr; }
488 char* pbase() const { return _pbase; }
489 char* eback() const { return _eback; }
490 char* ebuf() const { return _ebuf; }
491 char* base() const { return _base; }
492 void xput_char(char c) { *_pptr++ = c; }
493 int xflags() { return _flags; }
494 int xflags(int f) { int fl = _flags; _flags = f; return fl; }
495 void xsetflags(int f) { _flags |= f; }
496 void gbump(int n) { _gptr += n; }
497 void pbump(int n) { _pptr += n; }
498 void setb(char* b, char* eb, int a=0);
499 void setp(char* p, char* ep) { _pbase=_pptr=p; _epptr=ep; }
500 void setg(char* eb, char* g, char *eg) { _eback=eb; _gptr=g; _egptr=eg; }
502 static int flush_all();
503 static void flush_all_linebuffered(); // Flush all line buffered files.
504 virtual int underflow(); // Leave public for now
505 virtual int overflow(int c = (-1) ); // Leave public for now
506 virtual int doallocate();
507 virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
508 virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out);
509 int sputbackc(char c);
512 virtual ~streambuf();
513 int unbuffered() { return _flags & 2 ? 1 : 0; }
514 int linebuffered() { return _flags & 0x4000 ? 1 : 0; }
515 void unbuffered(int i)
516 { if (i) _flags |= 2 ; else _flags &= ~2 ; }
517 void linebuffered(int i)
518 { if (i) _flags |= 0x4000 ; else _flags &= ~0x4000 ; }
520 if (base() || unbuffered()) return 0;
521 else return doallocate(); }
523 virtual int pbackfail(int c);
524 virtual int ungetfail();
525 virtual streambuf* setbuf(char* p, int len);
526 int in_avail() { return _egptr - _gptr; }
527 int out_waiting() { return _pptr - _pbase; }
528 virtual int sputn(const char* s, int n);
529 virtual int sgetn(char* s, int n);
530 long sgetline(char* buf, size_t n, char delim, int putback_delim);
532 if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
533 else return *(unsigned char*)_gptr++; }
535 if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
536 else return *(unsigned char*)_gptr; }
538 if (++_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
539 else return *(unsigned char*)_gptr; }
541 if (_pptr >= _epptr) return overflow(c);
542 return *_pptr++ = c, (unsigned char)c; }
543 int vscan(char const *fmt0, char* ap);
544 int vform(char const *fmt0, char* ap);
547 struct __file_fields {
557 class filebuf : public streambuf {
558 struct __file_fields _fb;
563 filebuf(int fd, char* p, int len);
565 filebuf* attach(int fd);
566 filebuf* open(const char *filename, const char *mode);
567 filebuf* open(const char *filename, int mode, int prot = 0664);
568 virtual int underflow();
569 virtual int overflow(int c = (-1) );
570 int is_open() { return _fb._fileno >= 0; }
571 int fd() { return is_open() ? _fb._fileno : (-1) ; }
573 virtual int doallocate();
574 virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
575 int sputn(const char* s, int n);
576 int sgetn(char* s, int n);
577 protected: // See documentation in filebuf.C.
578 virtual int pbackfail(int c);
580 int is_reading() { return eback() != egptr(); }
581 char* cur_ptr() { return is_reading() ? gptr() : pptr(); }
582 /* System's idea of pointer */
583 char* file_ptr() { return _fb._save_gptr ? _fb._save_egptr : egptr(); }
585 // Low-level operations (Usually invoke system calls.)
586 virtual int sys_read(char* buf, size_t size);
587 virtual long sys_seek(long , _seek_dir);
588 virtual long sys_write(const void*, long);
589 virtual int sys_stat(void*); // Actually, a (struct stat*)
590 virtual int sys_close();
594 inline int ios::readable() { return rdbuf()->_flags & 4 ; }
595 inline int ios::writable() { return rdbuf()->_flags & 8 ; }
596 inline int ios::is_open() {return rdbuf()->_flags & 4 +8 ;}
601 //# 25 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 2
604 class istream; class ostream;
605 typedef istream& (*__imanip)(istream&);
606 typedef ostream& (*__omanip)(ostream&);
608 extern istream& ws(istream& ins);
609 extern ostream& flush(ostream& outs);
610 extern ostream& endl(ostream& outs);
611 extern ostream& ends(ostream& outs);
613 class ostream : public ios
618 ostream(streambuf* sb, ostream* tied=(__null) );
621 int opfx() { if (!good()) return 0; if (_tie) _tie->flush(); return 1; }
622 void osfx() { if (flags() & (ios::unitbuf|ios::stdio))
624 streambuf* ostreambuf() const { return _strbuf; }
626 ostream& put(char c);
627 ostream& write(const char *s, int n);
628 ostream& write(const unsigned char *s, int n) { return write((char*)s, n);}
629 ostream& write(const void *s, int n) { return write((char*)s, n);}
630 ostream& seekp(streampos);
631 ostream& seekp(streamoff, _seek_dir);
633 ostream& form(const char *format ...);
634 ostream& vform(const char *format, char* args);
637 ostream& operator<<(ostream&, char c);
638 ostream& operator<<(ostream& os, unsigned char c) { return os << (char)c; }
639 //ostream& operator<<(ostream &os, signed char c) { return os << (char)c; }
640 extern ostream& operator<<(ostream&, const char *s);
641 inline ostream& operator<<(ostream& os, const unsigned char *s)
642 { return os << (const char*)s; }
643 //inline ostream& operator<<(ostream& os, const signed char *s)
644 //{ return os << (const char*)s; }
645 ostream& operator<<(ostream&, void *p);
646 ostream& operator<<(ostream&, int n);
647 ostream& operator<<(ostream&, long n);
648 ostream& operator<<(ostream&, unsigned int n);
649 ostream& operator<<(ostream&, unsigned long n);
650 ostream& operator<<(ostream& os, short n) {return os << (int)n;}
651 ostream& operator<<(ostream& os, unsigned short n)
652 {return os << (unsigned int)n;}
653 ostream& operator<<(ostream&, float n);
654 ostream& operator<<(ostream&, double n);
655 ostream& operator<<(ostream& os, __omanip func) { return (*func)(os); }
656 ostream& operator<<(ostream&, streambuf*);
658 class istream : public ios
663 istream(streambuf* sb, ostream*tied=(__null) );
665 streambuf* istreambuf() const { return _strbuf; }
666 istream& get(char& c);
667 istream& get(unsigned char& c);
668 istream& read(char *ptr, int n);
669 istream& read(unsigned char *ptr, int n) { return read((char*)ptr, n); }
670 istream& read(void *ptr, int n) { return read((char*)ptr, n); }
671 int get() { return _strbuf->sbumpc(); }
672 istream& getline(char* ptr, int len, char delim = '\n');
673 istream& get(char* ptr, int len, char delim = '\n');
674 istream& gets(char **s, char delim = '\n');
676 if (!good()) { set(ios::failbit); return 0; }
677 if (_tie && (need == 0 || rdbuf()->in_avail())) ; //??? THIS LINE IS QUESTIONABLE */
678 if (!need && (flags() & ios::skipws) && !ws(*this)) return 0;
681 int ipfx0() { // Optimized version of ipfx(0).
682 if (!good()) { set(ios::failbit); return 0; }
683 if (_tie) _tie->flush();
684 if ((flags() & ios::skipws) && !ws(*this)) return 0;
687 int ipfx1() { // Optimized version of ipfx(1).
688 if (!good()) { set(ios::failbit); return 0; }
689 if (_tie && rdbuf()->in_avail() == 0) _tie->flush();
692 size_t gcount() { return _gcount; }
693 istream& seekg(streampos);
694 istream& seekg(streamoff, _seek_dir);
696 istream& putback(char ch) {
697 if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit);
700 if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit);
703 istream& unget(char ch) { return putback(ch); }
708 istream& operator>>(istream&, char*);
709 istream& operator>>(istream& is, unsigned char* p) { return is >> (char*)p; }
710 //istream& operator>>(istream& is, signed char* p) { return is >> (char*)p; }
711 istream& operator>>(istream&, char& c);
712 istream& operator>>(istream&, unsigned char& c);
713 //istream& operator>>(istream&, signed char& c);
714 istream& operator>>(istream&, int&);
715 istream& operator>>(istream&, long&);
716 istream& operator>>(istream&, short&);
717 istream& operator>>(istream&, unsigned int&);
718 istream& operator>>(istream&, unsigned long&);
719 istream& operator>>(istream&, unsigned short&);
720 istream& operator>>(istream&, float&);
721 istream& operator>>(istream&, double&);
722 istream& operator>>(istream& is, __imanip func) { return (*func)(is); }
724 class iostream : public ios {
728 operator istream&() { return *(istream*)this; }
729 operator ostream&() { return *(ostream*)this; }
731 // NOTE: These duplicate istream methods.
732 istream& get(char& c) { return ((istream*)this)->get(c); }
733 istream& get(unsigned char& c) { return ((istream*)this)->get(c); }
734 istream& read(char *ptr, int n) { return ((istream*)this)->read(ptr, n); }
735 istream& read(unsigned char *ptr, int n)
736 { return ((istream*)this)->read((char*)ptr, n); }
737 istream& read(void *ptr, int n)
738 { return ((istream*)this)->read((char*)ptr, n); }
739 int get() { return _strbuf->sbumpc(); }
740 istream& getline(char* ptr, int len, char delim = '\n')
741 { return ((istream*)this)->getline(ptr, len, delim); }
742 istream& get(char* ptr, int len, char delim = '\n')
743 { return ((istream*)this)->get(ptr, len, delim); }
744 istream& gets(char **s, char delim = '\n')
745 { return ((istream*)this)->gets(s, delim); }
746 int ipfx(int need) { return ((istream*)this)->ipfx(need); }
747 int ipfx0() { return ((istream*)this)->ipfx0(); }
748 int ipfx1() { return ((istream*)this)->ipfx1(); }
749 size_t gcount() { return _gcount; }
750 istream& putback(char ch) { return ((istream*)this)->putback(ch); }
751 istream& unget() { return ((istream*)this)->unget(); }
752 istream& seekg(streampos pos) { return ((istream*)this)->seekg(pos); }
753 istream& seekg(streamoff off, _seek_dir dir)
754 { return ((istream*)this)->seekg(off, dir); }
755 streampos tellg() { return ((istream*)this)->tellg(); }
757 istream& unget(char ch) { return putback(ch); }
760 // NOTE: These duplicate ostream methods.
761 int opfx() { return ((ostream*)this)->opfx(); }
762 void osfx() { ((ostream*)this)->osfx(); }
763 ostream& flush() { return ((ostream*)this)->flush(); }
764 ostream& put(char c) { return ((ostream*)this)->put(c); }
765 ostream& write(const char *s, int n)
766 { return ((ostream*)this)->write(s, n); }
767 ostream& write(const unsigned char *s, int n)
768 { return ((ostream*)this)->write((char*)s, n); }
769 ostream& write(const void *s, int n)
770 { return ((ostream*)this)->write((char*)s, n); }
771 ostream& form(const char *format ...);
772 ostream& vform(const char *format, char* args)
773 { return ((ostream*)this)->vform(format, args); }
774 ostream& seekp(streampos pos) { return ((ostream*)this)->seekp(pos); }
775 ostream& seekp(streamoff off, _seek_dir dir)
776 { return ((ostream*)this)->seekp(off, dir); }
777 streampos tellp() { return ((ostream*)this)->tellp(); }
781 extern ostream cout, cerr, clog; // clog->rdbuf() == cerr->rdbuf()
783 inline ostream& ostream::put(char c) { _strbuf->sputc(c); return *this; }
785 struct Iostream_init { } ; // Compatibility hack for AT&T libraray.
788 //# 7 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stream.h" 2
791 extern char* form(char*, ...);
793 extern char* dec(long, int=0);
794 extern char* dec(int, int=0);
795 extern char* dec(unsigned long, int=0);
796 extern char* dec(unsigned int, int=0);
798 extern char* hex(long, int=0);
799 extern char* hex(int, int=0);
800 extern char* hex(unsigned long, int=0);
801 extern char* hex(unsigned int, int=0);
803 extern char* oct(long, int=0);
804 extern char* oct(int, int=0);
805 extern char* oct(unsigned long, int=0);
806 extern char* oct(unsigned int, int=0);
808 inline istream& WS(istream& str) { return ws(str); }
811 //# 26 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 2
813 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/Regex.h" 1
814 // This may look like C code, but it is really -*- C++ -*-
816 Copyright (C) 1988 Free Software Foundation
817 written by Doug Lea (dl@rocky.oswego.edu)
819 This file is part of the GNU C++ Library. This library is free
820 software; you can redistribute it and/or modify it under the terms of
821 the GNU Library General Public License as published by the Free
822 Software Foundation; either version 2 of the License, or (at your
823 option) any later version. This library is distributed in the hope
824 that it will be useful, but WITHOUT ANY WARRANTY; without even the
825 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
826 PURPOSE. See the GNU Library General Public License for more details.
827 You should have received a copy of the GNU Library General Public
828 License along with this library; if not, write to the Free Software
829 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
845 struct re_pattern_buffer; // defined elsewhere
852 Regex(const Regex&) {} // no X(X&)
853 void operator = (const Regex&) {} // no assignment
856 re_pattern_buffer* buf;
863 const char* transtable = 0);
867 int match(const char* s, int len, int pos = 0) const;
868 int search(const char* s, int len,
869 int& matchlen, int startpos = 0) const;
870 int match_info(int& start, int& length, int nth = 0) const;
872 int OK() const; // representation invariant
875 // some built in regular expressions
877 extern const Regex RXwhite; // = "[ \n\t\r\v\f]+"
878 extern const Regex RXint; // = "-?[0-9]+"
879 extern const Regex RXdouble; // = "-?\\(\\([0-9]+\\.[0-9]*\\)\\|
880 // \\([0-9]+\\)\\|\\(\\.[0-9]+\\)\\)
881 // \\([eE][---+]?[0-9]+\\)?"
882 extern const Regex RXalpha; // = "[A-Za-z]+"
883 extern const Regex RXlowercase; // = "[a-z]+"
884 extern const Regex RXuppercase; // = "[A-Z]+"
885 extern const Regex RXalphanum; // = "[0-9A-Za-z]+"
886 extern const Regex RXidentifier; // = "[A-Za-z_][A-Za-z0-9_]*"
890 //# 27 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 2
893 struct StrRep // internal String representations
895 unsigned short len; // string length
896 unsigned short sz; // allocated space
897 char s[1]; // the string starts here
898 // (at least 1 char for trailing null)
899 // allocated & expanded via non-public fcts
902 // primitive ops on StrReps -- nearly all String fns go through these.
904 StrRep* Salloc(StrRep*, const char*, int, int);
905 StrRep* Scopy(StrRep*, StrRep*);
906 StrRep* Sresize(StrRep*, int);
907 StrRep* Scat(StrRep*, const char*, int, const char*, int);
908 StrRep* Scat(StrRep*, const char*, int,const char*,int, const char*,int);
909 StrRep* Sprepend(StrRep*, const char*, int);
910 StrRep* Sreverse(StrRep*, StrRep*);
911 StrRep* Supcase(StrRep*, StrRep*);
912 StrRep* Sdowncase(StrRep*, StrRep*);
913 StrRep* Scapitalize(StrRep*, StrRep*);
915 // These classes need to be defined in the order given
925 String& S; // The String I'm a substring of
926 unsigned short pos; // starting position in S's rep
927 unsigned short len; // length of substring
929 void assign(StrRep*, const char*, int = -1);
930 SubString(String& x, int p, int l);
931 SubString(const SubString& x);
935 // Note there are no public constructors. SubStrings are always
936 // created via String operations
940 void operator = (const String& y);
941 void operator = (const SubString& y);
942 void operator = (const char* t);
943 void operator = (char c);
945 // return 1 if target appears anywhere in SubString; else 0
947 int contains(char c) const;
948 int contains(const String& y) const;
949 int contains(const SubString& y) const;
950 int contains(const char* t) const;
951 int contains(const Regex& r) const;
953 // return 1 if target matches entire SubString
955 int matches(const Regex& r) const;
959 friend ostream& operator<<(ostream& s, const SubString& x);
963 unsigned int length() const;
965 const char* chars() const;
974 friend class SubString;
977 StrRep* rep; // Strings are pointers to their representations
979 // some helper functions
981 int search(int, int, const char*, int = -1) const;
982 int search(int, int, char) const;
983 int match(int, int, int, const char*, int = -1) const;
984 int _gsub(const char*, int, const char* ,int);
985 int _gsub(const Regex&, const char*, int);
986 SubString _substr(int, int);
990 // constructors & assignment
993 String(const String& x);
994 String(const SubString& x);
995 String(const char* t);
996 String(const char* t, int len);
1001 void operator = (const String& y);
1002 void operator = (const char* y);
1003 void operator = (char c);
1004 void operator = (const SubString& y);
1008 void operator += (const String& y);
1009 void operator += (const SubString& y);
1010 void operator += (const char* t);
1011 void operator += (char c);
1013 void prepend(const String& y);
1014 void prepend(const SubString& y);
1015 void prepend(const char* t);
1016 void prepend(char c);
1019 // procedural versions:
1020 // concatenate first 2 args, store result in last arg
1022 friend void cat(const String&, const String&, String&);
1023 friend void cat(const String&, const SubString&, String&);
1024 friend void cat(const String&, const char*, String&);
1025 friend void cat(const String&, char, String&);
1027 friend void cat(const SubString&, const String&, String&);
1028 friend void cat(const SubString&, const SubString&, String&);
1029 friend void cat(const SubString&, const char*, String&);
1030 friend void cat(const SubString&, char, String&);
1032 friend void cat(const char*, const String&, String&);
1033 friend void cat(const char*, const SubString&, String&);
1034 friend void cat(const char*, const char*, String&);
1035 friend void cat(const char*, char, String&);
1037 // double concatenation, by request. (yes, there are too many versions,
1038 // but if one is supported, then the others should be too...)
1039 // Concatenate first 3 args, store in last arg
1041 friend void cat(const String&,const String&, const String&,String&);
1042 friend void cat(const String&,const String&,const SubString&,String&);
1043 friend void cat(const String&,const String&, const char*, String&);
1044 friend void cat(const String&,const String&, char, String&);
1045 friend void cat(const String&,const SubString&,const String&,String&);
1046 friend void cat(const String&,const SubString&,const SubString&,String&);
1047 friend void cat(const String&,const SubString&, const char*, String&);
1048 friend void cat(const String&,const SubString&, char, String&);
1049 friend void cat(const String&,const char*, const String&, String&);
1050 friend void cat(const String&,const char*, const SubString&, String&);
1051 friend void cat(const String&,const char*, const char*, String&);
1052 friend void cat(const String&,const char*, char, String&);
1054 friend void cat(const char*, const String&, const String&,String&);
1055 friend void cat(const char*,const String&,const SubString&,String&);
1056 friend void cat(const char*,const String&, const char*, String&);
1057 friend void cat(const char*,const String&, char, String&);
1058 friend void cat(const char*,const SubString&,const String&,String&);
1059 friend void cat(const char*,const SubString&,const SubString&,String&);
1060 friend void cat(const char*,const SubString&, const char*, String&);
1061 friend void cat(const char*,const SubString&, char, String&);
1062 friend void cat(const char*,const char*, const String&, String&);
1063 friend void cat(const char*,const char*, const SubString&, String&);
1064 friend void cat(const char*,const char*, const char*, String&);
1065 friend void cat(const char*,const char*, char, String&);
1068 // searching & matching
1070 // return position of target in string or -1 for failure
1072 int index(char c, int startpos = 0) const;
1073 int index(const String& y, int startpos = 0) const;
1074 int index(const SubString& y, int startpos = 0) const;
1075 int index(const char* t, int startpos = 0) const;
1076 int index(const Regex& r, int startpos = 0) const;
1078 // return 1 if target appears anyhere in String; else 0
1080 int contains(char c) const;
1081 int contains(const String& y) const;
1082 int contains(const SubString& y) const;
1083 int contains(const char* t) const;
1084 int contains(const Regex& r) const;
1086 // return 1 if target appears anywhere after position pos
1087 // (or before, if pos is negative) in String; else 0
1089 int contains(char c, int pos) const;
1090 int contains(const String& y, int pos) const;
1091 int contains(const SubString& y, int pos) const;
1092 int contains(const char* t, int pos) const;
1093 int contains(const Regex& r, int pos) const;
1095 // return 1 if target appears at position pos in String; else 0
1097 int matches(char c, int pos = 0) const;
1098 int matches(const String& y, int pos = 0) const;
1099 int matches(const SubString& y, int pos = 0) const;
1100 int matches(const char* t, int pos = 0) const;
1101 int matches(const Regex& r, int pos = 0) const;
1103 // return number of occurences of target in String
1105 int freq(char c) const;
1106 int freq(const String& y) const;
1107 int freq(const SubString& y) const;
1108 int freq(const char* t) const;
1110 // SubString extraction
1112 // Note that you can't take a substring of a const String, since
1113 // this leaves open the possiblility of indirectly modifying the
1114 // String through the SubString
1116 SubString at(int pos, int len);
1117 SubString operator () (int pos, int len); // synonym for at
1119 SubString at(const String& x, int startpos = 0);
1120 SubString at(const SubString& x, int startpos = 0);
1121 SubString at(const char* t, int startpos = 0);
1122 SubString at(char c, int startpos = 0);
1123 SubString at(const Regex& r, int startpos = 0);
1125 SubString before(int pos);
1126 SubString before(const String& x, int startpos = 0);
1127 SubString before(const SubString& x, int startpos = 0);
1128 SubString before(const char* t, int startpos = 0);
1129 SubString before(char c, int startpos = 0);
1130 SubString before(const Regex& r, int startpos = 0);
1132 SubString through(int pos);
1133 SubString through(const String& x, int startpos = 0);
1134 SubString through(const SubString& x, int startpos = 0);
1135 SubString through(const char* t, int startpos = 0);
1136 SubString through(char c, int startpos = 0);
1137 SubString through(const Regex& r, int startpos = 0);
1139 SubString from(int pos);
1140 SubString from(const String& x, int startpos = 0);
1141 SubString from(const SubString& x, int startpos = 0);
1142 SubString from(const char* t, int startpos = 0);
1143 SubString from(char c, int startpos = 0);
1144 SubString from(const Regex& r, int startpos = 0);
1146 SubString after(int pos);
1147 SubString after(const String& x, int startpos = 0);
1148 SubString after(const SubString& x, int startpos = 0);
1149 SubString after(const char* t, int startpos = 0);
1150 SubString after(char c, int startpos = 0);
1151 SubString after(const Regex& r, int startpos = 0);
1156 // delete len chars starting at pos
1157 void del(int pos, int len);
1159 // delete the first occurrence of target after startpos
1161 void del(const String& y, int startpos = 0);
1162 void del(const SubString& y, int startpos = 0);
1163 void del(const char* t, int startpos = 0);
1164 void del(char c, int startpos = 0);
1165 void del(const Regex& r, int startpos = 0);
1167 // global substitution: substitute all occurrences of pat with repl
1169 int gsub(const String& pat, const String& repl);
1170 int gsub(const SubString& pat, const String& repl);
1171 int gsub(const char* pat, const String& repl);
1172 int gsub(const char* pat, const char* repl);
1173 int gsub(const Regex& pat, const String& repl);
1175 // friends & utilities
1177 // split string into array res at separators; return number of elements
1179 friend int split(const String& x, String res[], int maxn,
1181 friend int split(const String& x, String res[], int maxn,
1184 friend String common_prefix(const String& x, const String& y,
1186 friend String common_suffix(const String& x, const String& y,
1188 friend String replicate(char c, int n);
1189 friend String replicate(const String& y, int n);
1190 friend String join(String src[], int n, const String& sep);
1192 // simple builtin transformations
1194 friend String reverse(const String& x);
1195 friend String upcase(const String& x);
1196 friend String downcase(const String& x);
1197 friend String capitalize(const String& x);
1199 // in-place versions of above
1206 // element extraction
1208 char& operator [] (int i);
1209 char elem(int i) const;
1210 char firstchar() const;
1211 char lastchar() const;
1215 operator const char*() const;
1216 const char* chars() const;
1221 friend ostream& operator<<(ostream& s, const String& x);
1222 friend ostream& operator<<(ostream& s, const SubString& x);
1223 friend istream& operator>>(istream& s, String& x);
1225 friend int readline(istream& s, String& x,
1226 char terminator = '\n',
1227 int discard_terminator = 1);
1231 unsigned int length() const;
1234 // preallocate some space for String
1235 void alloc(int newsize);
1237 // report current allocation (not length!)
1239 int allocation() const;
1242 volatile void error(const char* msg) const;
1247 typedef String StrTmp; // for backward compatibility
1251 int compare(const String& x, const String& y);
1252 int compare(const String& x, const SubString& y);
1253 int compare(const String& x, const char* y);
1254 int compare(const SubString& x, const String& y);
1255 int compare(const SubString& x, const SubString& y);
1256 int compare(const SubString& x, const char* y);
1257 int fcompare(const String& x, const String& y); // ignore case
1259 extern StrRep _nilStrRep;
1260 extern String _nilString;
1264 String operator + (const String& x, const String& y);
1265 String operator + (const String& x, const SubString& y);
1266 String operator + (const String& x, const char* y);
1267 String operator + (const String& x, char y);
1268 String operator + (const SubString& x, const String& y);
1269 String operator + (const SubString& x, const SubString& y);
1270 String operator + (const SubString& x, const char* y);
1271 String operator + (const SubString& x, char y);
1272 String operator + (const char* x, const String& y);
1273 String operator + (const char* x, const SubString& y);
1275 int operator==(const String& x, const String& y);
1276 int operator!=(const String& x, const String& y);
1277 int operator> (const String& x, const String& y);
1278 int operator>=(const String& x, const String& y);
1279 int operator< (const String& x, const String& y);
1280 int operator<=(const String& x, const String& y);
1281 int operator==(const String& x, const SubString& y);
1282 int operator!=(const String& x, const SubString& y);
1283 int operator> (const String& x, const SubString& y);
1284 int operator>=(const String& x, const SubString& y);
1285 int operator< (const String& x, const SubString& y);
1286 int operator<=(const String& x, const SubString& y);
1287 int operator==(const String& x, const char* t);
1288 int operator!=(const String& x, const char* t);
1289 int operator> (const String& x, const char* t);
1290 int operator>=(const String& x, const char* t);
1291 int operator< (const String& x, const char* t);
1292 int operator<=(const String& x, const char* t);
1293 int operator==(const SubString& x, const String& y);
1294 int operator!=(const SubString& x, const String& y);
1295 int operator> (const SubString& x, const String& y);
1296 int operator>=(const SubString& x, const String& y);
1297 int operator< (const SubString& x, const String& y);
1298 int operator<=(const SubString& x, const String& y);
1299 int operator==(const SubString& x, const SubString& y);
1300 int operator!=(const SubString& x, const SubString& y);
1301 int operator> (const SubString& x, const SubString& y);
1302 int operator>=(const SubString& x, const SubString& y);
1303 int operator< (const SubString& x, const SubString& y);
1304 int operator<=(const SubString& x, const SubString& y);
1305 int operator==(const SubString& x, const char* t);
1306 int operator!=(const SubString& x, const char* t);
1307 int operator> (const SubString& x, const char* t);
1308 int operator>=(const SubString& x, const char* t);
1309 int operator< (const SubString& x, const char* t);
1310 int operator<=(const SubString& x, const char* t);
1315 // status reports, needed before defining other things
1317 inline unsigned int String::length() const { return rep->len; }
1318 inline int String::empty() const { return rep->len == 0; }
1319 inline const char* String::chars() const { return &(rep->s[0]); }
1320 inline int String::allocation() const { return rep->sz; }
1321 inline void String::alloc(int newsize) { rep = Sresize(rep, newsize); }
1323 inline unsigned int SubString::length() const { return len; }
1324 inline int SubString::empty() const { return len == 0; }
1325 inline const char* SubString::chars() const { return &(S.rep->s[pos]); }
1330 inline String::String()
1331 : rep(&_nilStrRep) {}
1332 inline String::String(const String& x)
1333 : rep(Scopy(0, x.rep)) {}
1334 inline String::String(const char* t)
1335 : rep(Salloc(0, t, -1, -1)) {}
1336 inline String::String(const char* t, int tlen)
1337 : rep(Salloc(0, t, tlen, tlen)) {}
1338 inline String::String(const SubString& y)
1339 : rep(Salloc(0, y.chars(), y.length(), y.length())) {}
1340 inline String::String(char c)
1341 : rep(Salloc(0, &c, 1, 1)) {}
1343 inline String::~String() { if (rep != &_nilStrRep) delete rep; }
1345 inline SubString::SubString(const SubString& x)
1346 :S(x.S), pos(x.pos), len(x.len) {}
1347 inline SubString::SubString(String& x, int first, int l)
1348 :S(x), pos(first), len(l) {}
1350 inline SubString::~SubString() {}
1354 inline void String::operator = (const String& y)
1356 rep = Scopy(rep, y.rep);
1359 inline void String::operator=(const char* t)
1361 rep = Salloc(rep, t, -1, -1);
1364 inline void String::operator=(const SubString& y)
1366 rep = Salloc(rep, y.chars(), y.length(), y.length());
1369 inline void String::operator=(char c)
1371 rep = Salloc(rep, &c, 1, 1);
1375 inline void SubString::operator = (const char* ys)
1380 inline void SubString::operator = (char ch)
1385 inline void SubString::operator = (const String& y)
1387 assign(y.rep, y.chars(), y.length());
1390 inline void SubString::operator = (const SubString& y)
1392 assign(y.S.rep, y.chars(), y.length());
1395 // Zillions of cats...
1397 inline void cat(const String& x, const String& y, String& r)
1399 r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
1402 inline void cat(const String& x, const SubString& 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 char* y, String& r)
1409 r.rep = Scat(r.rep, x.chars(), x.length(), y, -1);
1412 inline void cat(const String& x, char y, String& r)
1414 r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1);
1417 inline void cat(const SubString& x, const String& y, String& r)
1419 r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
1422 inline void cat(const SubString& x, const SubString& 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 char* y, String& r)
1429 r.rep = Scat(r.rep, x.chars(), x.length(), y, -1);
1432 inline void cat(const SubString& x, char y, String& r)
1434 r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1);
1437 inline void cat(const char* x, const String& y, String& r)
1439 r.rep = Scat(r.rep, x, -1, y.chars(), y.length());
1442 inline void cat(const char* x, const SubString& y, String& r)
1444 r.rep = Scat(r.rep, x, -1, y.chars(), y.length());
1447 inline void cat(const char* x, const char* y, String& r)
1449 r.rep = Scat(r.rep, x, -1, y, -1);
1452 inline void cat(const char* x, char y, String& r)
1454 r.rep = Scat(r.rep, x, -1, &y, 1);
1457 inline void cat(const String& a, const String& x, const String& y, String& r)
1459 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
1462 inline void cat(const String& a, const String& x, const SubString& 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 char* y, String& r)
1469 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1);
1472 inline void cat(const String& a, const String& x, 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 SubString& x, const String& y, String& r)
1479 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
1482 inline void cat(const String& a, const SubString& x, const SubString& 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 char* y, String& r)
1489 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1);
1492 inline void cat(const String& a, const SubString& x, 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 char* x, const String& y, String& r)
1499 r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y.chars(), y.length());
1502 inline void cat(const String& a, const char* x, const SubString& 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 char* y, String& r)
1509 r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y, -1);
1512 inline void cat(const String& a, const char* x, char y, String& r)
1514 r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, &y, 1);
1518 inline void cat(const char* a, const String& x, const String& y, String& r)
1520 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
1523 inline void cat(const char* a, const String& x, const SubString& 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 char* y, String& r)
1530 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1);
1533 inline void cat(const char* a, const String& x, 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 SubString& x, const String& y, String& r)
1540 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
1543 inline void cat(const char* a, const SubString& x, const SubString& 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 char* y, String& r)
1550 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1);
1553 inline void cat(const char* a, const SubString& x, 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 char* x, const String& y, String& r)
1560 r.rep = Scat(r.rep, a, -1, x, -1, y.chars(), y.length());
1563 inline void cat(const char* a, const char* x, const SubString& 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 char* y, String& r)
1570 r.rep = Scat(r.rep, a, -1, x, -1, y, -1);
1573 inline void cat(const char* a, const char* x, char y, String& r)
1575 r.rep = Scat(r.rep, a, -1, x, -1, &y, 1);
1579 // operator versions
1581 inline void String::operator +=(const String& y)
1583 cat(*this, y, *this);
1586 inline void String::operator +=(const SubString& y)
1588 cat(*this, y, *this);
1591 inline void String::operator += (const char* y)
1593 cat(*this, y, *this);
1596 inline void String:: operator +=(char y)
1598 cat(*this, y, *this);
1601 // constructive concatenation
1605 inline String operator + (const String& x, const String& y) return r; // { dg-error "" }
1607 cat(x, y, r); // { dg-error "" }
1610 inline String operator + (const String& x, const SubString& y) return r; // { dg-error "" }
1612 cat(x, y, r); // { dg-error "" }
1615 inline String operator + (const String& x, const char* y) return r; // { dg-error "" }
1617 cat(x, y, r); // { dg-error "" }
1620 inline String operator + (const String& x, char y) return r; // { dg-error "" }
1622 cat(x, y, r); // { dg-error "" }
1625 inline String operator + (const SubString& x, const String& y) return r; // { dg-error "" }
1627 cat(x, y, r); // { dg-error "" }
1630 inline String operator + (const SubString& x, const SubString& y) return r; // { dg-error "" }
1632 cat(x, y, r); // { dg-error "" }
1635 inline String operator + (const SubString& x, const char* y) return r; // { dg-error "" }
1637 cat(x, y, r); // { dg-error "" }
1640 inline String operator + (const SubString& x, char y) return r; // { dg-error "" }
1642 cat(x, y, r); // { dg-error "" }
1645 inline String operator + (const char* x, const String& y) return r; // { dg-error "" }
1647 cat(x, y, r); // { dg-error "" }
1650 inline String operator + (const char* x, const SubString& y) return r; // { dg-error "" }
1652 cat(x, y, r); // { dg-error "" }
1655 inline String reverse(const String& x) return r; // { dg-error "" }
1657 r.rep = Sreverse(x.rep, r.rep); // { dg-error "" }
1660 inline String upcase(const String& x) return r; // { dg-error "" }
1662 r.rep = Supcase(x.rep, r.rep); // { dg-error "" }
1665 inline String downcase(const String& x) return r; // { dg-error "" }
1667 r.rep = Sdowncase(x.rep, r.rep); // { dg-error "" }
1670 inline String capitalize(const String& x) return r; // { dg-error "" }
1672 r.rep = Scapitalize(x.rep, r.rep); // { dg-error "" }
1675 //# 883 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h"
1680 inline void String::prepend(const String& y)
1682 rep = Sprepend(rep, y.chars(), y.length());
1685 inline void String::prepend(const char* y)
1687 rep = Sprepend(rep, y, -1);
1690 inline void String::prepend(char y)
1692 rep = Sprepend(rep, &y, 1);
1695 inline void String::prepend(const SubString& y)
1697 rep = Sprepend(rep, y.chars(), y.length());
1700 // misc transformations
1703 inline void String::reverse()
1705 rep = Sreverse(rep, rep);
1709 inline void String::upcase()
1711 rep = Supcase(rep, rep);
1715 inline void String::downcase()
1717 rep = Sdowncase(rep, rep);
1721 inline void String::capitalize()
1723 rep = Scapitalize(rep, rep);
1726 // element extraction
1728 inline char& String::operator [] (int i)
1730 if (((unsigned)i) >= length()) error("invalid index");
1734 inline char String::elem (int i) const
1736 if (((unsigned)i) >= length()) error("invalid index");
1740 inline char String::firstchar() const
1745 inline char String::lastchar() const
1747 return elem(length() - 1);
1752 inline int String::index(char c, int startpos) const
1754 return search(startpos, length(), c);
1757 inline int String::index(const char* t, int startpos) const
1759 return search(startpos, length(), t);
1762 inline int String::index(const String& y, int startpos) const
1764 return search(startpos, length(), y.chars(), y.length());
1767 inline int String::index(const SubString& y, int startpos) const
1769 return search(startpos, length(), y.chars(), y.length());
1772 inline int String::index(const Regex& r, int startpos) const
1774 int unused; return r.search(chars(), length(), unused, startpos);
1777 inline int String::contains(char c) const
1779 return search(0, length(), c) >= 0;
1782 inline int String::contains(const char* t) const
1784 return search(0, length(), t) >= 0;
1787 inline int String::contains(const String& y) const
1789 return search(0, length(), y.chars(), y.length()) >= 0;
1792 inline int String::contains(const SubString& y) const
1794 return search(0, length(), y.chars(), y.length()) >= 0;
1797 inline int String::contains(char c, int p) const
1799 return match(p, length(), 0, &c, 1) >= 0;
1802 inline int String::contains(const char* t, int p) const
1804 return match(p, length(), 0, t) >= 0;
1807 inline int String::contains(const String& y, int p) const
1809 return match(p, length(), 0, y.chars(), y.length()) >= 0;
1812 inline int String::contains(const SubString& y, int p) const
1814 return match(p, length(), 0, y.chars(), y.length()) >= 0;
1817 inline int String::contains(const Regex& r) const
1819 int unused; return r.search(chars(), length(), unused, 0) >= 0;
1822 inline int String::contains(const Regex& r, int p) const
1824 return r.match(chars(), length(), p) >= 0;
1828 inline int String::matches(const SubString& y, int p) const
1830 return match(p, length(), 1, y.chars(), y.length()) >= 0;
1833 inline int String::matches(const String& y, int p) const
1835 return match(p, length(), 1, y.chars(), y.length()) >= 0;
1838 inline int String::matches(const char* t, int p) const
1840 return match(p, length(), 1, t) >= 0;
1843 inline int String::matches(char c, int p) const
1845 return match(p, length(), 1, &c, 1) >= 0;
1848 inline int String::matches(const Regex& r, int p) const
1850 int l = (p < 0)? -p : length() - p;
1851 return r.match(chars(), length(), p) == l;
1855 inline int SubString::contains(const char* t) const
1857 return S.search(pos, pos+len, t) >= 0;
1860 inline int SubString::contains(const String& y) const
1862 return S.search(pos, pos+len, y.chars(), y.length()) >= 0;
1865 inline int SubString::contains(const SubString& y) const
1867 return S.search(pos, pos+len, y.chars(), y.length()) >= 0;
1870 inline int SubString::contains(char c) const
1872 return S.search(pos, pos+len, 0, c) >= 0;
1875 inline int SubString::contains(const Regex& r) const
1877 int unused; return r.search(chars(), len, unused, 0) >= 0;
1880 inline int SubString::matches(const Regex& r) const
1882 return r.match(chars(), len, 0) == len;
1886 inline int String::gsub(const String& pat, const String& r)
1888 return _gsub(pat.chars(), pat.length(), r.chars(), r.length());
1891 inline int String::gsub(const SubString& pat, const String& r)
1893 return _gsub(pat.chars(), pat.length(), r.chars(), r.length());
1896 inline int String::gsub(const Regex& pat, const String& r)
1898 return _gsub(pat, r.chars(), r.length());
1901 inline int String::gsub(const char* pat, const String& r)
1903 return _gsub(pat, -1, r.chars(), r.length());
1906 inline int String::gsub(const char* pat, const char* r)
1908 return _gsub(pat, -1, r, -1);
1913 inline ostream& operator<<(ostream& s, const String& x)
1915 s << x.chars(); return s;
1918 // a zillion comparison operators
1920 inline int operator==(const String& x, const String& y)
1922 return compare(x, y) == 0;
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 SubString& 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 char* t)
1982 return compare(x, t) == 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 SubString& x, const String& y)
2012 return compare(y, x) == 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 SubString& y)
2042 return compare(x, y) == 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 char* t)
2072 return compare(x, t) == 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;
2101 // a helper needed by at, before, etc.
2103 inline SubString String::_substr(int first, int l)
2105 if (first >= length() ) // ??? THIS LINE IS QUESTIONABLE
2106 return SubString(_nilString, 0, 0) ;
2108 return SubString(*this, first, l);
2115 //# 26 "../../GctSymbol.h" 2
2118 //# 1 "../../../../../../mips/include/Gct/Object/GctHashObject.h" 1
2124 // GctHashObject class (is abstract)
2126 // Expects to be included by Object.h or where needed explicitly.
2128 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2139 //# 1 "../../../../../../mips/include/Gct/Object/GctObject.h" 1
2145 // GctObject class (is abstract)
2147 // Expects to be included by Object.h or where needed explicitly.
2149 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2160 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
2166 // tostrstream class
2168 // A terminated oststream - an ostsrstream that auto-terminates on str()
2170 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2181 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/strstream.h" 1
2182 // This is part of the iostream library, providing input/output for C++.
2183 // Copyright (C) 1991 Per Bothner.
2185 // This library is free software; you can redistribute it and/or
2186 // modify it under the terms of the GNU Library General Public
2187 // License as published by the Free Software Foundation; either
2188 // version 2 of the License, or (at your option) any later version.
2190 // This library is distributed in the hope that it will be useful,
2191 // but WITHOUT ANY WARRANTY; without even the implied warranty of
2192 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2193 // Library General Public License for more details.
2195 // You should have received a copy of the GNU Library General Public
2196 // License along with this library; if not, write to the Free
2197 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2204 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
2205 // This is part of the iostream library, providing -*- C++ -*- input/output.
2206 // Copyright (C) 1991 Per Bothner.
2208 // This library is free software; you can redistribute it and/or
2209 // modify it under the terms of the GNU Library General Public
2210 // License as published by the Free Software Foundation; either
2211 // version 2 of the License, or (at your option) any later version.
2213 // This library is distributed in the hope that it will be useful,
2214 // but WITHOUT ANY WARRANTY; without even the implied warranty of
2215 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2216 // Library General Public License for more details.
2218 // You should have received a copy of the GNU Library General Public
2219 // License along with this library; if not, write to the Free
2220 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2222 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2224 //# 23 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/strstream.h" 2
2227 class strstreambuf : public streambuf {
2228 size_t *lenp; /* current (logical) length (i.e. valid data bytes) */
2229 size_t *sizep; /* allocated (physical) buffer size */
2236 virtual int overflow(int = (-1) );
2239 strstreambuf(int initial);
2240 strstreambuf(char *ptr, int size, char *pstart = (__null) );
2242 int frozen() { return _frozen; }
2243 void freeze(int n=1) { _frozen = n != 0; }
2248 class istrstream : public istream {
2251 istrstream(char*, int);
2252 strstreambuf* rdbuf() { return (strstreambuf*)_strbuf; }
2255 class ostrstream : public ostream {
2258 ostrstream(char *cp, int n, int mode=ios::out);
2259 size_t pcount() { return ((strstreambuf*)_strbuf)->pcount(); }
2260 char *str() { return ((strstreambuf*)_strbuf)->str(); }
2261 void freeze(int n = 1) { ((strstreambuf*)_strbuf)->freeze(n); }
2262 int frozen() { return ((strstreambuf*)_strbuf)->frozen(); }
2263 strstreambuf* rdbuf() { return (strstreambuf*)_strbuf; }
2267 //# 25 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 2
2271 // tostrstream class
2273 // An isteam class that doesn't have that nasty skipws parameter that
2274 // you have to remember to set. This class simply provides the istream
2275 // functionality with a set of constructors which defaults skipws to
2276 // FALSE (instead of defaulting to TRUE as is the case with plain istream).
2278 class tostrstream: public ostrstream {
2280 tostrstream(): ostrstream()
2282 // This constructor defines cp as the buffer to use for the
2283 // stream (instead of one of its own devising); it does NOT
2284 // initialize the ostrstream to contain cp (of length n).
2285 tostrstream(char *cp, int n, int mode=ios::out): ostrtream(cp, n, mode) // { dg-error "" }
2289 char *s = ostrstream::str();
2290 s[ostrstream::pcount()] = '\0';
2296 //# 25 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
2299 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 1
2305 // GttObject class (is abstract)
2307 // Expects to be included where needed explicitly.
2309 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2320 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
2322 //# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
2324 //# 25 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
2327 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 1
2333 // GttErrorHandler class
2335 // Expects to be included by Gtt.h
2337 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2348 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
2356 //# 25 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
2359 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 1
2365 // Fake up a libstuff++
2367 // This is done as a complete and utter hack; this library has no function
2368 // at all being in the boot area; it is here solely in order to provide a
2369 // libstuff++ against which the Makefiles can resolve link lines.
2371 // The only reason that this is done is to allow the STANDARD_C++_LIBRARIES
2372 // as provided by the Makefile templates in the boot area to be the same
2373 // ones that are used by the tools outside this hierarchy.
2375 // The tools outside this hierarchy use a different libstuff++; one that is
2376 // written in C++. This one is not written in C++ in order to be simpler.
2388 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 1
2399 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/ansi.h" 1
2405 * ANSI Compiler Support
2408 * University of California, Berkeley
2411 * ANSI compatible compilers are supposed to define the preprocessor
2412 * directive __STDC__. Based on this directive, this file defines
2413 * certain ANSI specific macros.
2416 * Used in function prototypes. Example:
2418 * ARGS((char *blah, double threshold));
2425 * University of California, Berkeley
2428 /* Function prototypes */
2456 //# 15 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 2
2461 * If g++, then we stub out part of this thing and let the C++ types take
2462 * over and do the same job; some compatibility must be given however
2466 * Use the GNU libg++ definition
2468 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
2476 //# 26 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 2
2478 //# 35 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h"
2482 * Make various pieces of C code that use the old ``Boolean''
2483 * be compatible by faking up the definition of Boolean using
2484 * the new bool type.
2488 //# 58 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h"
2491 typedef long FitAny; /* can fit any integral type */
2494 * typedef char *String; - DO NOT USE THIS - it conflicts with C++
2495 * typedef char **Stringv; - just use char* and char** instead.
2496 * - void* can be used for arbitrary pointers
2502 extern int nocase_strcmp (char *, char *) ;
2503 extern int nocase_strncmp (char *, char *, int) ;
2505 extern bool nocase_strequal (char *, char *) ;
2506 extern bool nocase_strnequal (char *, char *, int) ;
2508 extern bool lead_strequal (char *, char *) ;
2509 extern bool nocase_lead_strequal (char *, char *) ;
2511 extern int strhash (char *, int) ;
2512 extern int nocase_strhash (char *, int) ;
2514 extern int sign (int) ;
2517 * Some useful macros.
2548 //# 33 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
2553 // This is here because we wish to provide externs for the two
2554 // functions btoa(bool, unsigned = 0) and operator<<(ostream&, bool)
2555 // because they are not provided in bool.h.
2557 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
2565 //# 41 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
2567 extern const char *stringify(bool b);
2568 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
2569 // This is part of the iostream library, providing -*- C++ -*- input/output.
2570 // Copyright (C) 1991 Per Bothner.
2572 // This library is free software; you can redistribute it and/or
2573 // modify it under the terms of the GNU Library General Public
2574 // License as published by the Free Software Foundation; either
2575 // version 2 of the License, or (at your option) any later version.
2577 // This library is distributed in the hope that it will be useful,
2578 // but WITHOUT ANY WARRANTY; without even the implied warranty of
2579 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2580 // Library General Public License for more details.
2582 // You should have received a copy of the GNU Library General Public
2583 // License along with this library; if not, write to the Free
2584 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2586 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2588 //# 43 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
2590 extern ostream& operator<<(ostream&, bool);
2592 // Should this be kept separate? bool isn't, but then is
2593 // included here only to define ostream& operator<<(ostream&, bool)
2594 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/unit.h" 1
2602 // Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU)
2609 // This _looks_ silly, but it has an important theoretical basis in category
2610 // theory. For the pragmatic reason for its existence, see the example below.
2616 extern const char *stringify(unit u);
2618 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
2619 // This is part of the iostream library, providing -*- C++ -*- input/output.
2620 // Copyright (C) 1991 Per Bothner.
2622 // This library is free software; you can redistribute it and/or
2623 // modify it under the terms of the GNU Library General Public
2624 // License as published by the Free Software Foundation; either
2625 // version 2 of the License, or (at your option) any later version.
2627 // This library is distributed in the hope that it will be useful,
2628 // but WITHOUT ANY WARRANTY; without even the implied warranty of
2629 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2630 // Library General Public License for more details.
2632 // You should have received a copy of the GNU Library General Public
2633 // License along with this library; if not, write to the Free
2634 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2636 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2638 //# 28 "/sandbox/wbaker/wbaker0/source/mips/include/unit.h" 2
2640 extern ostream& operator<<(ostream&, unit);
2643 // A unit is used in cases where the type signature of an overloaded
2644 // function must be differentiated in some stronger way than can be
2645 // denoted unambiguously in the C++ syntax. This enum is used to give
2646 // one of the functions a different type signature, thereby allowing
2649 // The use of ``unit'' instead of int or bool is important because a unit
2650 // has only one possible value; therefore it adds no more information to
2651 // the code. For example, say a bool was used instead, then in the testing
2652 // phase, would have to ask: what if TRUE was given, what if FALSE was given.
2653 // The problem is compounded if char or int is used.
2659 // ID(); // construct a null ID
2660 // ID(unit); // alloc a ID with a new id
2662 // static unsigned high_water;
2666 // Try working this example save that ID implements all of the generic
2667 // features of the identifier object, but the high_water is stored
2668 // in the heir. That is what originally motivated the creation of unit.
2672 //# 48 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
2676 // In the spirit of the standard GNU error handler functions
2678 // typedef void (*one_arg_error_handler_t)(const char*);
2679 // a one argument error handler function pointer
2680 // typedef void (*two_arg_error_handler_t)(const char*, const char*);
2681 // a two argument error handler function pointer
2685 // typedef void (*zero_arg_error_handler_t)();
2686 // a zero argument error handler function pointer
2688 typedef void (*zero_arg_error_handler_t)();
2691 // In the spirit of the default GNU error handler functions
2693 // extern void default_one_arg_error_handler(const char *message);
2694 // print out message on stderr, and do the default thing (abort)
2695 // extern void default_two_arg_error_handler(const char *kind, const char *message);
2696 // print out kind and message on stderr, and do the default thing (abort)
2700 // extern void default_zero_arg_error_handler(const char *message);
2701 // do the default thing (abort)
2703 extern void default_zero_arg_error_handler();
2705 // Guaranteed to exit (1)
2706 extern void exit_zero_arg_error_handler();
2707 extern void exit_one_arg_error_handler(const char *message);
2708 extern void exit_two_arg_error_handler(const char *kind, const char *message);
2710 // Guaranteed to abort()
2711 extern void abort_zero_arg_error_handler();
2712 extern void abort_one_arg_error_handler(const char *message);
2713 extern void abort_two_arg_error_handler(const char *kind, const char *message);
2716 // In the spirit of the standard GNU error handlers
2718 // extern void verbose_File_error_handler(const char*);
2719 // perror and set errno = 0
2720 // extern void quiet_File_error_handler(const char*);
2722 // extern void fatal_File_error_handler(const char*);
2723 // perror and exit 1
2727 // extern void preserve_File_error_handler(const char *message);
2728 // no perror, no assignment to errno.
2730 extern void preserve_File_error_handler(const char *message);
2733 //# 27 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
2735 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
2737 //# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
2739 //# 28 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
2743 // It is expected that this will be virtually multiply inherited
2744 // into all of the classes that need error reporting services.
2746 // The typical way to have that done is by inheriting the GttObject
2747 // as a virtual base class.
2751 // GttErrorHandler class
2753 class GttErrorHandler {
2756 GttErrorHandler(const char *program);
2757 virtual ~GttErrorHandler();
2761 // - an unacceptable, but expected and recoverable condition
2762 // was detected (but the test fails)
2763 // - errors are for ``the expected environment was not found''
2764 // rather than for ``file couldn't be opened''
2765 // - these messages cannot be shut off
2766 // - the error handler determines the recovery action
2767 // TODO - one day exceptions will be used here
2769 static void error(const char *message);
2770 static void error(tostrstream& message);
2772 static void error(const char *function, const char *message);
2773 static void error(const char *function, tostrstream& message);
2775 static void error(const char *class_name, const char *method, const char *message);
2776 static void error(const char *class_name, const char *method, tostrstream& message);
2780 // - an unacceptable and unexpected error was detected
2781 // the data invariants were violated, there is no recovery
2782 // - these messages cannot be shut off
2783 // - the error handler determines the recovery action
2784 // TODO - one day exceptions will be used here
2786 static void fatal(const char *message);
2787 static void fatal(tostrstream& message);
2789 static void fatal(const char *function, const char *message);
2790 static void fatal(const char *function, tostrstream& message);
2792 static void fatal(const char *class_name, const char *method, const char *message);
2793 static void fatal(const char *class_name, const char *method, tostrstream& message);
2796 // Two underscores are used here in order to prevent confusion of these
2797 // private variables with any of the heir's private variables. Note that
2798 // access control is different than visibility in C++, so all the variable
2799 // names in a class hierarchy must be unique.
2802 static bool __partial_init;
2803 static void __partial_initialize();
2804 static bool __full_init;
2805 static void __full_initialize(const char *program);
2806 static char *__program;
2808 static void __handle_error();
2809 static void __handle_fatal();
2810 static void __add_newline(const char *message);
2812 static bool __output_valid();
2813 static ostream *__output;
2817 //# 27 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
2821 // GttObject class (is abstract)
2823 class GttObject: virtual public GttErrorHandler {
2826 GttObject(const GttObject&);
2827 virtual ~GttObject(); // ensure descendants have virtual destructors
2833 // The value typically persists only long enough for an i/o operation
2834 // to be performed (see the defintion of output via operator<<(... ) below)
2835 virtual const char *stringify();
2837 // This is the buffer into which the printed representation of this
2838 // object will be put when the time comes. It is associated with the
2839 // object so it will never go away (so long as the object exists).
2840 // Use a pointer so that you only pay for the space when I/O is used
2841 tostrstream *stringbuf;
2842 void clear_stringbuf();
2848 // The global data invariant for the whole object (heirs included).
2849 // This OK function will call the local invariant function ok() if
2850 // necessary and in addition the OK functions of the heirs
2851 // This is expected to compute the data invariant of the object.
2852 // It will execute GctErrorHandler::fatal if there is wrong.
2853 virtual void OK() const;
2859 // This function computes the invariant which is local to this object.
2860 // It does not call any of the ancestor's OK() or ok() functions.
2861 // It is not a virtual function so that it can be called from within a
2862 // constructor with impunity. Thus this function MUST NOT call any
2863 // virtual functions either; it should call them by their full name if
2864 // that is necessary. The global OK() function will call this function
2867 // This function must NOT NEVER EVER be made virtual.
2874 // This must return a static (constant) string which is the name
2875 // of the class being declared. By convention, not all classes
2876 // must have one of these, but the major root abstract class must
2877 // have one in order to allow the stringify() to work approximately
2879 virtual const char *class_name() const = 0;
2882 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
2883 // This is part of the iostream library, providing -*- C++ -*- input/output.
2884 // Copyright (C) 1991 Per Bothner.
2886 // This library is free software; you can redistribute it and/or
2887 // modify it under the terms of the GNU Library General Public
2888 // License as published by the Free Software Foundation; either
2889 // version 2 of the License, or (at your option) any later version.
2891 // This library is distributed in the hope that it will be useful,
2892 // but WITHOUT ANY WARRANTY; without even the implied warranty of
2893 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2894 // Library General Public License for more details.
2896 // You should have received a copy of the GNU Library General Public
2897 // License along with this library; if not, write to the Free
2898 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2900 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2902 //# 91 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
2904 extern ostream& operator<<(ostream&, GttObject&);
2906 // There may be other X& operator<<(X&, GttObject&) defined in the
2907 // packages defining class X. For example see the definition of
2908 // GttUnitObject& operator<<(GttUnitObject&, GttObject&) in Unit.
2911 //# 27 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
2914 //# 1 "../../../../../../mips/include/Gct/GctErrorHandler.h" 1
2920 // GctErrorHandler class
2922 // Expects to be included by Gct.h
2924 // Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU)
2935 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
2943 //# 25 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
2945 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 1
2946 // This may look like C code, but it is really -*- C++ -*-
2948 Copyright (C) 1988 Free Software Foundation
2949 written by Doug Lea (dl@rocky.oswego.edu)
2951 This file is part of the GNU C++ Library. This library is free
2952 software; you can redistribute it and/or modify it under the terms of
2953 the GNU Library General Public License as published by the Free
2954 Software Foundation; either version 2 of the License, or (at your
2955 option) any later version. This library is distributed in the hope
2956 that it will be useful, but WITHOUT ANY WARRANTY; without even the
2957 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
2958 PURPOSE. See the GNU Library General Public License for more details.
2959 You should have received a copy of the GNU Library General Public
2960 License along with this library; if not, write to the Free Software
2961 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2965 //# 1321 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h"
2967 //# 26 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
2969 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
2970 // This is part of the iostream library, providing -*- C++ -*- input/output.
2971 // Copyright (C) 1991 Per Bothner.
2973 // This library is free software; you can redistribute it and/or
2974 // modify it under the terms of the GNU Library General Public
2975 // License as published by the Free Software Foundation; either
2976 // version 2 of the License, or (at your option) any later version.
2978 // This library is distributed in the hope that it will be useful,
2979 // but WITHOUT ANY WARRANTY; without even the implied warranty of
2980 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2981 // Library General Public License for more details.
2983 // You should have received a copy of the GNU Library General Public
2984 // License along with this library; if not, write to the Free
2985 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2987 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2989 //# 27 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
2992 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 1
2994 //# 107 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h"
2996 //# 29 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
2998 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
3000 //# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
3002 //# 30 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
3005 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 1
3007 //# 98 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h"
3009 //# 32 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
3013 // It is expected that this will be virtually multiply inherited
3014 // into all of the classes that need error reporting services.
3016 // The typical way to have that done is by inheriting the GctObject
3017 // as a virtual base class.
3021 // GctErrorHandler class
3024 // NOTE - virtual public GttObject should be MI into GctObject - but that
3025 // causes g++ 1.96 to segfault; so we must inherit GttObject here and use SI
3027 class GctErrorHandler: virtual public GttObject {
3030 GctErrorHandler(const String& program);
3031 virtual ~GctErrorHandler();
3034 // Debugging messages
3035 // - these are turned off for production code.
3036 // - these messages can be shut off
3038 static void debug(const char *message);
3039 static void debug(tostrstream& message);
3041 static void debug(const char *function, const char *message);
3042 static void debug(const char *function, tostrstream& message);
3044 static void debug(const char *class_name, const char *method, const char *message);
3045 static void debug(const char *class_name, const char *method, tostrstream& message);
3047 static bool debug(); // current debug switch
3048 static void debug(bool value); // change the debug switch
3051 // Informational messages
3052 // - these correspond to a ``verbose'' mode
3053 // - these are not errors, just chatty progress reports
3054 // - these messages can be shut off
3056 static void note(const char *message);
3057 static void note(tostrstream& message);
3059 static void note(const char *function, const char *message);
3060 static void note(const char *function, tostrstream& message);
3062 static void note(const char *class_name, const char *method, const char *message);
3063 static void note(const char *class_name, const char *method, tostrstream& message);
3065 static bool note(); // current note switch
3066 static void note(bool value); // change the note switch
3070 // - warnings are system-recoverable errors
3071 // - the system has noticed something and taken some
3072 // corrective action
3073 // - these messages can be shut off
3075 static void warning(const char *message);
3076 static void warning(tostrstream& message);
3078 static void warning(const char *function, const char *message);
3079 static void warning(const char *function, tostrstream& message);
3081 static void warning(const char *class_name, const char *method, const char *message);
3082 static void warning(const char *class_name, const char *method, tostrstream& message);
3084 static bool warning(); // current warning switch
3085 static void warning(bool value); // change the warning switch
3089 // - an unacceptable, but expected and recoverable
3090 // condition was detected
3091 // - errors are for ``the expected environment was not found''
3092 // rather than for ``file couldn't be opened''
3093 // - these messages cannot be shut off
3094 // - the error handler determines the recovery action
3095 // TODO - one day exceptions will be used here
3097 static void error(const char *message);
3098 static void error(tostrstream& message);
3100 static void error(const char *function, const char *message);
3101 static void error(const char *function, tostrstream& message);
3103 static void error(const char *class_name, const char *method, const char *message);
3104 static void error(const char *class_name, const char *method, tostrstream& message);
3106 // can't turn off errors - no ``static void error(bool value);''
3107 static zero_arg_error_handler_t error(); // current error handler
3108 static void error(zero_arg_error_handler_t handler);// change the error handler
3110 static void error_is_lib_error_handler(); // change the error handler
3111 static void error_is_exit(); // change the error handler
3113 // Describes the fatal handler - WATCHOUT - implicitly uses AllocRing
3114 static const char *error_handler_description();
3118 // - an unacceptable and unexpected error was detected
3119 // the data invariants were violated, there is no recovery
3120 // - these messages cannot be shut off
3121 // - the error handler determines the recovery action
3122 // TODO - one day exceptions will be used here
3124 static void fatal(const char *message);
3125 static void fatal(tostrstream& message);
3127 static void fatal(const char *function, const char *message);
3128 static void fatal(const char *function, tostrstream& message);
3130 static void fatal(const char *class_name, const char *method, const char *message);
3131 static void fatal(const char *class_name, const char *method, tostrstream& message);
3133 // can't turn off fatals - no ``static void fatal(bool value);''
3134 static zero_arg_error_handler_t fatal(); // return the fatal handler
3135 static void fatal(zero_arg_error_handler_t handler); // change the fatal handler
3137 static void fatal_is_exit(); // change the fatal handler
3138 static void fatal_is_abort(); // change the fatal handler
3140 // Describes the fatal handler - WATCHOUT - implicitly uses AllocRing
3141 static const char *fatal_handler_description();
3144 // Two underscores are used here in order to prevent confusion of these
3145 // private variables with any of the heir's private variables. Note that
3146 // access control is different than visibility in C++, so all the variable
3147 // names in a class hierarchy must be unique.
3149 static bool __debug;
3151 static bool __warning;
3152 static void (*__error_handler)(); // can't turn off errors
3153 static void (*__fatal_handler)(); // can't turn off fatals
3155 static bool __partial_init;
3156 static void __partial_initialize();
3157 static bool __full_init;
3158 static void __full_initialize(const char *program);
3159 static char *__program;
3161 static void __handle_error();
3162 static void __handle_fatal();
3163 static void __add_newline(const char *message);
3164 static void __message_switch(bool value, bool& flag, const char *description);
3165 static void __message_switch(bool value, bool& flag);
3166 static const char *__describe_handler(zero_arg_error_handler_t handler);
3168 static bool __output_valid();
3169 static ostream *__output;
3172 const char *class_name() const;
3177 //# 29 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
3181 // GctObject class (is abstract)
3183 class GctObject: virtual public GctErrorHandler /*, virtual public GttObject*/ {
3186 GctObject(const GctObject&);
3187 virtual ~GctObject(); // ensure descendants have virtual destructors
3193 // The value typically persists only long enough for an i/o operation
3194 // to be performed (see the defintion of output via operator<<(... ) below)
3195 virtual const char *stringify();
3197 // This is the buffer into which the printed representation of this
3198 // object will be put when the time comes. It is associated with the
3199 // object so it will never go away (so long as the object exists).
3200 // Use a pointer so that you only pay for the space when I/O is used
3201 tostrstream *stringbuf;
3202 void clear_stringbuf();
3206 // Consistency (global consistency)
3208 // The global data invariant for the whole object (heirs included).
3209 // This OK function will call the local invariant function ok() if
3210 // necessary and in addition the OK functions of the heirs
3211 // This is expected to compute the data invariant of the object.
3212 // It will execute GctErrorHandler::fatal if there is wrong.
3213 virtual void OK() const;
3217 // consistency (local consistency)
3219 // This function computes the invariant which is local to this object.
3220 // It does not call any of the ancestor's OK() or ok() functions.
3221 // It is not a virtual function so that it can be called from within a
3222 // constructor with impunity. Thus this function MUST NOT call any
3223 // virtual functions either; it should call them by their full name if
3224 // that is necessary. The global OK() function will call this function
3227 // This function must NOT NEVER EVER be made virtual.
3233 // This must return a static (constant) string which is the name
3234 // of the class being declared. By convention, not all classes
3235 // must have one of these, but the major root abstract class must
3236 // have one in order to allow the stringify() to work approximately
3238 virtual const char *class_name() const = 0;
3242 // The ``id'' of this object
3244 // NOTE - we explicitly allow the situation where this function
3245 // can return the address of the object - the ``this'' pointer
3246 // instead of a computed id field (the __object_id field below).
3248 // This function is protected because we don't want too much dependence
3249 // on this notion of object identity. I want to be able to rip it
3250 // out if it becomes to cumbersome.
3251 unsigned objectId() const;
3256 // NOTE - Normally this would be implemented by the `this' pointer.
3257 // TODO - remove this for production code
3259 // However, in order to make the test suites run on all machines, we
3260 // make this into a symbolic id that is maintained with each object.
3261 // Thus the valid outputs are always consistent across all machines.
3262 unsigned __object_id;
3263 static unsigned __next_id;
3266 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
3267 // This is part of the iostream library, providing -*- C++ -*- input/output.
3268 // Copyright (C) 1991 Per Bothner.
3270 // This library is free software; you can redistribute it and/or
3271 // modify it under the terms of the GNU Library General Public
3272 // License as published by the Free Software Foundation; either
3273 // version 2 of the License, or (at your option) any later version.
3275 // This library is distributed in the hope that it will be useful,
3276 // but WITHOUT ANY WARRANTY; without even the implied warranty of
3277 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3278 // Library General Public License for more details.
3280 // You should have received a copy of the GNU Library General Public
3281 // License along with this library; if not, write to the Free
3282 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
3284 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
3286 //# 117 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
3288 extern ostream& operator<<(ostream&, GctObject&);
3291 //# 25 "../../../../../../mips/include/Gct/Object/GctHashObject.h" 2
3295 // GctHashObject class (is abstract)
3297 class GctHashObject: virtual public GctObject {
3300 GctHashObject(const GctHashObject&);
3306 virtual unsigned hash() const;
3310 //# 28 "../../GctSymbol.h" 2
3316 class GctSymbol: virtual public GctHashObject, String {
3318 GctSymbol(); // vacuous symbol required for genclass usage
3319 GctSymbol(const char*);
3320 GctSymbol(const String&);
3321 GctSymbol(const GctSymbol&);
3323 operator const char *() const;
3325 bool operator==(const GctSymbol&) const;
3326 bool operator!=(const GctSymbol&) const;
3328 bool operator<=(const GctSymbol&) const;
3329 bool operator<(const GctSymbol&) const;
3330 bool operator>=(const GctSymbol&) const;
3331 bool operator>(const GctSymbol&) const;
3333 unsigned hash() const;
3336 const char *stringify();
3341 const char *class_name() const;
3344 extern unsigned hash(GctSymbol&); // genclass support (no const)
3349 // Note - none of the String operators save for operator const char *()
3350 // are String member functions, instead, they are anonymous functions
3351 // which work by overloading.
3358 GctSymbol::operator const char *() const
3365 return String::operator const char *();
3369 GctSymbol::operator==(const GctSymbol& other) const
3376 return (bool)::operator==(*this, other);
3380 GctSymbol::operator!=(const GctSymbol& other) const
3387 return (bool)::operator!=(*this, other);
3391 GctSymbol::operator<=(const GctSymbol& other) const
3398 return (bool)::operator<=(*this, other);
3402 GctSymbol::operator<(const GctSymbol& other) const
3409 return (bool)::operator<(*this, other);
3413 GctSymbol::operator>=(const GctSymbol& other) const
3420 return (bool)::operator>=(*this, other);
3424 GctSymbol::operator>(const GctSymbol& other) const
3431 return (bool)::operator>(*this, other);
3435 //# 25 "GctSymbol.defs.h" 2
3438 // equality operator
3443 // less-than-or-equal
3448 // comparison : less-than -> 0
3455 extern unsigned int hash(GctSymbol&);
3459 // initial capacity for structures requiring one
3467 //# 27 "GctSymbol.GctSymbol.Map.h" 2
3470 class GctSymbolGctSymbolMap
3477 GctSymbolGctSymbolMap(GctSymbol& dflt);
3478 virtual ~GctSymbolGctSymbolMap();
3480 int length(); // current number of items
3483 virtual int contains(GctSymbol& key); // is key mapped?
3485 virtual void clear(); // delete all items
3487 virtual GctSymbol& operator [] (GctSymbol& key) = 0; // access contents by key
3489 virtual void del(GctSymbol& key) = 0; // delete entry
3491 virtual Pix first() = 0; // Pix of first item or 0
3492 virtual void next(Pix& i) = 0; // advance to next or 0
3493 virtual GctSymbol& key(Pix i) = 0; // access key at i
3494 virtual GctSymbol& contents(Pix i) = 0; // access contents at i
3496 virtual int owns(Pix i); // is i a valid Pix ?
3497 virtual Pix seek(GctSymbol& key); // Pix of key
3499 GctSymbol& dflt(); // access default val
3501 void error(const char* msg);
3502 virtual int OK() = 0; // rep invariant
3507 inline GctSymbolGctSymbolMap::~GctSymbolGctSymbolMap() {}
3509 inline int GctSymbolGctSymbolMap::length()
3514 inline int GctSymbolGctSymbolMap::empty()
3519 inline GctSymbol& GctSymbolGctSymbolMap::dflt()
3524 inline GctSymbolGctSymbolMap::GctSymbolGctSymbolMap(GctSymbol& dflt) :def(dflt)
3532 //# 26 "GctSymbol.GctSymbol.CHMap.h" 2
3538 struct GctSymbolGctSymbolCHNode
3540 GctSymbolGctSymbolCHNode* tl;
3543 GctSymbolGctSymbolCHNode();
3544 GctSymbolGctSymbolCHNode(GctSymbol& h, GctSymbol& c, GctSymbolGctSymbolCHNode* t = 0);
3545 ~GctSymbolGctSymbolCHNode();
3550 inline GctSymbolGctSymbolCHNode::GctSymbolGctSymbolCHNode() {}
3552 inline GctSymbolGctSymbolCHNode::GctSymbolGctSymbolCHNode(GctSymbol& h, GctSymbol& c, GctSymbolGctSymbolCHNode* t)
3553 : hd(h), cont(c), tl(t) {}
3555 inline GctSymbolGctSymbolCHNode::~GctSymbolGctSymbolCHNode() {}
3560 typedef GctSymbolGctSymbolCHNode* GctSymbolGctSymbolCHNodePtr;
3565 class GctSymbolGctSymbolCHMap : public GctSymbolGctSymbolMap
3568 GctSymbolGctSymbolCHNode** tab;
3572 GctSymbolGctSymbolCHMap(GctSymbol& dflt,unsigned int sz=100 );
3573 GctSymbolGctSymbolCHMap(GctSymbolGctSymbolCHMap& a);
3574 ~GctSymbolGctSymbolCHMap();
3576 GctSymbol& operator [] (GctSymbol& key);
3578 void del(GctSymbol& key);
3582 GctSymbol& key(Pix i);
3583 GctSymbol& contents(Pix i);
3585 Pix seek(GctSymbol& key);
3586 int contains(GctSymbol& key);
3594 inline GctSymbolGctSymbolCHMap::~GctSymbolGctSymbolCHMap()
3600 inline int GctSymbolGctSymbolCHMap::contains(GctSymbol& key)
3602 return seek(key) != 0;
3605 inline GctSymbol& GctSymbolGctSymbolCHMap::key(Pix p)
3607 if (p == 0) error("null Pix");
3608 return ((GctSymbolGctSymbolCHNode*)p)->hd;
3611 inline GctSymbol& GctSymbolGctSymbolCHMap::contents(Pix p)
3613 if (p == 0) error("null Pix");
3614 return ((GctSymbolGctSymbolCHNode*)p)->cont;
3620 //# 22 "GctSymbol.GctSymbol.CHMap.cc" 2
3623 // The nodes are linked together serially via a version
3624 // of a trick used in some vtables: odd pointers are
3625 // actually links to the next table entry.
3626 // Not terrible, but not wonderful either
3628 static inline int goodCHptr(GctSymbolGctSymbolCHNode* t)
3630 return ((((unsigned)t) & 1) == 0);
3633 static inline GctSymbolGctSymbolCHNode* index_to_CHptr(int i)
3635 return (GctSymbolGctSymbolCHNode*)((i << 1) + 1);
3638 static inline int CHptr_to_index(GctSymbolGctSymbolCHNode* t)
3640 return ( ((unsigned) t) >> 1);
3643 GctSymbolGctSymbolCHMap::GctSymbolGctSymbolCHMap(GctSymbol& dflt, unsigned int sz)
3644 :GctSymbolGctSymbolMap(dflt)
3646 tab = (GctSymbolGctSymbolCHNode**)(new GctSymbolGctSymbolCHNodePtr[size = sz]);
3647 for (unsigned int i = 0; i < size; ++i) tab[i] = index_to_CHptr(i+1);
3651 GctSymbolGctSymbolCHMap::GctSymbolGctSymbolCHMap(GctSymbolGctSymbolCHMap& a) :GctSymbolGctSymbolMap(a.def)
3653 tab = (GctSymbolGctSymbolCHNode**)(new GctSymbolGctSymbolCHNodePtr[size = a.size]);
3654 for (unsigned int i = 0; i < size; ++i) tab[i] = index_to_CHptr(i+1);
3656 for (Pix p = a.first(); p; a.next(p)) (*this)[a.key(p)] = a.contents(p); // { dg-bogus "" } type `GctSymbol' is derived from private `String'