[gnu.g++.bug] g++-1.35.0 seg fault in my error_handler class

dove@UUNET.UU.NET (Webster Dove) (08/18/89)

Here is the emacs compilation buffer for a g++ -E output file

-------------------------------------------

cd /usr/homes/dsp/dove/src/c++/
make g++-1.35.0-bug-8-17-89.o
g++ -c -g -O -I. -fpcc-struct-return g++-1.35.0-bug-8-17-89.cc
In method const const char *error_handler::object_string ():
./error_handler.h:27: Segmentation violation
g++-1.35.0: Program cc1plus got fatal signal 11.
*** Error code 1
make: Fatal error: Command failed for target `g++-1.35.0-bug-8-17-89.o'

Compilation exited abnormally with code 1 at Thu Aug 17 22:46:41

------------------------------------

Here is the g++ -E output file.  Somebody let me know if either 1.35.1
fixes this, or someone knows the fix.

-------------------------------------

# 1 "error_handler.cc"
 
# 1 "./error_handler.h"
 

# 1 "/usr/include/g++-1.35.0/stream.h"
 

#pragma once

# 1 "/usr/include/g++-1.35.0/File.h"
 

#pragma once

# 1 "/usr/include/g++-1.35.0/builtin.h"
 

 

 

#pragma once

overload clearbit;
overload dec;
overload gcd;
overload hex;
overload lcm;
overload lg;
overload oct;
overload setbit;
overload sign;
overload sqr;
overload testbit;
overload even;
overload odd;

# 1 "/usr/include/g++-1.35.0/std.h"
 

#pragma once

#pragma once

overload abs;
overload atoi;

extern "C" {
void      _exit(int);
void      abort(void);
int       abs(int);
int       access(const char*, int);
int       acct(const char*);
unsigned  alarm(unsigned);
void*     alloca(int);
double    atof(const char*);
int       atoi(const char*);
long      atol(const char*);
int       bcmp(const void*, const void*, int);
void      bcopy(const void*, void*, int);
void*     brk(void*);
void      bzero(void*, int);
void*     calloc(unsigned, unsigned);
void      cfree(void*);
int       chdir(const char*);
int       chmod(const char*, int);
int       chown(const char*, int, int);
long      clock(void);
int       close(int);
int       creat(const char*, int);
char*     crypt(const char*, const char*);
char*     ctermid(char*);
char*     cuserid(char*);
double    drand48(void);
int       dup(int);
int       dup2(int, int);
int       dysize(int);
char*     ecvt(double, int, int*, int*);
char*     encrypt(char*, int);
double    erand(short*);
int       execl(const char*, const char *, ...);
int       execle(const char*, const char *, ...);
int       execlp(const char*, const char*, ...);
int       exect(const char*,  const char**,  char**);
int       execv(const char*,  const char**);
int       execve(const char*, const char**, char**);
int       execvp(const char*,  const char**);
void      exit(int);
int       fchmod(int, int);
int       fchown(int, int, int);
int       fcntl(int, int, int);
char*     fcvt(double, int, int*, int*);
int       ffs(int);
int       flock(int, int);
int       fork(void);
void      free(void*);
int       fsync(int);
long      ftok(const char*, int);
int       ftruncate(int, unsigned long);
char*     gcvt(double, int, char*);
char*     getcwd(char*, int);
int       getdomainname(char*, int);
int       getdtablesize(void);
int       getegid(void);
char*     getenv(const char*);
int       geteuid(void);
int       getgid(void);
int       getgroups(int, int*);
long      gethostid(void);
int       gethostname(char*, int);
char*     getlogin(void);
int       getopt(int, char**, char*);
int       getpagesize(void);
char*     getpass(const char*);
int       getpgrp(void);
int       getpid(void);
int       getppid(void);
int       getpriority(int, int);
int       getpw(int, char*);
unsigned  getuid(void);
char*     getwd(char*);
char*     index(const char*, int);
char*     initstate(unsigned, char*, int);
int       ioctl(int, int, char*);
int       isatty(int);
long      jrand48(short*);
int       kill(int, int);
int       killpg(int, int);
void      lcong48(short*);
int       link(const char*, const char*);
int       lock(int, int, long);
long      lrand48(void);
long      lseek(int, long, int);
void*     malloc(unsigned);
void*     memalign(unsigned, unsigned);
void*     memccpy(void*, const void*, int, int);
void*     memchr(const void*, int, int);
int       memcmp(const void*, const void*, int);
void*     memcpy(void*, const void*, int);
void*     memset(void*, int, int);
int       mkdir(const char*, int);
int       mknod(const char*, int, int);
int       mkstemp(char*);
char*     mktemp(char*);
long      mrand48(void);
int       nice(int);
long      nrand48(short*);
int       open(const char*, int, ...);
void      pause(void);
void      perror(const char*);
int       pipe(int*);
void      profil(char*, int, int, int);
int       psignal(unsigned, char*);
int       ptrace(int, int, int, int);
int       putenv(const char*);
int       qsort(void*, int, unsigned, auto (*ptf)(void*,void*));
int       rand(void);
long      random(void);
int       read(int, void*, unsigned);
int       readlink(const char*, char*, int);
void*     realloc(void*, unsigned);
int       rename(const char*, const char*);
char*     rindex(const char*, int);
int       rmdir(const char*);               
void*     sbrk(int);              
short*    seed48(short*);
int       send(int, char*, int, int);
int       setgid(int);
int       sethostname(char*, int);
int       setkey(const char*);
int       setpgrp(int, int);
int       setpriority(int, int, int);
int       setregid(int, int);
int       setreuid(int, int);
char*     setstate(char*);
int       setuid(int);
int       sigblock(int);
int       siginterrupt(int, int);
int       sigpause(int);
int       sigsetmask(int);
unsigned  sleep(unsigned);
int       srand(int);
void      srand48(long);
void      srandom(int);
int       stime(long*);
char*     strcat(char*, const char*);
char*     strchr(const char*, int);
int       strcmp(const char*, const char*);
char*     strcpy(char*, const char*);
int       strcspn(const char*, const char*);
char*     strdup(const char*);
int       strlen(const char*);
char*     strncat(char*, const char*, int);
int       strncmp(const char*, const char*, int);
char*     strncpy(char*, const char*, int);
char*     strpbrk(const char*, const char*);
char*     strrchr(const char*, int);
int       strspn(const char*, const char*);
double    strtod(const char*, char**);
char*     strtok(char*, const char*);
long      strtol(const char*, char**, int);
void      swab(void*, void*, int);
int       symlink(const char*, const char*);
int       syscall(int, ...);
int       system(const char*);
char*     tempnam(char*, char*);
int       tgetent(char*, char*);
int       tgetnum(char*);
int       tgetflag(char*);
char*     tgetstr(char *, char **);
char*     tgoto(char*, int, int);
long      time(long*);
 
char*     tmpnam(char*);
int       truncate(const char*, unsigned long);
char*     ttyname(int);
int       ttyslot(void);
unsigned  ualarm(unsigned, unsigned);
long      ulimit(int, long);
int       umask(int);
int       unlink(const char*);
unsigned  usleep(unsigned);
int       vadvise(int);
void*     valloc(unsigned);
int       vfork(void);
int       vhangup(void);
int       wait(int*);
int       write(int, const void*, unsigned);
}

extern char**   environ;
extern int      errno;
extern char*    sys_errlist[];
extern int      sys_nerr;                  
extern char*    optarg;
extern int      opterr;
extern int      optind;

# 48 "/usr/include/g++-1.35.0/builtin.h"

# 1 "/usr/include/g++-1.35.0/stddef.h"
 

#pragma once

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 "/usr/include/g++-1.35.0/builtin.h"

# 1 "/usr/include/g++-1.35.0/math.h"
 

#pragma once

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;

# 1 "/usr/include/g++-1.35.0/math-68881.h"
 

# 1 "/usr/include/CC/errno.h"
 

 

# 1 "/usr/include/sys/errno.h"
 

 

 

 

 

	 

	 

	 

 

 

 

 

 

 

# 11 "/usr/include/CC/errno.h"

extern int errno;

# 22 "/usr/include/g++-1.35.0/math-68881.h"

# 34 "/usr/include/g++-1.35.0/math-68881.h"

__inline static const double sin (double x)
{
  double value;

  __asm ("fsin%.x %1,%0"
	 : "=f" (value)
	 : "f" (x));
  return value;
}

__inline static const double cos (double x)
{
  double value;

  __asm ("fcos%.x %1,%0"
	 : "=f" (value)
	 : "f" (x));
  return value;
}

__inline static const double tan (double x)
{
  double value;

  __asm ("ftan%.x %1,%0"
	 : "=f" (value)
	 : "f" (x));
  return value;
}

__inline static const double asin (double x)
{
  double value;

  __asm ("fasin%.x %1,%0"
	 : "=f" (value)
	 : "f" (x));
  return value;
}

__inline static const double acos (double x)
{
  double value;

  __asm ("facos%.x %1,%0"
	 : "=f" (value)
	 : "f" (x));
  return value;
}

__inline static const double atan (double x)
{
  double value;

  __asm ("fatan%.x %1,%0"
	 : "=f" (value)
	 : "f" (x));
  return value;
}

__inline static const double atan2 (double y, double x)
{
  double pi, pi_over_2;

  __asm ("fmovecr%.x %#0,%0"		 
	 : "=f" (pi)
	 :   );
  __asm ("fscale%.b %#-1,%0"		 
	 : "=f" (pi_over_2)
	 : "0" (pi));
  if (x > 0)
    {
      if (y > 0)
	{
	  if (x > y)
	    return atan (y / x);
	  else
	    return pi_over_2 - atan (x / y);
	}
      else
	{
	  if (x > -y)
	    return atan (y / x);
	  else
	    return - pi_over_2 - atan (x / y);
	}
    }
  else
    {
      if (y > 0)
	{
	  if (-x > y)
	    return pi + atan (y / x);
	  else
	    return pi_over_2 - atan (x / y);
	}
      else
	{
	  if (-x > -y)
	    return - pi + atan (y / x);
	  else if (y < 0)
	    return - pi_over_2 - atan (x / y);
	  else
	    {
	      double value;

	      errno = 	33		;
	      __asm ("fmove%.d %#0rnan,%0" 	 
		     : "=f" (value)
		     :  );
	      return value;
	    }
	}
    }
}

__inline static const double sinh (double x)
{
  double value;

  __asm ("fsinh%.x %1,%0"
	 : "=f" (value)
	 : "f" (x));
  return value;
}

__inline static const double cosh (double x)
{
  double value;

  __asm ("fcosh%.x %1,%0"
	 : "=f" (value)
	 : "f" (x));
  return value;
}

__inline static const double tanh (double x)
{
  double value;

  __asm ("ftanh%.x %1,%0"
	 : "=f" (value)
	 : "f" (x));
  return value;
}

__inline static const double atanh (double x)
{
  double value;

  __asm ("fatanh%.x %1,%0"
	 : "=f" (value)
	 : "f" (x));
  return value;
}

__inline static const double exp (double x)
{
  double value;

  __asm ("fetox%.x %1,%0"
	 : "=f" (value)
	 : "f" (x));
  return value;
}

__inline static const double expm1 (double x)
{
  double value;

  __asm ("fetoxm1%.x %1,%0"
	 : "=f" (value)
	 : "f" (x));
  return value;
}

__inline static const double log (double x)
{
  double value;

  __asm ("flogn%.x %1,%0"
	 : "=f" (value)
	 : "f" (x));
  return value;
}

__inline static const double log1p (double x)
{
  double value;

  __asm ("flognp1%.x %1,%0"
	 : "=f" (value)
	 : "f" (x));
  return value;
}

__inline static const double log10 (double x)
{
  double value;

  __asm ("flog10%.x %1,%0"
	 : "=f" (value)
	 : "f" (x));
  return value;
}

__inline static const double sqrt (double x)
{
  double value;

  __asm ("fsqrt%.x %1,%0"
	 : "=f" (value)
	 : "f" (x));
  return value;
}

__inline static const double pow (const double x, const double y)
{
  if (x > 0)
    return exp (y * log (x));
  else if (x == 0)
    {
      if (y > 0)
	return 0.0;
      else
	{
	  double value;

	  errno = 	33		;
	  __asm ("fmove%.d %#0rnan,%0"		 
		 : "=f" (value)
		 :  );
	  return value;
	}
    }
  else
    {
      double temp;

      __asm ("fintrz%.x %1,%0"
	     : "=f" (temp)			 
	     : "f" (y));
      if (y == temp)
        {
	  int i = (int) y;
	  
	  if (i & 1 == 0)			 
	    return exp (y * log (x));
	  else
	    return - exp (y * log (x));
        }
      else
        {
	  double value;

	  errno = 	33		;
	  __asm ("fmove%.d %#0rnan,%0"		 
		 : "=f" (value)
		 :  );
	  return value;
        }
    }
}

__inline static const double fabs (double x)
{
  double value;

  __asm ("fabs%.x %1,%0"
	 : "=f" (value)
	 : "f" (x));
  return value;
}

__inline static const double ceil (double x)
{
  int rounding_mode, round_up;
  double value;

  __asm volatile ("fmove%.l fpcr,%0"
		  : "=dm" (rounding_mode)
		  :   );
  round_up = rounding_mode | 0x30;
  __asm volatile ("fmove%.l %0,fpcr"
		  :  
		  : "dmi" (round_up));
  __asm volatile ("fint%.x %1,%0"
		  : "=f" (value)
		  : "f" (x));
  __asm volatile ("fmove%.l %0,fpcr"
		  :  
		  : "dmi" (rounding_mode));
  return value;
}

__inline static const double floor (double x)
{
  int rounding_mode, round_down;
  double value;

  __asm volatile ("fmove%.l fpcr,%0"
		  : "=dm" (rounding_mode)
		  :   );
  round_down = (rounding_mode & ~0x10)
		| 0x20;
  __asm volatile ("fmove%.l %0,fpcr"
		  :  
		  : "dmi" (round_down));
  __asm volatile ("fint%.x %1,%0"
		  : "=f" (value)
		  : "f" (x));
  __asm volatile ("fmove%.l %0,fpcr"
		  :  
		  : "dmi" (rounding_mode));
  return value;
}

__inline static const double rint (double x)
{
  int rounding_mode, round_nearest;
  double value;

  __asm volatile ("fmove%.l fpcr,%0"
		  : "=dm" (rounding_mode)
		  :   );
  round_nearest = rounding_mode & ~0x30;
  __asm volatile ("fmove%.l %0,fpcr"
		  :  
		  : "dmi" (round_nearest));
  __asm volatile ("fint%.x %1,%0"
		  : "=f" (value)
		  : "f" (x));
  __asm volatile ("fmove%.l %0,fpcr"
		  :  
		  : "dmi" (rounding_mode));
  return value;
}

__inline static const double fmod (double x, double y)
{
  double value;

  __asm ("fmod%.x %2,%0"
	 : "=f" (value)
	 : "0" (x),
	   "f" (y));
  return value;
}

__inline static const double drem (double x, double y)
{
  double value;

  __asm ("frem%.x %2,%0"
	 : "=f" (value)
	 : "0" (x),
	   "f" (y));
  return value;
}

__inline static const double scalb (double x, int n)
{
  double value;

  __asm ("fscale%.l %2,%0"
	 : "=f" (value)
	 : "0" (x),
	   "dmi" (n));
  return value;
}

__inline static double logb (double x)
{
  double exponent;

  __asm ("fgetexp%.x %1,%0"
	 : "=f" (exponent)
	 : "f" (x));
  return exponent;
}

__inline static const double ldexp (double x, int n)
{
  double value;

  __asm ("fscale%.l %2,%0"
	 : "=f" (value)
	 : "0" (x),
	   "dmi" (n));
  return value;
}

__inline static double frexp (double x, int *exp)
{
  double float_exponent;
  int int_exponent;
  double mantissa;

  __asm ("fgetexp%.x %1,%0"
	 : "=f" (float_exponent) 	 
	 : "f" (x));
  int_exponent = (int) float_exponent;
  __asm ("fgetman%.x %1,%0"
	 : "=f" (mantissa)		 
	 : "f" (x));
  if (mantissa != 0)
    {
      __asm ("fscale%.b %#-1,%0"
	     : "=f" (mantissa)		 
	     : "0" (mantissa));
      int_exponent += 1;
    }
  *exp = int_exponent;
  return mantissa;
}

__inline static double modf (double x, double *ip)
{
  double temp;

  __asm ("fintrz%.x %1,%0"
	 : "=f" (temp)			 
	 : "f" (x));
  *ip = temp;
  return x - temp;
}
# 53 "/usr/include/g++-1.35.0/math.h"

extern "C" {			 

double  acosh(double);
double  asinh(double);
double  cbrt(double);
double  copysign(double,double);
double  erf(double);
double  erfc(double);
double  finite(double);
double  gamma(double);
double  hypot(double,double);
double  infnan(int);
int     isinf(double);
int     isnan(double);
double  j0(double);
double  j1(double);
double  jn(int, double);
double  lgamma(double);
double  y0(double);
double  y1(double);
double  yn(int, double);

}
 
# 130 "/usr/include/g++-1.35.0/math.h"

 

 

struct exception
{
  int type;
  char* name;
  double arg1, arg2, retval;
};

extern "C" int matherr(exception*);

# 1 "/usr/include/g++-1.35.0/values.h"
 

#pragma once

# 108 "/usr/include/g++-1.35.0/values.h"

# 155 "/usr/include/g++-1.35.0/math.h"

 

 

# 50 "/usr/include/g++-1.35.0/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 ...);
char*        chr(char ch);

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);
}

 

# 28 "/usr/include/g++-1.35.0/File.h"

# 1 "/usr/include/g++-1.35.0/stdio.h"
 

 

#pragma once

 

 

extern  struct  _iobuf {
    int      _cnt;
    char*    _ptr;
    char*    _base;

    int     _bufsiz;
    short   _flag;

    char    _file;
} _iob[];

extern "C" {

int    _doprnt(const char*, void*,     struct _iobuf *);
int    _doscan(    struct _iobuf *, const char*, void*);
int    _filbuf(    struct _iobuf *);
int    _flsbuf(unsigned,     struct _iobuf *);
int    fclose(    struct _iobuf *);
    struct _iobuf *  fdopen(int, const char*);
int    fflush(    struct _iobuf *);
int    fgetc(    struct _iobuf *);
char*  fgets(char*, int,     struct _iobuf  *);
    struct _iobuf *  fopen(const char*, const char*);
int    fprintf(    struct _iobuf *, const char* ...);
int    fputc(int,     struct _iobuf *);
int    fputs(const char*,     struct _iobuf *);
int    fread(void*, int, int,     struct _iobuf *);
    struct _iobuf *  freopen(const char*, const char*,     struct _iobuf *);
int    fscanf(    struct _iobuf *, const char* ...);
int    fseek(    struct _iobuf *, long, int);
long   ftell(    struct _iobuf  *);
int    fwrite(const void*, int, int,     struct _iobuf *);
char*  gets(char*);
int    getw(    struct _iobuf *);
int    pclose(    struct _iobuf *);
    struct _iobuf *  popen(const char*, const char*);
int    printf(const char* ...);
void   puts(const char*);
int    putw(int,     struct _iobuf *);
int    scanf(const char* ...);
void   setbuf(    struct _iobuf *, char*);
void   setbuffer(    struct _iobuf *, char*, int);
void   setlinebuf(    struct _iobuf *);
void   setvbuf(    struct _iobuf *, char*, int, int);
int    sscanf(char*, const char* ...);
    struct _iobuf *  tmpfile();
int    ungetc(int,     struct _iobuf *);
int    vfprintf(    struct _iobuf *, const char*, void* ap);
int    vprintf(const char*, void* ap);
int    vsprintf(char*, const char*, void* ap);

int    sprintf(char*, const char* ...);

}

# 29 "/usr/include/g++-1.35.0/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*);
  char         *readline (int chunk_number, char terminator);

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&         gets   (char **s, 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 this->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; 
}

 

# 28 "/usr/include/g++-1.35.0/stream.h"

class whitespace                 
{                                
  char filler;                     
};

class ostream: private 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: private File
{
protected:
  ostream* tied_to;         
  void     _flush();

public:
           File::open;      File::close;     File::get;  File::gets;
           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();
}

 

# 5 "./error_handler.h"

 

 

typedef const char * const string_const;

 

class error_handler
{
  typedef void (error_handler::*error_handler_type)(string_const short_form,
						    string_const long_form);
  virtual error_handler_type get_error_handler()
    { return((error_handler_type)default_error_handler); }
  void default_error_handler(string_const, string_const); 
protected:
   
  void error(string_const short_form, string_const long_form);
public:
  virtual string_const type_string() = 0;    
  virtual string_const object_string()	      
    { return(form("#<%s x%x>", type_string(), this)); }
};

 

 

 

 

  if(local_error_handler == 0)     local_error_handler = (error_handler_type)default_error_handler;    return(local_error_handler); } static error_handler_type set_error_handler(error_handler_type new_handler) {     error_handler_type old_handler = local_
error_handler;     local_error_handler = new_handler;     return(old_handler); } private: static error_handler_type local_error_handler
# 129 "./error_handler.h"

# 2 "error_handler.cc"

void error_handler::error(string_const short_form, string_const long_form)
{
  error_handler_type error_handler = get_error_handler();

   
  char short_copy[strlen(short_form)];
  strcpy(short_copy, short_form);
  char long_copy[strlen(long_form)];
  strcpy(long_copy, long_form);
  
  (*error_handler)(short_copy, long_copy);
}

 
void error_handler::default_error_handler(string_const short_form, string_const long_form)
{
  cerr << object_string() << ": (" << short_form << ")\n\t";
  cerr << long_form << ".  Abort()\n";
  abort();
}