1 // Special g++ Options: -w
5 //# 1 "GctNameRef.List.cc"
6 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine++.h" 1
17 // WATCHOUT - CC 2.1 uses regular old cpp as its #ifdef processor
18 // whereas GNU uses a special preprocessor (actually ``gcc-cpp -+'')
19 // This implies that there can be no C++ comments on lines which are
20 // to be understood by cpp. Actually it turns out that only lines
21 // with grammatical structures (such as ``#if defined( ... )'') are
22 // affected, but this is probably a good rule to follow elsewhere too.
26 // Define a ``Standard C++ Unix Machine''
28 // By whatever means are available in sumachine and elsewhere,
29 // figure out what type of C++ world we are on.
31 // See also "sumachine.h"
34 // This file is expected to be included as the first #include file in
35 // all .cc files This file should be included in each and every src file
36 // compiled b/c it ensures that the environment which those src files
37 // expect exists either by fiat or by faking it.
44 // This pragma only works under g++ 1 (it no longer works for gcc2)
49 // Because between releases of Cygnus' stuff, the definitions keep bouncing
50 // around between so fast that one can't
51 // keep one's code compiling ... Just include them all and be done with it.
52 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stdlib.h" 1
58 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 1
65 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/mips/lib/gcc/decstatn/cygnus-1.96/include/stddef.h" 1
72 /* This avoids lossage on Sunos but only if stdtypes.h comes first.
73 There's no way to win with the other order! Sun lossage. */
75 /* In case nobody has defined these types, but we aren't running under
76 GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
77 __WCHAR_TYPE__ have reasonable values. This can happen if the
78 parts of GCC is compiled by an older compiler, that actually
79 include gstddef.h, such as collect2. */
81 /* Signed type of difference of two pointers. */
96 typedef long int ptrdiff_t;
103 /* Unsigned type of `sizeof' something. */
125 /* Data type for wide chars. */
149 /* A null pointer constant. */
154 /* Offset of member MEMBER in a struct of type TYPE. */
160 //# 7 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 2
167 //# 6 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stdlib.h" 2
180 double atof(const char*);
181 int atoi(const char*);
182 long atol(const char*);
184 int atexit(auto void (*p) (void));
185 int bsearch (const void *, const void *, size_t,
186 size_t, auto int (*ptf)(const void*, const void*));
187 void* calloc(size_t, size_t);
196 char* fcvt(double, int, int*, int*);
198 char* getenv(const char*);
199 int getopt(int, const char**, const char*);
200 int getpw(int, char*);
201 char* gcvt(double, int, char*);
202 char* ecvt(double, int, int*, int*);
203 extern char** environ;
206 void* malloc(size_t);
207 size_t malloc_usable_size(void*);
208 int putenv(const char*);
212 void qsort(void*, size_t, size_t, auto int (*ptf)(void*,void*));
214 void* realloc(void*, size_t);
215 int setkey(const char*);
216 int srand(unsigned int);
217 double strtod(const char*, char**);
218 long strtol(const char*, char**, int);
219 unsigned long stroul(const char**, int);
220 int system(const char*);
224 char* setstate(char*);
225 char* initstate(unsigned, char*, int);
227 double drand48(void);
228 void lcong48(short*);
229 long jrand48(short*);
232 long nrand48(short*);
233 short* seed48(short*);
236 char* ctermid(char*);
237 char* cuserid(char*);
238 char* tempnam(const char*, const char*);
243 //# 44 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine++.h" 2
245 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/std.h" 1
246 // This may look like C code, but it is really -*- C++ -*-
248 Copyright (C) 1988, 1992 Free Software Foundation
249 written by Doug Lea (dl@rocky.oswego.edu)
251 This file is part of the GNU C++ Library. This library is free
252 software; you can redistribute it and/or modify it under the terms of
253 the GNU Library General Public License as published by the Free
254 Software Foundation; either version 2 of the License, or (at your
255 option) any later version. This library is distributed in the hope
256 that it will be useful, but WITHOUT ANY WARRANTY; without even the
257 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
258 PURPOSE. See the GNU Library General Public License for more details.
259 You should have received a copy of the GNU Library General Public
260 License along with this library; if not, write to the Free Software
261 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
268 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 1
269 //# 12 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h"
271 //# 23 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/std.h" 2
273 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stdlib.h" 1
276 //# 80 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stdlib.h"
278 //# 24 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/std.h" 2
280 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/string.h" 1
285 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 1
286 //# 12 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h"
288 //# 5 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/string.h" 2
294 char* strcat(char*, const char*);
295 char* strchr(const char*, int);
296 int strcmp(const char*, const char*);
297 int strcoll(const char*, const char*);
298 char* strcpy(char*, const char*);
299 size_t strcspn(const char*, const char*);
300 char* strdup(const char*);
302 char* strncat(char*, const char*, size_t);
303 int strncmp(const char*, const char*, size_t);
304 char* strncpy(char*, const char*, size_t);
305 char* strpbrk(const char*, const char*);
306 char* strrchr(const char*, int);
307 size_t strspn(const char*, const char*);
308 char* strstr(const char*, const char *);
309 char* strtok(char*, const char*);
310 size_t strxfrm(char*, const char*, size_t);
321 char* index(const char*, int);
322 char* rindex(const char*, int);
327 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/memory.h" 1
332 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 1
333 //# 12 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h"
335 //# 5 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/memory.h" 2
340 void* memalign(size_t, size_t);
341 void* memccpy(void*, const void*, int, size_t);
342 void* memchr(const void*, int, size_t);
345 void* memset(void*, int, size_t);
347 size_t getpagesize(void);
348 void* valloc(size_t);
361 void bcopy(const void*, void*, size_t); // USG uses version in bcopy.c
362 int bcmp(const void*, const void*, int);
363 void bzero(void*, int);
381 //# 43 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/string.h" 2
385 //# 25 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/std.h" 2
387 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/memory.h" 1
389 //# 49 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/memory.h"
391 //# 26 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/std.h" 2
393 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/unistd.h" 1
397 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 1
398 //# 12 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h"
400 //# 4 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/unistd.h" 2
411 unsigned alarm(unsigned);
413 int chdir(const char*);
414 int chmod(const char*, int);
415 int chown(const char*, int, int);
417 char* crypt(const char*, const char*);
420 char* encrypt(char*, int);
421 int execl(const char*, const char *, ...);
422 int execle(const char*, const char *, ...);
423 int execlp(const char*, const char*, ...);
424 int exect(const char*, const char**, char**);
425 int execv(const char*, const char**);
426 int execve(const char*, const char**, char**);
427 int execvp(const char*, const char**);
428 int fchown(int, int, int);
431 int ftruncate(int, unsigned long);
432 char* getcwd(char*, int);
433 int getdomainname(char*, int);
434 int getdtablesize(void);
436 int getgroups(int, int*);
440 long gethostid(void);
441 int gethostname(char*, int);
445 char* getlogin(void);
446 char* getpass(const char*);
447 unsigned getuid(void);
448 int ioctl(int, int, void*);
450 int link(const char*, const char*);
455 void volatile pause(void);
460 int readlink(const char*, char*, int);
461 int rename(const char*, const char*);
462 int rmdir(const char*);
464 int syscall(int, ...);
466 int sethostname(const char*, int);
468 int setregid(int, int);
469 int setreuid(int, int);
471 unsigned sleep(unsigned);
472 void swab(void*, void*, int);
473 int symlink(const char*, const char*);
474 int truncate(const char*, unsigned long);
477 // int umask(int); /* commented out for now; wrong for SunOs4.1 */
478 int unlink(const char*);
483 long lseek(int, long, int);
484 int read(int, void*, size_t);
485 int write(int, const void*, size_t);
486 int access(const char*, int);
496 //# 27 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/std.h" 2
498 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stdio.h" 1
499 // This may look like C code, but it is really -*- C++ -*-
501 Copyright (C) 1988 Free Software Foundation
502 written by Doug Lea (dl@rocky.oswego.edu)
504 This file is part of the GNU C++ Library. This library is free
505 software; you can redistribute it and/or modify it under the terms of
506 the GNU Library General Public License as published by the Free
507 Software Foundation; either version 2 of the License, or (at your
508 option) any later version. This library is distributed in the hope
509 that it will be useful, but WITHOUT ANY WARRANTY; without even the
510 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
511 PURPOSE. See the GNU Library General Public License for more details.
512 You should have received a copy of the GNU Library General Public
513 License along with this library; if not, write to the Free Software
514 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
518 * Please check the following before installing this file:
520 * Make sure USG is #defined if you are on a USG system!
522 * Check the value of _NFILE against the one in your /usr/include/stdio.h.
525 * Check whether your libc.a sprintf function returns
526 * an int (as do most) versus a char* (BSD), and (un)comment
527 * the corresponding SPRINTF_RETURNS_INT line.
529 * Check the value of BUFSIZ against the one in your /usr/include/stdio.h.
531 * Carefully check the fields and order of _iobuf declaration against
532 * the one in your /usr/include/stdio.h. Xenix-based systems
533 * may need some re-ordering of _iobuf. fields.
535 * Note that some _IOXXX #defines may not be present in your
536 * /usr/include/stdio.h. This is ok, so long as the ones that
537 * are present in both are set to the same values.
539 * Some of the prototypes refer to functions that may not be
540 * present in your libc.a. This is ok so long as you do not
541 * actually call such functions.
555 // Note: The #define _stdio_h is at the end of this file,
556 // in case #include_next finds an installed version of this
557 // same file -- we want it to continue until it finds the C version.
560 HAVE_VPRINTF should be set if vprintf is in libc.a
561 HAVE_SETVBUF should be set if setvbuf is in libc.a
562 HAVE_SETLINEBUF should be set if setlinebuf in libc.a
564 The following are probably correct for the listed systems
572 //# 85 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stdio.h"
576 //# 158 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stdio.h"
608 //# 1 "/usr/include/stdio.h" 1
609 /* @(#)stdio.h 4.6 (ULTRIX) 3/1/91 */
610 /************************************************************************
612 * Copyright (c) 1985 by *
613 * Digital Equipment Corporation, Maynard, MA *
614 * All rights reserved. *
616 * This software is furnished under a license and may be used and *
617 * copied only in accordance with the terms of such license and *
618 * with the inclusion of the above copyright notice. This *
619 * software or any other copies thereof may not be provided or *
620 * otherwise made available to any other person. No title to and *
621 * ownership of the software is hereby transferred. *
623 * This software is derived from software received from the *
624 * University of California, Berkeley, and from Bell *
625 * Laboratories. Use, duplication, or disclosure is subject to *
626 * restrictions under license agreements with University of *
627 * California and with AT&T. *
629 * The information in this software is subject to change without *
630 * notice and should not be construed as a commitment by Digital *
631 * Equipment Corporation. *
633 * Digital assumes no responsibility for the use or reliability *
634 * of its software on equipment which is not supplied by Digital. *
636 ************************************************************************/
637 /************************************************************************
638 * Modification History
640 * Mitch Condylis 28-Feb-1991
641 * Changed _file member of FILE structure from char to short
642 * as part of work to increase max number of open file descriptors.
644 * Mike Thomas, 7-Sep-1990
645 * 016 Back out most of 015. Leave in explicit declarations.
647 * Mike Thomas, 21-Aug-1990
648 * 015 DECwest ANSI - change _filbuf to __filbuf for ANSI compliance.
649 * Explicitly declare __filbuf under __STDC__.
652 * 014 Mike Thomas, 08-Jun-90
653 * Changed _POSIX_SOURCE reference back to POSIX.
655 * 013 Dan Smith, 23-Feb-90
656 * Added const to several prototypes. More namespace protection.
657 * Changed reference of POSIX to _POSIX_SOURCE.
659 * Jon Reeves, 07-Dec-1989
660 * 012 Namespace protection.
662 * Jon Reeves, 09-Nov-1989
663 * 011 Fix putc properly: could still sign-extend in some cases before.
665 * Linda Wilson, 06-Oct-1989
666 * 010 Declare sprintf as int for std conformance
668 * Jon Reeves, 25-Aug-1989
669 * 009 Fix putc[har] for 8-bit mode (unsigned int->char)
671 * Jon Reeves, 18-Jul-1989
672 * 008 Add getw, putw for X/Open conformance.
674 * Jon Reeves, 31-May-1989
675 * 007 ANSI conformance; clean up rogue comments. sprintf is still
678 * Lu Anne Van de Pas, 02-Jun-1986
679 * 006 Added ending "/" to P_tmpdir string.
681 * David L Ballenger, 22-Nov-1985
682 * 005 Correct definition of sprintf() for System V environment.
684 * David L Ballenger, 01-Aug-1985
685 * 004 Add _IOAPPEND flag for files opened with "A" or "A+".
687 * David L Ballenger, 26-Jun-1985
688 * 003 Add changes so that FILE structures are allocated dynamically.
690 * Larry Cohen, 23-April-1985
691 * - change NFILE from 20 to 64
693 * David L Ballenger, 13-Mar-1985
694 * 0001 Add System V definitions.
695 ************************************************************************/
697 //# 1 "/usr/include/ansi_compat.h" 1
699 * @(#)ansi_compat.h 4.4 (ULTRIX) 10/8/90
702 /************************************************************************
704 * Copyright (c) 1990 by *
705 * Digital Equipment Corporation, Maynard, MA *
706 * All rights reserved. *
708 * This software is furnished under a license and may be used and *
709 * copied only in accordance with the terms of such license and *
710 * with the inclusion of the above copyright notice. This *
711 * software or any other copies thereof may not be provided or *
712 * otherwise made available to any other person. No title to and *
713 * ownership of the software is hereby transferred. *
715 * The information in this software is subject to change without *
716 * notice and should not be construed as a commitment by Digital *
717 * Equipment Corporation. *
719 * Digital assumes no responsibility for the use or reliability *
720 * of its software on equipment which is not supplied by Digital. *
722 ************************************************************************/
725 * To avoid namespace pollution when using the ULTRIX header files under the
726 * DEC ANSI compiler, all user-visible header files were modifed to reference
727 * ANSI-style predefined macro name rather than their traditional names
728 * (__ultrix vice ultrix). Every file which accesses a predefined macro name
729 * must include this file before any other files are included or the macros
732 * In strict ANSI mode, the appropriate ANSI-style macros are already
733 * defined and the redefinitions in this file will not be seen. When using
734 * pcc, the traditional macro names are defined and this file will define
735 * ANSI-style equivalents of the traditional names. When using the DEC C
736 * compiler, both the traditional and ANSI predefined macro names are
737 * available so the definitions in this file are not made visible.
742 //# 116 "/usr/include/ansi_compat.h"
744 //# 89 "/usr/include/stdio.h" 2
758 /* Note: spacing must match, too, to avoid warnings */
763 extern struct _iobuf {
771 typedef struct _iobuf FILE;
803 extern int getc( FILE *__stream );
804 extern int getchar( void );
805 extern int putc( int __c, FILE *__stream);
806 extern int putchar( int __c);
807 extern int feof( FILE *__stream );
808 extern int ferror( FILE *__stream );
809 extern int fileno( FILE *__stream );
810 extern int _filbuf( FILE *p);
811 extern int _flsbuf( unsigned char x , FILE *p);
828 typedef char *va_list;
834 extern void clearerr( FILE *__stream);
835 extern int fclose( FILE *__stream );
836 extern FILE * c_proto_fdopen ( int __filedes, char *__type );
837 extern int fflush( FILE *__stream );
838 extern int fgetc( FILE *__stream );
839 extern int fgetpos( FILE *__stream, fpos_t *__pos );
840 extern char * fgets( char *__s, int __n, FILE *__stream );
841 extern FILE * c_proto_fopen ( const char *__filename, const char *__type );
842 extern int c_proto_fprintf ( FILE *__stream, const char *__format, ... );
843 extern int fputc( int __c, FILE *__stream );
844 extern int c_proto_fputs ( const char *__s, FILE *__stream );
845 extern size_t fread( void *__ptr, size_t __size,
846 size_t __nitems, FILE *__stream );
847 extern FILE * c_proto_freopen ( const char *__filename, const char *__type,
849 extern int c_proto_fscanf ( FILE *__stream, const char *__format, ... );
850 extern int fseek( FILE *__stream, long __offset, int __ptrname );
851 extern int fsetpos( FILE *__stream, const fpos_t *__pos );
852 extern long ftell( FILE *__stream );
853 extern size_t c_proto_fwrite ( const void *__ptr, size_t __size,
854 size_t __nitems, FILE *__stream );
855 extern char * gets( char *__s );
856 extern void c_proto_perror ( const char *__s );
857 extern FILE * c_proto_popen (const char *__command, const char *__type );
858 extern int c_proto_printf ( const char *__format, ... );
859 extern int c_proto_puts ( const char *__s );
860 extern int remove( const char *__filename );
861 extern int rename( const char *__from, const char *__to );
862 extern void c_proto_rewind ( FILE *__stream );
863 extern int c_proto_scanf ( const char *__format, ... );
864 extern void c_proto_setbuf ( FILE *__stream, char *__buf );
865 extern int c_proto_setvbuf ( FILE *__stream, char *__buf,
866 int __type, size_t __size );
867 extern int c_proto_sscanf ( const char *__s, const char *__format, ... );
868 extern FILE * tmpfile( void );
869 extern char * tmpnam( char *__s );
870 extern int ungetc( int __c, FILE *__stream );
871 extern int c_proto_vfprintf ( FILE *__stream, const char *__format, va_list __ap );
872 extern int c_proto_vprintf ( const char *__format, va_list __ap );
873 extern int c_proto_vsprintf ( char *__s, const char *__format, va_list __ap);
876 extern char * c_proto_tempnam ( const char *__dir, const char *__pfx);
877 extern int c_proto_putw ( int __w, FILE *__stream );
878 extern int getw(FILE *__stream);
879 extern int pclose( FILE *__stream );
882 //# 298 "/usr/include/stdio.h"
886 /* function prototype */
887 extern int c_proto_sprintf ( char *__s, const char *__format, ... );
907 //# 189 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stdio.h" 2
946 //# 239 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stdio.h"
949 FILE* fdopen(int, const char*);
952 char* fgets(char*, int, FILE *);
953 FILE* fopen(const char*, const char*);
954 int fprintf(FILE*, const char* ...);
955 int fputc(int, FILE*);
956 int fputs(const char*, FILE*);
957 size_t fread(void*, size_t, size_t, FILE*);
961 FILE* freopen(const char*, const char*, FILE*);
963 int fscanf(FILE*, const char* ...);
964 int fseek(FILE*, long, int);
966 unsigned int fwrite(const void*, unsigned int, unsigned int, FILE*);
970 void perror(const char*);
971 FILE* popen(const char*, const char*);
972 int printf(const char* ...);
973 int puts(const char*);
974 int putw(int, FILE*);
976 int scanf(const char* ...);
977 int setbuf(FILE*, char*);
978 int setbuffer(FILE*, char*, int);
979 int setlinebuf(FILE*);
980 int setvbuf(FILE*, char*, int, unsigned int);
981 int sscanf(char*, const char* ...);
983 int ungetc(int, FILE*);
984 int vfprintf(FILE*, const char*, ...);
986 // Third arg to vprintf must be '...' for some machines, & doesn't
989 int vprintf(const char*, ... );
995 char* sprintf(char*, const char*, ...);
996 char* vsprintf(char*, const char*, ...);
1018 //# 28 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/std.h" 2
1020 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/errno.h" 1
1029 //# 1 "/usr/include/errno.h" 1
1030 /* @(#)errno.h 2.4 (ULTRIX) 11/10/89 */
1032 /************************************************************************
1034 * Copyright (c) 1984, 1987 by *
1035 * Digital Equipment Corporation, Maynard, MA *
1036 * All rights reserved. *
1038 * This software is furnished under a license and may be used and *
1039 * copied only in accordance with the terms of such license and *
1040 * with the inclusion of the above copyright notice. This *
1041 * software or any other copies thereof may not be provided or *
1042 * otherwise made available to any other person. No title to and *
1043 * ownership of the software is hereby transferred. *
1045 * This software is derived from software received from the *
1046 * University of California, Berkeley, and from Bell *
1047 * Laboratories. Use, duplication, or disclosure is subject to *
1048 * restrictions under license agreements with University of *
1049 * California and with AT&T. *
1051 * The information in this software is subject to change without *
1052 * notice and should not be construed as a commitment by Digital *
1053 * Equipment Corporation. *
1055 * Digital assumes no responsibility for the use or reliability *
1056 * of its software on equipment which is not supplied by Digital. *
1058 ************************************************************************/
1061 * Modification history:
1064 * Added ENOSYS for POSIX
1067 * Added ENOLCK for POSIX
1070 * Moved NFS error codes to match SUN's.
1073 * Added EALIGN error code
1075 * 28-Mar-85 -- David L Ballenger
1076 * Add mapping of System V error numbers from BRL package.
1079 * Added System V IPC error codes error codes.
1124 /* non-blocking and interrupt i/o */
1128 /* ipc/network software */
1130 /* argument errors */
1144 /* operational errors */
1162 /* should be rearranged */
1172 /* NFS error codes */
1181 /* Alignment error of some type (i.e., cluster, page, block ...) */
1184 /* System V mappings from BRL package
1194 * DUP (Diagnostic/Utilities Protocol) related error numbers.
1210 /* External definition of errno from System V
1215 //# 9 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/errno.h" 2
1220 extern char* sys_errlist[];
1221 extern int sys_nerr;
1223 void perror(const char*);
1230 //# 29 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/std.h" 2
1234 //# 45 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine++.h" 2
1236 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/builtin.h" 1
1237 // This may look like C code, but it is really -*- C++ -*-
1240 Copyright (C) 1988, 1992 Free Software Foundation
1241 written by Doug Lea (dl@rocky.oswego.edu)
1243 This file is part of the GNU C++ Library. This library is free
1244 software; you can redistribute it and/or modify it under the terms of
1245 the GNU Library General Public License as published by the Free
1246 Software Foundation; either version 2 of the License, or (at your
1247 option) any later version. This library is distributed in the hope
1248 that it will be useful, but WITHOUT ANY WARRANTY; without even the
1249 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
1250 PURPOSE. See the GNU Library General Public License for more details.
1251 You should have received a copy of the GNU Library General Public
1252 License along with this library; if not, write to the Free Software
1253 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
1257 arithmetic, etc. functions on built in types
1267 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 1
1268 //# 12 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h"
1270 //# 31 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/builtin.h" 2
1272 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/std.h" 1
1273 // This may look like C code, but it is really -*- C++ -*-
1275 Copyright (C) 1988, 1992 Free Software Foundation
1276 written by Doug Lea (dl@rocky.oswego.edu)
1278 This file is part of the GNU C++ Library. This library is free
1279 software; you can redistribute it and/or modify it under the terms of
1280 the GNU Library General Public License as published by the Free
1281 Software Foundation; either version 2 of the License, or (at your
1282 option) any later version. This library is distributed in the hope
1283 that it will be useful, but WITHOUT ANY WARRANTY; without even the
1284 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
1285 PURPOSE. See the GNU Library General Public License for more details.
1286 You should have received a copy of the GNU Library General Public
1287 License along with this library; if not, write to the Free Software
1288 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
1292 //# 31 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/std.h"
1294 //# 32 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/builtin.h" 2
1296 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/math.h" 1
1297 // This may look like C code, but it is really -*- C++ -*-
1299 Copyright (C) 1988 Free Software Foundation
1300 written by Doug Lea (dl@rocky.oswego.edu)
1302 This file is part of the GNU C++ Library. This library is free
1303 software; you can redistribute it and/or modify it under the terms of
1304 the GNU Library General Public License as published by the Free
1305 Software Foundation; either version 2 of the License, or (at your
1306 option) any later version. This library is distributed in the hope
1307 that it will be useful, but WITHOUT ANY WARRANTY; without even the
1308 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
1309 PURPOSE. See the GNU Library General Public License for more details.
1310 You should have received a copy of the GNU Library General Public
1311 License along with this library; if not, write to the Free Software
1312 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
1330 //# 64 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/math.h"
1334 double acos(double);
1335 double acosh(double);
1336 double asin(double);
1337 double asinh(double);
1338 double atan(double);
1339 double atan2(double, double);
1340 double atanh(double);
1341 double cbrt(double);
1342 double ceil(double);
1343 double copysign(double,double);
1345 double cosh(double);
1346 double drem(double,double);
1348 double erfc(double);
1350 double expm1(double);
1351 double fabs(double);
1352 double finite(double);
1353 double floor(double);
1354 double frexp(double, int*);
1355 double gamma(double);
1356 double hypot(double,double);
1365 double jn(int, double);
1366 double ldexp(double, int);
1367 double lgamma(double);
1369 double log10(double);
1370 double log1p(double);
1371 double logb(double);
1372 double modf(double, double*);
1373 double pow(double, double);
1374 double rint(double);
1375 double scalb(double, int);
1377 double sinh(double);
1378 double sqrt(double);
1380 double tanh(double);
1383 double yn(int, double);
1385 double aint(double);
1386 double anint(double);
1393 /* libg++ doesn't use this since it is not available on some systems */
1395 /* the following ifdef is just for compiling OOPS */
1398 struct libm_exception
1402 double arg1, arg2, retval;
1412 extern "C" int matherr(libm_exception*);
1416 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/values.h" 1
1417 // This may look like C code, but it is really -*- C++ -*-
1419 Copyright (C) 1988 Free Software Foundation
1420 written by Doug Lea (dl@rocky.oswego.edu)
1422 This file is part of the GNU C++ Library. This library is free
1423 software; you can redistribute it and/or modify it under the terms of
1424 the GNU Library General Public License as published by the Free
1425 Software Foundation; either version 2 of the License, or (at your
1426 option) any later version. This library is distributed in the hope
1427 that it will be useful, but WITHOUT ANY WARRANTY; without even the
1428 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
1429 PURPOSE. See the GNU Library General Public License for more details.
1430 You should have received a copy of the GNU Library General Public
1431 License along with this library; if not, write to the Free Software
1432 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
1461 //# 150 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/values.h"
1487 //# 149 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/math.h" 2
1490 /* On some systems, HUGE ought to be MAXFLOAT or IEEE infinity */
1497 /* sequents don't supply these. The following should suffice */
1507 /* These seem to be sun & sysV names of these constants */
1557 //# 33 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/builtin.h" 2
1560 typedef void (*one_arg_error_handler_t)(const char*);
1561 typedef void (*two_arg_error_handler_t)(const char*, const char*);
1563 long gcd(long, long);
1564 long lg(unsigned long);
1565 double pow(double, long);
1566 long pow(long, long);
1568 double start_timer();
1569 double return_elapsed_time(double last_time = 0.0);
1571 char* itoa(long x, int base = 10, int width = 0);
1572 char* itoa(unsigned long x, int base = 10, int width = 0);
1574 char* itoa(long long x, int base = 10, int width = 0);
1575 char* itoa(unsigned long long x, int base = 10, int width = 0);
1577 char* dtoa(double x, char cvt = 'g', int width = 0, int prec = 6);
1579 char* hex(long x, int width);
1580 char* hex(unsigned long x, int width);
1581 char* hex(int x, int width);
1582 char* hex(short x, int width);
1583 char* hex(unsigned int x, int width);
1584 char* hex(unsigned short x, int width);
1586 char* oct(long x, int width);
1587 char* oct(unsigned long x, int width);
1588 char* oct(int x, int width);
1589 char* oct(short x, int width);
1590 char* oct(unsigned int x, int width) ;
1591 char* oct(unsigned short x, int width);
1593 char* dec(long x, int width);
1594 char* dec(unsigned long x, int width);
1595 char* dec(int x, int width);
1596 char* dec(short x, int width);
1597 char* dec(unsigned int x, int width) ;
1598 char* dec(unsigned short x, int width);
1600 char* form(const char* fmt ...);
1601 char* chr(char ch, int width = 0);
1602 char* str(const char* s, int width = 0);
1604 unsigned int hashpjw(const char*);
1605 unsigned int multiplicativehash(int);
1606 unsigned int foldhash(double);
1608 extern void default_one_arg_error_handler(const char*);
1609 extern void default_two_arg_error_handler(const char*, const char*);
1611 extern two_arg_error_handler_t lib_error_handler;
1613 extern two_arg_error_handler_t
1614 set_lib_error_handler(two_arg_error_handler_t f);
1617 double abs(double arg);
1618 float abs(float arg);
1619 short abs(short arg);
1622 int sign(double arg);
1624 double sqr(double arg);
1627 long lcm(long x, long y);
1628 void setbit(long& x, long b);
1629 void clearbit(long& x, long b);
1630 int testbit(long x, long b);
1632 signed char min(signed char a, signed char b);
1633 unsigned char min(unsigned char a, unsigned char b);
1635 signed short min(signed short a, signed short b);
1636 unsigned short min(unsigned short a, unsigned short b);
1638 signed int min(signed int a, signed int b);
1639 unsigned int min(unsigned int a, unsigned int b);
1641 signed long min(signed long a, signed long b);
1642 unsigned long min(unsigned long a, unsigned long b);
1644 float min(float a, float b);
1646 double min(double a, double b);
1648 signed char max(signed char a, signed char b);
1649 unsigned char max(unsigned char a, unsigned char b);
1651 signed short max(signed short a, signed short b);
1652 unsigned short max(unsigned short a, unsigned short b);
1654 signed int max(signed int a, signed int b);
1655 unsigned int max(unsigned int a, unsigned int b);
1657 signed long max(signed long a, signed long b);
1658 unsigned long max(unsigned long a, unsigned long b);
1660 float max(float a, float b);
1662 double max(double a, double b);
1667 inline double abs(double arg)
1669 return (arg < 0.0)? -arg : arg;
1672 inline float abs(float arg)
1674 return (arg < 0.0)? -arg : arg;
1677 inline short abs(short arg)
1679 return (arg < 0)? -arg : arg;
1682 inline long abs(long arg)
1684 return (arg < 0)? -arg : arg;
1687 inline int sign(long arg)
1689 return (arg == 0) ? 0 : ( (arg > 0) ? 1 : -1 );
1692 inline int sign(double arg)
1694 return (arg == 0.0) ? 0 : ( (arg > 0.0) ? 1 : -1 );
1697 inline long sqr(long arg)
1702 inline double sqr(double arg)
1707 inline int even(long arg)
1712 inline int odd(long arg)
1717 inline long lcm(long x, long y)
1719 return x / gcd(x, y) * y;
1722 inline void setbit(long& x, long b)
1727 inline void clearbit(long& x, long b)
1732 inline int testbit(long x, long b)
1734 return ((x & (1 << b)) != 0);
1740 //# 46 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine++.h" 2
1743 //# 65 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine++.h"
1746 // Take the nice stuff that the regular sumachine.h provides
1748 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h" 1
1753 * Define a ``Standard Unix Machine''
1755 * By whatever means are available in /lib/cpp, figure out
1756 * what type of operating system, maker, machine architecture
1757 * and architecture instance we are on.
1759 * OPSYS_TYPE - the type of operating system (e.g. vms)
1760 * OPSYS_SUBTYPE - the subtype of operating system (e.g. bsd, sys5, etc)
1761 * OPSYS_MFR - the manufacturer (e.g. Hewlett-Packard)
1762 * OPSYS_VERS - the operating system version (e.g. sun 4.0)
1764 * CPU_TYPE - the architecture (e.g. 68K)
1765 * CPU_MODEL - the architecture instance (e.g. 68010)
1768 * This file should be #included as the 1st line of each and every .c file
1770 * It ensures that the environment which those src files expect exists
1771 * either by fiat or by faking it where the host operating system is not
1776 * The OPSYS specifics
1778 * Parameterized with the best known /lib/cpp predefines
1790 * Note that everyone defines the symbol unix except IBM's AIX 3.1
1791 * which doesn't define unix but DOES define the symbol _AIX
1815 * WATCHOUT - the newer gcc doesn't define __GNU__
1816 * So we may have to define __GNU__ ourselves
1818 * __GNU__ is the old way
1819 * __GNUC__ is the new way
1821 * Use gcc -v somefile.c to determine what is being passed.
1825 * GNU doesn't know about any opsys-specific
1826 * cpp tokens, so we must figure them out for it.
1827 * GNU does however know about architecture-tokens
1829 //# 93 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h"
1834 /* then if defined(vax) || defined(mips) */
1835 /* then if >= ultrix 4.2 => defined(__vax) || defined(__mips) */
1839 * gcc 1.39 uses the words mips and __mips__ while Ultrix 4.2 has
1840 * been coded in terms of __mips (only!) - so we have to hack it.
1842 * See from Ultrix 4.2
1844 * Unfortunately also, is turned on only if __STDC__
1845 * is undefined. gcc defines __STDC__ and you can't undef it. So
1846 * We are forced here (as with math.h) to copy and
1847 * strip off the #if !defined(__STDC__).
1849 * Further unfortunateness occurs in that the only way we have of
1850 * discovering that we're in Ultrix 4.2 is to #include
1851 * and check for the vector unit support #defined there. However
1852 * we need the workarounds to be defined first in
1853 * order to get the full effect of .
1855 * So we have to do all this stuff under any and all Ultrix versions.
1857 * We also have to work around the fact that the GNU (gcc 1.95.0 and later)
1858 * compilers may be defining this stuff already
1928 /* end of fakeout */
1932 * The r2000 and r3000 are indistinguishable (so far)
1936 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/sys/types.h" 1
1946 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 1
1947 //# 12 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h"
1949 //# 10 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/sys/types.h" 2
1955 //# 1 "/usr/include/sys/types.h" 1
1956 /* @(#)types.h 4.3 (ULTRIX) 2/28/91 */
1958 /************************************************************************
1960 * Copyright (c) 1984 - 1989 by *
1961 * Digital Equipment Corporation, Maynard, MA *
1962 * All rights reserved. *
1964 * This software is furnished under a license and may be used and *
1965 * copied only in accordance with the terms of such license and *
1966 * with the inclusion of the above copyright notice. This *
1967 * software or any other copies thereof may not be provided or *
1968 * otherwise made available to any other person. No title to and *
1969 * ownership of the software is hereby transferred. *
1971 * This software is derived from software received from the *
1972 * University of California, Berkeley, and from Bell *
1973 * Laboratories. Use, duplication, or disclosure is subject to *
1974 * restrictions under license agreements with University of *
1975 * California and with AT&T. *
1977 * The information in this software is subject to change without *
1978 * notice and should not be construed as a commitment by Digital *
1979 * Equipment Corporation. *
1981 * Digital assumes no responsibility for the use or reliability *
1982 * of its software on equipment which is not supplied by Digital. *
1984 ************************************************************************/
1986 /* ------------------------------------------------------------------------
1987 * Modification History: /sys/h/types.h
1989 * 20-Dec-1989 Larry Scott
1990 * added #ifdef's for compliance
1992 * 16-Jun-1989 Jon Reeves
1993 * size_t must be unsigned, per ANSI and X/Open
1995 * 05-Jun-1989 Jon Reeves
1996 * Change latch name for size_t; it's in lots of headers.
1998 * 12-May-1989 Todd M. Katz TMK0001
1999 * Added volatile type definitions: vu_long, vu_short, vu_char,
2000 * v_long, v_short, and v_char.
2002 * 08-May-1989 -- Ken Lesniak
2003 * Conditionalize items also defined in time.h.
2005 * 1-Feb-89 -- jmartin
2009 * Merge of final 43BSD changes.
2011 * 31-August-1987 -- Mark Parenti
2012 * Add definitions needed for POSIX compliance
2014 * 27-April-1987 -- Larry Cohen
2015 * Modify the typedef "fd_set" to accomodate 64 file descriptors.
2017 * David L Ballenger, 8-Mar-1985
2018 * 0002 Add types for System V compatibility.
2021 * Add ifdef so we can be nested without problem
2022 * Derived from 4.2BSD, labeled:
2023 * types.h 6.2 84/06/09
2025 * -----------------------------------------------------------------------
2034 //# 1 "/usr/include/ansi_compat.h" 1
2036 * @(#)ansi_compat.h 4.4 (ULTRIX) 10/8/90
2039 /************************************************************************
2041 * Copyright (c) 1990 by *
2042 * Digital Equipment Corporation, Maynard, MA *
2043 * All rights reserved. *
2045 * This software is furnished under a license and may be used and *
2046 * copied only in accordance with the terms of such license and *
2047 * with the inclusion of the above copyright notice. This *
2048 * software or any other copies thereof may not be provided or *
2049 * otherwise made available to any other person. No title to and *
2050 * ownership of the software is hereby transferred. *
2052 * The information in this software is subject to change without *
2053 * notice and should not be construed as a commitment by Digital *
2054 * Equipment Corporation. *
2056 * Digital assumes no responsibility for the use or reliability *
2057 * of its software on equipment which is not supplied by Digital. *
2059 ************************************************************************/
2062 * To avoid namespace pollution when using the ULTRIX header files under the
2063 * DEC ANSI compiler, all user-visible header files were modifed to reference
2064 * ANSI-style predefined macro name rather than their traditional names
2065 * (__ultrix vice ultrix). Every file which accesses a predefined macro name
2066 * must include this file before any other files are included or the macros
2069 * In strict ANSI mode, the appropriate ANSI-style macros are already
2070 * defined and the redefinitions in this file will not be seen. When using
2071 * pcc, the traditional macro names are defined and this file will define
2072 * ANSI-style equivalents of the traditional names. When using the DEC C
2073 * compiler, both the traditional and ANSI predefined macro names are
2074 * available so the definitions in this file are not made visible.
2079 //# 116 "/usr/include/ansi_compat.h"
2081 //# 79 "/usr/include/sys/types.h" 2
2087 * Basic system types and major/minor device constructing/busting macros.
2090 /* major part of a device */
2093 /* minor part of a device */
2096 /* make a device number */
2099 typedef unsigned char u_char;
2100 typedef unsigned short u_short;
2101 typedef unsigned int u_int;
2102 typedef unsigned int uint; /* sys V compatibility */
2103 typedef unsigned long u_long;
2104 typedef unsigned short ushort; /* sys III compat */
2106 typedef volatile char v_char;
2107 typedef volatile short v_short;
2108 typedef volatile long v_long;
2109 typedef volatile unsigned char vu_char;
2110 typedef volatile unsigned short vu_short;
2111 typedef volatile unsigned long vu_long;
2127 typedef struct _physadr { int r[1]; } *physadr;
2130 * this must match the definition of kernel jmpbuf's in machine/pcb.h
2132 typedef struct label_t {
2137 typedef struct _quad { long val[2]; } quad;
2138 typedef long daddr_t;
2139 typedef char * caddr_t;
2140 typedef u_long gno_t;
2141 typedef short cnt_t; /* sys V compatibility */
2142 typedef long swblk_t;
2143 typedef long paddr_t; /* sys V compatibility */
2144 typedef long audit_ID_t;
2147 typedef short dev_t;
2148 typedef short gid_t; /* POSIX compliance */
2149 typedef unsigned long ino_t;
2150 typedef unsigned short mode_t; /* POSIX compliance */
2151 typedef short nlink_t; /* POSIX compliance */
2155 typedef int pid_t; /* POSIX compliance */
2157 typedef short uid_t; /* POSIX compliance */
2170 typedef int clock_t; /* POSIX compliance */
2172 typedef long key_t; /* sys V compatibility */
2178 * The maximum number of file descriptors is now a configurable option
2179 * (max_nofile variable in /sys/conf/{mips|vax}/param.c).
2180 * The getdtablesize(2) system call should be used to obtain the
2181 * current limit. The value returned by getdtablesize() must be greater
2182 * than 64, and less than or equal to MAX_NOFILE in types.h . The
2183 * MAX_NOFILE define is needed for backward compatability with broken
2184 * programs that need a static sized array for selecting. These programs
2185 * should be modified to use the getdtablesize() interface for sizing.
2190 * Select uses bit masks of file descriptors in longs.
2191 * These macros manipulate such bit fields (the filesystem macros use chars).
2192 * FD_SETSIZE may be defined by the user, but the default here
2193 * should be >= NOFILE (param.h).
2199 /* How many things we'll allow select to use. 0 if unlimited */
2201 typedef long fd_mask;
2208 typedef struct fd_set {
2209 fd_mask fds_bits[(((4096 )+(( (sizeof(fd_mask) * 8 ) )-1))/( (sizeof(fd_mask) * 8 ) )) ];
2219 //# 15 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/sys/types.h" 2
2231 //# 199 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h" 2
2233 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/signal.h" 1
2234 // This may look like C code, but it is really -*- C++ -*-
2236 Copyright (C) 1989 Free Software Foundation
2237 written by Doug Lea (dl@rocky.oswego.edu)
2239 This file is part of the GNU C++ Library. This library is free
2240 software; you can redistribute it and/or modify it under the terms of
2241 the GNU Library General Public License as published by the Free
2242 Software Foundation; either version 2 of the License, or (at your
2243 option) any later version. This library is distributed in the hope
2244 that it will be useful, but WITHOUT ANY WARRANTY; without even the
2245 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
2246 PURPOSE. See the GNU Library General Public License for more details.
2247 You should have received a copy of the GNU Library General Public
2248 License along with this library; if not, write to the Free Software
2249 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
2259 //# 1 "/usr/include/signal.h" 1
2260 /* @(#)signal.h 2.8 (ULTRIX) 11/9/89 */
2262 /************************************************************************
2264 * Copyright (c) 1987-1989 by *
2265 * Digital Equipment Corporation, Maynard, MA *
2266 * All rights reserved. *
2268 * This software is furnished under a license and may be used and *
2269 * copied only in accordance with the terms of such license and *
2270 * with the inclusion of the above copyright notice. This *
2271 * software or any other copies thereof may not be provided or *
2272 * otherwise made available to any other person. No title to and *
2273 * ownership of the software is hereby transferred. *
2275 * This software is derived from software received from the *
2276 * University of California, Berkeley, and from Bell *
2277 * Laboratories. Use, duplication, or disclosure is subject to *
2278 * restrictions under license agreements with University of *
2279 * California and with AT&T. *
2281 * The information in this software is subject to change without *
2282 * notice and should not be construed as a commitment by Digital *
2283 * Equipment Corporation. *
2285 * Digital assumes no responsibility for the use or reliability *
2286 * of its software on equipment which is not supplied by Digital. *
2288 ************************************************************************/
2289 /************************************************************************
2290 * Modification History *
2292 * Debby Haeck 11/14/90 *
2293 * added new Vector Arithmetic Exception handling codes *
2294 * Debby Haeck 9/4/90 *
2295 * added new u_code for vector support *
2296 * ILL_VECOP_FAULT, ILL_VECINST_FAULT, TERM_VECT_HARD and *
2297 * TERM_VECT_TOOMANY *
2298 * Tak Yin Wong 3/390 *
2299 * Add ifdef's for POSIX and XOPEN *
2300 * Linda Wilson 9/12/89 *
2301 * typedef sigset_t for X/OPEN *
2302 * Linda Wilson 9/12/89 *
2303 * ifdef out sigmask for POSIX *
2304 * Jon Reeves 7/14/89 *
2305 * Add X/Open mandated function declarations. *
2306 * Jon Reeves 5/16/89 *
2307 * Add new BRK_STACKOVERFLOW def from MIPS 2.0 cmplrs *
2308 * Jon Reeves 5/12/89 *
2309 * Add raise() and sig_atomic_t for ANSI *
2310 * Mark Parenti 2/06/88 *
2311 * Change SA_CLDSTOP to SA_NOCLDSTOP per POSIX change *
2312 * Fred Glover 1/12/88 *
2313 * Add SIGLOST - server crash Sys-V lock notification *
2315 * Larry Cohen 10/1/85 *
2316 * Add SIGWINCH - window change signal *
2318 * Greg Depp 25 Jun 85 *
2319 * Moved SIGUSR1 and SIGUSR2 to 30 and 31 to conform with Berkeley *
2321 * David L Ballenger, 28-Mar-1985 *
2322 * 0001 Add definitions for System V compatibility *
2324 ************************************************************************/
2333 //# 1 "/usr/include/ansi_compat.h" 1
2335 * @(#)ansi_compat.h 4.4 (ULTRIX) 10/8/90
2338 /************************************************************************
2340 * Copyright (c) 1990 by *
2341 * Digital Equipment Corporation, Maynard, MA *
2342 * All rights reserved. *
2344 * This software is furnished under a license and may be used and *
2345 * copied only in accordance with the terms of such license and *
2346 * with the inclusion of the above copyright notice. This *
2347 * software or any other copies thereof may not be provided or *
2348 * otherwise made available to any other person. No title to and *
2349 * ownership of the software is hereby transferred. *
2351 * The information in this software is subject to change without *
2352 * notice and should not be construed as a commitment by Digital *
2353 * Equipment Corporation. *
2355 * Digital assumes no responsibility for the use or reliability *
2356 * of its software on equipment which is not supplied by Digital. *
2358 ************************************************************************/
2361 * To avoid namespace pollution when using the ULTRIX header files under the
2362 * DEC ANSI compiler, all user-visible header files were modifed to reference
2363 * ANSI-style predefined macro name rather than their traditional names
2364 * (__ultrix vice ultrix). Every file which accesses a predefined macro name
2365 * must include this file before any other files are included or the macros
2368 * In strict ANSI mode, the appropriate ANSI-style macros are already
2369 * defined and the redefinitions in this file will not be seen. When using
2370 * pcc, the traditional macro names are defined and this file will define
2371 * ANSI-style equivalents of the traditional names. When using the DEC C
2372 * compiler, both the traditional and ANSI predefined macro names are
2373 * available so the definitions in this file are not made visible.
2378 //# 116 "/usr/include/ansi_compat.h"
2380 //# 74 "/usr/include/signal.h" 2
2399 /* absent or non-vector capable sys */
2400 /* CHME, CHMS, CHMU are not yet given back to users reasonably */
2420 /* the following are used to for Vector Arithmetic Exception handling */
2460 /* Add System V signal definitions (DLB001) */
2469 * Codes for the mips break instruction.
2487 /* Accesses to sig_atomic_t are atomic, even with async interrupts.
2488 Not an issue for us, but ANSI requires the definition. */
2489 typedef long sig_atomic_t;
2490 typedef int sigset_t; /* type used for sigsetops() functions */
2494 * Signal vector "template" used in sigvec call.
2497 void (*sv_handler)(); /* signal handler */
2498 sigset_t sv_mask; /* signal mask to apply */
2499 int sv_flags; /* see signal options below */
2504 * The following structure must be exactly the same as the above structure
2505 * with the names changed for POSIX compliance.
2508 void (*sa_handler)(); /* signal handler */
2509 sigset_t sa_mask; /* signal mask to apply */
2510 int sa_flags; /* see signal options below */
2526 /* Defines for sigprocmask() call. POSIX.
2535 * Structure used in sigstack call.
2538 char *ss_sp; /* signal stack pointer */
2539 int ss_onstack; /* current status */
2543 * Information pushed on stack when a signal is delivered.
2544 * This is used by the kernel to restore state following
2545 * execution of the signal handler. It is also made available
2546 * to the handler to allow it to properly restore state if
2547 * a non-standard exit is performed.
2550 * XXX - sigcontext needs updating per 4.3BSD - rr
2554 * WARNING: THE sigcontext MUST BE KEPT CONSISTENT WITH /usr/include/setjmp.h
2555 * AND THE LIBC ROUTINES setjmp() AND longjmp()
2561 * BEGIN REGION THAT MUST CORRESPOND WITH setjmp.h
2562 * BEGIN REGION THAT MUST CORRESPOND WITH A jmp_buf
2565 int sc_onstack; /* sigstack state to restore */
2566 int sc_mask; /* signal mask to restore */
2573 int sc_pc; /* pc at time of signal */
2575 * General purpose registers
2577 int sc_regs[32]; /* processor regs 0 to 31 */
2578 int sc_mdlo; /* mul/div low */
2579 int sc_mdhi; /* mul/div high */
2581 * Floating point coprocessor state
2583 int sc_ownedfp; /* fp has been used */
2584 int sc_fpregs[32]; /* fp regs 0 to 31 */
2585 int sc_fpc_csr; /* floating point control and status reg */
2586 int sc_fpc_eir; /* floating point exception instruction reg */
2588 * END OF REGION THAT MUST AGREE WITH setjmp.h
2589 * END OF jmp_buf REGION
2592 * System coprocessor registers at time of signal
2594 int sc_cause; /* cp0 cause register */
2595 int sc_badvaddr; /* cp0 bad virtual address */
2596 int sc_badpaddr; /* cpu bd bad physical address */
2626 extern void (*signal(int __sig, void(*__func)(int)))(int);
2627 int raise( int __sig );
2628 int kill( pid_t __pid, int __sig );
2629 int sigemptyset( sigset_t *__set );
2630 int sigfillset( sigset_t *__set );
2631 int sigaddset( sigset_t *__set, int __signo );
2632 int sigdelset( sigset_t *__set, int __signo );
2633 int sigismember( const sigset_t *__set, int __signo );
2634 int sigaction( int __sig, const struct sigaction *__act,
2635 struct sigaction *__oact );
2636 int sigprocmask( int __how, const sigset_t *__set, sigset_t *__oset );
2637 int sigpending( sigset_t *__set );
2638 int sigsuspend( const sigset_t *__sigmask );
2651 * Macro for converting signal number to a mask suitable for
2660 //# 26 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/signal.h" 2
2665 // The Interviews folks call this SignalHandler. Might as well conform.
2666 // Beware: some systems think that SignalHandler returns int.
2667 typedef void (*SignalHandler) (int);
2669 extern SignalHandler signal(int sig, SignalHandler action);
2670 extern SignalHandler sigset(int sig, SignalHandler action);
2671 extern SignalHandler ssignal(int sig, SignalHandler action);
2672 extern int gsignal (int sig);
2673 extern int kill (int pid, int sig);
2674 extern int killpg(int, int);
2675 extern int siginterrupt(int, int);
2676 extern void psignal(unsigned, char*);
2679 extern int sigsetmask(int mask);
2680 extern int sigblock(int mask);
2681 extern int sigpause(int mask);
2682 extern int sigvec(int sig, struct sigvec* v, struct sigvec* prev);
2685 // The Interviews version also has these ...
2703 //# 200 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h" 2
2707 * Note that in Ultrix 4.2 renames all of the
2708 * previously-predefined cpp names to __names. Also there is
2709 * new support for vector processors - TERM_VECT_HARD etc.
2712 //# 244 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h"
2715 //# 263 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h"
2717 //# 283 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h"
2720 //# 298 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h"
2722 //# 319 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h"
2724 //# 328 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h"
2726 //# 345 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h"
2753 //# 387 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h"
2764 * Parameterized with the best known /lib/cpp predefines
2765 * Set up for a middle-of-the-road machine.
2769 * DECstation Processor
2770 * 2100 R2000 (slower clock)
2777 * We might be on the R3000 machine, but there is really
2778 * no way of distinguishing that from the src-code level.
2779 * The GNU people define some stuff, but its usually wrong.
2798 //# 453 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h"
2808 //# 471 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h"
2838 //# 512 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h"
2840 /* will we be porting to this? */
2841 //# 522 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h"
2844 //# 537 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h"
2848 * The following MUST be literals else /lib/cpp cannot do
2849 * == operations on them. Remember cpp does strcmps, not MATH
2853 * #if OPSYS_TYPE == MD_opsystype
2865 * #if OPSYS_SUBTYPE == MD_opsyssubtype
2882 * #if OPSYS_MFR == MD_opsysmfr
2903 * #if OPSYS_VERS == MD_opsysvers
2905 * #if OPSYS_MFR == MD_opsysmfr && OPSYS_VERS <= MD_opsysvers
3035 * #if CPU_TYPE == MD_cputype
3061 * #if CPU_MODEL == MD_modelname
3126 /* don't add this stuff in if the query program display.sh is being run */
3128 //# 1754 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine.h"
3134 //# 69 "/sandbox/wbaker/wbaker0/source/mips/include/sumachine++.h" 2
3138 // Always turn this stuff on b/c otherwise nothing works
3144 //# 1 "GctNameRef.List.cc" 2
3146 //# 1 "../../../../mips/include/Gct/genclasses.h" 1
3152 // genclasses - The GNU Container Classes
3154 // Expects to be included by Gct.h or where appropriate
3155 // especially before any genclass class headerfile is included.
3157 // Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU)
3161 // Make sure that we get all of the inline functions too but prevent duplicate
3162 // definition warnings.
3174 // Turn off the definitions of these hash functions
3176 // unsigned hash(GctAstRef&)
3178 // So that the following will match and be used instead:
3180 // unsigned hash(GctRef&)
3182 // The idea is to not allow the various header files to
3183 // create (say) ``unsigned hash(GctAstRef&)'' but to use
3184 // ``hash(x)'' for the hash function anyway. We just want
3185 // the hash() function used to be ``unsigned hash(GctRef&)''
3189 //# 1 "../../../../mips/include/Gct/Reference.h" 1
3197 // GctReferenceObject
3199 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
3210 //# 1 "../../../../mips/include/Gct/Reference/GctReferenceCount.h" 1
3216 // GctReferenceCount class
3218 // Expects to be included by Gct/Reference.h
3220 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
3233 //# 25 "../../../../mips/include/Gct/Reference/GctReferenceCount.h" 2
3236 //# 1 "../../../../mips/include/Gct/GctErrorHandler.h" 1
3242 // GctErrorHandler class
3244 // Expects to be included by Gct.h
3246 // Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU)
3257 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
3265 //# 25 "../../../../mips/include/Gct/GctErrorHandler.h" 2
3267 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 1
3268 // This may look like C code, but it is really -*- C++ -*-
3270 Copyright (C) 1988 Free Software Foundation
3271 written by Doug Lea (dl@rocky.oswego.edu)
3273 This file is part of the GNU C++ Library. This library is free
3274 software; you can redistribute it and/or modify it under the terms of
3275 the GNU Library General Public License as published by the Free
3276 Software Foundation; either version 2 of the License, or (at your
3277 option) any later version. This library is distributed in the hope
3278 that it will be useful, but WITHOUT ANY WARRANTY; without even the
3279 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
3280 PURPOSE. See the GNU Library General Public License for more details.
3281 You should have received a copy of the GNU Library General Public
3282 License along with this library; if not, write to the Free Software
3283 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
3293 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stream.h" 1
3297 // Compatibility with old library.
3300 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
3301 // This is part of the iostream library, providing -*- C++ -*- input/output.
3302 // Copyright (C) 1991 Per Bothner.
3304 // This library is free software; you can redistribute it and/or
3305 // modify it under the terms of the GNU Library General Public
3306 // License as published by the Free Software Foundation; either
3307 // version 2 of the License, or (at your option) any later version.
3309 // This library is distributed in the hope that it will be useful,
3310 // but WITHOUT ANY WARRANTY; without even the implied warranty of
3311 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3312 // Library General Public License for more details.
3314 // You should have received a copy of the GNU Library General Public
3315 // License along with this library; if not, write to the Free
3316 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3325 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/streambuf.h" 1
3326 // This is part of the iostream library, providing -*- C++ -*- input/output.
3327 // Copyright (C) 1991 Per Bothner.
3329 // This library is free software; you can redistribute it and/or
3330 // modify it under the terms of the GNU Library General Public
3331 // License as published by the Free Software Foundation; either
3332 // version 2 of the License, or (at your option) any later version.
3334 // This library is distributed in the hope that it will be useful,
3335 // but WITHOUT ANY WARRANTY; without even the implied warranty of
3336 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3337 // Library General Public License for more details.
3339 // You should have received a copy of the GNU Library General Public
3340 // License along with this library; if not, write to the Free
3341 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3350 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 1
3351 //# 12 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h"
3353 //# 25 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/streambuf.h" 2
3370 class ostream; class streambuf;
3372 typedef long streamoff, streampos;
3374 struct _ios_fields { // The data members of an ios.
3378 unsigned long _flags;
3380 unsigned char _state;
3381 unsigned short _precision;
3385 enum state_value { _good = 0, _eof = 1, _fail = 2, _bad = 4 };
3388 class ios : public _ios_fields {
3390 enum io_state { goodbit=0, eofbit=1, failbit=2, badbit=4 };
3399 enum seek_dir { beg, cur, end};
3400 enum { skipws=01, left=02, right=04, internal=010,
3401 dec=020, oct=040, hex=0100,
3402 showbase=0200, showpoint=0400, uppercase=01000, showpos=02000,
3403 scientific=04000, fixed=0100000, unitbuf=020000, stdio=040000,
3404 dont_close=0x80000000 //Don't close streambuf when destroying stream
3407 ostream* tie() { return _tie; }
3408 ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; }
3410 // Methods to change the format state.
3411 char fill() { return _fill; }
3412 char fill(char newf) { char oldf = _fill; _fill = newf; return oldf; }
3413 unsigned long flags() { return _flags; }
3414 unsigned long flags(unsigned long new_val) {
3415 unsigned long old_val = _flags; _flags = new_val; return old_val; }
3416 unsigned short precision() { return _precision; }
3417 unsigned short precision(int newp) {
3418 unsigned short oldp = _precision; _precision = (unsigned short)newp;
3420 unsigned long setf(unsigned long val) {
3421 unsigned long oldbits = _flags;
3422 _flags |= val; return oldbits; }
3423 unsigned long setf(unsigned long val, unsigned long mask) {
3424 unsigned long oldbits = _flags;
3425 _flags = (_flags & ~mask) | (val & mask); return oldbits; }
3426 unsigned long unsetf(unsigned long mask) {
3427 unsigned long oldbits = _flags & mask;
3428 _flags &= ~mask; return oldbits; }
3429 long width() { return _width; }
3430 long width(long val) { long save = _width; _width = val; return save; }
3432 static const unsigned long basefield;
3433 static const unsigned long adjustfield;
3434 static const unsigned long floatfield;
3436 streambuf* rdbuf() { return _strbuf; }
3437 void clear(int state = 0) { _state = state; }
3438 int good() { return _state == 0; }
3439 int eof() { return _state & ios::eofbit; }
3440 int fail() { return _state & (ios::badbit|ios::failbit); }
3441 int bad() { return _state & ios::badbit; }
3442 int rdstate() { return _state; }
3443 void set(int flag) { _state |= flag; }
3444 operator void*() { return fail() ? (void*)0 : (void*)this; }
3445 int operator!() { return fail(); }
3448 void unset(state_value flag) { _state &= ~flag; }
3456 ios(streambuf*sb) { _strbuf=sb; _state=0; _width=0; _fill=' ';
3457 _flags=ios::skipws; _precision=6; }
3463 typedef ios::seek_dir _seek_dir;
3466 // Magic numbers and bits for the _flags field.
3467 // The magic numbers use the high-order bits of _flags;
3468 // the remaining bits are abailable for variable flags.
3469 // Note: The magic numbers must all be negative if stdio
3470 // emulation is desired.
3486 struct __streambuf {
3487 // NOTE: If this is changed, also change __FILE in stdio/stdio.h!
3488 int _flags; /* High-order word is _IO_MAGIC; rest is flags. */
3489 char* _gptr; /* Current get pointer */
3490 char* _egptr; /* End of get area. */
3491 char* _eback; /* Start of putback+get area. */
3492 char* _pbase; /* Start of put area. */
3493 char* _pptr; /* Current put pointer. */
3494 char* _epptr; /* End of put area. */
3495 char* _base; /* Start of reserve area. */
3496 char* _ebuf; /* End of reserve area. */
3497 struct streambuf *_chain;
3500 struct streambuf : private __streambuf {
3502 friend class istream;
3503 friend class ostream;
3505 static streambuf* _list_all; /* List of open streambufs. */
3506 streambuf*& xchain() { return _chain; }
3509 char* gptr() const { return _gptr; }
3510 char* pptr() const { return _pptr; }
3511 char* egptr() const { return _egptr; }
3512 char* epptr() const { return _epptr; }
3513 char* pbase() const { return _pbase; }
3514 char* eback() const { return _eback; }
3515 char* ebuf() const { return _ebuf; }
3516 char* base() const { return _base; }
3517 void xput_char(char c) { *_pptr++ = c; }
3518 int xflags() { return _flags; }
3519 int xflags(int f) { int fl = _flags; _flags = f; return fl; }
3520 void xsetflags(int f) { _flags |= f; }
3521 void gbump(int n) { _gptr += n; }
3522 void pbump(int n) { _pptr += n; }
3523 void setb(char* b, char* eb, int a=0);
3524 void setp(char* p, char* ep) { _pbase=_pptr=p; _epptr=ep; }
3525 void setg(char* eb, char* g, char *eg) { _eback=eb; _gptr=g; _egptr=eg; }
3527 static int flush_all();
3528 static void flush_all_linebuffered(); // Flush all line buffered files.
3529 virtual int underflow(); // Leave public for now
3530 virtual int overflow(int c = (-1) ); // Leave public for now
3531 virtual int doallocate();
3532 virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
3533 virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out);
3534 int sputbackc(char c);
3537 virtual ~streambuf();
3538 int unbuffered() { return _flags & 2 ? 1 : 0; }
3539 int linebuffered() { return _flags & 0x4000 ? 1 : 0; }
3540 void unbuffered(int i)
3541 { if (i) _flags |= 2 ; else _flags &= ~2 ; }
3542 void linebuffered(int i)
3543 { if (i) _flags |= 0x4000 ; else _flags &= ~0x4000 ; }
3545 if (base() || unbuffered()) return 0;
3546 else return doallocate(); }
3548 virtual int pbackfail(int c);
3549 virtual int ungetfail();
3550 virtual streambuf* setbuf(char* p, int len);
3551 int in_avail() { return _egptr - _gptr; }
3552 int out_waiting() { return _pptr - _pbase; }
3553 virtual int sputn(const char* s, int n);
3554 virtual int sgetn(char* s, int n);
3555 long sgetline(char* buf, size_t n, char delim, int putback_delim);
3557 if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
3558 else return *(unsigned char*)_gptr++; }
3560 if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
3561 else return *(unsigned char*)_gptr; }
3563 if (++_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
3564 else return *(unsigned char*)_gptr; }
3566 if (_pptr >= _epptr) return overflow(c);
3567 return *_pptr++ = c, (unsigned char)c; }
3568 int vscan(char const *fmt0, char* ap);
3569 int vform(char const *fmt0, char* ap);
3572 struct __file_fields {
3582 class filebuf : public streambuf {
3583 struct __file_fields _fb;
3588 filebuf(int fd, char* p, int len);
3590 filebuf* attach(int fd);
3591 filebuf* open(const char *filename, const char *mode);
3592 filebuf* open(const char *filename, int mode, int prot = 0664);
3593 virtual int underflow();
3594 virtual int overflow(int c = (-1) );
3595 int is_open() { return _fb._fileno >= 0; }
3596 int fd() { return is_open() ? _fb._fileno : (-1) ; }
3598 virtual int doallocate();
3599 virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
3600 int sputn(const char* s, int n);
3601 int sgetn(char* s, int n);
3602 protected: // See documentation in filebuf.C.
3603 virtual int pbackfail(int c);
3605 int is_reading() { return eback() != egptr(); }
3606 char* cur_ptr() { return is_reading() ? gptr() : pptr(); }
3607 /* System's idea of pointer */
3608 char* file_ptr() { return _fb._save_gptr ? _fb._save_egptr : egptr(); }
3610 // Low-level operations (Usually invoke system calls.)
3611 virtual int sys_read(char* buf, size_t size);
3612 virtual long sys_seek(long , _seek_dir);
3613 virtual long sys_write(const void*, long);
3614 virtual int sys_stat(void*); // Actually, a (struct stat*)
3615 virtual int sys_close();
3619 inline int ios::readable() { return rdbuf()->_flags & 4 ; }
3620 inline int ios::writable() { return rdbuf()->_flags & 8 ; }
3621 inline int ios::is_open() {return rdbuf()->_flags & 4 +8 ;}
3626 //# 25 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 2
3629 class istream; class ostream;
3630 typedef istream& (*__imanip)(istream&);
3631 typedef ostream& (*__omanip)(ostream&);
3633 extern istream& ws(istream& ins);
3634 extern ostream& flush(ostream& outs);
3635 extern ostream& endl(ostream& outs);
3636 extern ostream& ends(ostream& outs);
3638 class ostream : public ios
3643 ostream(streambuf* sb, ostream* tied=0 );
3646 int opfx() { if (!good()) return 0; if (_tie) _tie->flush(); return 1; }
3647 void osfx() { if (flags() & (ios::unitbuf|ios::stdio))
3649 streambuf* ostreambuf() const { return _strbuf; }
3651 ostream& put(char c);
3652 ostream& write(const char *s, int n);
3653 ostream& write(const unsigned char *s, int n) { return write((char*)s, n);}
3654 ostream& write(const void *s, int n) { return write((char*)s, n);}
3655 ostream& seekp(streampos);
3656 ostream& seekp(streamoff, _seek_dir);
3658 ostream& form(const char *format ...);
3659 ostream& vform(const char *format, char* args);
3662 ostream& operator<<(ostream&, char c);
3663 ostream& operator<<(ostream& os, unsigned char c) { return os << (char)c; }
3664 //ostream& operator<<(ostream &os, signed char c) { return os << (char)c; }
3665 extern ostream& operator<<(ostream&, const char *s);
3666 inline ostream& operator<<(ostream& os, const unsigned char *s)
3667 { return os << (const char*)s; }
3668 //inline ostream& operator<<(ostream& os, const signed char *s)
3669 //{ return os << (const char*)s; }
3670 ostream& operator<<(ostream&, void *p);
3671 ostream& operator<<(ostream&, int n);
3672 ostream& operator<<(ostream&, long n);
3673 ostream& operator<<(ostream&, unsigned int n);
3674 ostream& operator<<(ostream&, unsigned long n);
3675 ostream& operator<<(ostream& os, short n) {return os << (int)n;}
3676 ostream& operator<<(ostream& os, unsigned short n)
3677 {return os << (unsigned int)n;}
3678 ostream& operator<<(ostream&, float n);
3679 ostream& operator<<(ostream&, double n);
3680 ostream& operator<<(ostream& os, __omanip func) { return (*func)(os); }
3681 ostream& operator<<(ostream&, streambuf*);
3683 class istream : public ios
3688 istream(streambuf* sb, ostream*tied=0 );
3690 streambuf* istreambuf() const { return _strbuf; }
3691 istream& get(char& c);
3692 istream& get(unsigned char& c);
3693 istream& read(char *ptr, int n);
3694 istream& read(unsigned char *ptr, int n) { return read((char*)ptr, n); }
3695 istream& read(void *ptr, int n) { return read((char*)ptr, n); }
3696 int get() { return _strbuf->sbumpc(); }
3697 istream& getline(char* ptr, int len, char delim = '\n');
3698 istream& get(char* ptr, int len, char delim = '\n');
3699 istream& gets(char **s, char delim = '\n');
3700 int ipfx(int need) {
3701 if (!good()) { set(ios::failbit); return 0; }
3702 if (_tie && (need == 0 || rdbuf()->in_avail())) ; /* THIS IS BAD */
3703 if (!need && (flags() & ios::skipws) && !ws(*this)) return 0;
3706 int ipfx0() { // Optimized version of ipfx(0).
3707 if (!good()) { set(ios::failbit); return 0; }
3708 if (_tie) _tie->flush();
3709 if ((flags() & ios::skipws) && !ws(*this)) return 0;
3712 int ipfx1() { // Optimized version of ipfx(1).
3713 if (!good()) { set(ios::failbit); return 0; }
3714 if (_tie && rdbuf()->in_avail() == 0) _tie->flush();
3717 size_t gcount() { return _gcount; }
3718 istream& seekg(streampos);
3719 istream& seekg(streamoff, _seek_dir);
3721 istream& putback(char ch) {
3722 if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit);
3725 if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit);
3728 istream& unget(char ch) { return putback(ch); }
3733 istream& operator>>(istream&, char*);
3734 istream& operator>>(istream& is, unsigned char* p) { return is >> (char*)p; }
3735 //istream& operator>>(istream& is, signed char* p) { return is >> (char*)p; }
3736 istream& operator>>(istream&, char& c);
3737 istream& operator>>(istream&, unsigned char& c);
3738 //istream& operator>>(istream&, signed char& c);
3739 istream& operator>>(istream&, int&);
3740 istream& operator>>(istream&, long&);
3741 istream& operator>>(istream&, short&);
3742 istream& operator>>(istream&, unsigned int&);
3743 istream& operator>>(istream&, unsigned long&);
3744 istream& operator>>(istream&, unsigned short&);
3745 istream& operator>>(istream&, float&);
3746 istream& operator>>(istream&, double&);
3747 istream& operator>>(istream& is, __imanip func) { return (*func)(is); }
3749 class iostream : public ios {
3753 operator istream&() { return *(istream*)this; }
3754 operator ostream&() { return *(ostream*)this; }
3756 // NOTE: These duplicate istream methods.
3757 istream& get(char& c) { return ((istream*)this)->get(c); }
3758 istream& get(unsigned char& c) { return ((istream*)this)->get(c); }
3759 istream& read(char *ptr, int n) { return ((istream*)this)->read(ptr, n); }
3760 istream& read(unsigned char *ptr, int n)
3761 { return ((istream*)this)->read((char*)ptr, n); }
3762 istream& read(void *ptr, int n)
3763 { return ((istream*)this)->read((char*)ptr, n); }
3764 int get() { return _strbuf->sbumpc(); }
3765 istream& getline(char* ptr, int len, char delim = '\n')
3766 { return ((istream*)this)->getline(ptr, len, delim); }
3767 istream& get(char* ptr, int len, char delim = '\n')
3768 { return ((istream*)this)->get(ptr, len, delim); }
3769 istream& gets(char **s, char delim = '\n')
3770 { return ((istream*)this)->gets(s, delim); }
3771 int ipfx(int need) { return ((istream*)this)->ipfx(need); }
3772 int ipfx0() { return ((istream*)this)->ipfx0(); }
3773 int ipfx1() { return ((istream*)this)->ipfx1(); }
3774 size_t gcount() { return _gcount; }
3775 istream& putback(char ch) { return ((istream*)this)->putback(ch); }
3776 istream& unget() { return ((istream*)this)->unget(); }
3777 istream& seekg(streampos pos) { return ((istream*)this)->seekg(pos); }
3778 istream& seekg(streamoff off, _seek_dir dir)
3779 { return ((istream*)this)->seekg(off, dir); }
3780 streampos tellg() { return ((istream*)this)->tellg(); }
3782 istream& unget(char ch) { return putback(ch); }
3785 // NOTE: These duplicate ostream methods.
3786 int opfx() { return ((ostream*)this)->opfx(); }
3787 void osfx() { ((ostream*)this)->osfx(); }
3788 ostream& flush() { return ((ostream*)this)->flush(); }
3789 ostream& put(char c) { return ((ostream*)this)->put(c); }
3790 ostream& write(const char *s, int n)
3791 { return ((ostream*)this)->write(s, n); }
3792 ostream& write(const unsigned char *s, int n)
3793 { return ((ostream*)this)->write((char*)s, n); }
3794 ostream& write(const void *s, int n)
3795 { return ((ostream*)this)->write((char*)s, n); }
3796 ostream& form(const char *format ...);
3797 ostream& vform(const char *format, char* args)
3798 { return ((ostream*)this)->vform(format, args); }
3799 ostream& seekp(streampos pos) { return ((ostream*)this)->seekp(pos); }
3800 ostream& seekp(streamoff off, _seek_dir dir)
3801 { return ((ostream*)this)->seekp(off, dir); }
3802 streampos tellp() { return ((ostream*)this)->tellp(); }
3806 extern ostream cout, cerr, clog; // clog->rdbuf() == cerr->rdbuf()
3808 inline ostream& ostream::put(char c) { _strbuf->sputc(c); return *this; }
3810 struct Iostream_init { } ; // Compatibility hack for AT&T libraray.
3813 //# 7 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stream.h" 2
3816 extern char* form(char*, ...);
3818 extern char* dec(long, int=0);
3819 extern char* dec(int, int=0);
3820 extern char* dec(unsigned long, int=0);
3821 extern char* dec(unsigned int, int=0);
3823 extern char* hex(long, int=0);
3824 extern char* hex(int, int=0);
3825 extern char* hex(unsigned long, int=0);
3826 extern char* hex(unsigned int, int=0);
3828 extern char* oct(long, int=0);
3829 extern char* oct(int, int=0);
3830 extern char* oct(unsigned long, int=0);
3831 extern char* oct(unsigned int, int=0);
3833 inline istream& WS(istream& str) { return ws(str); }
3836 //# 26 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 2
3838 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/Regex.h" 1
3839 // This may look like C code, but it is really -*- C++ -*-
3841 Copyright (C) 1988 Free Software Foundation
3842 written by Doug Lea (dl@rocky.oswego.edu)
3844 This file is part of the GNU C++ Library. This library is free
3845 software; you can redistribute it and/or modify it under the terms of
3846 the GNU Library General Public License as published by the Free
3847 Software Foundation; either version 2 of the License, or (at your
3848 option) any later version. This library is distributed in the hope
3849 that it will be useful, but WITHOUT ANY WARRANTY; without even the
3850 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
3851 PURPOSE. See the GNU Library General Public License for more details.
3852 You should have received a copy of the GNU Library General Public
3853 License along with this library; if not, write to the Free Software
3854 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
3870 struct re_pattern_buffer; // defined elsewhere
3871 struct re_registers;
3877 Regex(const Regex&) {} // no X(X&)
3878 void operator = (const Regex&) {} // no assignment
3881 re_pattern_buffer* buf;
3885 Regex(const char* t,
3888 const char* transtable = 0);
3892 int match(const char* s, int len, int pos = 0) const;
3893 int search(const char* s, int len,
3894 int& matchlen, int startpos = 0) const;
3895 int match_info(int& start, int& length, int nth = 0) const;
3897 int OK() const; // representation invariant
3900 // some built in regular expressions
3902 extern const Regex RXwhite; // = "[ \n\t\r\v\f]+"
3903 extern const Regex RXint; // = "-?[0-9]+"
3904 extern const Regex RXdouble; // = "-?\\(\\([0-9]+\\.[0-9]*\\)\\|
3905 // \\([0-9]+\\)\\|\\(\\.[0-9]+\\)\\)
3906 // \\([eE][---+]?[0-9]+\\)?"
3907 extern const Regex RXalpha; // = "[A-Za-z]+"
3908 extern const Regex RXlowercase; // = "[a-z]+"
3909 extern const Regex RXuppercase; // = "[A-Z]+"
3910 extern const Regex RXalphanum; // = "[0-9A-Za-z]+"
3911 extern const Regex RXidentifier; // = "[A-Za-z_][A-Za-z0-9_]*"
3915 //# 27 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 2
3918 struct StrRep // internal String representations
3920 unsigned short len; // string length
3921 unsigned short sz; // allocated space
3922 char s[1]; // the string starts here
3923 // (at least 1 char for trailing null)
3924 // allocated & expanded via non-public fcts
3927 // primitive ops on StrReps -- nearly all String fns go through these.
3929 StrRep* Salloc(StrRep*, const char*, int, int);
3930 StrRep* Scopy(StrRep*, StrRep*);
3931 StrRep* Sresize(StrRep*, int);
3932 StrRep* Scat(StrRep*, const char*, int, const char*, int);
3933 StrRep* Scat(StrRep*, const char*, int,const char*,int, const char*,int);
3934 StrRep* Sprepend(StrRep*, const char*, int);
3935 StrRep* Sreverse(StrRep*, StrRep*);
3936 StrRep* Supcase(StrRep*, StrRep*);
3937 StrRep* Sdowncase(StrRep*, StrRep*);
3938 StrRep* Scapitalize(StrRep*, StrRep*);
3940 // These classes need to be defined in the order given
3947 friend class String;
3950 String& S; // The String I'm a substring of
3951 unsigned short pos; // starting position in S's rep
3952 unsigned short len; // length of substring
3954 void assign(StrRep*, const char*, int = -1);
3955 SubString(String& x, int p, int l);
3956 SubString(const SubString& x);
3960 // Note there are no public constructors. SubStrings are always
3961 // created via String operations
3965 void operator = (const String& y);
3966 void operator = (const SubString& y);
3967 void operator = (const char* t);
3968 void operator = (char c);
3970 // return 1 if target appears anywhere in SubString; else 0
3972 int contains(char c) const;
3973 int contains(const String& y) const;
3974 int contains(const SubString& y) const;
3975 int contains(const char* t) const;
3976 int contains(const Regex& r) const;
3978 // return 1 if target matches entire SubString
3980 int matches(const Regex& r) const;
3984 friend ostream& operator<<(ostream& s, const SubString& x);
3988 unsigned int length() const;
3990 const char* chars() const;
3999 friend class SubString;
4002 StrRep* rep; // Strings are pointers to their representations
4004 // some helper functions
4006 int search(int, int, const char*, int = -1) const;
4007 int search(int, int, char) const;
4008 int match(int, int, int, const char*, int = -1) const;
4009 int _gsub(const char*, int, const char* ,int);
4010 int _gsub(const Regex&, const char*, int);
4011 SubString _substr(int, int);
4015 // constructors & assignment
4018 String(const String& x);
4019 String(const SubString& x);
4020 String(const char* t);
4021 String(const char* t, int len);
4026 void operator = (const String& y);
4027 void operator = (const char* y);
4028 void operator = (char c);
4029 void operator = (const SubString& y);
4033 void operator += (const String& y);
4034 void operator += (const SubString& y);
4035 void operator += (const char* t);
4036 void operator += (char c);
4038 void prepend(const String& y);
4039 void prepend(const SubString& y);
4040 void prepend(const char* t);
4041 void prepend(char c);
4044 // procedural versions:
4045 // concatenate first 2 args, store result in last arg
4047 friend void cat(const String&, const String&, String&);
4048 friend void cat(const String&, const SubString&, String&);
4049 friend void cat(const String&, const char*, String&);
4050 friend void cat(const String&, char, String&);
4052 friend void cat(const SubString&, const String&, String&);
4053 friend void cat(const SubString&, const SubString&, String&);
4054 friend void cat(const SubString&, const char*, String&);
4055 friend void cat(const SubString&, char, String&);
4057 friend void cat(const char*, const String&, String&);
4058 friend void cat(const char*, const SubString&, String&);
4059 friend void cat(const char*, const char*, String&);
4060 friend void cat(const char*, char, String&);
4062 // double concatenation, by request. (yes, there are too many versions,
4063 // but if one is supported, then the others should be too...)
4064 // Concatenate first 3 args, store in last arg
4066 friend void cat(const String&,const String&, const String&,String&);
4067 friend void cat(const String&,const String&,const SubString&,String&);
4068 friend void cat(const String&,const String&, const char*, String&);
4069 friend void cat(const String&,const String&, char, String&);
4070 friend void cat(const String&,const SubString&,const String&,String&);
4071 friend void cat(const String&,const SubString&,const SubString&,String&);
4072 friend void cat(const String&,const SubString&, const char*, String&);
4073 friend void cat(const String&,const SubString&, char, String&);
4074 friend void cat(const String&,const char*, const String&, String&);
4075 friend void cat(const String&,const char*, const SubString&, String&);
4076 friend void cat(const String&,const char*, const char*, String&);
4077 friend void cat(const String&,const char*, char, String&);
4079 friend void cat(const char*, const String&, const String&,String&);
4080 friend void cat(const char*,const String&,const SubString&,String&);
4081 friend void cat(const char*,const String&, const char*, String&);
4082 friend void cat(const char*,const String&, char, String&);
4083 friend void cat(const char*,const SubString&,const String&,String&);
4084 friend void cat(const char*,const SubString&,const SubString&,String&);
4085 friend void cat(const char*,const SubString&, const char*, String&);
4086 friend void cat(const char*,const SubString&, char, String&);
4087 friend void cat(const char*,const char*, const String&, String&);
4088 friend void cat(const char*,const char*, const SubString&, String&);
4089 friend void cat(const char*,const char*, const char*, String&);
4090 friend void cat(const char*,const char*, char, String&);
4093 // searching & matching
4095 // return position of target in string or -1 for failure
4097 int index(char c, int startpos = 0) const;
4098 int index(const String& y, int startpos = 0) const;
4099 int index(const SubString& y, int startpos = 0) const;
4100 int index(const char* t, int startpos = 0) const;
4101 int index(const Regex& r, int startpos = 0) const;
4103 // return 1 if target appears anyhere in String; else 0
4105 int contains(char c) const;
4106 int contains(const String& y) const;
4107 int contains(const SubString& y) const;
4108 int contains(const char* t) const;
4109 int contains(const Regex& r) const;
4111 // return 1 if target appears anywhere after position pos
4112 // (or before, if pos is negative) in String; else 0
4114 int contains(char c, int pos) const;
4115 int contains(const String& y, int pos) const;
4116 int contains(const SubString& y, int pos) const;
4117 int contains(const char* t, int pos) const;
4118 int contains(const Regex& r, int pos) const;
4120 // return 1 if target appears at position pos in String; else 0
4122 int matches(char c, int pos = 0) const;
4123 int matches(const String& y, int pos = 0) const;
4124 int matches(const SubString& y, int pos = 0) const;
4125 int matches(const char* t, int pos = 0) const;
4126 int matches(const Regex& r, int pos = 0) const;
4128 // return number of occurences of target in String
4130 int freq(char c) const;
4131 int freq(const String& y) const;
4132 int freq(const SubString& y) const;
4133 int freq(const char* t) const;
4135 // SubString extraction
4137 // Note that you can't take a substring of a const String, since
4138 // this leaves open the possiblility of indirectly modifying the
4139 // String through the SubString
4141 SubString at(int pos, int len);
4142 SubString operator () (int pos, int len); // synonym for at
4144 SubString at(const String& x, int startpos = 0);
4145 SubString at(const SubString& x, int startpos = 0);
4146 SubString at(const char* t, int startpos = 0);
4147 SubString at(char c, int startpos = 0);
4148 SubString at(const Regex& r, int startpos = 0);
4150 SubString before(int pos);
4151 SubString before(const String& x, int startpos = 0);
4152 SubString before(const SubString& x, int startpos = 0);
4153 SubString before(const char* t, int startpos = 0);
4154 SubString before(char c, int startpos = 0);
4155 SubString before(const Regex& r, int startpos = 0);
4157 SubString through(int pos);
4158 SubString through(const String& x, int startpos = 0);
4159 SubString through(const SubString& x, int startpos = 0);
4160 SubString through(const char* t, int startpos = 0);
4161 SubString through(char c, int startpos = 0);
4162 SubString through(const Regex& r, int startpos = 0);
4164 SubString from(int pos);
4165 SubString from(const String& x, int startpos = 0);
4166 SubString from(const SubString& x, int startpos = 0);
4167 SubString from(const char* t, int startpos = 0);
4168 SubString from(char c, int startpos = 0);
4169 SubString from(const Regex& r, int startpos = 0);
4171 SubString after(int pos);
4172 SubString after(const String& x, int startpos = 0);
4173 SubString after(const SubString& x, int startpos = 0);
4174 SubString after(const char* t, int startpos = 0);
4175 SubString after(char c, int startpos = 0);
4176 SubString after(const Regex& r, int startpos = 0);
4181 // delete len chars starting at pos
4182 void del(int pos, int len);
4184 // delete the first occurrence of target after startpos
4186 void del(const String& y, int startpos = 0);
4187 void del(const SubString& y, int startpos = 0);
4188 void del(const char* t, int startpos = 0);
4189 void del(char c, int startpos = 0);
4190 void del(const Regex& r, int startpos = 0);
4192 // global substitution: substitute all occurrences of pat with repl
4194 int gsub(const String& pat, const String& repl);
4195 int gsub(const SubString& pat, const String& repl);
4196 int gsub(const char* pat, const String& repl);
4197 int gsub(const char* pat, const char* repl);
4198 int gsub(const Regex& pat, const String& repl);
4200 // friends & utilities
4202 // split string into array res at separators; return number of elements
4204 friend int split(const String& x, String res[], int maxn,
4206 friend int split(const String& x, String res[], int maxn,
4209 friend String common_prefix(const String& x, const String& y,
4211 friend String common_suffix(const String& x, const String& y,
4213 friend String replicate(char c, int n);
4214 friend String replicate(const String& y, int n);
4215 friend String join(String src[], int n, const String& sep);
4217 // simple builtin transformations
4219 friend String reverse(const String& x);
4220 friend String upcase(const String& x);
4221 friend String downcase(const String& x);
4222 friend String capitalize(const String& x);
4224 // in-place versions of above
4231 // element extraction
4233 char& operator [] (int i);
4234 char elem(int i) const;
4235 char firstchar() const;
4236 char lastchar() const;
4240 operator const char*() const;
4241 const char* chars() const;
4246 friend ostream& operator<<(ostream& s, const String& x);
4247 friend ostream& operator<<(ostream& s, const SubString& x);
4248 friend istream& operator>>(istream& s, String& x);
4250 friend int readline(istream& s, String& x,
4251 char terminator = '\n',
4252 int discard_terminator = 1);
4256 unsigned int length() const;
4259 // preallocate some space for String
4260 void alloc(int newsize);
4262 // report current allocation (not length!)
4264 int allocation() const;
4267 volatile void error(const char* msg) const;
4272 typedef String StrTmp; // for backward compatibility
4276 int compare(const String& x, const String& y);
4277 int compare(const String& x, const SubString& y);
4278 int compare(const String& x, const char* y);
4279 int compare(const SubString& x, const String& y);
4280 int compare(const SubString& x, const SubString& y);
4281 int compare(const SubString& x, const char* y);
4282 int fcompare(const String& x, const String& y); // ignore case
4284 extern StrRep _nilStrRep;
4285 extern String _nilString;
4289 String operator + (const String& x, const String& y);
4290 String operator + (const String& x, const SubString& y);
4291 String operator + (const String& x, const char* y);
4292 String operator + (const String& x, char y);
4293 String operator + (const SubString& x, const String& y);
4294 String operator + (const SubString& x, const SubString& y);
4295 String operator + (const SubString& x, const char* y);
4296 String operator + (const SubString& x, char y);
4297 String operator + (const char* x, const String& y);
4298 String operator + (const char* x, const SubString& y);
4300 int operator==(const String& x, const String& y);
4301 int operator!=(const String& x, const String& y);
4302 int operator> (const String& x, const String& y);
4303 int operator>=(const String& x, const String& y);
4304 int operator< (const String& x, const String& y);
4305 int operator<=(const String& x, const String& y);
4306 int operator==(const String& x, const SubString& y);
4307 int operator!=(const String& x, const SubString& y);
4308 int operator> (const String& x, const SubString& y);
4309 int operator>=(const String& x, const SubString& y);
4310 int operator< (const String& x, const SubString& y);
4311 int operator<=(const String& x, const SubString& y);
4312 int operator==(const String& x, const char* t);
4313 int operator!=(const String& x, const char* t);
4314 int operator> (const String& x, const char* t);
4315 int operator>=(const String& x, const char* t);
4316 int operator< (const String& x, const char* t);
4317 int operator<=(const String& x, const char* t);
4318 int operator==(const SubString& x, const String& y);
4319 int operator!=(const SubString& x, const String& y);
4320 int operator> (const SubString& x, const String& y);
4321 int operator>=(const SubString& x, const String& y);
4322 int operator< (const SubString& x, const String& y);
4323 int operator<=(const SubString& x, const String& y);
4324 int operator==(const SubString& x, const SubString& y);
4325 int operator!=(const SubString& x, const SubString& y);
4326 int operator> (const SubString& x, const SubString& y);
4327 int operator>=(const SubString& x, const SubString& y);
4328 int operator< (const SubString& x, const SubString& y);
4329 int operator<=(const SubString& x, const SubString& y);
4330 int operator==(const SubString& x, const char* t);
4331 int operator!=(const SubString& x, const char* t);
4332 int operator> (const SubString& x, const char* t);
4333 int operator>=(const SubString& x, const char* t);
4334 int operator< (const SubString& x, const char* t);
4335 int operator<=(const SubString& x, const char* t);
4340 // status reports, needed before defining other things
4342 inline unsigned int String::length() const { return rep->len; }
4343 inline int String::empty() const { return rep->len == 0; }
4344 inline const char* String::chars() const { return &(rep->s[0]); }
4345 inline int String::allocation() const { return rep->sz; }
4346 inline void String::alloc(int newsize) { rep = Sresize(rep, newsize); }
4348 inline unsigned int SubString::length() const { return len; }
4349 inline int SubString::empty() const { return len == 0; }
4350 inline const char* SubString::chars() const { return &(S.rep->s[pos]); }
4355 inline String::String()
4356 : rep(&_nilStrRep) {}
4357 inline String::String(const String& x)
4358 : rep(Scopy(0, x.rep)) {}
4359 inline String::String(const char* t)
4360 : rep(Salloc(0, t, -1, -1)) {}
4361 inline String::String(const char* t, int tlen)
4362 : rep(Salloc(0, t, tlen, tlen)) {}
4363 inline String::String(const SubString& y)
4364 : rep(Salloc(0, y.chars(), y.length(), y.length())) {}
4365 inline String::String(char c)
4366 : rep(Salloc(0, &c, 1, 1)) {}
4368 inline String::~String() { if (rep != &_nilStrRep) delete rep; }
4370 inline SubString::SubString(const SubString& x)
4371 :S(x.S), pos(x.pos), len(x.len) {}
4372 inline SubString::SubString(String& x, int first, int l)
4373 :S(x), pos(first), len(l) {}
4375 inline SubString::~SubString() {}
4379 inline void String::operator = (const String& y)
4381 rep = Scopy(rep, y.rep);
4384 inline void String::operator=(const char* t)
4386 rep = Salloc(rep, t, -1, -1);
4389 inline void String::operator=(const SubString& y)
4391 rep = Salloc(rep, y.chars(), y.length(), y.length());
4394 inline void String::operator=(char c)
4396 rep = Salloc(rep, &c, 1, 1);
4400 inline void SubString::operator = (const char* ys)
4405 inline void SubString::operator = (char ch)
4410 inline void SubString::operator = (const String& y)
4412 assign(y.rep, y.chars(), y.length());
4415 inline void SubString::operator = (const SubString& y)
4417 assign(y.S.rep, y.chars(), y.length());
4420 // Zillions of cats...
4422 inline void cat(const String& x, const String& y, String& r)
4424 r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
4427 inline void cat(const String& x, const SubString& y, String& r)
4429 r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
4432 inline void cat(const String& x, const char* y, String& r)
4434 r.rep = Scat(r.rep, x.chars(), x.length(), y, -1);
4437 inline void cat(const String& x, char y, String& r)
4439 r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1);
4442 inline void cat(const SubString& x, const String& y, String& r)
4444 r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
4447 inline void cat(const SubString& x, const SubString& y, String& r)
4449 r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
4452 inline void cat(const SubString& x, const char* y, String& r)
4454 r.rep = Scat(r.rep, x.chars(), x.length(), y, -1);
4457 inline void cat(const SubString& x, char y, String& r)
4459 r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1);
4462 inline void cat(const char* x, const String& y, String& r)
4464 r.rep = Scat(r.rep, x, -1, y.chars(), y.length());
4467 inline void cat(const char* x, const SubString& y, String& r)
4469 r.rep = Scat(r.rep, x, -1, y.chars(), y.length());
4472 inline void cat(const char* x, const char* y, String& r)
4474 r.rep = Scat(r.rep, x, -1, y, -1);
4477 inline void cat(const char* x, char y, String& r)
4479 r.rep = Scat(r.rep, x, -1, &y, 1);
4482 inline void cat(const String& a, const String& x, const String& y, String& r)
4484 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
4487 inline void cat(const String& a, const String& x, const SubString& y, String& r)
4489 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
4492 inline void cat(const String& a, const String& x, const char* y, String& r)
4494 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1);
4497 inline void cat(const String& a, const String& x, char y, String& r)
4499 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), &y, 1);
4502 inline void cat(const String& a, const SubString& x, const String& y, String& r)
4504 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
4507 inline void cat(const String& a, const SubString& x, const SubString& y, String& r)
4509 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
4512 inline void cat(const String& a, const SubString& x, const char* y, String& r)
4514 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1);
4517 inline void cat(const String& a, const SubString& x, char y, String& r)
4519 r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), &y, 1);
4522 inline void cat(const String& a, const char* x, const String& y, String& r)
4524 r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y.chars(), y.length());
4527 inline void cat(const String& a, const char* x, const SubString& y, String& r)
4529 r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y.chars(), y.length());
4532 inline void cat(const String& a, const char* x, const char* y, String& r)
4534 r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y, -1);
4537 inline void cat(const String& a, const char* x, char y, String& r)
4539 r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, &y, 1);
4543 inline void cat(const char* a, const String& x, const String& y, String& r)
4545 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
4548 inline void cat(const char* a, const String& x, const SubString& y, String& r)
4550 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
4553 inline void cat(const char* a, const String& x, const char* y, String& r)
4555 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1);
4558 inline void cat(const char* a, const String& x, char y, String& r)
4560 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), &y, 1);
4563 inline void cat(const char* a, const SubString& x, const String& y, String& r)
4565 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
4568 inline void cat(const char* a, const SubString& x, const SubString& y, String& r)
4570 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
4573 inline void cat(const char* a, const SubString& x, const char* y, String& r)
4575 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1);
4578 inline void cat(const char* a, const SubString& x, char y, String& r)
4580 r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), &y, 1);
4583 inline void cat(const char* a, const char* x, const String& y, String& r)
4585 r.rep = Scat(r.rep, a, -1, x, -1, y.chars(), y.length());
4588 inline void cat(const char* a, const char* x, const SubString& y, String& r)
4590 r.rep = Scat(r.rep, a, -1, x, -1, y.chars(), y.length());
4593 inline void cat(const char* a, const char* x, const char* y, String& r)
4595 r.rep = Scat(r.rep, a, -1, x, -1, y, -1);
4598 inline void cat(const char* a, const char* x, char y, String& r)
4600 r.rep = Scat(r.rep, a, -1, x, -1, &y, 1);
4604 // operator versions
4606 inline void String::operator +=(const String& y)
4608 cat(*this, y, *this);
4611 inline void String::operator +=(const SubString& y)
4613 cat(*this, y, *this);
4616 inline void String::operator += (const char* y)
4618 cat(*this, y, *this);
4621 inline void String:: operator +=(char y)
4623 cat(*this, y, *this);
4626 // constructive concatenation
4630 inline String operator + (const String& x, const String& y) return r;
4635 inline String operator + (const String& x, const SubString& y) return r;
4640 inline String operator + (const String& x, const char* y) return r;
4645 inline String operator + (const String& x, char y) return r;
4650 inline String operator + (const SubString& x, const String& y) return r;
4655 inline String operator + (const SubString& x, const SubString& y) return r;
4660 inline String operator + (const SubString& x, const char* y) return r;
4665 inline String operator + (const SubString& x, char y) return r;
4670 inline String operator + (const char* x, const String& y) return r;
4675 inline String operator + (const char* x, const SubString& y) return r;
4680 inline String reverse(const String& x) return r;
4682 r.rep = Sreverse(x.rep, r.rep);
4685 inline String upcase(const String& x) return r;
4687 r.rep = Supcase(x.rep, r.rep);
4690 inline String downcase(const String& x) return r;
4692 r.rep = Sdowncase(x.rep, r.rep);
4695 inline String capitalize(const String& x) return r;
4697 r.rep = Scapitalize(x.rep, r.rep);
4700 //# 883 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h"
4705 inline void String::prepend(const String& y)
4707 rep = Sprepend(rep, y.chars(), y.length());
4710 inline void String::prepend(const char* y)
4712 rep = Sprepend(rep, y, -1);
4715 inline void String::prepend(char y)
4717 rep = Sprepend(rep, &y, 1);
4720 inline void String::prepend(const SubString& y)
4722 rep = Sprepend(rep, y.chars(), y.length());
4725 // misc transformations
4728 inline void String::reverse()
4730 rep = Sreverse(rep, rep);
4734 inline void String::upcase()
4736 rep = Supcase(rep, rep);
4740 inline void String::downcase()
4742 rep = Sdowncase(rep, rep);
4746 inline void String::capitalize()
4748 rep = Scapitalize(rep, rep);
4751 // element extraction
4753 inline char& String::operator [] (int i)
4755 if (((unsigned)i) >= length()) error("invalid index");
4759 inline char String::elem (int i) const
4761 if (((unsigned)i) >= length()) error("invalid index");
4765 inline char String::firstchar() const
4770 inline char String::lastchar() const
4772 return elem(length() - 1);
4777 inline int String::index(char c, int startpos) const
4779 return search(startpos, length(), c);
4782 inline int String::index(const char* t, int startpos) const
4784 return search(startpos, length(), t);
4787 inline int String::index(const String& y, int startpos) const
4789 return search(startpos, length(), y.chars(), y.length());
4792 inline int String::index(const SubString& y, int startpos) const
4794 return search(startpos, length(), y.chars(), y.length());
4797 inline int String::index(const Regex& r, int startpos) const
4799 int unused; return r.search(chars(), length(), unused, startpos);
4802 inline int String::contains(char c) const
4804 return search(0, length(), c) >= 0;
4807 inline int String::contains(const char* t) const
4809 return search(0, length(), t) >= 0;
4812 inline int String::contains(const String& y) const
4814 return search(0, length(), y.chars(), y.length()) >= 0;
4817 inline int String::contains(const SubString& y) const
4819 return search(0, length(), y.chars(), y.length()) >= 0;
4822 inline int String::contains(char c, int p) const
4824 return match(p, length(), 0, &c, 1) >= 0;
4827 inline int String::contains(const char* t, int p) const
4829 return match(p, length(), 0, t) >= 0;
4832 inline int String::contains(const String& y, int p) const
4834 return match(p, length(), 0, y.chars(), y.length()) >= 0;
4837 inline int String::contains(const SubString& y, int p) const
4839 return match(p, length(), 0, y.chars(), y.length()) >= 0;
4842 inline int String::contains(const Regex& r) const
4844 int unused; return r.search(chars(), length(), unused, 0) >= 0;
4847 inline int String::contains(const Regex& r, int p) const
4849 return r.match(chars(), length(), p) >= 0;
4853 inline int String::matches(const SubString& y, int p) const
4855 return match(p, length(), 1, y.chars(), y.length()) >= 0;
4858 inline int String::matches(const String& y, int p) const
4860 return match(p, length(), 1, y.chars(), y.length()) >= 0;
4863 inline int String::matches(const char* t, int p) const
4865 return match(p, length(), 1, t) >= 0;
4868 inline int String::matches(char c, int p) const
4870 return match(p, length(), 1, &c, 1) >= 0;
4873 inline int String::matches(const Regex& r, int p) const
4875 int l = (p < 0)? -p : length() - p;
4876 return r.match(chars(), length(), p) == l;
4880 inline int SubString::contains(const char* t) const
4882 return S.search(pos, pos+len, t) >= 0;
4885 inline int SubString::contains(const String& y) const
4887 return S.search(pos, pos+len, y.chars(), y.length()) >= 0;
4890 inline int SubString::contains(const SubString& y) const
4892 return S.search(pos, pos+len, y.chars(), y.length()) >= 0;
4895 inline int SubString::contains(char c) const
4897 return S.search(pos, pos+len, 0, c) >= 0;
4900 inline int SubString::contains(const Regex& r) const
4902 int unused; return r.search(chars(), len, unused, 0) >= 0;
4905 inline int SubString::matches(const Regex& r) const
4907 return r.match(chars(), len, 0) == len;
4911 inline int String::gsub(const String& pat, const String& r)
4913 return _gsub(pat.chars(), pat.length(), r.chars(), r.length());
4916 inline int String::gsub(const SubString& pat, const String& r)
4918 return _gsub(pat.chars(), pat.length(), r.chars(), r.length());
4921 inline int String::gsub(const Regex& pat, const String& r)
4923 return _gsub(pat, r.chars(), r.length());
4926 inline int String::gsub(const char* pat, const String& r)
4928 return _gsub(pat, -1, r.chars(), r.length());
4931 inline int String::gsub(const char* pat, const char* r)
4933 return _gsub(pat, -1, r, -1);
4938 inline ostream& operator<<(ostream& s, const String& x)
4940 s << x.chars(); return s;
4943 // a zillion comparison operators
4945 inline int operator==(const String& x, const String& y)
4947 return compare(x, y) == 0;
4950 inline int operator!=(const String& x, const String& y)
4952 return compare(x, y) != 0;
4955 inline int operator>(const String& x, const String& y)
4957 return compare(x, y) > 0;
4960 inline int operator>=(const String& x, const String& y)
4962 return compare(x, y) >= 0;
4965 inline int operator<(const String& x, const String& y)
4967 return compare(x, y) < 0;
4970 inline int operator<=(const String& x, const String& y)
4972 return compare(x, y) <= 0;
4975 inline int operator==(const String& x, const SubString& y)
4977 return compare(x, y) == 0;
4980 inline int operator!=(const String& x, const SubString& y)
4982 return compare(x, y) != 0;
4985 inline int operator>(const String& x, const SubString& y)
4987 return compare(x, y) > 0;
4990 inline int operator>=(const String& x, const SubString& y)
4992 return compare(x, y) >= 0;
4995 inline int operator<(const String& x, const SubString& y)
4997 return compare(x, y) < 0;
5000 inline int operator<=(const String& x, const SubString& y)
5002 return compare(x, y) <= 0;
5005 inline int operator==(const String& x, const char* t)
5007 return compare(x, t) == 0;
5010 inline int operator!=(const String& x, const char* t)
5012 return compare(x, t) != 0;
5015 inline int operator>(const String& x, const char* t)
5017 return compare(x, t) > 0;
5020 inline int operator>=(const String& x, const char* t)
5022 return compare(x, t) >= 0;
5025 inline int operator<(const String& x, const char* t)
5027 return compare(x, t) < 0;
5030 inline int operator<=(const String& x, const char* t)
5032 return compare(x, t) <= 0;
5035 inline int operator==(const SubString& x, const String& y)
5037 return compare(y, x) == 0;
5040 inline int operator!=(const SubString& x, const String& y)
5042 return compare(y, x) != 0;
5045 inline int operator>(const SubString& x, const String& y)
5047 return compare(y, x) < 0;
5050 inline int operator>=(const SubString& x, const String& y)
5052 return compare(y, x) <= 0;
5055 inline int operator<(const SubString& x, const String& y)
5057 return compare(y, x) > 0;
5060 inline int operator<=(const SubString& x, const String& y)
5062 return compare(y, x) >= 0;
5065 inline int operator==(const SubString& x, const SubString& y)
5067 return compare(x, y) == 0;
5070 inline int operator!=(const SubString& x, const SubString& y)
5072 return compare(x, y) != 0;
5075 inline int operator>(const SubString& x, const SubString& y)
5077 return compare(x, y) > 0;
5080 inline int operator>=(const SubString& x, const SubString& y)
5082 return compare(x, y) >= 0;
5085 inline int operator<(const SubString& x, const SubString& y)
5087 return compare(x, y) < 0;
5090 inline int operator<=(const SubString& x, const SubString& y)
5092 return compare(x, y) <= 0;
5095 inline int operator==(const SubString& x, const char* t)
5097 return compare(x, t) == 0;
5100 inline int operator!=(const SubString& x, const char* t)
5102 return compare(x, t) != 0;
5105 inline int operator>(const SubString& x, const char* t)
5107 return compare(x, t) > 0;
5110 inline int operator>=(const SubString& x, const char* t)
5112 return compare(x, t) >= 0;
5115 inline int operator<(const SubString& x, const char* t)
5117 return compare(x, t) < 0;
5120 inline int operator<=(const SubString& x, const char* t)
5122 return compare(x, t) <= 0;
5126 // a helper needed by at, before, etc.
5128 inline SubString String::_substr(int first, int l)
5130 if (first >= length() )
5131 return SubString(_nilString, 0, 0) ;
5133 return SubString(*this, first, l);
5140 //# 26 "../../../../mips/include/Gct/GctErrorHandler.h" 2
5142 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
5143 // This is part of the iostream library, providing -*- C++ -*- input/output.
5144 // Copyright (C) 1991 Per Bothner.
5146 // This library is free software; you can redistribute it and/or
5147 // modify it under the terms of the GNU Library General Public
5148 // License as published by the Free Software Foundation; either
5149 // version 2 of the License, or (at your option) any later version.
5151 // This library is distributed in the hope that it will be useful,
5152 // but WITHOUT ANY WARRANTY; without even the implied warranty of
5153 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5154 // Library General Public License for more details.
5156 // You should have received a copy of the GNU Library General Public
5157 // License along with this library; if not, write to the Free
5158 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
5160 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
5162 //# 27 "../../../../mips/include/Gct/GctErrorHandler.h" 2
5165 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 1
5171 // Fake up a libstuff++
5173 // This is done as a complete and utter hack; this library has no function
5174 // at all being in the boot area; it is here solely in order to provide a
5175 // libstuff++ against which the Makefiles can resolve link lines.
5177 // The only reason that this is done is to allow the STANDARD_C++_LIBRARIES
5178 // as provided by the Makefile templates in the boot area to be the same
5179 // ones that are used by the tools outside this hierarchy.
5181 // The tools outside this hierarchy use a different libstuff++; one that is
5182 // written in C++. This one is not written in C++ in order to be simpler.
5194 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 1
5205 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/ansi.h" 1
5211 * ANSI Compiler Support
5214 * University of California, Berkeley
5217 * ANSI compatible compilers are supposed to define the preprocessor
5218 * directive __STDC__. Based on this directive, this file defines
5219 * certain ANSI specific macros.
5222 * Used in function prototypes. Example:
5224 * ARGS((char *blah, double threshold));
5231 * University of California, Berkeley
5234 /* Function prototypes */
5262 //# 15 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 2
5267 * If g++, then we stub out part of this thing and let the C++ types take
5268 * over and do the same job; some compatibility must be given however
5272 * Use the GNU libg++ definition
5274 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
5282 //# 26 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 2
5284 //# 35 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h"
5288 * Make various pieces of C code that use the old ``Boolean''
5289 * be compatible by faking up the definition of Boolean using
5290 * the new bool type.
5294 //# 58 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h"
5297 typedef long FitAny; /* can fit any integral type */
5300 * typedef char *String; - DO NOT USE THIS - it conflicts with C++
5301 * typedef char **Stringv; - just use char* and char** instead.
5302 * - void* can be used for arbitrary pointers
5308 extern int nocase_strcmp (char *, char *) ;
5309 extern int nocase_strncmp (char *, char *, int) ;
5311 extern bool nocase_strequal (char *, char *) ;
5312 extern bool nocase_strnequal (char *, char *, int) ;
5314 extern bool lead_strequal (char *, char *) ;
5315 extern bool nocase_lead_strequal (char *, char *) ;
5317 extern int strhash (char *, int) ;
5318 extern int nocase_strhash (char *, int) ;
5320 extern int sign (int) ;
5323 * Some useful macros.
5354 //# 33 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
5359 // This is here because we wish to provide externs for the two
5360 // functions btoa(bool, unsigned = 0) and operator<<(ostream&, bool)
5361 // because they are not provided in bool.h.
5363 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
5371 //# 41 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
5373 extern const char *stringify(bool b);
5374 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
5375 // This is part of the iostream library, providing -*- C++ -*- input/output.
5376 // Copyright (C) 1991 Per Bothner.
5378 // This library is free software; you can redistribute it and/or
5379 // modify it under the terms of the GNU Library General Public
5380 // License as published by the Free Software Foundation; either
5381 // version 2 of the License, or (at your option) any later version.
5383 // This library is distributed in the hope that it will be useful,
5384 // but WITHOUT ANY WARRANTY; without even the implied warranty of
5385 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5386 // Library General Public License for more details.
5388 // You should have received a copy of the GNU Library General Public
5389 // License along with this library; if not, write to the Free
5390 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
5392 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
5394 //# 43 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
5396 extern ostream& operator<<(ostream&, bool);
5398 // Should this be kept separate? bool isn't, but then is
5399 // included here only to define ostream& operator<<(ostream&, bool)
5400 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/unit.h" 1
5408 // Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU)
5415 // This _looks_ silly, but it has an important theoretical basis in category
5416 // theory. For the pragmatic reason for its existence, see the example below.
5422 extern const char *stringify(unit u);
5424 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
5425 // This is part of the iostream library, providing -*- C++ -*- input/output.
5426 // Copyright (C) 1991 Per Bothner.
5428 // This library is free software; you can redistribute it and/or
5429 // modify it under the terms of the GNU Library General Public
5430 // License as published by the Free Software Foundation; either
5431 // version 2 of the License, or (at your option) any later version.
5433 // This library is distributed in the hope that it will be useful,
5434 // but WITHOUT ANY WARRANTY; without even the implied warranty of
5435 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5436 // Library General Public License for more details.
5438 // You should have received a copy of the GNU Library General Public
5439 // License along with this library; if not, write to the Free
5440 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
5442 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
5444 //# 28 "/sandbox/wbaker/wbaker0/source/mips/include/unit.h" 2
5446 extern ostream& operator<<(ostream&, unit);
5449 // A unit is used in cases where the type signature of an overloaded
5450 // function must be differentiated in some stronger way than can be
5451 // denoted unambiguously in the C++ syntax. This enum is used to give
5452 // one of the functions a different type signature, thereby allowing
5455 // The use of ``unit'' instead of int or bool is important because a unit
5456 // has only one possible value; therefore it adds no more information to
5457 // the code. For example, say a bool was used instead, then in the testing
5458 // phase, would have to ask: what if TRUE was given, what if FALSE was given.
5459 // The problem is compounded if char or int is used.
5465 // ID(); // construct a null ID
5466 // ID(unit); // alloc a ID with a new id
5468 // static unsigned high_water;
5472 // Try working this example save that ID implements all of the generic
5473 // features of the identifier object, but the high_water is stored
5474 // in the heir. That is what originally motivated the creation of unit.
5478 //# 48 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
5482 // In the spirit of the standard GNU error handler functions
5484 // typedef void (*one_arg_error_handler_t)(const char*);
5485 // a one argument error handler function pointer
5486 // typedef void (*two_arg_error_handler_t)(const char*, const char*);
5487 // a two argument error handler function pointer
5491 // typedef void (*zero_arg_error_handler_t)();
5492 // a zero argument error handler function pointer
5494 typedef void (*zero_arg_error_handler_t)();
5497 // In the spirit of the default GNU error handler functions
5499 // extern void default_one_arg_error_handler(const char *message);
5500 // print out message on stderr, and do the default thing (abort)
5501 // extern void default_two_arg_error_handler(const char *kind, const char *message);
5502 // print out kind and message on stderr, and do the default thing (abort)
5506 // extern void default_zero_arg_error_handler(const char *message);
5507 // do the default thing (abort)
5509 extern void default_zero_arg_error_handler();
5511 // Guaranteed to exit (1)
5512 extern void exit_zero_arg_error_handler();
5513 extern void exit_one_arg_error_handler(const char *message);
5514 extern void exit_two_arg_error_handler(const char *kind, const char *message);
5516 // Guaranteed to abort()
5517 extern void abort_zero_arg_error_handler();
5518 extern void abort_one_arg_error_handler(const char *message);
5519 extern void abort_two_arg_error_handler(const char *kind, const char *message);
5522 // In the spirit of the standard GNU error handlers
5524 // extern void verbose_File_error_handler(const char*);
5525 // perror and set errno = 0
5526 // extern void quiet_File_error_handler(const char*);
5528 // extern void fatal_File_error_handler(const char*);
5529 // perror and exit 1
5533 // extern void preserve_File_error_handler(const char *message);
5534 // no perror, no assignment to errno.
5536 extern void preserve_File_error_handler(const char *message);
5539 //# 29 "../../../../mips/include/Gct/GctErrorHandler.h" 2
5541 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
5547 // tostrstream class
5549 // A terminated oststream - an ostsrstream that auto-terminates on str()
5551 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
5562 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/strstream.h" 1
5563 // This is part of the iostream library, providing input/output for C++.
5564 // Copyright (C) 1991 Per Bothner.
5566 // This library is free software; you can redistribute it and/or
5567 // modify it under the terms of the GNU Library General Public
5568 // License as published by the Free Software Foundation; either
5569 // version 2 of the License, or (at your option) any later version.
5571 // This library is distributed in the hope that it will be useful,
5572 // but WITHOUT ANY WARRANTY; without even the implied warranty of
5573 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5574 // Library General Public License for more details.
5576 // You should have received a copy of the GNU Library General Public
5577 // License along with this library; if not, write to the Free
5578 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
5585 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
5586 // This is part of the iostream library, providing -*- C++ -*- input/output.
5587 // Copyright (C) 1991 Per Bothner.
5589 // This library is free software; you can redistribute it and/or
5590 // modify it under the terms of the GNU Library General Public
5591 // License as published by the Free Software Foundation; either
5592 // version 2 of the License, or (at your option) any later version.
5594 // This library is distributed in the hope that it will be useful,
5595 // but WITHOUT ANY WARRANTY; without even the implied warranty of
5596 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5597 // Library General Public License for more details.
5599 // You should have received a copy of the GNU Library General Public
5600 // License along with this library; if not, write to the Free
5601 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
5603 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
5605 //# 23 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/strstream.h" 2
5608 class strstreambuf : public streambuf {
5609 size_t *lenp; /* current (logical) length (i.e. valid data bytes) */
5610 size_t *sizep; /* allocated (physical) buffer size */
5617 virtual int overflow(int = (-1) );
5620 strstreambuf(int initial);
5621 strstreambuf(char *ptr, int size, char *pstart = 0 );
5623 int frozen() { return _frozen; }
5624 void freeze(int n=1) { _frozen = n != 0; }
5629 class istrstream : public istream {
5632 istrstream(char*, int);
5633 strstreambuf* rdbuf() { return (strstreambuf*)_strbuf; }
5636 class ostrstream : public ostream {
5639 ostrstream(char *cp, int n, int mode=ios::out);
5640 size_t pcount() { return ((strstreambuf*)_strbuf)->pcount(); }
5641 char *str() { return ((strstreambuf*)_strbuf)->str(); }
5642 void freeze(int n = 1) { ((strstreambuf*)_strbuf)->freeze(n); }
5643 int frozen() { return ((strstreambuf*)_strbuf)->frozen(); }
5644 strstreambuf* rdbuf() { return (strstreambuf*)_strbuf; }
5648 //# 25 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 2
5652 // tostrstream class
5654 // An isteam class that doesn't have that nasty skipws parameter that
5655 // you have to remember to set. This class simply provides the istream
5656 // functionality with a set of constructors which defaults skipws to
5657 // FALSE (instead of defaulting to TRUE as is the case with plain istream).
5659 class tostrstream: public ostrstream {
5661 tostrstream(): ostrstream()
5663 // This constructor defines cp as the buffer to use for the
5664 // stream (instead of one of its own devising); it does NOT
5665 // initialize the ostrstream to contain cp (of length n).
5666 tostrstream(char *cp, int n, int mode=ios::out): ostrstream(cp, n, mode)
5670 char *s = ostrstream::str();
5671 s[ostrstream::pcount()] = '\0';
5677 //# 30 "../../../../mips/include/Gct/GctErrorHandler.h" 2
5680 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 1
5686 // GttObject class (is abstract)
5688 // Expects to be included where needed explicitly.
5690 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
5701 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
5703 //# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
5705 //# 25 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
5708 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 1
5714 // GttErrorHandler class
5716 // Expects to be included by Gtt.h
5718 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
5729 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
5737 //# 25 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
5740 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 1
5742 //# 107 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h"
5744 //# 27 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
5746 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
5748 //# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
5750 //# 28 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
5754 // It is expected that this will be virtually multiply inherited
5755 // into all of the classes that need error reporting services.
5757 // The typical way to have that done is by inheriting the GttObject
5758 // as a virtual base class.
5762 // GttErrorHandler class
5764 class GttErrorHandler {
5767 GttErrorHandler(const char *program);
5768 virtual ~GttErrorHandler();
5772 // - an unacceptable, but expected and recoverable condition
5773 // was detected (but the test fails)
5774 // - errors are for ``the expected environment was not found''
5775 // rather than for ``file couldn't be opened''
5776 // - these messages cannot be shut off
5777 // - the error handler determines the recovery action
5778 // TODO - one day exceptions will be used here
5780 static void error(const char *message);
5781 static void error(tostrstream& message);
5783 static void error(const char *function, const char *message);
5784 static void error(const char *function, tostrstream& message);
5786 static void error(const char *class_name, const char *method, const char *message);
5787 static void error(const char *class_name, const char *method, tostrstream& message);
5791 // - an unacceptable and unexpected error was detected
5792 // the data invariants were violated, there is no recovery
5793 // - these messages cannot be shut off
5794 // - the error handler determines the recovery action
5795 // TODO - one day exceptions will be used here
5797 static void fatal(const char *message);
5798 static void fatal(tostrstream& message);
5800 static void fatal(const char *function, const char *message);
5801 static void fatal(const char *function, tostrstream& message);
5803 static void fatal(const char *class_name, const char *method, const char *message);
5804 static void fatal(const char *class_name, const char *method, tostrstream& message);
5807 // Two underscores are used here in order to prevent confusion of these
5808 // private variables with any of the heir's private variables. Note that
5809 // access control is different than visibility in C++, so all the variable
5810 // names in a class hierarchy must be unique.
5813 static bool __partial_init;
5814 static void __partial_initialize();
5815 static bool __full_init;
5816 static void __full_initialize(const char *program);
5817 static char *__program;
5819 static void __handle_error();
5820 static void __handle_fatal();
5821 static void __add_newline(const char *message);
5823 static bool __output_valid();
5824 static ostream *__output;
5828 //# 27 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
5832 // GttObject class (is abstract)
5834 class GttObject: virtual public GttErrorHandler {
5837 GttObject(const GttObject&);
5838 virtual ~GttObject(); // ensure descendants have virtual destructors
5844 // The value typically persists only long enough for an i/o operation
5845 // to be performed (see the defintion of output via operator<<(... ) below)
5846 virtual const char *stringify();
5848 // This is the buffer into which the printed representation of this
5849 // object will be put when the time comes. It is associated with the
5850 // object so it will never go away (so long as the object exists).
5851 // Use a pointer so that you only pay for the space when I/O is used
5852 tostrstream *stringbuf;
5853 void clear_stringbuf();
5859 // The global data invariant for the whole object (heirs included).
5860 // This OK function will call the local invariant function ok() if
5861 // necessary and in addition the OK functions of the heirs
5862 // This is expected to compute the data invariant of the object.
5863 // It will execute GctErrorHandler::fatal if there is wrong.
5864 virtual void OK() const;
5870 // This function computes the invariant which is local to this object.
5871 // It does not call any of the ancestor's OK() or ok() functions.
5872 // It is not a virtual function so that it can be called from within a
5873 // constructor with impunity. Thus this function MUST NOT call any
5874 // virtual functions either; it should call them by their full name if
5875 // that is necessary. The global OK() function will call this function
5878 // This function must NOT NEVER EVER be made virtual.
5885 // This must return a static (constant) string which is the name
5886 // of the class being declared. By convention, not all classes
5887 // must have one of these, but the major root abstract class must
5888 // have one in order to allow the stringify() to work approximately
5890 virtual const char *class_name() const = 0;
5893 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
5894 // This is part of the iostream library, providing -*- C++ -*- input/output.
5895 // Copyright (C) 1991 Per Bothner.
5897 // This library is free software; you can redistribute it and/or
5898 // modify it under the terms of the GNU Library General Public
5899 // License as published by the Free Software Foundation; either
5900 // version 2 of the License, or (at your option) any later version.
5902 // This library is distributed in the hope that it will be useful,
5903 // but WITHOUT ANY WARRANTY; without even the implied warranty of
5904 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5905 // Library General Public License for more details.
5907 // You should have received a copy of the GNU Library General Public
5908 // License along with this library; if not, write to the Free
5909 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
5911 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
5913 //# 91 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
5915 extern ostream& operator<<(ostream&, GttObject&);
5917 // There may be other X& operator<<(X&, GttObject&) defined in the
5918 // packages defining class X. For example see the definition of
5919 // GttUnitObject& operator<<(GttUnitObject&, GttObject&) in Unit.
5922 //# 32 "../../../../mips/include/Gct/GctErrorHandler.h" 2
5926 // It is expected that this will be virtually multiply inherited
5927 // into all of the classes that need error reporting services.
5929 // The typical way to have that done is by inheriting the GctObject
5930 // as a virtual base class.
5934 // GctErrorHandler class
5937 // NOTE - virtual public GttObject should be MI into GctObject - but that
5938 // causes g++ 1.96 to segfault; so we must inherit GttObject here and use SI
5940 class GctErrorHandler: virtual public GttObject {
5943 GctErrorHandler(const String& program);
5944 virtual ~GctErrorHandler();
5947 // Debugging messages
5948 // - these are turned off for production code.
5949 // - these messages can be shut off
5951 static void debug(const char *message);
5952 static void debug(tostrstream& message);
5954 static void debug(const char *function, const char *message);
5955 static void debug(const char *function, tostrstream& message);
5957 static void debug(const char *class_name, const char *method, const char *message);
5958 static void debug(const char *class_name, const char *method, tostrstream& message);
5960 static bool debug(); // current debug switch
5961 static void debug(bool value); // change the debug switch
5964 // Informational messages
5965 // - these correspond to a ``verbose'' mode
5966 // - these are not errors, just chatty progress reports
5967 // - these messages can be shut off
5969 static void note(const char *message);
5970 static void note(tostrstream& message);
5972 static void note(const char *function, const char *message);
5973 static void note(const char *function, tostrstream& message);
5975 static void note(const char *class_name, const char *method, const char *message);
5976 static void note(const char *class_name, const char *method, tostrstream& message);
5978 static bool note(); // current note switch
5979 static void note(bool value); // change the note switch
5983 // - warnings are system-recoverable errors
5984 // - the system has noticed something and taken some
5985 // corrective action
5986 // - these messages can be shut off
5988 static void warning(const char *message);
5989 static void warning(tostrstream& message);
5991 static void warning(const char *function, const char *message);
5992 static void warning(const char *function, tostrstream& message);
5994 static void warning(const char *class_name, const char *method, const char *message);
5995 static void warning(const char *class_name, const char *method, tostrstream& message);
5997 static bool warning(); // current warning switch
5998 static void warning(bool value); // change the warning switch
6002 // - an unacceptable, but expected and recoverable
6003 // condition was detected
6004 // - errors are for ``the expected environment was not found''
6005 // rather than for ``file couldn't be opened''
6006 // - these messages cannot be shut off
6007 // - the error handler determines the recovery action
6008 // TODO - one day exceptions will be used here
6010 static void error(const char *message);
6011 static void error(tostrstream& message);
6013 static void error(const char *function, const char *message);
6014 static void error(const char *function, tostrstream& message);
6016 static void error(const char *class_name, const char *method, const char *message);
6017 static void error(const char *class_name, const char *method, tostrstream& message);
6019 // can't turn off errors - no ``static void error(bool value);''
6020 static zero_arg_error_handler_t error(); // current error handler
6021 static void error(zero_arg_error_handler_t handler);// change the error handler
6023 static void error_is_lib_error_handler(); // change the error handler
6024 static void error_is_exit(); // change the error handler
6026 // Describes the fatal handler - WATCHOUT - implicitly uses AllocRing
6027 static const char *error_handler_description();
6031 // - an unacceptable and unexpected error was detected
6032 // the data invariants were violated, there is no recovery
6033 // - these messages cannot be shut off
6034 // - the error handler determines the recovery action
6035 // TODO - one day exceptions will be used here
6037 static void fatal(const char *message);
6038 static void fatal(tostrstream& message);
6040 static void fatal(const char *function, const char *message);
6041 static void fatal(const char *function, tostrstream& message);
6043 static void fatal(const char *class_name, const char *method, const char *message);
6044 static void fatal(const char *class_name, const char *method, tostrstream& message);
6046 // can't turn off fatals - no ``static void fatal(bool value);''
6047 static zero_arg_error_handler_t fatal(); // return the fatal handler
6048 static void fatal(zero_arg_error_handler_t handler); // change the fatal handler
6050 static void fatal_is_exit(); // change the fatal handler
6051 static void fatal_is_abort(); // change the fatal handler
6053 // Describes the fatal handler - WATCHOUT - implicitly uses AllocRing
6054 static const char *fatal_handler_description();
6057 // Two underscores are used here in order to prevent confusion of these
6058 // private variables with any of the heir's private variables. Note that
6059 // access control is different than visibility in C++, so all the variable
6060 // names in a class hierarchy must be unique.
6062 static bool __debug;
6064 static bool __warning;
6065 static void (*__error_handler)(); // can't turn off errors
6066 static void (*__fatal_handler)(); // can't turn off fatals
6068 static bool __partial_init;
6069 static void __partial_initialize();
6070 static bool __full_init;
6071 static void __full_initialize(const char *program);
6072 static char *__program;
6074 static void __handle_error();
6075 static void __handle_fatal();
6076 static void __add_newline(const char *message);
6077 static void __message_switch(bool value, bool& flag, const char *description);
6078 static void __message_switch(bool value, bool& flag);
6079 static const char *__describe_handler(zero_arg_error_handler_t handler);
6081 static bool __output_valid();
6082 static ostream *__output;
6085 const char *class_name() const;
6090 //# 27 "../../../../mips/include/Gct/Reference/GctReferenceCount.h" 2
6093 class GctReferenceCount: virtual public GctErrorHandler {
6095 GctReferenceCount();
6105 GctReferenceCount::GctReferenceCount()
6111 GctReferenceCount::inc()
6117 GctReferenceCount::dec()
6119 if (this->debug()) {
6120 if (this->_count == 0)
6121 this->error("GctReferenceCount", "dec()",
6122 "attempt to decrement a zero refcount");
6125 // Protect against decrementing off zero in case
6126 // this->debug() is not turned on to signal the error.
6132 GctReferenceCount::zero() const
6134 return (bool)(this->_count == 0);
6138 //# 25 "../../../../mips/include/Gct/Reference.h" 2
6140 //# 1 "../../../../mips/include/Gct/Reference/GctReferenceObject.h" 1
6146 // GctReferenceObject class
6148 // Expects to be included by Gct/Reference.h
6150 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
6161 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
6169 //# 25 "../../../../mips/include/Gct/Reference/GctReferenceObject.h" 2
6172 //# 1 "../../../../mips/include/Gct/Object/GctHashObject.h" 1
6178 // GctHashObject class (is abstract)
6180 // Expects to be included by Object.h or where needed explicitly.
6182 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
6193 //# 1 "../../../../mips/include/Gct/Object/GctObject.h" 1
6199 // GctObject class (is abstract)
6201 // Expects to be included by Object.h or where needed explicitly.
6203 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
6214 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
6216 //# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
6218 //# 25 "../../../../mips/include/Gct/Object/GctObject.h" 2
6221 //# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 1
6223 //# 98 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h"
6225 //# 27 "../../../../mips/include/Gct/Object/GctObject.h" 2
6228 //# 1 "../../../../mips/include/Gct/GctErrorHandler.h" 1
6230 //# 198 "../../../../mips/include/Gct/GctErrorHandler.h"
6232 //# 29 "../../../../mips/include/Gct/Object/GctObject.h" 2
6236 // GctObject class (is abstract)
6238 class GctObject: virtual public GctErrorHandler /*, virtual public GttObject*/ {
6241 GctObject(const GctObject&);
6242 virtual ~GctObject(); // ensure descendants have virtual destructors
6248 // The value typically persists only long enough for an i/o operation
6249 // to be performed (see the defintion of output via operator<<(... ) below)
6250 virtual const char *stringify();
6252 // This is the buffer into which the printed representation of this
6253 // object will be put when the time comes. It is associated with the
6254 // object so it will never go away (so long as the object exists).
6255 // Use a pointer so that you only pay for the space when I/O is used
6256 tostrstream *stringbuf;
6257 void clear_stringbuf();
6261 // Consistency (global consistency)
6263 // The global data invariant for the whole object (heirs included).
6264 // This OK function will call the local invariant function ok() if
6265 // necessary and in addition the OK functions of the heirs
6266 // This is expected to compute the data invariant of the object.
6267 // It will execute GctErrorHandler::fatal if there is wrong.
6268 virtual void OK() const;
6272 // consistency (local consistency)
6274 // This function computes the invariant which is local to this object.
6275 // It does not call any of the ancestor's OK() or ok() functions.
6276 // It is not a virtual function so that it can be called from within a
6277 // constructor with impunity. Thus this function MUST NOT call any
6278 // virtual functions either; it should call them by their full name if
6279 // that is necessary. The global OK() function will call this function
6282 // This function must NOT NEVER EVER be made virtual.
6288 // This must return a static (constant) string which is the name
6289 // of the class being declared. By convention, not all classes
6290 // must have one of these, but the major root abstract class must
6291 // have one in order to allow the stringify() to work approximately
6293 virtual const char *class_name() const = 0;
6297 // The ``id'' of this object
6299 // NOTE - we explicitly allow the situation where this function
6300 // can return the address of the object - the ``this'' pointer
6301 // instead of a computed id field (the __object_id field below).
6303 // This function is protected because we don't want too much dependence
6304 // on this notion of object identity. I want to be able to rip it
6305 // out if it becomes to cumbersome.
6306 unsigned objectId() const;
6311 // NOTE - Normally this would be implemented by the `this' pointer.
6312 // TODO - remove this for production code
6314 // However, in order to make the test suites run on all machines, we
6315 // make this into a symbolic id that is maintained with each object.
6316 // Thus the valid outputs are always consistent across all machines.
6317 unsigned __object_id;
6318 static unsigned __next_id;
6321 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
6322 // This is part of the iostream library, providing -*- C++ -*- input/output.
6323 // Copyright (C) 1991 Per Bothner.
6325 // This library is free software; you can redistribute it and/or
6326 // modify it under the terms of the GNU Library General Public
6327 // License as published by the Free Software Foundation; either
6328 // version 2 of the License, or (at your option) any later version.
6330 // This library is distributed in the hope that it will be useful,
6331 // but WITHOUT ANY WARRANTY; without even the implied warranty of
6332 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6333 // Library General Public License for more details.
6335 // You should have received a copy of the GNU Library General Public
6336 // License along with this library; if not, write to the Free
6337 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
6339 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
6341 //# 117 "../../../../mips/include/Gct/Object/GctObject.h" 2
6343 extern ostream& operator<<(ostream&, GctObject&);
6346 //# 25 "../../../../mips/include/Gct/Object/GctHashObject.h" 2
6350 // GctHashObject class (is abstract)
6352 class GctHashObject: virtual public GctObject {
6355 GctHashObject(const GctHashObject&);
6361 virtual unsigned hash() const;
6365 //# 27 "../../../../mips/include/Gct/Reference/GctReferenceObject.h" 2
6371 // GctReferenceObject class
6373 class GctReferenceObject: virtual public GctHashObject {
6375 // Aid in using operator new() to allocate dynamic
6376 // instances of heirs to GctReferenceObject.
6377 // An error is reported if result_of_new is nil.
6378 static void ensure_new_succeeded(GctReferenceObject *result_of_new,
6379 const char *class_name,
6380 const char *args_supplied = "");
6382 // the stringify() is standard
6385 GctReferenceObject(const bool refcounting = FALSE);
6386 GctReferenceObject(const GctReferenceObject&,
6387 const bool refcounting = FALSE);
6388 virtual ~GctReferenceObject();
6390 void operator=(const GctReferenceObject&);
6394 // Disallowed (create pointers to objects via new only)
6395 // It is kept protected so that heirs can do *-cast-& tricks to work
6396 // around the contravariance of abstract virtuals. This operator should
6397 // never be used to return an address of a GctReferenceObject.
6398 GctReferenceObject *operator&() const;
6400 const char *class_name() const;
6402 bool _destructed; // ensure no use of destructed objects
6403 // this bit guards against the destruct-before-copy g++ bug
6405 bool _refcounting; // was allocated via operator new()
6406 GctReferenceCount _refcount;
6408 // TODO - these names can never be used again in a derived
6409 // class; should they be obfuscated some to free up the
6410 // names (these are good, commonly-used names).
6412 void dereference(GctReferenceObject *&);
6415 bool refcounted() const;
6416 void refcounting(); // as if given in the constructor
6418 // Using this scheme, only GctRef can manipulate the
6419 // reference count via reference(), dereference(). The derived
6420 // classes cannot do such, and the _refcount field is not
6421 // available to be tweaked by GctRef in any way other
6422 // way than the inc/dec/zero interface.
6423 friend class GctRef;
6427 //# 26 "../../../../mips/include/Gct/Reference.h" 2
6429 //# 1 "../../../../mips/include/Gct/Reference/GctRef.h" 1
6437 // Expects to be included by Gct/Reference.h
6439 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
6450 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
6458 //# 25 "../../../../mips/include/Gct/Reference/GctRef.h" 2
6461 //# 1 "../../../../mips/include/Gct/Object/GctHashObject.h" 1
6463 //# 42 "../../../../mips/include/Gct/Object/GctHashObject.h"
6465 //# 27 "../../../../mips/include/Gct/Reference/GctRef.h" 2
6468 class GctReferenceObject;
6470 class GctRef: virtual public GctHashObject {
6473 GctRef(const GctRef&);
6476 void operator=(GctRef&);
6478 // Accessor functions
6479 bool valid() const; // the managed pointer is !null
6480 bool null() const; // the managed pointer is null
6482 GctReferenceObject *ref() const; // faults if not valid
6483 operator void*() const; // unchecked reference
6485 void nullify(); // set the managed pointer to null
6486 void invalidate(); // set the managed pointer to null
6488 unsigned hash() const;
6490 // the stringify() is standard
6495 // We want to make sure pointers do not float around for very long.
6496 // This constructor is used by descendants of this class only; it is
6497 // expected that such descendants will have friend functions which
6498 // will call ``new MumbleObject()'' and return a GctRef to THAT.
6499 // MumbleObject would be a descendant of GctReferenceObject
6500 GctRef(GctReferenceObject *);
6501 friend class GctReferenceObject;
6503 const char *class_name() const;
6505 GctReferenceObject *_pointer; // may store 0
6507 bool _destructed; // ensure no use of destructed objects
6508 // this bit guards against the destruct-before-copy g++ bug
6512 GctRef::operator void*() const
6513 { return this->_pointer; }
6516 GctRef::valid() const
6517 { return (bool)(this->_pointer != 0); }
6520 GctRef::null() const
6521 { return (bool)(this->_pointer == 0); }
6524 // Required operations for the container classes
6526 // NOTE: we can't use const here because the genclass code doesn't
6527 // That is the ONLY reason for not using const reference args here.
6529 extern int operator==(GctRef&, GctRef&);
6530 extern int operator!=(GctRef&, GctRef&);
6532 extern int operator<=(GctRef&, GctRef&);
6533 extern int operator<(GctRef&, GctRef&);
6535 extern int operator>=(GctRef&, GctRef&);
6536 extern int operator>(GctRef&, GctRef&);
6538 extern unsigned hash(GctRef&);
6541 //# 27 "../../../../mips/include/Gct/Reference.h" 2
6545 //# 47 "../../../../mips/include/Gct/genclasses.h" 2
6548 //# 1 "../../../../mips/include/Gct/Ast/GctAstRef.h" 1
6556 // Expects to be included by Gct/Ast.h
6558 // Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU)
6569 //# 1 "../../../../mips/include/Gct/Reference.h" 1
6571 //# 29 "../../../../mips/include/Gct/Reference.h"
6573 //# 25 "../../../../mips/include/Gct/Ast/GctAstRef.h" 2
6576 //# 1 "../../../../mips/include/Gct/Ast/GctAstType.h" 1
6584 // Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
6596 extern const char *stringify(GctAstType a);
6598 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
6599 // This is part of the iostream library, providing -*- C++ -*- input/output.
6600 // Copyright (C) 1991 Per Bothner.
6602 // This library is free software; you can redistribute it and/or
6603 // modify it under the terms of the GNU Library General Public
6604 // License as published by the Free Software Foundation; either
6605 // version 2 of the License, or (at your option) any later version.
6607 // This library is distributed in the hope that it will be useful,
6608 // but WITHOUT ANY WARRANTY; without even the implied warranty of
6609 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6610 // Library General Public License for more details.
6612 // You should have received a copy of the GNU Library General Public
6613 // License along with this library; if not, write to the Free
6614 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
6616 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
6618 //# 26 "../../../../mips/include/Gct/Ast/GctAstType.h" 2
6620 extern ostream& operator<<(ostream&, GctAstType);
6623 //# 27 "../../../../mips/include/Gct/Ast/GctAstRef.h" 2
6630 class GctAstRef: public GctRef {
6633 GctAstRef(const GctAstRef&);
6635 GctAst *ref() const; // may return 0 (not requires valid)
6637 GctAstType concrete_type() const; // requires valid()
6638 GctTree *tree() const; // never return 0 - typechecked
6639 GctLeaf *leaf() const; // never return 0 - typechecked
6641 // We make sure pointers do not float around for very long.
6642 // This constructor cooperates with Gct{Leaf,Tree}::New
6643 // (all flavors) to allow for the creation of new dynamic structures.
6644 GctAstRef(GctAst *);
6645 friend class GctLeaf;
6646 friend class GctTree;
6650 //# 49 "../../../../mips/include/Gct/genclasses.h" 2
6654 //# 2 "GctNameRef.List.cc" 2
6656 //# 1 "../../../../mips/include/Gct/Name/GctNameRef.h" 1
6664 // Expects to be included by Gct/Name.h
6666 // Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU)
6677 //# 1 "../../../../mips/include/Gct/Reference.h" 1
6679 //# 29 "../../../../mips/include/Gct/Reference.h"
6681 //# 25 "../../../../mips/include/Gct/Name/GctNameRef.h" 2
6684 //# 1 "../../../../mips/include/Gct/Name/GctNameType.h" 1
6692 // Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU)
6704 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
6705 // This is part of the iostream library, providing -*- C++ -*- input/output.
6706 // Copyright (C) 1991 Per Bothner.
6708 // This library is free software; you can redistribute it and/or
6709 // modify it under the terms of the GNU Library General Public
6710 // License as published by the Free Software Foundation; either
6711 // version 2 of the License, or (at your option) any later version.
6713 // This library is distributed in the hope that it will be useful,
6714 // but WITHOUT ANY WARRANTY; without even the implied warranty of
6715 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6716 // Library General Public License for more details.
6718 // You should have received a copy of the GNU Library General Public
6719 // License along with this library; if not, write to the Free
6720 // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
6722 //# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
6724 //# 24 "../../../../mips/include/Gct/Name/GctNameType.h" 2
6727 extern char *ntoa(GctNameType n, unsigned width = 0);
6728 extern ostream& operator<<(ostream&, GctNameType);
6731 //# 27 "../../../../mips/include/Gct/Name/GctNameRef.h" 2
6735 class GctIdentifier;
6738 class GctNameRef: public GctRef {
6741 GctNameRef(const GctNameRef&);
6743 GctName *ref() const; // may return 0 (not requires valid())
6745 GctNameType concrete_type() const; // requires valid()
6746 GctIdentifier *identifier() const; // never return 0 - typechecked
6747 GctSignature *signature() const; // never return 0 - typechecked
6749 // We make sure pointers do not float around for very long.
6750 // This constructor cooperates with GctIdentifier::New and
6751 // GctSignature::New (all flavors) to allow for the creation of new
6752 // dynamic structures.
6753 GctNameRef(GctName *);
6754 friend class GctIdentifier;
6755 friend class GctSignature;
6758 const char *class_name() const;
6762 // Required operations for use by genclass container classes
6764 // These are more specific than the ones supplied by GctRef
6765 // because they use the name of the attribute as the key for
6766 // comparison instead of the pointer stored as a void* value.
6768 // NOTE: we can't use const here because the genclass code doesn't
6769 // That is the ONLY reason for not using const reference args here.
6771 extern int operator==(GctNameRef&, GctNameRef&);
6772 extern int operator!=(GctNameRef&, GctNameRef&);
6774 extern int operator<=(GctNameRef&, GctNameRef&);
6775 extern int operator<(GctNameRef&, GctNameRef&);
6777 extern int operator>=(GctNameRef&, GctNameRef&);
6778 extern int operator>(GctNameRef&, GctNameRef&);
6780 // extern unsigned hash(GctNameRef&)
6781 // is handled by the previous declaration of
6782 // extern unsigned hash(GctRef&);
6785 //# 3 "GctNameRef.List.cc" 2
6787 // This may look like C code, but it is really -*- C++ -*-
6789 Copyright (C) 1988 Free Software Foundation
6790 written by Doug Lea (dl@rocky.oswego.edu)
6792 This file is part of GNU CC.
6794 GNU CC is distributed in the hope that it will be useful,
6795 but WITHOUT ANY WARRANTY. No author or distributor
6796 accepts responsibility to anyone for the consequences of using it
6797 or for whether it serves any particular purpose or works at all,
6798 unless he says so in writing. Refer to the GNU CC General Public
6799 License for full details.
6801 Everyone is granted permission to copy, modify and redistribute
6802 GNU CC, but only under the conditions described in the
6803 GNU CC General Public License. A copy of this license is
6804 supposed to have been given to you along with GNU CC so you
6805 can know your rights and responsibilities. It should be in a
6806 file named COPYING. Among other things, the copyright notice
6807 and this notice must be preserved on all copies.
6811 //#pragma implementation
6813 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/builtin.h" 1
6814 // This may look like C code, but it is really -*- C++ -*-
6817 Copyright (C) 1988, 1992 Free Software Foundation
6818 written by Doug Lea (dl@rocky.oswego.edu)
6820 This file is part of the GNU C++ Library. This library is free
6821 software; you can redistribute it and/or modify it under the terms of
6822 the GNU Library General Public License as published by the Free
6823 Software Foundation; either version 2 of the License, or (at your
6824 option) any later version. This library is distributed in the hope
6825 that it will be useful, but WITHOUT ANY WARRANTY; without even the
6826 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
6827 PURPOSE. See the GNU Library General Public License for more details.
6828 You should have received a copy of the GNU Library General Public
6829 License along with this library; if not, write to the Free Software
6830 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
6834 arithmetic, etc. functions on built in types
6838 //# 214 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/builtin.h"
6840 //# 30 "GctNameRef.List.cc" 2
6842 //# 1 "genclasses/GctNameRef.List.h" 1
6843 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/Pix.h" 1
6849 //# 1 "genclasses/GctNameRef.List.h" 2
6851 // This may look like C code, but it is really -*- C++ -*-
6853 Copyright (C) 1988 Free Software Foundation
6854 written by Doug Lea (dl@rocky.oswego.edu)
6856 This file is part of GNU CC.
6858 GNU CC is distributed in the hope that it will be useful,
6859 but WITHOUT ANY WARRANTY. No author or distributor
6860 accepts responsibility to anyone for the consequences of using it
6861 or for whether it serves any particular purpose or works at all,
6862 unless he says so in writing. Refer to the GNU CC General Public
6863 License for full details.
6865 Everyone is granted permission to copy, modify and redistribute
6866 GNU CC, but only under the conditions described in the
6867 GNU CC General Public License. A copy of this license is
6868 supposed to have been given to you along with GNU CC so you
6869 can know your rights and responsibilities. It should be in a
6870 file named COPYING. Among other things, the copyright notice
6871 and this notice must be preserved on all copies.
6884 typedef void (*GctNameRefProcedure)(GctNameRef&);
6885 typedef GctNameRef (*GctNameRefMapper)(GctNameRef&);
6886 typedef GctNameRef (*GctNameRefCombiner)(GctNameRef&, GctNameRef&);
6887 typedef int (*GctNameRefPredicate)(GctNameRef&);
6888 typedef int (*GctNameRefComparator)(GctNameRef&, GctNameRef&);
6891 //# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/Pix.h" 1
6897 //# 42 "genclasses/GctNameRef.List.h" 2
6900 struct GctNameRefListNode
6902 GctNameRefListNode* tl;
6907 extern GctNameRefListNode NilGctNameRefListNode;
6909 class GctNameRefList
6912 GctNameRefListNode* P;
6914 GctNameRefList(GctNameRefListNode* p);
6917 GctNameRefList(GctNameRef& head);
6918 GctNameRefList(GctNameRef& head, GctNameRefList& tl);
6919 GctNameRefList(GctNameRefList& a);
6920 GctNameRefList(Pix p);
6923 GctNameRefList& operator = (GctNameRefList& a);
6927 operator const void* ();
6935 GctNameRef& operator [] (int n);
6937 GctNameRefList nth(int n);
6938 GctNameRefList tail();
6939 GctNameRefList last() const;
6941 GctNameRefList find(GctNameRef& targ);
6942 GctNameRefList find(GctNameRefList& targ);
6943 int contains(GctNameRef& targ) const;
6944 int contains(GctNameRefList& targ) const;
6945 int position(GctNameRef& targ);
6947 friend GctNameRefList copy(GctNameRefList& a);
6948 friend GctNameRefList concat(GctNameRefList& a, GctNameRefList& b);
6949 friend GctNameRefList append(GctNameRefList& a, GctNameRefList& b);
6950 friend GctNameRefList map(GctNameRefMapper f, GctNameRefList& a);
6951 friend GctNameRefList merge(GctNameRefList& a, GctNameRefList& b, GctNameRefComparator f);
6952 friend GctNameRefList combine(GctNameRefCombiner f, GctNameRefList& a, GctNameRefList& b);
6953 friend GctNameRefList reverse(GctNameRefList& a);
6954 friend GctNameRefList select(GctNameRefPredicate f, GctNameRefList& a);
6955 friend GctNameRefList remove(GctNameRef& targ, GctNameRefList& a);
6956 friend GctNameRefList remove(GctNameRefPredicate f, GctNameRefList& a);
6957 friend GctNameRefList subst(GctNameRef& old, GctNameRef& repl, GctNameRefList& a);
6959 void push(GctNameRef& x);
6962 void set_tail(GctNameRefList& p);
6963 void append(GctNameRefList& p);
6964 void prepend(GctNameRefList& p);
6965 void del(GctNameRef& targ);
6966 void del(GctNameRefPredicate f);
6967 void select(GctNameRefPredicate f);
6968 void subst(GctNameRef& old, GctNameRef& repl);
6970 void sort(GctNameRefComparator f);
6972 void apply(GctNameRefProcedure f);
6973 GctNameRef reduce(GctNameRefCombiner f, GctNameRef& base);
6975 friend int operator == (GctNameRefList& a, GctNameRefList& b);
6976 friend int operator != (GctNameRefList& a, GctNameRefList& b);
6979 void next(Pix& p) const;
6980 Pix seek(GctNameRef& item) const;
6981 GctNameRef& operator () (Pix p) const;
6982 int owns(Pix p) const;
6984 void error(const char*) const;
6990 inline void reference(GctNameRefListNode* p)
6992 if (p->ref >= 0) ++p->ref;
6995 inline void dereference(GctNameRefListNode* p)
6997 while (p->ref > 0 && --p->ref == 0)
6999 GctNameRefListNode* n = p->tl;
7006 inline GctNameRefListNode* newGctNameRefListNode(GctNameRef& h)
7008 GctNameRefListNode* p = new GctNameRefListNode;
7014 inline GctNameRefListNode* newGctNameRefListNode(GctNameRef& h, GctNameRefListNode* t)
7016 GctNameRefListNode* p = new GctNameRefListNode;
7024 inline GctNameRefList::~GctNameRefList()
7029 inline GctNameRefList::GctNameRefList()
7031 P = &NilGctNameRefListNode;
7034 inline GctNameRefList::GctNameRefList(GctNameRefListNode* p)
7039 inline GctNameRefList::GctNameRefList(GctNameRef& head)
7041 P = newGctNameRefListNode(head);
7042 P->tl = &NilGctNameRefListNode;
7045 inline GctNameRefList::GctNameRefList(GctNameRef& head, GctNameRefList& tl)
7047 P = newGctNameRefListNode(head, tl.P);
7051 inline GctNameRefList::GctNameRefList(GctNameRefList& a)
7058 inline GctNameRef& GctNameRefList::get()
7063 inline GctNameRef& GctNameRefList::head()
7069 inline GctNameRefList GctNameRefList::tail()
7072 return GctNameRefList(P->tl);
7077 inline int GctNameRefList::null()
7079 return P == &NilGctNameRefListNode;
7082 inline int GctNameRefList::valid()
7084 return P != &NilGctNameRefListNode;
7087 inline GctNameRefList::operator const void* ()
7089 return (P == &NilGctNameRefListNode)? 0 : this;
7092 inline int GctNameRefList::operator ! ()
7094 return (P == &NilGctNameRefListNode);
7098 inline void GctNameRefList::push(GctNameRef& head)
7100 GctNameRefListNode* oldp = P;
7101 P = newGctNameRefListNode(head, oldp);
7105 inline int operator != (GctNameRefList& x, GctNameRefList& y)
7110 inline Pix GctNameRefList::first() const
7112 return (P == &NilGctNameRefListNode)? 0 : Pix(P);
7115 inline GctNameRef& GctNameRefList::operator () (Pix p) const
7117 return ((GctNameRefListNode*)p)->hd;
7120 inline void GctNameRefList::next(Pix& p) const
7124 p = Pix(((GctNameRefListNode*)p)->tl);
7125 if (p == &NilGctNameRefListNode) p = 0;
7129 inline GctNameRefList::GctNameRefList(Pix p)
7131 P = (GctNameRefListNode*)p;
7137 //# 31 "GctNameRef.List.cc" 2
7140 GctNameRefListNode NilGctNameRefListNode;
7142 class init_NilGctNameRefListNode
7145 inline init_NilGctNameRefListNode()
7147 NilGctNameRefListNode.tl = &NilGctNameRefListNode;
7148 NilGctNameRefListNode.ref = -1;
7152 static init_NilGctNameRefListNode NilGctNameRefListNode_initializer;
7154 GctNameRefList& GctNameRefList::operator = (GctNameRefList& a)
7162 GctNameRef GctNameRefList::pop()
7164 GctNameRef res = P->hd;
7165 GctNameRefListNode* tail = P->tl;
7172 void GctNameRefList::set_tail(GctNameRefList& a)
7179 GctNameRefList GctNameRefList::nth(int n)
7181 GctNameRefListNode* p;
7182 for (p = P; n-- > 0; p = p->tl);
7184 return GctNameRefList(p);
7187 GctNameRefList GctNameRefList::last() const
7189 GctNameRefListNode* p = P;
7190 if (p != &NilGctNameRefListNode) while (p->tl != &NilGctNameRefListNode) p = p->tl;
7192 return GctNameRefList(p);
7195 void GctNameRefList::append(GctNameRefList& l)
7197 GctNameRefListNode* p = P;
7198 GctNameRefListNode* a = l.P;
7200 if (p != &NilGctNameRefListNode)
7202 while (p->tl != &NilGctNameRefListNode) p = p->tl;
7209 int GctNameRefList::length() const
7212 for (GctNameRefListNode* p = P; p != &NilGctNameRefListNode; p = p->tl) ++l;
7216 GctNameRef& GctNameRefList::operator [] (int n)
7218 GctNameRefListNode* p;
7219 for (p = P; n-- > 0; p = p->tl);
7223 int operator == (GctNameRefList& x, GctNameRefList& y)
7225 GctNameRefListNode* a = x.P;
7226 GctNameRefListNode* b = y.P;
7230 if (a == &NilGctNameRefListNode)
7231 return b == &NilGctNameRefListNode;
7232 else if (b == &NilGctNameRefListNode)
7234 else if (a->hd == b->hd)
7245 void GctNameRefList::apply(GctNameRefProcedure f)
7247 for(GctNameRefListNode* p = P; p != &NilGctNameRefListNode; p = p->tl)
7251 void GctNameRefList::subst(GctNameRef& old, GctNameRef& repl)
7253 for(GctNameRefListNode* p = P; p != &NilGctNameRefListNode; p = p->tl)
7258 GctNameRef GctNameRefList::reduce(GctNameRefCombiner f, GctNameRef& base)
7260 GctNameRef r = base;
7261 for(GctNameRefListNode* p = P; p != &NilGctNameRefListNode; p = p->tl)
7262 r = (*f)(r, (p->hd));
7266 int GctNameRefList::position(GctNameRef& targ)
7269 GctNameRefListNode* p = P;
7272 if (p == &NilGctNameRefListNode)
7274 else if (p->hd == targ)
7284 int GctNameRefList::contains(GctNameRef& targ) const
7286 GctNameRefListNode* p = P;
7289 if (p == &NilGctNameRefListNode)
7291 else if (p->hd == targ)
7298 GctNameRefList GctNameRefList::find(GctNameRef& targ)
7300 GctNameRefListNode* p;
7301 for (p = P; p != &NilGctNameRefListNode && !(p->hd == targ); p=p->tl);
7303 return GctNameRefList(p);
7306 Pix GctNameRefList::seek(GctNameRef& targ) const
7308 GctNameRefListNode* p = P;
7311 if (p == &NilGctNameRefListNode)
7313 else if (p->hd == targ)
7320 int GctNameRefList::owns(Pix i) const
7322 GctNameRefListNode* p = P;
7325 if (p == &NilGctNameRefListNode)
7327 else if (Pix(p) == i)
7334 GctNameRefList GctNameRefList::find(GctNameRefList& target)
7336 GctNameRefListNode* targ = target.P;
7337 if (targ == &NilGctNameRefListNode)
7338 return GctNameRefList(targ);
7340 GctNameRefListNode* p = P;
7341 while (p != &NilGctNameRefListNode)
7343 if (p->hd == targ->hd)
7345 GctNameRefListNode* a = p->tl;
7346 GctNameRefListNode* t = targ->tl;
7349 if (t == &NilGctNameRefListNode)
7352 return GctNameRefList(p);
7354 else if (a == &NilGctNameRefListNode || !(a->hd == t->hd))
7365 return GctNameRefList(&NilGctNameRefListNode);
7368 int GctNameRefList::contains(GctNameRefList& target) const
7370 GctNameRefListNode* targ = target.P;
7371 if (targ == &NilGctNameRefListNode)
7374 GctNameRefListNode* p = P;
7375 while (p != &NilGctNameRefListNode)
7377 if (p->hd == targ->hd)
7379 GctNameRefListNode* a = p->tl;
7380 GctNameRefListNode* t = targ->tl;
7383 if (t == &NilGctNameRefListNode)
7385 else if (a == &NilGctNameRefListNode || !(a->hd == t->hd))
7399 void GctNameRefList::del(GctNameRef& targ)
7401 GctNameRefListNode* h = P;
7405 if (h == &NilGctNameRefListNode)
7410 else if (h->hd == targ)
7412 GctNameRefListNode* nxt = h->tl;
7421 GctNameRefListNode* trail = h;
7422 GctNameRefListNode* p = h->tl;
7423 while (p != &NilGctNameRefListNode)
7427 GctNameRefListNode* nxt = p->tl;
7442 void GctNameRefList::del(GctNameRefPredicate f)
7444 GctNameRefListNode* h = P;
7447 if (h == &NilGctNameRefListNode)
7452 else if ((*f)(h->hd))
7454 GctNameRefListNode* nxt = h->tl;
7463 GctNameRefListNode* trail = h;
7464 GctNameRefListNode* p = h->tl;
7465 while (p != &NilGctNameRefListNode)
7469 GctNameRefListNode* nxt = p->tl;
7484 void GctNameRefList::select(GctNameRefPredicate f)
7486 GctNameRefListNode* h = P;
7489 if (h == &NilGctNameRefListNode)
7494 else if (!(*f)(h->hd))
7496 GctNameRefListNode* nxt = h->tl;
7504 GctNameRefListNode* trail = h;
7505 GctNameRefListNode* p = h->tl;
7506 while (p != &NilGctNameRefListNode)
7510 GctNameRefListNode* nxt = p->tl;
7525 void GctNameRefList::reverse()
7527 GctNameRefListNode* l = &NilGctNameRefListNode;
7528 GctNameRefListNode* p = P;
7529 while (p != &NilGctNameRefListNode)
7531 GctNameRefListNode* nxt = p->tl;
7540 GctNameRefList copy(GctNameRefList& x)
7542 GctNameRefListNode* a = x.P;
7543 if (a == &NilGctNameRefListNode)
7544 return GctNameRefList(a);
7547 GctNameRefListNode* h = newGctNameRefListNode(a->hd);
7548 GctNameRefListNode* trail = h;
7549 for(a = a->tl; a != &NilGctNameRefListNode; a = a->tl)
7551 GctNameRefListNode* n = newGctNameRefListNode(a->hd);
7555 trail->tl = &NilGctNameRefListNode;
7556 return GctNameRefList(h);
7561 GctNameRefList subst(GctNameRef& old, GctNameRef& repl, GctNameRefList& x)
7563 GctNameRefListNode* a = x.P;
7564 if (a == &NilGctNameRefListNode)
7565 return GctNameRefList(a);
7568 GctNameRefListNode* h = new GctNameRefListNode;
7574 GctNameRefListNode* trail = h;
7575 for(a = a->tl; a != &NilGctNameRefListNode; a = a->tl)
7577 GctNameRefListNode* n = new GctNameRefListNode;
7586 trail->tl = &NilGctNameRefListNode;
7587 return GctNameRefList(h);
7591 GctNameRefList combine(GctNameRefCombiner f, GctNameRefList& x, GctNameRefList& y)
7593 GctNameRefListNode* a = x.P;
7594 GctNameRefListNode* b = y.P;
7595 if (a == &NilGctNameRefListNode || b == &NilGctNameRefListNode)
7596 return GctNameRefList(&NilGctNameRefListNode);
7599 GctNameRefListNode* h = newGctNameRefListNode((*f)(a->hd, b->hd));
7600 GctNameRefListNode* trail = h;
7603 while (a != &NilGctNameRefListNode && b != &NilGctNameRefListNode)
7605 GctNameRefListNode* n = newGctNameRefListNode((*f)(a->hd, b->hd));
7611 trail->tl = &NilGctNameRefListNode;
7612 return GctNameRefList(h);
7616 GctNameRefList reverse(GctNameRefList& x)
7618 GctNameRefListNode* a = x.P;
7619 if (a == &NilGctNameRefListNode)
7620 return GctNameRefList(a);
7623 GctNameRefListNode* l = newGctNameRefListNode(a->hd);
7624 l->tl = &NilGctNameRefListNode;
7625 for(a = a->tl; a != &NilGctNameRefListNode; a = a->tl)
7627 GctNameRefListNode* n = newGctNameRefListNode(a->hd);
7631 return GctNameRefList(l);
7635 GctNameRefList append(GctNameRefList& x, GctNameRefList& y)
7637 GctNameRefListNode* a = x.P;
7638 GctNameRefListNode* b = y.P;
7640 if (a != &NilGctNameRefListNode)
7642 GctNameRefListNode* h = newGctNameRefListNode(a->hd);
7643 GctNameRefListNode* trail = h;
7644 for(a = a->tl; a != &NilGctNameRefListNode; a = a->tl)
7646 GctNameRefListNode* n = newGctNameRefListNode(a->hd);
7651 return GctNameRefList(h);
7654 return GctNameRefList(b);
7657 void GctNameRefList::prepend(GctNameRefList& y)
7659 GctNameRefListNode* b = y.P;
7660 if (b != &NilGctNameRefListNode)
7662 GctNameRefListNode* h = newGctNameRefListNode(b->hd);
7663 GctNameRefListNode* trail = h;
7664 for(b = b->tl; b != &NilGctNameRefListNode; b = b->tl)
7666 GctNameRefListNode* n = newGctNameRefListNode(b->hd);
7675 GctNameRefList concat(GctNameRefList& x, GctNameRefList& y)
7677 GctNameRefListNode* a = x.P;
7678 GctNameRefListNode* b = y.P;
7679 if (a != &NilGctNameRefListNode)
7681 GctNameRefListNode* h = newGctNameRefListNode(a->hd);
7682 GctNameRefListNode* trail = h;
7683 for(a = a->tl; a != &NilGctNameRefListNode; a = a->tl)
7685 GctNameRefListNode* n = newGctNameRefListNode(a->hd);
7689 for(;b != &NilGctNameRefListNode; b = b->tl)
7691 GctNameRefListNode* n = newGctNameRefListNode(b->hd);
7695 trail->tl = &NilGctNameRefListNode;
7696 return GctNameRefList(h);
7698 else if (b != &NilGctNameRefListNode)
7700 GctNameRefListNode* h = newGctNameRefListNode(b->hd);
7701 GctNameRefListNode* trail = h;
7702 for(b = b->tl; b != &NilGctNameRefListNode; b = b->tl)
7704 GctNameRefListNode* n = newGctNameRefListNode(b->hd);
7708 trail->tl = &NilGctNameRefListNode;
7709 return GctNameRefList(h);
7712 return GctNameRefList(&NilGctNameRefListNode);
7715 GctNameRefList select(GctNameRefPredicate f, GctNameRefList& x)
7717 GctNameRefListNode* a = x.P;
7718 GctNameRefListNode* h = &NilGctNameRefListNode;
7719 while (a != &NilGctNameRefListNode)
7723 h = newGctNameRefListNode(a->hd);
7724 GctNameRefListNode* trail = h;
7725 for(a = a->tl; a != &NilGctNameRefListNode; a = a->tl)
7729 GctNameRefListNode* n = newGctNameRefListNode(a->hd);
7734 trail->tl = &NilGctNameRefListNode;
7740 return GctNameRefList(h);
7743 GctNameRefList remove(GctNameRefPredicate f, GctNameRefList& x)
7745 GctNameRefListNode* a = x.P;
7746 GctNameRefListNode* h = &NilGctNameRefListNode;
7747 while (a != &NilGctNameRefListNode)
7751 h = newGctNameRefListNode(a->hd);
7752 GctNameRefListNode* trail = h;
7753 for(a = a->tl; a != &NilGctNameRefListNode; a = a->tl)
7757 GctNameRefListNode* n = newGctNameRefListNode(a->hd);
7762 trail->tl = &NilGctNameRefListNode;
7768 return GctNameRefList(h);
7771 GctNameRefList remove(GctNameRef& targ, GctNameRefList& x)
7773 GctNameRefListNode* a = x.P;
7774 GctNameRefListNode* h = &NilGctNameRefListNode;
7775 while (a != &NilGctNameRefListNode)
7777 if (!(a->hd == targ))
7779 h = newGctNameRefListNode(a->hd);
7780 GctNameRefListNode* trail = h;
7781 for(a = a->tl; a != &NilGctNameRefListNode; a = a->tl)
7783 if (!(a->hd == targ))
7785 GctNameRefListNode* n = newGctNameRefListNode(a->hd);
7790 trail->tl = &NilGctNameRefListNode;
7796 return GctNameRefList(h);
7799 GctNameRefList map(GctNameRefMapper f, GctNameRefList& x)
7801 GctNameRefListNode* a = x.P;
7802 GctNameRefListNode* h = &NilGctNameRefListNode;
7803 if (a != &NilGctNameRefListNode)
7805 h = newGctNameRefListNode((*f)(a->hd));
7806 GctNameRefListNode* trail = h;
7807 for(a = a->tl; a != &NilGctNameRefListNode; a = a->tl)
7809 GctNameRefListNode* n = newGctNameRefListNode((*f)(a->hd));
7813 trail->tl = &NilGctNameRefListNode;
7815 return GctNameRefList(h);
7819 GctNameRefList merge(GctNameRefList& x, GctNameRefList& y, GctNameRefComparator f)
7821 GctNameRefListNode* a = x.P;
7822 GctNameRefListNode* b = y.P;
7824 if (a == &NilGctNameRefListNode)
7826 if (b == &NilGctNameRefListNode)
7827 return GctNameRefList(&NilGctNameRefListNode);
7831 else if (b == &NilGctNameRefListNode)
7834 GctNameRefListNode* h = new GctNameRefListNode;
7836 if ((*f)(a->hd, b->hd) <= 0)
7847 GctNameRefListNode* r = h;
7851 if (a == &NilGctNameRefListNode)
7853 while (b != &NilGctNameRefListNode)
7855 GctNameRefListNode* n = new GctNameRefListNode;
7862 r->tl = &NilGctNameRefListNode;
7863 return GctNameRefList(h);
7865 else if (b == &NilGctNameRefListNode)
7867 while (a != &NilGctNameRefListNode)
7869 GctNameRefListNode* n = new GctNameRefListNode;
7876 r->tl = &NilGctNameRefListNode;
7877 return GctNameRefList(h);
7879 else if ((*f)(a->hd, b->hd) <= 0)
7881 GctNameRefListNode* n = new GctNameRefListNode;
7890 GctNameRefListNode* n = new GctNameRefListNode;
7900 void GctNameRefList::sort(GctNameRefComparator f)
7902 // strategy: place runs in queue, merge runs until done
7903 // This is often very fast
7905 if (P == &NilGctNameRefListNode || P->tl == &NilGctNameRefListNode)
7908 int qlen = 250; // guess a good queue size, realloc if necessary
7910 GctNameRefListNode** queue = (GctNameRefListNode**)malloc(qlen * sizeof(GctNameRefListNode*));
7912 GctNameRefListNode* h = P;
7913 GctNameRefListNode* a = h;
7914 GctNameRefListNode* b = a->tl;
7917 while (b != &NilGctNameRefListNode)
7919 if ((*f)(a->hd, b->hd) > 0)
7921 if (h == a) // minor optimization: ensure runlen >= 2
7933 queue = (GctNameRefListNode**)realloc(queue, qlen * sizeof(GctNameRefListNode*));
7936 a->tl = &NilGctNameRefListNode;
7950 if (++qin >= qlen) qin = 0;
7956 if (++qout >= qlen) qout = 0;
7958 if (++qout >= qlen) qout = 0;
7960 if ((*f)(a->hd, b->hd) <= 0)
7971 if (++qin >= qlen) qin = 0;
7975 if (a == &NilGctNameRefListNode)
7980 else if (b == &NilGctNameRefListNode)
7985 else if ((*f)(a->hd, b->hd) <= 0)
8003 int GctNameRefList::list_length()
8005 GctNameRefListNode* fast = P;
8006 if (fast == &NilGctNameRefListNode)
8009 GctNameRefListNode* slow = fast->tl;
8010 if (slow == &NilGctNameRefListNode)
8018 if (fast == &NilGctNameRefListNode)
8020 else if (fast->tl == &NilGctNameRefListNode)
8022 else if (fast == slow)
8027 fast = fast->tl->tl;
8033 void GctNameRefList::error(const char* msg) const
8035 (*lib_error_handler)("List", msg);
8038 int GctNameRefList::OK() const
8040 int v = P != 0; // have a node
8041 // check that all nodes OK, even if circular:
8043 GctNameRefListNode* fast = P;
8044 if (fast != &NilGctNameRefListNode)
8046 v &= fast->ref != 0;
8047 GctNameRefListNode* slow = fast->tl;
8048 v &= slow->ref != 0;
8049 if (v && slow != &NilGctNameRefListNode)
8052 v &= fast->ref != 0;
8055 if (fast == &NilGctNameRefListNode)
8057 else if (fast->tl == &NilGctNameRefListNode)
8059 else if (fast == slow)
8063 v &= fast->ref != 0 && slow->ref != 0;
8064 fast = fast->tl->tl;
8070 if (!v) error ("invariant failure");