home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / gnu / g / bug / 1840 < prev    next >
Encoding:
Text File  |  1992-11-17  |  55.2 KB  |  3,711 lines

  1. Newsgroups: gnu.g++.bug
  2. 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
  3. From: tmb@idiap.CH (Thomas M. Breuel)
  4. Subject: GNU C++ 2.3.1 crash
  5. Message-ID: <9211170302.AA09453@idiap.ch>
  6. Sender: gnulists@ai.mit.edu
  7. Reply-To: tmb@idiap.ch
  8. Organization: GNUs Not Usenet
  9. Distribution: gnu
  10. Date: Tue, 17 Nov 1992 05:02:07 GMT
  11. Approved: bug-g++@prep.ai.mit.edu
  12. Lines: 3697
  13.  
  14. arolla$ ngcc -v -c bar.cc
  15. Reading specs from /sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/specs
  16. gcc version 2.3.1
  17.  /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
  18. GNU CPP version 2.3.1 (sparc)
  19.  /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
  20. GNU C++ version 2.3.1 (sparc) compiled by GNU C version 2.3.1.
  21. ngcc: Internal compiler error: program cc1plus got fatal signal 11
  22. arolla$
  23.  
  24. ================================================================
  25. # 1 "foo.cc"
  26. # 1 "/sym/gnu/lib/g++-include/stream.h" 1 3
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33. # 1 "/sym/gnu/lib/g++-include/iostream.h" 1 3
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53. #pragma interface
  54.  
  55.  
  56.  
  57.  
  58. # 1 "/sym/gnu/lib/g++-include/streambuf.h" 1 3
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78. #pragma interface
  79.  
  80.  
  81. # 1 "/sym/gnu/lib/g++-include/_G_config.h" 1 3
  82.   
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126. # 23 "/sym/gnu/lib/g++-include/streambuf.h" 2 3
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142. class ostream; class streambuf; class backupbuf;
  143.  
  144.  
  145.  
  146.  
  147.  
  148. extern "C" int __underflow(streambuf*);
  149. extern "C" int __overflow(streambuf*, int);
  150.  
  151. typedef long  streamoff;
  152. typedef long  streampos;  
  153.  
  154. typedef unsigned long __fmtflags;
  155. typedef unsigned char __iostate;
  156.  
  157. struct _ios_fields {  
  158.     streambuf *_strbuf;
  159.     ostream* _tie;
  160.     int _width;
  161.     __fmtflags _flags;
  162.     char _fill;
  163.     __iostate _state;
  164.     unsigned short _precision;
  165. };
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181. enum state_value {
  182.     _good = 0 ,
  183.     _eof = 1 ,
  184.     _fail = 2 ,
  185.     _bad = 4  };
  186. enum open_mode {
  187.     input = 1 ,
  188.     output = 2 ,
  189.     atend = 4 ,
  190.     append = 8  };
  191.  
  192.  
  193. class ios : public _ios_fields {
  194.   public:
  195.     typedef __fmtflags fmtflags;
  196.     typedef __iostate iostate;
  197.     enum io_state {
  198.     goodbit = 0 ,
  199.     eofbit = 1 ,
  200.     failbit = 2 ,
  201.     badbit = 4  };
  202.     enum open_mode {
  203.     in = 1 ,
  204.     out = 2 ,
  205.     ate = 4 ,
  206.     app = 8 ,
  207.     trunc = 16 ,
  208.     nocreate = 32 ,
  209.     noreplace = 64  };
  210.     enum seek_dir { beg, cur, end};
  211.     enum { skipws=01, left=02, right=04, internal=010,
  212.        dec=020, oct=040, hex=0100,
  213.        showbase=0200, showpoint=0400, uppercase=01000, showpos=02000,
  214.        scientific=04000, fixed=0100000, unitbuf=020000, stdio=040000,
  215.        dont_close=0x80000000  
  216.        };
  217.  
  218.     ostream* tie() const { return _tie; }
  219.     ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; }
  220.  
  221.      
  222.     char fill() const { return _fill; }
  223.     char fill(char newf) { char oldf = _fill; _fill = newf; return oldf; }
  224.     fmtflags flags() const { return _flags; }
  225.     fmtflags flags(fmtflags new_val) {
  226.     fmtflags old_val = _flags; _flags = new_val; return old_val; }
  227.     int precision() const { return _precision; }
  228.     int precision(int newp) {
  229.     unsigned short oldp = _precision; _precision = (unsigned short)newp;
  230.     return oldp; }
  231.     fmtflags setf(fmtflags val) {
  232.     fmtflags oldbits = _flags;
  233.     _flags |= val; return oldbits; }
  234.     fmtflags setf(fmtflags val, fmtflags mask) {
  235.     fmtflags oldbits = _flags;
  236.     _flags = (_flags & ~mask) | (val & mask); return oldbits; }
  237.     fmtflags unsetf(fmtflags mask) {
  238.     fmtflags oldbits = _flags & mask;
  239.     _flags &= ~mask; return oldbits; }
  240.     int width() const { return _width; }
  241.     int width(int val) { int save = _width; _width = val; return save; }
  242.  
  243.     static const unsigned long basefield;
  244.     static const unsigned long adjustfield;
  245.     static const unsigned long floatfield;
  246.  
  247.     streambuf* rdbuf() const { return _strbuf; }
  248.     void clear(iostate state = 0) { _state = state; }
  249.     void set(iostate flag) { _state |= flag; }  
  250.     int good() const { return _state == 0; }
  251.     int eof() const { return _state & ios::eofbit; }
  252.     int fail() const { return _state & (ios::badbit|ios::failbit); }
  253.     int bad() const { return _state & ios::badbit; }
  254.     int rdstate() const { return _state; }
  255.     operator void*() const { return fail() ? (void*)0 : (void*)(-1); }
  256.     int operator!() const { return fail(); }
  257.  
  258.  
  259.     void unset(state_value flag) { _state &= ~flag; }
  260.     void close();
  261.     int is_open();
  262.     int readable();
  263.     int writable();
  264.  
  265.  
  266.   protected:
  267.     ios(streambuf* sb = 0, ostream* tie = 0);
  268.     ~ios();
  269. };
  270.  
  271.  
  272.  
  273.  
  274. typedef ios::seek_dir _seek_dir;
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303. class streammarker {
  304.     friend class streambuf;
  305.  
  306.  
  307.  
  308.     friend int __underflow(streambuf*);
  309.  
  310.     struct streammarker *_next;   
  311.     streambuf *_sbuf;  
  312.     streampos _spos;  
  313.     void set_streampos(streampos sp) { _spos = sp; }
  314.     void set_offset(int offset) { _pos = offset; _spos = (streampos)(-2); }
  315.      
  316.      
  317.     int _pos;
  318.   public:
  319.     streammarker(streambuf *sb);
  320.     ~streammarker();
  321.     int saving() { return  _spos == -2; }
  322.     int delta(streammarker&);
  323.     int delta();
  324. };
  325.  
  326. struct __streambuf {
  327.      
  328.     int _flags;         
  329.     char* _gptr;     
  330.     char* _egptr;     
  331.     char* _eback;     
  332.     char* _pbase;     
  333.     char* _pptr;     
  334.     char* _epptr;     
  335.     char* _base;     
  336.     char* _ebuf;     
  337.     struct streambuf *_chain;
  338.  
  339.      
  340.     friend class streammarker;
  341.     char *_other_gbase;  
  342.     char *_aux_limit;   
  343.     char *_other_egptr;  
  344.     streammarker *_markers;
  345.  
  346.  
  347.      
  348.     unsigned short _cur_column;
  349.     char _unused;
  350.     char _shortbuf[1];
  351. };
  352.  
  353. extern unsigned __adjust_column(unsigned start, const char *line, int count);
  354.  
  355. struct streambuf : private __streambuf {
  356.     friend class ios;
  357.     friend class istream;
  358.     friend class ostream;
  359.     friend class streammarker;
  360.  
  361.  
  362.  
  363.     friend int __underflow(streambuf*);
  364.  
  365.   protected:
  366.     static streambuf* _list_all;  
  367.     streambuf*& xchain() { return _chain; }
  368.     void _un_link();
  369.     void _link_in();
  370.     char* gptr() const { return _gptr; }
  371.     char* pptr() const { return _pptr; }
  372.     char* egptr() const { return _egptr; }
  373.     char* epptr() const { return _epptr; }
  374.     char* pbase() const { return _pbase; }
  375.     char* eback() const { return _eback; }
  376.     char* ebuf() const { return _ebuf; }
  377.     char* base() const { return _base; }
  378.     void xput_char(char c) { *_pptr++ = c; }
  379.     int xflags() { return _flags; }
  380.     int xflags(int f) { int fl = _flags; _flags = f; return fl; }
  381.     void xsetflags(int f) { _flags |= f; }
  382.     void xsetflags(int f, int mask) { _flags = (_flags & ~mask) | (f & mask); }
  383.     void gbump(int n) { _gptr += n; }
  384.     void pbump(int n) { _pptr += n; }
  385.     void setb(char* b, char* eb, int a=0);
  386.     void setp(char* p, char* ep) { _pbase=_pptr=p; _epptr=ep; }
  387.     void setg(char* eb, char* g, char *eg) { _eback=eb; _gptr=g; _egptr=eg; }
  388.     char *shortbuf() { return _shortbuf; }
  389.  
  390.     int in_backup() { return _flags & 0x100 ; }
  391.      
  392.     char *Gbase() { return in_backup() ? _other_gbase : _eback; }
  393.      
  394.     char *eGptr() { return in_backup() ? _other_egptr : _egptr; }
  395.      
  396.     char *Bbase() { return in_backup() ? _eback : _other_gbase; }
  397.     char *Bptr() { return _aux_limit; }
  398.      
  399.     char *eBptr() { return in_backup() ? _egptr : _other_egptr; }
  400.     char *Nbase() { return _other_gbase; }
  401.     char *eNptr() { return _other_egptr; }
  402.     int have_backup() { return _other_gbase != ((void*)0) ; }
  403.     int have_markers() { return _markers != ((void*)0) ; }
  404.     int _least_marker();
  405.     void switch_to_main_get_area();
  406.     void switch_to_backup_area();
  407.     void free_backup_area();
  408.     void unsave_markers();  
  409.     int put_mode() { return _flags & 0x800 ; }
  410.     int switch_to_get_mode();
  411.     
  412.     streambuf(int flags=0);
  413.   public:
  414.     static int flush_all();
  415.     static void flush_all_linebuffered();  
  416.     virtual int underflow() = 0;  
  417.     virtual int overflow(int c = (-1) ) = 0;  
  418.     virtual int doallocate();
  419.     virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
  420.     virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out);
  421.     int seekmark(streammarker& mark, int delta = 0);
  422.     int sputbackc(char c);
  423.     int sungetc();
  424.     virtual ~streambuf();
  425.     int unbuffered() { return _flags & 2  ? 1 : 0; }
  426.     int linebuffered() { return _flags & 0x200  ? 1 : 0; }
  427.     void unbuffered(int i)
  428.     { if (i) _flags |= 2 ; else _flags &= ~2 ; }
  429.     void linebuffered(int i)
  430.     { if (i) _flags |= 0x200 ; else _flags &= ~0x200 ; }
  431.     int allocate() {  
  432.     if (base() || unbuffered()) return 0;
  433.     else return doallocate(); }
  434.      
  435.     void allocbuf() { if (base() == ((void*)0) ) doallocbuf(); }
  436.     void doallocbuf();
  437.     virtual int sync();
  438.     virtual int pbackfail(int c);
  439.     virtual int ungetfail();
  440.     virtual streambuf* setbuf(char* p, int len);
  441.     int in_avail() { return _egptr - _gptr; }
  442.     int out_waiting() { return _pptr - _pbase; }
  443.     virtual int sputn(const char* s, int n);
  444.     int padn(char pad, int n);  
  445.     virtual int sgetn(char* s, int n);
  446.     int ignore(int);
  447.     virtual int get_column();
  448.     virtual int set_column(int);
  449.     long sgetline(char* buf, int  n, char delim, int putback_delim);
  450.     int sbumpc() {
  451.     if (_gptr >= _egptr && __underflow(this) == (-1) ) return (-1) ;
  452.     else return *(unsigned char*)_gptr++; }
  453.     int sgetc() {
  454.     if (_gptr >= _egptr && __underflow(this) == (-1) ) return (-1) ;
  455.     else return *(unsigned char*)_gptr; }
  456.     int snextc() {
  457.     if (++_gptr >= _egptr && __underflow(this) == (-1) ) return (-1) ;
  458.     else return *(unsigned char*)_gptr; }
  459.     int sputc(int c) {
  460.     if (_pptr >= _epptr) return __overflow(this, (unsigned char)c);
  461.     return *_pptr++ = c, (unsigned char)c; }
  462.     void stossc() { if (_gptr < _egptr) _gptr++; }
  463.     int vscan(char const *fmt0, char *  ap, ios::iostate* = ((void*)0) );
  464.     int vform(char const *fmt0, char *  ap);
  465.  
  466.  
  467.  
  468.  
  469. };
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479. class backupbuf : public streambuf {
  480.     friend class streammarker;
  481.   protected:
  482.     backupbuf(int flags=0) : streambuf(flags|0x4000 ) { }
  483.   public:
  484.     virtual int pbackfail(int c);
  485.     virtual int underflow();
  486.     virtual int overflow(int c = (-1) );
  487. };
  488.  
  489. struct __file_fields {
  490.     short _fileno;
  491.     int _blksize;
  492.     long   _offset;
  493.  
  494. };
  495.  
  496. class filebuf : public backupbuf {
  497.   protected:
  498.     struct __file_fields _fb;
  499.     void init();
  500.   public:
  501.     filebuf();
  502.     filebuf(int fd);
  503.     filebuf(int fd, char* p, int len);
  504.     ~filebuf();
  505.     filebuf* attach(int fd);
  506.     filebuf* open(const char *filename, const char *mode);
  507.     filebuf* open(const char *filename, int mode, int prot = 0664);
  508.     virtual int underflow();
  509.     virtual int overflow(int c = (-1) );
  510.     int is_open() { return _fb._fileno >= 0; }
  511.     int fd() { return is_open() ? _fb._fileno : (-1) ; }
  512.     filebuf* close();
  513.     virtual int doallocate();
  514.     virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
  515.     int sputn(const char* s, int n);
  516.     int sgetn(char* s, int n);
  517.     virtual int sync();
  518.   protected:  
  519.  
  520.     int is_reading() { return eback() != egptr(); }
  521.     char* cur_ptr() { return is_reading() ?  gptr() : pptr(); }
  522.      
  523.     char* file_ptr() { return eGptr(); }
  524.     int do_write(const char *data, int to_do);
  525.     int do_flush() { return do_write(_pbase, _pptr-_pbase); }
  526.      
  527.     virtual int  sys_read(char* buf, int  size);
  528.     virtual long   sys_seek(long  , _seek_dir);
  529.     virtual int  sys_write(const void*, long);
  530.     virtual int sys_stat(void*);  
  531.     virtual int sys_close();
  532. };
  533.  
  534.  
  535. inline int ios::readable() { return !(rdbuf()->_flags & 4 ); }
  536. inline int ios::writable() { return !(rdbuf()->_flags & 8 ); }
  537. inline int ios::is_open() { return (rdbuf()->_flags & 4 +8 )
  538.                 != 4 +8 ; }
  539.  
  540. inline ios::ios(streambuf* sb  , ostream* tie  ) {
  541.         _tie = tie; _strbuf=sb; _state=0; _width=0; _fill=' ';
  542.         _flags=ios::skipws; _precision=6; }
  543. inline ios::~ios() {
  544.     if (!(_flags & (unsigned int)ios::dont_close)) delete _strbuf; }
  545.  
  546.  
  547. # 25 "/sym/gnu/lib/g++-include/iostream.h" 2 3
  548.  
  549.  
  550. class istream; class ostream;
  551. typedef ios& (*__manip)(ios&);
  552. typedef istream& (*__imanip)(istream&);
  553. typedef ostream& (*__omanip)(ostream&);
  554.  
  555. extern istream& ws(istream& ins);
  556. extern ostream& flush(ostream& outs);
  557. extern ostream& endl(ostream& outs);
  558. extern ostream& ends(ostream& outs);
  559.  
  560. class ostream : public ios
  561. {
  562.     void do_osfx();
  563.   public:
  564.     ostream() { }
  565.     ostream(streambuf* sb, ostream* tied=((void*)0) );
  566.     int opfx() { if (!good()) return 0; if (_tie) _tie->flush(); return 1; }
  567.     void osfx() { if (flags() & (ios::unitbuf|ios::stdio))
  568.               do_osfx(); }
  569.     streambuf* ostreambuf() const { return _strbuf; }
  570.     ostream& flush();
  571.     ostream& put(char c) { _strbuf->sputc(c); return *this; }
  572.  
  573.     ostream& write(const char *s, int n);
  574.     ostream& write(const unsigned char *s, int n) { return write((const char*)s, n);}
  575.  
  576.     ostream& write(const signed char *s, int n) { return write((const char*)s, n);}
  577.  
  578.     ostream& write(const void *s, int n) { return write((const char*)s, n);}
  579.     ostream& seekp(streampos);
  580.     ostream& seekp(streamoff, _seek_dir);
  581.     streampos tellp();
  582.     ostream& form(const char *format ...);
  583.     ostream& vform(const char *format, char *  args);
  584. };
  585.  
  586. extern ostream& operator<<(ostream&, char c);
  587. inline ostream& operator<<(ostream& os, unsigned char c)
  588. { return os << (char)c; }
  589.  
  590. extern ostream& operator<<(ostream &os, signed char c) { return os << (char)c;}
  591.  
  592. extern ostream& operator<<(ostream&, const char *s);
  593. inline ostream& operator<<(ostream& os, const unsigned char *s)
  594. { return os << (const char*)s; }
  595.  
  596. inline ostream& operator<<(ostream& os, const signed char *s)
  597. { return os << (const char*)s; }
  598.  
  599. extern ostream& operator<<(ostream&, void *p);
  600. extern ostream& operator<<(ostream&, int n);
  601. extern ostream& operator<<(ostream&, long n);
  602. extern ostream& operator<<(ostream&, unsigned int n);
  603. extern ostream& operator<<(ostream&, unsigned long n);
  604. inline ostream& operator<<(ostream& os, short n) {return os << (int)n;}
  605. inline ostream& operator<<(ostream& os, unsigned short n)
  606. {return os << (unsigned int)n;}
  607. extern ostream& operator<<(ostream&, float n);
  608. extern ostream& operator<<(ostream&, double n);
  609. inline ostream& operator<<(ostream& os, __omanip func) { return (*func)(os); }
  610. inline ostream& operator<<(ostream& os, __manip func) {(*func)(os); return os;}
  611. extern ostream& operator<<(ostream&, streambuf*);
  612.  
  613. class istream : public ios
  614. {
  615.     int  _gcount;
  616.  
  617.     int _skip_ws();
  618.   public:
  619.     istream() { _gcount = 0; }
  620.     istream(streambuf* sb, ostream*tied=((void*)0) );
  621.     streambuf* istreambuf() const { return _strbuf; }
  622.     istream& get(char& c);
  623.     istream& get(unsigned char& c) { return get((char&)c); }
  624.  
  625.     istream& get(signed char& c)  { return get((char&)c); }
  626.  
  627.     istream& read(char *ptr, int n);
  628.     istream& read(unsigned char *ptr, int n) { return read((char*)ptr, n); }
  629.  
  630.     istream& read(signed char *ptr, int n) { return read((char*)ptr, n); }
  631.  
  632.     istream& read(void *ptr, int n) { return read((char*)ptr, n); }
  633.      
  634.     istream& getline(char* ptr, int len, char delim = '\n');
  635.     istream& get(char* ptr, int len, char delim = '\n');
  636.     istream& get(streambuf& sb, char delim = '\n');
  637.     istream& gets(char **s, char delim = '\n');
  638.     int ipfx(int need) {
  639.     if (!good()) { set(ios::failbit); return 0; }
  640.     if (_tie && (need == 0 || rdbuf()->in_avail() < need)) _tie->flush();
  641.     if (!need && (flags() & ios::skipws)) return _skip_ws();
  642.     return 1;
  643.     }
  644.     int ipfx0() {  
  645.     if (!good()) { set(ios::failbit); return 0; }
  646.     if (_tie) _tie->flush();
  647.     if (flags() & ios::skipws) return _skip_ws();
  648.     return 1;
  649.     }
  650.     int ipfx1() {  
  651.     if (!good()) { set(ios::failbit); return 0; }
  652.     if (_tie && rdbuf()->in_avail() == 0) _tie->flush();
  653.     return 1;
  654.     }
  655.     int get() { if (!ipfx1()) return (-1) ;
  656.         int ch = _strbuf->sbumpc();
  657.         if (ch == (-1) ) set(ios::eofbit);
  658.         return ch; }
  659.     int peek() { if (!ipfx1()) return (-1) ;
  660.         int ch = _strbuf->sgetc();
  661.         if (ch == (-1) ) set(ios::eofbit);
  662.         return ch; }
  663.     int  gcount() { return _gcount; }
  664.     istream& ignore(int n=1, int delim = (-1) );
  665.     istream& seekg(streampos);
  666.     istream& seekg(streamoff, _seek_dir);
  667.     streampos tellg();
  668.     istream& putback(char ch) {
  669.     if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit);
  670.     return *this;}
  671.     istream& unget() {
  672.     if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit);
  673.     return *this;}
  674.     istream& scan(const char *format ...);
  675.     istream& vscan(const char *format, char *  args);
  676.  
  677.     istream& unget(char ch) { return putback(ch); }
  678.     int skip(int i);
  679.  
  680. };
  681.  
  682. extern istream& operator>>(istream&, char*);
  683. inline istream& operator>>(istream& is, unsigned char* p)
  684. { return is >> (char*)p; }
  685.  
  686. inline istream& operator>>(istream& is, signed char*p) {return is >> (char*)p;}
  687.  
  688. extern istream& operator>>(istream&, char& c);
  689. extern istream& operator>>(istream& s, unsigned char& c) {return s>>(char&)c;}
  690.  
  691. extern istream& operator>>(istream& s, signed char& c) {return s >> (char&)c;}
  692.  
  693. extern istream& operator>>(istream&, int&);
  694. extern istream& operator>>(istream&, long&);
  695. extern istream& operator>>(istream&, short&);
  696. extern istream& operator>>(istream&, unsigned int&);
  697. extern istream& operator>>(istream&, unsigned long&);
  698. extern istream& operator>>(istream&, unsigned short&);
  699. extern istream& operator>>(istream&, float&);
  700. extern istream& operator>>(istream&, double&);
  701. inline istream& operator>>(istream& is, __manip func) {(*func)(is); return is;}
  702. inline istream& operator>>(istream& is, __imanip func) { return (*func)(is); }
  703. extern istream& operator>>(istream&, streambuf*);
  704.  
  705. class iostream : public ios {
  706.     int  _gcount;
  707.   public:
  708.     iostream() { _gcount = 0; }
  709.     iostream(streambuf* sb, ostream*tied=((void*)0) );
  710.     operator istream&() { return *(istream*)this; }
  711.     operator ostream&() { return *(ostream*)this; }
  712.      
  713.     istream& get(char& c) { return ((istream*)this)->get(c); }
  714.     istream& get(unsigned char& c) { return ((istream*)this)->get((char&)c); }
  715.  
  716.     istream& get(signed char& c) { return ((istream*)this)->get((char&)c); }
  717.  
  718.     istream& read(char *ptr, int n) { return ((istream*)this)->read(ptr, n); }
  719.     istream& read(unsigned char *ptr, int n)
  720.     { return ((istream*)this)->read((char*)ptr, n); }
  721.  
  722.     istream& read(signed char *ptr, int n)
  723.     { return ((istream*)this)->read((char*)ptr, n); }
  724.  
  725.     istream& read(void *ptr, int n)
  726.     { return ((istream*)this)->read((char*)ptr, n); }
  727.     istream& getline(char* ptr, int len, char delim = '\n')
  728.     { return ((istream*)this)->getline(ptr, len, delim); }
  729.     istream& get(char* ptr, int len, char delim = '\n')
  730.     { return ((istream*)this)->get(ptr, len, delim); }
  731.     istream& gets(char **s, char delim = '\n')
  732.     { return ((istream*)this)->gets(s, delim); }
  733.     istream& ignore(int n=1, int delim = (-1) )
  734.     { return ((istream*)this)->ignore(n, delim); }
  735.     int ipfx(int need) { return ((istream*)this)->ipfx(need); }
  736.     int ipfx0()  { return ((istream*)this)->ipfx0(); }
  737.     int ipfx1()  { return ((istream*)this)->ipfx1(); }
  738.     int get() { return _strbuf->sbumpc(); }
  739.     int peek() { return ipfx1() ? _strbuf->sgetc() : (-1) ; }
  740.     int  gcount() { return _gcount; }
  741.     istream& putback(char ch) { return ((istream*)this)->putback(ch); }
  742.     istream& unget() { return ((istream*)this)->unget(); }
  743.     istream& seekg(streampos pos) { return ((istream*)this)->seekg(pos); }
  744.     istream& seekg(streamoff off, _seek_dir dir)
  745.     { return ((istream*)this)->seekg(off, dir); }
  746.     streampos tellg() { return ((istream*)this)->tellg(); }
  747.     istream& scan(const char *format ...);
  748.     istream& vscan(const char *format, char *  args)
  749.     { return ((istream*)this)->vscan(format, args); }
  750.  
  751.     istream& unget(char ch) { return putback(ch); }
  752.  
  753.  
  754.      
  755.     int opfx() { return ((ostream*)this)->opfx(); }
  756.     void osfx() { ((ostream*)this)->osfx(); }
  757.     ostream& flush() { return ((ostream*)this)->flush(); }
  758.     ostream& put(char c) { return ((ostream*)this)->put(c); }
  759.     ostream& write(const char *s, int n)
  760.     { return ((ostream*)this)->write(s, n); }
  761.     ostream& write(const unsigned char *s, int n)
  762.     { return ((ostream*)this)->write((const char*)s, n); }
  763.  
  764.     ostream& write(const signed char *s, int n)
  765.     { return ((ostream*)this)->write((const char*)s, n); }
  766.  
  767.     ostream& write(const void *s, int n)
  768.     { return ((ostream*)this)->write((const char*)s, n); }
  769.     ostream& form(const char *format ...);
  770.     ostream& vform(const char *format, char *  args)
  771.     { return ((ostream*)this)->vform(format, args); }
  772.     ostream& seekp(streampos pos) { return ((ostream*)this)->seekp(pos); }
  773.     ostream& seekp(streamoff off, _seek_dir dir)
  774.     { return ((ostream*)this)->seekp(off, dir); }
  775.     streampos tellp() { return ((ostream*)this)->tellp(); }
  776. };
  777.  
  778. extern istream cin;
  779. extern ostream cout, cerr, clog;  
  780.  
  781. struct Iostream_init { } ;   
  782.  
  783. inline ios& dec(ios& i)
  784. { i.setf(ios::dec, ios::dec|ios::hex|ios::oct); return i; }
  785. inline ios& hex(ios& i)
  786. { i.setf(ios::hex, ios::dec|ios::hex|ios::oct); return i; }
  787. inline ios& oct(ios& i)
  788. { i.setf(ios::oct, ios::dec|ios::hex|ios::oct); return i; }
  789.  
  790.  
  791. # 7 "/sym/gnu/lib/g++-include/stream.h" 2 3
  792.  
  793.  
  794. extern char* form(const char*, ...);
  795.  
  796. extern char* dec(long, int=0);
  797. extern char* dec(int, int=0);
  798. extern char* dec(unsigned long, int=0);
  799. extern char* dec(unsigned int, int=0);
  800.  
  801. extern char* hex(long, int=0);
  802. extern char* hex(int, int=0);
  803. extern char* hex(unsigned long, int=0);
  804. extern char* hex(unsigned int, int=0);
  805.  
  806. extern char* oct(long, int=0);
  807. extern char* oct(int, int=0);
  808. extern char* oct(unsigned long, int=0);
  809. extern char* oct(unsigned int, int=0);
  810.  
  811. inline istream& WS(istream& str) { return ws(str); }
  812.  
  813.  
  814. # 1 "foo.cc" 2
  815.  
  816.  
  817. extern "C" {
  818. # 1 "winlib.h" 1
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828. extern int wininit ( void );
  829. extern int winid ( int n );
  830. extern int winsetcolor ( int n, char *name );
  831. extern int winsetgrey ( int n, double v );
  832. extern int winsetwidth ( int n, int w );
  833. extern int winsetfont ( int n, char *s );
  834. extern int winmake ( int n, char *name, int w, int h );
  835. extern int winflush ( void );
  836. extern int winsynchronize ( int onoff );
  837. extern int winsync ( void );
  838. extern int winclear ( int n );
  839. extern int winpoint ( int n, int x, int y );
  840. extern int winline ( int n, int x0, int y0, int x1, int y1 );
  841. extern int winrect ( int n, int x0, int y0, int x1, int y1 );
  842. extern int winfrect ( int n, int x0, int y0, int x1, int y1 );
  843. extern int winpoly ( int n, struct Points *points, int r );
  844. extern int wintext ( int n, int x, int y, char *s );
  845. extern int winlabel ( int n, int x, int y, char *s );
  846. extern int winbclick ( int n, int *b, int *x, int *y );
  847. extern int winclick ( int n, int *x, int *y );
  848. extern int wininput ( int n, int *b, int *x, int *y, char **s );
  849. extern int windiscardinput ( int n );
  850. extern int wingetline ( int n, int *b, int *x0, int *y0, int *x1, int *y1 );
  851. extern int wingetrect ( int n, int *b, int *x0, int *y0, int *x1, int *y1 );
  852. extern int wingetpoly ( int n, int *b, int *xs, int *ys, int *m );
  853. extern int winfidraw ( int n, int wx, int wy, float **data, int w, int h, int x, int y );
  854. extern int winucidraw ( int n, int wx, int wy, unsigned char **data, int w, int h, int x, int y );
  855. extern int winbipaint ( int n, unsigned char **image, int w, int h, int x, int y );
  856.  
  857. # 70 "winlib.h"
  858.  
  859.  
  860. # 4 "foo.cc" 2
  861.  
  862. }
  863.  
  864. # 1 "Art.h" 1
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871. extern "C" { void abort(); }
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888. template <class T>
  889. class Art {
  890. protected:
  891.     int mark_temp;
  892.     T *data;
  893.     int dims[1];
  894.     void constructor(int d) {
  895.         if(d<0) abort() ;
  896.         mark_temp=0;
  897.         dims[0]=d;
  898.         if(d>0) {
  899.             data=new T[d];
  900.             if(!data) abort() ;
  901.         } else data=0;
  902.          
  903.     }
  904.     void destructor() {
  905.         if(!data) return;
  906.         delete [] data;
  907.         mark_temp=0;
  908.         data=0;
  909.         dims[0]=0;
  910.      }
  911.     void copy(Art &other) {
  912.         int d0=dims[0]<?other.dims[0];
  913.         for(int i=0;i<d0;i++) data[i]=other.data[i];
  914.     }
  915. public:
  916.     void copyclear(Art &other) {
  917.         dims[0]=other.dims[0];
  918.         data=other.data;
  919.         other.dims[0]=0;
  920.         other.data=0;
  921.     }
  922. private:
  923.     void copyconstructor(Art &other) {
  924.         mark_temp=0;
  925.         if(other.mark_temp) {
  926.             copyclear(other);
  927.         } else {
  928.             constructor(other.dims[0]);
  929.             copy(other);
  930.         }
  931.     }
  932.  public:
  933.     Art() {constructor(0);}
  934.     Art(int d) {constructor(d);}
  935.     Art(Art &other) {copyconstructor(other);}
  936.     ~Art() {destructor();}
  937.      
  938.     Art &operator=(Art &other) {
  939.         destructor();
  940.         copyconstructor(other);
  941.         return *this;
  942.     }
  943.     int dim(int i) {return dims[i];}
  944.     T &operator()(int i) {
  945.         if(unsigned(i)>=unsigned(dims[0])) abort()  ;
  946.         return data[i];
  947.     }
  948.     T &sub(int i) {return data[i];}
  949.     void resize(int nd) {
  950.         if(nd<0) abort() ;
  951.         Art t(nd);
  952.         int limit=nd<?dims[0];
  953.         for(int i=0;i<limit;i++) t.data[i]=data[i];
  954.         t.mark_temp=1;
  955.         *this=t;
  956.     }
  957.     Art &temp() { mark_temp=1; return *this; }
  958.     T *pointer() {return data;}
  959.     void fill(T value) {for(int i=0;i<dims[0];i++) data[i]=value;}
  960.  
  961.     int length() {return dims[0];}
  962.     T &operator[](int i) {return operator()(i);}
  963. };
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972. template <class T>
  973. class Stk {
  974. protected:
  975.     Art<T> stack;
  976.     int fill;
  977. public:
  978.     Stk() {stack.resize(4); fill=0;}
  979.     Stk(Stk &other) {
  980.         stack=other.stack;
  981.         fill=other.fill;
  982.     }
  983.     int dim(int i) {return stack.dim(i);}
  984.     void push(T &element) {
  985.         if(fill>=stack.dim(0)) stack.resize(2*fill);
  986.         stack.sub(fill++)=element;
  987.     }
  988.     T &tos() {
  989.         return stack(fill-1);
  990.     }
  991.     T &pop() {
  992.         return stack(--fill);
  993.     }
  994.     T &operator()(int i) {return stack(i);}
  995.     T &sub(int i) {return stack.sub(i);}
  996.     void clear() {
  997.         stack.resize(0);
  998.         stack.resize(4);
  999.         fill=0;
  1000.     }
  1001.     void compact() {
  1002.         stack.resize(fill+1);
  1003.     }
  1004.     Stk temp() { stack.temp(); return *this; }
  1005.     T *pointer() {return stack.pointer();}
  1006.     operator Art<T>&() {return stack;}
  1007.  
  1008.     int length() {return fill;}
  1009.     T &operator[](int i) {return operator()(i);}
  1010. };
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016. template <class T>
  1017. class Art2 {
  1018. protected:
  1019.     int mark_temp;
  1020.     T **data;
  1021.     int dims[2];
  1022.     int total_length;
  1023.     void constructor(int d0,int d1) {
  1024.         if(d0<0||d1<0) abort() ;
  1025.         mark_temp=0;
  1026.         dims[0]=d0;
  1027.         dims[1]=d1;
  1028.         total_length=dims[0]*dims[1];
  1029.         if(d0>0) {
  1030.             data=new T*[d0];
  1031.             if(!data) abort() ;
  1032.         } else data=0;
  1033.         if(d0>0&&d1>0) {
  1034.             T *p=new T[d0*d1];
  1035.             if(!p) abort() ;
  1036.             for(int i=0;i<d0;i++) data[i]=p+i*d1;
  1037.              
  1038.         }
  1039.     }
  1040.     void destructor() {
  1041.         if(dims[0]<1) return;
  1042.         if(!data) return;
  1043.         delete [] data[0];
  1044.         delete [] data;
  1045.         mark_temp=0;
  1046.         data=0;
  1047.         dims[0]=0;
  1048.         dims[1]=0;
  1049.     }
  1050.     void copy(Art2 &other) {
  1051.         int d0=dims[0]<?other.dims[0];
  1052.         int d1=dims[1]<?other.dims[1];
  1053.         for(int i=0;i<d0;i++) for(int j=0;j<d1;j++)
  1054.             data[i][j]=other.data[i][j];
  1055.     }
  1056. public:
  1057.     void copyclear(Art2 &other) {
  1058.         dims[0]=other.dims[0];
  1059.         dims[1]=other.dims[1];
  1060.         total_length=dims[0]*dims[1];
  1061.         data=other.data;
  1062.         other.dims[0]=0;
  1063.         other.dims[1]=0;
  1064.         other.total_length=0;
  1065.         other.data=0;
  1066.     }
  1067. private:
  1068.     void copyconstructor(Art2 &other) {
  1069.         mark_temp=0;
  1070.         if(other.mark_temp) {
  1071.             copyclear(other);
  1072.         } else {
  1073.             constructor(other.dims[0],other.dims[1]);
  1074.             copy(other);
  1075.         }
  1076.     }
  1077.  public:
  1078.     Art2() {constructor(0,0);}
  1079.     Art2(int d0,int d1) {constructor(d0,d1);}
  1080.     Art2(Art2 &other) {copyconstructor(other);}
  1081.     ~Art2() {destructor();}
  1082.      
  1083.     Art2 &operator=(Art2 &other) {
  1084.         destructor();
  1085.         copyconstructor(other);
  1086.         return *this;
  1087.     }
  1088.     int dim(int i) {return dims[i];}
  1089.     T &operator()(int i,int j) {
  1090.         if(unsigned(i)>=unsigned(dims[0])||unsigned(j)>=unsigned(dims[1]))
  1091.             abort() ; 
  1092.         return data[i][j];
  1093.     }
  1094.     T &sub(int i,int j) {return data[i][j];}
  1095.     void resize(int nd0,int nd1) {
  1096.         if(nd0<0||nd1<0) abort() ;
  1097.         Art2 t(nd0,nd1);
  1098.         int limit0=nd0<?dims[0];
  1099.         int limit1=nd1<?dims[1];
  1100.         for(int i=0;i<limit0;i++) for(int j=0;j<limit1;j++) t.data[i][j]=data[i][j];
  1101.         t.mark_temp=1;
  1102.         *this=t;
  1103.     }
  1104.     Art2 &temp() { mark_temp=1; return *this; }
  1105.     T **pointer() {return data;}
  1106.     void fill(T value) {
  1107.         for(int i=0;i<dims[0];i++) for(int j=0;j<dims[1];j++)
  1108.             data[i][j]=value;
  1109.     }
  1110.  
  1111.      
  1112.  
  1113.     int length() {return total_length;}
  1114.     T &sub(int i) {return data[0][i];}
  1115.     T &operator()(int i) {
  1116.         if(unsigned(i)>=total_length) abort() ; 
  1117.         return data[0][i];
  1118.     }
  1119. };
  1120.  
  1121. template <class T>
  1122. inline void art_swap(T &x,T &y) {
  1123.     T temp = x;
  1124.     x = y;
  1125.     y = temp;
  1126. }
  1127.  
  1128. template <class T>
  1129. inline void reverse(Art<T> &a) {
  1130.     int i;
  1131.     for(i=a.length()/2;i>=0;i--) art_swap(a.sub(i),a.sub(a.length()-i-1));
  1132. }
  1133.  
  1134. template <class T>
  1135. inline void reverse(Stk<T> &a) {
  1136.     reverse(a.stack);
  1137. }
  1138.  
  1139. template <class T>
  1140. inline void bag_remove(Stk<T> &a,T &element) {
  1141.     for(int i=0;i<a.length()-1;i++) {
  1142.         if(a(i)==element) {
  1143.             a.sub(i)=a.tos();
  1144.             a.pop();
  1145.         }
  1146.     }
  1147.     if(i<a.length()&&a.sub(i)==element) a.pop();
  1148. }
  1149.  
  1150. template <class T>
  1151. inline void ordered_remove(Stk<T> &a,T &element) {
  1152.     int source=0,dest=0;
  1153.     while(source<a.length()) {
  1154.         if(a(source)!=element) {
  1155.             a(dest)=a(source);
  1156.             dest++;
  1157.         }
  1158.         source++;
  1159.     }
  1160.     a.stack.resize(dest);
  1161. }
  1162.  
  1163. template <class T>
  1164. inline Art<T> concatenate(Art<T> &a,Art<T> &b) {
  1165.     int i,k;
  1166.     k=a.length();
  1167.     Art<T> result(k+b.length());
  1168.     for(i=0;i<a.length();i++) result.sub(i)=a.sub(i);
  1169.     for(i=0;i<b.length();i++) result.sub(i+k)=b.sub(i);
  1170.     return result.temp();
  1171. }
  1172.  
  1173. template <class T>
  1174. inline Stk<T> concatenate(Stk<T> &a,Stk<T> &b) {
  1175.     int i;
  1176.     Stk<T> result;
  1177.     for(i=0;i<a.length();i++) result.push(a.sub(i));
  1178.     for(i=0;i<b.length();i++) result.push(b.sub(i));
  1179.     return result.temp();
  1180. }
  1181.  
  1182.  
  1183. # 7 "foo.cc" 2
  1184.  
  1185. # 1 "Geo.h" 1
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191. # 1 "/sym/gnu/lib/g++-include/math.h" 1 3
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213. #pragma interface
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225. # 64 "/sym/gnu/lib/g++-include/math.h" 3
  1226.  
  1227. extern "C" {
  1228.  
  1229. double  acos(double);
  1230. double  acosh(double);
  1231. double  asin(double);
  1232. double  asinh(double);
  1233. double  atan(double);
  1234. double  atan2(double, double);
  1235. double  atanh(double);
  1236. double  cbrt(double);
  1237. double  ceil(double);
  1238. double  copysign(double,double);
  1239. double  cos(double);
  1240. double  cosh(double);
  1241. double  drem(double,double);
  1242. double  erf(double);
  1243. double  erfc(double);
  1244. double  exp(double);
  1245. double  expm1(double);
  1246. double  fabs(double);
  1247. double  finite(double);
  1248. double  floor(double);
  1249. double    fmod(double, double);
  1250. double  frexp(double, int*);
  1251. double  gamma(double);
  1252. double  hypot(double,double);
  1253. double  infnan(int);
  1254.  
  1255.  
  1256. int     isinf(double);
  1257. int     isnan(double);
  1258.  
  1259. double  j0(double);
  1260. double  j1(double);
  1261. double  jn(int, double);
  1262. double  ldexp(double, int);
  1263. double  lgamma(double);
  1264. double  log(double);
  1265. double  log10(double);
  1266. double  log1p(double);
  1267. double  logb(double);
  1268. double  modf(double, double*);
  1269. double  pow(double, double);
  1270. double  rint(double);
  1271. double  scalb(double, int);
  1272. double  sin(double);
  1273. double  sinh(double);
  1274. double  sqrt(double);
  1275. double  tan(double);
  1276. double  tanh(double);
  1277. double  y0(double);
  1278. double  y1(double);
  1279. double  yn(int, double);
  1280.  
  1281. double aint(double);
  1282. double anint(double);
  1283. int irint(double);
  1284. int nint(double);
  1285. }
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294. struct libm_exception
  1295. {
  1296.   int type;
  1297.   char* name;
  1298.   double arg1, arg2, retval;
  1299. };
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308. extern "C" int matherr(libm_exception*);
  1309.  
  1310.  
  1311.  
  1312. # 1 "/sym/gnu/lib/g++-include/values.h" 1 3
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358. # 57 "/sym/gnu/lib/g++-include/values.h" 3
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374. # 166 "/sym/gnu/lib/g++-include/values.h" 3
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384. # 150 "/sym/gnu/lib/g++-include/math.h" 2 3
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451. # 6 "Geo.h" 2
  1452.  
  1453.  
  1454. extern "C" {
  1455. void abort();
  1456. }
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.  
  1463.  
  1464.  
  1465.  
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471. template <class T,int n>
  1472. class vec {
  1473. protected:
  1474.     T v[n];
  1475. public:
  1476.     int length() {return n;}
  1477.     int dim(int) {return n;}
  1478.     vec() {}
  1479.     vec(T v0) { v[0]=v0; }
  1480.     vec(T v0,T v1) { v[0]=v0; v[1]=v1; }
  1481.     vec(T v0,T v1,T v2) { v[0]=v0; v[1]=v1; v[2]=v2; }
  1482.     vec(T v0,T v1,T v2,T v3) { v[0]=v0; v[1]=v1; v[2]=v2; v[3]=v3; }
  1483.     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; }
  1484.     
  1485.     T &operator[](int i) {return v[i];}
  1486.     T &sub(int i) {return v[i];}
  1487.     T &operator()(int i) {
  1488.         if(unsigned(i)>=n) abort(); 
  1489.         return v[i];
  1490.     }
  1491.  
  1492.      
  1493.      
  1494.      
  1495.      
  1496.      
  1497.      
  1498.      
  1499.      
  1500.      
  1501.  
  1502.      
  1503.     T operator*(vec &other) {
  1504.         T result=0;
  1505.         for(int i=0;i<n;i++) result=result+sub(i)*other.sub(i);
  1506.         return result;
  1507.     }
  1508.  
  1509.      
  1510.     vec operator-() {
  1511.         vec result;
  1512.         for(int i=0;i<n;i++) result.sub(i)= -sub(i);
  1513.         return result;
  1514.     }
  1515.     vec operator*(T other) {
  1516.         vec result;
  1517.         for(int i=0;i<n;i++) result.sub(i)=sub(i)*other;
  1518.         return result;
  1519.     }
  1520.     vec operator/(T other) {
  1521.         vec result;
  1522.         for(int i=0;i<n;i++) result.sub(i)=sub(i)/other;
  1523.         return result;
  1524.     }
  1525.     vec operator+(vec &other) {
  1526.         vec result;
  1527.         for(int i=0;i<n;i++) result.sub(i)=sub(i)+other.sub(i);
  1528.         return result;
  1529.     }
  1530.     vec operator-(vec &other) {
  1531.         vec result;
  1532.         for(int i=0;i<n;i++) result.sub(i)=sub(i)-other.sub(i);
  1533.         return result;
  1534.     }
  1535.     vec operator<?(vec &other) {
  1536.         vec result;
  1537.         for(int i=0;i<n;i++) result.sub(i)=sub(i)<?other.sub(i);
  1538.         return result;
  1539.     }
  1540.     vec operator>?(vec &other) {
  1541.         vec result;
  1542.         for(int i=0;i<n;i++) result.sub(i)=sub(i)>?other.sub(i);
  1543.         return result;
  1544.     }
  1545.  
  1546.      
  1547.     int operator==(vec &other) {
  1548.         for(int i=0;i<n;i++) if(sub(i)!=other.sub(i)) return 0;
  1549.         return 1;
  1550.     }
  1551.     int operator!=(vec &other) {
  1552.         for(int i=0;i<n;i++) if(sub(i)!=other.sub(i)) return 1;
  1553.         return 0;
  1554.     }
  1555.     int operator<(vec &other) {
  1556.         for(int i=0;i<n;i++) if(sub(i)>=other.sub(i)) return 0;
  1557.         return 1;
  1558.     }
  1559.     int operator>(vec &other) {
  1560.         for(int i=0;i<n;i++) if(sub(i)<=other.sub(i)) return 0;
  1561.         return 1;
  1562.     }
  1563.     int operator<=(vec &other) {
  1564.         for(int i=0;i<n;i++) if(sub(i)>other.sub(i)) return 0;
  1565.         return 1;
  1566.     }
  1567.     int operator>=(vec &other) {
  1568.         for(int i=0;i<n;i++) if(sub(i)<other.sub(i)) return 0;
  1569.         return 1;
  1570.     }
  1571. };
  1572.  
  1573. template <class T>
  1574. inline float euclidean_norm(T &v) {
  1575.     float total=0.0;
  1576.     for(int i=0;i<v.dim(0);i++) total+=v(i)*v(i);
  1577.     return sqrt(total);
  1578. }
  1579.  
  1580. template <class T>
  1581. inline float euclidean_distance(T &u,T &v) {
  1582.     float total=0.0;
  1583.     for(int i=0;i<u.dim(0);i++) {
  1584.         float d=u(i)-v(i);
  1585.         total+=d*d;
  1586.     }
  1587.     return sqrt(total);
  1588. }
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594. template <class T,int n>
  1595. class mat:vec<T,n*n> {
  1596. protected:
  1597. public:
  1598.     int dim(int) {return n;}
  1599.     T &operator[](int i) {return v[i];}
  1600.     T &sub(int i,int j) {return v[i*n+j];}
  1601.     T &operator()(int i,int j) {
  1602.         if(unsigned(i)>=n||unsigned(j)>=n) abort(); 
  1603.         return sub(i,j);
  1604.     }
  1605.     mat operator*(mat &other) {
  1606.         mat result;
  1607.         for(int i=0;i<n;i++) for(int j=0;j<n;j++) {
  1608.             T total=0;
  1609.             for(int k=0;k<n;k++) total=total+sub(i,k)*other.sub(k,j);
  1610.             result.sub(i,j)=total;
  1611.         }
  1612.         return result;
  1613.     }
  1614.     vec<T,n> operator*(vec<T,n> &other) {
  1615.         vec<T,n> result;
  1616.         for(int i=0;i<n;i++) {
  1617.             T total=0;
  1618.             for(int k=0;k<n;k++) total=total+sub(i,k)*other.sub(k);
  1619.             result.sub(i)=total;
  1620.         }
  1621.         return result;
  1622.     }
  1623. };
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629. typedef vec<float,2> vec2;
  1630. typedef vec<float,3> vec3;
  1631. typedef vec<float,4> vec4;
  1632.  
  1633. typedef mat<float,2> mat2;
  1634. typedef mat<float,3> mat3;
  1635. typedef mat<float,4> mat4;
  1636.  
  1637. typedef vec<int,2> ivec2;
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645. inline float norm_angle(float p) {
  1646.     while(p<0) p+=2*       3.14159265358979323846 ; while(p>=2*       3.14159265358979323846 ) p-=2*       3.14159265358979323846 ; return p;
  1647. }
  1648. inline float norm_angle0(float p) {
  1649.     while(p<-       3.14159265358979323846 ) p+=2*       3.14159265358979323846 ; while(p>=       3.14159265358979323846 ) p-=2*       3.14159265358979323846 ; return p;
  1650. }
  1651. inline float norm_orientation(float p) {
  1652.     while(p<0) p+=       3.14159265358979323846 ; while(p>=       3.14159265358979323846 ) p-=       3.14159265358979323846 ; return p;
  1653. }
  1654. inline float norm_orientation0(float p) {
  1655.     while(p<-       3.14159265358979323846 /2) p+=       3.14159265358979323846 ; while(p>=       3.14159265358979323846 /2) p-=       3.14159265358979323846 ; return p;
  1656. }
  1657. inline float orientation_difference(float p,float q) {
  1658.     fabs(norm_orientation0(p-q));
  1659. }
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674. inline vec2 cmul(vec2 &p,vec2 &q) {
  1675.     return vec2(p.sub(0)*q.sub(0)-p.sub(1)*q.sub(1),
  1676.             p.sub(0)*q.sub(1)+p.sub(1)*q.sub(0));
  1677. }
  1678.  
  1679. inline vec2 cdiv(vec2 &p,vec2 &q) {
  1680.     float n=q*q;
  1681.     return vec2((p.sub(0)*q.sub(0)+p.sub(1)*q.sub(1))/n,
  1682.             (p.sub(1)*q.sub(0)-p.sub(0)*q.sub(1))/n);
  1683. }
  1684.  
  1685. inline vec2 csqrt(vec2 &x) {
  1686.     if (x.sub(0)==0.0&&x.sub(1)==0.0)
  1687.         return vec2(0.0,0.0);
  1688.     else {
  1689.         float a=sqrt((fabs(x.sub(0))+hypot(x.sub(0),x.sub(1)))*0.5);
  1690.         float b=0.5*(x.sub(1)/a);
  1691.         if(x.sub(0)>0.0) return vec2(a, b);
  1692.         else if(x.sub(1)>=0.0) return vec2(a,b);
  1693.         else return vec2(-a,-b);
  1694.     }
  1695. }
  1696. inline vec2 cpow(vec2& x, double p) {
  1697.     float h=hypot(x.sub(0),x.sub(1));
  1698.     if (h<=0.0) abort();
  1699.     float lr=pow(h,p);
  1700.     float a=atan2(x.sub(1),x.sub(0));
  1701.     float li=p*a;
  1702.     return vec2(lr*cos(li),lr*sin(li));
  1703. }
  1704.  
  1705.  
  1706.  
  1707. inline float cross(vec2 p,vec2 q) {
  1708.     return p.sub(0)*q.sub(1)-p.sub(1)*q.sub(0);
  1709. }
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715. struct TRS2 {
  1716.     vec2 t;
  1717.     vec2 r;
  1718.     TRS2(vec2 t=vec2(0.0,0.0),vec2 r=vec2(1.0,0.0)):t(t),r(r) {
  1719.     }
  1720.     vec2 operator()(vec2 &arg) {
  1721.         return cmul(r,arg)+t;
  1722.     }
  1723.     float rotation() {
  1724.         return atan2(r(1),r(0));
  1725.     }
  1726. };
  1727.  
  1728.  
  1729.  
  1730. # 8 "foo.cc" 2
  1731.  
  1732. # 1 "Counted.h" 1
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738. # 1 "/sym/gnu/lib/g++-include/std.h" 1 3
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762. # 1 "/sym/gnu/lib/g++-include/stddef.h" 1 3
  1763.  
  1764.  
  1765. extern "C" {
  1766.  
  1767.  
  1768.  
  1769. # 1 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stddef.h" 1 3
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794.  
  1795.  
  1796.  
  1797. # 41 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stddef.h" 3
  1798.  
  1799.  
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828. typedef int ptrdiff_t;
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866. typedef int size_t;
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907. typedef __wchar_t wchar_t;
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922.  
  1923.  
  1924.  
  1925.  
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932.  
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953. # 7 "/sym/gnu/lib/g++-include/stddef.h" 2 3
  1954.  
  1955.  
  1956.  
  1957.  
  1958. }
  1959.  
  1960. # 24 "/sym/gnu/lib/g++-include/std.h" 2 3
  1961.  
  1962. # 1 "/sym/gnu/lib/g++-include/stdlib.h" 1 3
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970. extern "C" {
  1971.  
  1972. int       abs(int);
  1973.  
  1974.  
  1975. void volatile abort(void);
  1976.  
  1977.  
  1978.  
  1979.  
  1980. double    atof(const char*);
  1981. int       atoi(const char*);
  1982. long      atol(const char*);
  1983.  
  1984. int       atexit(auto void (*p) (void));
  1985. int       bsearch (const void *, const void *, size_t, 
  1986.                    size_t, auto int (*ptf)(const void*, const void*));
  1987. void*     calloc(size_t, size_t);
  1988. void      cfree(void*);
  1989.  
  1990.  
  1991. void volatile exit(int);
  1992.  
  1993.  
  1994.  
  1995.  
  1996. char*     fcvt(double, int, int*, int*);
  1997. void      free(void*);
  1998. char*     getenv(const char*);
  1999. int       getopt(int, char * const *, const char*);
  2000. int       getpw(int, char*);
  2001. char*     gcvt(double, int, char*);
  2002. char*     ecvt(double, int, int*, int*);
  2003. extern char**   environ;
  2004.  
  2005. long      labs(long);
  2006. void*     malloc(size_t);
  2007. size_t    malloc_usable_size(void*);
  2008. int       putenv(const char*);
  2009. extern char*    optarg;
  2010. extern int      opterr;
  2011. extern int      optind;
  2012. void      qsort(void*, size_t, size_t, auto int (*ptf)(void*,void*));
  2013. int       rand(void);
  2014. void*     realloc(void*, size_t);
  2015. int       setkey(const char*);
  2016. int       srand(unsigned int);
  2017. double    strtod(const char*, char**);
  2018. long      strtol(const char*, char**, int);
  2019. unsigned long stroul(const char**, int);
  2020. int       system(const char*);
  2021.  
  2022. long      random(void);
  2023. void      srandom(int);
  2024. char*     setstate(char*);
  2025. char*     initstate(unsigned, char*, int);
  2026.  
  2027. double    drand48(void);
  2028. void      lcong48(short*);
  2029. long      jrand48(short*);
  2030. long      lrand48(void);
  2031. long      mrand48(void);
  2032. long      nrand48(short*);
  2033. short*    seed48(short*);
  2034. void      srand48(long);
  2035.  
  2036. char*     ctermid(char*);
  2037. char*     cuserid(char*);
  2038. char*     tempnam(const char*, const char*);
  2039. char*     tmpnam(char*);
  2040.  
  2041. }
  2042.  
  2043. # 25 "/sym/gnu/lib/g++-include/std.h" 2 3
  2044.  
  2045. # 1 "/sym/gnu/lib/g++-include/string.h" 1 3
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  
  2054.  
  2055.  
  2056.  
  2057.  
  2058.  
  2059.  
  2060. extern "C" {
  2061.  
  2062. char*     strcat(char*, const char*);
  2063. char*     strchr(const char*, int);
  2064. int       strcmp(const char*, const char*);
  2065. int       strcoll(const char*, const char*);
  2066. char*     strcpy(char*, const char*);
  2067. int      strcspn(const char*, const char*);
  2068. char*     strdup(const char*);
  2069.  
  2070.  
  2071.  
  2072.  
  2073. int      strlen(const char*);
  2074. char*     strncat(char*, const char*, int  );
  2075. int       strncmp(const char*, const char*, int  );
  2076. char*     strncpy(char*, const char*, int  );
  2077. char*     strpbrk(const char*, const char*);
  2078. char*     strrchr(const char*, int);
  2079. int      strspn(const char*, const char*);
  2080. char*     strstr(const char*, const char *);
  2081. char*     strtok(char*, const char*);
  2082. int      strxfrm(char*, const char*, int  );
  2083.  
  2084. char*     index(const char*, int);
  2085. char*     rindex(const char*, int);
  2086. }
  2087.  
  2088. # 1 "/sym/gnu/lib/g++-include/memory.h" 1 3
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096. extern "C" {
  2097.  
  2098. void*     memalign (...) ;
  2099. void*     memccpy (...) ;
  2100. void*     memchr (...) ;
  2101. int       memcmp (...) ;
  2102. void*     memcpy (...) ;
  2103. void*     memmove (...) ;
  2104. void*     memset (...) ;
  2105. int       ffs (...) ;
  2106. int     getpagesize (...) ;
  2107. void*     valloc (...) ;
  2108.  
  2109. void      bcopy (...) ;
  2110. int       bcmp (...) ;
  2111. void      bzero (...) ;
  2112. }
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.  
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127. # 43 "/sym/gnu/lib/g++-include/string.h" 2 3
  2128.  
  2129.  
  2130.  
  2131. # 26 "/sym/gnu/lib/g++-include/std.h" 2 3
  2132.  
  2133.  
  2134. # 1 "/sym/gnu/lib/g++-include/unistd.h" 1 3
  2135.  
  2136.  
  2137.  
  2138.  
  2139.  
  2140. extern "C" {
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159. # 1 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/unistd.h" 1 3
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.  
  2191.  
  2192.  
  2193.  
  2194.  
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232. # 1 "/sym/gnu/lib/g++-include/sys/types.h" 1 3
  2233.  
  2234.  
  2235. extern "C"
  2236. {
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247. # 1 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/sys/types.h" 1 3
  2248.  
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.  
  2255.  
  2256.  
  2257.  
  2258.  
  2259.  
  2260.  
  2261.  
  2262.  
  2263. # 1 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/sys/stdtypes.h" 1 3
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277. typedef    int        sigset_t;     
  2278.  
  2279. typedef    unsigned int    speed_t;     
  2280. typedef    unsigned long    tcflag_t;     
  2281. typedef    unsigned char    cc_t;         
  2282. typedef    int        pid_t;         
  2283.  
  2284. typedef    unsigned short    mode_t;         
  2285. typedef    short        nlink_t;     
  2286.  
  2287. typedef    long        clock_t;     
  2288. typedef    long        time_t;         
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305. # 16 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/sys/types.h" 2 3
  2306.  
  2307.  
  2308.  
  2309. # 1 "/usr/include/sys/sysmacros.h" 1 3
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  
  2318.  
  2319.  
  2320.  
  2321.  
  2322.  
  2323.  
  2324.  
  2325.  
  2326.  
  2327.  
  2328.  
  2329. # 19 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/sys/types.h" 2 3
  2330.  
  2331.  
  2332.  
  2333.  
  2334.  
  2335. typedef    unsigned char    u_char;
  2336. typedef    unsigned short    u_short;
  2337. typedef    unsigned int    u_int;
  2338. typedef    unsigned long    u_long;
  2339. typedef    unsigned short    ushort;         
  2340. typedef    unsigned int    uint;         
  2341.  
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356. typedef    struct  _physadr_t { int r[1]; } *physadr_t;
  2357. typedef    struct label_t {
  2358.     int    val[2];
  2359. } label_t;
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367. typedef    struct    _quad_t { long val[2]; } quad_t;
  2368. typedef    long    daddr_t;
  2369. typedef    char *    caddr_t;
  2370. typedef    unsigned long    ino_t;
  2371. typedef    short    dev_t;
  2372. typedef    long    off_t;
  2373. typedef    unsigned short    uid_t;
  2374. typedef    unsigned short    gid_t;
  2375. typedef    long    key_t;
  2376. typedef    char *    addr_t;
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387.  
  2388.  
  2389.  
  2390.  
  2391. typedef    long    fd_mask;
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.  
  2401. typedef    struct fd_set {
  2402.     fd_mask    fds_bits[(((256 )+(( (sizeof (fd_mask) * 8        )    )-1))/( (sizeof (fd_mask) * 8        )    )) ];
  2403. } fd_set;
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411. # 113 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/sys/types.h" 3
  2412.  
  2413.  
  2414.  
  2415. # 15 "/sym/gnu/lib/g++-include/sys/types.h" 2 3
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422. }
  2423.  
  2424.  
  2425.  
  2426.  
  2427. # 73 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/unistd.h" 2 3
  2428.  
  2429.  
  2430. extern void    _exit( );
  2431. extern int    access( );
  2432. extern unsigned    alarm( );
  2433. extern int    chdir( );
  2434. extern int    __hide_chmod ( );
  2435. extern int    __hide_chown ( );
  2436. extern int    close( );
  2437. extern char    *ctermid( );
  2438. extern char    *cuserid( );
  2439. extern int    dup( );
  2440. extern int    dup2( );
  2441. extern int    __hide_execl ( );
  2442. extern int    __hide_execle ( );
  2443. extern int    __hide_execlp ( );
  2444. extern int    execv( );
  2445. extern int    execve( );
  2446. extern int    execvp( );
  2447. extern pid_t    fork( );
  2448. extern long    fpathconf( );
  2449. extern char    *getcwd( );
  2450. extern gid_t    getegid( );
  2451. extern uid_t    geteuid( );
  2452. extern gid_t    getgid( );
  2453. extern int    getgroups( );
  2454. extern char    *getlogin( );
  2455. extern pid_t    getpgrp( );
  2456. extern pid_t    getpid( );
  2457. extern pid_t    getppid( );
  2458. extern uid_t    getuid( );
  2459. extern int    isatty( );
  2460. extern int    link( );
  2461. extern off_t    lseek( );
  2462. extern long    pathconf( );
  2463. extern int    pause( );
  2464. extern int    pipe( );
  2465. extern int    read( );
  2466. extern int    rmdir( );
  2467. extern int    __hide_setgid ( );
  2468. extern int    setpgid( );
  2469. extern pid_t    setsid( );
  2470. extern int    __hide_setuid ( );
  2471. extern unsigned    sleep( );
  2472. extern long    sysconf( );
  2473. extern pid_t    tcgetpgrp( );
  2474. extern int    tcsetpgrp( );
  2475. extern char    *ttyname( );
  2476. extern int    unlink( );
  2477. extern int    write( );
  2478.  
  2479.  
  2480.  
  2481. # 25 "/sym/gnu/lib/g++-include/unistd.h" 2 3
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497. # 59 "/sym/gnu/lib/g++-include/unistd.h" 3
  2498.  
  2499.  
  2500.  
  2501. extern void volatile _exit(int);
  2502.  
  2503.  
  2504.  
  2505.  
  2506. extern unsigned alarm (...) ;
  2507. extern int      brk (...) ;
  2508. extern int      chdir (...) ;
  2509. extern int      chmod  (...) ;
  2510. extern int      chown (const char*, unsigned short , unsigned short );
  2511. extern int      close (...) ;
  2512. extern char*    crypt (...) ;
  2513. extern int      dup (...) ;
  2514. extern int      dup2 (...) ;
  2515. extern void    encrypt (...) ;
  2516. extern int      execl (const char*, const char *, ...);
  2517. extern int      execle (const char*, const char *, ...);
  2518. extern int      execlp (const char*, const char*, ...);
  2519. extern int      exect (...) ;
  2520. extern int      execv (...) ;
  2521. extern int      execve (...) ;
  2522. extern int      execvp (...) ;
  2523. extern int      fchown (int, unsigned short , unsigned short );
  2524. extern int  fork (...) ;
  2525. extern int      fsync (...) ;
  2526. extern int      ftruncate (...) ;
  2527. extern char*    getcwd (...) ;
  2528. extern int      getdomainname (...) ;
  2529. extern int      getdtablesize (...) ;
  2530. extern int      getgroups (...) ;
  2531. extern unsigned short  geteuid (...) ;
  2532. extern unsigned short  getegid (...) ;
  2533. extern unsigned short  getgid (...) ;
  2534. extern long     gethostid (...) ;
  2535. extern int      gethostname (...) ;
  2536. extern int  getpgrp (...) ;
  2537. extern int  getpid (...) ;
  2538. extern int  getppid (...) ;
  2539. extern char*    getlogin (...) ;
  2540. extern char*    getpass (...) ;
  2541. extern unsigned short  getuid (...) ;
  2542. extern int      ioctl (int, int, ... );
  2543. extern int      isatty (...) ;
  2544. extern int      link (...) ;
  2545. extern int      mkstemp (...) ;
  2546. extern char*    mktemp (...) ;
  2547. extern int      nice (...) ;
  2548. extern int      pause (...) ;
  2549. extern int      pipe (...) ;
  2550. extern int      readlink (...) ;
  2551. extern int      rename (...) ;
  2552. extern int      rmdir (...) ; 
  2553. extern void*    sbrk (...) ; 
  2554. extern int      syscall (...) ;
  2555. extern int      setgid (unsigned short );
  2556. extern int      sethostname (...) ;
  2557.  
  2558.  
  2559.  
  2560.  
  2561. extern int  setpgrp (...) ;
  2562.  
  2563. extern int      setregid (...) ;
  2564. extern int      setreuid (...) ;
  2565. extern int      setuid (unsigned short );
  2566. extern unsigned sleep (...) ;
  2567. extern void     swab (...) ;
  2568. extern int      symlink (...) ;
  2569. extern long     sysconf (...) ;
  2570. extern int      truncate (...) ;
  2571. extern char*    ttyname (...) ;
  2572. extern int      ttyslot (...) ;
  2573.  
  2574. extern int      unlink (...) ;
  2575. extern int  vfork (...) ;
  2576. extern int      vadvise (...) ;
  2577. extern int      vhangup (...) ;
  2578. extern long  lseek (...) ;
  2579. extern int  read (...) ;
  2580. extern int  write (...) ;
  2581. extern int      access (...) ;
  2582.  
  2583. extern int      flock (...) ;
  2584.  
  2585.  
  2586. }
  2587.  
  2588.  
  2589. # 28 "/sym/gnu/lib/g++-include/std.h" 2 3
  2590.  
  2591. # 1 "/sym/gnu/lib/g++-include/stdio.h" 1 3
  2592.  
  2593.  
  2594.  
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600.  
  2601.  
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612. #pragma interface
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626. extern "C" {
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.  
  2648.  
  2649.  
  2650.  
  2651.  
  2652.  
  2653.  
  2654.  
  2655.  
  2656.  
  2657.  
  2658.  
  2659.  
  2660. # 1 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdio.h" 1 3
  2661.  
  2662. # 1 "/sym/gnu/lib/g++-include/stdarg.h" 1 3
  2663. extern "C" {
  2664. # 1 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdarg.h" 1 3
  2665.  
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696. # 1 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/va-sparc.h" 1 3
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708. typedef char * __gnuc_va_list;
  2709.  
  2710.  
  2711.  
  2712.  
  2713.  
  2714.  
  2715.  
  2716.  
  2717.  
  2718. # 79 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/va-sparc.h" 3
  2719.  
  2720.  
  2721. # 32 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdarg.h" 2 3
  2722.  
  2723. # 77 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdarg.h" 3
  2724.  
  2725.  
  2726.  
  2727.  
  2728.  
  2729.  
  2730. # 140 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdarg.h" 3
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736. # 2 "/sym/gnu/lib/g++-include/stdarg.h" 2 3
  2737.  
  2738. }
  2739. # 2 "/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdio.h" 2 3
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746. extern    struct    _iobuf {
  2747.     int    _cnt;
  2748.     unsigned char *_ptr;
  2749.     unsigned char *_base;
  2750.     int    _bufsiz;
  2751.     short    _flag;
  2752.     char    _file;         
  2753. } _iob[];
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.  
  2777.  
  2778.  
  2779.  
  2780.  
  2781.  
  2782.  
  2783.  
  2784.  
  2785.  
  2786.  
  2787.  
  2788.  
  2789.  
  2790.  
  2791.  
  2792.  
  2793.  
  2794. extern struct _iobuf     *__hide_fopen ();
  2795. extern struct _iobuf     *__hide_fdopen ();
  2796. extern struct _iobuf     *__hide_freopen ();
  2797. extern struct _iobuf     *__hide_popen ();
  2798. extern struct _iobuf     *tmpfile();
  2799. extern long    __hide_ftell ();
  2800. extern char    *fgets();
  2801. extern char    *gets();
  2802. extern char    *__hide_sprintf ();
  2803. extern char    *ctermid();
  2804. extern char    *cuserid();
  2805. extern char    *__hide_tempnam ();
  2806. extern char    *tmpnam();
  2807.  
  2808.  
  2809.  
  2810.  
  2811.  
  2812.  
  2813. # 69 "/sym/gnu/lib/g++-include/stdio.h" 2 3
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845.  
  2846.  
  2847.  
  2848.  
  2849.  
  2850.  
  2851.  
  2852.  
  2853. }
  2854.  
  2855. extern "C" {
  2856.  
  2857. int    fclose(struct _iobuf *);
  2858. struct _iobuf *  fdopen(int, const char*);
  2859. int    fflush(struct _iobuf *);
  2860. int    fgetc(struct _iobuf *);
  2861. char*  fgets(char*, int, struct _iobuf  *);
  2862. struct _iobuf *  fopen(const char*, const char*);
  2863. int    fprintf(struct _iobuf *, const char* ...);
  2864. int    fputc(int, struct _iobuf *);
  2865. int    fputs(const char*, struct _iobuf *);
  2866. int   fread(void*, int  , int  , struct _iobuf *);
  2867.  
  2868.  
  2869.  
  2870. struct _iobuf *  freopen(const char*, const char*, struct _iobuf *);
  2871.  
  2872. int    fscanf(struct _iobuf *, const char* ...);
  2873. int    fseek(struct _iobuf *, long, int);
  2874. long   ftell(struct _iobuf  *);
  2875. int   fwrite(const void*, int  , int  , struct _iobuf *);
  2876. char*  gets(char*);
  2877. int    getw(struct _iobuf *);
  2878. int    pclose(struct _iobuf *);
  2879. void   perror(const char*);
  2880. struct _iobuf *  popen(const char*, const char*);
  2881. int    printf(const char* ...);
  2882. int    puts(const char*);
  2883. int    putw(int, struct _iobuf *);
  2884. int    rewind(struct _iobuf *);
  2885. int    scanf(const char* ...);
  2886. void   setbuf(struct _iobuf *, char*);
  2887. void   setbuffer(struct _iobuf *, char*, int);
  2888. int    setlinebuf(struct _iobuf *);
  2889. int    setvbuf(struct _iobuf *, char*, int, int  );
  2890. int    sscanf(char*, const char* ...);
  2891. struct _iobuf *  tmpfile();
  2892. int    ungetc(int, struct _iobuf *);
  2893. int    vfprintf (...) ;
  2894. int    vprintf (...) ;
  2895. char*  sprintf (...) ;
  2896. char*  vsprintf (...) ;
  2897.  
  2898. extern int _filbuf (...) ;
  2899. extern int _flsbuf (...) ;
  2900.  
  2901. }
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914.  
  2915.  
  2916.  
  2917.  
  2918.  
  2919.  
  2920. # 29 "/sym/gnu/lib/g++-include/std.h" 2 3
  2921.  
  2922. # 1 "/sym/gnu/lib/g++-include/errno.h" 1 3
  2923.  
  2924.  
  2925. extern "C" {
  2926.  
  2927.  
  2928.  
  2929.  
  2930.  
  2931. # 1 "/usr/include/errno.h" 1 3
  2932.  
  2933.  
  2934.  
  2935.  
  2936.  
  2937.  
  2938.  
  2939.  
  2940.  
  2941. # 1 "/usr/include/sys/errno.h" 1 3
  2942.  
  2943.  
  2944.  
  2945.  
  2946.  
  2947.  
  2948.  
  2949.  
  2950.  
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974.  
  2975.  
  2976.  
  2977.  
  2978.  
  2979.  
  2980.  
  2981.  
  2982.  
  2983.  
  2984.  
  2985.  
  2986.  
  2987.  
  2988.  
  2989.  
  2990.  
  2991.  
  2992.  
  2993.  
  2994.  
  2995.  
  2996.  
  2997.  
  2998.  
  2999.      
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.      
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.      
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.  
  3041.  
  3042.  
  3043.  
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075. # 10 "/usr/include/errno.h" 2 3
  3076.  
  3077. extern int errno;
  3078.  
  3079.  
  3080. # 9 "/sym/gnu/lib/g++-include/errno.h" 2 3
  3081.  
  3082.  
  3083.  
  3084.  
  3085. extern char*    sys_errlist[];
  3086. extern int      sys_nerr;
  3087.  
  3088. extern int      errno;
  3089.  
  3090. void      perror(const char*);
  3091. char*     strerr(int);
  3092.  
  3093.  
  3094. }
  3095.  
  3096.  
  3097. # 30 "/sym/gnu/lib/g++-include/std.h" 2 3
  3098.  
  3099. # 1 "/sym/gnu/lib/g++-include/fcntl.h" 1 3
  3100.  
  3101.  
  3102. extern "C" {
  3103.  
  3104.  
  3105.  
  3106.  
  3107.  
  3108.  
  3109.  
  3110.  
  3111.  
  3112.  
  3113. # 1 "/usr/include/fcntl.h" 1 3
  3114.  
  3115.  
  3116.  
  3117.  
  3118.  
  3119. # 1 "/usr/include/sys/fcntlcom.h" 1 3
  3120.  
  3121.  
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146.  
  3147.  
  3148.  
  3149.  
  3150.  
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.  
  3164.  
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.  
  3173.  
  3174.  
  3175.  
  3176.  
  3177.  
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194.  
  3195.  
  3196.  
  3197.  
  3198.  
  3199.  
  3200.  
  3201.  
  3202.  
  3203.  
  3204.  
  3205.  
  3206.  
  3207.  
  3208.  
  3209.  
  3210.  
  3211.  
  3212.  
  3213.  
  3214.  
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244. struct flock {
  3245.     short    l_type;         
  3246.     short    l_whence;     
  3247.     long    l_start;     
  3248.     long    l_len;         
  3249.     short    l_pid;         
  3250.     short    l_xxx;         
  3251. };
  3252.  
  3253.  
  3254.  
  3255. struct eflock {
  3256.     short    l_type;         
  3257.     short    l_whence;     
  3258.     long    l_start;     
  3259.     long    l_len;         
  3260.     short    l_pid;         
  3261.     short    l_xxx;         
  3262.     long    l_rpid;         
  3263.     long    l_rsys;         
  3264. };
  3265.  
  3266.  
  3267.  
  3268. # 1 "/sym/gnu/lib/g++-include/sys/stat.h" 1 3
  3269.  
  3270.  
  3271. extern "C"
  3272. {
  3273.  
  3274.  
  3275.  
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282. # 1 "/usr/include/sys/stat.h" 1 3
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294. struct    stat {
  3295.     dev_t    st_dev;
  3296.     ino_t    st_ino;
  3297.     mode_t    st_mode;
  3298.     short    st_nlink;
  3299.     uid_t    st_uid;
  3300.     gid_t    st_gid;
  3301.     dev_t    st_rdev;
  3302.     off_t    st_size;
  3303.     time_t    st_atime;
  3304.     int    st_spare1;
  3305.     time_t    st_mtime;
  3306.     int    st_spare2;
  3307.     time_t    st_ctime;
  3308.     int    st_spare3;
  3309.     long    st_blksize;
  3310.     long    st_blocks;
  3311.     long    st_spare4[2];
  3312. };
  3313.  
  3314.  
  3315.  
  3316.  
  3317.  
  3318.  
  3319.  
  3320.  
  3321.  
  3322.  
  3323.  
  3324.  
  3325.  
  3326.  
  3327.  
  3328.  
  3329.  
  3330.  
  3331.  
  3332.  
  3333.  
  3334.  
  3335.  
  3336.  
  3337.  
  3338.  
  3339.  
  3340.  
  3341.  
  3342.  
  3343.  
  3344.  
  3345.  
  3346.  
  3347.  
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367. int    __hide_chmod ( );
  3368. int    fstat( );
  3369. int    mkdir( );
  3370. int    mkfifo( );
  3371. int    stat( );
  3372. mode_t    umask( );
  3373.  
  3374.  
  3375.  
  3376. # 14 "/sym/gnu/lib/g++-include/sys/stat.h" 2 3
  3377.  
  3378.  
  3379.  
  3380.  
  3381.  
  3382.  
  3383. extern int       chmod  (...) ;
  3384. extern int       stat (...) ;
  3385. extern int       lstat (...) ;
  3386. extern int       fstat (...) ;
  3387.  
  3388.  
  3389.  
  3390.  
  3391.  
  3392.  
  3393.  
  3394.  
  3395.  
  3396.  
  3397.  
  3398.  
  3399.  
  3400.  
  3401.  
  3402.  
  3403.  
  3404.  
  3405. }
  3406.  
  3407.  
  3408. # 149 "/usr/include/sys/fcntlcom.h" 2 3
  3409.  
  3410.  
  3411. int     __hide_open ( );
  3412. int    __hide_creat ( );
  3413. int    __hide_fcntl ( );
  3414.  
  3415.  
  3416. # 6 "/usr/include/fcntl.h" 2 3
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422. # 14 "/sym/gnu/lib/g++-include/fcntl.h" 2 3
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431. int       fcntl(int, int, ...);
  3432. int      creat (...) ;
  3433.  
  3434. int       open (...) ;
  3435.  
  3436.  
  3437. }
  3438.  
  3439. # 31 "/sym/gnu/lib/g++-include/std.h" 2 3
  3440.  
  3441.  
  3442. extern "C" {
  3443. int strcasecmp (...) ;
  3444. }
  3445.  
  3446.  
  3447. # 6 "Counted.h" 2
  3448.  
  3449.  
  3450. template <class T>
  3451. struct Counted {
  3452. protected:
  3453.     int *count;
  3454.     T *object;
  3455.     void dec_count() {
  3456.         if(!count) return;
  3457.         (*count)--;
  3458.         if(*count<=0) {
  3459.             delete count;
  3460.             delete object;
  3461.             count=0;
  3462.             object=0;
  3463.         }
  3464.     }
  3465.     void inc_count() {
  3466.         if(!count) return;
  3467.         (*count)++;
  3468.     }
  3469.     Counted &assign(Counted &other) {
  3470.         other.inc_count();
  3471.         dec_count();
  3472.         count=other.count;
  3473.         object=other.object;
  3474.         return *this;
  3475.     }
  3476.     void constructor(T *object) {
  3477.         this->object = object;
  3478.         count = new int(1);
  3479.     }
  3480.  public:
  3481.     Counted() {
  3482.         count=0;
  3483.         object=0;
  3484.     }
  3485.     Counted(T *object) {
  3486.         constructor(object);
  3487.     }
  3488.     ~Counted() {
  3489.         dec_count();
  3490.     }
  3491.     Counted(Counted &other) {
  3492.         count=other.count;
  3493.         object=other.object;
  3494.         inc_count();
  3495.     }
  3496.     void operator=(Counted &other) {
  3497.         assign(other);
  3498.     }
  3499.     void clear() {
  3500.         dec_count();
  3501.         count=0;
  3502.         object=0;
  3503.     }
  3504.     int operator==(Counted &other) {
  3505.         return object==other.object;
  3506.     }
  3507.     int operator!=(Counted &other) {
  3508.         return object!=other.object;
  3509.     }
  3510.  
  3511.     T &operator*() {if(!object) abort(); else return *object; return *object;}
  3512.     T *operator->() {if(!object) abort(); else return object; return object;}
  3513.     operator T&() {if(!object) abort(); else return *object; return *object;}
  3514.  
  3515.      
  3516. };
  3517.  
  3518.  
  3519. # 9 "foo.cc" 2
  3520.  
  3521. # 1 "Str.h" 1
  3522.  
  3523.  
  3524.  
  3525. # 1 "/sym/gnu/lib/g++-include/std.h" 1 3
  3526.  
  3527.  
  3528.  
  3529.  
  3530.  
  3531.  
  3532.  
  3533.  
  3534.  
  3535.  
  3536.  
  3537.  
  3538.  
  3539.  
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545. # 37 "/sym/gnu/lib/g++-include/std.h" 3
  3546.  
  3547. # 4 "Str.h" 2
  3548.  
  3549. # 1 "Art.h" 1
  3550.  
  3551.  
  3552. # 318 "Art.h"
  3553.  
  3554. # 5 "Str.h" 2
  3555.  
  3556.  
  3557. struct Str {
  3558.     Art<char> data;
  3559.     operator char*() {return data.pointer();}
  3560.     char *pointer() {return data.pointer();}
  3561.     Str() {}
  3562.     Str(int size):data(size) {}
  3563.     Str(char *p) {
  3564.         data.resize(strlen(p)+1);
  3565.         strcpy(pointer(),p);
  3566.     }
  3567.      
  3568.     Str(Str &other) {
  3569.         data=other.data;
  3570.     }
  3571.     Str &operator=(Str &other) {
  3572.         data=other.data; return *this;
  3573.     }
  3574.     char operator()(int i) {return data(i);}
  3575.     int length() {return data.dim(0);}
  3576.     Str &temp() {
  3577.         data.temp();
  3578.         return *this;
  3579.     }
  3580.     Str operator+(Str &other) {
  3581.         Str result(length()+other.length()+1);
  3582.         strcpy(result.pointer(),pointer());
  3583.         strcat(result.pointer(),other.pointer());
  3584.         return result.temp();
  3585.     }
  3586.     int operator==(Str &other) {return strcmp(pointer(),other.pointer())==0;}
  3587.     int operator!=(Str &other) {return strcmp(pointer(),other.pointer())!=0;}
  3588.     int operator<(Str &other) {return strcmp(pointer(),other.pointer())<0;}
  3589.     int operator>(Str &other) {return strcmp(pointer(),other.pointer())>0;}
  3590.     int operator<=(Str &other) {return strcmp(pointer(),other.pointer())<=0;}
  3591.     int operator>=(Str &other) {return strcmp(pointer(),other.pointer())>=0;}
  3592.     Str substring(int from,int below) {
  3593.         if(below<0) below=length();
  3594.         if(below>length()) abort();
  3595.         Str result(below-from);
  3596.         for(int i=from;i<below;i++)
  3597.             result.data(i-from)=data(i);
  3598.         return result.temp();
  3599.     }
  3600. };
  3601.  
  3602. inline unsigned hash(Str &s) {
  3603.     unsigned x = 0;
  3604.     for(int i=0;i<s.length();i++) x = (x*467 + s(i))%10000019;
  3605.     return x;
  3606. }
  3607.  
  3608.  
  3609. # 10 "foo.cc" 2
  3610.  
  3611.  
  3612. template <class V>
  3613. struct BaseConstraint {
  3614.     virtual ~BaseConstraint() {}
  3615.     virtual void new_value() {}
  3616.     virtual void no_value() {}
  3617. };
  3618.  
  3619.  
  3620.  
  3621. template <class V>
  3622. struct RConnector {
  3623. private:
  3624.     typedef Counted< BaseConstraint<V> >  VConstraint;
  3625.     int fixed;
  3626.     V value;
  3627.     VConstraint source;
  3628.     Stk<VConstraint> constraints;
  3629.     
  3630. public:
  3631.     void connect(Counted< BaseConstraint<V> >  &constraint) {
  3632.         constraints.push(constraint);
  3633.         if(has_value()) constraint->new_value();
  3634.     }
  3635.     int has_value() {return fixed;}
  3636.     V get_value() {return value;}
  3637.     void set_value(V new_value,VConstraint &new_source) {
  3638.         if(has_value()) {
  3639.             if(new_value!=value) abort();
  3640.         } else {
  3641.             fixed=1;
  3642.             source=new_source;
  3643.             for(int i=0;i<constraints.length();i++) {
  3644.                 if(constraints(i)==new_source) continue;
  3645.                 constraints(i)->new_value();
  3646.             }
  3647.         }
  3648.     }
  3649.     void forget_value(VConstraint retractor) {
  3650.         for(int i=0;i<constraints.length();i++) {
  3651.             if(constraints(i)==retractor) continue;
  3652.             constraints(i)->new_value();
  3653.         }
  3654.     }
  3655. };
  3656.  
  3657. template <class V>
  3658. struct Connector : public Counted< RConnector<V> > {
  3659.     Connector() {constructor(new RConnector<V>);}
  3660.     void operator=(Connector &other) {assign(other);}
  3661. };
  3662.  
  3663. template <class V>
  3664. struct Constant : BaseConstraint<V> {
  3665.     V value;
  3666.     Connector<V> connection;
  3667.     
  3668.     void new_value() {}
  3669.     void no_value() {}
  3670.     Constant(V value,Connector<V> connection)
  3671.     :value(value),connection(connection) {}
  3672. };
  3673.  
  3674. template <class V>
  3675. Counted< BaseConstraint<V> >  make_Constant(V value,Connector<V> connection) {
  3676.     Counted< BaseConstraint<V> >  constraint = new Constant<V>(value,connection);
  3677.     connection->connect(constraint);
  3678.     connection->set_value(value,constraint);
  3679.     return constraint;
  3680. }
  3681.  
  3682. template <class V>
  3683. struct Reporter : BaseConstraint<V> {
  3684.     char *name;
  3685.     Connector<V> connection;
  3686.  
  3687.     void new_value() {
  3688.         cout << "Reporter " << name << ":" << 1 << "\n";
  3689.     }
  3690.     void no_value() {
  3691.         cout << "Reporter " << name << ": [unconstrained] \n";
  3692.     }
  3693.     Reporter(char *name,Connector<V> connection)
  3694.     :name(name),connection(connection) {}
  3695. };
  3696.  
  3697. template <class V>
  3698. Counted< BaseConstraint<V> >  make_Reporter(char *name,Connector<V> connection) {
  3699.     Counted< BaseConstraint<V> >  constraint = new Reporter<V>(name,connection);
  3700.     connection->connect(constraint);
  3701.     return constraint;
  3702. }
  3703.  
  3704. main() {
  3705.     Connector<int> c;
  3706.     Counted< BaseConstraint<int> >  out = make_Reporter("foo",c);
  3707.     Counted< BaseConstraint<int> >  in = make_Constant(9,c);
  3708. }
  3709. ================================================================
  3710.  
  3711.