grunwald@M.CS.UIUC.EDU (Dirk Grunwald) (03/22/89)
The program appended causes 1.34.1 to dump core, both on an Encore multimax
and a Sun-3/60. Both were derived from the same sources, which is mainly
1.34.1 with patches from MDT for a couple of bugs.
I suspect that this has something to do with me saying
``operator Load * new(long)''
in the class decl. (inserted text in wrong spot). Changing this makes
things work.
Here's a backtrace & source file.
(gdb) run
Starting program: /ug/lib/gcc-c++ -fstrength-reduce DIE.cc -opt -version -o /dev/null
GNU C++ version 1.34.1 (32000, Encore syntax) compiled by GNU C version 1.34.
abs (double); abs (long int); sign (long int); sign (double); sqr (long int); sqr (double); even (long int); odd (long int); lcm (long int, long int); setbit (long int &, long int); clearbit (long int &, long int); testbit (long int, long int); File::filedesc (); File::name (); File::iocount (); File::readable (); File::writable (); File::is_open (); File::clear (enum state_value (= 0 )); File::raw (); File::check_state (); File::failif (int); File::get (char &); File::put (char); File::unget (char); File
::putback (char); File::read (void *, int, int); File::write (void *, int, int); File::flush (); File::seek (long int, int (= 0 )); File::tell (); File::rdstate (); File::operator void *(); File::eof (); File::fail (); File::bad (); File::good (); ostream::operator void *(); ostream::operator << (char); istream::operator void *(); istream::_flush (); istream::operator >> (char &); Awesime::Awesime (enum bool (= 0 )); Awesime::Awesime (const int); operator << (struct ostre!
am &, const struct Awesime &); Spi
nLock::SpinLock (); SpinLock::SpinLock (const int); SpinLock::reserve (); SpinLock::release (); SpinLock::count ();
At top level:
../Src/Load.h:17: parse error before `('
../Src/Load.h:18: parse error before `('
Load::timeStamp ();
Program received signal 11, Segmentation fault
0x30de1 in dfs_pushdecls ()
(gdb) where
#0 0x30de1 in dfs_pushdecls ()
#1 0x3087b in dfs_walk ()
#2 0x30e7c in push_class_decls ()
#3 0x24dab in pushclass ()
#4 0x130ba in start_function (5607348, 5611552, 0)
#5 0x7cb6 in yyparse ()
#6 0x33041 in compile_file ()
#7 0x34451 in main (7, -5048, -5016)
(gdb) Continuing.
-------DIE.cc------
# 1 "../Src/Load.cc"
# 1 "../Src/Load.h"
# 1 "/ug/include/Awe2onemax/Awesime.h"
# 1 "/ug/lib/g++-include/stream.h"
# 1 "/ug/lib/g++-include/File.h"
# 1 "/ug/lib/g++-include/builtin.h"
overload clearbit;
overload dec;
overload even;
overload gcd;
overload hex;
overload lcm;
overload lg;
overload oct;
overload odd;
overload setbit;
overload sign;
overload sqr;
overload testbit;
# 1 "/ug/lib/g++-include/std.h"
overload abs;
extern void _exit (int) asm ("_" "_exit") ;
extern void abort () asm ("_" "abort") ;
extern int abs (int) asm ("_" "abs") ;
extern int access (const char*, int) asm ("_" "access") ;
extern int acct (const char*) asm ("_" "acct") ;
extern unsigned alarm (unsigned) asm ("_" "alarm") ;
extern void* alloca (int) asm ("_" "alloca") ;
extern double atof (const char*) asm ("_" "atof") ;
extern int atoi (const char*) asm ("_" "atoi") ;
extern long atol (const char*) asm ("_" "atol") ;
extern int bcmp (const void*, const void*, int) asm ("_" "bcmp") ;
extern void bcopy (const void*, void*, int) asm ("_" "bcopy") ;
extern void* brk (void*) asm ("_" "brk") ;
extern void bzero (void*, int) asm ("_" "bzero") ;
extern void* calloc (unsigned, unsigned) asm ("_" "calloc") ;
extern void cfree (void*) asm ("_" "cfree") ;
extern int chdir (const char*) asm ("_" "chdir") ;
extern int chmod (const char*, int) asm ("_" "chmod") ;
extern int chown (const char*, int, int) asm ("_" "chown") ;
extern long clock () asm ("_" "clock") ;
extern int close (int) asm ("_" "close") ;
extern int creat (const char*, int) asm ("_" "creat") ;
extern char* crypt (const char*, const char*) asm ("_" "crypt") ;
extern char* ctermid (char*) asm ("_" "ctermid") ;
extern char* cuserid (char*) asm ("_" "cuserid") ;
extern double drand48 () asm ("_" "drand48") ;
extern int dup (int) asm ("_" "dup") ;
extern int dup2 (int, int) asm ("_" "dup2") ;
extern int dysize (int) asm ("_" "dysize") ;
extern char* ecvt (double, int, int*, int*) asm ("_" "ecvt") ;
extern char* encrypt (char*, int) asm ("_" "encrypt") ;
extern double erand (short*) asm ("_" "erand") ;
extern int execl (const char*, const char *, ...) asm ("_" "execl") ;
extern int execle (const char*, const char *, ...) asm ("_" "execle") ;
extern int execlp (const char*, const char*, ...) asm ("_" "execlp") ;
extern int exect (const char*, const char**, char**) asm ("_" "exect") ;
extern int execv (const char*, const char**) asm ("_" "execv") ;
extern int execve (const char*, const char**, char**) asm ("_" "execve") ;
extern int execvp (const char*, const char**) asm ("_" "execvp") ;
extern void exit (int) asm ("_" "exit") ;
extern int fchmod (int, int) asm ("_" "fchmod") ;
extern int fchown (int, int, int) asm ("_" "fchown") ;
extern int fcntl (int, int, int) asm ("_" "fcntl") ;
extern char* fcvt (double, int, int*, int*) asm ("_" "fcvt") ;
extern int ffs (int) asm ("_" "ffs") ;
extern int flock (int, int) asm ("_" "flock") ;
extern int fork () asm ("_" "fork") ;
extern void free (void*) asm ("_" "free") ;
extern int fsync (int) asm ("_" "fsync") ;
extern long ftok (const char*, int) asm ("_" "ftok") ;
extern int ftruncate (int, unsigned long) asm ("_" "ftruncate") ;
extern char* gcvt (double, int, char*) asm ("_" "gcvt") ;
extern char* getcwd (char*, int) asm ("_" "getcwd") ;
extern int getdomainname (char*, int) asm ("_" "getdomainname") ;
extern int getdtablesize () asm ("_" "getdtablesize") ;
extern int getegid () asm ("_" "getegid") ;
extern char* getenv (const char*) asm ("_" "getenv") ;
extern int geteuid () asm ("_" "geteuid") ;
extern int getgid () asm ("_" "getgid") ;
extern int getgroups (int, int*) asm ("_" "getgroups") ;
extern long gethostid () asm ("_" "gethostid") ;
extern int gethostname (char*, int) asm ("_" "gethostname") ;
extern char* getlogin () asm ("_" "getlogin") ;
extern int getopt (int, char**, char*) asm ("_" "getopt") ;
extern int getpagesize () asm ("_" "getpagesize") ;
extern char* getpass (const char*) asm ("_" "getpass") ;
extern int getpgrp () asm ("_" "getpgrp") ;
extern int getpid () asm ("_" "getpid") ;
extern int getppid () asm ("_" "getppid") ;
extern int getpriority (int, int) asm ("_" "getpriority") ;
extern int getpw (int, char*) asm ("_" "getpw") ;
extern unsigned getuid () asm ("_" "getuid") ;
extern char* getwd (const char*) asm ("_" "getwd") ;
extern char* index (const char*, int) asm ("_" "index") ;
extern char* initstate (unsigned, char*, int) asm ("_" "initstate") ;
extern int ioctl (int, int, char*) asm ("_" "ioctl") ;
extern int isatty (int) asm ("_" "isatty") ;
extern long jrand48 (short*) asm ("_" "jrand48") ;
extern int kill (int, int) asm ("_" "kill") ;
extern int killpg (int, int) asm ("_" "killpg") ;
extern void lcong48 (short*) asm ("_" "lcong48") ;
extern int link (const char*, const char*) asm ("_" "link") ;
extern int lock (int, int, long) asm ("_" "lock") ;
extern long lrand48 () asm ("_" "lrand48") ;
extern long lseek (int, long, int) asm ("_" "lseek") ;
extern void* malloc (unsigned) asm ("_" "malloc") ;
extern void* memalign (unsigned, unsigned) asm ("_" "memalign") ;
extern void* memccpy (void*, const void*, int, int) asm ("_" "memccpy") ;
extern void* memchr (const void*, int, int) asm ("_" "memchr") ;
extern int memcmp (const void*, const void*, int) asm ("_" "memcmp") ;
extern void* memcpy (void*, const void*, int) asm ("_" "memcpy") ;
extern void* memset (void*, int, int) asm ("_" "memset") ;
extern int mkdir (const char*, int) asm ("_" "mkdir") ;
extern int mknod (const char*, int, int) asm ("_" "mknod") ;
extern int mkstemp (char*) asm ("_" "mkstemp") ;
extern char* mktemp (char*) asm ("_" "mktemp") ;
extern long mrand48 () asm ("_" "mrand48") ;
extern int nice (int) asm ("_" "nice") ;
extern long nrand48 (short*) asm ("_" "nrand48") ;
extern int open (const char*, int, ...) asm ("_" "open") ;
extern void pause () asm ("_" "pause") ;
extern void perror (const char*) asm ("_" "perror") ;
extern int pipe (int*) asm ("_" "pipe") ;
extern void profil (char*, int, int, int) asm ("_" "profil") ;
extern int psignal (unsigned, char*) asm ("_" "psignal") ;
extern int ptrace (int, int, int, int) asm ("_" "ptrace") ;
extern int putenv (const char*) asm ("_" "putenv") ;
extern int rand () asm ("_" "rand") ;
extern long random () asm ("_" "random") ;
extern int read (int, void*, unsigned) asm ("_" "read") ;
extern int readlink (const char*, char*, int) asm ("_" "readlink") ;
extern void* realloc (void*, unsigned) asm ("_" "realloc") ;
extern int rename (const char*, const char*) asm ("_" "rename") ;
extern char* rindex (const char*, int) asm ("_" "rindex") ;
extern int rmdir (const char*) asm ("_" "rmdir") ;
extern void* sbrk (int) asm ("_" "sbrk") ;
extern short* seed48 (short*) asm ("_" "seed48") ;
extern int send (int, char*, int, int) asm ("_" "send") ;
extern int setgid (int) asm ("_" "setgid") ;
extern int sethostname (char*, int) asm ("_" "sethostname") ;
extern int setkey (const char*) asm ("_" "setkey") ;
extern int setpgrp (int, int) asm ("_" "setpgrp") ;
extern int setpriority (int, int, int) asm ("_" "setpriority") ;
extern int setregid (int, int) asm ("_" "setregid") ;
extern int setreuid (int, int) asm ("_" "setreuid") ;
extern char* setstate (char*) asm ("_" "setstate") ;
extern int setuid (int) asm ("_" "setuid") ;
extern int sigblock (int) asm ("_" "sigblock") ;
extern int siginterrupt (int, int) asm ("_" "siginterrupt") ;
extern int sigpause (int) asm ("_" "sigpause") ;
extern int sigsetmask (int) asm ("_" "sigsetmask") ;
extern unsigned sleep (unsigned) asm ("_" "sleep") ;
extern int srand (int) asm ("_" "srand") ;
extern void srand48 (long) asm ("_" "srand48") ;
extern void srandom (int) asm ("_" "srandom") ;
extern int stime (long*) asm ("_" "stime") ;
extern char* strcat (char*, const char*) asm ("_" "strcat") ;
extern char* strchr (const char*, int) asm ("_" "strchr") ;
extern int strcmp (const char*, const char*) asm ("_" "strcmp") ;
extern char* strcpy (char*, const char*) asm ("_" "strcpy") ;
extern int strcspn (const char*, const char*) asm ("_" "strcspn") ;
extern char* strdup (const char*) asm ("_" "strdup") ;
extern int strlen (const char*) asm ("_" "strlen") ;
extern char* strncat (char*, const char*, int) asm ("_" "strncat") ;
extern int strncmp (const char*, const char*, int) asm ("_" "strncmp") ;
extern char* strncpy (char*, const char*, int) asm ("_" "strncpy") ;
extern char* strpbrk (const char*, const char*) asm ("_" "strpbrk") ;
extern char* strrchr (const char*, int) asm ("_" "strrchr") ;
extern int strspn (const char*, const char*) asm ("_" "strspn") ;
extern double strtod (const char*, char**) asm ("_" "strtod") ;
extern char* strtok (char*, const char*) asm ("_" "strtok") ;
extern long strtol (const char*, char**, int) asm ("_" "strtol") ;
extern void swab (void*, void*, int) asm ("_" "swab") ;
extern int symlink (const char*, const char*) asm ("_" "symlink") ;
extern int syscall (int, ...) asm ("_" "syscall") ;
extern int system (const char*) asm ("_" "system") ;
extern char* tempnam (char*, char*) asm ("_" "tempnam") ;
extern int tgetent (char*, char*) asm ("_" "tgetent") ;
extern int tgetnum (char*) asm ("_" "tgetnum") ;
extern int tgetflag (char*) asm ("_" "tgetflag") ;
extern char* tgetstr (char *, char **) asm ("_" "tgetstr") ;
extern char* tgoto (char*, int, int) asm ("_" "tgoto") ;
extern long time (long*) asm ("_" "time") ;
extern char* tmpnam (char*) asm ("_" "tmpnam") ;
extern int truncate (const char*, unsigned long) asm ("_" "truncate") ;
extern char* ttyname (int) asm ("_" "ttyname") ;
extern int ttyslot () asm ("_" "ttyslot") ;
extern unsigned ualarm (unsigned, unsigned) asm ("_" "ualarm") ;
extern long ulimit (int, long) asm ("_" "ulimit") ;
extern int umask (int) asm ("_" "umask") ;
extern int unlink (const char*) asm ("_" "unlink") ;
extern unsigned usleep (unsigned) asm ("_" "usleep") ;
extern int vadvise (int) asm ("_" "vadvise") ;
extern void* valloc (unsigned) asm ("_" "valloc") ;
extern int vfork () asm ("_" "vfork") ;
extern int vhangup () asm ("_" "vhangup") ;
extern int wait (int*) asm ("_" "wait") ;
extern int write (int, const void*, unsigned) asm ("_" "write") ;
extern char** environ;
extern int errno;
extern char* sys_errlist[];
extern int sys_nerr;
extern char* optarg;
extern int opterr;
extern int optind;
# 48 "/ug/lib/g++-include/builtin.h"
# 1 "/ug/lib/g++-include/stddef.h"
enum bool
{
FALSE = 0,
TRUE = 1
};
typedef void (*one_arg_error_handler_t)(const char*);
typedef void (*two_arg_error_handler_t)(const char*, const char*);
# 49 "/ug/lib/g++-include/builtin.h"
# 1 "/ug/lib/g++-include/math.h"
overload acos;
overload acosh;
overload asin;
overload asinh;
overload atan2;
overload atanh;
overload ceil;
overload cos;
overload cosh;
overload exp;
overload floor;
overload gamma;
overload hypot;
overload log;
overload log10;
overload pow;
overload sin;
overload sinh;
overload sqrt;
overload tan;
overload tanh;
extern double acos (double) asm ("_" "acos") ;
extern double acosh (double) asm ("_" "acosh") ;
extern double asin (double) asm ("_" "asin") ;
extern double asinh (double) asm ("_" "asinh") ;
extern double atan (double) asm ("_" "atan") ;
extern double atan2 (double, double) asm ("_" "atan2") ;
extern double atanh (double) asm ("_" "atanh") ;
extern double cbrt (double) asm ("_" "cbrt") ;
extern double ceil (double) asm ("_" "ceil") ;
extern double copysign (double,double) asm ("_" "copysign") ;
extern double cos (double) asm ("_" "cos") ;
extern double cosh (double) asm ("_" "cosh") ;
extern double drem (double,double) asm ("_" "drem") ;
extern double erf (double) asm ("_" "erf") ;
extern double erfc (double) asm ("_" "erfc") ;
extern double exp (double) asm ("_" "exp") ;
extern double expm1 (double) asm ("_" "expm1") ;
extern double fabs (double) asm ("_" "fabs") ;
extern double finite (double) asm ("_" "finite") ;
extern double floor (double) asm ("_" "floor") ;
extern double frexp (double, int*) asm ("_" "frexp") ;
extern double gamma (double) asm ("_" "gamma") ;
extern double hypot (double,double) asm ("_" "hypot") ;
extern double infnan (int) asm ("_" "infnan") ;
extern int isinf (double) asm ("_" "isinf") ;
extern int isnan (double) asm ("_" "isnan") ;
extern double j0 (double) asm ("_" "j0") ;
extern double j1 (double) asm ("_" "j1") ;
extern double jn (int, double) asm ("_" "jn") ;
extern double ldexp (double, int) asm ("_" "ldexp") ;
extern double lgamma (double) asm ("_" "lgamma") ;
extern double log (double) asm ("_" "log") ;
extern double log10 (double) asm ("_" "log10") ;
extern double log1p (double) asm ("_" "log1p") ;
extern double logb (double) asm ("_" "logb") ;
extern double modf (double, double*) asm ("_" "modf") ;
extern double pow (double, double) asm ("_" "pow") ;
extern double rint (double) asm ("_" "rint") ;
extern double scalb (double, int) asm ("_" "scalb") ;
extern double sin (double) asm ("_" "sin") ;
extern double sinh (double) asm ("_" "sinh") ;
extern double sqrt (double) asm ("_" "sqrt") ;
extern double tan (double) asm ("_" "tan") ;
extern double tanh (double) asm ("_" "tanh") ;
extern double y0 (double) asm ("_" "y0") ;
extern double y1 (double) asm ("_" "y1") ;
extern double yn (int, double) asm ("_" "yn") ;
struct exception
{
int type;
char* name;
double arg1, arg2, retval;
};
int matherr(exception*);
# 1 "/ug/lib/g++-include/values.h"
# 66 "/ug/lib/g++-include/values.h"
# 111 "/ug/lib/g++-include/values.h"
# 126 "/ug/lib/g++-include/math.h"
# 50 "/ug/lib/g++-include/builtin.h"
long abs(long);
double abs(double);
void clearbit(long&, long);
void setbit(long&, long);
int testbit(long, long);
int even(long);
long gcd(long, long);
long lg(long);
long lcm(long, long);
int odd(long);
double pow(double, long);
long pow(long, long);
int sign(long);
int sign(double);
long sqr(long);
double sqr(double);
long sqrt(long);
double start_timer();
double return_elapsed_time(double);
char* itoa(long x, int base = 10, int width = 0);
char* hex(long x, int width = 0);
char* oct(long x, int width = 0);
char* dec(long x, int width = 0);
char* form(const char* fmt ...);
unsigned int hashpjw(const char*);
unsigned int multiplicativehash(int);
unsigned int foldhash(double);
extern void default_one_arg_error_handler(const char*);
extern void default_two_arg_error_handler(const char*, const char*);
extern two_arg_error_handler_t lib_error_handler;
extern two_arg_error_handler_t
set_lib_error_handler(two_arg_error_handler_t f);
inline double abs(double _arg)
{
return (_arg < 0.0)? -_arg : _arg;
}
inline long abs(long _arg)
{
return (_arg < 0)? -_arg : _arg;
}
inline int sign(long _arg)
{
return (_arg == 0) ? 0 : ( (_arg > 0) ? 1 : -1 );
}
inline int sign(double _arg)
{
return (_arg == 0.0) ? 0 : ( (_arg > 0.0) ? 1 : -1 );
}
inline long sqr(long _arg)
{
return _arg * _arg;
}
inline double sqr(double _arg)
{
return _arg * _arg;
}
inline int even(long _arg)
{
return !(_arg & 1);
}
inline int odd(long _arg)
{
return (_arg & 1);
}
inline long lcm(long _x, long _y)
{
return _x / gcd(_x, _y) * _y;
}
inline void setbit(long& _x, long _b)
{
_x |= (1 << _b);
}
inline void clearbit(long& _x, long _b)
{
_x &= ~(1 << _b);
}
inline int testbit(long _x, long _b)
{
return ((_x & (1 << _b)) != 0);
}
# 27 "/ug/lib/g++-include/File.h"
# 1 "/ug/lib/g++-include/stdio.h"
extern struct _iobuf {
int _cnt;
char* _ptr;
char* _base;
int _bufsiz;
short _flag;
char _file;
} _iob[];
extern int _doprnt(const char*, void*, struct _iobuf *);
extern int _doscan( struct _iobuf *, const char*, void*);
extern int _filbuf( struct _iobuf *);
extern int _flsbuf(unsigned, struct _iobuf *);
extern int fclose( struct _iobuf *);
extern struct _iobuf * fdopen(int, const char*);
extern int fflush( struct _iobuf *);
extern int fgetc( struct _iobuf *);
extern char* fgets(char*, int, struct _iobuf *);
extern struct _iobuf * fopen(const char*, const char*);
extern int fprintf( struct _iobuf *, const char* ...);
extern int fputc(int, struct _iobuf *);
extern int fputs(const char*, struct _iobuf *);
extern int fread(void*, int, int, struct _iobuf *);
extern struct _iobuf * freopen(const char*, const char*, struct _iobuf *);
extern int fscanf( struct _iobuf *, const char* ...);
extern int fseek( struct _iobuf *, long, int);
extern long ftell( struct _iobuf *);
extern int fwrite(const void*, int, int, struct _iobuf *);
extern char* gets(char*);
extern int getw( struct _iobuf *);
extern int pclose( struct _iobuf *);
extern struct _iobuf * popen(const char*, const char*);
extern int printf(const char* ...);
extern void puts(const char*);
extern int putw(int, struct _iobuf *);
extern int scanf(const char* ...);
extern void setbuf( struct _iobuf *, char*);
extern void setbuffer( struct _iobuf *, char*, int);
extern void setlinebuf( struct _iobuf *);
extern void setvbuf( struct _iobuf *, char*, int, int);
extern int sscanf(char*, const char* ...);
extern struct _iobuf * tmpfile();
extern int ungetc(int, struct _iobuf *);
extern int vfprintf( struct _iobuf *, const char*, void* ap);
extern int vprintf(const char*, void* ap);
extern int vsprintf(char*, const char*, void* ap);
extern int sprintf(char*, const char* ...);
# 28 "/ug/lib/g++-include/File.h"
# 1 "/ug/lib/g++-include/stddef.h"
# 59 "/ug/lib/g++-include/stddef.h"
# 29 "/ug/lib/g++-include/File.h"
enum io_mode
{
io_readonly = 0,
io_writeonly = 1,
io_readwrite = 2,
io_appendonly = 3,
io_append = 4,
};
enum access_mode
{
a_createonly = 0,
a_create = 1,
a_useonly = 2,
a_use = 3,
};
enum state_value
{
_good = 0,
_eof = 1,
_fail = 2,
_bad = 4
};
class File
{
protected:
struct _iobuf * fp;
char* nm;
char rw;
state_value state;
long stat;
void initialize();
void reinitialize(const char*);
public:
File();
File(const char* filename, io_mode m, access_mode a);
File(const char* filename, const char* m);
File(int filedesc, io_mode m);
File( struct _iobuf * fileptr);
File(int sz, char* buf, io_mode m);
~File();
File& open(const char* filename, io_mode m, access_mode a);
File& open(const char* filename, const char* m);
File& open(int filedesc, io_mode m);
File& open( struct _iobuf * fileptr);
File& close();
File& remove();
int filedesc();
const char* name();
void setname(const char* newname);
int iocount();
int rdstate();
int eof();
int fail();
int bad();
int good();
int readable();
int writable();
int is_open();
void* operator void*();
void error();
void clear(state_value f = 0);
File& failif(int cond);
void check_state();
File& get(char& c);
File& put(char c);
File& unget(char c);
File& putback(char c);
File& put(const char* s);
File& get (char* s, int n, char terminator = '\n');
File& getline(char* s, int n, char terminator = '\n');
File& read(void* x, int sz, int n);
File& write(void* x, int sz, int n);
File& seek(long pos, int seek_mode=0);
long tell();
File& flush();
File& setbuf(int buffer_kind);
File& setbuf(int size, char* buf);
File& raw();
};
extern void verbose_File_error_handler(char*);
extern void quiet_File_error_handler(char*);
extern void fatal_File_error_handler(char*);
extern one_arg_error_handler_t File_error_handler;
extern one_arg_error_handler_t set_File_error_handler(one_arg_error_handler_t);
inline int File::filedesc()
{
return ((fp)->_file) ;
}
inline const char* File::name()
{
return nm;
}
inline int File::iocount()
{
return stat;
}
inline int File::readable()
{
if (fp != 0) { if ( (((fp)->_flag& 00020 )!=0) ) state |= _eof; if ( (((fp)->_flag& 00040 )!=0) ) state |= _bad;}
return (state == _good && (rw & 01));
}
inline int File::writable()
{
if (fp != 0 && (((fp)->_flag& 00040 )!=0) ) state |= _bad;
return ((state & (_fail|_bad)) == 0 && (rw & 02));
}
inline int File::is_open()
{
return (fp != 0);
}
inline void File::clear(state_value flag = 0)
{
state = flag;
}
inline File& File::raw()
{
return File::setbuf( 00004 );
}
inline void File::check_state()
{
if (fp != 0)
{
if ( (((fp)->_flag& 00020 )!=0) )
state |= _eof;
else
state &= ~_eof;
if ( (((fp)->_flag& 00040 )!=0) )
state |= _bad;
}
}
inline File& File::failif(int cond)
{
if (cond) state |= _fail; return *this;
}
inline File& File::get(char& c)
{
if (readable())
{
int ch = (--(fp)->_cnt>=0?(int)(*(unsigned char*)(fp)->_ptr++):_filbuf(fp)) ;
c = ch;
failif (ch == (-1) );
}
return *this;
}
inline File& File::put(char c)
{
return failif (!writable() || (--( fp)->_cnt>=0? ((int)((unsigned char)((*( fp)->_ptr++=(unsigned)(c))))):_flsbuf((unsigned)(c), fp)) == (-1) );
}
inline File& File::unget(char c)
{
return failif(!is_open() || !(rw & 01) || ungetc(c, fp) == (-1) );
}
inline File& File::putback(char c)
{
return failif (!is_open() || !(rw & 01) || ungetc(c, fp) == (-1) );
}
inline File& File::read(void* x, int sz, int n)
{
return failif (!readable() || (stat = fread(x, sz, n, fp)) != n);
}
inline File& File::write(void* x, int sz, int n)
{
return failif (!writable() || (stat = fwrite(x, sz, n, fp)) != n);
}
inline File& File::flush()
{
return failif(!is_open() || fflush(fp) == (-1) );
}
inline File& File::seek(long pos, int seek_mode = 0)
{
return failif (!is_open() || fseek(fp, pos, seek_mode) < 0);
}
inline long File::tell()
{
failif (!is_open() || (stat = ftell(fp) < 0));
return stat;
}
inline int File::rdstate()
{
check_state(); return state;
}
inline void* File::operator void*()
{
check_state(); return (state & (_bad|_fail))? 0 : this ;
}
inline int File::eof()
{
check_state(); return state & _eof;
}
inline int File::fail()
{
check_state(); return state & _fail;
}
inline int File::bad()
{
check_state(); return state & _bad;
}
inline int File::good()
{
check_state(); return rdstate() == _good;
}
# 27 "/ug/lib/g++-include/stream.h"
class whitespace
{
char filler;
};
class ostream: File
{
public:
File::open; File::close;
File::remove; File::filedesc; File::is_open;
File::raw; File::put; File::check_state;
File::iocount; File::error; File::name;
File::setname; File::rdstate; File::flush;
File::eof; File::fail; File::bad;
File::good; File::clear; File::failif;
File::setbuf; File::writable; File::readable;
ostream();
ostream(const char* filename, io_mode m, access_mode a);
ostream(const char* filename, const char* m);
ostream(int filedesc, io_mode m = io_writeonly);
ostream( struct _iobuf * fileptr);
ostream(int sz, char* buf);
~ostream();
void* operator void*();
ostream& form(const char* fmt, ...);
ostream& operator << (char c);
ostream& operator << (short n);
ostream& operator << (unsigned short n);
ostream& operator << (int n);
ostream& operator << (unsigned int n);
ostream& operator << (long n);
ostream& operator << (unsigned long n);
ostream& operator << (float n);
ostream& operator << (double n);
ostream& operator << (const char* s);
};
class istream: File
{
protected:
ostream* tied_to;
void _flush();
public:
File::open; File::close; File::get;
File::remove; File::filedesc; File::is_open;
File::raw; File::unget; File::getline;
File::iocount; File::error; File::name;
File::setname; File::rdstate; File::putback;
File::eof; File::fail; File::bad;
File::good; File::clear; File::failif;
File::setbuf; File::writable; File::readable;
File::check_state;
istream();
istream(const char* filename, io_mode m, access_mode a);
istream(const char* filename, const char* m);
istream(int filedesc, io_mode m = io_readonly);
istream( struct _iobuf * fileptr);
istream(int sz, char* buf);
~istream();
void* operator void*();
ostream* tie(ostream* s);
istream& scan(const char* fmt, ...);
istream& operator >> (char& c);
istream& operator >> (short& n);
istream& operator >> (unsigned short& n);
istream& operator >> (int& n);
istream& operator >> (unsigned int& n);
istream& operator >> (long& n);
istream& operator >> (unsigned long& n);
istream& operator >> (float& n);
istream& operator >> (double& n);
istream& operator >> (char* s);
istream& operator >> (whitespace& w);
};
void eatwhite(istream& s);
extern istream cin;
extern ostream cout;
extern ostream cerr;
extern whitespace WS;
inline void* ostream::operator void*()
{
check_state(); return (state & (_bad|_fail))? 0 : this ;
}
inline ostream& ostream::operator<<(char c)
{
put(c); return *this;
}
inline void* istream::operator void*()
{
check_state(); return (state & (_bad|_fail))? 0 : this ;
}
inline void istream::_flush()
{
if (tied_to) tied_to->flush();
}
inline istream& istream::operator>>(char& c)
{
_flush(); get(c); return *this;
}
# 24 "/ug/include/Awe2onemax/Awesime.h"
# 1 "/ug/lib/g++-include/std.h"
# 225 "/ug/lib/g++-include/std.h"
# 27 "/ug/include/Awe2onemax/Awesime.h"
# 53 "/ug/include/Awe2onemax/Awesime.h"
class Awesime;
typedef Awesime *AwesimePtr;
typedef void *VoidPtr;
extern const int SubClassResponsibility;
class Awesime {
protected:
int debugFlag;
public :
inline Awesime(bool xdebug = 0) {
debugFlag = xdebug;
}
inline ~Awesime(){};
virtual bool debug();
virtual bool debug(bool x);
virtual void classResetInternalState();
virtual void classReportState(ostream&);
virtual void classPrintOn(ostream& s);
virtual const char* classIsA();
virtual AwesimePtr classCopy();
virtual AwesimePtr classDeepCopy();
virtual void subClassResponsibility(char *name = "");
};
inline ostream&
operator<<(ostream& strm, const Awesime& ob)
{
ob.classPrintOn(strm);
return strm;
}
# 4 "../Src/Load.h"
# 1 "../Src/Globals.h"
# 1 "/ug/include/Awe2onemax/Awesime.h"
# 92 "/ug/include/Awe2onemax/Awesime.h"
# 4 "../Src/Globals.h"
# 1 "/ug/include/Awe2onemax/SpinLock.h"
# 1 "/ug/include/Awe2onemax/assert.h"
# 1 "/ug/include/Awe2onemax/Generic.h"
# 51 "/ug/include/Awe2onemax/Generic.h"
# 28 "/ug/include/Awe2onemax/assert.h"
extern void _assert(const char *, const char *, const int);
extern void _assert2(const char *, const char *, const int, const char *);
# 16 "/ug/include/Awe2onemax/SpinLock.h"
# 1 "/ug/include/Awe2onemax/Config.h"
const static int MaxCpuMultiplexors = 1;
const static int DefaultSpinBarrierLoops = 0;
const static int DefaultBarrierLoops = 0;
# 17 "/ug/include/Awe2onemax/SpinLock.h"
static const char SpinLockFree = '\x00';
static const char SpinLockHeld = '\xff';
class SpinLock {
int state;
int pCount;
public:
inline SpinLock();
inline ~SpinLock();
void reserve();
void release();
int count();
};
inline
SpinLock::SpinLock()
{
state = SpinLockFree;
pCount = 0;
}
inline
SpinLock::~SpinLock()
{
{ if ((state == SpinLockFree)) ; else _assert( "state == SpinLockFree", "/ug/include/Awe2onemax/SpinLock.h",44); } ;
}
inline void
SpinLock::reserve()
{
{ if ((state == SpinLockFree)) ; else _assert( "state == SpinLockFree", "/ug/include/Awe2onemax/SpinLock.h",54); } ;
state = ~SpinLockFree;
}
inline void
SpinLock::release()
{
{ if ((state != SpinLockFree)) ; else _assert( "state != SpinLockFree", "/ug/include/Awe2onemax/SpinLock.h",62); } ;
state = SpinLockFree;
}
inline int
SpinLock::count()
{
return pCount;
}
# 5 "../Src/Globals.h"
class Node;
class Link;
class Thread;
class LowerBoundedFifo;
class Statistic;
class Facility;
class Barrier;
class Message;
class ostream;
class istream;
static const int MaxDiameter = 7;
static const int MaxNodes = (1 << MaxDiameter);
extern int GlobalNodes;
extern int GlobalDiameter;
extern Barrier *EveryBodyReady;
extern SpinLock DebugFileLock;
extern ostream *DebugFile;
extern SpinLock OutputLock;
extern ostream *Output;
extern SpinLock ErrorLock;
extern ostream *Error;
extern SpinLock SummaryLock;
extern ostream *Summary;
extern bool Debug;
extern bool DebugCpu;
extern Node *GlobalNode[ MaxNodes ];
extern Facility *GlobalWire[ MaxNodes ][ MaxDiameter ];
extern int GlobalWireFlaws;
extern bool GlobalBiDirectionalLinks;
extern char *NodeKind;
extern char *LinkKind;
extern int ServersPerNode;
static const int NOTREACHED = 0;
static const int NOTIMPLEMENTED = 0;
# 5 "../Src/Load.h"
class Load {
protected: double ptimeStamp ; void timeStamp(double);public: double timeStamp() ;
protected: double pcpuLoad ; void cpuLoad(double);public: double cpuLoad() ;
protected: Load * pnext ; void next(Load *);public: Load * next() ;
public:
Load();
Load(double cpu);
Load( Load * );
operator Load *operatornew(long);
operator void operatordelete(void *);
int operator<=(Load &);
};
inline double Load::timeStamp(){ return( ptimeStamp );} inline void Load::timeStamp(double x){ ptimeStamp = x;}
inline double Load::cpuLoad(){ return( pcpuLoad );} inline void Load::cpuLoad(double x){ pcpuLoad = x;}
inline Load * Load::next(){ return( pnext );} inline void Load::next(Load * x){ pnext = x;}
static inline int Load::operator<=(Load& l)
{
return( cpuLoad() <= l.cpuLoad() );
}
# 1 "../Src/Load.cc"
# 1 "/ug/include/Awe2onemax/SpinLock.h"
# 72 "/ug/include/Awe2onemax/SpinLock.h"
# 2 "../Src/Load.cc"
static SpinLock freeLock;
static const int AllocateChunk = 1000;
static Load *freeList = 0;
Load *
Load::operatornew(long size)
{
freeLock.reserve();
if (freeList == 0) {
Load *p
= (Load *) new char[ sizeof(Load) * AllocateChunk ];
Load *follow = 0;
Load *n = p;
for (int i = 0; i < AllocateChunk; i++ ) {
n -> next(follow);
follow = n;
n++;
}
freeList = &( p[AllocateChunk - 1] );
}
Load *t = freeList;
freeList = freeList -> next();
freeLock.release();
t -> next(0);
return( t );
}
void
Load::operatordelete(void *pp)
{
Load *p = (Load *) pp;
freeLock.reserve();
p -> next(freeList);
freeList = p;
freeLock.release();
}
Load::Load()
{
ptimeStamp = simulatedClock();
pcpuLoad = 2.2250738585072030e-308 ;
}
Load::Load(double cpu)
{
ptimeStamp = simulatedClock();
pcpuLoad = cpu;
}
Load::Load( Load * from )
{
if ( from != 0 ) {
timeStamp ( from -> timeStamp () ); ;
cpuLoad ( from -> cpuLoad () ); ;
}
else {
ptimeStamp = 0;
pcpuLoad = 0;
}
}