home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-11-17 | 55.2 KB | 3,711 lines |
- Newsgroups: gnu.g++.bug
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!umn.edu!spool.mu.edu!caen!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!idiap.CH!tmb
- From: tmb@idiap.CH (Thomas M. Breuel)
- Subject: GNU C++ 2.3.1 crash
- Message-ID: <9211170302.AA09453@idiap.ch>
- Sender: gnulists@ai.mit.edu
- Reply-To: tmb@idiap.ch
- Organization: GNUs Not Usenet
- Distribution: gnu
- Date: Tue, 17 Nov 1992 05:02:07 GMT
- Approved: bug-g++@prep.ai.mit.edu
- Lines: 3697
-
- arolla$ ngcc -v -c bar.cc
- Reading specs from /sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/specs
- gcc version 2.3.1
- /sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix bar.cc /local/tmp/cca19293.i
- GNU CPP version 2.3.1 (sparc)
- /sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/cc1plus /local/tmp/cca19293.i -quiet -dumpbase bar.cc -version -o /local/tmp/cca19293.s
- GNU C++ version 2.3.1 (sparc) compiled by GNU C version 2.3.1.
- ngcc: Internal compiler error: program cc1plus got fatal signal 11
- arolla$
-
- ================================================================
- # 1 "foo.cc"
- # 1 "/sym/gnu/lib/g++-include/stream.h" 1 3
-
-
-
-
-
-
- # 1 "/sym/gnu/lib/g++-include/iostream.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #pragma interface
-
-
-
-
- # 1 "/sym/gnu/lib/g++-include/streambuf.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #pragma interface
-
-
- # 1 "/sym/gnu/lib/g++-include/_G_config.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 23 "/sym/gnu/lib/g++-include/streambuf.h" 2 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- class ostream; class streambuf; class backupbuf;
-
-
-
-
-
- extern "C" int __underflow(streambuf*);
- extern "C" int __overflow(streambuf*, int);
-
- typedef long streamoff;
- typedef long streampos;
-
- typedef unsigned long __fmtflags;
- typedef unsigned char __iostate;
-
- struct _ios_fields {
- streambuf *_strbuf;
- ostream* _tie;
- int _width;
- __fmtflags _flags;
- char _fill;
- __iostate _state;
- unsigned short _precision;
- };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- enum state_value {
- _good = 0 ,
- _eof = 1 ,
- _fail = 2 ,
- _bad = 4 };
- enum open_mode {
- input = 1 ,
- output = 2 ,
- atend = 4 ,
- append = 8 };
-
-
- class ios : public _ios_fields {
- public:
- typedef __fmtflags fmtflags;
- typedef __iostate iostate;
- 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 };
- enum seek_dir { beg, cur, end};
- 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=0100000, unitbuf=020000, stdio=040000,
- dont_close=0x80000000
- };
-
- ostream* tie() const { return _tie; }
- ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; }
-
-
- char fill() const { return _fill; }
- char fill(char newf) { char 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 & mask;
- _flags &= ~mask; return oldbits; }
- int width() const { return _width; }
- int width(int val) { int save = _width; _width = val; return save; }
-
- static const unsigned long basefield;
- static const unsigned long adjustfield;
- static const unsigned long floatfield;
-
- streambuf* rdbuf() const { return _strbuf; }
- void clear(iostate state = 0) { _state = state; }
- void set(iostate flag) { _state |= flag; }
- 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; }
- int rdstate() const { return _state; }
- operator void*() const { return fail() ? (void*)0 : (void*)(-1); }
- int operator!() const { return fail(); }
-
-
- void unset(state_value flag) { _state &= ~flag; }
- void close();
- int is_open();
- int readable();
- int writable();
-
-
- protected:
- ios(streambuf* sb = 0, ostream* tie = 0);
- ~ios();
- };
-
-
-
-
- typedef ios::seek_dir _seek_dir;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- class streammarker {
- friend class streambuf;
-
-
-
- friend int __underflow(streambuf*);
-
- struct streammarker *_next;
- streambuf *_sbuf;
- streampos _spos;
- void set_streampos(streampos sp) { _spos = sp; }
- void set_offset(int offset) { _pos = offset; _spos = (streampos)(-2); }
-
-
- int _pos;
- public:
- streammarker(streambuf *sb);
- ~streammarker();
- int saving() { return _spos == -2; }
- int delta(streammarker&);
- int delta();
- };
-
- struct __streambuf {
-
- int _flags;
- char* _gptr;
- char* _egptr;
- char* _eback;
- char* _pbase;
- char* _pptr;
- char* _epptr;
- char* _base;
- char* _ebuf;
- struct streambuf *_chain;
-
-
- friend class streammarker;
- char *_other_gbase;
- char *_aux_limit;
- char *_other_egptr;
- streammarker *_markers;
-
-
-
- unsigned short _cur_column;
- char _unused;
- char _shortbuf[1];
- };
-
- extern unsigned __adjust_column(unsigned start, const char *line, int count);
-
- struct streambuf : private __streambuf {
- friend class ios;
- friend class istream;
- friend class ostream;
- friend class streammarker;
-
-
-
- friend int __underflow(streambuf*);
-
- protected:
- static streambuf* _list_all;
- streambuf*& xchain() { return _chain; }
- void _un_link();
- void _link_in();
- char* gptr() const { return _gptr; }
- char* pptr() const { return _pptr; }
- char* egptr() const { return _egptr; }
- char* epptr() const { return _epptr; }
- char* pbase() const { return _pbase; }
- char* eback() const { return _eback; }
- char* ebuf() const { return _ebuf; }
- char* base() const { return _base; }
- void xput_char(char c) { *_pptr++ = 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) { _gptr += n; }
- void pbump(int n) { _pptr += n; }
- void setb(char* b, char* eb, int a=0);
- void setp(char* p, char* ep) { _pbase=_pptr=p; _epptr=ep; }
- void setg(char* eb, char* g, char *eg) { _eback=eb; _gptr=g; _egptr=eg; }
- char *shortbuf() { return _shortbuf; }
-
- int in_backup() { return _flags & 0x100 ; }
-
- char *Gbase() { return in_backup() ? _other_gbase : _eback; }
-
- char *eGptr() { return in_backup() ? _other_egptr : _egptr; }
-
- char *Bbase() { return in_backup() ? _eback : _other_gbase; }
- char *Bptr() { return _aux_limit; }
-
- char *eBptr() { return in_backup() ? _egptr : _other_egptr; }
- char *Nbase() { return _other_gbase; }
- char *eNptr() { return _other_egptr; }
- int have_backup() { return _other_gbase != ((void*)0) ; }
- int have_markers() { return _markers != ((void*)0) ; }
- int _least_marker();
- void switch_to_main_get_area();
- void switch_to_backup_area();
- 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 int underflow() = 0;
- virtual int overflow(int c = (-1) ) = 0;
- virtual int doallocate();
- virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
- virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out);
- int seekmark(streammarker& mark, int delta = 0);
- int sputbackc(char c);
- int sungetc();
- virtual ~streambuf();
- 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() == ((void*)0) ) doallocbuf(); }
- void doallocbuf();
- virtual int sync();
- virtual int pbackfail(int c);
- virtual int ungetfail();
- virtual streambuf* setbuf(char* p, int len);
- int in_avail() { return _egptr - _gptr; }
- int out_waiting() { return _pptr - _pbase; }
- virtual int sputn(const char* s, int n);
- int padn(char pad, int n);
- virtual int sgetn(char* s, int n);
- int ignore(int);
- virtual int get_column();
- virtual int set_column(int);
- long sgetline(char* buf, int n, char delim, int putback_delim);
- int sbumpc() {
- if (_gptr >= _egptr && __underflow(this) == (-1) ) return (-1) ;
- else return *(unsigned char*)_gptr++; }
- int sgetc() {
- if (_gptr >= _egptr && __underflow(this) == (-1) ) return (-1) ;
- else return *(unsigned char*)_gptr; }
- int snextc() {
- if (++_gptr >= _egptr && __underflow(this) == (-1) ) return (-1) ;
- else return *(unsigned char*)_gptr; }
- int sputc(int c) {
- if (_pptr >= _epptr) return __overflow(this, (unsigned char)c);
- return *_pptr++ = c, (unsigned char)c; }
- void stossc() { if (_gptr < _egptr) _gptr++; }
- int vscan(char const *fmt0, char * ap, ios::iostate* = ((void*)0) );
- int vform(char const *fmt0, char * ap);
-
-
-
-
- };
-
-
-
-
-
-
-
-
-
- class backupbuf : public streambuf {
- friend class streammarker;
- protected:
- backupbuf(int flags=0) : streambuf(flags|0x4000 ) { }
- public:
- virtual int pbackfail(int c);
- virtual int underflow();
- virtual int overflow(int c = (-1) );
- };
-
- struct __file_fields {
- short _fileno;
- int _blksize;
- long _offset;
-
- };
-
- class filebuf : public backupbuf {
- protected:
- struct __file_fields _fb;
- void init();
- public:
- 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, int mode, int prot = 0664);
- virtual int underflow();
- virtual int overflow(int c = (-1) );
- int is_open() { return _fb._fileno >= 0; }
- int fd() { return is_open() ? _fb._fileno : (-1) ; }
- filebuf* close();
- virtual int doallocate();
- virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
- int sputn(const char* s, int n);
- int sgetn(char* s, int n);
- virtual int sync();
- protected:
-
- int is_reading() { return eback() != egptr(); }
- char* cur_ptr() { return is_reading() ? gptr() : pptr(); }
-
- char* file_ptr() { return eGptr(); }
- int do_write(const char *data, int to_do);
- int do_flush() { return do_write(_pbase, _pptr-_pbase); }
-
- virtual int sys_read(char* buf, int size);
- virtual long sys_seek(long , _seek_dir);
- virtual int sys_write(const void*, long);
- virtual int sys_stat(void*);
- virtual int sys_close();
- };
-
-
- inline int ios::readable() { return !(rdbuf()->_flags & 4 ); }
- inline int ios::writable() { return !(rdbuf()->_flags & 8 ); }
- inline int ios::is_open() { return (rdbuf()->_flags & 4 +8 )
- != 4 +8 ; }
-
- inline ios::ios(streambuf* sb , ostream* tie ) {
- _tie = tie; _strbuf=sb; _state=0; _width=0; _fill=' ';
- _flags=ios::skipws; _precision=6; }
- inline ios::~ios() {
- if (!(_flags & (unsigned int)ios::dont_close)) delete _strbuf; }
-
-
- # 25 "/sym/gnu/lib/g++-include/iostream.h" 2 3
-
-
- 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 : public ios
- {
- void do_osfx();
- public:
- ostream() { }
- ostream(streambuf* sb, ostream* tied=((void*)0) );
- int opfx() { if (!good()) return 0; if (_tie) _tie->flush(); return 1; }
- void osfx() { if (flags() & (ios::unitbuf|ios::stdio))
- do_osfx(); }
- streambuf* ostreambuf() const { return _strbuf; }
- ostream& flush();
- ostream& put(char c) { _strbuf->sputc(c); return *this; }
-
- ostream& write(const char *s, int n);
- ostream& write(const unsigned char *s, int n) { return write((const char*)s, n);}
-
- ostream& write(const signed char *s, int n) { return write((const char*)s, n);}
-
- ostream& write(const void *s, int 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, char * args);
- };
-
- extern ostream& operator<<(ostream&, char c);
- inline ostream& operator<<(ostream& os, unsigned char c)
- { return os << (char)c; }
-
- extern ostream& operator<<(ostream &os, signed char c) { return os << (char)c;}
-
- extern ostream& operator<<(ostream&, const char *s);
- inline ostream& operator<<(ostream& os, const unsigned char *s)
- { return os << (const char*)s; }
-
- inline ostream& operator<<(ostream& os, const signed char *s)
- { return os << (const char*)s; }
-
- extern ostream& operator<<(ostream&, void *p);
- extern ostream& operator<<(ostream&, int n);
- extern ostream& operator<<(ostream&, long n);
- extern ostream& operator<<(ostream&, unsigned int n);
- extern ostream& operator<<(ostream&, unsigned long n);
- inline ostream& operator<<(ostream& os, short n) {return os << (int)n;}
- inline ostream& operator<<(ostream& os, unsigned short n)
- {return os << (unsigned int)n;}
- extern ostream& operator<<(ostream&, float n);
- extern ostream& operator<<(ostream&, double n);
- inline ostream& operator<<(ostream& os, __omanip func) { return (*func)(os); }
- inline ostream& operator<<(ostream& os, __manip func) {(*func)(os); return os;}
- extern ostream& operator<<(ostream&, streambuf*);
-
- class istream : public ios
- {
- int _gcount;
-
- int _skip_ws();
- public:
- istream() { _gcount = 0; }
- istream(streambuf* sb, ostream*tied=((void*)0) );
- streambuf* istreambuf() const { return _strbuf; }
- istream& get(char& c);
- istream& get(unsigned char& c) { return get((char&)c); }
-
- istream& get(signed char& c) { return get((char&)c); }
-
- istream& read(char *ptr, int n);
- istream& read(unsigned char *ptr, int n) { return read((char*)ptr, n); }
-
- istream& read(signed char *ptr, int n) { return read((char*)ptr, n); }
-
- istream& read(void *ptr, int n) { return read((char*)ptr, n); }
-
- istream& getline(char* ptr, int len, char delim = '\n');
- istream& get(char* ptr, int len, char delim = '\n');
- istream& get(streambuf& sb, char delim = '\n');
- istream& gets(char **s, char delim = '\n');
- int ipfx(int need) {
- if (!good()) { set(ios::failbit); return 0; }
- if (_tie && (need == 0 || rdbuf()->in_avail() < need)) _tie->flush();
- if (!need && (flags() & ios::skipws)) return _skip_ws();
- return 1;
- }
- int ipfx0() {
- if (!good()) { set(ios::failbit); return 0; }
- if (_tie) _tie->flush();
- if (flags() & ios::skipws) return _skip_ws();
- return 1;
- }
- int ipfx1() {
- if (!good()) { set(ios::failbit); return 0; }
- if (_tie && rdbuf()->in_avail() == 0) _tie->flush();
- return 1;
- }
- int get() { if (!ipfx1()) return (-1) ;
- int ch = _strbuf->sbumpc();
- if (ch == (-1) ) set(ios::eofbit);
- return ch; }
- int peek() { if (!ipfx1()) return (-1) ;
- int ch = _strbuf->sgetc();
- if (ch == (-1) ) set(ios::eofbit);
- return ch; }
- int gcount() { return _gcount; }
- istream& ignore(int n=1, int delim = (-1) );
- 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, char * args);
-
- istream& unget(char ch) { return putback(ch); }
- int skip(int i);
-
- };
-
- extern istream& operator>>(istream&, char*);
- inline istream& operator>>(istream& is, unsigned char* p)
- { return is >> (char*)p; }
-
- inline istream& operator>>(istream& is, signed char*p) {return is >> (char*)p;}
-
- extern istream& operator>>(istream&, char& c);
- extern istream& operator>>(istream& s, unsigned char& c) {return s>>(char&)c;}
-
- extern istream& operator>>(istream& s, signed char& c) {return s >> (char&)c;}
-
- extern istream& operator>>(istream&, int&);
- extern istream& operator>>(istream&, long&);
- extern istream& operator>>(istream&, short&);
- extern istream& operator>>(istream&, unsigned int&);
- extern istream& operator>>(istream&, unsigned long&);
- extern istream& operator>>(istream&, unsigned short&);
- extern istream& operator>>(istream&, float&);
- extern istream& operator>>(istream&, double&);
- inline istream& operator>>(istream& is, __manip func) {(*func)(is); return is;}
- inline istream& operator>>(istream& is, __imanip func) { return (*func)(is); }
- extern istream& operator>>(istream&, streambuf*);
-
- class iostream : public ios {
- int _gcount;
- public:
- iostream() { _gcount = 0; }
- iostream(streambuf* sb, ostream*tied=((void*)0) );
- operator istream&() { return *(istream*)this; }
- operator ostream&() { return *(ostream*)this; }
-
- istream& get(char& c) { return ((istream*)this)->get(c); }
- istream& get(unsigned char& c) { return ((istream*)this)->get((char&)c); }
-
- istream& get(signed char& c) { return ((istream*)this)->get((char&)c); }
-
- istream& read(char *ptr, int n) { return ((istream*)this)->read(ptr, n); }
- istream& read(unsigned char *ptr, int n)
- { return ((istream*)this)->read((char*)ptr, n); }
-
- istream& read(signed char *ptr, int n)
- { return ((istream*)this)->read((char*)ptr, n); }
-
- istream& read(void *ptr, int n)
- { return ((istream*)this)->read((char*)ptr, n); }
- istream& getline(char* ptr, int len, char delim = '\n')
- { return ((istream*)this)->getline(ptr, len, delim); }
- istream& get(char* ptr, int len, char delim = '\n')
- { return ((istream*)this)->get(ptr, len, delim); }
- istream& gets(char **s, char delim = '\n')
- { return ((istream*)this)->gets(s, delim); }
- istream& ignore(int n=1, int delim = (-1) )
- { return ((istream*)this)->ignore(n, delim); }
- int ipfx(int need) { return ((istream*)this)->ipfx(need); }
- int ipfx0() { return ((istream*)this)->ipfx0(); }
- int ipfx1() { return ((istream*)this)->ipfx1(); }
- int get() { return _strbuf->sbumpc(); }
- int peek() { return ipfx1() ? _strbuf->sgetc() : (-1) ; }
- int gcount() { return _gcount; }
- istream& putback(char ch) { return ((istream*)this)->putback(ch); }
- istream& unget() { return ((istream*)this)->unget(); }
- istream& seekg(streampos pos) { return ((istream*)this)->seekg(pos); }
- istream& seekg(streamoff off, _seek_dir dir)
- { return ((istream*)this)->seekg(off, dir); }
- streampos tellg() { return ((istream*)this)->tellg(); }
- istream& scan(const char *format ...);
- istream& vscan(const char *format, char * args)
- { return ((istream*)this)->vscan(format, args); }
-
- istream& unget(char ch) { return putback(ch); }
-
-
-
- int opfx() { return ((ostream*)this)->opfx(); }
- void osfx() { ((ostream*)this)->osfx(); }
- ostream& flush() { return ((ostream*)this)->flush(); }
- ostream& put(char c) { return ((ostream*)this)->put(c); }
- ostream& write(const char *s, int n)
- { return ((ostream*)this)->write(s, n); }
- ostream& write(const unsigned char *s, int n)
- { return ((ostream*)this)->write((const char*)s, n); }
-
- ostream& write(const signed char *s, int n)
- { return ((ostream*)this)->write((const char*)s, n); }
-
- ostream& write(const void *s, int n)
- { return ((ostream*)this)->write((const char*)s, n); }
- ostream& form(const char *format ...);
- ostream& vform(const char *format, char * args)
- { return ((ostream*)this)->vform(format, args); }
- ostream& seekp(streampos pos) { return ((ostream*)this)->seekp(pos); }
- ostream& seekp(streamoff off, _seek_dir dir)
- { return ((ostream*)this)->seekp(off, dir); }
- streampos tellp() { return ((ostream*)this)->tellp(); }
- };
-
- extern istream cin;
- extern ostream cout, cerr, clog;
-
- 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; }
-
-
- # 7 "/sym/gnu/lib/g++-include/stream.h" 2 3
-
-
- extern char* form(const char*, ...);
-
- extern char* dec(long, int=0);
- extern char* dec(int, int=0);
- extern char* dec(unsigned long, int=0);
- extern char* dec(unsigned int, int=0);
-
- extern char* hex(long, int=0);
- extern char* hex(int, int=0);
- extern char* hex(unsigned long, int=0);
- extern char* hex(unsigned int, int=0);
-
- extern char* oct(long, int=0);
- extern char* oct(int, int=0);
- extern char* oct(unsigned long, int=0);
- extern char* oct(unsigned int, int=0);
-
- inline istream& WS(istream& str) { return ws(str); }
-
-
- # 1 "foo.cc" 2
-
-
- extern "C" {
- # 1 "winlib.h" 1
-
-
-
-
-
-
-
-
-
- extern int wininit ( void );
- extern int winid ( int n );
- extern int winsetcolor ( int n, char *name );
- extern int winsetgrey ( int n, double v );
- extern int winsetwidth ( int n, int w );
- extern int winsetfont ( int n, char *s );
- extern int winmake ( int n, char *name, int w, int h );
- extern int winflush ( void );
- extern int winsynchronize ( int onoff );
- extern int winsync ( void );
- extern int winclear ( int n );
- extern int winpoint ( int n, int x, int y );
- extern int winline ( int n, int x0, int y0, int x1, int y1 );
- extern int winrect ( int n, int x0, int y0, int x1, int y1 );
- extern int winfrect ( int n, int x0, int y0, int x1, int y1 );
- extern int winpoly ( int n, struct Points *points, int r );
- extern int wintext ( int n, int x, int y, char *s );
- extern int winlabel ( int n, int x, int y, char *s );
- extern int winbclick ( int n, int *b, int *x, int *y );
- extern int winclick ( int n, int *x, int *y );
- extern int wininput ( int n, int *b, int *x, int *y, char **s );
- extern int windiscardinput ( int n );
- extern int wingetline ( int n, int *b, int *x0, int *y0, int *x1, int *y1 );
- extern int wingetrect ( int n, int *b, int *x0, int *y0, int *x1, int *y1 );
- extern int wingetpoly ( int n, int *b, int *xs, int *ys, int *m );
- extern int winfidraw ( int n, int wx, int wy, float **data, int w, int h, int x, int y );
- extern int winucidraw ( int n, int wx, int wy, unsigned char **data, int w, int h, int x, int y );
- extern int winbipaint ( int n, unsigned char **image, int w, int h, int x, int y );
-
- # 70 "winlib.h"
-
-
- # 4 "foo.cc" 2
-
- }
-
- # 1 "Art.h" 1
-
-
-
-
-
-
- extern "C" { void abort(); }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- template <class T>
- class Art {
- protected:
- int mark_temp;
- T *data;
- int dims[1];
- void constructor(int d) {
- if(d<0) abort() ;
- mark_temp=0;
- dims[0]=d;
- if(d>0) {
- data=new T[d];
- if(!data) abort() ;
- } else data=0;
-
- }
- void destructor() {
- if(!data) return;
- delete [] data;
- mark_temp=0;
- data=0;
- dims[0]=0;
- }
- void copy(Art &other) {
- int d0=dims[0]<?other.dims[0];
- for(int i=0;i<d0;i++) data[i]=other.data[i];
- }
- public:
- void copyclear(Art &other) {
- dims[0]=other.dims[0];
- data=other.data;
- other.dims[0]=0;
- other.data=0;
- }
- private:
- void copyconstructor(Art &other) {
- mark_temp=0;
- if(other.mark_temp) {
- copyclear(other);
- } else {
- constructor(other.dims[0]);
- copy(other);
- }
- }
- public:
- Art() {constructor(0);}
- Art(int d) {constructor(d);}
- Art(Art &other) {copyconstructor(other);}
- ~Art() {destructor();}
-
- Art &operator=(Art &other) {
- destructor();
- copyconstructor(other);
- return *this;
- }
- int dim(int i) {return dims[i];}
- T &operator()(int i) {
- if(unsigned(i)>=unsigned(dims[0])) abort() ;
- return data[i];
- }
- T &sub(int i) {return data[i];}
- void resize(int nd) {
- if(nd<0) abort() ;
- Art t(nd);
- int limit=nd<?dims[0];
- for(int i=0;i<limit;i++) t.data[i]=data[i];
- t.mark_temp=1;
- *this=t;
- }
- Art &temp() { mark_temp=1; return *this; }
- T *pointer() {return data;}
- void fill(T value) {for(int i=0;i<dims[0];i++) data[i]=value;}
-
- int length() {return dims[0];}
- T &operator[](int i) {return operator()(i);}
- };
-
-
-
-
-
-
-
-
- template <class T>
- class Stk {
- protected:
- Art<T> stack;
- int fill;
- public:
- Stk() {stack.resize(4); fill=0;}
- Stk(Stk &other) {
- stack=other.stack;
- fill=other.fill;
- }
- int dim(int i) {return stack.dim(i);}
- void push(T &element) {
- if(fill>=stack.dim(0)) stack.resize(2*fill);
- stack.sub(fill++)=element;
- }
- T &tos() {
- return stack(fill-1);
- }
- T &pop() {
- return stack(--fill);
- }
- T &operator()(int i) {return stack(i);}
- T &sub(int i) {return stack.sub(i);}
- void clear() {
- stack.resize(0);
- stack.resize(4);
- fill=0;
- }
- void compact() {
- stack.resize(fill+1);
- }
- Stk temp() { stack.temp(); return *this; }
- T *pointer() {return stack.pointer();}
- operator Art<T>&() {return stack;}
-
- int length() {return fill;}
- T &operator[](int i) {return operator()(i);}
- };
-
-
-
-
-
- template <class T>
- class Art2 {
- protected:
- int mark_temp;
- T **data;
- int dims[2];
- int total_length;
- void constructor(int d0,int d1) {
- if(d0<0||d1<0) abort() ;
- mark_temp=0;
- dims[0]=d0;
- dims[1]=d1;
- total_length=dims[0]*dims[1];
- if(d0>0) {
- data=new T*[d0];
- if(!data) abort() ;
- } else data=0;
- if(d0>0&&d1>0) {
- T *p=new T[d0*d1];
- if(!p) abort() ;
- for(int i=0;i<d0;i++) data[i]=p+i*d1;
-
- }
- }
- void destructor() {
- if(dims[0]<1) return;
- if(!data) return;
- delete [] data[0];
- delete [] data;
- mark_temp=0;
- data=0;
- dims[0]=0;
- dims[1]=0;
- }
- void copy(Art2 &other) {
- int d0=dims[0]<?other.dims[0];
- int d1=dims[1]<?other.dims[1];
- for(int i=0;i<d0;i++) for(int j=0;j<d1;j++)
- data[i][j]=other.data[i][j];
- }
- public:
- void copyclear(Art2 &other) {
- dims[0]=other.dims[0];
- dims[1]=other.dims[1];
- total_length=dims[0]*dims[1];
- data=other.data;
- other.dims[0]=0;
- other.dims[1]=0;
- other.total_length=0;
- other.data=0;
- }
- private:
- void copyconstructor(Art2 &other) {
- mark_temp=0;
- if(other.mark_temp) {
- copyclear(other);
- } else {
- constructor(other.dims[0],other.dims[1]);
- copy(other);
- }
- }
- public:
- Art2() {constructor(0,0);}
- Art2(int d0,int d1) {constructor(d0,d1);}
- Art2(Art2 &other) {copyconstructor(other);}
- ~Art2() {destructor();}
-
- Art2 &operator=(Art2 &other) {
- destructor();
- copyconstructor(other);
- return *this;
- }
- int dim(int i) {return dims[i];}
- T &operator()(int i,int j) {
- if(unsigned(i)>=unsigned(dims[0])||unsigned(j)>=unsigned(dims[1]))
- abort() ;
- return data[i][j];
- }
- T &sub(int i,int j) {return data[i][j];}
- void resize(int nd0,int nd1) {
- if(nd0<0||nd1<0) abort() ;
- Art2 t(nd0,nd1);
- int limit0=nd0<?dims[0];
- int limit1=nd1<?dims[1];
- for(int i=0;i<limit0;i++) for(int j=0;j<limit1;j++) t.data[i][j]=data[i][j];
- t.mark_temp=1;
- *this=t;
- }
- Art2 &temp() { mark_temp=1; return *this; }
- T **pointer() {return data;}
- void fill(T value) {
- for(int i=0;i<dims[0];i++) for(int j=0;j<dims[1];j++)
- data[i][j]=value;
- }
-
-
-
- int length() {return total_length;}
- T &sub(int i) {return data[0][i];}
- T &operator()(int i) {
- if(unsigned(i)>=total_length) abort() ;
- return data[0][i];
- }
- };
-
- template <class T>
- inline void art_swap(T &x,T &y) {
- T temp = x;
- x = y;
- y = temp;
- }
-
- template <class T>
- inline void reverse(Art<T> &a) {
- int i;
- for(i=a.length()/2;i>=0;i--) art_swap(a.sub(i),a.sub(a.length()-i-1));
- }
-
- template <class T>
- inline void reverse(Stk<T> &a) {
- reverse(a.stack);
- }
-
- template <class T>
- inline void bag_remove(Stk<T> &a,T &element) {
- for(int i=0;i<a.length()-1;i++) {
- if(a(i)==element) {
- a.sub(i)=a.tos();
- a.pop();
- }
- }
- if(i<a.length()&&a.sub(i)==element) a.pop();
- }
-
- template <class T>
- inline void ordered_remove(Stk<T> &a,T &element) {
- int source=0,dest=0;
- while(source<a.length()) {
- if(a(source)!=element) {
- a(dest)=a(source);
- dest++;
- }
- source++;
- }
- a.stack.resize(dest);
- }
-
- template <class T>
- inline Art<T> concatenate(Art<T> &a,Art<T> &b) {
- int i,k;
- k=a.length();
- Art<T> result(k+b.length());
- for(i=0;i<a.length();i++) result.sub(i)=a.sub(i);
- for(i=0;i<b.length();i++) result.sub(i+k)=b.sub(i);
- return result.temp();
- }
-
- template <class T>
- inline Stk<T> concatenate(Stk<T> &a,Stk<T> &b) {
- int i;
- Stk<T> result;
- for(i=0;i<a.length();i++) result.push(a.sub(i));
- for(i=0;i<b.length();i++) result.push(b.sub(i));
- return result.temp();
- }
-
-
- # 7 "foo.cc" 2
-
- # 1 "Geo.h" 1
-
-
-
-
-
- # 1 "/sym/gnu/lib/g++-include/math.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #pragma interface
-
-
-
-
-
-
-
-
-
-
-
- # 64 "/sym/gnu/lib/g++-include/math.h" 3
-
- extern "C" {
-
- double acos(double);
- double acosh(double);
- double asin(double);
- double asinh(double);
- double atan(double);
- double atan2(double, double);
- double atanh(double);
- double cbrt(double);
- double ceil(double);
- double copysign(double,double);
- double cos(double);
- double cosh(double);
- double drem(double,double);
- double erf(double);
- double erfc(double);
- double exp(double);
- double expm1(double);
- double fabs(double);
- double finite(double);
- double floor(double);
- double fmod(double, double);
- double frexp(double, int*);
- 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 ldexp(double, int);
- double lgamma(double);
- double log(double);
- double log10(double);
- double log1p(double);
- double logb(double);
- double modf(double, double*);
- double pow(double, double);
- double rint(double);
- double scalb(double, int);
- double sin(double);
- double sinh(double);
- double sqrt(double);
- double tan(double);
- double tanh(double);
- double y0(double);
- double y1(double);
- double yn(int, double);
-
- double aint(double);
- double anint(double);
- int irint(double);
- int nint(double);
- }
-
-
-
-
-
-
-
-
- struct libm_exception
- {
- int type;
- char* name;
- double arg1, arg2, retval;
- };
-
-
-
-
-
-
-
-
- extern "C" int matherr(libm_exception*);
-
-
-
- # 1 "/sym/gnu/lib/g++-include/values.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 57 "/sym/gnu/lib/g++-include/values.h" 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 166 "/sym/gnu/lib/g++-include/values.h" 3
-
-
-
-
-
-
-
-
-
- # 150 "/sym/gnu/lib/g++-include/math.h" 2 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 6 "Geo.h" 2
-
-
- extern "C" {
- void abort();
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- template <class T,int n>
- class vec {
- protected:
- T v[n];
- public:
- int length() {return n;}
- int dim(int) {return n;}
- vec() {}
- vec(T v0) { v[0]=v0; }
- vec(T v0,T v1) { v[0]=v0; v[1]=v1; }
- vec(T v0,T v1,T v2) { v[0]=v0; v[1]=v1; v[2]=v2; }
- vec(T v0,T v1,T v2,T v3) { v[0]=v0; v[1]=v1; v[2]=v2; v[3]=v3; }
- vec(T v0,T v1,T v2,T v3,T v4) { v[0]=v0; v[1]=v1; v[2]=v2; v[3]=v3; v[4]=v4; }
-
- T &operator[](int i) {return v[i];}
- T &sub(int i) {return v[i];}
- T &operator()(int i) {
- if(unsigned(i)>=n) abort();
- return v[i];
- }
-
-
-
-
-
-
-
-
-
-
-
-
- T operator*(vec &other) {
- T result=0;
- for(int i=0;i<n;i++) result=result+sub(i)*other.sub(i);
- return result;
- }
-
-
- vec operator-() {
- vec result;
- for(int i=0;i<n;i++) result.sub(i)= -sub(i);
- return result;
- }
- vec operator*(T other) {
- vec result;
- for(int i=0;i<n;i++) result.sub(i)=sub(i)*other;
- return result;
- }
- vec operator/(T other) {
- vec result;
- for(int i=0;i<n;i++) result.sub(i)=sub(i)/other;
- return result;
- }
- vec operator+(vec &other) {
- vec result;
- for(int i=0;i<n;i++) result.sub(i)=sub(i)+other.sub(i);
- return result;
- }
- vec operator-(vec &other) {
- vec result;
- for(int i=0;i<n;i++) result.sub(i)=sub(i)-other.sub(i);
- return result;
- }
- vec operator<?(vec &other) {
- vec result;
- for(int i=0;i<n;i++) result.sub(i)=sub(i)<?other.sub(i);
- return result;
- }
- vec operator>?(vec &other) {
- vec result;
- for(int i=0;i<n;i++) result.sub(i)=sub(i)>?other.sub(i);
- return result;
- }
-
-
- int operator==(vec &other) {
- for(int i=0;i<n;i++) if(sub(i)!=other.sub(i)) return 0;
- return 1;
- }
- int operator!=(vec &other) {
- for(int i=0;i<n;i++) if(sub(i)!=other.sub(i)) return 1;
- return 0;
- }
- int operator<(vec &other) {
- for(int i=0;i<n;i++) if(sub(i)>=other.sub(i)) return 0;
- return 1;
- }
- int operator>(vec &other) {
- for(int i=0;i<n;i++) if(sub(i)<=other.sub(i)) return 0;
- return 1;
- }
- int operator<=(vec &other) {
- for(int i=0;i<n;i++) if(sub(i)>other.sub(i)) return 0;
- return 1;
- }
- int operator>=(vec &other) {
- for(int i=0;i<n;i++) if(sub(i)<other.sub(i)) return 0;
- return 1;
- }
- };
-
- template <class T>
- inline float euclidean_norm(T &v) {
- float total=0.0;
- for(int i=0;i<v.dim(0);i++) total+=v(i)*v(i);
- return sqrt(total);
- }
-
- template <class T>
- inline float euclidean_distance(T &u,T &v) {
- float total=0.0;
- for(int i=0;i<u.dim(0);i++) {
- float d=u(i)-v(i);
- total+=d*d;
- }
- return sqrt(total);
- }
-
-
-
-
-
- template <class T,int n>
- class mat:vec<T,n*n> {
- protected:
- public:
- int dim(int) {return n;}
- T &operator[](int i) {return v[i];}
- T &sub(int i,int j) {return v[i*n+j];}
- T &operator()(int i,int j) {
- if(unsigned(i)>=n||unsigned(j)>=n) abort();
- return sub(i,j);
- }
- mat operator*(mat &other) {
- mat result;
- for(int i=0;i<n;i++) for(int j=0;j<n;j++) {
- T total=0;
- for(int k=0;k<n;k++) total=total+sub(i,k)*other.sub(k,j);
- result.sub(i,j)=total;
- }
- return result;
- }
- vec<T,n> operator*(vec<T,n> &other) {
- vec<T,n> result;
- for(int i=0;i<n;i++) {
- T total=0;
- for(int k=0;k<n;k++) total=total+sub(i,k)*other.sub(k);
- result.sub(i)=total;
- }
- return result;
- }
- };
-
-
-
-
-
- typedef vec<float,2> vec2;
- typedef vec<float,3> vec3;
- typedef vec<float,4> vec4;
-
- typedef mat<float,2> mat2;
- typedef mat<float,3> mat3;
- typedef mat<float,4> mat4;
-
- typedef vec<int,2> ivec2;
-
-
-
-
-
-
-
- inline float norm_angle(float p) {
- while(p<0) p+=2* 3.14159265358979323846 ; while(p>=2* 3.14159265358979323846 ) p-=2* 3.14159265358979323846 ; return p;
- }
- inline float norm_angle0(float p) {
- while(p<- 3.14159265358979323846 ) p+=2* 3.14159265358979323846 ; while(p>= 3.14159265358979323846 ) p-=2* 3.14159265358979323846 ; return p;
- }
- inline float norm_orientation(float p) {
- while(p<0) p+= 3.14159265358979323846 ; while(p>= 3.14159265358979323846 ) p-= 3.14159265358979323846 ; return p;
- }
- inline float norm_orientation0(float p) {
- while(p<- 3.14159265358979323846 /2) p+= 3.14159265358979323846 ; while(p>= 3.14159265358979323846 /2) p-= 3.14159265358979323846 ; return p;
- }
- inline float orientation_difference(float p,float q) {
- fabs(norm_orientation0(p-q));
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- inline vec2 cmul(vec2 &p,vec2 &q) {
- return vec2(p.sub(0)*q.sub(0)-p.sub(1)*q.sub(1),
- p.sub(0)*q.sub(1)+p.sub(1)*q.sub(0));
- }
-
- inline vec2 cdiv(vec2 &p,vec2 &q) {
- float n=q*q;
- return vec2((p.sub(0)*q.sub(0)+p.sub(1)*q.sub(1))/n,
- (p.sub(1)*q.sub(0)-p.sub(0)*q.sub(1))/n);
- }
-
- inline vec2 csqrt(vec2 &x) {
- if (x.sub(0)==0.0&&x.sub(1)==0.0)
- return vec2(0.0,0.0);
- else {
- float a=sqrt((fabs(x.sub(0))+hypot(x.sub(0),x.sub(1)))*0.5);
- float b=0.5*(x.sub(1)/a);
- if(x.sub(0)>0.0) return vec2(a, b);
- else if(x.sub(1)>=0.0) return vec2(a,b);
- else return vec2(-a,-b);
- }
- }
- inline vec2 cpow(vec2& x, double p) {
- float h=hypot(x.sub(0),x.sub(1));
- if (h<=0.0) abort();
- float lr=pow(h,p);
- float a=atan2(x.sub(1),x.sub(0));
- float li=p*a;
- return vec2(lr*cos(li),lr*sin(li));
- }
-
-
-
- inline float cross(vec2 p,vec2 q) {
- return p.sub(0)*q.sub(1)-p.sub(1)*q.sub(0);
- }
-
-
-
-
-
- struct TRS2 {
- vec2 t;
- vec2 r;
- TRS2(vec2 t=vec2(0.0,0.0),vec2 r=vec2(1.0,0.0)):t(t),r(r) {
- }
- vec2 operator()(vec2 &arg) {
- return cmul(r,arg)+t;
- }
- float rotation() {
- return atan2(r(1),r(0));
- }
- };
-
-
-
- # 8 "foo.cc" 2
-
- # 1 "Counted.h" 1
-
-
-
-
-
- # 1 "/sym/gnu/lib/g++-include/std.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 1 "/sym/gnu/lib/g++-include/stddef.h" 1 3
-
-
- extern "C" {
-
-
-
- # 1 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stddef.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 41 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stddef.h" 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- typedef int ptrdiff_t;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- typedef int size_t;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- typedef __wchar_t wchar_t;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 7 "/sym/gnu/lib/g++-include/stddef.h" 2 3
-
-
-
-
- }
-
- # 24 "/sym/gnu/lib/g++-include/std.h" 2 3
-
- # 1 "/sym/gnu/lib/g++-include/stdlib.h" 1 3
-
-
-
-
-
-
-
- extern "C" {
-
- int abs(int);
-
-
- void volatile abort(void);
-
-
-
-
- double atof(const char*);
- int atoi(const char*);
- long atol(const char*);
-
- int atexit(auto void (*p) (void));
- int bsearch (const void *, const void *, size_t,
- size_t, auto int (*ptf)(const void*, const void*));
- void* calloc(size_t, size_t);
- void cfree(void*);
-
-
- void volatile exit(int);
-
-
-
-
- char* fcvt(double, int, int*, int*);
- void free(void*);
- char* getenv(const char*);
- int getopt(int, char * const *, const char*);
- int getpw(int, char*);
- char* gcvt(double, int, char*);
- char* ecvt(double, int, int*, int*);
- extern char** environ;
-
- long labs(long);
- void* malloc(size_t);
- size_t malloc_usable_size(void*);
- int putenv(const char*);
- extern char* optarg;
- extern int opterr;
- extern int optind;
- void qsort(void*, size_t, size_t, auto int (*ptf)(void*,void*));
- int rand(void);
- void* realloc(void*, size_t);
- int setkey(const char*);
- int srand(unsigned int);
- double strtod(const char*, char**);
- long strtol(const char*, char**, int);
- unsigned long stroul(const char**, int);
- int system(const char*);
-
- long random(void);
- void srandom(int);
- char* setstate(char*);
- char* initstate(unsigned, char*, int);
-
- double drand48(void);
- void lcong48(short*);
- long jrand48(short*);
- long lrand48(void);
- long mrand48(void);
- long nrand48(short*);
- short* seed48(short*);
- void srand48(long);
-
- char* ctermid(char*);
- char* cuserid(char*);
- char* tempnam(const char*, const char*);
- char* tmpnam(char*);
-
- }
-
- # 25 "/sym/gnu/lib/g++-include/std.h" 2 3
-
- # 1 "/sym/gnu/lib/g++-include/string.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- extern "C" {
-
- char* strcat(char*, const char*);
- char* strchr(const char*, int);
- int strcmp(const char*, const char*);
- int strcoll(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*);
- char* strstr(const char*, const char *);
- char* strtok(char*, const char*);
- int strxfrm(char*, const char*, int );
-
- char* index(const char*, int);
- char* rindex(const char*, int);
- }
-
- # 1 "/sym/gnu/lib/g++-include/memory.h" 1 3
-
-
-
-
-
-
-
- extern "C" {
-
- void* memalign (...) ;
- void* memccpy (...) ;
- void* memchr (...) ;
- int memcmp (...) ;
- void* memcpy (...) ;
- void* memmove (...) ;
- void* memset (...) ;
- int ffs (...) ;
- int getpagesize (...) ;
- void* valloc (...) ;
-
- void bcopy (...) ;
- int bcmp (...) ;
- void bzero (...) ;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 43 "/sym/gnu/lib/g++-include/string.h" 2 3
-
-
-
- # 26 "/sym/gnu/lib/g++-include/std.h" 2 3
-
-
- # 1 "/sym/gnu/lib/g++-include/unistd.h" 1 3
-
-
-
-
-
- extern "C" {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 1 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/unistd.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 1 "/sym/gnu/lib/g++-include/sys/types.h" 1 3
-
-
- extern "C"
- {
-
-
-
-
-
-
-
-
-
-
- # 1 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/sys/types.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 1 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/sys/stdtypes.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
- typedef int sigset_t;
-
- typedef unsigned int speed_t;
- typedef unsigned long tcflag_t;
- typedef unsigned char cc_t;
- typedef int pid_t;
-
- typedef unsigned short mode_t;
- typedef short nlink_t;
-
- typedef long clock_t;
- typedef long time_t;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 16 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/sys/types.h" 2 3
-
-
-
- # 1 "/usr/include/sys/sysmacros.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 19 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/sys/types.h" 2 3
-
-
-
-
-
- typedef unsigned char u_char;
- typedef unsigned short u_short;
- typedef unsigned int u_int;
- typedef unsigned long u_long;
- typedef unsigned short ushort;
- typedef unsigned int uint;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- typedef struct _physadr_t { int r[1]; } *physadr_t;
- typedef struct label_t {
- int val[2];
- } label_t;
-
-
-
-
-
-
-
- typedef struct _quad_t { long val[2]; } quad_t;
- typedef long daddr_t;
- typedef char * caddr_t;
- typedef unsigned long ino_t;
- typedef short dev_t;
- typedef long off_t;
- typedef unsigned short uid_t;
- typedef unsigned short gid_t;
- typedef long key_t;
- typedef char * addr_t;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- typedef long fd_mask;
-
-
-
-
-
-
-
-
-
- typedef struct fd_set {
- fd_mask fds_bits[(((256 )+(( (sizeof (fd_mask) * 8 ) )-1))/( (sizeof (fd_mask) * 8 ) )) ];
- } fd_set;
-
-
-
-
-
-
-
- # 113 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/sys/types.h" 3
-
-
-
- # 15 "/sym/gnu/lib/g++-include/sys/types.h" 2 3
-
-
-
-
-
-
- }
-
-
-
-
- # 73 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/unistd.h" 2 3
-
-
- extern void _exit( );
- extern int access( );
- extern unsigned alarm( );
- extern int chdir( );
- extern int __hide_chmod ( );
- extern int __hide_chown ( );
- extern int close( );
- extern char *ctermid( );
- extern char *cuserid( );
- extern int dup( );
- extern int dup2( );
- extern int __hide_execl ( );
- extern int __hide_execle ( );
- extern int __hide_execlp ( );
- extern int execv( );
- extern int execve( );
- extern int execvp( );
- extern pid_t fork( );
- extern long fpathconf( );
- extern char *getcwd( );
- extern gid_t getegid( );
- extern uid_t geteuid( );
- extern gid_t getgid( );
- extern int getgroups( );
- extern char *getlogin( );
- extern pid_t getpgrp( );
- extern pid_t getpid( );
- extern pid_t getppid( );
- extern uid_t getuid( );
- extern int isatty( );
- extern int link( );
- extern off_t lseek( );
- extern long pathconf( );
- extern int pause( );
- extern int pipe( );
- extern int read( );
- extern int rmdir( );
- extern int __hide_setgid ( );
- extern int setpgid( );
- extern pid_t setsid( );
- extern int __hide_setuid ( );
- extern unsigned sleep( );
- extern long sysconf( );
- extern pid_t tcgetpgrp( );
- extern int tcsetpgrp( );
- extern char *ttyname( );
- extern int unlink( );
- extern int write( );
-
-
-
- # 25 "/sym/gnu/lib/g++-include/unistd.h" 2 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 59 "/sym/gnu/lib/g++-include/unistd.h" 3
-
-
-
- extern void volatile _exit(int);
-
-
-
-
- extern unsigned alarm (...) ;
- extern int brk (...) ;
- extern int chdir (...) ;
- extern int chmod (...) ;
- extern int chown (const char*, unsigned short , unsigned short );
- extern int close (...) ;
- extern char* crypt (...) ;
- extern int dup (...) ;
- extern int dup2 (...) ;
- extern void encrypt (...) ;
- extern int execl (const char*, const char *, ...);
- extern int execle (const char*, const char *, ...);
- extern int execlp (const char*, const char*, ...);
- extern int exect (...) ;
- extern int execv (...) ;
- extern int execve (...) ;
- extern int execvp (...) ;
- extern int fchown (int, unsigned short , unsigned short );
- extern int fork (...) ;
- extern int fsync (...) ;
- extern int ftruncate (...) ;
- extern char* getcwd (...) ;
- extern int getdomainname (...) ;
- extern int getdtablesize (...) ;
- extern int getgroups (...) ;
- extern unsigned short geteuid (...) ;
- extern unsigned short getegid (...) ;
- extern unsigned short getgid (...) ;
- extern long gethostid (...) ;
- extern int gethostname (...) ;
- extern int getpgrp (...) ;
- extern int getpid (...) ;
- extern int getppid (...) ;
- extern char* getlogin (...) ;
- extern char* getpass (...) ;
- extern unsigned short getuid (...) ;
- extern int ioctl (int, int, ... );
- extern int isatty (...) ;
- extern int link (...) ;
- extern int mkstemp (...) ;
- extern char* mktemp (...) ;
- extern int nice (...) ;
- extern int pause (...) ;
- extern int pipe (...) ;
- extern int readlink (...) ;
- extern int rename (...) ;
- extern int rmdir (...) ;
- extern void* sbrk (...) ;
- extern int syscall (...) ;
- extern int setgid (unsigned short );
- extern int sethostname (...) ;
-
-
-
-
- extern int setpgrp (...) ;
-
- extern int setregid (...) ;
- extern int setreuid (...) ;
- extern int setuid (unsigned short );
- extern unsigned sleep (...) ;
- extern void swab (...) ;
- extern int symlink (...) ;
- extern long sysconf (...) ;
- extern int truncate (...) ;
- extern char* ttyname (...) ;
- extern int ttyslot (...) ;
-
- extern int unlink (...) ;
- extern int vfork (...) ;
- extern int vadvise (...) ;
- extern int vhangup (...) ;
- extern long lseek (...) ;
- extern int read (...) ;
- extern int write (...) ;
- extern int access (...) ;
-
- extern int flock (...) ;
-
-
- }
-
-
- # 28 "/sym/gnu/lib/g++-include/std.h" 2 3
-
- # 1 "/sym/gnu/lib/g++-include/stdio.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #pragma interface
-
-
-
-
-
-
-
-
-
-
-
-
-
- extern "C" {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 1 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdio.h" 1 3
-
- # 1 "/sym/gnu/lib/g++-include/stdarg.h" 1 3
- extern "C" {
- # 1 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdarg.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 1 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/va-sparc.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
- typedef char * __gnuc_va_list;
-
-
-
-
-
-
-
-
-
- # 79 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/va-sparc.h" 3
-
-
- # 32 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdarg.h" 2 3
-
- # 77 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdarg.h" 3
-
-
-
-
-
-
- # 140 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdarg.h" 3
-
-
-
-
-
- # 2 "/sym/gnu/lib/g++-include/stdarg.h" 2 3
-
- }
- # 2 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdio.h" 2 3
-
-
-
-
-
-
- extern struct _iobuf {
- int _cnt;
- unsigned char *_ptr;
- unsigned char *_base;
- int _bufsiz;
- short _flag;
- char _file;
- } _iob[];
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- extern struct _iobuf *__hide_fopen ();
- extern struct _iobuf *__hide_fdopen ();
- extern struct _iobuf *__hide_freopen ();
- extern struct _iobuf *__hide_popen ();
- extern struct _iobuf *tmpfile();
- extern long __hide_ftell ();
- extern char *fgets();
- extern char *gets();
- extern char *__hide_sprintf ();
- extern char *ctermid();
- extern char *cuserid();
- extern char *__hide_tempnam ();
- extern char *tmpnam();
-
-
-
-
-
-
- # 69 "/sym/gnu/lib/g++-include/stdio.h" 2 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
-
- extern "C" {
-
- 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 *);
- void perror(const char*);
- struct _iobuf * popen(const char*, const char*);
- int printf(const char* ...);
- int puts(const char*);
- int putw(int, struct _iobuf *);
- int rewind(struct _iobuf *);
- int scanf(const char* ...);
- void setbuf(struct _iobuf *, char*);
- void setbuffer(struct _iobuf *, char*, int);
- int setlinebuf(struct _iobuf *);
- int setvbuf(struct _iobuf *, char*, int, int );
- int sscanf(char*, const char* ...);
- struct _iobuf * tmpfile();
- int ungetc(int, struct _iobuf *);
- int vfprintf (...) ;
- int vprintf (...) ;
- char* sprintf (...) ;
- char* vsprintf (...) ;
-
- extern int _filbuf (...) ;
- extern int _flsbuf (...) ;
-
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 29 "/sym/gnu/lib/g++-include/std.h" 2 3
-
- # 1 "/sym/gnu/lib/g++-include/errno.h" 1 3
-
-
- extern "C" {
-
-
-
-
-
- # 1 "/usr/include/errno.h" 1 3
-
-
-
-
-
-
-
-
-
- # 1 "/usr/include/sys/errno.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 10 "/usr/include/errno.h" 2 3
-
- extern int errno;
-
-
- # 9 "/sym/gnu/lib/g++-include/errno.h" 2 3
-
-
-
-
- extern char* sys_errlist[];
- extern int sys_nerr;
-
- extern int errno;
-
- void perror(const char*);
- char* strerr(int);
-
-
- }
-
-
- # 30 "/sym/gnu/lib/g++-include/std.h" 2 3
-
- # 1 "/sym/gnu/lib/g++-include/fcntl.h" 1 3
-
-
- extern "C" {
-
-
-
-
-
-
-
-
-
-
- # 1 "/usr/include/fcntl.h" 1 3
-
-
-
-
-
- # 1 "/usr/include/sys/fcntlcom.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- struct flock {
- short l_type;
- short l_whence;
- long l_start;
- long l_len;
- short l_pid;
- short l_xxx;
- };
-
-
-
- struct eflock {
- short l_type;
- short l_whence;
- long l_start;
- long l_len;
- short l_pid;
- short l_xxx;
- long l_rpid;
- long l_rsys;
- };
-
-
-
- # 1 "/sym/gnu/lib/g++-include/sys/stat.h" 1 3
-
-
- extern "C"
- {
-
-
-
-
-
-
-
-
-
- # 1 "/usr/include/sys/stat.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
- struct stat {
- dev_t st_dev;
- ino_t st_ino;
- mode_t st_mode;
- short st_nlink;
- uid_t st_uid;
- gid_t st_gid;
- dev_t st_rdev;
- off_t st_size;
- time_t st_atime;
- int st_spare1;
- time_t st_mtime;
- int st_spare2;
- time_t st_ctime;
- int st_spare3;
- long st_blksize;
- long st_blocks;
- long st_spare4[2];
- };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- int __hide_chmod ( );
- int fstat( );
- int mkdir( );
- int mkfifo( );
- int stat( );
- mode_t umask( );
-
-
-
- # 14 "/sym/gnu/lib/g++-include/sys/stat.h" 2 3
-
-
-
-
-
-
- extern int chmod (...) ;
- extern int stat (...) ;
- extern int lstat (...) ;
- extern int fstat (...) ;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
-
-
- # 149 "/usr/include/sys/fcntlcom.h" 2 3
-
-
- int __hide_open ( );
- int __hide_creat ( );
- int __hide_fcntl ( );
-
-
- # 6 "/usr/include/fcntl.h" 2 3
-
-
-
-
-
- # 14 "/sym/gnu/lib/g++-include/fcntl.h" 2 3
-
-
-
-
-
-
-
-
- int fcntl(int, int, ...);
- int creat (...) ;
-
- int open (...) ;
-
-
- }
-
- # 31 "/sym/gnu/lib/g++-include/std.h" 2 3
-
-
- extern "C" {
- int strcasecmp (...) ;
- }
-
-
- # 6 "Counted.h" 2
-
-
- template <class T>
- struct Counted {
- protected:
- int *count;
- T *object;
- void dec_count() {
- if(!count) return;
- (*count)--;
- if(*count<=0) {
- delete count;
- delete object;
- count=0;
- object=0;
- }
- }
- void inc_count() {
- if(!count) return;
- (*count)++;
- }
- Counted &assign(Counted &other) {
- other.inc_count();
- dec_count();
- count=other.count;
- object=other.object;
- return *this;
- }
- void constructor(T *object) {
- this->object = object;
- count = new int(1);
- }
- public:
- Counted() {
- count=0;
- object=0;
- }
- Counted(T *object) {
- constructor(object);
- }
- ~Counted() {
- dec_count();
- }
- Counted(Counted &other) {
- count=other.count;
- object=other.object;
- inc_count();
- }
- void operator=(Counted &other) {
- assign(other);
- }
- void clear() {
- dec_count();
- count=0;
- object=0;
- }
- int operator==(Counted &other) {
- return object==other.object;
- }
- int operator!=(Counted &other) {
- return object!=other.object;
- }
-
- T &operator*() {if(!object) abort(); else return *object; return *object;}
- T *operator->() {if(!object) abort(); else return object; return object;}
- operator T&() {if(!object) abort(); else return *object; return *object;}
-
-
- };
-
-
- # 9 "foo.cc" 2
-
- # 1 "Str.h" 1
-
-
-
- # 1 "/sym/gnu/lib/g++-include/std.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 37 "/sym/gnu/lib/g++-include/std.h" 3
-
- # 4 "Str.h" 2
-
- # 1 "Art.h" 1
-
-
- # 318 "Art.h"
-
- # 5 "Str.h" 2
-
-
- struct Str {
- Art<char> data;
- operator char*() {return data.pointer();}
- char *pointer() {return data.pointer();}
- Str() {}
- Str(int size):data(size) {}
- Str(char *p) {
- data.resize(strlen(p)+1);
- strcpy(pointer(),p);
- }
-
- Str(Str &other) {
- data=other.data;
- }
- Str &operator=(Str &other) {
- data=other.data; return *this;
- }
- char operator()(int i) {return data(i);}
- int length() {return data.dim(0);}
- Str &temp() {
- data.temp();
- return *this;
- }
- Str operator+(Str &other) {
- Str result(length()+other.length()+1);
- strcpy(result.pointer(),pointer());
- strcat(result.pointer(),other.pointer());
- return result.temp();
- }
- int operator==(Str &other) {return strcmp(pointer(),other.pointer())==0;}
- int operator!=(Str &other) {return strcmp(pointer(),other.pointer())!=0;}
- int operator<(Str &other) {return strcmp(pointer(),other.pointer())<0;}
- int operator>(Str &other) {return strcmp(pointer(),other.pointer())>0;}
- int operator<=(Str &other) {return strcmp(pointer(),other.pointer())<=0;}
- int operator>=(Str &other) {return strcmp(pointer(),other.pointer())>=0;}
- Str substring(int from,int below) {
- if(below<0) below=length();
- if(below>length()) abort();
- Str result(below-from);
- for(int i=from;i<below;i++)
- result.data(i-from)=data(i);
- return result.temp();
- }
- };
-
- inline unsigned hash(Str &s) {
- unsigned x = 0;
- for(int i=0;i<s.length();i++) x = (x*467 + s(i))%10000019;
- return x;
- }
-
-
- # 10 "foo.cc" 2
-
-
- template <class V>
- struct BaseConstraint {
- virtual ~BaseConstraint() {}
- virtual void new_value() {}
- virtual void no_value() {}
- };
-
-
-
- template <class V>
- struct RConnector {
- private:
- typedef Counted< BaseConstraint<V> > VConstraint;
- int fixed;
- V value;
- VConstraint source;
- Stk<VConstraint> constraints;
-
- public:
- void connect(Counted< BaseConstraint<V> > &constraint) {
- constraints.push(constraint);
- if(has_value()) constraint->new_value();
- }
- int has_value() {return fixed;}
- V get_value() {return value;}
- void set_value(V new_value,VConstraint &new_source) {
- if(has_value()) {
- if(new_value!=value) abort();
- } else {
- fixed=1;
- source=new_source;
- for(int i=0;i<constraints.length();i++) {
- if(constraints(i)==new_source) continue;
- constraints(i)->new_value();
- }
- }
- }
- void forget_value(VConstraint retractor) {
- for(int i=0;i<constraints.length();i++) {
- if(constraints(i)==retractor) continue;
- constraints(i)->new_value();
- }
- }
- };
-
- template <class V>
- struct Connector : public Counted< RConnector<V> > {
- Connector() {constructor(new RConnector<V>);}
- void operator=(Connector &other) {assign(other);}
- };
-
- template <class V>
- struct Constant : BaseConstraint<V> {
- V value;
- Connector<V> connection;
-
- void new_value() {}
- void no_value() {}
- Constant(V value,Connector<V> connection)
- :value(value),connection(connection) {}
- };
-
- template <class V>
- Counted< BaseConstraint<V> > make_Constant(V value,Connector<V> connection) {
- Counted< BaseConstraint<V> > constraint = new Constant<V>(value,connection);
- connection->connect(constraint);
- connection->set_value(value,constraint);
- return constraint;
- }
-
- template <class V>
- struct Reporter : BaseConstraint<V> {
- char *name;
- Connector<V> connection;
-
- void new_value() {
- cout << "Reporter " << name << ":" << 1 << "\n";
- }
- void no_value() {
- cout << "Reporter " << name << ": [unconstrained] \n";
- }
- Reporter(char *name,Connector<V> connection)
- :name(name),connection(connection) {}
- };
-
- template <class V>
- Counted< BaseConstraint<V> > make_Reporter(char *name,Connector<V> connection) {
- Counted< BaseConstraint<V> > constraint = new Reporter<V>(name,connection);
- connection->connect(constraint);
- return constraint;
- }
-
- main() {
- Connector<int> c;
- Counted< BaseConstraint<int> > out = make_Reporter("foo",c);
- Counted< BaseConstraint<int> > in = make_Constant(9,c);
- }
- ================================================================
-
-