1// Build don't link:
2// Special g++ Options: -w
3// prms-id: 784
4
5//# 1 "GctSymbol.GctSymbol.CHMap.cc"
6// This may look like C code, but it is really -*- C++ -*-
7/*
8Copyright (C) 1988, 2000 Free Software Foundation
9    written by Doug Lea (dl@rocky.oswego.edu)
10
11This file is part of the GNU C++ Library.  This library is free
12software; you can redistribute it and/or modify it under the terms of
13the GNU Library General Public License as published by the Free
14Software Foundation; either version 2 of the License, or (at your
15option) any later version.  This library is distributed in the hope
16that it will be useful, but WITHOUT ANY WARRANTY; without even the
17implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18PURPOSE.  See the GNU Library General Public License for more details.
19You should have received a copy of the GNU Library General Public
20License along with this library; if not, write to the Free Software
21Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22*/
23
24
25//#pragma implementation
26
27//# 1 "GctSymbol.GctSymbol.CHMap.h" 1
28// This may look like C code, but it is really -*- C++ -*-
29/*
30Copyright (C) 1988 Free Software Foundation
31    written by Doug Lea (dl@rocky.oswego.edu)
32
33This file is part of the GNU C++ Library.  This library is free
34software; you can redistribute it and/or modify it under the terms of
35the GNU Library General Public License as published by the Free
36Software Foundation; either version 2 of the License, or (at your
37option) any later version.  This library is distributed in the hope
38that it will be useful, but WITHOUT ANY WARRANTY; without even the
39implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
40PURPOSE.  See the GNU Library General Public License for more details.
41You should have received a copy of the GNU Library General Public
42License along with this library; if not, write to the Free Software
43Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
44*/
45
46
47
48
49//#pragma interface
50
51
52
53//# 1 "GctSymbol.GctSymbol.Map.h" 1
54// This may look like C code, but it is really -*- C++ -*-
55/*
56Copyright (C) 1988 Free Software Foundation
57    written by Doug Lea (dl@rocky.oswego.edu)
58
59This file is part of the GNU C++ Library.  This library is free
60software; you can redistribute it and/or modify it under the terms of
61the GNU Library General Public License as published by the Free
62Software Foundation; either version 2 of the License, or (at your
63option) any later version.  This library is distributed in the hope
64that it will be useful, but WITHOUT ANY WARRANTY; without even the
65implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
66PURPOSE.  See the GNU Library General Public License for more details.
67You should have received a copy of the GNU Library General Public
68License along with this library; if not, write to the Free Software
69Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
70*/
71
72
73
74
75//#pragma interface
76
77
78
79//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/Pix.h" 1
80
81
82
83typedef void* Pix;
84
85//# 26 "GctSymbol.GctSymbol.Map.h" 2
86
87//# 1 "GctSymbol.defs.h" 1
88// This may look like C code, but it is really -*- C++ -*-
89/*
90Copyright (C) 1988 Free Software Foundation
91    written by Doug Lea (dl@rocky.oswego.edu)
92
93This file is part of the GNU C++ Library.  This library is free
94software; you can redistribute it and/or modify it under the terms of
95the GNU Library General Public License as published by the Free
96Software Foundation; either version 2 of the License, or (at your
97option) any later version.  This library is distributed in the hope
98that it will be useful, but WITHOUT ANY WARRANTY; without even the
99implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
100PURPOSE.  See the GNU Library General Public License for more details.
101You should have received a copy of the GNU Library General Public
102License along with this library; if not, write to the Free Software
103Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
104*/
105
106
107
108
109
110
111
112//# 1 "../../GctSymbol.h" 1
113// -*- C++ -*-
114
115
116
117//
118// GctSymbol class
119//
120// Expects to be included by Gct.h
121//
122// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
123//
124
125
126
127
128
129//#pragma interface
130
131
132
133
134
135//# 25 "../../GctSymbol.h" 2
136
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++ -*-
139/*
140Copyright (C) 1988 Free Software Foundation
141    written by Doug Lea (dl@rocky.oswego.edu)
142
143This file is part of the GNU C++ Library.  This library is free
144software; you can redistribute it and/or modify it under the terms of
145the GNU Library General Public License as published by the Free
146Software Foundation; either version 2 of the License, or (at your
147option) any later version.  This library is distributed in the hope
148that it will be useful, but WITHOUT ANY WARRANTY; without even the
149implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
150PURPOSE.  See the GNU Library General Public License for more details.
151You should have received a copy of the GNU Library General Public
152License along with this library; if not, write to the Free Software
153Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
154*/
155
156
157
158
159//#pragma interface
160
161
162
163//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stream.h" 1
164
165
166
167// Compatibility with old library.
168
169
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.
173//
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.
178//
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.
183//
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.
187
188
189
190//#pragma interface
191
192
193
194
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.
198//
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.
203//
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.
208//
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.
212
213
214
215
216//#pragma interface
217
218
219/* KLUDGES!! */
220//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 1
221
222
223extern "C" {
224
225
226
227//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/mips/lib/gcc/decstatn/cygnus-1.96/include/stddef.h" 1
228
229
230
231
232
233
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.  */
236
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.  */
242
243/* Signed type of difference of two pointers.  */
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258typedef long int ptrdiff_t;
259
260
261
262
263
264
265/* Unsigned type of `sizeof' something.  */
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280typedef unsigned int size_t;
281
282
283
284
285
286
287/* Data type for wide chars.  */
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310/* A null pointer constant.  */
311
312
313
314
315/* Offset of member MEMBER in a struct of type TYPE.  */
316
317
318
319
320
321//# 7 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 2
322
323
324
325
326}
327
328//# 25 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/streambuf.h" 2
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345class ostream; class streambuf;
346
347typedef long streamoff, streampos;
348
349struct _ios_fields { // The data members of an ios.
350    streambuf *_strbuf;
351    ostream* _tie;
352    long _width;
353    unsigned long _flags;
354    char _fill;
355    unsigned char _state;
356    unsigned short _precision;
357};
358
359
360enum state_value { _good = 0, _eof = 1,  _fail = 2, _bad  = 4 };
361
362
363class ios : public _ios_fields {
364  public:
365    enum io_state { goodbit=0, eofbit=1, failbit=2, badbit=4 };
366    enum open_mode {
367	in=1,
368	out=2,
369	ate=4,
370	app=8,
371	trunc=16,
372	nocreate=32,
373	noreplace=64 };
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
380	   };
381
382    ostream* tie() { return _tie; }
383    ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; }
384
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;
394	return oldp; }
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; }
406
407    static const unsigned long basefield;
408    static const unsigned long adjustfield;
409    static const unsigned long floatfield;
410
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(); }
421
422
423    void unset(state_value flag) { _state &= ~flag; }
424    void close();
425    int is_open();
426    int readable();
427    int writable();
428
429
430  protected:
431    ios(streambuf*sb) { _strbuf=sb; _state=0; _width=0; _fill=' ';
432			_flags=ios::skipws; _precision=6; }
433};
434
435
436
437
438typedef ios::seek_dir _seek_dir;
439
440
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.
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461struct __streambuf {
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;
473};
474
475struct streambuf : private __streambuf {
476    friend class ios;
477    friend class istream;
478    friend class ostream;
479  protected:
480    static streambuf* _list_all; /* List of open streambufs. */
481    streambuf*& xchain() { return _chain; }
482    void _un_link();
483    void _link_in();
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; }
501  public:
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);
510    int sungetc();
511    streambuf();
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 ; }
519    int allocate() {
520	if (base() || unbuffered()) return 0;
521	else return doallocate(); }
522    virtual int sync();
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);
531    int sbumpc() {
532	if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
533	else return *(unsigned char*)_gptr++; }
534    int sgetc() {
535	if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
536	else return *(unsigned char*)_gptr; }
537    int snextc() {
538	if (++_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
539	else return *(unsigned char*)_gptr; }
540    int sputc(int c) {
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);
545};
546
547struct __file_fields {
548    char _fake;
549    char _shortbuf[1];
550    short _fileno;
551    int _blksize;
552    char* _save_gptr;
553    char* _save_egptr;
554    long  _offset;
555};
556
557class filebuf : public streambuf {
558    struct __file_fields _fb;
559    void init();
560  public:
561    filebuf();
562    filebuf(int fd);
563    filebuf(int fd, char* p, int len);
564    ~filebuf();
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) ; }
572    filebuf* close();
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);
579    virtual int sync();
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(); }
584    int do_flush();
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();
591};
592
593
594inline int ios::readable() { return rdbuf()->_flags & 4 ; }
595inline int ios::writable() { return rdbuf()->_flags & 8 ; }
596inline int ios::is_open() {return rdbuf()->_flags & 4 +8 ;}
597
598
599
600
601//# 25 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 2
602
603
604class istream; class ostream;
605typedef istream& (*__imanip)(istream&);
606typedef ostream& (*__omanip)(ostream&);
607
608extern istream& ws(istream& ins);
609extern ostream& flush(ostream& outs);
610extern ostream& endl(ostream& outs);
611extern ostream& ends(ostream& outs);
612
613class ostream : public ios
614{
615    void do_osfx();
616  public:
617    ostream();
618    ostream(streambuf* sb, ostream* tied=(__null) );
619    ~ostream();
620
621    int opfx() { if (!good()) return 0; if (_tie) _tie->flush(); return 1; }
622    void osfx() { if (flags() & (ios::unitbuf|ios::stdio))
623		      do_osfx(); }
624    streambuf* ostreambuf() const { return _strbuf; }
625    ostream& flush();
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);
632    streampos tellp();
633    ostream& form(const char *format ...);
634    ostream& vform(const char *format, char*  args);
635};
636
637ostream& operator<<(ostream&, char c);
638ostream& operator<<(ostream& os, unsigned char c) { return os << (char)c; }
639//ostream& operator<<(ostream &os, signed char c) { return os << (char)c; }
640extern ostream& operator<<(ostream&, const char *s);
641inline 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; }
645ostream& operator<<(ostream&, void *p);
646ostream& operator<<(ostream&, int n);
647ostream& operator<<(ostream&, long n);
648ostream& operator<<(ostream&, unsigned int n);
649ostream& operator<<(ostream&, unsigned long n);
650ostream& operator<<(ostream& os, short n) {return os << (int)n;}
651ostream& operator<<(ostream& os, unsigned short n)
652{return os << (unsigned int)n;}
653ostream& operator<<(ostream&, float n);
654ostream& operator<<(ostream&, double n);
655ostream& operator<<(ostream& os, __omanip func) { return (*func)(os); }
656ostream& operator<<(ostream&, streambuf*);
657
658class istream : public ios
659{
660    size_t _gcount;
661  public:
662    istream();
663    istream(streambuf* sb, ostream*tied=(__null) );
664    ~istream();
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');
675    int ipfx(int need) {
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;
679	return 1;
680    }
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;
685	return 1;
686    }
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();
690	return 1;
691    }
692    size_t gcount() { return _gcount; }
693    istream& seekg(streampos);
694    istream& seekg(streamoff, _seek_dir);
695    streampos tellg();
696    istream& putback(char ch) {
697	if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit);
698	return *this;}
699    istream& unget() {
700	if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit);
701	return *this;}
702
703    istream& unget(char ch) { return putback(ch); }
704    int skip(int i);
705
706};
707
708istream& operator>>(istream&, char*);
709istream& operator>>(istream& is, unsigned char* p) { return is >> (char*)p; }
710//istream& operator>>(istream& is, signed char* p) { return is >> (char*)p; }
711istream& operator>>(istream&, char& c);
712istream& operator>>(istream&, unsigned char& c);
713//istream& operator>>(istream&, signed char& c);
714istream& operator>>(istream&, int&);
715istream& operator>>(istream&, long&);
716istream& operator>>(istream&, short&);
717istream& operator>>(istream&, unsigned int&);
718istream& operator>>(istream&, unsigned long&);
719istream& operator>>(istream&, unsigned short&);
720istream& operator>>(istream&, float&);
721istream& operator>>(istream&, double&);
722istream& operator>>(istream& is, __imanip func) { return (*func)(is); }
723
724class iostream : public ios {
725    size_t _gcount;
726  public:
727    iostream();
728    operator istream&() { return *(istream*)this; }
729    operator ostream&() { return *(ostream*)this; }
730    ~iostream();
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(); }
756
757    istream& unget(char ch) { return putback(ch); }
758
759
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(); }
778};
779
780extern istream cin;
781extern ostream cout, cerr, clog; // clog->rdbuf() == cerr->rdbuf()
782
783inline ostream& ostream::put(char c) { _strbuf->sputc(c); return *this; }
784
785struct Iostream_init { } ;  // Compatibility hack for AT&T libraray.
786
787
788//# 7 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stream.h" 2
789
790
791extern char* form(char*, ...);
792
793extern char* dec(long, int=0);
794extern char* dec(int, int=0);
795extern char* dec(unsigned long, int=0);
796extern char* dec(unsigned int, int=0);
797
798extern char* hex(long, int=0);
799extern char* hex(int, int=0);
800extern char* hex(unsigned long, int=0);
801extern char* hex(unsigned int, int=0);
802
803extern char* oct(long, int=0);
804extern char* oct(int, int=0);
805extern char* oct(unsigned long, int=0);
806extern char* oct(unsigned int, int=0);
807
808inline istream& WS(istream& str) { return ws(str); }
809
810
811//# 26 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 2
812
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++ -*-
815/*
816Copyright (C) 1988 Free Software Foundation
817    written by Doug Lea (dl@rocky.oswego.edu)
818
819This file is part of the GNU C++ Library.  This library is free
820software; you can redistribute it and/or modify it under the terms of
821the GNU Library General Public License as published by the Free
822Software Foundation; either version 2 of the License, or (at your
823option) any later version.  This library is distributed in the hope
824that it will be useful, but WITHOUT ANY WARRANTY; without even the
825implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
826PURPOSE.  See the GNU Library General Public License for more details.
827You should have received a copy of the GNU Library General Public
828License along with this library; if not, write to the Free Software
829Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
830*/
831
832
833
834
835//#pragma interface
836
837
838
839
840
841
842
843
844
845struct re_pattern_buffer;       // defined elsewhere
846struct re_registers;
847
848class Regex
849{
850private:
851
852                     Regex(const Regex&) {}  // no X(X&)
853  void               operator = (const Regex&) {} // no assignment
854
855protected:
856  re_pattern_buffer* buf;
857  re_registers*      reg;
858
859public:
860                     Regex(const char* t,
861                           int fast = 0,
862                           int bufsize = 40,
863                           const char* transtable = 0);
864
865                    ~Regex();
866
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;
871
872  int                OK() const;  // representation invariant
873};
874
875// some built in regular expressions
876
877extern const Regex RXwhite;          // = "[ \n\t\r\v\f]+"
878extern const Regex RXint;            // = "-?[0-9]+"
879extern const Regex RXdouble;         // = "-?\\(\\([0-9]+\\.[0-9]*\\)\\|
880                                     //    \\([0-9]+\\)\\|\\(\\.[0-9]+\\)\\)
881                                     //    \\([eE][---+]?[0-9]+\\)?"
882extern const Regex RXalpha;          // = "[A-Za-z]+"
883extern const Regex RXlowercase;      // = "[a-z]+"
884extern const Regex RXuppercase;      // = "[A-Z]+"
885extern const Regex RXalphanum;       // = "[0-9A-Za-z]+"
886extern const Regex RXidentifier;     // = "[A-Za-z_][A-Za-z0-9_]*"
887
888
889
890//# 27 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 2
891
892
893struct StrRep                     // internal String representations
894{
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
900};
901
902// primitive ops on StrReps -- nearly all String fns go through these.
903
904StrRep*     Salloc(StrRep*, const char*, int, int);
905StrRep*     Scopy(StrRep*, StrRep*);
906StrRep*     Sresize(StrRep*, int);
907StrRep*     Scat(StrRep*, const char*, int, const char*, int);
908StrRep*     Scat(StrRep*, const char*, int,const char*,int, const char*,int);
909StrRep*     Sprepend(StrRep*, const char*, int);
910StrRep*     Sreverse(StrRep*, StrRep*);
911StrRep*     Supcase(StrRep*, StrRep*);
912StrRep*     Sdowncase(StrRep*, StrRep*);
913StrRep*     Scapitalize(StrRep*, StrRep*);
914
915// These classes need to be defined in the order given
916
917class String;
918class SubString;
919
920class SubString
921{
922  friend class      String;
923protected:
924
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
928
929  void              assign(StrRep*, const char*, int = -1);
930                    SubString(String& x, int p, int l);
931                    SubString(const SubString& x);
932
933public:
934
935// Note there are no public constructors. SubStrings are always
936// created via String operations
937
938                   ~SubString();
939
940  void              operator =  (const String&     y);
941  void              operator =  (const SubString&  y);
942  void              operator =  (const char* t);
943  void              operator =  (char        c);
944
945// return 1 if target appears anywhere in SubString; else 0
946
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;
952
953// return 1 if target matches entire SubString
954
955  int               matches(const Regex&  r) const;
956
957// IO
958
959  friend ostream&   operator<<(ostream& s, const SubString& x);
960
961// status
962
963  unsigned int      length() const;
964  int               empty() const;
965  const char*       chars() const;
966
967  int               OK() const;
968
969};
970
971
972class String
973{
974  friend class      SubString;
975
976protected:
977  StrRep*           rep;   // Strings are pointers to their representations
978
979// some helper functions
980
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);
987
988public:
989
990// constructors & assignment
991
992                    String();
993                    String(const String& x);
994                    String(const SubString&  x);
995                    String(const char* t);
996                    String(const char* t, int len);
997                    String(char c);
998
999                    ~String();
1000
1001  void              operator =  (const String&     y);
1002  void              operator =  (const char* y);
1003  void              operator =  (char        c);
1004  void              operator =  (const SubString&  y);
1005
1006// concatenation
1007
1008  void              operator += (const String&     y);
1009  void              operator += (const SubString&  y);
1010  void              operator += (const char* t);
1011  void              operator += (char        c);
1012
1013  void              prepend(const String&     y);
1014  void              prepend(const SubString&  y);
1015  void              prepend(const char* t);
1016  void              prepend(char        c);
1017
1018
1019// procedural versions:
1020// concatenate first 2 args, store result in last arg
1021
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&);
1026
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&);
1031
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&);
1036
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
1040
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&);
1053
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&);
1066
1067
1068// searching & matching
1069
1070// return position of target in string or -1 for failure
1071
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;
1077
1078// return 1 if target appears anyhere in String; else 0
1079
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;
1085
1086// return 1 if target appears anywhere after position pos
1087// (or before, if pos is negative) in String; else 0
1088
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;
1094
1095// return 1 if target appears at position pos in String; else 0
1096
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;
1102
1103//  return number of occurences of target in String
1104
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;
1109
1110// SubString extraction
1111
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
1115
1116  SubString         at(int         pos, int len);
1117  SubString         operator () (int         pos, int len); // synonym for at
1118
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);
1124
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);
1131
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);
1138
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);
1145
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);
1152
1153
1154// deletion
1155
1156// delete len chars starting at pos
1157  void              del(int         pos, int len);
1158
1159// delete the first occurrence of target after startpos
1160
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);
1166
1167// global substitution: substitute all occurrences of pat with repl
1168
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);
1174
1175// friends & utilities
1176
1177// split string into array res at separators; return number of elements
1178
1179  friend int        split(const String& x, String res[], int maxn,
1180                          const String& sep);
1181  friend int        split(const String& x, String res[], int maxn,
1182                          const Regex&  sep);
1183
1184  friend String     common_prefix(const String& x, const String& y,
1185                                  int startpos = 0);
1186  friend String     common_suffix(const String& x, const String& y,
1187                                  int startpos = -1);
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);
1191
1192// simple builtin transformations
1193
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);
1198
1199// in-place versions of above
1200
1201  void              reverse();
1202  void              upcase();
1203  void              downcase();
1204  void              capitalize();
1205
1206// element extraction
1207
1208  char&             operator [] (int i);
1209  char              elem(int i) const;
1210  char              firstchar() const;
1211  char              lastchar() const;
1212
1213// conversion
1214
1215                    operator const char*() const;
1216  const char*       chars() const;
1217
1218
1219// IO
1220
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);
1224
1225  friend int        readline(istream& s, String& x,
1226                             char terminator = '\n',
1227                             int discard_terminator = 1);
1228
1229// status
1230
1231  unsigned int      length() const;
1232  int               empty() const;
1233
1234// preallocate some space for String
1235  void              alloc(int newsize);
1236
1237// report current allocation (not length!)
1238
1239  int               allocation() const;
1240
1241
1242  volatile void     error(const char* msg) const;
1243
1244  int               OK() const;
1245};
1246
1247typedef String StrTmp; // for backward compatibility
1248
1249// other externs
1250
1251int        compare(const String&    x, const String&     y);
1252int        compare(const String&    x, const SubString&  y);
1253int        compare(const String&    x, const char* y);
1254int        compare(const SubString& x, const String&     y);
1255int        compare(const SubString& x, const SubString&  y);
1256int        compare(const SubString& x, const char* y);
1257int        fcompare(const String&   x, const String&     y); // ignore case
1258
1259extern StrRep  _nilStrRep;
1260extern String _nilString;
1261
1262// other inlines
1263
1264String operator + (const String& x, const String& y);
1265String operator + (const String& x, const SubString& y);
1266String operator + (const String& x, const char* y);
1267String operator + (const String& x, char y);
1268String operator + (const SubString& x, const String& y);
1269String operator + (const SubString& x, const SubString& y);
1270String operator + (const SubString& x, const char* y);
1271String operator + (const SubString& x, char y);
1272String operator + (const char* x, const String& y);
1273String operator + (const char* x, const SubString& y);
1274
1275int operator==(const String& x, const String& y);
1276int operator!=(const String& x, const String& y);
1277int operator> (const String& x, const String& y);
1278int operator>=(const String& x, const String& y);
1279int operator< (const String& x, const String& y);
1280int operator<=(const String& x, const String& y);
1281int operator==(const String& x, const SubString&  y);
1282int operator!=(const String& x, const SubString&  y);
1283int operator> (const String& x, const SubString&  y);
1284int operator>=(const String& x, const SubString&  y);
1285int operator< (const String& x, const SubString&  y);
1286int operator<=(const String& x, const SubString&  y);
1287int operator==(const String& x, const char* t);
1288int operator!=(const String& x, const char* t);
1289int operator> (const String& x, const char* t);
1290int operator>=(const String& x, const char* t);
1291int operator< (const String& x, const char* t);
1292int operator<=(const String& x, const char* t);
1293int operator==(const SubString& x, const String& y);
1294int operator!=(const SubString& x, const String& y);
1295int operator> (const SubString& x, const String& y);
1296int operator>=(const SubString& x, const String& y);
1297int operator< (const SubString& x, const String& y);
1298int operator<=(const SubString& x, const String& y);
1299int operator==(const SubString& x, const SubString&  y);
1300int operator!=(const SubString& x, const SubString&  y);
1301int operator> (const SubString& x, const SubString&  y);
1302int operator>=(const SubString& x, const SubString&  y);
1303int operator< (const SubString& x, const SubString&  y);
1304int operator<=(const SubString& x, const SubString&  y);
1305int operator==(const SubString& x, const char* t);
1306int operator!=(const SubString& x, const char* t);
1307int operator> (const SubString& x, const char* t);
1308int operator>=(const SubString& x, const char* t);
1309int operator< (const SubString& x, const char* t);
1310int operator<=(const SubString& x, const char* t);
1311
1312
1313
1314
1315// status reports, needed before defining other things
1316
1317inline unsigned int String::length() const {  return rep->len; }
1318inline int         String::empty() const { return rep->len == 0; }
1319inline const char* String::chars() const { return &(rep->s[0]); }
1320inline int         String::allocation() const { return rep->sz; }
1321inline void        String::alloc(int newsize) { rep = Sresize(rep, newsize); }
1322
1323inline unsigned int SubString::length() const { return len; }
1324inline int         SubString::empty() const { return len == 0; }
1325inline const char* SubString::chars() const { return &(S.rep->s[pos]); }
1326
1327
1328// constructors
1329
1330inline String::String()
1331  : rep(&_nilStrRep) {}
1332inline String::String(const String& x)
1333  : rep(Scopy(0, x.rep)) {}
1334inline String::String(const char* t)
1335  : rep(Salloc(0, t, -1, -1)) {}
1336inline String::String(const char* t, int tlen)
1337  : rep(Salloc(0, t, tlen, tlen)) {}
1338inline String::String(const SubString& y)
1339  : rep(Salloc(0, y.chars(), y.length(), y.length())) {}
1340inline String::String(char c)
1341  : rep(Salloc(0, &c, 1, 1)) {}
1342
1343inline String::~String() { if (rep != &_nilStrRep) delete rep; }
1344
1345inline SubString::SubString(const SubString& x)
1346  :S(x.S), pos(x.pos), len(x.len) {}
1347inline SubString::SubString(String& x, int first, int l)
1348  :S(x), pos(first), len(l) {}
1349
1350inline SubString::~SubString() {}
1351
1352// assignment
1353
1354inline void String::operator =  (const String& y)
1355{
1356  rep = Scopy(rep, y.rep);
1357}
1358
1359inline void String::operator=(const char* t)
1360{
1361  rep = Salloc(rep, t, -1, -1);
1362}
1363
1364inline void String::operator=(const SubString&  y)
1365{
1366  rep = Salloc(rep, y.chars(), y.length(), y.length());
1367}
1368
1369inline void String::operator=(char c)
1370{
1371  rep = Salloc(rep, &c, 1, 1);
1372}
1373
1374
1375inline void SubString::operator = (const char* ys)
1376{
1377  assign(0, ys);
1378}
1379
1380inline void SubString::operator = (char ch)
1381{
1382  assign(0, &ch, 1);
1383}
1384
1385inline void SubString::operator = (const String& y)
1386{
1387  assign(y.rep, y.chars(), y.length());
1388}
1389
1390inline void SubString::operator = (const SubString& y)
1391{
1392  assign(y.S.rep, y.chars(), y.length());
1393}
1394
1395// Zillions of cats...
1396
1397inline void cat(const String& x, const String& y, String& r)
1398{
1399  r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
1400}
1401
1402inline void cat(const String& x, const SubString& y, String& r)
1403{
1404  r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
1405}
1406
1407inline void cat(const String& x, const char* y, String& r)
1408{
1409  r.rep = Scat(r.rep, x.chars(), x.length(), y, -1);
1410}
1411
1412inline void cat(const String& x, char y, String& r)
1413{
1414  r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1);
1415}
1416
1417inline void cat(const SubString& x, const String& y, String& r)
1418{
1419  r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
1420}
1421
1422inline void cat(const SubString& x, const SubString& y, String& r)
1423{
1424  r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
1425}
1426
1427inline void cat(const SubString& x, const char* y, String& r)
1428{
1429  r.rep = Scat(r.rep, x.chars(), x.length(), y, -1);
1430}
1431
1432inline void cat(const SubString& x, char y, String& r)
1433{
1434  r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1);
1435}
1436
1437inline void cat(const char* x, const String& y, String& r)
1438{
1439  r.rep = Scat(r.rep, x, -1, y.chars(), y.length());
1440}
1441
1442inline void cat(const char* x, const SubString& y, String& r)
1443{
1444  r.rep = Scat(r.rep, x, -1, y.chars(), y.length());
1445}
1446
1447inline void cat(const char* x, const char* y, String& r)
1448{
1449  r.rep = Scat(r.rep, x, -1, y, -1);
1450}
1451
1452inline void cat(const char* x, char y, String& r)
1453{
1454  r.rep = Scat(r.rep, x, -1, &y, 1);
1455}
1456
1457inline void cat(const String& a, const String& x, const String& y, String& r)
1458{
1459  r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
1460}
1461
1462inline void cat(const String& a, const String& x, const SubString& y, String& r)
1463{
1464  r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
1465}
1466
1467inline void cat(const String& a, const String& x, const char* y, String& r)
1468{
1469  r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1);
1470}
1471
1472inline void cat(const String& a, const String& x, char y, String& r)
1473{
1474  r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), &y, 1);
1475}
1476
1477inline void cat(const String& a, const SubString& x, const String& y, String& r)
1478{
1479  r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
1480}
1481
1482inline void cat(const String& a, const SubString& x, const SubString& y, String& r)
1483{
1484  r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
1485}
1486
1487inline void cat(const String& a, const SubString& x, const char* y, String& r)
1488{
1489  r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1);
1490}
1491
1492inline void cat(const String& a, const SubString& x, char y, String& r)
1493{
1494  r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), &y, 1);
1495}
1496
1497inline void cat(const String& a, const char* x, const String& y, String& r)
1498{
1499  r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y.chars(), y.length());
1500}
1501
1502inline void cat(const String& a, const char* x, const SubString& y, String& r)
1503{
1504  r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y.chars(), y.length());
1505}
1506
1507inline void cat(const String& a, const char* x, const char* y, String& r)
1508{
1509  r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y, -1);
1510}
1511
1512inline void cat(const String& a, const char* x, char y, String& r)
1513{
1514  r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, &y, 1);
1515}
1516
1517
1518inline void cat(const char* a, const String& x, const String& y, String& r)
1519{
1520  r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
1521}
1522
1523inline void cat(const char* a, const String& x, const SubString& y, String& r)
1524{
1525  r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
1526}
1527
1528inline void cat(const char* a, const String& x, const char* y, String& r)
1529{
1530  r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1);
1531}
1532
1533inline void cat(const char* a, const String& x, char y, String& r)
1534{
1535  r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), &y, 1);
1536}
1537
1538inline void cat(const char* a, const SubString& x, const String& y, String& r)
1539{
1540  r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
1541}
1542
1543inline void cat(const char* a, const SubString& x, const SubString& y, String& r)
1544{
1545  r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
1546}
1547
1548inline void cat(const char* a, const SubString& x, const char* y, String& r)
1549{
1550  r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1);
1551}
1552
1553inline void cat(const char* a, const SubString& x, char y, String& r)
1554{
1555  r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), &y, 1);
1556}
1557
1558inline void cat(const char* a, const char* x, const String& y, String& r)
1559{
1560  r.rep = Scat(r.rep, a, -1, x, -1, y.chars(), y.length());
1561}
1562
1563inline void cat(const char* a, const char* x, const SubString& y, String& r)
1564{
1565  r.rep = Scat(r.rep, a, -1, x, -1, y.chars(), y.length());
1566}
1567
1568inline void cat(const char* a, const char* x, const char* y, String& r)
1569{
1570  r.rep = Scat(r.rep, a, -1, x, -1, y, -1);
1571}
1572
1573inline void cat(const char* a, const char* x, char y, String& r)
1574{
1575  r.rep = Scat(r.rep, a, -1, x, -1, &y, 1);
1576}
1577
1578
1579// operator versions
1580
1581inline void String::operator +=(const String& y)
1582{
1583  cat(*this, y, *this);
1584}
1585
1586inline void String::operator +=(const SubString& y)
1587{
1588  cat(*this, y, *this);
1589}
1590
1591inline void String::operator += (const char* y)
1592{
1593  cat(*this, y, *this);
1594}
1595
1596inline void String:: operator +=(char y)
1597{
1598  cat(*this, y, *this);
1599}
1600
1601// constructive concatenation
1602
1603
1604
1605inline String operator + (const String& x, const String& y) return r;
1606{
1607  cat(x, y, r);
1608}
1609
1610inline String operator + (const String& x, const SubString& y) return r;
1611{
1612  cat(x, y, r);
1613}
1614
1615inline String operator + (const String& x, const char* y) return r;
1616{
1617  cat(x, y, r);
1618}
1619
1620inline String operator + (const String& x, char y) return r;
1621{
1622  cat(x, y, r);
1623}
1624
1625inline String operator + (const SubString& x, const String& y) return r;
1626{
1627  cat(x, y, r);
1628}
1629
1630inline String operator + (const SubString& x, const SubString& y) return r;
1631{
1632  cat(x, y, r);
1633}
1634
1635inline String operator + (const SubString& x, const char* y) return r;
1636{
1637  cat(x, y, r);
1638}
1639
1640inline String operator + (const SubString& x, char y) return r;
1641{
1642  cat(x, y, r);
1643}
1644
1645inline String operator + (const char* x, const String& y) return r;
1646{
1647  cat(x, y, r);
1648}
1649
1650inline String operator + (const char* x, const SubString& y) return r;
1651{
1652  cat(x, y, r);
1653}
1654
1655inline String reverse(const String& x) return r;
1656{
1657  r.rep = Sreverse(x.rep, r.rep);
1658}
1659
1660inline String upcase(const String& x) return r;
1661{
1662  r.rep = Supcase(x.rep, r.rep);
1663}
1664
1665inline String downcase(const String& x) return r;
1666{
1667  r.rep = Sdowncase(x.rep, r.rep);
1668}
1669
1670inline String capitalize(const String& x) return r;
1671{
1672  r.rep = Scapitalize(x.rep, r.rep);
1673}
1674
1675//# 883 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h"
1676
1677
1678// prepend
1679
1680inline void String::prepend(const String& y)
1681{
1682  rep = Sprepend(rep, y.chars(), y.length());
1683}
1684
1685inline void String::prepend(const char* y)
1686{
1687  rep = Sprepend(rep, y, -1);
1688}
1689
1690inline void String::prepend(char y)
1691{
1692  rep = Sprepend(rep, &y, 1);
1693}
1694
1695inline void String::prepend(const SubString& y)
1696{
1697  rep = Sprepend(rep, y.chars(), y.length());
1698}
1699
1700// misc transformations
1701
1702
1703inline void String::reverse()
1704{
1705  rep = Sreverse(rep, rep);
1706}
1707
1708
1709inline void String::upcase()
1710{
1711  rep = Supcase(rep, rep);
1712}
1713
1714
1715inline void String::downcase()
1716{
1717  rep = Sdowncase(rep, rep);
1718}
1719
1720
1721inline void String::capitalize()
1722{
1723  rep = Scapitalize(rep, rep);
1724}
1725
1726// element extraction
1727
1728inline char&  String::operator [] (int i)
1729{
1730  if (((unsigned)i) >= length()) error("invalid index");
1731  return rep->s[i];
1732}
1733
1734inline char  String::elem (int i) const
1735{
1736  if (((unsigned)i) >= length()) error("invalid index");
1737  return rep->s[i];
1738}
1739
1740inline char  String::firstchar() const
1741{
1742  return elem(0);
1743}
1744
1745inline char  String::lastchar() const
1746{
1747  return elem(length() - 1);
1748}
1749
1750// searching
1751
1752inline int String::index(char c, int startpos) const
1753{
1754  return search(startpos, length(), c);
1755}
1756
1757inline int String::index(const char* t, int startpos) const
1758{
1759  return search(startpos, length(), t);
1760}
1761
1762inline int String::index(const String& y, int startpos) const
1763{
1764  return search(startpos, length(), y.chars(), y.length());
1765}
1766
1767inline int String::index(const SubString& y, int startpos) const
1768{
1769  return search(startpos, length(), y.chars(), y.length());
1770}
1771
1772inline int String::index(const Regex& r, int startpos) const
1773{
1774  int unused;  return r.search(chars(), length(), unused, startpos);
1775}
1776
1777inline int String::contains(char c) const
1778{
1779  return search(0, length(), c) >= 0;
1780}
1781
1782inline int String::contains(const char* t) const
1783{
1784  return search(0, length(), t) >= 0;
1785}
1786
1787inline int String::contains(const String& y) const
1788{
1789  return search(0, length(), y.chars(), y.length()) >= 0;
1790}
1791
1792inline int String::contains(const SubString& y) const
1793{
1794  return search(0, length(), y.chars(), y.length()) >= 0;
1795}
1796
1797inline int String::contains(char c, int p) const
1798{
1799  return match(p, length(), 0, &c, 1) >= 0;
1800}
1801
1802inline int String::contains(const char* t, int p) const
1803{
1804  return match(p, length(), 0, t) >= 0;
1805}
1806
1807inline int String::contains(const String& y, int p) const
1808{
1809  return match(p, length(), 0, y.chars(), y.length()) >= 0;
1810}
1811
1812inline int String::contains(const SubString& y, int p) const
1813{
1814  return match(p, length(), 0, y.chars(), y.length()) >= 0;
1815}
1816
1817inline int String::contains(const Regex& r) const
1818{
1819  int unused;  return r.search(chars(), length(), unused, 0) >= 0;
1820}
1821
1822inline int String::contains(const Regex& r, int p) const
1823{
1824  return r.match(chars(), length(), p) >= 0;
1825}
1826
1827
1828inline int String::matches(const SubString& y, int p) const
1829{
1830  return match(p, length(), 1, y.chars(), y.length()) >= 0;
1831}
1832
1833inline int String::matches(const String& y, int p) const
1834{
1835  return match(p, length(), 1, y.chars(), y.length()) >= 0;
1836}
1837
1838inline int String::matches(const char* t, int p) const
1839{
1840  return match(p, length(), 1, t) >= 0;
1841}
1842
1843inline int String::matches(char c, int p) const
1844{
1845  return match(p, length(), 1, &c, 1) >= 0;
1846}
1847
1848inline int String::matches(const Regex& r, int p) const
1849{
1850  int l = (p < 0)? -p : length() - p;
1851  return r.match(chars(), length(), p) == l;
1852}
1853
1854
1855inline int SubString::contains(const char* t) const
1856{
1857  return S.search(pos, pos+len, t) >= 0;
1858}
1859
1860inline int SubString::contains(const String& y) const
1861{
1862  return S.search(pos, pos+len, y.chars(), y.length()) >= 0;
1863}
1864
1865inline int SubString::contains(const SubString&  y) const
1866{
1867  return S.search(pos, pos+len, y.chars(), y.length()) >= 0;
1868}
1869
1870inline int SubString::contains(char c) const
1871{
1872  return S.search(pos, pos+len, 0, c) >= 0;
1873}
1874
1875inline int SubString::contains(const Regex& r) const
1876{
1877  int unused;  return r.search(chars(), len, unused, 0) >= 0;
1878}
1879
1880inline int SubString::matches(const Regex& r) const
1881{
1882  return r.match(chars(), len, 0) == len;
1883}
1884
1885
1886inline int String::gsub(const String& pat, const String& r)
1887{
1888  return _gsub(pat.chars(), pat.length(), r.chars(), r.length());
1889}
1890
1891inline int String::gsub(const SubString&  pat, const String& r)
1892{
1893  return _gsub(pat.chars(), pat.length(), r.chars(), r.length());
1894}
1895
1896inline int String::gsub(const Regex& pat, const String& r)
1897{
1898  return _gsub(pat, r.chars(), r.length());
1899}
1900
1901inline int String::gsub(const char* pat, const String& r)
1902{
1903  return _gsub(pat, -1, r.chars(), r.length());
1904}
1905
1906inline int String::gsub(const char* pat, const char* r)
1907{
1908  return _gsub(pat, -1, r, -1);
1909}
1910
1911
1912
1913inline  ostream& operator<<(ostream& s, const String& x)
1914{
1915   s << x.chars(); return s;
1916}
1917
1918// a zillion comparison operators
1919
1920inline int operator==(const String& x, const String& y)
1921{
1922  return compare(x, y) == 0;
1923}
1924
1925inline int operator!=(const String& x, const String& y)
1926{
1927  return compare(x, y) != 0;
1928}
1929
1930inline int operator>(const String& x, const String& y)
1931{
1932  return compare(x, y) > 0;
1933}
1934
1935inline int operator>=(const String& x, const String& y)
1936{
1937  return compare(x, y) >= 0;
1938}
1939
1940inline int operator<(const String& x, const String& y)
1941{
1942  return compare(x, y) < 0;
1943}
1944
1945inline int operator<=(const String& x, const String& y)
1946{
1947  return compare(x, y) <= 0;
1948}
1949
1950inline int operator==(const String& x, const SubString&  y)
1951{
1952  return compare(x, y) == 0;
1953}
1954
1955inline int operator!=(const String& x, const SubString&  y)
1956{
1957  return compare(x, y) != 0;
1958}
1959
1960inline int operator>(const String& x, const SubString&  y)
1961{
1962  return compare(x, y) > 0;
1963}
1964
1965inline int operator>=(const String& x, const SubString&  y)
1966{
1967  return compare(x, y) >= 0;
1968}
1969
1970inline int operator<(const String& x, const SubString&  y)
1971{
1972  return compare(x, y) < 0;
1973}
1974
1975inline int operator<=(const String& x, const SubString&  y)
1976{
1977  return compare(x, y) <= 0;
1978}
1979
1980inline int operator==(const String& x, const char* t)
1981{
1982  return compare(x, t) == 0;
1983}
1984
1985inline int operator!=(const String& x, const char* t)
1986{
1987  return compare(x, t) != 0;
1988}
1989
1990inline int operator>(const String& x, const char* t)
1991{
1992  return compare(x, t) > 0;
1993}
1994
1995inline int operator>=(const String& x, const char* t)
1996{
1997  return compare(x, t) >= 0;
1998}
1999
2000inline int operator<(const String& x, const char* t)
2001{
2002  return compare(x, t) < 0;
2003}
2004
2005inline int operator<=(const String& x, const char* t)
2006{
2007  return compare(x, t) <= 0;
2008}
2009
2010inline int operator==(const SubString& x, const String& y)
2011{
2012  return compare(y, x) == 0;
2013}
2014
2015inline int operator!=(const SubString& x, const String& y)
2016{
2017  return compare(y, x) != 0;
2018}
2019
2020inline int operator>(const SubString& x, const String& y)
2021{
2022  return compare(y, x) < 0;
2023}
2024
2025inline int operator>=(const SubString& x, const String& y)
2026{
2027  return compare(y, x) <= 0;
2028}
2029
2030inline int operator<(const SubString& x, const String& y)
2031{
2032  return compare(y, x) > 0;
2033}
2034
2035inline int operator<=(const SubString& x, const String& y)
2036{
2037  return compare(y, x) >= 0;
2038}
2039
2040inline int operator==(const SubString& x, const SubString&  y)
2041{
2042  return compare(x, y) == 0;
2043}
2044
2045inline int operator!=(const SubString& x, const SubString&  y)
2046{
2047  return compare(x, y) != 0;
2048}
2049
2050inline int operator>(const SubString& x, const SubString&  y)
2051{
2052  return compare(x, y) > 0;
2053}
2054
2055inline int operator>=(const SubString& x, const SubString&  y)
2056{
2057  return compare(x, y) >= 0;
2058}
2059
2060inline int operator<(const SubString& x, const SubString&  y)
2061{
2062  return compare(x, y) < 0;
2063}
2064
2065inline int operator<=(const SubString& x, const SubString&  y)
2066{
2067  return compare(x, y) <= 0;
2068}
2069
2070inline int operator==(const SubString& x, const char* t)
2071{
2072  return compare(x, t) == 0;
2073}
2074
2075inline int operator!=(const SubString& x, const char* t)
2076{
2077  return compare(x, t) != 0;
2078}
2079
2080inline int operator>(const SubString& x, const char* t)
2081{
2082  return compare(x, t) > 0;
2083}
2084
2085inline int operator>=(const SubString& x, const char* t)
2086{
2087  return compare(x, t) >= 0;
2088}
2089
2090inline int operator<(const SubString& x, const char* t)
2091{
2092  return compare(x, t) < 0;
2093}
2094
2095inline int operator<=(const SubString& x, const char* t)
2096{
2097  return compare(x, t) <= 0;
2098}
2099
2100
2101// a helper needed by at, before, etc.
2102
2103inline SubString String::_substr(int first, int l)
2104{
2105  if (first >= length() )  // ??? THIS LINE IS QUESTIONABLE
2106    return SubString(_nilString, 0, 0) ;
2107  else
2108    return SubString(*this, first, l);
2109}
2110
2111
2112
2113
2114
2115//# 26 "../../GctSymbol.h" 2
2116
2117
2118//# 1 "../../../../../../mips/include/Gct/Object/GctHashObject.h" 1
2119// -*- C++ -*-
2120
2121
2122
2123//
2124// GctHashObject class (is abstract)
2125//
2126// Expects to be included by Object.h or where needed explicitly.
2127//
2128// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2129//
2130
2131
2132
2133
2134
2135//#pragma interface
2136
2137
2138
2139//# 1 "../../../../../../mips/include/Gct/Object/GctObject.h" 1
2140// -*- C++ -*-
2141
2142
2143
2144//
2145// GctObject class (is abstract)
2146//
2147// Expects to be included by Object.h or where needed explicitly.
2148//
2149// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2150//
2151
2152
2153
2154
2155
2156//#pragma interface
2157
2158
2159
2160//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
2161// -*- C++ -*-
2162
2163
2164
2165//
2166// tostrstream class
2167//
2168// A terminated oststream - an ostsrstream that auto-terminates on str()
2169//
2170// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2171//
2172
2173
2174
2175
2176
2177//#pragma interface
2178
2179
2180
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.
2184//
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.
2189//
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.
2194//
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.
2198
2199
2200
2201
2202//#pragma interface
2203
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.
2207//
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.
2212//
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.
2217//
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.
2221
2222//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2223
2224//# 23 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/strstream.h" 2
2225
2226
2227class strstreambuf : public streambuf {
2228    size_t *lenp; /* current (logical) length (i.e. valid data bytes) */
2229    size_t *sizep; /* allocated (physical) buffer size */
2230    char **bufp;
2231    size_t _len;
2232    size_t _size;
2233    char *buf;
2234    int _frozen;
2235  protected:
2236    virtual int overflow(int = (-1) );
2237  public:
2238    strstreambuf();
2239    strstreambuf(int initial);
2240    strstreambuf(char *ptr, int size, char *pstart = (__null) );
2241    ~strstreambuf();
2242    int frozen() { return _frozen; }
2243    void freeze(int n=1) { _frozen = n != 0; }
2244    size_t pcount();
2245    char *str();
2246};
2247
2248class istrstream : public istream {
2249  public:
2250    istrstream(char*);
2251    istrstream(char*, int);
2252    strstreambuf* rdbuf() { return (strstreambuf*)_strbuf; }
2253};
2254
2255class ostrstream : public ostream {
2256  public:
2257    ostrstream();
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; }
2264};
2265
2266
2267//# 25 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 2
2268
2269
2270//
2271// tostrstream class
2272//
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).
2277//
2278class tostrstream: public ostrstream {
2279public:
2280    tostrstream(): ostrstream()
2281	{ }
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)	// ERROR -
2286	{ }
2287    char *str()
2288	{
2289	    char *s = ostrstream::str();
2290	    s[ostrstream::pcount()] = '\0';
2291	    return s;
2292	}
2293};
2294
2295
2296//# 25 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
2297
2298
2299//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 1
2300// -*- C++ -*-
2301
2302
2303
2304//
2305// GttObject class (is abstract)
2306//
2307// Expects to be included where needed explicitly.
2308//
2309// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2310//
2311
2312
2313
2314
2315
2316//#pragma interface
2317
2318
2319
2320//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
2321// -*- C++ -*-
2322//# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
2323
2324//# 25 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
2325
2326
2327//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 1
2328// -*- C++ -*-
2329
2330
2331
2332//
2333// GttErrorHandler class
2334//
2335// Expects to be included by Gtt.h
2336//
2337// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2338//
2339
2340
2341
2342
2343
2344//#pragma interface
2345
2346
2347
2348//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
2349
2350
2351
2352
2353
2354
2355
2356//# 25 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
2357
2358
2359//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 1
2360// -*- C++ -*-
2361
2362
2363
2364//
2365// Fake up a libstuff++
2366//
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.
2370//
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.
2374//
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.
2377//
2378
2379
2380
2381
2382
2383//#pragma interface
2384
2385
2386
2387extern "C" {
2388//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 1
2389
2390
2391
2392/*
2393 * Useful stuff
2394 */
2395
2396/*
2397 */
2398
2399//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/ansi.h" 1
2400
2401
2402
2403
2404/*
2405 * ANSI Compiler Support
2406 *
2407 * David Harrison
2408 * University of California, Berkeley
2409 * 1988
2410 *
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.
2414 *
2415 * ARGS:
2416 *   Used in function prototypes.  Example:
2417 *   extern int foo
2418 *     ARGS((char *blah, double threshold));
2419 */
2420
2421/*
2422 *
2423 * Modifications
2424 * Wendell C Baker
2425 * University of California, Berkeley
2426 */
2427
2428/* Function prototypes */
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456//# 15 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 2
2457
2458
2459
2460/*
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
2463 */
2464
2465/*
2466 *    Use the GNU libg++ definition
2467 */
2468//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
2469
2470
2471
2472
2473
2474
2475
2476//# 26 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 2
2477
2478//# 35 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h"
2479
2480
2481/*
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.
2485 */
2486
2487
2488//# 58 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h"
2489
2490
2491typedef long FitAny;		/* can fit any integral type */
2492
2493/*
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
2497 */
2498
2499
2500
2501
2502extern int nocase_strcmp (char *, char *)		;
2503extern int nocase_strncmp (char *, char *, int)		;
2504
2505extern bool	 nocase_strequal (char *, char *)		;
2506extern bool	 nocase_strnequal (char *, char *, int)		;
2507
2508extern bool	 lead_strequal (char *, char *)		;
2509extern bool	 nocase_lead_strequal (char *, char *)		;
2510
2511extern int strhash (char *, int)		;
2512extern int nocase_strhash (char *, int)		;
2513
2514extern int sign (int)		;
2515
2516/*
2517 *    Some useful macros.
2518 */
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548//# 33 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
2549
2550}
2551
2552//
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.
2556//
2557//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
2558
2559
2560
2561
2562
2563
2564
2565//# 41 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
2566
2567extern 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.
2571//
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.
2576//
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.
2581//
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.
2585
2586//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2587
2588//# 43 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
2589
2590extern ostream& operator<<(ostream&, bool);
2591
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
2595// -*- C++ -*-
2596
2597
2598
2599//
2600// unit enum
2601//
2602// Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU)
2603//
2604
2605
2606//
2607// unit enum
2608//
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.
2611//
2612enum unit {
2613    UNIT = 1,
2614};
2615
2616extern const char *stringify(unit u);
2617
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.
2621//
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.
2626//
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.
2631//
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.
2635
2636//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2637
2638//# 28 "/sandbox/wbaker/wbaker0/source/mips/include/unit.h" 2
2639
2640extern ostream& operator<<(ostream&, unit);
2641
2642//
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
2647// the overloading.
2648//
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.
2654//
2655// Example:
2656//
2657//     class ID {
2658//     public:
2659//         ID();		// construct a null ID
2660//         ID(unit);		// alloc a ID with a new id
2661//     private:
2662//         static unsigned high_water;
2663//         unsigned id;
2664//     };
2665//
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.
2669//
2670
2671
2672//# 48 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
2673
2674
2675//
2676// In the spirit of the standard GNU error handler functions
2677// as described in
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
2682//
2683// And now the NEW
2684//
2685// typedef void (*zero_arg_error_handler_t)();
2686//     a zero argument error handler function pointer
2687//
2688typedef void (*zero_arg_error_handler_t)();
2689
2690//
2691// In the spirit of the default GNU error handler functions
2692// as described in
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)
2697//
2698// And now the NEW
2699//
2700// extern void default_zero_arg_error_handler(const char *message);
2701//     do the default thing (abort)
2702//
2703extern void default_zero_arg_error_handler();
2704
2705// Guaranteed to exit (1)
2706extern void exit_zero_arg_error_handler();
2707extern void exit_one_arg_error_handler(const char *message);
2708extern void exit_two_arg_error_handler(const char *kind, const char *message);
2709
2710// Guaranteed to abort()
2711extern void abort_zero_arg_error_handler();
2712extern void abort_one_arg_error_handler(const char *message);
2713extern void abort_two_arg_error_handler(const char *kind, const char *message);
2714
2715//
2716// In the spirit of the standard GNU error handlers
2717// as described in
2718//     extern void  verbose_File_error_handler(const char*);
2719//         perror and set errno = 0
2720//     extern void  quiet_File_error_handler(const char*);
2721//         set errno = 0
2722//     extern void  fatal_File_error_handler(const char*);
2723//         perror and exit 1
2724//
2725// And now the NEW
2726//
2727// extern void preserve_File_error_handler(const char *message);
2728//     no perror, no assignment to errno.
2729//
2730extern void preserve_File_error_handler(const char *message);
2731
2732
2733//# 27 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
2734
2735//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
2736// -*- C++ -*-
2737//# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
2738
2739//# 28 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
2740
2741
2742//
2743// It is expected that this will be virtually multiply inherited
2744// into all of the classes that need error reporting services.
2745//
2746// The typical way to have that done is by inheriting the GttObject
2747// as a virtual base class.
2748//
2749
2750//
2751// GttErrorHandler class
2752//
2753class GttErrorHandler {
2754public:
2755    GttErrorHandler();
2756    GttErrorHandler(const char *program);
2757    virtual ~GttErrorHandler();
2758
2759    //
2760    // Error messages
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
2768    //
2769    static void error(const char *message);
2770    static void error(tostrstream& message);
2771
2772    static void error(const char *function, const char *message);
2773    static void error(const char *function, tostrstream& message);
2774
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);
2777
2778    //
2779    // Fatal messages
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
2785    //
2786    static void fatal(const char *message);
2787    static void fatal(tostrstream& message);
2788
2789    static void fatal(const char *function, const char *message);
2790    static void fatal(const char *function, tostrstream& message);
2791
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);
2794private:
2795    //
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.
2800    //
2801
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;
2807
2808    static void __handle_error();
2809    static void __handle_fatal();
2810    static void __add_newline(const char *message);
2811
2812    static bool __output_valid();
2813    static ostream *__output;
2814};
2815
2816
2817//# 27 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
2818
2819
2820//
2821// GttObject class (is abstract)
2822//
2823class GttObject: virtual public GttErrorHandler {
2824protected:
2825    GttObject();
2826    GttObject(const GttObject&);
2827    virtual ~GttObject();	// ensure descendants have virtual destructors
2828
2829public:
2830    //
2831    // I/O Support
2832    //
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();
2836protected:
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();
2843
2844public:
2845    //
2846    // Consistency
2847    //
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;
2854
2855protected:
2856    //
2857    // consistency
2858    //
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
2865    // as necessary.
2866    //
2867    // This function must NOT NEVER EVER be made virtual.
2868    void ok() const;
2869
2870protected:
2871    //
2872    // Class Name
2873    //
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
2878    // correctly.
2879    virtual const char *class_name() const = 0;
2880};
2881
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.
2885//
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.
2890//
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.
2895//
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.
2899
2900//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2901
2902//# 91 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
2903
2904extern ostream& operator<<(ostream&, GttObject&);
2905
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.
2909
2910
2911//# 27 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
2912
2913
2914//# 1 "../../../../../../mips/include/Gct/GctErrorHandler.h" 1
2915// -*- C++ -*-
2916
2917
2918
2919//
2920// GctErrorHandler class
2921//
2922// Expects to be included by Gct.h
2923//
2924// Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU)
2925//
2926
2927
2928
2929
2930
2931//#pragma interface
2932
2933
2934
2935//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
2936
2937
2938
2939
2940
2941
2942
2943//# 25 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
2944
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++ -*-
2947/*
2948Copyright (C) 1988 Free Software Foundation
2949    written by Doug Lea (dl@rocky.oswego.edu)
2950
2951This file is part of the GNU C++ Library.  This library is free
2952software; you can redistribute it and/or modify it under the terms of
2953the GNU Library General Public License as published by the Free
2954Software Foundation; either version 2 of the License, or (at your
2955option) any later version.  This library is distributed in the hope
2956that it will be useful, but WITHOUT ANY WARRANTY; without even the
2957implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
2958PURPOSE.  See the GNU Library General Public License for more details.
2959You should have received a copy of the GNU Library General Public
2960License along with this library; if not, write to the Free Software
2961Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2962*/
2963
2964
2965//# 1321 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h"
2966
2967//# 26 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
2968
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.
2972//
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.
2977//
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.
2982//
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.
2986
2987//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2988
2989//# 27 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
2990
2991
2992//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 1
2993// -*- C++ -*-
2994//# 107 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h"
2995
2996//# 29 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
2997
2998//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
2999// -*- C++ -*-
3000//# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
3001
3002//# 30 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
3003
3004
3005//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 1
3006// -*- C++ -*-
3007//# 98 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h"
3008
3009//# 32 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
3010
3011
3012//
3013// It is expected that this will be virtually multiply inherited
3014// into all of the classes that need error reporting services.
3015//
3016// The typical way to have that done is by inheriting the GctObject
3017// as a virtual base class.
3018//
3019
3020//
3021// GctErrorHandler class
3022//
3023// GPP_1_96_BUG
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
3026// GPP_1_96_BUG
3027class GctErrorHandler: virtual public GttObject {
3028public:
3029    GctErrorHandler();
3030    GctErrorHandler(const String& program);
3031    virtual ~GctErrorHandler();
3032
3033    //
3034    // Debugging messages
3035    //     - these are turned off for production code.
3036    //     - these messages can be shut off
3037    //
3038    static void debug(const char *message);
3039    static void debug(tostrstream& message);
3040
3041    static void debug(const char *function, const char *message);
3042    static void debug(const char *function, tostrstream& message);
3043
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);
3046
3047    static bool debug();		// current debug switch
3048    static void debug(bool value);	// change the debug switch
3049
3050    //
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
3055    //
3056    static void note(const char *message);
3057    static void note(tostrstream& message);
3058
3059    static void note(const char *function, const char *message);
3060    static void note(const char *function, tostrstream& message);
3061
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);
3064
3065    static bool note();			// current note switch
3066    static void note(bool value);	// change the note switch
3067
3068    //
3069    // Warning messages
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
3074    //
3075    static void warning(const char *message);
3076    static void warning(tostrstream& message);
3077
3078    static void warning(const char *function, const char *message);
3079    static void warning(const char *function, tostrstream& message);
3080
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);
3083
3084    static bool warning();		// current warning switch
3085    static void warning(bool value);	// change the warning switch
3086
3087    //
3088    // Error messages
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
3096    //
3097    static void error(const char *message);
3098    static void error(tostrstream& message);
3099
3100    static void error(const char *function, const char *message);
3101    static void error(const char *function, tostrstream& message);
3102
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);
3105
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
3109
3110    static void error_is_lib_error_handler();		// change the error handler
3111    static void error_is_exit();			// change the error handler
3112
3113    // Describes the fatal handler - WATCHOUT - implicitly uses AllocRing
3114    static const char *error_handler_description();
3115
3116    //
3117    // Fatal messages
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
3123    //
3124    static void fatal(const char *message);
3125    static void fatal(tostrstream& message);
3126
3127    static void fatal(const char *function, const char *message);
3128    static void fatal(const char *function, tostrstream& message);
3129
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);
3132
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
3136
3137    static void fatal_is_exit();	// change the fatal handler
3138    static void fatal_is_abort();	// change the fatal handler
3139
3140    // Describes the fatal handler - WATCHOUT - implicitly uses AllocRing
3141    static const char *fatal_handler_description();
3142private:
3143    //
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.
3148    //
3149    static bool __debug;
3150    static bool __note;
3151    static bool __warning;
3152    static void (*__error_handler)();	// can't turn off errors
3153    static void (*__fatal_handler)();	// can't turn off fatals
3154
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;
3160
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);
3167
3168    static bool __output_valid();
3169    static ostream *__output;
3170
3171    // GPP_1_96_BUG
3172    const char *class_name() const;
3173    // GPP_1_96_BUG
3174};
3175
3176
3177//# 29 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
3178
3179
3180//
3181// GctObject class (is abstract)
3182//
3183class GctObject: virtual public GctErrorHandler /*, virtual public GttObject*/ {
3184protected:
3185    GctObject();
3186    GctObject(const GctObject&);
3187    virtual ~GctObject();	// ensure descendants have virtual destructors
3188
3189public:
3190    //
3191    // I/O Support
3192    //
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();
3196protected:
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();
3203
3204public:
3205    //
3206    // Consistency (global consistency)
3207    //
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;
3214
3215protected:
3216    //
3217    // consistency (local consistency)
3218    //
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
3225    // as necessary.
3226    //
3227    // This function must NOT NEVER EVER be made virtual.
3228    void ok() const;
3229protected:
3230    //
3231    // Class Name
3232    //
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
3237    // correctly.
3238    virtual const char *class_name() const = 0;
3239
3240public:
3241    //
3242    // The ``id'' of this object
3243    //
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).
3247    //
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;
3252private:
3253    //
3254    // Symbolic ID
3255    //
3256    // NOTE - Normally this would be implemented by the `this' pointer.
3257    // TODO - remove this for production code
3258    //
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;
3264};
3265
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.
3269//
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.
3274//
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.
3279//
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.
3283
3284//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
3285
3286//# 117 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
3287
3288extern ostream& operator<<(ostream&, GctObject&);
3289
3290
3291//# 25 "../../../../../../mips/include/Gct/Object/GctHashObject.h" 2
3292
3293
3294//
3295// GctHashObject class (is abstract)
3296//
3297class GctHashObject: virtual public GctObject {
3298protected:
3299    GctHashObject();
3300    GctHashObject(const GctHashObject&);
3301
3302public:
3303    //
3304    // hash support
3305    //
3306    virtual unsigned hash() const;
3307};
3308
3309
3310//# 28 "../../GctSymbol.h" 2
3311
3312
3313//
3314// GctSymbol
3315//
3316class GctSymbol: virtual public GctHashObject, String {
3317public:
3318    GctSymbol();		// vacuous symbol required for genclass usage
3319    GctSymbol(const char*);
3320    GctSymbol(const String&);
3321    GctSymbol(const GctSymbol&);
3322
3323    operator const char *() const;
3324
3325    bool operator==(const GctSymbol&) const;
3326    bool operator!=(const GctSymbol&) const;
3327
3328    bool operator<=(const GctSymbol&) const;
3329    bool operator<(const GctSymbol&) const;
3330    bool operator>=(const GctSymbol&) const;
3331    bool operator>(const GctSymbol&) const;
3332
3333    unsigned hash() const;
3334
3335    // I/O Support
3336    const char *stringify();
3337
3338    // Consistency
3339    void OK() const;
3340private:
3341    const char *class_name() const;
3342};
3343
3344extern unsigned hash(GctSymbol&);	// genclass support (no const)
3345
3346//
3347// Inline functions
3348//
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.
3352//
3353
3354
3355
3356
3357
3358GctSymbol::operator const char *() const
3359{
3360
3361
3362
3363
3364
3365    return String::operator const char *();
3366}
3367
3368bool
3369GctSymbol::operator==(const GctSymbol& other) const
3370{
3371
3372
3373
3374
3375
3376    return (bool)::operator==(*this, other);
3377}
3378
3379bool
3380GctSymbol::operator!=(const GctSymbol& other) const
3381{
3382
3383
3384
3385
3386
3387    return (bool)::operator!=(*this, other);
3388}
3389
3390bool
3391GctSymbol::operator<=(const GctSymbol& other) const
3392{
3393
3394
3395
3396
3397
3398    return (bool)::operator<=(*this, other);
3399}
3400
3401bool
3402GctSymbol::operator<(const GctSymbol& other) const
3403{
3404
3405
3406
3407
3408
3409    return (bool)::operator<(*this, other);
3410}
3411
3412bool
3413GctSymbol::operator>=(const GctSymbol& other) const
3414{
3415
3416
3417
3418
3419
3420    return (bool)::operator>=(*this, other);
3421}
3422
3423bool
3424GctSymbol::operator>(const GctSymbol& other) const
3425{
3426
3427
3428
3429
3430
3431    return (bool)::operator>(*this, other);
3432}
3433
3434
3435//# 25 "GctSymbol.defs.h" 2
3436
3437
3438// equality operator
3439
3440
3441
3442
3443// less-than-or-equal
3444
3445
3446
3447
3448// comparison : less-than ->  0
3449
3450
3451
3452
3453// hash function
3454
3455extern unsigned int hash(GctSymbol&);
3456
3457
3458
3459// initial capacity for structures requiring one
3460
3461
3462
3463
3464
3465
3466
3467//# 27 "GctSymbol.GctSymbol.Map.h" 2
3468
3469
3470class GctSymbolGctSymbolMap
3471{
3472protected:
3473  int                   count;
3474  GctSymbol                   def;
3475
3476public:
3477                        GctSymbolGctSymbolMap(GctSymbol& dflt);
3478  virtual              ~GctSymbolGctSymbolMap();
3479
3480  int                   length();                // current number of items
3481  int                   empty();
3482
3483  virtual int           contains(GctSymbol& key);      // is key mapped?
3484
3485  virtual void          clear();                 // delete all items
3486
3487  virtual GctSymbol&          operator [] (GctSymbol& key) = 0; // access contents by key
3488
3489  virtual void          del(GctSymbol& key) = 0;       // delete entry
3490
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
3495
3496  virtual int           owns(Pix i);             // is i a valid Pix  ?
3497  virtual Pix           seek(GctSymbol& key);          // Pix of key
3498
3499  GctSymbol&                  dflt();                  // access default val
3500
3501  void                  error(const char* msg);
3502  virtual int           OK() = 0;                // rep invariant
3503};
3504
3505
3506
3507inline GctSymbolGctSymbolMap::~GctSymbolGctSymbolMap() {}
3508
3509inline int GctSymbolGctSymbolMap::length()
3510{
3511  return count;
3512}
3513
3514inline int GctSymbolGctSymbolMap::empty()
3515{
3516  return count == 0;
3517}
3518
3519inline GctSymbol& GctSymbolGctSymbolMap::dflt()
3520{
3521  return def;
3522}
3523
3524inline GctSymbolGctSymbolMap::GctSymbolGctSymbolMap(GctSymbol& dflt) :def(dflt)
3525{
3526  count = 0;
3527}
3528
3529
3530
3531
3532//# 26 "GctSymbol.GctSymbol.CHMap.h" 2
3533
3534
3535
3536
3537
3538struct GctSymbolGctSymbolCHNode
3539{
3540  GctSymbolGctSymbolCHNode*      tl;
3541  GctSymbol                hd;
3542  GctSymbol                cont;
3543                     GctSymbolGctSymbolCHNode();
3544                     GctSymbolGctSymbolCHNode(GctSymbol& h, GctSymbol& c, GctSymbolGctSymbolCHNode* t = 0);
3545                     ~GctSymbolGctSymbolCHNode();
3546};
3547
3548
3549
3550inline GctSymbolGctSymbolCHNode::GctSymbolGctSymbolCHNode() {}
3551
3552inline GctSymbolGctSymbolCHNode::GctSymbolGctSymbolCHNode(GctSymbol& h, GctSymbol& c, GctSymbolGctSymbolCHNode* t)
3553     : hd(h), cont(c), tl(t) {}
3554
3555inline GctSymbolGctSymbolCHNode::~GctSymbolGctSymbolCHNode() {}
3556
3557
3558
3559
3560typedef GctSymbolGctSymbolCHNode* GctSymbolGctSymbolCHNodePtr;
3561
3562
3563
3564
3565class GctSymbolGctSymbolCHMap : public GctSymbolGctSymbolMap
3566{
3567protected:
3568  GctSymbolGctSymbolCHNode** tab;
3569  unsigned int   size;
3570
3571public:
3572                GctSymbolGctSymbolCHMap(GctSymbol& dflt,unsigned int sz=100 );
3573                GctSymbolGctSymbolCHMap(GctSymbolGctSymbolCHMap& a);
3574                ~GctSymbolGctSymbolCHMap();
3575
3576  GctSymbol&          operator [] (GctSymbol& key);
3577
3578  void          del(GctSymbol& key);
3579
3580  Pix           first();
3581  void          next(Pix& i);
3582  GctSymbol&          key(Pix i);
3583  GctSymbol&          contents(Pix i);
3584
3585  Pix           seek(GctSymbol& key);
3586  int           contains(GctSymbol& key);
3587
3588  void          clear();
3589  int           OK();
3590};
3591
3592
3593
3594inline GctSymbolGctSymbolCHMap::~GctSymbolGctSymbolCHMap()
3595{
3596  clear();
3597  delete tab;
3598}
3599
3600inline int GctSymbolGctSymbolCHMap::contains(GctSymbol& key)
3601{
3602  return seek(key) != 0;
3603}
3604
3605inline GctSymbol& GctSymbolGctSymbolCHMap::key(Pix p)
3606{
3607  if (p == 0) error("null Pix");
3608  return ((GctSymbolGctSymbolCHNode*)p)->hd;
3609}
3610
3611inline GctSymbol& GctSymbolGctSymbolCHMap::contents(Pix p)
3612{
3613  if (p == 0) error("null Pix");
3614  return ((GctSymbolGctSymbolCHNode*)p)->cont;
3615}
3616
3617
3618
3619
3620//# 22 "GctSymbol.GctSymbol.CHMap.cc" 2
3621
3622
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
3627
3628static inline int goodCHptr(GctSymbolGctSymbolCHNode* t)
3629{
3630  return ((((unsigned)t) & 1) == 0);
3631}
3632
3633static inline GctSymbolGctSymbolCHNode* index_to_CHptr(int i)
3634{
3635  return (GctSymbolGctSymbolCHNode*)((i << 1) + 1);
3636}
3637
3638static inline int CHptr_to_index(GctSymbolGctSymbolCHNode* t)
3639{
3640  return ( ((unsigned) t) >> 1);
3641}
3642
3643GctSymbolGctSymbolCHMap::GctSymbolGctSymbolCHMap(GctSymbol& dflt, unsigned int sz)
3644     :GctSymbolGctSymbolMap(dflt)
3645{
3646  tab = (GctSymbolGctSymbolCHNode**)(new GctSymbolGctSymbolCHNodePtr[size = sz]);
3647  for (unsigned int i = 0; i < size; ++i) tab[i] = index_to_CHptr(i+1);
3648  count = 0;
3649}
3650
3651GctSymbolGctSymbolCHMap::GctSymbolGctSymbolCHMap(GctSymbolGctSymbolCHMap& a) :GctSymbolGctSymbolMap(a.def)
3652{
3653  tab = (GctSymbolGctSymbolCHNode**)(new GctSymbolGctSymbolCHNodePtr[size = a.size]);
3654  for (unsigned int i = 0; i < size; ++i) tab[i] = index_to_CHptr(i+1);
3655  count = 0;
3656  for (Pix p = a.first(); p; a.next(p)) (*this)[a.key(p)] = a.contents(p); // gets bogus error - type `GctSymbol' is derived from private `String'
3657}
3658