OSDN Git Service

Initial revision
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.mike / p784.C
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 /*
8 Copyright (C) 1988 Free Software Foundation
9     written by Doug Lea (dl@rocky.oswego.edu)
10
11 This file is part of the GNU C++ Library.  This library is free
12 software; you can redistribute it and/or modify it under the terms of
13 the GNU Library General Public License as published by the Free
14 Software Foundation; either version 2 of the License, or (at your
15 option) any later version.  This library is distributed in the hope
16 that it will be useful, but WITHOUT ANY WARRANTY; without even the
17 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18 PURPOSE.  See the GNU Library General Public License for more details.
19 You should have received a copy of the GNU Library General Public
20 License along with this library; if not, write to the Free Software
21 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
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 /*
30 Copyright (C) 1988 Free Software Foundation
31     written by Doug Lea (dl@rocky.oswego.edu)
32
33 This file is part of the GNU C++ Library.  This library is free
34 software; you can redistribute it and/or modify it under the terms of
35 the GNU Library General Public License as published by the Free
36 Software Foundation; either version 2 of the License, or (at your
37 option) any later version.  This library is distributed in the hope
38 that it will be useful, but WITHOUT ANY WARRANTY; without even the
39 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
40 PURPOSE.  See the GNU Library General Public License for more details.
41 You should have received a copy of the GNU Library General Public
42 License along with this library; if not, write to the Free Software
43 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
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 /*
56 Copyright (C) 1988 Free Software Foundation
57     written by Doug Lea (dl@rocky.oswego.edu)
58
59 This file is part of the GNU C++ Library.  This library is free
60 software; you can redistribute it and/or modify it under the terms of
61 the GNU Library General Public License as published by the Free
62 Software Foundation; either version 2 of the License, or (at your
63 option) any later version.  This library is distributed in the hope
64 that it will be useful, but WITHOUT ANY WARRANTY; without even the
65 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
66 PURPOSE.  See the GNU Library General Public License for more details.
67 You should have received a copy of the GNU Library General Public
68 License along with this library; if not, write to the Free Software
69 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
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
83 typedef 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 /*
90 Copyright (C) 1988 Free Software Foundation
91     written by Doug Lea (dl@rocky.oswego.edu)
92
93 This file is part of the GNU C++ Library.  This library is free
94 software; you can redistribute it and/or modify it under the terms of
95 the GNU Library General Public License as published by the Free
96 Software Foundation; either version 2 of the License, or (at your
97 option) any later version.  This library is distributed in the hope
98 that it will be useful, but WITHOUT ANY WARRANTY; without even the
99 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
100 PURPOSE.  See the GNU Library General Public License for more details.
101 You should have received a copy of the GNU Library General Public
102 License along with this library; if not, write to the Free Software
103 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
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 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
133 // $Author: jason $
134 // $Revision: 1.6 $
135 // $Date: 1994/05/16 09:13:02 $
136
137 #include <bool.h>
138
139 //# 25 "../../GctSymbol.h" 2
140
141 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 1
142 // This may look like C code, but it is really -*- C++ -*-
143 /*
144 Copyright (C) 1988 Free Software Foundation
145     written by Doug Lea (dl@rocky.oswego.edu)
146
147 This file is part of the GNU C++ Library.  This library is free
148 software; you can redistribute it and/or modify it under the terms of
149 the GNU Library General Public License as published by the Free
150 Software Foundation; either version 2 of the License, or (at your
151 option) any later version.  This library is distributed in the hope
152 that it will be useful, but WITHOUT ANY WARRANTY; without even the
153 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
154 PURPOSE.  See the GNU Library General Public License for more details.
155 You should have received a copy of the GNU Library General Public
156 License along with this library; if not, write to the Free Software
157 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
158 */
159
160
161
162
163 //#pragma interface
164
165
166
167 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stream.h" 1
168
169
170
171 // Compatibility with old library.
172
173
174 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
175 //    This is part of the iostream library, providing -*- C++ -*- input/output.
176 //    Copyright (C) 1991 Per Bothner.
177 //
178 //    This library is free software; you can redistribute it and/or
179 //    modify it under the terms of the GNU Library General Public
180 //    License as published by the Free Software Foundation; either
181 //    version 2 of the License, or (at your option) any later version.
182 //
183 //    This library is distributed in the hope that it will be useful,
184 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
185 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
186 //    Library General Public License for more details.
187 //
188 //    You should have received a copy of the GNU Library General Public
189 //    License along with this library; if not, write to the Free
190 //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
191
192
193
194 //#pragma interface
195
196
197
198
199 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/streambuf.h" 1
200 //    This is part of the iostream library, providing -*- C++ -*- input/output.
201 //    Copyright (C) 1991 Per Bothner.
202 //
203 //    This library is free software; you can redistribute it and/or
204 //    modify it under the terms of the GNU Library General Public
205 //    License as published by the Free Software Foundation; either
206 //    version 2 of the License, or (at your option) any later version.
207 //
208 //    This library is distributed in the hope that it will be useful,
209 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
210 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
211 //    Library General Public License for more details.
212 //
213 //    You should have received a copy of the GNU Library General Public
214 //    License along with this library; if not, write to the Free
215 //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
216
217
218
219
220 //#pragma interface
221
222
223 /* KLUDGES!! */
224 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 1
225
226
227 extern "C" {
228
229
230
231 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/mips/lib/gcc/decstatn/cygnus-1.96/include/stddef.h" 1
232
233
234
235
236
237
238 /* This avoids lossage on Sunos but only if stdtypes.h comes first.
239    There's no way to win with the other order!  Sun lossage.  */
240
241 /* In case nobody has defined these types, but we aren't running under
242    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
243    __WCHAR_TYPE__ have reasonable values.  This can happen if the
244    parts of GCC is compiled by an older compiler, that actually
245    include gstddef.h, such as collect2.  */
246
247 /* Signed type of difference of two pointers.  */
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262 typedef long int ptrdiff_t;
263
264
265
266
267
268
269 /* Unsigned type of `sizeof' something.  */
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284 typedef unsigned int size_t;
285
286
287
288
289
290
291 /* Data type for wide chars.  */
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306 typedef int wchar_t;
307
308
309
310
311
312
313
314
315 /* A null pointer constant.  */
316
317
318
319
320 /* Offset of member MEMBER in a struct of type TYPE.  */
321
322
323
324
325
326 //# 7 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 2
327
328
329
330
331 }
332
333 //# 25 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/streambuf.h" 2
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350 class ostream; class streambuf;
351
352 typedef long streamoff, streampos;
353
354 struct _ios_fields { // The data members of an ios.
355     streambuf *_strbuf;
356     ostream* _tie;
357     long _width;
358     unsigned long _flags;
359     char _fill;
360     unsigned char _state;
361     unsigned short _precision;
362 };
363
364
365 enum state_value { _good = 0, _eof = 1,  _fail = 2, _bad  = 4 };
366
367
368 class ios : public _ios_fields {
369   public:
370     enum io_state { goodbit=0, eofbit=1, failbit=2, badbit=4 };
371     enum open_mode {
372         in=1,
373         out=2,
374         ate=4,
375         app=8,
376         trunc=16,
377         nocreate=32,
378         noreplace=64 };
379     enum seek_dir { beg, cur, end};
380     enum { skipws=01, left=02, right=04, internal=010,
381            dec=020, oct=040, hex=0100,
382            showbase=0200, showpoint=0400, uppercase=01000, showpos=02000,
383            scientific=04000, fixed=0100000, unitbuf=020000, stdio=040000,
384            dont_close=0x80000000 //Don't close streambuf when destroying stream
385            };
386
387     ostream* tie() { return _tie; }
388     ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; }
389
390     // Methods to change the format state.
391     char fill() { return _fill; }
392     char fill(char newf) { char oldf = _fill; _fill = newf; return oldf; }
393     unsigned long flags() { return _flags; }
394     unsigned long flags(unsigned long new_val) {
395         unsigned long old_val = _flags; _flags = new_val; return old_val; }
396     unsigned short precision() { return _precision; }
397     unsigned short precision(int newp) {
398         unsigned short oldp = _precision; _precision = (unsigned short)newp;
399         return oldp; }
400     unsigned long setf(unsigned long val) {
401         unsigned long oldbits = _flags;
402         _flags |= val; return oldbits; }
403     unsigned long setf(unsigned long val, unsigned long mask) {
404         unsigned long oldbits = _flags;
405         _flags = (_flags & ~mask) | (val & mask); return oldbits; }
406     unsigned long unsetf(unsigned long mask) {
407         unsigned long oldbits = _flags & mask;
408         _flags &= ~mask; return oldbits; }
409     long width() { return _width; }
410     long width(long val) { long save = _width; _width = val; return save; }
411
412     static const unsigned long basefield;
413     static const unsigned long adjustfield;
414     static const unsigned long floatfield;
415
416     streambuf* rdbuf() { return _strbuf; }
417     void clear(int state = 0) { _state = state; }
418     int good() { return _state == 0; }
419     int eof() { return _state & ios::eofbit; }
420     int fail() { return _state & (ios::badbit|ios::failbit); }
421     int bad() { return _state & ios::badbit; }
422     int rdstate() { return _state; }
423     void set(int flag) { _state |= flag; }
424     operator void*() { return fail() ? (void*)0 : (void*)this; }
425     int operator!() { return fail(); }
426
427
428     void unset(state_value flag) { _state &= ~flag; }
429     void close();
430     int is_open();
431     int readable();
432     int writable();
433
434
435   protected:
436     ios(streambuf*sb) { _strbuf=sb; _state=0; _width=0; _fill=' ';
437                         _flags=ios::skipws; _precision=6; }
438 };
439
440
441
442
443 typedef ios::seek_dir _seek_dir;
444
445
446 // Magic numbers and bits for the _flags field.
447 // The magic numbers use the high-order bits of _flags;
448 // the remaining bits are abailable for variable flags.
449 // Note: The magic numbers must all be negative if stdio
450 // emulation is desired.
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466 struct __streambuf {
467     // NOTE: If this is changed, also change __FILE in stdio/stdio.h!
468     int _flags;         /* High-order word is _IO_MAGIC; rest is flags. */
469     char* _gptr;        /* Current get pointer */
470     char* _egptr;       /* End of get area. */
471     char* _eback;       /* Start of putback+get area. */
472     char* _pbase;       /* Start of put area. */
473     char* _pptr;        /* Current put pointer. */
474     char* _epptr;       /* End of put area. */
475     char* _base;        /* Start of reserve area. */
476     char* _ebuf;        /* End of reserve area. */
477     struct streambuf *_chain;
478 };
479
480 struct streambuf : private __streambuf {
481     friend class ios;
482     friend class istream;
483     friend class ostream;
484   protected:
485     static streambuf* _list_all; /* List of open streambufs. */
486     streambuf*& xchain() { return _chain; }
487     void _un_link();
488     void _link_in();
489     char* gptr() const { return _gptr; }
490     char* pptr() const { return _pptr; }
491     char* egptr() const { return _egptr; }
492     char* epptr() const { return _epptr; }
493     char* pbase() const { return _pbase; }
494     char* eback() const { return _eback; }
495     char* ebuf() const { return _ebuf; }
496     char* base() const { return _base; }
497     void xput_char(char c) { *_pptr++ = c; }
498     int xflags() { return _flags; }
499     int xflags(int f) { int fl = _flags; _flags = f; return fl; }
500     void xsetflags(int f) { _flags |= f; }
501     void gbump(int n) { _gptr += n; }
502     void pbump(int n) { _pptr += n; }
503     void setb(char* b, char* eb, int a=0);
504     void setp(char* p, char* ep) { _pbase=_pptr=p; _epptr=ep; }
505     void setg(char* eb, char* g, char *eg) { _eback=eb; _gptr=g; _egptr=eg; }
506   public:
507     static int flush_all();
508     static void flush_all_linebuffered(); // Flush all line buffered files.
509     virtual int underflow(); // Leave public for now
510     virtual int overflow(int c = (-1) ); // Leave public for now
511     virtual int doallocate();
512     virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
513     virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out);
514     int sputbackc(char c);
515     int sungetc();
516     streambuf();
517     virtual ~streambuf();
518     int unbuffered() { return _flags & 2  ? 1 : 0; }
519     int linebuffered() { return _flags & 0x4000  ? 1 : 0; }
520     void unbuffered(int i)
521         { if (i) _flags |= 2 ; else _flags &= ~2 ; }
522     void linebuffered(int i)
523         { if (i) _flags |= 0x4000 ; else _flags &= ~0x4000 ; }
524     int allocate() {
525         if (base() || unbuffered()) return 0;
526         else return doallocate(); }
527     virtual int sync();
528     virtual int pbackfail(int c);
529     virtual int ungetfail();
530     virtual streambuf* setbuf(char* p, int len);
531     int in_avail() { return _egptr - _gptr; }
532     int out_waiting() { return _pptr - _pbase; }
533     virtual int sputn(const char* s, int n);
534     virtual int sgetn(char* s, int n);
535     long sgetline(char* buf, size_t n, char delim, int putback_delim);
536     int sbumpc() {
537         if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
538         else return *(unsigned char*)_gptr++; }
539     int sgetc() {
540         if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
541         else return *(unsigned char*)_gptr; }
542     int snextc() {
543         if (++_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
544         else return *(unsigned char*)_gptr; }
545     int sputc(int c) {
546         if (_pptr >= _epptr) return overflow(c);
547         return *_pptr++ = c, (unsigned char)c; }
548     int vscan(char const *fmt0, char*  ap);
549     int vform(char const *fmt0, char*  ap);
550 };
551
552 struct __file_fields {
553     char _fake;
554     char _shortbuf[1];
555     short _fileno;
556     int _blksize;
557     char* _save_gptr;
558     char* _save_egptr;
559     long  _offset;
560 };
561
562 class filebuf : public streambuf {
563     struct __file_fields _fb;
564     void init();
565   public:
566     filebuf();
567     filebuf(int fd);
568     filebuf(int fd, char* p, int len);
569     ~filebuf();
570     filebuf* attach(int fd);
571     filebuf* open(const char *filename, const char *mode);
572     filebuf* open(const char *filename, int mode, int prot = 0664);
573     virtual int underflow();
574     virtual int overflow(int c = (-1) );
575     int is_open() { return _fb._fileno >= 0; }
576     int fd() { return is_open() ? _fb._fileno : (-1) ; }
577     filebuf* close();
578     virtual int doallocate();
579     virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
580     int sputn(const char* s, int n);
581     int sgetn(char* s, int n);
582   protected: // See documentation in filebuf.C.
583     virtual int pbackfail(int c);
584     virtual int sync();
585     int is_reading() { return eback() != egptr(); }
586     char* cur_ptr() { return is_reading() ?  gptr() : pptr(); }
587     /* System's idea of pointer */
588     char* file_ptr() { return _fb._save_gptr ? _fb._save_egptr : egptr(); }
589     int do_flush();
590     // Low-level operations (Usually invoke system calls.)
591     virtual int sys_read(char* buf, size_t size);
592     virtual long  sys_seek(long , _seek_dir);
593     virtual long sys_write(const void*, long);
594     virtual int sys_stat(void*); // Actually, a (struct stat*)
595     virtual int sys_close();
596 };
597
598
599 inline int ios::readable() { return rdbuf()->_flags & 4 ; }
600 inline int ios::writable() { return rdbuf()->_flags & 8 ; }
601 inline int ios::is_open() {return rdbuf()->_flags & 4 +8 ;}
602
603
604
605
606 //# 25 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 2
607
608
609 class istream; class ostream;
610 typedef istream& (*__imanip)(istream&);
611 typedef ostream& (*__omanip)(ostream&);
612
613 extern istream& ws(istream& ins);
614 extern ostream& flush(ostream& outs);
615 extern ostream& endl(ostream& outs);
616 extern ostream& ends(ostream& outs);
617
618 class ostream : public ios
619 {
620     void do_osfx();
621   public:
622     ostream();
623     ostream(streambuf* sb, ostream* tied=((void *)0) );
624     ~ostream();
625
626     int opfx() { if (!good()) return 0; if (_tie) _tie->flush(); return 1; }
627     void osfx() { if (flags() & (ios::unitbuf|ios::stdio))
628                       do_osfx(); }
629     streambuf* ostreambuf() const { return _strbuf; }
630     ostream& flush();
631     ostream& put(char c);
632     ostream& write(const char *s, int n);
633     ostream& write(const unsigned char *s, int n) { return write((char*)s, n);}
634     ostream& write(const void *s, int n) { return write((char*)s, n);}
635     ostream& seekp(streampos);
636     ostream& seekp(streamoff, _seek_dir);
637     streampos tellp();
638     ostream& form(const char *format ...);
639     ostream& vform(const char *format, char*  args);
640 };
641
642 ostream& operator<<(ostream&, char c);
643 ostream& operator<<(ostream& os, unsigned char c) { return os << (char)c; }
644 //ostream& operator<<(ostream &os, signed char c) { return os << (char)c; }
645 extern ostream& operator<<(ostream&, const char *s);
646 inline ostream& operator<<(ostream& os, const unsigned char *s)
647 { return os << (const char*)s; }
648 //inline ostream& operator<<(ostream& os, const signed char *s)
649 //{ return os << (const char*)s; }
650 ostream& operator<<(ostream&, void *p);
651 ostream& operator<<(ostream&, int n);
652 ostream& operator<<(ostream&, long n);
653 ostream& operator<<(ostream&, unsigned int n);
654 ostream& operator<<(ostream&, unsigned long n);
655 ostream& operator<<(ostream& os, short n) {return os << (int)n;}
656 ostream& operator<<(ostream& os, unsigned short n)
657 {return os << (unsigned int)n;}
658 ostream& operator<<(ostream&, float n);
659 ostream& operator<<(ostream&, double n);
660 ostream& operator<<(ostream& os, __omanip func) { return (*func)(os); }
661 ostream& operator<<(ostream&, streambuf*);
662
663 class istream : public ios
664 {
665     size_t _gcount;
666   public:
667     istream();
668     istream(streambuf* sb, ostream*tied=((void *)0) );
669     ~istream();
670     streambuf* istreambuf() const { return _strbuf; }
671     istream& get(char& c);
672     istream& get(unsigned char& c);
673     istream& read(char *ptr, int n);
674     istream& read(unsigned char *ptr, int n) { return read((char*)ptr, n); }
675     istream& read(void *ptr, int n) { return read((char*)ptr, n); }
676     int get() { return _strbuf->sbumpc(); }
677     istream& getline(char* ptr, int len, char delim = '\n');
678     istream& get(char* ptr, int len, char delim = '\n');
679     istream& gets(char **s, char delim = '\n');
680     int ipfx(int need) {
681         if (!good()) { set(ios::failbit); return 0; }
682         if (_tie && (need == 0 || rdbuf()->in_avail())) ;  //??? THIS LINE IS QUESTIONABLE */
683         if (!need && (flags() & ios::skipws) && !ws(*this)) return 0;
684         return 1;
685     }
686     int ipfx0() { // Optimized version of ipfx(0).
687         if (!good()) { set(ios::failbit); return 0; }
688         if (_tie) _tie->flush();
689         if ((flags() & ios::skipws) && !ws(*this)) return 0;
690         return 1;
691     }
692     int ipfx1() { // Optimized version of ipfx(1).
693         if (!good()) { set(ios::failbit); return 0; }
694         if (_tie && rdbuf()->in_avail() == 0) _tie->flush();
695         return 1;
696     }
697     size_t gcount() { return _gcount; }
698     istream& seekg(streampos);
699     istream& seekg(streamoff, _seek_dir);
700     streampos tellg();
701     istream& putback(char ch) {
702         if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit);
703         return *this;}
704     istream& unget() {
705         if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit);
706         return *this;}
707
708     istream& unget(char ch) { return putback(ch); }
709     int skip(int i);
710
711 };
712
713 istream& operator>>(istream&, char*);
714 istream& operator>>(istream& is, unsigned char* p) { return is >> (char*)p; }
715 //istream& operator>>(istream& is, signed char* p) { return is >> (char*)p; }
716 istream& operator>>(istream&, char& c);
717 istream& operator>>(istream&, unsigned char& c);
718 //istream& operator>>(istream&, signed char& c);
719 istream& operator>>(istream&, int&);
720 istream& operator>>(istream&, long&);
721 istream& operator>>(istream&, short&);
722 istream& operator>>(istream&, unsigned int&);
723 istream& operator>>(istream&, unsigned long&);
724 istream& operator>>(istream&, unsigned short&);
725 istream& operator>>(istream&, float&);
726 istream& operator>>(istream&, double&);
727 istream& operator>>(istream& is, __imanip func) { return (*func)(is); }
728
729 class iostream : public ios {
730     size_t _gcount;
731   public:
732     iostream();
733     operator istream&() { return *(istream*)this; }
734     operator ostream&() { return *(ostream*)this; }
735     ~iostream();
736     // NOTE: These duplicate istream methods.
737     istream& get(char& c) { return ((istream*)this)->get(c); }
738     istream& get(unsigned char& c) { return ((istream*)this)->get(c); }
739     istream& read(char *ptr, int n) { return ((istream*)this)->read(ptr, n); }
740     istream& read(unsigned char *ptr, int n)
741         { return ((istream*)this)->read((char*)ptr, n); }
742     istream& read(void *ptr, int n)
743         { return ((istream*)this)->read((char*)ptr, n); }
744     int get() { return _strbuf->sbumpc(); }
745     istream& getline(char* ptr, int len, char delim = '\n')
746         { return ((istream*)this)->getline(ptr, len, delim); }
747     istream& get(char* ptr, int len, char delim = '\n')
748         { return ((istream*)this)->get(ptr, len, delim); }
749     istream& gets(char **s, char delim = '\n')
750         { return ((istream*)this)->gets(s, delim); }
751     int ipfx(int need) { return ((istream*)this)->ipfx(need); }
752     int ipfx0()  { return ((istream*)this)->ipfx0(); }
753     int ipfx1()  { return ((istream*)this)->ipfx1(); }
754     size_t gcount() { return _gcount; }
755     istream& putback(char ch) { return ((istream*)this)->putback(ch); }
756     istream& unget() { return ((istream*)this)->unget(); }
757     istream& seekg(streampos pos) { return ((istream*)this)->seekg(pos); }
758     istream& seekg(streamoff off, _seek_dir dir)
759         { return ((istream*)this)->seekg(off, dir); }
760     streampos tellg() { return ((istream*)this)->tellg(); }
761
762     istream& unget(char ch) { return putback(ch); }
763
764
765     // NOTE: These duplicate ostream methods.
766     int opfx() { return ((ostream*)this)->opfx(); }
767     void osfx() { ((ostream*)this)->osfx(); }
768     ostream& flush() { return ((ostream*)this)->flush(); }
769     ostream& put(char c) { return ((ostream*)this)->put(c); }
770     ostream& write(const char *s, int n)
771         { return ((ostream*)this)->write(s, n); }
772     ostream& write(const unsigned char *s, int n)
773         { return ((ostream*)this)->write((char*)s, n); }
774     ostream& write(const void *s, int n)
775         { return ((ostream*)this)->write((char*)s, n); }
776     ostream& form(const char *format ...);
777     ostream& vform(const char *format, char*  args)
778         { return ((ostream*)this)->vform(format, args); }
779     ostream& seekp(streampos pos) { return ((ostream*)this)->seekp(pos); }
780     ostream& seekp(streamoff off, _seek_dir dir)
781         { return ((ostream*)this)->seekp(off, dir); }
782     streampos tellp() { return ((ostream*)this)->tellp(); }
783 };
784
785 extern istream cin;
786 extern ostream cout, cerr, clog; // clog->rdbuf() == cerr->rdbuf()
787
788 inline ostream& ostream::put(char c) { _strbuf->sputc(c); return *this; }
789
790 struct Iostream_init { } ;  // Compatibility hack for AT&T libraray.
791
792
793 //# 7 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stream.h" 2
794
795
796 extern char* form(char*, ...);
797
798 extern char* dec(long, int=0);
799 extern char* dec(int, int=0);
800 extern char* dec(unsigned long, int=0);
801 extern char* dec(unsigned int, int=0);
802
803 extern char* hex(long, int=0);
804 extern char* hex(int, int=0);
805 extern char* hex(unsigned long, int=0);
806 extern char* hex(unsigned int, int=0);
807
808 extern char* oct(long, int=0);
809 extern char* oct(int, int=0);
810 extern char* oct(unsigned long, int=0);
811 extern char* oct(unsigned int, int=0);
812
813 inline istream& WS(istream& str) { return ws(str); }
814
815
816 //# 26 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 2
817
818 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/Regex.h" 1
819 // This may look like C code, but it is really -*- C++ -*-
820 /*
821 Copyright (C) 1988 Free Software Foundation
822     written by Doug Lea (dl@rocky.oswego.edu)
823
824 This file is part of the GNU C++ Library.  This library is free
825 software; you can redistribute it and/or modify it under the terms of
826 the GNU Library General Public License as published by the Free
827 Software Foundation; either version 2 of the License, or (at your
828 option) any later version.  This library is distributed in the hope
829 that it will be useful, but WITHOUT ANY WARRANTY; without even the
830 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
831 PURPOSE.  See the GNU Library General Public License for more details.
832 You should have received a copy of the GNU Library General Public
833 License along with this library; if not, write to the Free Software
834 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
835 */
836
837
838
839
840 //#pragma interface
841
842
843
844
845
846
847
848
849
850 struct re_pattern_buffer;       // defined elsewhere
851 struct re_registers;
852
853 class Regex
854 {
855 private:
856
857                      Regex(const Regex&) {}  // no X(X&)
858   void               operator = (const Regex&) {} // no assignment
859
860 protected:
861   re_pattern_buffer* buf;
862   re_registers*      reg;
863
864 public:
865                      Regex(const char* t,
866                            int fast = 0,
867                            int bufsize = 40,
868                            const char* transtable = 0);
869
870                     ~Regex();
871
872   int                match(const char* s, int len, int pos = 0) const;
873   int                search(const char* s, int len,
874                             int& matchlen, int startpos = 0) const;
875   int                match_info(int& start, int& length, int nth = 0) const;
876
877   int                OK() const;  // representation invariant
878 };
879
880 // some built in regular expressions
881
882 extern const Regex RXwhite;          // = "[ \n\t\r\v\f]+"
883 extern const Regex RXint;            // = "-?[0-9]+"
884 extern const Regex RXdouble;         // = "-?\\(\\([0-9]+\\.[0-9]*\\)\\|
885                                      //    \\([0-9]+\\)\\|\\(\\.[0-9]+\\)\\)
886                                      //    \\([eE][---+]?[0-9]+\\)?"
887 extern const Regex RXalpha;          // = "[A-Za-z]+"
888 extern const Regex RXlowercase;      // = "[a-z]+"
889 extern const Regex RXuppercase;      // = "[A-Z]+"
890 extern const Regex RXalphanum;       // = "[0-9A-Za-z]+"
891 extern const Regex RXidentifier;     // = "[A-Za-z_][A-Za-z0-9_]*"
892
893
894
895 //# 27 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 2
896
897
898 struct StrRep                     // internal String representations
899 {
900   unsigned short    len;         // string length
901   unsigned short    sz;          // allocated space
902   char              s[1];        // the string starts here
903                                  // (at least 1 char for trailing null)
904                                  // allocated & expanded via non-public fcts
905 };
906
907 // primitive ops on StrReps -- nearly all String fns go through these.
908
909 StrRep*     Salloc(StrRep*, const char*, int, int);
910 StrRep*     Scopy(StrRep*, StrRep*);
911 StrRep*     Sresize(StrRep*, int);
912 StrRep*     Scat(StrRep*, const char*, int, const char*, int);
913 StrRep*     Scat(StrRep*, const char*, int,const char*,int, const char*,int);
914 StrRep*     Sprepend(StrRep*, const char*, int);
915 StrRep*     Sreverse(StrRep*, StrRep*);
916 StrRep*     Supcase(StrRep*, StrRep*);
917 StrRep*     Sdowncase(StrRep*, StrRep*);
918 StrRep*     Scapitalize(StrRep*, StrRep*);
919
920 // These classes need to be defined in the order given
921
922 class String;
923 class SubString;
924
925 class SubString
926 {
927   friend class      String;
928 protected:
929
930   String&           S;        // The String I'm a substring of
931   unsigned short    pos;      // starting position in S's rep
932   unsigned short    len;      // length of substring
933
934   void              assign(StrRep*, const char*, int = -1);
935                     SubString(String& x, int p, int l);
936                     SubString(const SubString& x);
937
938 public:
939
940 // Note there are no public constructors. SubStrings are always
941 // created via String operations
942
943                    ~SubString();
944
945   void              operator =  (const String&     y);
946   void              operator =  (const SubString&  y);
947   void              operator =  (const char* t);
948   void              operator =  (char        c);
949
950 // return 1 if target appears anywhere in SubString; else 0
951
952   int               contains(char        c) const;
953   int               contains(const String&     y) const;
954   int               contains(const SubString&  y) const;
955   int               contains(const char* t) const;
956   int               contains(const Regex&       r) const;
957
958 // return 1 if target matches entire SubString
959
960   int               matches(const Regex&  r) const;
961
962 // IO
963
964   friend ostream&   operator<<(ostream& s, const SubString& x);
965
966 // status
967
968   unsigned int      length() const;
969   int               empty() const;
970   const char*       chars() const;
971
972   int               OK() const;
973
974 };
975
976
977 class String
978 {
979   friend class      SubString;
980
981 protected:
982   StrRep*           rep;   // Strings are pointers to their representations
983
984 // some helper functions
985
986   int               search(int, int, const char*, int = -1) const;
987   int               search(int, int, char) const;
988   int               match(int, int, int, const char*, int = -1) const;
989   int               _gsub(const char*, int, const char* ,int);
990   int               _gsub(const Regex&, const char*, int);
991   SubString         _substr(int, int);
992
993 public:
994
995 // constructors & assignment
996
997                     String();
998                     String(const String& x);
999                     String(const SubString&  x);
1000                     String(const char* t);
1001                     String(const char* t, int len);
1002                     String(char c);
1003
1004                     ~String();
1005
1006   void              operator =  (const String&     y);
1007   void              operator =  (const char* y);
1008   void              operator =  (char        c);
1009   void              operator =  (const SubString&  y);
1010
1011 // concatenation
1012
1013   void              operator += (const String&     y);
1014   void              operator += (const SubString&  y);
1015   void              operator += (const char* t);
1016   void              operator += (char        c);
1017
1018   void              prepend(const String&     y);
1019   void              prepend(const SubString&  y);
1020   void              prepend(const char* t);
1021   void              prepend(char        c);
1022
1023
1024 // procedural versions:
1025 // concatenate first 2 args, store result in last arg
1026
1027   friend void     cat(const String&, const String&, String&);
1028   friend void     cat(const String&, const SubString&, String&);
1029   friend void     cat(const String&, const char*, String&);
1030   friend void     cat(const String&, char, String&);
1031
1032   friend void     cat(const SubString&, const String&, String&);
1033   friend void     cat(const SubString&, const SubString&, String&);
1034   friend void     cat(const SubString&, const char*, String&);
1035   friend void     cat(const SubString&, char, String&);
1036
1037   friend void     cat(const char*, const String&, String&);
1038   friend void     cat(const char*, const SubString&, String&);
1039   friend void     cat(const char*, const char*, String&);
1040   friend void     cat(const char*, char, String&);
1041
1042 // double concatenation, by request. (yes, there are too many versions,
1043 // but if one is supported, then the others should be too...)
1044 // Concatenate first 3 args, store in last arg
1045
1046   friend void     cat(const String&,const String&, const String&,String&);
1047   friend void     cat(const String&,const String&,const SubString&,String&);
1048   friend void     cat(const String&,const String&, const char*, String&);
1049   friend void     cat(const String&,const String&, char, String&);
1050   friend void     cat(const String&,const SubString&,const String&,String&);
1051   friend void     cat(const String&,const SubString&,const SubString&,String&);
1052   friend void     cat(const String&,const SubString&, const char*, String&);
1053   friend void     cat(const String&,const SubString&, char, String&);
1054   friend void     cat(const String&,const char*, const String&,    String&);
1055   friend void     cat(const String&,const char*, const SubString&, String&);
1056   friend void     cat(const String&,const char*, const char*, String&);
1057   friend void     cat(const String&,const char*, char, String&);
1058
1059   friend void     cat(const char*, const String&, const String&,String&);
1060   friend void     cat(const char*,const String&,const SubString&,String&);
1061   friend void     cat(const char*,const String&, const char*, String&);
1062   friend void     cat(const char*,const String&, char, String&);
1063   friend void     cat(const char*,const SubString&,const String&,String&);
1064   friend void     cat(const char*,const SubString&,const SubString&,String&);
1065   friend void     cat(const char*,const SubString&, const char*, String&);
1066   friend void     cat(const char*,const SubString&, char, String&);
1067   friend void     cat(const char*,const char*, const String&,    String&);
1068   friend void     cat(const char*,const char*, const SubString&, String&);
1069   friend void     cat(const char*,const char*, const char*, String&);
1070   friend void     cat(const char*,const char*, char, String&);
1071
1072
1073 // searching & matching
1074
1075 // return position of target in string or -1 for failure
1076
1077   int               index(char        c, int startpos = 0) const;
1078   int               index(const String&     y, int startpos = 0) const;
1079   int               index(const SubString&  y, int startpos = 0) const;
1080   int               index(const char* t, int startpos = 0) const;
1081   int               index(const Regex&      r, int startpos = 0) const;
1082
1083 // return 1 if target appears anyhere in String; else 0
1084
1085   int               contains(char        c) const;
1086   int               contains(const String&     y) const;
1087   int               contains(const SubString&  y) const;
1088   int               contains(const char* t) const;
1089   int               contains(const Regex&      r) const;
1090
1091 // return 1 if target appears anywhere after position pos
1092 // (or before, if pos is negative) in String; else 0
1093
1094   int               contains(char        c, int pos) const;
1095   int               contains(const String&     y, int pos) const;
1096   int               contains(const SubString&  y, int pos) const;
1097   int               contains(const char* t, int pos) const;
1098   int               contains(const Regex&      r, int pos) const;
1099
1100 // return 1 if target appears at position pos in String; else 0
1101
1102   int               matches(char        c, int pos = 0) const;
1103   int               matches(const String&     y, int pos = 0) const;
1104   int               matches(const SubString&  y, int pos = 0) const;
1105   int               matches(const char* t, int pos = 0) const;
1106   int               matches(const Regex&      r, int pos = 0) const;
1107
1108 //  return number of occurences of target in String
1109
1110   int               freq(char        c) const;
1111   int               freq(const String&     y) const;
1112   int               freq(const SubString&  y) const;
1113   int               freq(const char* t) const;
1114
1115 // SubString extraction
1116
1117 // Note that you can't take a substring of a const String, since
1118 // this leaves open the possiblility of indirectly modifying the
1119 // String through the SubString
1120
1121   SubString         at(int         pos, int len);
1122   SubString         operator () (int         pos, int len); // synonym for at
1123
1124   SubString         at(const String&     x, int startpos = 0);
1125   SubString         at(const SubString&  x, int startpos = 0);
1126   SubString         at(const char* t, int startpos = 0);
1127   SubString         at(char        c, int startpos = 0);
1128   SubString         at(const Regex&      r, int startpos = 0);
1129
1130   SubString         before(int          pos);
1131   SubString         before(const String&      x, int startpos = 0);
1132   SubString         before(const SubString&   x, int startpos = 0);
1133   SubString         before(const char*  t, int startpos = 0);
1134   SubString         before(char         c, int startpos = 0);
1135   SubString         before(const Regex&       r, int startpos = 0);
1136
1137   SubString         through(int          pos);
1138   SubString         through(const String&      x, int startpos = 0);
1139   SubString         through(const SubString&   x, int startpos = 0);
1140   SubString         through(const char*  t, int startpos = 0);
1141   SubString         through(char         c, int startpos = 0);
1142   SubString         through(const Regex&       r, int startpos = 0);
1143
1144   SubString         from(int          pos);
1145   SubString         from(const String&      x, int startpos = 0);
1146   SubString         from(const SubString&   x, int startpos = 0);
1147   SubString         from(const char*  t, int startpos = 0);
1148   SubString         from(char         c, int startpos = 0);
1149   SubString         from(const Regex&       r, int startpos = 0);
1150
1151   SubString         after(int         pos);
1152   SubString         after(const String&     x, int startpos = 0);
1153   SubString         after(const SubString&  x, int startpos = 0);
1154   SubString         after(const char* t, int startpos = 0);
1155   SubString         after(char        c, int startpos = 0);
1156   SubString         after(const Regex&      r, int startpos = 0);
1157
1158
1159 // deletion
1160
1161 // delete len chars starting at pos
1162   void              del(int         pos, int len);
1163
1164 // delete the first occurrence of target after startpos
1165
1166   void              del(const String&     y, int startpos = 0);
1167   void              del(const SubString&  y, int startpos = 0);
1168   void              del(const char* t, int startpos = 0);
1169   void              del(char        c, int startpos = 0);
1170   void              del(const Regex&      r, int startpos = 0);
1171
1172 // global substitution: substitute all occurrences of pat with repl
1173
1174   int               gsub(const String&     pat, const String&     repl);
1175   int               gsub(const SubString&  pat, const String&     repl);
1176   int               gsub(const char* pat, const String&     repl);
1177   int               gsub(const char* pat, const char* repl);
1178   int               gsub(const Regex&      pat, const String&     repl);
1179
1180 // friends & utilities
1181
1182 // split string into array res at separators; return number of elements
1183
1184   friend int        split(const String& x, String res[], int maxn,
1185                           const String& sep);
1186   friend int        split(const String& x, String res[], int maxn,
1187                           const Regex&  sep);
1188
1189   friend String     common_prefix(const String& x, const String& y,
1190                                   int startpos = 0);
1191   friend String     common_suffix(const String& x, const String& y,
1192                                   int startpos = -1);
1193   friend String     replicate(char        c, int n);
1194   friend String     replicate(const String&     y, int n);
1195   friend String     join(String src[], int n, const String& sep);
1196
1197 // simple builtin transformations
1198
1199   friend String     reverse(const String& x);
1200   friend String     upcase(const String& x);
1201   friend String     downcase(const String& x);
1202   friend String     capitalize(const String& x);
1203
1204 // in-place versions of above
1205
1206   void              reverse();
1207   void              upcase();
1208   void              downcase();
1209   void              capitalize();
1210
1211 // element extraction
1212
1213   char&             operator [] (int i);
1214   char              elem(int i) const;
1215   char              firstchar() const;
1216   char              lastchar() const;
1217
1218 // conversion
1219
1220                     operator const char*() const;
1221   const char*       chars() const;
1222
1223
1224 // IO
1225
1226   friend ostream&   operator<<(ostream& s, const String& x);
1227   friend ostream&   operator<<(ostream& s, const SubString& x);
1228   friend istream&   operator>>(istream& s, String& x);
1229
1230   friend int        readline(istream& s, String& x,
1231                              char terminator = '\n',
1232                              int discard_terminator = 1);
1233
1234 // status
1235
1236   unsigned int      length() const;
1237   int               empty() const;
1238
1239 // preallocate some space for String
1240   void              alloc(int newsize);
1241
1242 // report current allocation (not length!)
1243
1244   int               allocation() const;
1245
1246
1247   volatile void     error(const char* msg) const;
1248
1249   int               OK() const;
1250 };
1251
1252 typedef String StrTmp; // for backward compatibility
1253
1254 // other externs
1255
1256 int        compare(const String&    x, const String&     y);
1257 int        compare(const String&    x, const SubString&  y);
1258 int        compare(const String&    x, const char* y);
1259 int        compare(const SubString& x, const String&     y);
1260 int        compare(const SubString& x, const SubString&  y);
1261 int        compare(const SubString& x, const char* y);
1262 int        fcompare(const String&   x, const String&     y); // ignore case
1263
1264 extern StrRep  _nilStrRep;
1265 extern String _nilString;
1266
1267 // other inlines
1268
1269 String operator + (const String& x, const String& y);
1270 String operator + (const String& x, const SubString& y);
1271 String operator + (const String& x, const char* y);
1272 String operator + (const String& x, char y);
1273 String operator + (const SubString& x, const String& y);
1274 String operator + (const SubString& x, const SubString& y);
1275 String operator + (const SubString& x, const char* y);
1276 String operator + (const SubString& x, char y);
1277 String operator + (const char* x, const String& y);
1278 String operator + (const char* x, const SubString& y);
1279
1280 int operator==(const String& x, const String& y);
1281 int operator!=(const String& x, const String& y);
1282 int operator> (const String& x, const String& y);
1283 int operator>=(const String& x, const String& y);
1284 int operator< (const String& x, const String& y);
1285 int operator<=(const String& x, const String& y);
1286 int operator==(const String& x, const SubString&  y);
1287 int operator!=(const String& x, const SubString&  y);
1288 int operator> (const String& x, const SubString&  y);
1289 int operator>=(const String& x, const SubString&  y);
1290 int operator< (const String& x, const SubString&  y);
1291 int operator<=(const String& x, const SubString&  y);
1292 int operator==(const String& x, const char* t);
1293 int operator!=(const String& x, const char* t);
1294 int operator> (const String& x, const char* t);
1295 int operator>=(const String& x, const char* t);
1296 int operator< (const String& x, const char* t);
1297 int operator<=(const String& x, const char* t);
1298 int operator==(const SubString& x, const String& y);
1299 int operator!=(const SubString& x, const String& y);
1300 int operator> (const SubString& x, const String& y);
1301 int operator>=(const SubString& x, const String& y);
1302 int operator< (const SubString& x, const String& y);
1303 int operator<=(const SubString& x, const String& y);
1304 int operator==(const SubString& x, const SubString&  y);
1305 int operator!=(const SubString& x, const SubString&  y);
1306 int operator> (const SubString& x, const SubString&  y);
1307 int operator>=(const SubString& x, const SubString&  y);
1308 int operator< (const SubString& x, const SubString&  y);
1309 int operator<=(const SubString& x, const SubString&  y);
1310 int operator==(const SubString& x, const char* t);
1311 int operator!=(const SubString& x, const char* t);
1312 int operator> (const SubString& x, const char* t);
1313 int operator>=(const SubString& x, const char* t);
1314 int operator< (const SubString& x, const char* t);
1315 int operator<=(const SubString& x, const char* t);
1316
1317
1318
1319
1320 // status reports, needed before defining other things
1321
1322 inline unsigned int String::length() const {  return rep->len; }
1323 inline int         String::empty() const { return rep->len == 0; }
1324 inline const char* String::chars() const { return &(rep->s[0]); }
1325 inline int         String::allocation() const { return rep->sz; }
1326 inline void        String::alloc(int newsize) { rep = Sresize(rep, newsize); }
1327
1328 inline unsigned int SubString::length() const { return len; }
1329 inline int         SubString::empty() const { return len == 0; }
1330 inline const char* SubString::chars() const { return &(S.rep->s[pos]); }
1331
1332
1333 // constructors
1334
1335 inline String::String()
1336   : rep(&_nilStrRep) {}
1337 inline String::String(const String& x)
1338   : rep(Scopy(0, x.rep)) {}
1339 inline String::String(const char* t)
1340   : rep(Salloc(0, t, -1, -1)) {}
1341 inline String::String(const char* t, int tlen)
1342   : rep(Salloc(0, t, tlen, tlen)) {}
1343 inline String::String(const SubString& y)
1344   : rep(Salloc(0, y.chars(), y.length(), y.length())) {}
1345 inline String::String(char c)
1346   : rep(Salloc(0, &c, 1, 1)) {}
1347
1348 inline String::~String() { if (rep != &_nilStrRep) delete rep; }
1349
1350 inline SubString::SubString(const SubString& x)
1351   :S(x.S), pos(x.pos), len(x.len) {}
1352 inline SubString::SubString(String& x, int first, int l)
1353   :S(x), pos(first), len(l) {}
1354
1355 inline SubString::~SubString() {}
1356
1357 // assignment
1358
1359 inline void String::operator =  (const String& y)
1360 {
1361   rep = Scopy(rep, y.rep);
1362 }
1363
1364 inline void String::operator=(const char* t)
1365 {
1366   rep = Salloc(rep, t, -1, -1);
1367 }
1368
1369 inline void String::operator=(const SubString&  y)
1370 {
1371   rep = Salloc(rep, y.chars(), y.length(), y.length());
1372 }
1373
1374 inline void String::operator=(char c)
1375 {
1376   rep = Salloc(rep, &c, 1, 1);
1377 }
1378
1379
1380 inline void SubString::operator = (const char* ys)
1381 {
1382   assign(0, ys);
1383 }
1384
1385 inline void SubString::operator = (char ch)
1386 {
1387   assign(0, &ch, 1);
1388 }
1389
1390 inline void SubString::operator = (const String& y)
1391 {
1392   assign(y.rep, y.chars(), y.length());
1393 }
1394
1395 inline void SubString::operator = (const SubString& y)
1396 {
1397   assign(y.S.rep, y.chars(), y.length());
1398 }
1399
1400 // Zillions of cats...
1401
1402 inline void cat(const String& x, const String& y, String& r)
1403 {
1404   r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
1405 }
1406
1407 inline void cat(const String& x, const SubString& y, String& r)
1408 {
1409   r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
1410 }
1411
1412 inline void cat(const String& x, const char* y, String& r)
1413 {
1414   r.rep = Scat(r.rep, x.chars(), x.length(), y, -1);
1415 }
1416
1417 inline void cat(const String& x, char y, String& r)
1418 {
1419   r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1);
1420 }
1421
1422 inline void cat(const SubString& x, const String& y, String& r)
1423 {
1424   r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
1425 }
1426
1427 inline void cat(const SubString& x, const SubString& y, String& r)
1428 {
1429   r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
1430 }
1431
1432 inline void cat(const SubString& x, const char* y, String& r)
1433 {
1434   r.rep = Scat(r.rep, x.chars(), x.length(), y, -1);
1435 }
1436
1437 inline void cat(const SubString& x, char y, String& r)
1438 {
1439   r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1);
1440 }
1441
1442 inline void cat(const char* x, const String& y, String& r)
1443 {
1444   r.rep = Scat(r.rep, x, -1, y.chars(), y.length());
1445 }
1446
1447 inline void cat(const char* x, const SubString& y, String& r)
1448 {
1449   r.rep = Scat(r.rep, x, -1, y.chars(), y.length());
1450 }
1451
1452 inline void cat(const char* x, const char* y, String& r)
1453 {
1454   r.rep = Scat(r.rep, x, -1, y, -1);
1455 }
1456
1457 inline void cat(const char* x, char y, String& r)
1458 {
1459   r.rep = Scat(r.rep, x, -1, &y, 1);
1460 }
1461
1462 inline void cat(const String& a, const String& x, const String& y, String& r)
1463 {
1464   r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
1465 }
1466
1467 inline void cat(const String& a, const String& x, const SubString& y, String& r)
1468 {
1469   r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
1470 }
1471
1472 inline void cat(const String& a, const String& x, const char* y, String& r)
1473 {
1474   r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1);
1475 }
1476
1477 inline void cat(const String& a, const String& x, char y, String& r)
1478 {
1479   r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), &y, 1);
1480 }
1481
1482 inline void cat(const String& a, const SubString& x, const String& y, String& r)
1483 {
1484   r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
1485 }
1486
1487 inline void cat(const String& a, const SubString& x, const SubString& y, String& r)
1488 {
1489   r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
1490 }
1491
1492 inline void cat(const String& a, const SubString& x, const char* y, String& r)
1493 {
1494   r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1);
1495 }
1496
1497 inline void cat(const String& a, const SubString& x, char y, String& r)
1498 {
1499   r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), &y, 1);
1500 }
1501
1502 inline void cat(const String& a, const char* x, const String& y, String& r)
1503 {
1504   r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y.chars(), y.length());
1505 }
1506
1507 inline void cat(const String& a, const char* x, const SubString& y, String& r)
1508 {
1509   r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y.chars(), y.length());
1510 }
1511
1512 inline void cat(const String& a, const char* x, const char* y, String& r)
1513 {
1514   r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y, -1);
1515 }
1516
1517 inline void cat(const String& a, const char* x, char y, String& r)
1518 {
1519   r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, &y, 1);
1520 }
1521
1522
1523 inline void cat(const char* a, const String& x, const String& y, String& r)
1524 {
1525   r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
1526 }
1527
1528 inline void cat(const char* a, const String& x, const SubString& y, String& r)
1529 {
1530   r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
1531 }
1532
1533 inline void cat(const char* a, const String& x, const char* y, String& r)
1534 {
1535   r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1);
1536 }
1537
1538 inline void cat(const char* a, const String& x, char y, String& r)
1539 {
1540   r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), &y, 1);
1541 }
1542
1543 inline void cat(const char* a, const SubString& x, const String& y, String& r)
1544 {
1545   r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
1546 }
1547
1548 inline void cat(const char* a, const SubString& x, const SubString& y, String& r)
1549 {
1550   r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
1551 }
1552
1553 inline void cat(const char* a, const SubString& x, const char* y, String& r)
1554 {
1555   r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1);
1556 }
1557
1558 inline void cat(const char* a, const SubString& x, char y, String& r)
1559 {
1560   r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), &y, 1);
1561 }
1562
1563 inline void cat(const char* a, const char* x, const String& y, String& r)
1564 {
1565   r.rep = Scat(r.rep, a, -1, x, -1, y.chars(), y.length());
1566 }
1567
1568 inline void cat(const char* a, const char* x, const SubString& y, String& r)
1569 {
1570   r.rep = Scat(r.rep, a, -1, x, -1, y.chars(), y.length());
1571 }
1572
1573 inline void cat(const char* a, const char* x, const char* y, String& r)
1574 {
1575   r.rep = Scat(r.rep, a, -1, x, -1, y, -1);
1576 }
1577
1578 inline void cat(const char* a, const char* x, char y, String& r)
1579 {
1580   r.rep = Scat(r.rep, a, -1, x, -1, &y, 1);
1581 }
1582
1583
1584 // operator versions
1585
1586 inline void String::operator +=(const String& y)
1587 {
1588   cat(*this, y, *this);
1589 }
1590
1591 inline void String::operator +=(const SubString& y)
1592 {
1593   cat(*this, y, *this);
1594 }
1595
1596 inline void String::operator += (const char* y)
1597 {
1598   cat(*this, y, *this);
1599 }
1600
1601 inline void String:: operator +=(char y)
1602 {
1603   cat(*this, y, *this);
1604 }
1605
1606 // constructive concatenation
1607
1608
1609
1610 inline String operator + (const String& x, const String& y) return r;
1611 {
1612   cat(x, y, r);
1613 }
1614
1615 inline String operator + (const String& x, const SubString& y) return r;
1616 {
1617   cat(x, y, r);
1618 }
1619
1620 inline String operator + (const String& x, const char* y) return r;
1621 {
1622   cat(x, y, r);
1623 }
1624
1625 inline String operator + (const String& x, char y) return r;
1626 {
1627   cat(x, y, r);
1628 }
1629
1630 inline String operator + (const SubString& x, const String& y) return r;
1631 {
1632   cat(x, y, r);
1633 }
1634
1635 inline String operator + (const SubString& x, const SubString& y) return r;
1636 {
1637   cat(x, y, r);
1638 }
1639
1640 inline String operator + (const SubString& x, const char* y) return r;
1641 {
1642   cat(x, y, r);
1643 }
1644
1645 inline String operator + (const SubString& x, char y) return r;
1646 {
1647   cat(x, y, r);
1648 }
1649
1650 inline String operator + (const char* x, const String& y) return r;
1651 {
1652   cat(x, y, r);
1653 }
1654
1655 inline String operator + (const char* x, const SubString& y) return r;
1656 {
1657   cat(x, y, r);
1658 }
1659
1660 inline String reverse(const String& x) return r;
1661 {
1662   r.rep = Sreverse(x.rep, r.rep);
1663 }
1664
1665 inline String upcase(const String& x) return r;
1666 {
1667   r.rep = Supcase(x.rep, r.rep);
1668 }
1669
1670 inline String downcase(const String& x) return r;
1671 {
1672   r.rep = Sdowncase(x.rep, r.rep);
1673 }
1674
1675 inline String capitalize(const String& x) return r;
1676 {
1677   r.rep = Scapitalize(x.rep, r.rep);
1678 }
1679
1680 //# 883 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h"
1681
1682
1683 // prepend
1684
1685 inline void String::prepend(const String& y)
1686 {
1687   rep = Sprepend(rep, y.chars(), y.length());
1688 }
1689
1690 inline void String::prepend(const char* y)
1691 {
1692   rep = Sprepend(rep, y, -1);
1693 }
1694
1695 inline void String::prepend(char y)
1696 {
1697   rep = Sprepend(rep, &y, 1);
1698 }
1699
1700 inline void String::prepend(const SubString& y)
1701 {
1702   rep = Sprepend(rep, y.chars(), y.length());
1703 }
1704
1705 // misc transformations
1706
1707
1708 inline void String::reverse()
1709 {
1710   rep = Sreverse(rep, rep);
1711 }
1712
1713
1714 inline void String::upcase()
1715 {
1716   rep = Supcase(rep, rep);
1717 }
1718
1719
1720 inline void String::downcase()
1721 {
1722   rep = Sdowncase(rep, rep);
1723 }
1724
1725
1726 inline void String::capitalize()
1727 {
1728   rep = Scapitalize(rep, rep);
1729 }
1730
1731 // element extraction
1732
1733 inline char&  String::operator [] (int i)
1734 {
1735   if (((unsigned)i) >= length()) error("invalid index");
1736   return rep->s[i];
1737 }
1738
1739 inline char  String::elem (int i) const
1740 {
1741   if (((unsigned)i) >= length()) error("invalid index");
1742   return rep->s[i];
1743 }
1744
1745 inline char  String::firstchar() const
1746 {
1747   return elem(0);
1748 }
1749
1750 inline char  String::lastchar() const
1751 {
1752   return elem(length() - 1);
1753 }
1754
1755 // searching
1756
1757 inline int String::index(char c, int startpos) const
1758 {
1759   return search(startpos, length(), c);
1760 }
1761
1762 inline int String::index(const char* t, int startpos) const
1763 {
1764   return search(startpos, length(), t);
1765 }
1766
1767 inline int String::index(const String& y, int startpos) const
1768 {
1769   return search(startpos, length(), y.chars(), y.length());
1770 }
1771
1772 inline int String::index(const SubString& y, int startpos) const
1773 {
1774   return search(startpos, length(), y.chars(), y.length());
1775 }
1776
1777 inline int String::index(const Regex& r, int startpos) const
1778 {
1779   int unused;  return r.search(chars(), length(), unused, startpos);
1780 }
1781
1782 inline int String::contains(char c) const
1783 {
1784   return search(0, length(), c) >= 0;
1785 }
1786
1787 inline int String::contains(const char* t) const
1788 {
1789   return search(0, length(), t) >= 0;
1790 }
1791
1792 inline int String::contains(const String& y) const
1793 {
1794   return search(0, length(), y.chars(), y.length()) >= 0;
1795 }
1796
1797 inline int String::contains(const SubString& y) const
1798 {
1799   return search(0, length(), y.chars(), y.length()) >= 0;
1800 }
1801
1802 inline int String::contains(char c, int p) const
1803 {
1804   return match(p, length(), 0, &c, 1) >= 0;
1805 }
1806
1807 inline int String::contains(const char* t, int p) const
1808 {
1809   return match(p, length(), 0, t) >= 0;
1810 }
1811
1812 inline int String::contains(const String& y, int p) const
1813 {
1814   return match(p, length(), 0, y.chars(), y.length()) >= 0;
1815 }
1816
1817 inline int String::contains(const SubString& y, int p) const
1818 {
1819   return match(p, length(), 0, y.chars(), y.length()) >= 0;
1820 }
1821
1822 inline int String::contains(const Regex& r) const
1823 {
1824   int unused;  return r.search(chars(), length(), unused, 0) >= 0;
1825 }
1826
1827 inline int String::contains(const Regex& r, int p) const
1828 {
1829   return r.match(chars(), length(), p) >= 0;
1830 }
1831
1832
1833 inline int String::matches(const SubString& y, int p) const
1834 {
1835   return match(p, length(), 1, y.chars(), y.length()) >= 0;
1836 }
1837
1838 inline int String::matches(const String& y, int p) const
1839 {
1840   return match(p, length(), 1, y.chars(), y.length()) >= 0;
1841 }
1842
1843 inline int String::matches(const char* t, int p) const
1844 {
1845   return match(p, length(), 1, t) >= 0;
1846 }
1847
1848 inline int String::matches(char c, int p) const
1849 {
1850   return match(p, length(), 1, &c, 1) >= 0;
1851 }
1852
1853 inline int String::matches(const Regex& r, int p) const
1854 {
1855   int l = (p < 0)? -p : length() - p;
1856   return r.match(chars(), length(), p) == l;
1857 }
1858
1859
1860 inline int SubString::contains(const char* t) const
1861 {
1862   return S.search(pos, pos+len, t) >= 0;
1863 }
1864
1865 inline int SubString::contains(const String& y) const
1866 {
1867   return S.search(pos, pos+len, y.chars(), y.length()) >= 0;
1868 }
1869
1870 inline int SubString::contains(const SubString&  y) const
1871 {
1872   return S.search(pos, pos+len, y.chars(), y.length()) >= 0;
1873 }
1874
1875 inline int SubString::contains(char c) const
1876 {
1877   return S.search(pos, pos+len, 0, c) >= 0;
1878 }
1879
1880 inline int SubString::contains(const Regex& r) const
1881 {
1882   int unused;  return r.search(chars(), len, unused, 0) >= 0;
1883 }
1884
1885 inline int SubString::matches(const Regex& r) const
1886 {
1887   return r.match(chars(), len, 0) == len;
1888 }
1889
1890
1891 inline int String::gsub(const String& pat, const String& r)
1892 {
1893   return _gsub(pat.chars(), pat.length(), r.chars(), r.length());
1894 }
1895
1896 inline int String::gsub(const SubString&  pat, const String& r)
1897 {
1898   return _gsub(pat.chars(), pat.length(), r.chars(), r.length());
1899 }
1900
1901 inline int String::gsub(const Regex& pat, const String& r)
1902 {
1903   return _gsub(pat, r.chars(), r.length());
1904 }
1905
1906 inline int String::gsub(const char* pat, const String& r)
1907 {
1908   return _gsub(pat, -1, r.chars(), r.length());
1909 }
1910
1911 inline int String::gsub(const char* pat, const char* r)
1912 {
1913   return _gsub(pat, -1, r, -1);
1914 }
1915
1916
1917
1918 inline  ostream& operator<<(ostream& s, const String& x)
1919 {
1920    s << x.chars(); return s;
1921 }
1922
1923 // a zillion comparison operators
1924
1925 inline int operator==(const String& x, const String& y)
1926 {
1927   return compare(x, y) == 0;
1928 }
1929
1930 inline int operator!=(const String& x, const String& y)
1931 {
1932   return compare(x, y) != 0;
1933 }
1934
1935 inline int operator>(const String& x, const String& y)
1936 {
1937   return compare(x, y) > 0;
1938 }
1939
1940 inline int operator>=(const String& x, const String& y)
1941 {
1942   return compare(x, y) >= 0;
1943 }
1944
1945 inline int operator<(const String& x, const String& y)
1946 {
1947   return compare(x, y) < 0;
1948 }
1949
1950 inline int operator<=(const String& x, const String& y)
1951 {
1952   return compare(x, y) <= 0;
1953 }
1954
1955 inline int operator==(const String& x, const SubString&  y)
1956 {
1957   return compare(x, y) == 0;
1958 }
1959
1960 inline int operator!=(const String& x, const SubString&  y)
1961 {
1962   return compare(x, y) != 0;
1963 }
1964
1965 inline int operator>(const String& x, const SubString&  y)
1966 {
1967   return compare(x, y) > 0;
1968 }
1969
1970 inline int operator>=(const String& x, const SubString&  y)
1971 {
1972   return compare(x, y) >= 0;
1973 }
1974
1975 inline int operator<(const String& x, const SubString&  y)
1976 {
1977   return compare(x, y) < 0;
1978 }
1979
1980 inline int operator<=(const String& x, const SubString&  y)
1981 {
1982   return compare(x, y) <= 0;
1983 }
1984
1985 inline int operator==(const String& x, const char* t)
1986 {
1987   return compare(x, t) == 0;
1988 }
1989
1990 inline int operator!=(const String& x, const char* t)
1991 {
1992   return compare(x, t) != 0;
1993 }
1994
1995 inline int operator>(const String& x, const char* t)
1996 {
1997   return compare(x, t) > 0;
1998 }
1999
2000 inline int operator>=(const String& x, const char* t)
2001 {
2002   return compare(x, t) >= 0;
2003 }
2004
2005 inline int operator<(const String& x, const char* t)
2006 {
2007   return compare(x, t) < 0;
2008 }
2009
2010 inline int operator<=(const String& x, const char* t)
2011 {
2012   return compare(x, t) <= 0;
2013 }
2014
2015 inline int operator==(const SubString& x, const String& y)
2016 {
2017   return compare(y, x) == 0;
2018 }
2019
2020 inline int operator!=(const SubString& x, const String& y)
2021 {
2022   return compare(y, x) != 0;
2023 }
2024
2025 inline int operator>(const SubString& x, const String& y)
2026 {
2027   return compare(y, x) < 0;
2028 }
2029
2030 inline int operator>=(const SubString& x, const String& y)
2031 {
2032   return compare(y, x) <= 0;
2033 }
2034
2035 inline int operator<(const SubString& x, const String& y)
2036 {
2037   return compare(y, x) > 0;
2038 }
2039
2040 inline int operator<=(const SubString& x, const String& y)
2041 {
2042   return compare(y, x) >= 0;
2043 }
2044
2045 inline int operator==(const SubString& x, const SubString&  y)
2046 {
2047   return compare(x, y) == 0;
2048 }
2049
2050 inline int operator!=(const SubString& x, const SubString&  y)
2051 {
2052   return compare(x, y) != 0;
2053 }
2054
2055 inline int operator>(const SubString& x, const SubString&  y)
2056 {
2057   return compare(x, y) > 0;
2058 }
2059
2060 inline int operator>=(const SubString& x, const SubString&  y)
2061 {
2062   return compare(x, y) >= 0;
2063 }
2064
2065 inline int operator<(const SubString& x, const SubString&  y)
2066 {
2067   return compare(x, y) < 0;
2068 }
2069
2070 inline int operator<=(const SubString& x, const SubString&  y)
2071 {
2072   return compare(x, y) <= 0;
2073 }
2074
2075 inline int operator==(const SubString& x, const char* t)
2076 {
2077   return compare(x, t) == 0;
2078 }
2079
2080 inline int operator!=(const SubString& x, const char* t)
2081 {
2082   return compare(x, t) != 0;
2083 }
2084
2085 inline int operator>(const SubString& x, const char* t)
2086 {
2087   return compare(x, t) > 0;
2088 }
2089
2090 inline int operator>=(const SubString& x, const char* t)
2091 {
2092   return compare(x, t) >= 0;
2093 }
2094
2095 inline int operator<(const SubString& x, const char* t)
2096 {
2097   return compare(x, t) < 0;
2098 }
2099
2100 inline int operator<=(const SubString& x, const char* t)
2101 {
2102   return compare(x, t) <= 0;
2103 }
2104
2105
2106 // a helper needed by at, before, etc.
2107
2108 inline SubString String::_substr(int first, int l)
2109 {
2110   if (first >= length() )  // ??? THIS LINE IS QUESTIONABLE
2111     return SubString(_nilString, 0, 0) ;
2112   else
2113     return SubString(*this, first, l);
2114 }
2115
2116
2117
2118
2119
2120 //# 26 "../../GctSymbol.h" 2
2121
2122
2123 //# 1 "../../../../../../mips/include/Gct/Object/GctHashObject.h" 1
2124 // -*- C++ -*-
2125
2126
2127
2128 //
2129 // GctHashObject class (is abstract)
2130 //
2131 // Expects to be included by Object.h or where needed explicitly.
2132 //
2133 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2134 //
2135
2136
2137
2138
2139
2140 //#pragma interface
2141
2142
2143 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2144 // $Author: jason $
2145 // $Revision: 1.6 $
2146 // $Date: 1994/05/16 09:13:02 $
2147
2148 //# 1 "../../../../../../mips/include/Gct/Object/GctObject.h" 1
2149 // -*- C++ -*-
2150
2151
2152
2153 //
2154 // GctObject class (is abstract)
2155 //
2156 // Expects to be included by Object.h or where needed explicitly.
2157 //
2158 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2159 //
2160
2161
2162
2163
2164
2165 //#pragma interface
2166
2167
2168 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2169 // $Author: jason $
2170 // $Revision: 1.6 $
2171 // $Date: 1994/05/16 09:13:02 $
2172
2173 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
2174 // -*- C++ -*-
2175
2176
2177
2178 //
2179 // tostrstream class
2180 //
2181 // A terminated oststream - an ostsrstream that auto-terminates on str()
2182 //
2183 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2184 //
2185
2186
2187
2188
2189
2190 //#pragma interface
2191
2192
2193 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2194 // $Author: jason $
2195 // $Revision: 1.6 $
2196 // $Date: 1994/05/16 09:13:02 $
2197
2198 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/strstream.h" 1
2199 //    This is part of the iostream library, providing input/output for C++.
2200 //    Copyright (C) 1991 Per Bothner.
2201 //
2202 //    This library is free software; you can redistribute it and/or
2203 //    modify it under the terms of the GNU Library General Public
2204 //    License as published by the Free Software Foundation; either
2205 //    version 2 of the License, or (at your option) any later version.
2206 //
2207 //    This library is distributed in the hope that it will be useful,
2208 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
2209 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2210 //    Library General Public License for more details.
2211 //
2212 //    You should have received a copy of the GNU Library General Public
2213 //    License along with this library; if not, write to the Free
2214 //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2215
2216
2217
2218
2219 //#pragma interface
2220
2221 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
2222 //    This is part of the iostream library, providing -*- C++ -*- input/output.
2223 //    Copyright (C) 1991 Per Bothner.
2224 //
2225 //    This library is free software; you can redistribute it and/or
2226 //    modify it under the terms of the GNU Library General Public
2227 //    License as published by the Free Software Foundation; either
2228 //    version 2 of the License, or (at your option) any later version.
2229 //
2230 //    This library is distributed in the hope that it will be useful,
2231 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
2232 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2233 //    Library General Public License for more details.
2234 //
2235 //    You should have received a copy of the GNU Library General Public
2236 //    License along with this library; if not, write to the Free
2237 //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2238
2239 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2240
2241 //# 23 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/strstream.h" 2
2242
2243
2244 class strstreambuf : public streambuf {
2245     size_t *lenp; /* current (logical) length (i.e. valid data bytes) */
2246     size_t *sizep; /* allocated (physical) buffer size */
2247     char **bufp;
2248     size_t _len;
2249     size_t _size;
2250     char *buf;
2251     int _frozen;
2252   protected:
2253     virtual int overflow(int = (-1) );
2254   public:
2255     strstreambuf();
2256     strstreambuf(int initial);
2257     strstreambuf(char *ptr, int size, char *pstart = ((void *)0) );
2258     ~strstreambuf();
2259     int frozen() { return _frozen; }
2260     void freeze(int n=1) { _frozen = n != 0; }
2261     size_t pcount();
2262     char *str();
2263 };
2264
2265 class istrstream : public istream {
2266   public:
2267     istrstream(char*);
2268     istrstream(char*, int);
2269     strstreambuf* rdbuf() { return (strstreambuf*)_strbuf; }
2270 };
2271
2272 class ostrstream : public ostream {
2273   public:
2274     ostrstream();
2275     ostrstream(char *cp, int n, int mode=ios::out);
2276     size_t pcount() { return ((strstreambuf*)_strbuf)->pcount(); }
2277     char *str() { return ((strstreambuf*)_strbuf)->str(); }
2278     void freeze(int n = 1) { ((strstreambuf*)_strbuf)->freeze(n); }
2279     int frozen() { return ((strstreambuf*)_strbuf)->frozen(); }
2280     strstreambuf* rdbuf() { return (strstreambuf*)_strbuf; }
2281 };
2282
2283
2284 //# 25 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 2
2285
2286
2287 //
2288 // tostrstream class
2289 //
2290 // An isteam class that doesn't have that nasty skipws parameter that
2291 // you have to remember to set.  This class simply provides the istream
2292 // functionality with a set of constructors which defaults skipws to
2293 // FALSE (instead of defaulting to TRUE as is the case with plain istream).
2294 //
2295 class tostrstream: public ostrstream {
2296 public:
2297     tostrstream(): ostrstream()
2298         { }
2299     // This constructor defines cp as the buffer to use for the
2300     // stream (instead of one of its own devising); it does NOT
2301     // initialize the ostrstream to contain cp (of length n).
2302   tostrstream(char *cp, int n, int mode=ios::out): ostrtream(cp, n, mode)       // ERROR - 
2303         { }
2304     char *str()
2305         {
2306             char *s = ostrstream::str();
2307             s[ostrstream::pcount()] = '\0';
2308             return s;
2309         }
2310 };
2311
2312
2313 //# 25 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
2314
2315
2316 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 1
2317 // -*- C++ -*-
2318
2319
2320
2321 //
2322 // GttObject class (is abstract)
2323 //
2324 // Expects to be included where needed explicitly.
2325 //
2326 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2327 //
2328
2329
2330
2331
2332
2333 //#pragma interface
2334
2335
2336 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2337 // $Author: jason $
2338 // $Revision: 1.6 $
2339 // $Date: 1994/05/16 09:13:02 $
2340
2341 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
2342 // -*- C++ -*-
2343 //# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
2344
2345 //# 25 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
2346
2347
2348 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 1
2349 // -*- C++ -*-
2350
2351
2352
2353 //
2354 // GttErrorHandler class
2355 //
2356 // Expects to be included by Gtt.h
2357 //
2358 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
2359 //
2360
2361
2362
2363
2364
2365 //#pragma interface
2366
2367
2368 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2369 // $Author: jason $
2370 // $Revision: 1.6 $
2371 // $Date: 1994/05/16 09:13:02 $
2372
2373 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
2374
2375
2376
2377
2378
2379
2380
2381 //# 25 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
2382
2383
2384 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 1
2385 // -*- C++ -*-
2386
2387
2388
2389 //
2390 // Fake up a libstuff++
2391 //
2392 // This is done as a complete and utter hack; this library has no function
2393 // at all being in the boot area; it is here solely in order to provide a
2394 // libstuff++ against which the Makefiles can resolve link lines.
2395 //
2396 // The only reason that this is done is to allow the STANDARD_C++_LIBRARIES
2397 // as provided by the Makefile templates in the boot area to be the same
2398 // ones that are used by the tools outside this hierarchy.
2399 //
2400 // The tools outside this hierarchy use a different libstuff++; one that is
2401 // written in C++.  This one is not written in C++ in order to be simpler.
2402 //
2403
2404
2405
2406
2407
2408 //#pragma interface
2409
2410
2411 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2412 // $Author: jason $
2413 // $Revision: 1.6 $
2414 // $Date: 1994/05/16 09:13:02 $
2415
2416 extern "C" {
2417 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 1
2418
2419
2420
2421 /*
2422  * Useful stuff
2423  */
2424
2425 /*
2426  * $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2427  * $Revision: 1.6 $
2428  * $Author: jason $
2429  * $Date: 1994/05/16 09:13:02 $
2430  */
2431
2432 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/ansi.h" 1
2433
2434
2435
2436
2437 /*
2438  * ANSI Compiler Support
2439  *
2440  * David Harrison
2441  * University of California, Berkeley
2442  * 1988
2443  *
2444  * ANSI compatible compilers are supposed to define the preprocessor
2445  * directive __STDC__.  Based on this directive, this file defines
2446  * certain ANSI specific macros.
2447  *
2448  * ARGS:
2449  *   Used in function prototypes.  Example:
2450  *   extern int foo
2451  *     ARGS((char *blah, double threshold));
2452  */
2453
2454 /*
2455  * $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2456  * $Author: jason $
2457  * $Revision: 1.6 $
2458  * $Date: 1994/05/16 09:13:02 $
2459  *
2460  * Modifications
2461  * Wendell C Baker
2462  * University of California, Berkeley
2463  */
2464
2465 /* Function prototypes */
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493 //# 15 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 2
2494
2495
2496
2497 /*
2498  * If g++, then we stub out part of this thing and let the C++ types take
2499  * over and do the same job; some compatibility must be given however
2500  */
2501
2502 /*
2503  *    Use the GNU libg++ definition
2504  */
2505 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
2506
2507
2508
2509
2510
2511
2512
2513 //# 26 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 2
2514
2515 //# 35 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h"
2516
2517
2518 /*
2519  * Make various pieces of C code that use the old ``Boolean''
2520  * be compatible by faking up the definition of Boolean using
2521  * the new bool type.
2522  */
2523
2524
2525 //# 58 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h"
2526
2527
2528 typedef long FitAny;            /* can fit any integral type */
2529
2530 /*
2531  * typedef char *String;        - DO NOT USE THIS - it conflicts with C++
2532  * typedef char **Stringv;      - just use char* and char** instead.
2533  *                              - void* can be used for arbitrary pointers
2534  */
2535
2536
2537
2538
2539 extern int nocase_strcmp (char *, char *)               ;
2540 extern int nocase_strncmp (char *, char *, int)         ;
2541
2542 extern bool      nocase_strequal (char *, char *)               ;
2543 extern bool      nocase_strnequal (char *, char *, int)         ;
2544
2545 extern bool      lead_strequal (char *, char *)         ;
2546 extern bool      nocase_lead_strequal (char *, char *)          ;
2547
2548 extern int strhash (char *, int)                ;
2549 extern int nocase_strhash (char *, int)         ;
2550
2551 extern int sign (int)           ;
2552
2553 /*
2554  *    Some useful macros.
2555  */
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585 //# 33 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
2586
2587 }
2588
2589 //
2590 // This is here because we wish to provide externs for the two
2591 // functions btoa(bool, unsigned = 0) and operator<<(ostream&, bool)
2592 // because they are not provided in bool.h.
2593 //
2594 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
2595
2596
2597
2598
2599
2600
2601
2602 //# 41 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
2603
2604 extern const char *stringify(bool b);
2605 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
2606 //    This is part of the iostream library, providing -*- C++ -*- input/output.
2607 //    Copyright (C) 1991 Per Bothner.
2608 //
2609 //    This library is free software; you can redistribute it and/or
2610 //    modify it under the terms of the GNU Library General Public
2611 //    License as published by the Free Software Foundation; either
2612 //    version 2 of the License, or (at your option) any later version.
2613 //
2614 //    This library is distributed in the hope that it will be useful,
2615 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
2616 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2617 //    Library General Public License for more details.
2618 //
2619 //    You should have received a copy of the GNU Library General Public
2620 //    License along with this library; if not, write to the Free
2621 //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2622
2623 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2624
2625 //# 43 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
2626
2627 extern ostream& operator<<(ostream&, bool);
2628
2629 // Should this be kept separate?   bool isn't, but then  is
2630 // included here only to define ostream& operator<<(ostream&, bool)
2631 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/unit.h" 1
2632 // -*- C++ -*-
2633
2634
2635
2636 //
2637 // unit enum
2638 //
2639 // Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU)
2640 //
2641
2642 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2643 // $Author: jason $
2644 // $Revision: 1.6 $
2645 // $Date: 1994/05/16 09:13:02 $
2646
2647 //
2648 // unit enum
2649 //
2650 // This _looks_ silly, but it has an important theoretical basis in category
2651 // theory.  For the pragmatic reason for its existence, see the example below.
2652 //
2653 enum unit {
2654     UNIT = 1,
2655 };
2656
2657 extern const char *stringify(unit u);
2658
2659 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
2660 //    This is part of the iostream library, providing -*- C++ -*- input/output.
2661 //    Copyright (C) 1991 Per Bothner.
2662 //
2663 //    This library is free software; you can redistribute it and/or
2664 //    modify it under the terms of the GNU Library General Public
2665 //    License as published by the Free Software Foundation; either
2666 //    version 2 of the License, or (at your option) any later version.
2667 //
2668 //    This library is distributed in the hope that it will be useful,
2669 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
2670 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2671 //    Library General Public License for more details.
2672 //
2673 //    You should have received a copy of the GNU Library General Public
2674 //    License along with this library; if not, write to the Free
2675 //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2676
2677 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2678
2679 //# 28 "/sandbox/wbaker/wbaker0/source/mips/include/unit.h" 2
2680
2681 extern ostream& operator<<(ostream&, unit);
2682
2683 //
2684 // A unit is used in cases where the type signature of an overloaded
2685 // function must be differentiated in some stronger way than can be
2686 // denoted unambiguously in the C++ syntax.  This enum is used to give
2687 // one of the functions a different type signature, thereby allowing
2688 // the overloading.
2689 //
2690 // The use of ``unit'' instead of int or bool is important because a unit
2691 // has only one possible value; therefore it adds no more information to
2692 // the code.   For example, say a bool was used instead, then in the testing
2693 // phase, would have to ask: what if TRUE was given, what if FALSE was given.
2694 // The problem is compounded if char or int is used.
2695 //
2696 // Example:
2697 //
2698 //     class ID {
2699 //     public:
2700 //         ID();                // construct a null ID
2701 //         ID(unit);            // alloc a ID with a new id
2702 //     private:
2703 //         static unsigned high_water;
2704 //         unsigned id;
2705 //     };
2706 //
2707 // Try working this example save that ID implements all of the generic
2708 // features of the identifier object, but the high_water is stored
2709 // in the heir.  That is what originally motivated the creation of unit.
2710 //
2711
2712
2713 //# 48 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
2714
2715
2716 //
2717 // In the spirit of the standard GNU error handler functions
2718 // as described in
2719 //     typedef void (*one_arg_error_handler_t)(const char*);
2720 //         a one argument error handler function pointer
2721 //     typedef void (*two_arg_error_handler_t)(const char*, const char*);
2722 //         a two argument error handler function pointer
2723 //
2724 // And now the NEW
2725 //
2726 // typedef void (*zero_arg_error_handler_t)();
2727 //     a zero argument error handler function pointer
2728 //
2729 typedef void (*zero_arg_error_handler_t)();
2730
2731 //
2732 // In the spirit of the default GNU error handler functions
2733 // as described in
2734 //     extern void default_one_arg_error_handler(const char *message);
2735 //         print out message on stderr, and do the default thing (abort)
2736 //     extern void default_two_arg_error_handler(const char *kind, const char *message);
2737 //         print out kind and message on stderr, and do the default thing (abort)
2738 //
2739 // And now the NEW
2740 //
2741 // extern void default_zero_arg_error_handler(const char *message);
2742 //     do the default thing (abort)
2743 //
2744 extern void default_zero_arg_error_handler();
2745
2746 // Guaranteed to exit (1)
2747 extern void exit_zero_arg_error_handler();
2748 extern void exit_one_arg_error_handler(const char *message);
2749 extern void exit_two_arg_error_handler(const char *kind, const char *message);
2750
2751 // Guaranteed to abort()
2752 extern void abort_zero_arg_error_handler();
2753 extern void abort_one_arg_error_handler(const char *message);
2754 extern void abort_two_arg_error_handler(const char *kind, const char *message);
2755
2756 //
2757 // In the spirit of the standard GNU error handlers
2758 // as described in
2759 //     extern void  verbose_File_error_handler(const char*);
2760 //         perror and set errno = 0
2761 //     extern void  quiet_File_error_handler(const char*);
2762 //         set errno = 0
2763 //     extern void  fatal_File_error_handler(const char*);
2764 //         perror and exit 1
2765 //
2766 // And now the NEW
2767 //
2768 // extern void preserve_File_error_handler(const char *message);
2769 //     no perror, no assignment to errno.
2770 //
2771 extern void preserve_File_error_handler(const char *message);
2772
2773
2774 //# 27 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
2775
2776 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
2777 // -*- C++ -*-
2778 //# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
2779
2780 //# 28 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
2781
2782
2783 //
2784 // It is expected that this will be virtually multiply inherited
2785 // into all of the classes that need error reporting services.
2786 //
2787 // The typical way to have that done is by inheriting the GttObject
2788 // as a virtual base class.
2789 //
2790
2791 //
2792 // GttErrorHandler class
2793 //
2794 class GttErrorHandler {
2795 public:
2796     GttErrorHandler();
2797     GttErrorHandler(const char *program);
2798     virtual ~GttErrorHandler();
2799
2800     //
2801     // Error messages
2802     //     - an unacceptable, but expected and recoverable condition
2803     //       was was detected (but the test fails)
2804     //     - errors are for ``the expected environment was not found''
2805     //       rather than for ``file couldn't be opened''
2806     //     - these messages cannot be shut off
2807     //     - the error handler determines the recovery action
2808     //       TODO - one day exceptions will be used here
2809     //
2810     static void error(const char *message);
2811     static void error(tostrstream& message);
2812
2813     static void error(const char *function, const char *message);
2814     static void error(const char *function, tostrstream& message);
2815
2816     static void error(const char *class_name, const char *method, const char *message);
2817     static void error(const char *class_name, const char *method, tostrstream& message);
2818
2819     //
2820     // Fatal messages
2821     //     - an unacceptable and unexpected error was detected
2822     //       the data invariants were violated, there is no recovery
2823     //     - these messages cannot be shut off
2824     //     - the error handler determines the recovery action
2825     //       TODO - one day exceptions will be used here
2826     //
2827     static void fatal(const char *message);
2828     static void fatal(tostrstream& message);
2829
2830     static void fatal(const char *function, const char *message);
2831     static void fatal(const char *function, tostrstream& message);
2832
2833     static void fatal(const char *class_name, const char *method, const char *message);
2834     static void fatal(const char *class_name, const char *method, tostrstream& message);
2835 private:
2836     //
2837     // Two underscores are used here in order to prevent confusion of these
2838     // private variables with any of the heir's private variables.  Note that
2839     // access control is different than visibility in C++, so all the variable
2840     // names in a class hierarchy must be unique.
2841     //
2842
2843     static bool __partial_init;
2844     static void __partial_initialize();
2845     static bool __full_init;
2846     static void __full_initialize(const char *program);
2847     static char *__program;
2848
2849     static void __handle_error();
2850     static void __handle_fatal();
2851     static void __add_newline(const char *message);
2852
2853     static bool __output_valid();
2854     static ostream *__output;
2855 };
2856
2857
2858 //# 27 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
2859
2860
2861 //
2862 // GttObject class (is abstract)
2863 //
2864 class GttObject: virtual public GttErrorHandler {
2865 protected:
2866     GttObject();
2867     GttObject(const GttObject&);
2868     virtual ~GttObject();       // ensure descendants have virtual destructors
2869
2870 public:
2871     //
2872     // I/O Support
2873     //
2874     // The value typically persists only long enough for an i/o operation
2875     // to be performed (see the defintion of output via operator<<(... ) below)
2876     virtual const char *stringify();
2877 protected:
2878     // This is the buffer into which the printed representation of this
2879     // object will be put when the time comes.  It is associated with the
2880     // object so it will never go away (so long as the object exists).
2881     // Use a pointer so that you only pay for the space when I/O is used
2882     tostrstream *stringbuf;
2883     void clear_stringbuf();
2884
2885 public:
2886     //
2887     // Consistency
2888     //
2889     // The global data invariant for the whole object (heirs included).
2890     // This OK function will call the local invariant function ok() if
2891     // necessary and in addition the OK functions of the heirs
2892     // This is expected to compute the data invariant of the object.
2893     // It will execute GctErrorHandler::fatal if there is wrong.
2894     virtual void OK() const;
2895
2896 protected:
2897     //
2898     // consistency
2899     //
2900     // This function computes the invariant which is local to this object.
2901     // It does not call any of the ancestor's OK() or ok() functions.
2902     // It is not a virtual function so that it can be called from within a
2903     // constructor with impunity.  Thus this function MUST NOT call any
2904     // virtual functions either; it should call them by their full name if
2905     // that is necessary.  The global OK() function will call this function
2906     // as necessary.
2907     //
2908     // This function must NOT NEVER EVER be made virtual.
2909     void ok() const;
2910
2911 protected:
2912     //
2913     // Class Name
2914     //
2915     // This must return a static (constant) string which is the name
2916     // of the class being declared.  By convention, not all classes
2917     // must have one of these, but the major root abstract class must
2918     // have one in order to allow the stringify() to work approximately
2919     // correctly.
2920     virtual const char *class_name() const = 0;
2921 };
2922
2923 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
2924 //    This is part of the iostream library, providing -*- C++ -*- input/output.
2925 //    Copyright (C) 1991 Per Bothner.
2926 //
2927 //    This library is free software; you can redistribute it and/or
2928 //    modify it under the terms of the GNU Library General Public
2929 //    License as published by the Free Software Foundation; either
2930 //    version 2 of the License, or (at your option) any later version.
2931 //
2932 //    This library is distributed in the hope that it will be useful,
2933 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
2934 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2935 //    Library General Public License for more details.
2936 //
2937 //    You should have received a copy of the GNU Library General Public
2938 //    License along with this library; if not, write to the Free
2939 //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2940
2941 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
2942
2943 //# 91 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
2944
2945 extern ostream& operator<<(ostream&, GttObject&);
2946
2947 // There may be other X& operator<<(X&, GttObject&) defined in the
2948 // packages defining class X.  For example see the definition of
2949 // GttUnitObject& operator<<(GttUnitObject&, GttObject&) in Unit.
2950
2951
2952 //# 27 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
2953
2954
2955 //# 1 "../../../../../../mips/include/Gct/GctErrorHandler.h" 1
2956 // -*- C++ -*-
2957
2958
2959
2960 //
2961 // GctErrorHandler class
2962 //
2963 // Expects to be included by Gct.h
2964 //
2965 // Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU)
2966 //
2967
2968
2969
2970
2971
2972 //#pragma interface
2973
2974
2975 // $Source: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.mike/p784.C,v $
2976 // $Author: jason $
2977 // $Revision: 1.6 $
2978 // $Date: 1994/05/16 09:13:02 $
2979
2980 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
2981
2982
2983
2984
2985
2986
2987
2988 //# 25 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
2989
2990 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 1
2991 // This may look like C code, but it is really -*- C++ -*-
2992 /*
2993 Copyright (C) 1988 Free Software Foundation
2994     written by Doug Lea (dl@rocky.oswego.edu)
2995
2996 This file is part of the GNU C++ Library.  This library is free
2997 software; you can redistribute it and/or modify it under the terms of
2998 the GNU Library General Public License as published by the Free
2999 Software Foundation; either version 2 of the License, or (at your
3000 option) any later version.  This library is distributed in the hope
3001 that it will be useful, but WITHOUT ANY WARRANTY; without even the
3002 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
3003 PURPOSE.  See the GNU Library General Public License for more details.
3004 You should have received a copy of the GNU Library General Public
3005 License along with this library; if not, write to the Free Software
3006 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
3007 */
3008
3009
3010 //# 1321 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h"
3011
3012 //# 26 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
3013
3014 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
3015 //    This is part of the iostream library, providing -*- C++ -*- input/output.
3016 //    Copyright (C) 1991 Per Bothner.
3017 //
3018 //    This library is free software; you can redistribute it and/or
3019 //    modify it under the terms of the GNU Library General Public
3020 //    License as published by the Free Software Foundation; either
3021 //    version 2 of the License, or (at your option) any later version.
3022 //
3023 //    This library is distributed in the hope that it will be useful,
3024 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
3025 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3026 //    Library General Public License for more details.
3027 //
3028 //    You should have received a copy of the GNU Library General Public
3029 //    License along with this library; if not, write to the Free
3030 //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3031
3032 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
3033
3034 //# 27 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
3035
3036
3037 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 1
3038 // -*- C++ -*-
3039 //# 107 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h"
3040
3041 //# 29 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
3042
3043 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
3044 // -*- C++ -*-
3045 //# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
3046
3047 //# 30 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
3048
3049
3050 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 1
3051 // -*- C++ -*-
3052 //# 98 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h"
3053
3054 //# 32 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
3055
3056
3057 //
3058 // It is expected that this will be virtually multiply inherited
3059 // into all of the classes that need error reporting services.
3060 //
3061 // The typical way to have that done is by inheriting the GctObject
3062 // as a virtual base class.
3063 //
3064
3065 //
3066 // GctErrorHandler class
3067 //
3068 // GPP_1_96_BUG
3069 // NOTE - virtual public GttObject should be MI into GctObject - but that
3070 // causes g++ 1.96 to segfault; so we must inherit GttObject here and use SI
3071 // GPP_1_96_BUG
3072 class GctErrorHandler: virtual public GttObject {
3073 public:
3074     GctErrorHandler();
3075     GctErrorHandler(const String& program);
3076     virtual ~GctErrorHandler();
3077
3078     //
3079     // Debugging messages
3080     //     - these are turned off for production code.
3081     //     - these messages can be shut off
3082     //
3083     static void debug(const char *message);
3084     static void debug(tostrstream& message);
3085
3086     static void debug(const char *function, const char *message);
3087     static void debug(const char *function, tostrstream& message);
3088
3089     static void debug(const char *class_name, const char *method, const char *message);
3090     static void debug(const char *class_name, const char *method, tostrstream& message);
3091
3092     static bool debug();                // current debug switch
3093     static void debug(bool value);      // change the debug switch
3094
3095     //
3096     // Informational messages
3097     //     - these correspond to a ``verbose'' mode
3098     //     - these are not errors, just chatty progress reports
3099     //     - these messages can be shut off
3100     //
3101     static void note(const char *message);
3102     static void note(tostrstream& message);
3103
3104     static void note(const char *function, const char *message);
3105     static void note(const char *function, tostrstream& message);
3106
3107     static void note(const char *class_name, const char *method, const char *message);
3108     static void note(const char *class_name, const char *method, tostrstream& message);
3109
3110     static bool note();                 // current note switch
3111     static void note(bool value);       // change the note switch
3112
3113     //
3114     // Warning messages
3115     //     - warnings are system-recoverable errors
3116     //     - the system has noticed something and taken some
3117     //       corrective action
3118     //     - these messages can be shut off
3119     //
3120     static void warning(const char *message);
3121     static void warning(tostrstream& message);
3122
3123     static void warning(const char *function, const char *message);
3124     static void warning(const char *function, tostrstream& message);
3125
3126     static void warning(const char *class_name, const char *method, const char *message);
3127     static void warning(const char *class_name, const char *method, tostrstream& message);
3128
3129     static bool warning();              // current warning switch
3130     static void warning(bool value);    // change the warning switch
3131
3132     //
3133     // Error messages
3134     //     - an unacceptable, but expected and recoverable
3135     //       condition was was detected
3136     //     - errors are for ``the expected environment was not found''
3137     //       rather than for ``file couldn't be opened''
3138     //     - these messages cannot be shut off
3139     //     - the error handler determines the recovery action
3140     //       TODO - one day exceptions will be used here
3141     //
3142     static void error(const char *message);
3143     static void error(tostrstream& message);
3144
3145     static void error(const char *function, const char *message);
3146     static void error(const char *function, tostrstream& message);
3147
3148     static void error(const char *class_name, const char *method, const char *message);
3149     static void error(const char *class_name, const char *method, tostrstream& message);
3150
3151     // can't turn off errors - no ``static void error(bool value);''
3152     static zero_arg_error_handler_t error();            // current error handler
3153     static void error(zero_arg_error_handler_t handler);// change the error handler
3154
3155     static void error_is_lib_error_handler();           // change the error handler
3156     static void error_is_exit();                        // change the error handler
3157
3158     // Describes the fatal handler - WATCHOUT - implicitly uses AllocRing
3159     static const char *error_handler_description();
3160
3161     //
3162     // Fatal messages
3163     //     - an unacceptable and unexpected error was detected
3164     //       the data invariants were violated, there is no recovery
3165     //     - these messages cannot be shut off
3166     //     - the error handler determines the recovery action
3167     //       TODO - one day exceptions will be used here
3168     //
3169     static void fatal(const char *message);
3170     static void fatal(tostrstream& message);
3171
3172     static void fatal(const char *function, const char *message);
3173     static void fatal(const char *function, tostrstream& message);
3174
3175     static void fatal(const char *class_name, const char *method, const char *message);
3176     static void fatal(const char *class_name, const char *method, tostrstream& message);
3177
3178     // can't turn off fatals - no ``static void fatal(bool value);''
3179     static zero_arg_error_handler_t fatal();                    // return the fatal handler
3180     static void fatal(zero_arg_error_handler_t handler);        // change the fatal handler
3181
3182     static void fatal_is_exit();        // change the fatal handler
3183     static void fatal_is_abort();       // change the fatal handler
3184
3185     // Describes the fatal handler - WATCHOUT - implicitly uses AllocRing
3186     static const char *fatal_handler_description();
3187 private:
3188     //
3189     // Two underscores are used here in order to prevent confusion of these
3190     // private variables with any of the heir's private variables.  Note that
3191     // access control is different than visibility in C++, so all the variable
3192     // names in a class hierarchy must be unique.
3193     //
3194     static bool __debug;
3195     static bool __note;
3196     static bool __warning;
3197     static void (*__error_handler)();   // can't turn off errors
3198     static void (*__fatal_handler)();   // can't turn off fatals
3199
3200     static bool __partial_init;
3201     static void __partial_initialize();
3202     static bool __full_init;
3203     static void __full_initialize(const char *program);
3204     static char *__program;
3205
3206     static void __handle_error();
3207     static void __handle_fatal();
3208     static void __add_newline(const char *message);
3209     static void __message_switch(bool value, bool& flag, const char *description);
3210     static void __message_switch(bool value, bool& flag);
3211     static const char *__describe_handler(zero_arg_error_handler_t handler);
3212
3213     static bool __output_valid();
3214     static ostream *__output;
3215
3216     // GPP_1_96_BUG
3217     const char *class_name() const;
3218     // GPP_1_96_BUG
3219 };
3220
3221
3222 //# 29 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
3223
3224
3225 //
3226 // GctObject class (is abstract)
3227 //
3228 class GctObject: virtual public GctErrorHandler /*, virtual public GttObject*/ {
3229 protected:
3230     GctObject();
3231     GctObject(const GctObject&);
3232     virtual ~GctObject();       // ensure descendants have virtual destructors
3233
3234 public:
3235     //
3236     // I/O Support
3237     //
3238     // The value typically persists only long enough for an i/o operation
3239     // to be performed (see the defintion of output via operator<<(... ) below)
3240     virtual const char *stringify();
3241 protected:
3242     // This is the buffer into which the printed representation of this
3243     // object will be put when the time comes.  It is associated with the
3244     // object so it will never go away (so long as the object exists).
3245     // Use a pointer so that you only pay for the space when I/O is used
3246     tostrstream *stringbuf;
3247     void clear_stringbuf();
3248
3249 public:
3250     //
3251     // Consistency (global consistency)
3252     //
3253     // The global data invariant for the whole object (heirs included).
3254     // This OK function will call the local invariant function ok() if
3255     // necessary and in addition the OK functions of the heirs
3256     // This is expected to compute the data invariant of the object.
3257     // It will execute GctErrorHandler::fatal if there is wrong.
3258     virtual void OK() const;
3259
3260 protected:
3261     //
3262     // consistency (local consistency)
3263     //
3264     // This function computes the invariant which is local to this object.
3265     // It does not call any of the ancestor's OK() or ok() functions.
3266     // It is not a virtual function so that it can be called from within a
3267     // constructor with impunity.  Thus this function MUST NOT call any
3268     // virtual functions either; it should call them by their full name if
3269     // that is necessary.  The global OK() function will call this function
3270     // as necessary.
3271     //
3272     // This function must NOT NEVER EVER be made virtual.
3273     void ok() const;
3274 protected:
3275     //
3276     // Class Name
3277     //
3278     // This must return a static (constant) string which is the name
3279     // of the class being declared.  By convention, not all classes
3280     // must have one of these, but the major root abstract class must
3281     // have one in order to allow the stringify() to work approximately
3282     // correctly.
3283     virtual const char *class_name() const = 0;
3284
3285 public:
3286     //
3287     // The ``id'' of this object
3288     //
3289     // NOTE - we explicitly allow the situation where this function
3290     // can return the address of the object - the ``this'' pointer
3291     // instead of a computed id field (the __object_id field below).
3292     //
3293     // This function is protected because we don't want too much dependence
3294     // on this notion of object identity.  I want to be able to rip it
3295     // out if it becomes to cumbersome.
3296     unsigned objectId() const;
3297 private:
3298     //
3299     // Symbolic ID
3300     //
3301     // NOTE - Normally this would be implemented by the `this' pointer.
3302     // TODO - remove this for production code
3303     //
3304     // However, in order to make the test suites run on all machines, we
3305     // make this into a symbolic id that is maintained with each object.
3306     // Thus the valid outputs are always consistent across all machines.
3307     unsigned __object_id;
3308     static unsigned __next_id;
3309 };
3310
3311 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
3312 //    This is part of the iostream library, providing -*- C++ -*- input/output.
3313 //    Copyright (C) 1991 Per Bothner.
3314 //
3315 //    This library is free software; you can redistribute it and/or
3316 //    modify it under the terms of the GNU Library General Public
3317 //    License as published by the Free Software Foundation; either
3318 //    version 2 of the License, or (at your option) any later version.
3319 //
3320 //    This library is distributed in the hope that it will be useful,
3321 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
3322 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3323 //    Library General Public License for more details.
3324 //
3325 //    You should have received a copy of the GNU Library General Public
3326 //    License along with this library; if not, write to the Free
3327 //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3328
3329 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
3330
3331 //# 117 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
3332
3333 extern ostream& operator<<(ostream&, GctObject&);
3334
3335
3336 //# 25 "../../../../../../mips/include/Gct/Object/GctHashObject.h" 2
3337
3338
3339 //
3340 // GctHashObject class (is abstract)
3341 //
3342 class GctHashObject: virtual public GctObject {
3343 protected:
3344     GctHashObject();
3345     GctHashObject(const GctHashObject&);
3346
3347 public:
3348     //
3349     // hash support
3350     //
3351     virtual unsigned hash() const;
3352 };
3353
3354
3355 //# 28 "../../GctSymbol.h" 2
3356
3357
3358 //
3359 // GctSymbol
3360 //
3361 class GctSymbol: virtual public GctHashObject, String {
3362 public:
3363     GctSymbol();                // vacuous symbol required for genclass usage
3364     GctSymbol(const char*);
3365     GctSymbol(const String&);
3366     GctSymbol(const GctSymbol&);
3367
3368     operator const char *() const;
3369
3370     bool operator==(const GctSymbol&) const;
3371     bool operator!=(const GctSymbol&) const;
3372
3373     bool operator<=(const GctSymbol&) const;
3374     bool operator<(const GctSymbol&) const;
3375     bool operator>=(const GctSymbol&) const;
3376     bool operator>(const GctSymbol&) const;
3377
3378     unsigned hash() const;
3379
3380     // I/O Support
3381     const char *stringify();
3382
3383     // Consistency
3384     void OK() const;
3385 private:
3386     const char *class_name() const;
3387 };
3388
3389 extern unsigned hash(GctSymbol&);       // genclass support (no const)
3390
3391 //
3392 // Inline functions
3393 //
3394 // Note - none of the String operators save for operator const char *()
3395 // are String member functions, instead, they are anonymous functions
3396 // which work by overloading.
3397 //
3398
3399
3400
3401
3402
3403 GctSymbol::operator const char *() const
3404 {
3405
3406
3407
3408
3409
3410     return String::operator const char *();
3411 }
3412
3413 bool
3414 GctSymbol::operator==(const GctSymbol& other) const
3415 {
3416
3417
3418
3419
3420
3421     return (bool)::operator==(*this, other);
3422 }
3423
3424 bool
3425 GctSymbol::operator!=(const GctSymbol& other) const
3426 {
3427
3428
3429
3430
3431
3432     return (bool)::operator!=(*this, other);
3433 }
3434
3435 bool
3436 GctSymbol::operator<=(const GctSymbol& other) const
3437 {
3438
3439
3440
3441
3442
3443     return (bool)::operator<=(*this, other);
3444 }
3445
3446 bool
3447 GctSymbol::operator<(const GctSymbol& other) const
3448 {
3449
3450
3451
3452
3453
3454     return (bool)::operator<(*this, other);
3455 }
3456
3457 bool
3458 GctSymbol::operator>=(const GctSymbol& other) const
3459 {
3460
3461
3462
3463
3464
3465     return (bool)::operator>=(*this, other);
3466 }
3467
3468 bool
3469 GctSymbol::operator>(const GctSymbol& other) const
3470 {
3471
3472
3473
3474
3475
3476     return (bool)::operator>(*this, other);
3477 }
3478
3479
3480 //# 25 "GctSymbol.defs.h" 2
3481
3482
3483 // equality operator
3484
3485
3486
3487
3488 // less-than-or-equal
3489
3490
3491
3492
3493 // comparison : less-than ->  0
3494
3495
3496
3497
3498 // hash function
3499
3500 extern unsigned int hash(GctSymbol&);
3501
3502
3503
3504 // initial capacity for structures requiring one
3505
3506
3507
3508
3509
3510
3511
3512 //# 27 "GctSymbol.GctSymbol.Map.h" 2
3513
3514
3515 class GctSymbolGctSymbolMap
3516 {
3517 protected:
3518   int                   count;
3519   GctSymbol                   def;
3520
3521 public:
3522                         GctSymbolGctSymbolMap(GctSymbol& dflt);
3523   virtual              ~GctSymbolGctSymbolMap();
3524
3525   int                   length();                // current number of items
3526   int                   empty();
3527
3528   virtual int           contains(GctSymbol& key);      // is key mapped?
3529
3530   virtual void          clear();                 // delete all items
3531
3532   virtual GctSymbol&          operator [] (GctSymbol& key) = 0; // access contents by key
3533
3534   virtual void          del(GctSymbol& key) = 0;       // delete entry
3535
3536   virtual Pix           first() = 0;             // Pix of first item or 0
3537   virtual void          next(Pix& i) = 0;        // advance to next or 0
3538   virtual GctSymbol&          key(Pix i) = 0;          // access key at i
3539   virtual GctSymbol&          contents(Pix i) = 0;     // access contents at i
3540
3541   virtual int           owns(Pix i);             // is i a valid Pix  ?
3542   virtual Pix           seek(GctSymbol& key);          // Pix of key
3543
3544   GctSymbol&                  dflt();                  // access default val
3545
3546   void                  error(const char* msg);
3547   virtual int           OK() = 0;                // rep invariant
3548 };
3549
3550
3551
3552 inline GctSymbolGctSymbolMap::~GctSymbolGctSymbolMap() {}
3553
3554 inline int GctSymbolGctSymbolMap::length()
3555 {
3556   return count;
3557 }
3558
3559 inline int GctSymbolGctSymbolMap::empty()
3560 {
3561   return count == 0;
3562 }
3563
3564 inline GctSymbol& GctSymbolGctSymbolMap::dflt()
3565 {
3566   return def;
3567 }
3568
3569 inline GctSymbolGctSymbolMap::GctSymbolGctSymbolMap(GctSymbol& dflt) :def(dflt)
3570 {
3571   count = 0;
3572 }
3573
3574
3575
3576
3577 //# 26 "GctSymbol.GctSymbol.CHMap.h" 2
3578
3579
3580
3581
3582
3583 struct GctSymbolGctSymbolCHNode
3584 {
3585   GctSymbolGctSymbolCHNode*      tl;
3586   GctSymbol                hd;
3587   GctSymbol                cont;
3588                      GctSymbolGctSymbolCHNode();
3589                      GctSymbolGctSymbolCHNode(GctSymbol& h, GctSymbol& c, GctSymbolGctSymbolCHNode* t = 0);
3590                      ~GctSymbolGctSymbolCHNode();
3591 };
3592
3593
3594
3595 inline GctSymbolGctSymbolCHNode::GctSymbolGctSymbolCHNode() {}
3596
3597 inline GctSymbolGctSymbolCHNode::GctSymbolGctSymbolCHNode(GctSymbol& h, GctSymbol& c, GctSymbolGctSymbolCHNode* t)
3598      : hd(h), cont(c), tl(t) {}
3599
3600 inline GctSymbolGctSymbolCHNode::~GctSymbolGctSymbolCHNode() {}
3601
3602
3603
3604
3605 typedef GctSymbolGctSymbolCHNode* GctSymbolGctSymbolCHNodePtr;
3606
3607
3608
3609
3610 class GctSymbolGctSymbolCHMap : public GctSymbolGctSymbolMap
3611 {
3612 protected:
3613   GctSymbolGctSymbolCHNode** tab;
3614   unsigned int   size;
3615
3616 public:
3617                 GctSymbolGctSymbolCHMap(GctSymbol& dflt,unsigned int sz=100 );
3618                 GctSymbolGctSymbolCHMap(GctSymbolGctSymbolCHMap& a);
3619                 ~GctSymbolGctSymbolCHMap();
3620
3621   GctSymbol&          operator [] (GctSymbol& key);
3622
3623   void          del(GctSymbol& key);
3624
3625   Pix           first();
3626   void          next(Pix& i);
3627   GctSymbol&          key(Pix i);
3628   GctSymbol&          contents(Pix i);
3629
3630   Pix           seek(GctSymbol& key);
3631   int           contains(GctSymbol& key);
3632
3633   void          clear();
3634   int           OK();
3635 };
3636
3637
3638
3639 inline GctSymbolGctSymbolCHMap::~GctSymbolGctSymbolCHMap()
3640 {
3641   clear();
3642   delete tab;
3643 }
3644
3645 inline int GctSymbolGctSymbolCHMap::contains(GctSymbol& key)
3646 {
3647   return seek(key) != 0;
3648 }
3649
3650 inline GctSymbol& GctSymbolGctSymbolCHMap::key(Pix p)
3651 {
3652   if (p == 0) error("null Pix");
3653   return ((GctSymbolGctSymbolCHNode*)p)->hd;
3654 }
3655
3656 inline GctSymbol& GctSymbolGctSymbolCHMap::contents(Pix p)
3657 {
3658   if (p == 0) error("null Pix");
3659   return ((GctSymbolGctSymbolCHNode*)p)->cont;
3660 }
3661
3662
3663
3664
3665 //# 22 "GctSymbol.GctSymbol.CHMap.cc" 2
3666
3667
3668 // The nodes are linked together serially via a version
3669 // of a trick used in some vtables: odd pointers are
3670 // actually links to the next table entry.
3671 // Not terrible, but not wonderful either
3672
3673 static inline int goodCHptr(GctSymbolGctSymbolCHNode* t)
3674 {
3675   return ((((unsigned)t) & 1) == 0);
3676 }
3677
3678 static inline GctSymbolGctSymbolCHNode* index_to_CHptr(int i)
3679 {
3680   return (GctSymbolGctSymbolCHNode*)((i << 1) + 1);
3681 }
3682
3683 static inline int CHptr_to_index(GctSymbolGctSymbolCHNode* t)
3684 {
3685   return ( ((unsigned) t) >> 1);
3686 }
3687
3688 GctSymbolGctSymbolCHMap::GctSymbolGctSymbolCHMap(GctSymbol& dflt, unsigned int sz)
3689      :GctSymbolGctSymbolMap(dflt)
3690 {
3691   tab = (GctSymbolGctSymbolCHNode**)(new GctSymbolGctSymbolCHNodePtr[size = sz]);
3692   for (unsigned int i = 0; i < size; ++i) tab[i] = index_to_CHptr(i+1);
3693   count = 0;
3694 }
3695
3696 GctSymbolGctSymbolCHMap::GctSymbolGctSymbolCHMap(GctSymbolGctSymbolCHMap& a) :GctSymbolGctSymbolMap(a.def)
3697 {
3698   tab = (GctSymbolGctSymbolCHNode**)(new GctSymbolGctSymbolCHNodePtr[size = a.size]);
3699   for (unsigned int i = 0; i < size; ++i) tab[i] = index_to_CHptr(i+1);
3700   count = 0;
3701   for (Pix p = a.first(); p; a.next(p)) (*this)[a.key(p)] = a.contents(p); // gets bogus error - type `GctSymbol' is derived from private `String'
3702 }