home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / gnu / gcc / bug / 2164 < prev    next >
Encoding:
Text File  |  1992-08-21  |  18.2 KB  |  841 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!scs.CArleton.CA!petras
  3. From: petras@scs.CArleton.CA (juraj petras)
  4. Subject: compiler crushes
  5. Message-ID: <9208211706.AA18137@turing.scs.carleton.ca>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Fri, 21 Aug 1992 17:06:19 GMT
  10. Approved: bug-gcc@prep.ai.mit.edu
  11. Lines: 828
  12.  
  13. ----------
  14. X-Sun-Data-Type: text
  15. X-Sun-Data-Description: text
  16. X-Sun-Data-Name: text
  17. X-Sun-Content-Lines: 36
  18.  
  19. Hi,
  20. I need a help.
  21.  
  22. I tried to run simple program inspired by B. Stroustrup from "The C++ Programing Language" second edition p.260. A non-intrusive list is supposed to stored the pointers to the Dates. I localized that compiler crushed when it compiled
  23. the definition of ilst (SList of Dates). The rest is enclosed in the comment brackets.
  24.  
  25.  SList<Date> ilst;
  26.  
  27. Here are the information which should help you to find an error:
  28.  
  29. I use Sparc station, SunOS + OpenWindows Version 3. I didn't install gcc and
  30. so I don't know the operands for configure command.
  31.  
  32. All necessary files are included in the file "outfile".
  33.  
  34.  
  35. wilkes% gcc -E tSList.cc > outfile
  36. wilkes% gcc -v tSList.cc 
  37. Reading specs from /usr/local/lib/gcc/sparc/2.0/specs
  38. gcc version 2.0
  39.  /usr/local/lib/gcc/sparc/2.0/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 tSList.cc /usr/tmp/cca09086.cpp
  40. GNU CPP version 2.0 (sparc)
  41.  /usr/local/lib/gcc/sparc/2.0/cc1plus /usr/tmp/cca09086.cpp -quiet -dumpbase tSList.cc -version -o /usr/tmp/cca09086.s
  42. GNU C++ version 2.0 (sparc) compiled by GNU C version 2.0.
  43. gcc: Internal compiler error: program cc1plus got fatal signal 11
  44. wilkes% 
  45.  
  46. Remark:
  47. The intrusive list works perfect using template as is stated a few pages
  48. before in the same book.
  49.  
  50. I am going use g++ as an implementaion language for my thesis.
  51.  
  52. Thank you for you help 
  53.  
  54. Juraj Petras, School of Computer Science, Carleton University, Ottawa
  55. ----------
  56. X-Sun-Data-Type: default
  57. X-Sun-Data-Name: outfile
  58. X-Sun-Content-Lines: 734
  59.  
  60. # 1 "tSList.cc"
  61. # 1 "SList.h" 1
  62. struct SLink {
  63.  
  64.      SLink* next;
  65.      SLink() { next = 0; }
  66.     SLink(SLink* p) { next = p; }
  67. };
  68.  
  69.  
  70. template<class TT>
  71. struct TLink : public SLink {
  72.     TT info;
  73.     TLink(const TT& a) : info(a) { }
  74.     ~TLink();
  75. };
  76.  
  77.  
  78. class SListBase
  79. {
  80.     SLink* last;         
  81. public:
  82.     int insert(SLink*) ;     
  83.     int append(SLink*);     
  84.     SLink* get();         
  85.     SListBase()    { last = 0; }
  86.     SListBase(SLink* a) { last = a->next = a; }
  87. };
  88.  
  89. template<class T> 
  90. class SList : private SListBase 
  91. {
  92. public:
  93.     SList() : SListBase() {}
  94.     ~SList();    
  95.     void insert(const T& a) 
  96.         {SListBase::insert(new TLink<T>(a)); }
  97.     void append(const T& a) 
  98.         {SListBase::append(new TLink<T>(a)); }
  99.     T get(){
  100.         TLink<T>* lnk = (TLink<T>*) SListBase::get();
  101.         T i = lnk->info;
  102.         delete lnk;
  103.         return i;
  104.         }
  105.     
  106. };
  107. # 1 "tSList.cc" 2
  108.  
  109. # 1 "Date.h" 1
  110. # 1 "/usr/local/lib/g++-include/iostream.h" 1 3
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130. #pragma interface
  131.  
  132.  
  133.  
  134.  
  135. # 1 "/usr/local/lib/g++-include/streambuf.h" 1 3
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156. #pragma interface
  157.  
  158.  
  159.  
  160. # 1 "/usr/local/lib/g++-include/stddef.h" 1 3
  161.  
  162.  
  163. extern "C" {
  164.  
  165.  
  166.  
  167. # 1 "/usr/local/lib/gcc/sparc/2.0/include/stddef.h" 1 3
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198. typedef int ptrdiff_t;
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220. typedef int size_t;
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244. typedef short unsigned int wchar_t;
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265. # 7 "/usr/local/lib/g++-include/stddef.h" 2 3
  266.  
  267.  
  268.  
  269.  
  270. }
  271.  
  272. # 25 "/usr/local/lib/g++-include/streambuf.h" 2 3
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289. class ostream; class streambuf;
  290.  
  291. typedef long streamoff, streampos;
  292.  
  293. struct _ios_fields {  
  294.     streambuf *_strbuf;
  295.     ostream* _tie;
  296.     long _width;
  297.     unsigned long _flags;
  298.     char _fill;
  299.     unsigned char _state;
  300.     unsigned short _precision;
  301. };
  302.  
  303.  
  304.  
  305.  
  306.  
  307. class ios : public _ios_fields {
  308.   public:
  309.     enum io_state { goodbit=0, eofbit=1, failbit=2, badbit=4 };
  310.     enum open_mode {
  311.     in=1,
  312.     out=2,
  313.     ate=4,
  314.     app=8,
  315.     trunc=16,
  316.     nocreate=32,
  317.     noreplace=64 };
  318.     enum seek_dir { beg, cur, end};
  319.     enum { skipws=01, left=02, right=04, internal=010,
  320.        dec=020, oct=040, hex=0100,
  321.        showbase=0200, showpoint=0400, uppercase=01000, showpos=02000,
  322.        scientific=04000, fixed=0100000, unitbuf=020000, stdio=040000,
  323.        dont_close=0x80000000  
  324.        };
  325.  
  326.     ostream* tie() { return _tie; }
  327.     ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; }
  328.  
  329.      
  330.     char fill() { return _fill; }
  331.     char fill(char newf) { char oldf = _fill; _fill = newf; return oldf; }
  332.     unsigned long flags() { return _flags; }
  333.     unsigned long flags(unsigned long new_val) {
  334.     unsigned long old_val = _flags; _flags = new_val; return old_val; }
  335.     unsigned short precision() { return _precision; }
  336.     unsigned short precision(int newp) {
  337.     unsigned short oldp = _precision; _precision = (unsigned short)newp;
  338.     return oldp; }
  339.     unsigned long setf(unsigned long val) {
  340.     unsigned long oldbits = _flags;
  341.     _flags |= val; return oldbits; }
  342.     unsigned long setf(unsigned long val, unsigned long mask) {
  343.     unsigned long oldbits = _flags;
  344.     _flags = (_flags & ~mask) | (val & mask); return oldbits; }
  345.     unsigned long unsetf(unsigned long mask) {
  346.     unsigned long oldbits = _flags & mask;
  347.     _flags &= ~mask; return oldbits; }
  348.     long width() { return _width; }
  349.     long width(long val) { long save = _width; _width = val; return save; }
  350.  
  351.     static const unsigned long basefield;
  352.     static const unsigned long adjustfield;
  353.     static const unsigned long floatfield;
  354.  
  355.     streambuf* rdbuf() { return _strbuf; }
  356.     void clear(int state = 0) { _state = state; }
  357.     int good() { return _state == 0; }
  358.     int eof() { return _state & ios::eofbit; }
  359.     int fail() { return _state & (ios::badbit|ios::failbit); }
  360.     int bad() { return _state & ios::badbit; }
  361.     int rdstate() { return _state; }
  362.     void set(int flag) { _state |= flag; }
  363.     operator void*() { return fail() ? (void*)0 : (void*)this; }
  364.     int operator!() { return fail(); }
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.   protected:
  375.     ios(streambuf*sb) { _strbuf=sb; _state=0; _width=0; _fill=' ';
  376.             _flags=ios::skipws; _precision=6; }
  377. };
  378.  
  379.  
  380.  
  381.  
  382. typedef ios::seek_dir _seek_dir;
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405. struct __streambuf {
  406.      
  407.     int _flags;         
  408.     char* _gptr;     
  409.     char* _egptr;     
  410.     char* _eback;     
  411.     char* _pbase;     
  412.     char* _pptr;     
  413.     char* _epptr;     
  414.     char* _base;     
  415.     char* _ebuf;     
  416.     struct streambuf *_chain;
  417. };
  418.  
  419. struct streambuf : private __streambuf {
  420.     friend class ios;
  421.     friend class istream;
  422.     friend class ostream;
  423.   protected:
  424.     static streambuf* _list_all;  
  425.     streambuf*& xchain() { return _chain; }
  426.     void _un_link();
  427.     void _link_in();
  428.     char* gptr() const { return _gptr; }
  429.     char* pptr() const { return _pptr; }
  430.     char* egptr() const { return _egptr; }
  431.     char* epptr() const { return _epptr; }
  432.     char* pbase() const { return _pbase; }
  433.     char* eback() const { return _eback; }
  434.     char* ebuf() const { return _ebuf; }
  435.     char* base() const { return _base; }
  436.     void xput_char(char c) { *_pptr++ = c; }
  437.     int xflags() { return _flags; }
  438.     int xflags(int f) { int fl = _flags; _flags = f; return fl; }
  439.     void xsetflags(int f) { _flags |= f; }
  440.     void gbump(int n) { _gptr += n; }
  441.     void pbump(int n) { _pptr += n; }
  442.     void setb(char* b, char* eb, int a=0);
  443.     void setp(char* p, char* ep) { _pbase=_pptr=p; _epptr=ep; }
  444.     void setg(char* eb, char* g, char *eg) { _eback=eb; _gptr=g; _egptr=eg; }
  445.   public:
  446.     static int flush_all();
  447.     static void flush_all_linebuffered();  
  448.     virtual int underflow();  
  449.     virtual int overflow(int c = (-1) );  
  450.     virtual int doallocate();
  451.     virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
  452.     virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out);
  453.     int sputbackc(char c);
  454.     int sungetc();
  455.     streambuf();
  456.     virtual ~streambuf();
  457.     int unbuffered() { return _flags & 2  ? 1 : 0; }
  458.     int linebuffered() { return _flags & 0x4000  ? 1 : 0; }
  459.     void unbuffered(int i)
  460.     { if (i) _flags |= 2 ; else _flags &= ~2 ; }
  461.     void linebuffered(int i)
  462.     { if (i) _flags |= 0x4000 ; else _flags &= ~0x4000 ; }
  463.     int allocate() {
  464.     if (base() || unbuffered()) return 0;
  465.     else return doallocate(); }
  466.     virtual int sync();
  467.     virtual int pbackfail(int c);
  468.     virtual int ungetfail();
  469.     virtual streambuf* setbuf(char* p, int len);
  470.     int in_avail() { return _egptr - _gptr; }
  471.     int out_waiting() { return _pptr - _pbase; }
  472.     virtual int sputn(const char* s, int n);
  473.     virtual int sgetn(char* s, int n);
  474.     long sgetline(char* buf, size_t n, char delim, int putback_delim);
  475.     int sbumpc() {
  476.     if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
  477.     else return *(unsigned char*)_gptr++; }
  478.     int sgetc() {
  479.     if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
  480.     else return *(unsigned char*)_gptr; }
  481.     int snextc() {
  482.     if (++_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
  483.     else return *(unsigned char*)_gptr; }
  484.     int sputc(int c) {
  485.     if (_pptr >= _epptr) return overflow(c);
  486.     return *_pptr++ = c, (unsigned char)c; }
  487.     int vscan(char const *fmt0, char*  ap);
  488.     int vform(char const *fmt0, char*  ap);
  489. };
  490.  
  491. struct __file_fields {
  492.     char _fake;
  493.     char _shortbuf[1];
  494.     short _fileno;
  495.     int _blksize;
  496.     char* _save_gptr;
  497.     char* _save_egptr;
  498.     long  _offset;
  499. };
  500.  
  501. class filebuf : public streambuf {
  502.     struct __file_fields _fb;
  503.     void init();
  504.   public:
  505.     filebuf();
  506.     filebuf(int fd);
  507.     filebuf(int fd, char* p, int len);
  508.     ~filebuf();
  509.     filebuf* attach(int fd);
  510.     filebuf* open(const char *filename, const char *mode);
  511.     filebuf* open(const char *filename, int mode, int prot = 0664);
  512.     virtual int underflow();
  513.     virtual int overflow(int c = (-1) );
  514.     int is_open() { return _fb._fileno >= 0; }
  515.     int fd() { return is_open() ? _fb._fileno : (-1) ; }
  516.     filebuf* close();
  517.     virtual int doallocate();
  518.     virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
  519.     int sputn(const char* s, int n);
  520.     int sgetn(char* s, int n);
  521.   protected:  
  522.     virtual int pbackfail(int c);
  523.     virtual int sync();
  524.     int is_reading() { return eback() != egptr(); }
  525.     char* cur_ptr() { return is_reading() ?  gptr() : pptr(); }
  526.      
  527.     char* file_ptr() { return _fb._save_gptr ? _fb._save_egptr : egptr(); }
  528.     int do_flush();
  529.      
  530.     virtual int sys_read(char* buf, size_t size);
  531.     virtual long  sys_seek(long , _seek_dir);
  532.     virtual long sys_write(const void*, long);
  533.     virtual int sys_stat(void*);  
  534.     virtual int sys_close();
  535. };
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545. # 25 "/usr/local/lib/g++-include/iostream.h" 2 3
  546.  
  547.  
  548. class istream; class ostream;
  549. typedef istream& (*__imanip)(istream&);
  550. typedef ostream& (*__omanip)(ostream&);
  551.  
  552. extern istream& ws(istream& ins);
  553. extern ostream& flush(ostream& outs);
  554. extern ostream& endl(ostream& outs);
  555. extern ostream& ends(ostream& outs);
  556.  
  557. class ostream : public ios
  558. {
  559.     void do_osfx();
  560.   public:
  561.     ostream();
  562.     ostream(streambuf* sb, ostream* tied=((void *)0) );
  563.     ~ostream();
  564.  
  565.     int opfx() { if (!good()) return 0; if (_tie) _tie->flush(); return 1; }
  566.     void osfx() { if (flags() & (ios::unitbuf|ios::stdio))
  567.               do_osfx(); }
  568.     streambuf* ostreambuf() const { return _strbuf; }
  569.     ostream& flush();
  570.     ostream& put(char c);
  571.     ostream& write(const char *s, int n);
  572.     ostream& write(const unsigned char *s, int n) { return write((char*)s, n);}
  573.     ostream& write(const void *s, int n) { return write((char*)s, n);}
  574.     ostream& seekp(streampos);
  575.     ostream& seekp(streamoff, _seek_dir);
  576.     streampos tellp();
  577.     ostream& form(const char *format ...);
  578.     ostream& vform(const char *format, char*  args);
  579. };
  580.  
  581. ostream& operator<<(ostream&, char c);
  582. ostream& operator<<(ostream& os, unsigned char c) { return os << (char)c; }
  583.  
  584. extern ostream& operator<<(ostream&, const char *s);
  585. inline ostream& operator<<(ostream& os, const unsigned char *s)
  586. { return os << (const char*)s; }
  587.  
  588.  
  589. ostream& operator<<(ostream&, void *p);
  590. ostream& operator<<(ostream&, int n);
  591. ostream& operator<<(ostream&, long n);
  592. ostream& operator<<(ostream&, unsigned int n);
  593. ostream& operator<<(ostream&, unsigned long n);
  594. ostream& operator<<(ostream& os, short n) {return os << (int)n;}
  595. ostream& operator<<(ostream& os, unsigned short n)
  596. {return os << (unsigned int)n;}
  597. ostream& operator<<(ostream&, float n);
  598. ostream& operator<<(ostream&, double n);
  599. ostream& operator<<(ostream& os, __omanip func) { return (*func)(os); }
  600. ostream& operator<<(ostream&, streambuf*);
  601.  
  602. class istream : public ios
  603. {
  604.     size_t _gcount;
  605.   public:
  606.     istream();
  607.     istream(streambuf* sb, ostream*tied=((void *)0) );
  608.     ~istream();
  609.     streambuf* istreambuf() const { return _strbuf; }
  610.     istream& get(char& c);
  611.     istream& get(unsigned char& c);
  612.     istream& read(char *ptr, int n);
  613.     istream& read(unsigned char *ptr, int n) { return read((char*)ptr, n); }
  614.     istream& read(void *ptr, int n) { return read((char*)ptr, n); }
  615.     int get() { return _strbuf->sbumpc(); }
  616.     istream& getline(char* ptr, int len, char delim = '\n');
  617.     istream& get(char* ptr, int len, char delim = '\n');
  618.     istream& gets(char **s, char delim = '\n');
  619.     int ipfx(int need) {
  620.     if (!good()) { set(ios::failbit); return 0; }
  621.     if (_tie && (need == 0 || rdbuf()->in_avail() < need)) _tie->flush();
  622.     if (!need && (flags() & ios::skipws) && !ws(*this)) return 0;
  623.     return 1;
  624.     }
  625.     int ipfx0() {  
  626.     if (!good()) { set(ios::failbit); return 0; }
  627.     if (_tie) _tie->flush();
  628.     if ((flags() & ios::skipws) && !ws(*this)) return 0;
  629.     return 1;
  630.     }
  631.     int ipfx1() {  
  632.     if (!good()) { set(ios::failbit); return 0; }
  633.     if (_tie && rdbuf()->in_avail() == 0) _tie->flush();
  634.     return 1;
  635.     }
  636.     size_t gcount() { return _gcount; }
  637.     istream& seekg(streampos);
  638.     istream& seekg(streamoff, _seek_dir);
  639.     streampos tellg();
  640.     istream& putback(char ch) {
  641.     if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit);
  642.     return *this;}
  643.     istream& unget() {
  644.     if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit);
  645.     return *this;}
  646.  
  647.  
  648.  
  649.  
  650. };
  651.  
  652. istream& operator>>(istream&, char*);
  653. istream& operator>>(istream& is, unsigned char* p) { return is >> (char*)p; }
  654.  
  655. istream& operator>>(istream&, char& c);
  656. istream& operator>>(istream&, unsigned char& c);
  657.  
  658. istream& operator>>(istream&, int&);
  659. istream& operator>>(istream&, long&);
  660. istream& operator>>(istream&, short&);
  661. istream& operator>>(istream&, unsigned int&);
  662. istream& operator>>(istream&, unsigned long&);
  663. istream& operator>>(istream&, unsigned short&);
  664. istream& operator>>(istream&, float&);
  665. istream& operator>>(istream&, double&);
  666. istream& operator>>(istream& is, __imanip func) { return (*func)(is); }
  667.  
  668. class iostream : public ios {
  669.     size_t _gcount;
  670.   public:
  671.     iostream();
  672.     operator istream&() { return *(istream*)this; }
  673.     operator ostream&() { return *(ostream*)this; }
  674.     ~iostream();
  675.      
  676.     istream& get(char& c) { return ((istream*)this)->get(c); }
  677.     istream& get(unsigned char& c) { return ((istream*)this)->get(c); }
  678.     istream& read(char *ptr, int n) { return ((istream*)this)->read(ptr, n); }
  679.     istream& read(unsigned char *ptr, int n)
  680.     { return ((istream*)this)->read((char*)ptr, n); }
  681.     istream& read(void *ptr, int n)
  682.     { return ((istream*)this)->read((char*)ptr, n); }
  683.     int get() { return _strbuf->sbumpc(); }
  684.     istream& getline(char* ptr, int len, char delim = '\n')
  685.     { return ((istream*)this)->getline(ptr, len, delim); }
  686.     istream& get(char* ptr, int len, char delim = '\n')
  687.     { return ((istream*)this)->get(ptr, len, delim); }
  688.     istream& gets(char **s, char delim = '\n')
  689.     { return ((istream*)this)->gets(s, delim); }
  690.     int ipfx(int need) { return ((istream*)this)->ipfx(need); }
  691.     int ipfx0()  { return ((istream*)this)->ipfx0(); }
  692.     int ipfx1()  { return ((istream*)this)->ipfx1(); }
  693.     size_t gcount() { return _gcount; }
  694.     istream& putback(char ch) { return ((istream*)this)->putback(ch); }
  695.     istream& unget() { return ((istream*)this)->unget(); }
  696.     istream& seekg(streampos pos) { return ((istream*)this)->seekg(pos); }
  697.     istream& seekg(streamoff off, _seek_dir dir)
  698.     { return ((istream*)this)->seekg(off, dir); }
  699.     streampos tellg() { return ((istream*)this)->tellg(); }
  700.  
  701.  
  702.  
  703.  
  704.      
  705.     int opfx() { return ((ostream*)this)->opfx(); }
  706.     void osfx() { ((ostream*)this)->osfx(); }
  707.     ostream& flush() { return ((ostream*)this)->flush(); }
  708.     ostream& put(char c) { return ((ostream*)this)->put(c); }
  709.     ostream& write(const char *s, int n)
  710.     { return ((ostream*)this)->write(s, n); }
  711.     ostream& write(const unsigned char *s, int n)
  712.     { return ((ostream*)this)->write((char*)s, n); }
  713.     ostream& write(const void *s, int n)
  714.     { return ((ostream*)this)->write((char*)s, n); }
  715.     ostream& form(const char *format ...);
  716.     ostream& vform(const char *format, char*  args)
  717.     { return ((ostream*)this)->vform(format, args); }
  718.     ostream& seekp(streampos pos) { return ((ostream*)this)->seekp(pos); }
  719.     ostream& seekp(streamoff off, _seek_dir dir)
  720.     { return ((ostream*)this)->seekp(off, dir); }
  721.     streampos tellp() { return ((ostream*)this)->tellp(); }
  722. };
  723.  
  724. extern istream cin;
  725. extern ostream cout, cerr, clog;  
  726.  
  727. inline ostream& ostream::put(char c) { _strbuf->sputc(c); return *this; }
  728.  
  729. struct Iostream_init { } ;   
  730.  
  731.  
  732. # 1 "Date.h" 2
  733.  
  734.  
  735. class Date {
  736.     int month, day, year;
  737. public:
  738.     Date(int d, int m, int y) {day = d; month = m; year = y;}
  739.     Date(const Date&);
  740.     Date() {day = 20; month = 8; year = 1992;}
  741.     Date& operator=(const Date&);
  742.     void print() { cout << day << '/' << month << '/' << year << '\n' ;}
  743.     int CMP(Date& , Date&);
  744. };
  745.  
  746. inline int Date::CMP(Date& a, Date& b)
  747. {
  748.     long int n1 = 10000 * a.year + 100 * a.month + a.day;
  749.     long int n2 = 10000 * b.year + 100 * b.month + b.day;
  750.     return (n1 <= n2) ? ((n1 == n2) ? 0 : -1) : 1;
  751. }
  752.     
  753. # 2 "tSList.cc" 2
  754.  
  755. int main()
  756. {
  757.     Date d(20,8,92);
  758.     SList<Date> ilst;
  759.      
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790. }
  791.  
  792.  
  793.     
  794. ----------
  795. X-Sun-Data-Type: default
  796. X-Sun-Data-Name: tSList.cc
  797. X-Sun-Content-Lines: 41
  798.  
  799. #include "SList.h"
  800. #include "Date.h"
  801. int main()
  802. {
  803.     Date d(20,8,92);
  804.     SList<Date> ilst;
  805.     /*ilst.insert(Date(12,8,1992));
  806.     ilst.insert(Date(13,8,1992));
  807.     ilst.insert(Date(14,8,1992));
  808.     ilst.append(Date(15,8,1992));
  809.     ilst.append(Date(16,8,1992));
  810.     ilst.insert(Date(17,8,1992));
  811.     Date d = ilst.get();
  812.     d.print();
  813.      d = ilst.get();
  814.     d.print();
  815.     d = ilst.get();
  816.     d.print();
  817.     d = ilst.get();
  818.     d.print();
  819.     d = ilst.get();
  820.     d.print();
  821.     d = ilst.get();
  822.     d.print();
  823.     ilst.append(Date(18,8,1992));
  824.     ilst.insert(Date(19,8,1992));
  825.     d = ilst.get();
  826.     d.print();
  827.     d = ilst.get();
  828.     d.print();
  829.     ilst.insert(Date(20,8,1992));
  830.     ilst.insert(Date(21,8,1992));
  831.     d = ilst.get();
  832.     d.print();
  833.     d = ilst.get();
  834.     d.print();
  835.     exit(0);*/
  836. }
  837.  
  838.  
  839.     
  840.  
  841.