This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
g++ bug report
- To: egcs-bugs at cygnus dot com
- Subject: g++ bug report
- From: Ferenc Wagner <wferi at bolyai1 dot elte dot hu>
- Date: Fri, 16 Oct 1998 05:19:18 +0200 (CEST)
Hi,
I got the following message from the compiler:
sep.cc:19: warning: ANSI C++ forbids initialization of member `separation'
sep.cc:19: Internal compiler error.
sep.cc:19: Please submit a full bug report to `egcs-bugs@cygnus.com'.
So here it is. Find the related sources attached.
Output from `g++ -v':
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)
The offending command was: `g++ sep.cpp'
The operating system is RedHat Linux 5.1, default gcc configuration. No
modifications have been made to the gcc sources.
I agree the code is somehow foolish; anyway, I was said it was a bug...
Anyway, it appeared when I introduced the `separation' object.
Hope it helps, cheers: Ferenc.
# 1 "sep.cc"
# 1 "/usr/include/stdlib.h" 1 3
# 1 "/usr/include/features.h" 1 3
# 117 "/usr/include/features.h" 3
# 1 "/usr/include/sys/cdefs.h" 1 3
# 1 "/usr/include/features.h" 1 3
# 222 "/usr/include/features.h" 3
# 22 "/usr/include/sys/cdefs.h" 2 3
# 54 "/usr/include/sys/cdefs.h" 3
# 86 "/usr/include/sys/cdefs.h" 3
# 205 "/usr/include/features.h" 2 3
# 1 "/usr/include/gnu/stubs.h" 1 3
# 219 "/usr/include/features.h" 2 3
# 26 "/usr/include/stdlib.h" 2 3
# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 1 3
# 19 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 131 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
typedef unsigned int size_t;
# 270 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 302 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 32 "/usr/include/stdlib.h" 2 3
extern "C" {
typedef struct
{
int quot;
int rem;
} div_t;
typedef struct
{
long int quot;
long int rem;
} ldiv_t;
extern int __ctype_get_mb_cur_max (void) ;
extern double atof (__const char *__nptr) ;
extern int atoi (__const char *__nptr) ;
extern long int atol (__const char *__nptr) ;
extern long long int atoll (__const char *__nptr) ;
extern double strtod (__const char *__nptr, char **__endptr) ;
extern long int strtol (__const char *__nptr, char **__endptr,
int __base) ;
extern unsigned long int strtoul (__const char *__nptr,
char **__endptr, int __base) ;
extern long long int strtoq (__const char *__nptr, char **__endptr,
int __base) ;
extern unsigned long long int strtouq (__const char *__nptr,
char **__endptr, int __base) ;
extern long long int strtoll (__const char *__nptr, char **__endptr,
int __base) ;
extern unsigned long long int strtoull (__const char *__nptr,
char **__endptr, int __base) ;
extern double __strtod_internal (__const char *__nptr,
char **__endptr, int __group) ;
extern float __strtof_internal (__const char *__nptr, char **__endptr,
int __group) ;
extern long double __strtold_internal (__const char *__nptr,
char **__endptr, int __group) ;
extern long int __strtol_internal (__const char *__nptr, char **__endptr,
int __base, int __group) ;
extern unsigned long int __strtoul_internal (__const char *__nptr,
char **__endptr, int __base,
int __group) ;
extern long long int __strtoq_internal (__const char *__nptr,
char **__endptr, int __base,
int __group) ;
extern unsigned long long int __strtouq_internal (__const char *__nptr,
char **__endptr,
int __base,
int __group) ;
# 197 "/usr/include/stdlib.h" 3
extern char *l64a (long int __n) ;
extern long int a64l (__const char *__s) ;
# 1 "/usr/include/sys/types.h" 1 3
extern "C" {
# 1 "/usr/include/gnu/types.h" 1 3
typedef unsigned char __u_char;
typedef unsigned short __u_short;
typedef unsigned int __u_int;
typedef unsigned long __u_long;
typedef unsigned long long int __u_quad_t;
typedef long long int __quad_t;
# 41 "/usr/include/gnu/types.h" 3
typedef __quad_t *__qaddr_t;
typedef __u_quad_t __dev_t;
typedef __u_int __uid_t;
typedef __u_int __gid_t;
typedef __u_long __ino_t;
typedef __u_int __mode_t;
typedef __u_int __nlink_t;
typedef long int __off_t;
typedef __quad_t __loff_t;
typedef int __pid_t;
typedef int __ssize_t;
typedef struct
{
int __val[2];
} __fsid_t;
typedef int __daddr_t;
typedef char *__caddr_t;
typedef long int __time_t;
typedef long int __swblk_t;
typedef long int __clock_t;
typedef unsigned long int __fd_mask;
typedef struct
{
__fd_mask fds_bits[1024 / (8 * sizeof (__fd_mask)) ];
} __fd_set;
typedef int __key_t;
typedef unsigned short int __ipc_pid_t;
# 30 "/usr/include/sys/types.h" 2 3
typedef __u_char u_char;
typedef __u_short u_short;
typedef __u_int u_int;
typedef __u_long u_long;
typedef __quad_t quad_t;
typedef __u_quad_t u_quad_t;
typedef __fsid_t fsid_t;
typedef __dev_t dev_t;
typedef __gid_t gid_t;
typedef __ino_t ino_t;
typedef __mode_t mode_t;
typedef __nlink_t nlink_t;
typedef __off_t off_t;
typedef __loff_t loff_t;
typedef __pid_t pid_t;
typedef __uid_t uid_t;
typedef __ssize_t ssize_t;
typedef __daddr_t daddr_t;
typedef __caddr_t caddr_t;
typedef __key_t key_t;
# 1 "/usr/include/time.h" 1 3
# 56 "/usr/include/time.h" 3
# 68 "/usr/include/time.h" 3
typedef __time_t time_t;
# 97 "/usr/include/time.h" 3
# 125 "/usr/include/time.h" 3
# 281 "/usr/include/time.h" 3
# 67 "/usr/include/sys/types.h" 2 3
# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 1 3
# 19 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 131 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 182 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 258 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 270 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 302 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 70 "/usr/include/sys/types.h" 2 3
typedef unsigned long int ulong;
typedef unsigned short int ushort;
typedef unsigned int uint;
# 95 "/usr/include/sys/types.h" 3
typedef int int8_t __attribute__ ((__mode__ ( __QI__ ))) ;
typedef unsigned int u_int8_t __attribute__ ((__mode__ ( __QI__ ))) ;
typedef int int16_t __attribute__ ((__mode__ ( __HI__ ))) ;
typedef unsigned int u_int16_t __attribute__ ((__mode__ ( __HI__ ))) ;
typedef int int32_t __attribute__ ((__mode__ ( __SI__ ))) ;
typedef unsigned int u_int32_t __attribute__ ((__mode__ ( __SI__ ))) ;
typedef int int64_t __attribute__ ((__mode__ ( __DI__ ))) ;
typedef unsigned int u_int64_t __attribute__ ((__mode__ ( __DI__ ))) ;
typedef int register_t __attribute__ ((__mode__ (__word__)));
# 1 "/usr/include/endian.h" 1 3
# 1 "/usr/include/bytesex.h" 1 3
# 34 "/usr/include/endian.h" 2 3
# 123 "/usr/include/sys/types.h" 2 3
# 1 "/usr/include/sys/select.h" 1 3
# 1 "/usr/include/selectbits.h" 1 3
# 50 "/usr/include/selectbits.h" 3
# 65 "/usr/include/selectbits.h" 3
# 31 "/usr/include/sys/select.h" 2 3
# 1 "/usr/include/time.h" 1 3
# 56 "/usr/include/time.h" 3
# 68 "/usr/include/time.h" 3
# 80 "/usr/include/time.h" 3
struct timespec
{
long int tv_sec;
long int tv_nsec;
};
# 125 "/usr/include/time.h" 3
# 281 "/usr/include/time.h" 3
# 35 "/usr/include/sys/select.h" 2 3
extern "C" {
struct timeval;
typedef __fd_mask fd_mask;
typedef __fd_set fd_set;
extern int __select (int __nfds, __fd_set *__readfds,
__fd_set *__writefds, __fd_set *__exceptfds,
struct timeval *__timeout) ;
extern int select (int __nfds, __fd_set *__readfds,
__fd_set *__writefds, __fd_set *__exceptfds,
struct timeval *__timeout) ;
extern int __pselect (int __nfds, __fd_set *__readfds,
__fd_set *__writefds, __fd_set *__exceptfds,
struct timespec *__timeout) ;
extern int pselect (int __nfds, __fd_set *__readfds,
__fd_set *__writefds, __fd_set *__exceptfds,
struct timespec *__timeout) ;
}
# 126 "/usr/include/sys/types.h" 2 3
}
# 210 "/usr/include/stdlib.h" 2 3
extern int32_t __random (void) ;
extern int32_t random (void) ;
extern void __srandom (unsigned int __seed) ;
extern void srandom (unsigned int __seed) ;
extern void * __initstate (unsigned int __seed, void * __statebuf,
size_t __statelen) ;
extern void * initstate (unsigned int __seed, void * __statebuf,
size_t __statelen) ;
extern void * __setstate (void * __statebuf) ;
extern void * setstate (void * __statebuf) ;
struct random_data
{
int32_t *fptr;
int32_t *rptr;
int32_t *state;
int rand_type;
int rand_deg;
int rand_sep;
int32_t *end_ptr;
};
extern int __random_r (struct random_data *__buf, int32_t *__result) ;
extern int random_r (struct random_data *__buf, int32_t *__result) ;
extern int __srandom_r (unsigned int __seed, struct random_data *__buf) ;
extern int srandom_r (unsigned int __seed, struct random_data *__buf) ;
extern int __initstate_r (unsigned int __seed, void * __statebuf,
size_t __statelen, struct random_data *__buf) ;
extern int initstate_r (unsigned int __seed, void * __statebuf,
size_t __statelen, struct random_data *__buf) ;
extern int __setstate_r (void * __statebuf, struct random_data *__buf) ;
extern int setstate_r (void * __statebuf, struct random_data *__buf) ;
extern int rand (void) ;
extern void srand (unsigned int __seed) ;
extern int __rand_r (unsigned int *__seed) ;
extern int rand_r (unsigned int *__seed) ;
extern double drand48 (void) ;
extern double erand48 (unsigned short int __xsubi[3]) ;
extern long lrand48 (void) ;
extern long nrand48 (unsigned short int __xsubi[3]) ;
extern long mrand48 (void) ;
extern long jrand48 (unsigned short int __xsubi[3]) ;
extern void srand48 (long __seedval) ;
extern unsigned short int *seed48 (unsigned short int __seed16v[3]) ;
extern void lcong48 (unsigned short int __param[7]) ;
struct drand48_data
{
unsigned short int x[3];
unsigned short int a[3];
unsigned short int c;
unsigned short int old_x[3];
int init;
};
extern int drand48_r (struct drand48_data *__buffer, double *__result) ;
extern int erand48_r (unsigned short int __xsubi[3],
struct drand48_data *__buffer, double *__result) ;
extern int lrand48_r (struct drand48_data *__buffer, long *__result) ;
extern int nrand48_r (unsigned short int __xsubi[3],
struct drand48_data *__buffer, long *__result) ;
extern int mrand48_r (struct drand48_data *__buffer, long *__result) ;
extern int jrand48_r (unsigned short int __xsubi[3],
struct drand48_data *__buffer, long *__result) ;
extern int srand48_r (long __seedval, struct drand48_data *__buffer) ;
extern int seed48_r (unsigned short int __seed16v[3],
struct drand48_data *__buffer) ;
extern int lcong48_r (unsigned short int __param[7],
struct drand48_data *__buffer) ;
extern int __drand48_iterate (unsigned short int __xsubi[3],
struct drand48_data *__buffer) ;
extern void * malloc (size_t __size) ;
extern void * realloc (void * __ptr, size_t __size) ;
extern void * calloc (size_t __nmemb, size_t __size) ;
extern void free (void * __ptr) ;
extern void cfree (void * __ptr) ;
# 1 "/usr/include/alloca.h" 1 3
# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 1 3
# 19 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 131 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 182 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 258 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 270 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 302 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 25 "/usr/include/alloca.h" 2 3
extern "C" {
extern void * __alloca (size_t __size) ;
extern void * alloca (size_t __size) ;
}
# 360 "/usr/include/stdlib.h" 2 3
extern void * valloc (size_t __size) ;
extern void abort (void) __attribute__ ((__noreturn__));
extern int atexit (void (*__func) (void)) ;
extern int __on_exit (void (*__func) (int __status, void * __arg),
void * __arg) ;
extern int on_exit (void (*__func) (int __status, void * __arg),
void * __arg) ;
extern void exit (int __status) __attribute__ ((__noreturn__));
extern char *getenv (__const char *__name) ;
extern char *__secure_getenv (__const char *__name) ;
extern int putenv (__const char *__string) ;
extern int setenv (__const char *__name, __const char *__value,
int __replace) ;
extern void unsetenv (__const char *__name) ;
extern int __clearenv (void) ;
extern int clearenv (void) ;
extern char *mktemp (char *__template) ;
extern int mkstemp (char *__template) ;
extern int system (__const char *__command) ;
extern char *realpath (__const char *__name, char *__resolved) ;
typedef int (*__compar_fn_t) (__const void * , __const void * ) ;
extern void * bsearch (__const void * __key, __const void * __base,
size_t __nmemb, size_t __size,
__compar_fn_t __compar) ;
extern void qsort (void * __base, size_t __nmemb, size_t __size,
__compar_fn_t __compar) ;
extern int abs (int __x) __attribute__ ((__const__));
extern long int labs (long int __x) __attribute__ ((__const__));
extern div_t div (int __numer, int __denom) __attribute__ ((__const__));
extern ldiv_t ldiv (long int __numer, long int __denom) __attribute__ ((__const__));
extern char *ecvt (double __value, int __ndigit, int *__decpt,
int *__sign) ;
extern char *fcvt (double __value, int __ndigit, int *__decpt,
int *__sign) ;
extern char *gcvt (double __value, int __ndigit, char *__buf) ;
extern char *qecvt (long double __value, int __ndigit, int *__decpt,
int *__sign) ;
extern char *qfcvt (long double __value, int __ndigit, int *__decpt,
int *__sign) ;
extern char *qgcvt (long double __value, int __ndigit, char *__buf) ;
extern int ecvt_r (double __value, int __ndigit, int *__decpt,
int *__sign, char *__buf, size_t __len) ;
extern int fcvt_r (double __value, int __ndigit, int *__decpt,
int *__sign, char *__buf, size_t __len) ;
extern int qecvt_r (long double __value, int __ndigit, int *__decpt,
int *__sign, char *__buf, size_t __len) ;
extern int qfcvt_r (long double __value, int __ndigit, int *__decpt,
int *__sign, char *__buf, size_t __len) ;
extern int mblen (__const char *__s, size_t __n) ;
extern int mbtowc (wchar_t *__pwc, __const char *__s, size_t __n) ;
extern int wctomb (char *__s, wchar_t __wchar) ;
extern size_t mbstowcs (wchar_t *__pwcs, __const char *__s, size_t __n) ;
extern size_t wcstombs (char *__s, __const wchar_t *__pwcs, size_t __n) ;
extern int rpmatch (__const char *__response) ;
# 582 "/usr/include/stdlib.h" 3
}
# 6 "sep.cc" 2
# 1 "histogram.hh" 1
# 1 "/usr/include/g++/fstream.h" 1 3
#pragma interface
# 1 "/usr/include/g++/iostream.h" 1 3
#pragma interface
# 1 "/usr/include/g++/streambuf.h" 1 3
#pragma interface
extern "C" {
# 1 "/usr/include/libio.h" 1 3
# 1 "/usr/include/_G_config.h" 1 3
# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 1 3
# 19 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 131 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 182 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 258 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
typedef unsigned int wint_t;
# 302 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
# 13 "/usr/include/_G_config.h" 2 3
typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
# 31 "/usr/include/libio.h" 2 3
# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stdarg.h" 1 3
typedef void *__gnuc_va_list;
# 116 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stdarg.h" 3
# 202 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stdarg.h" 3
# 47 "/usr/include/libio.h" 2 3
# 64 "/usr/include/libio.h" 3
# 96 "/usr/include/libio.h" 3
struct _IO_jump_t; struct _IO_FILE;
typedef void _IO_lock_t;
struct _IO_marker {
struct _IO_marker *_next;
struct _IO_FILE *_sbuf;
int _pos;
# 180 "/usr/include/libio.h" 3
};
struct _IO_FILE {
int _flags;
char* _IO_read_ptr;
char* _IO_read_end;
char* _IO_read_base;
char* _IO_write_base;
char* _IO_write_ptr;
char* _IO_write_end;
char* _IO_buf_base;
char* _IO_buf_end;
char *_IO_save_base;
char *_IO_backup_base;
char *_IO_save_end;
struct _IO_marker *_markers;
struct _IO_FILE *_chain;
int _fileno;
int _blksize;
__off_t _offset;
unsigned short _cur_column;
char _unused;
char _shortbuf[1];
_IO_lock_t *_lock;
};
struct _IO_FILE_plus;
extern struct _IO_FILE_plus _IO_stdin_, _IO_stdout_, _IO_stderr_;
typedef struct
{
__ssize_t (*read) (struct _IO_FILE *, void *, __ssize_t ) ;
__ssize_t (*write) (struct _IO_FILE *, const void *, __ssize_t ) ;
__off_t (*seek) (struct _IO_FILE *, __off_t , int) ;
int (*close) (struct _IO_FILE *) ;
} _IO_cookie_io_functions_t;
struct _IO_cookie_file {
struct _IO_FILE file;
const void *vtable;
void *cookie;
_IO_cookie_io_functions_t io_functions;
};
extern "C" {
extern int __underflow (_IO_FILE*) ;
extern int __uflow (_IO_FILE*) ;
extern int __overflow (_IO_FILE*, int) ;
extern int _IO_getc (_IO_FILE *__fp) ;
extern int _IO_putc (int __c, _IO_FILE *__fp) ;
extern int _IO_feof (_IO_FILE *__fp) ;
extern int _IO_ferror (_IO_FILE *__fp) ;
extern int _IO_peekc_locked (_IO_FILE *__fp) ;
extern void _IO_flockfile (_IO_FILE *) ;
extern void _IO_funlockfile (_IO_FILE *) ;
extern int _IO_ftrylockfile (_IO_FILE *) ;
extern int _IO_vfscanf (_IO_FILE*, const char*, __gnuc_va_list , int*) ;
extern int _IO_vfprintf (_IO_FILE*, const char*, __gnuc_va_list ) ;
extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t ) ;
extern size_t _IO_sgetn (_IO_FILE *, void*, size_t ) ;
extern __off_t _IO_seekoff (_IO_FILE*, __off_t , int, int) ;
extern __off_t _IO_seekpos (_IO_FILE*, __off_t , int) ;
extern void _IO_free_backup_area (_IO_FILE*) ;
}
# 36 "/usr/include/g++/streambuf.h" 2 3
}
# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stdarg.h" 1 3
void va_end (__gnuc_va_list);
# 168 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stdarg.h" 3
typedef __gnuc_va_list va_list;
# 40 "/usr/include/g++/streambuf.h" 2 3
extern "C++" {
class istream;
class ostream; class streambuf;
typedef __off_t streamoff;
typedef __off_t streampos;
typedef __ssize_t streamsize;
typedef unsigned long __fmtflags;
typedef unsigned char __iostate;
struct _ios_fields
{
streambuf *_strbuf;
ostream* _tie;
int _width;
__fmtflags _flags;
short _fill;
__iostate _state;
__iostate _exceptions;
int _precision;
void *_arrays;
};
# 124 "/usr/include/g++/streambuf.h" 3
class ios : public _ios_fields {
ios& operator=(ios&);
ios (const ios&);
public:
typedef __fmtflags fmtflags;
typedef int iostate;
typedef int openmode;
typedef int streamsize;
enum io_state {
goodbit = 0 ,
eofbit = 1 ,
failbit = 2 ,
badbit = 4 };
enum open_mode {
in = 1 ,
out = 2 ,
ate = 4 ,
app = 8 ,
trunc = 16 ,
nocreate = 32 ,
noreplace = 64 ,
bin = 128 ,
binary = 128 };
enum seek_dir { beg, cur, end};
typedef enum seek_dir seekdir;
enum { skipws= 01 ,
left= 02 , right= 04 , internal= 010 ,
dec= 020 , oct= 040 , hex= 0100 ,
showbase= 0200 , showpoint= 0400 ,
uppercase= 01000 , showpos= 02000 ,
scientific= 04000 , fixed= 010000 ,
unitbuf= 020000 , stdio= 040000
};
enum {
basefield=dec+oct+hex,
floatfield = scientific+fixed,
adjustfield = left+right+internal
};
# 177 "/usr/include/g++/streambuf.h" 3
ostream* tie() const { return _tie; }
ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; }
short fill() const { return _fill; }
short fill(short newf)
{short oldf = _fill; _fill = newf; return oldf;}
fmtflags flags() const { return _flags; }
fmtflags flags(fmtflags new_val) {
fmtflags old_val = _flags; _flags = new_val; return old_val; }
int precision() const { return _precision; }
int precision(int newp) {
unsigned short oldp = _precision; _precision = (unsigned short)newp;
return oldp; }
fmtflags setf(fmtflags val) {
fmtflags oldbits = _flags;
_flags |= val; return oldbits; }
fmtflags setf(fmtflags val, fmtflags mask) {
fmtflags oldbits = _flags;
_flags = (_flags & ~mask) | (val & mask); return oldbits; }
fmtflags unsetf(fmtflags mask) {
fmtflags oldbits = _flags;
_flags &= ~mask; return oldbits; }
int width() const { return _width; }
int width(int val) { int save = _width; _width = val; return save; }
void _throw_failure() const { }
void clear(iostate state = 0) {
_state = _strbuf ? state : state|badbit;
if (_state & _exceptions) _throw_failure(); }
void set(iostate flag) { _state |= flag;
if (_state & _exceptions) _throw_failure(); }
void setstate(iostate flag) { _state |= flag;
if (_state & _exceptions) _throw_failure(); }
int good() const { return _state == 0; }
int eof() const { return _state & ios::eofbit; }
int fail() const { return _state & (ios::badbit|ios::failbit); }
int bad() const { return _state & ios::badbit; }
iostate rdstate() const { return _state; }
operator void*() const { return fail() ? (void*)0 : (void*)(-1); }
int operator!() const { return fail(); }
iostate exceptions() const { return _exceptions; }
void exceptions(iostate enable) {
_exceptions = enable;
if (_state & _exceptions) _throw_failure(); }
streambuf* rdbuf() const { return _strbuf; }
streambuf* rdbuf(streambuf *_s) {
streambuf *_old = _strbuf; _strbuf = _s; clear (); return _old; }
static int sync_with_stdio(int on);
static void sync_with_stdio() { sync_with_stdio(1); }
static fmtflags bitalloc();
static int xalloc();
void*& pword(int);
void* pword(int) const;
long& iword(int);
long iword(int) const;
class Init {
public:
Init () { }
};
protected:
inline ios(streambuf* sb = 0, ostream* tie_to = 0);
inline virtual ~ios();
inline void init(streambuf* sb, ostream* tie = 0);
};
typedef ios::seek_dir _seek_dir;
class streammarker : private _IO_marker {
friend class streambuf;
void set_offset(int offset) { _pos = offset; }
public:
streammarker(streambuf *sb);
~streammarker();
int saving() { return 1; }
int delta(streammarker&);
int delta();
};
struct streambuf : public _IO_FILE {
friend class ios;
friend class istream;
friend class ostream;
friend class streammarker;
const void *&_vtable() { return *(const void**)((_IO_FILE*)this + 1); }
protected:
static streambuf* _list_all;
_IO_FILE*& xchain() { return _chain; }
void _un_link();
void _link_in();
char* gptr() const
{ return _flags & 0x100 ? _IO_save_base : _IO_read_ptr; }
char* pptr() const { return _IO_write_ptr; }
char* egptr() const
{ return _flags & 0x100 ? _IO_save_end : _IO_read_end; }
char* epptr() const { return _IO_write_end; }
char* pbase() const { return _IO_write_base; }
char* eback() const
{ return _flags & 0x100 ? _IO_save_base : _IO_read_base;}
char* base() const { return _IO_buf_base; }
char* ebuf() const { return _IO_buf_end; }
int blen() const { return _IO_buf_end - _IO_buf_base; }
void xput_char(char c) { *_IO_write_ptr++ = c; }
int xflags() { return _flags ; }
int xflags(int f) {int fl = _flags ; _flags = f; return fl;}
void xsetflags(int f) { _flags |= f; }
void xsetflags(int f, int mask)
{ _flags = (_flags & ~mask) | (f & mask); }
void gbump(int n)
{ _flags & 0x100 ? (_IO_save_base+=n):(_IO_read_ptr+=n);}
void pbump(int n) { _IO_write_ptr += n; }
void setb(char* b, char* eb, int a=0);
void setp(char* p, char* ep)
{ _IO_write_base=_IO_write_ptr=p; _IO_write_end=ep; }
void setg(char* eb, char* g, char *eg) {
if (_flags & 0x100 ) _IO_free_backup_area(this);
_IO_read_base = eb; _IO_read_ptr = g; _IO_read_end = eg; }
char *shortbuf() { return _shortbuf; }
int in_backup() { return _flags & 0x100 ; }
char *Gbase() { return in_backup() ? _IO_save_base : _IO_read_base; }
char *eGptr() { return in_backup() ? _IO_save_end : _IO_read_end; }
char *Bbase() { return in_backup() ? _IO_read_base : _IO_save_base; }
char *Bptr() { return _IO_backup_base; }
char *eBptr() { return in_backup() ? _IO_read_end : _IO_save_end; }
char *Nbase() { return _IO_save_base; }
char *eNptr() { return _IO_save_end; }
int have_backup() { return _IO_save_base != __null ; }
int have_markers() { return _markers != __null ; }
void free_backup_area();
void unsave_markers();
int put_mode() { return _flags & 0x800 ; }
int switch_to_get_mode();
streambuf(int flags=0);
public:
static int flush_all();
static void flush_all_linebuffered();
virtual ~streambuf();
virtual int overflow(int c = (-1) );
virtual int underflow();
virtual int uflow();
virtual int pbackfail(int c);
virtual streamsize xsputn(const char* s, streamsize n);
virtual streamsize xsgetn(char* s, streamsize n);
virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out);
streampos pubseekoff(streamoff o, _seek_dir d, int mode=ios::in|ios::out)
{ return _IO_seekoff (this, o, d, mode); }
streampos pubseekpos(streampos pos, int mode = ios::in|ios::out)
{ return _IO_seekpos (this, pos, mode); }
streampos sseekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
streampos sseekpos(streampos pos, int mode = ios::in|ios::out);
virtual streambuf* setbuf(char* p, int len);
virtual int sync();
virtual int doallocate();
int seekmark(streammarker& mark, int delta = 0);
int sputbackc(char c);
int sungetc();
int unbuffered() { return _flags & 2 ? 1 : 0; }
int linebuffered() { return _flags & 0x200 ? 1 : 0; }
void unbuffered(int i)
{ if (i) _flags |= 2 ; else _flags &= ~2 ; }
void linebuffered(int i)
{ if (i) _flags |= 0x200 ; else _flags &= ~0x200 ; }
int allocate() {
if (base() || unbuffered()) return 0;
else return doallocate(); }
void allocbuf() { if (base() == __null ) doallocbuf(); }
void doallocbuf();
int in_avail() { return _IO_read_end - _IO_read_ptr; }
int out_waiting() { return _IO_write_ptr - _IO_write_base; }
streamsize sputn(const char* s, streamsize n) { return xsputn(s, n); }
streamsize padn(char pad, streamsize n) { return _IO_padn(this, pad, n); }
streamsize sgetn(char* s, streamsize n) { return _IO_sgetn(this, s, n); }
int ignore(int);
int get_column();
int set_column(int);
long sgetline(char* buf, size_t n, char delim, int putback_delim);
int sputc(int c) { return _IO_putc ( c , this ) ; }
int sbumpc() { return _IO_getc ( this ) ; }
int sgetc() { return _IO_peekc_locked ( this ) ; }
int snextc() {
if (_IO_read_ptr >= _IO_read_end && __underflow(this) == (-1) )
return (-1) ;
else return _IO_read_ptr++, sgetc(); }
void stossc() { if (_IO_read_ptr < _IO_read_end) _IO_read_ptr++; }
int vscan(char const *fmt0, __gnuc_va_list ap, ios* stream = __null );
int scan(char const *fmt0 ...);
int vform(char const *fmt0, __gnuc_va_list ap);
int form(char const *fmt0 ...);
virtual streamsize sys_read(char* buf, streamsize size);
virtual streamsize sys_write(const char*, streamsize);
virtual streampos sys_seek(streamoff, _seek_dir);
virtual int sys_close();
virtual int sys_stat(void*);
};
class filebuf : public streambuf {
protected:
void init();
public:
static const int openprot;
filebuf();
filebuf(int fd);
filebuf(int fd, char* p, int len);
~filebuf();
filebuf* attach(int fd);
filebuf* open(const char *filename, const char *mode);
filebuf* open(const char *filename, ios::openmode mode, int prot = 0664);
virtual int underflow();
virtual int overflow(int c = (-1) );
int is_open() const { return _fileno >= 0; }
int fd() const { return is_open() ? _fileno : (-1) ; }
filebuf* close();
virtual int doallocate();
virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
virtual streambuf* setbuf(char* p, int len);
streamsize xsputn(const char* s, streamsize n);
streamsize xsgetn(char* s, streamsize n);
virtual int sync();
protected:
int is_reading() { return eback() != egptr(); }
char* cur_ptr() { return is_reading() ? gptr() : pptr(); }
char* file_ptr() { return eGptr(); }
virtual streamsize sys_read(char* buf, streamsize size);
virtual streampos sys_seek(streamoff, _seek_dir);
virtual streamsize sys_write(const char*, streamsize);
virtual int sys_stat(void*);
virtual int sys_close();
};
inline void ios::init(streambuf* sb, ostream* tie_to) {
_state = sb ? ios::goodbit : ios::badbit; _exceptions=0;
_strbuf=sb; _tie = tie_to; _width=0; _fill=' ';
_flags=ios::skipws|ios::dec;
_precision=6; _arrays = 0; }
inline ios::ios(streambuf* sb, ostream* tie_to) { init(sb, tie_to); }
inline ios::~ios() {
if (_arrays) delete [] _arrays;
}
}
# 31 "/usr/include/g++/iostream.h" 2 3
extern "C++" {
class istream; class ostream;
typedef ios& (*__manip)(ios&);
typedef istream& (*__imanip)(istream&);
typedef ostream& (*__omanip)(ostream&);
extern istream& ws(istream& ins);
extern ostream& flush(ostream& outs);
extern ostream& endl(ostream& outs);
extern ostream& ends(ostream& outs);
class ostream : virtual public ios
{
void do_osfx();
public:
ostream() { }
ostream(streambuf* sb, ostream* tied= __null );
int opfx() {
if (!good()) return 0;
else { if (_tie) _tie->flush(); ; return 1;} }
void osfx() { ;
if (flags() & (ios::unitbuf|ios::stdio))
do_osfx(); }
ostream& flush();
ostream& put(char c) { _strbuf->sputc(c); return *this; }
ostream& write(const char *s, streamsize n);
ostream& write(const unsigned char *s, streamsize n)
{ return write((const char*)s, n);}
ostream& write(const signed char *s, streamsize n)
{ return write((const char*)s, n);}
ostream& write(const void *s, streamsize n)
{ return write((const char*)s, n);}
ostream& seekp(streampos);
ostream& seekp(streamoff, _seek_dir);
streampos tellp();
ostream& form(const char *format ...);
ostream& vform(const char *format, __gnuc_va_list args);
ostream& operator<<(char c);
ostream& operator<<(unsigned char c) { return (*this) << (char)c; }
ostream& operator<<(signed char c) { return (*this) << (char)c; }
ostream& operator<<(const char *s);
ostream& operator<<(const unsigned char *s)
{ return (*this) << (const char*)s; }
ostream& operator<<(const signed char *s)
{ return (*this) << (const char*)s; }
ostream& operator<<(const void *p);
ostream& operator<<(int n);
ostream& operator<<(unsigned int n);
ostream& operator<<(long n);
ostream& operator<<(unsigned long n);
__extension__ ostream& operator<<(long long n);
__extension__ ostream& operator<<(unsigned long long n);
ostream& operator<<(short n) {return operator<<((int)n);}
ostream& operator<<(unsigned short n) {return operator<<((unsigned int)n);}
ostream& operator<<(bool b) { return operator<<((int)b); }
ostream& operator<<(double n);
ostream& operator<<(float n) { return operator<<((double)n); }
ostream& operator<<(long double n);
ostream& operator<<(__omanip func) { return (*func)(*this); }
ostream& operator<<(__manip func) {(*func)(*this); return *this;}
ostream& operator<<(streambuf*);
};
class istream : virtual public ios
{
protected:
size_t _gcount;
int _skip_ws();
public:
istream(): _gcount (0) { }
istream(streambuf* sb, ostream*tied= __null );
istream& get(char* ptr, int len, char delim = '\n');
istream& get(unsigned char* ptr, int len, char delim = '\n')
{ return get((char*)ptr, len, delim); }
istream& get(char& c);
istream& get(unsigned char& c) { return get((char&)c); }
istream& getline(char* ptr, int len, char delim = '\n');
istream& getline(unsigned char* ptr, int len, char delim = '\n')
{ return getline((char*)ptr, len, delim); }
istream& get(signed char& c) { return get((char&)c); }
istream& get(signed char* ptr, int len, char delim = '\n')
{ return get((char*)ptr, len, delim); }
istream& getline(signed char* ptr, int len, char delim = '\n')
{ return getline((char*)ptr, len, delim); }
istream& read(char *ptr, streamsize n);
istream& read(unsigned char *ptr, streamsize n)
{ return read((char*)ptr, n); }
istream& read(signed char *ptr, streamsize n)
{ return read((char*)ptr, n); }
istream& read(void *ptr, streamsize n)
{ return read((char*)ptr, n); }
istream& get(streambuf& sb, char delim = '\n');
istream& gets(char **s, char delim = '\n');
int ipfx(int need = 0) {
if (!good()) { set(ios::failbit); return 0; }
else {
;
if (_tie && (need == 0 || rdbuf()->in_avail() < need)) _tie->flush();
if (!need && (flags() & ios::skipws)) return _skip_ws();
else return 1;
}
}
int ipfx0() {
if (!good()) { set(ios::failbit); return 0; }
else {
;
if (_tie) _tie->flush();
if (flags() & ios::skipws) return _skip_ws();
else return 1;
}
}
int ipfx1() {
if (!good()) { set(ios::failbit); return 0; }
else {
;
if (_tie && rdbuf()->in_avail() == 0) _tie->flush();
return 1;
}
}
void isfx() { ; }
int get() { if (!ipfx1()) return (-1) ;
else { int ch = _strbuf->sbumpc();
if (ch == (-1) ) set(ios::eofbit);
return ch;
} }
int peek();
size_t gcount() { return _gcount; }
istream& ignore(int n=1, int delim = (-1) );
int sync ();
istream& seekg(streampos);
istream& seekg(streamoff, _seek_dir);
streampos tellg();
istream& putback(char ch) {
if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit);
return *this;}
istream& unget() {
if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit);
return *this;}
istream& scan(const char *format ...);
istream& vscan(const char *format, __gnuc_va_list args);
istream& operator>>(char*);
istream& operator>>(unsigned char* p) { return operator>>((char*)p); }
istream& operator>>(signed char*p) { return operator>>((char*)p); }
istream& operator>>(char& c);
istream& operator>>(unsigned char& c) {return operator>>((char&)c);}
istream& operator>>(signed char& c) {return operator>>((char&)c);}
istream& operator>>(int&);
istream& operator>>(long&);
__extension__ istream& operator>>(long long&);
__extension__ istream& operator>>(unsigned long long&);
istream& operator>>(short&);
istream& operator>>(unsigned int&);
istream& operator>>(unsigned long&);
istream& operator>>(unsigned short&);
istream& operator>>(bool&);
istream& operator>>(float&);
istream& operator>>(double&);
istream& operator>>(long double&);
istream& operator>>( __manip func) {(*func)(*this); return *this;}
istream& operator>>(__imanip func) { return (*func)(*this); }
istream& operator>>(streambuf*);
};
class iostream : public istream, public ostream
{
public:
iostream() { }
iostream(streambuf* sb, ostream*tied= __null );
};
class _IO_istream_withassign : public istream {
public:
_IO_istream_withassign& operator=(istream&);
_IO_istream_withassign& operator=(_IO_istream_withassign& rhs)
{ return operator= (static_cast<istream&> (rhs)); }
};
class _IO_ostream_withassign : public ostream {
public:
_IO_ostream_withassign& operator=(ostream&);
_IO_ostream_withassign& operator=(_IO_ostream_withassign& rhs)
{ return operator= (static_cast<ostream&> (rhs)); }
};
extern _IO_istream_withassign cin;
extern _IO_ostream_withassign cout, cerr;
extern _IO_ostream_withassign clog
;
extern istream& lock(istream& ins);
extern istream& unlock(istream& ins);
extern ostream& lock(ostream& outs);
extern ostream& unlock(ostream& outs);
struct Iostream_init { } ;
inline ios& dec(ios& i)
{ i.setf(ios::dec, ios::dec|ios::hex|ios::oct); return i; }
inline ios& hex(ios& i)
{ i.setf(ios::hex, ios::dec|ios::hex|ios::oct); return i; }
inline ios& oct(ios& i)
{ i.setf(ios::oct, ios::dec|ios::hex|ios::oct); return i; }
}
# 30 "/usr/include/g++/fstream.h" 2 3
extern "C++" {
class fstreambase : virtual public ios {
mutable filebuf __my_fb;
void __fb_init ();
public:
fstreambase();
fstreambase(int fd);
fstreambase(int fd, char *p, int l);
fstreambase(const char *name, int mode, int prot=0664);
void close();
filebuf* rdbuf() const { return &__my_fb; }
void open(const char *name, int mode, int prot=0664);
int is_open() const { return rdbuf()->is_open(); }
void setbuf(char *ptr, int len) { rdbuf()->setbuf(ptr, len); }
void attach(int fd);
};
class ifstream : public fstreambase, public istream {
public:
ifstream() : fstreambase() { }
ifstream(int fd) : fstreambase(fd) { }
ifstream(int fd, char *p, int l) : fstreambase(fd, p, l) { }
ifstream(const char *name, int mode=ios::in, int prot=0664)
: fstreambase(name, mode, prot) { }
void open(const char *name, int mode=ios::in, int prot=0664)
{ fstreambase::open(name, mode, prot); }
};
class ofstream : public fstreambase, public ostream {
public:
ofstream() : fstreambase() { }
ofstream(int fd) : fstreambase(fd) { }
ofstream(int fd, char *p, int l) : fstreambase(fd, p, l) { }
ofstream(const char *name, int mode=ios::out, int prot=0664)
: fstreambase(name, mode, prot) { }
void open(const char *name, int mode=ios::out, int prot=0664)
{ fstreambase::open(name, mode, prot); }
};
class fstream : public fstreambase, public iostream {
public:
fstream() : fstreambase() { }
fstream(int fd) : fstreambase(fd) { }
fstream(const char *name, int mode, int prot=0664)
: fstreambase(name, mode, prot) { }
fstream(int fd, char *p, int l) : fstreambase(fd, p, l) { }
void open(const char *name, int mode, int prot=0664)
{ fstreambase::open(name, mode, prot); }
};
}
# 1 "histogram.hh" 2
class Histogram {
public:
Histogram (double start=0, double end=700, int bins=100);
~Histogram () {delete [] data;};
int bin (double value);
void put (double value) {if (data!=0) data[1+bin (value)]++;};
int bins () const {return bin_number;};
int count (int bin) const;
Histogram& operator= (const Histogram& other);
friend istream& operator>> (istream& is, Histogram& hist);
friend ostream& operator<< (ostream& os, const Histogram& hist);
private:
double start_value, end_value, bin_width;
int bin_number;
int *data;
};
# 7 "sep.cc" 2
# 1 "event.hh" 1
class Event {
public:
Event (int q1t=0, int q1l=0, int q2t=0, int q2c=0, int td=0)
{q1_total=q1t; q1_tail=q1l; q2_total=q2t; q2_cfd=q2c; tdc_value=td;};
int q1tot () const {return q1_total;};
int q1tail () const {return q1_tail;};
int q2tot () const {return q2_total;};
int q2cfd () const {return q2_cfd;};
int tdc () const {return tdc_value;};
friend istream& operator>> (istream& is, Event& ev);
private:
int q1_total, q1_tail, q2_total, q2_cfd, tdc_value;
};
# 8 "sep.cc" 2
class AllHists {
public:
AllHists (double start=0, double end=2048, int bins=100,
double a=0, double b=0);
void put (Event& ev);
friend ostream& operator<< (ostream& os, const AllHists& hists);
private:
enum Type {electron, neutron};
Type id (Event& ev);
Histogram electron_hist[2], neutron_hist[2], separation (-500, 500, 100);
double a, b;
};
AllHists::AllHists (double start, double end, int bins,
double aa, double bb)
{
electron_hist[0]=Histogram (start, end, bins);
electron_hist[1]=Histogram (start, end, bins);
neutron_hist[0]=Histogram (start, end, bins);
neutron_hist[1]=Histogram (start, end, bins);
a=aa; b=bb;
}
void
AllHists::put (Event& ev)
{
Histogram *particle;
switch (id (ev))
{
case electron:
particle=electron_hist;
break;
case neutron:
particle=neutron_hist;
break;
default:
exit (1);
}
particle[0].put (ev.q1tot ());
particle[1].put (ev.tdc ());
}
AllHists::Type
AllHists::id (Event& ev)
{
double diff;
diff=ev.q1tail () - (a*ev.q1tot ()+b);
separation.put (diff);
if (diff>0)
return electron;
else
return neutron;
}
ostream&
operator<< (ostream& os, const AllHists& hists)
{
os<<hists.electron_hist[0]
<<endl<<endl<<hists.electron_hist[1]
<<endl<<endl<<hists.neutron_hist[0]
<<endl<<endl<<hists.neutron_hist[1]
<<endl<<endl<<separation;
return os;
}
int
main (int argc, const char * const * argv)
{
Event ev;
AllHists *hists=0;
if (argc!=3)
return 2;
hists=new AllHists (0, 2048, 100, atof (argv[1]), atof (argv[2]));
if (hists==0)
return 1;
while (cin>>ev)
hists->put (ev);
cout<<*hists;
delete hists;
return 0;
}