diff options
author | Robert Lipe <robertl@gcc.gnu.org> | 1998-05-27 23:00:37 +0000 |
---|---|---|
committer | Robert Lipe <robertl@gcc.gnu.org> | 1998-05-27 23:00:37 +0000 |
commit | 26963cc3e169e29e3deb2c9c66d1ceba51596db8 (patch) | |
tree | 571db4ad79180858b47e7ce99ff6d3797f40496a /gcc | |
parent | 5bc80b30dfb404c576343eac379e72425bb58267 (diff) | |
download | gcc-26963cc3e169e29e3deb2c9c66d1ceba51596db8.zip gcc-26963cc3e169e29e3deb2c9c66d1ceba51596db8.tar.gz gcc-26963cc3e169e29e3deb2c9c66d1ceba51596db8.tar.bz2 |
Addition of a whole slew of "eb" test cases generated from the egcs-bugs mailing lists.
Addition of a whole slew of "eb" test cases generated from the egcs-bugs
mailing lists. See g++.robertl/README
From-SVN: r20107
Diffstat (limited to 'gcc')
131 files changed, 8365 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/980310-1.C b/gcc/testsuite/g++.old-deja/g++.robertl/980310-1.C new file mode 100644 index 0000000..07bd8dc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/980310-1.C @@ -0,0 +1,43 @@ +// Special g++ Options: -g +// Internal compiler error on egcs 1.0.1 i586-pc-linux-gnulibc1. +// From: Max Lawson <mlawson@drfmc.ceng.cea.fr> +// Message-Id: <9803091022.AA07520@drfmc.ceng.cea.fr> + + +typedef unsigned int size_t; + +struct dummy { }; + +struct arrrrrgh { }; + +template<class Par,class Rand = arrrrrgh> +struct whyyyyyyy { }; + +template<class T, class S =dummy> +struct grrrrrrrr { }; + +template<class Par, class Par2 =Par, class Rand =arrrrrgh> +class no_future +{ +public: + + template<class S> + no_future(const grrrrrrrr<whyyyyyyy<Par,Rand>*,S>& man ) { } + + ~no_future( ) { } + +private: + + no_future(const no_future&); + no_future& operator=(const no_future&); +}; + +int main( ) +{ + grrrrrrrr<whyyyyyyy<double>*> man; + + no_future<double> here(man); + + return 0; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/980310-2.C b/gcc/testsuite/g++.old-deja/g++.robertl/980310-2.C new file mode 100644 index 0000000..62c152f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/980310-2.C @@ -0,0 +1,33 @@ +// float mismatch. Abors on i586-pc-linux-gnulibc1 with egcs 1.0.1 +// Should run smoothly. Aborts on i586-pc-linux-gnulibc1 +// From: Max Lawson <mlawson@drfmc.ceng.cea.fr> +// Message-Id: <9803091022.AA07520@drfmc.ceng.cea.fr> + +#include <cstdlib> + +void f(double j, double& v) +{ + size_t sz = size_t(2*j+1); + double norm_ = j*(j+1); + double m = j; + int sign_ = -1; + for (size_t c=1;c<=sz;++c) + for (size_t r=1;r<=sz;++r) + if (r+sign_*1 == c) + { + double val = (norm_-m*(m+sign_)); + for (size_t k=1;k<2;++k) + val *= (norm_ - (m+sign_*k)*(m+sign_*(k+1))); + v = val; + } +} + +int main() +{ + double v; + f(1,v); + if (v != 4) abort(); + + return 0; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/980310-3.C b/gcc/testsuite/g++.old-deja/g++.robertl/980310-3.C new file mode 100644 index 0000000..a8c2e19 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/980310-3.C @@ -0,0 +1,42 @@ +// Bug: Segfaults on egcs 1.0.1 i586-pc-linux-glibc1 +// From: Max Lawson <mlawson@drfmc.ceng.cea.fr> +// Message-Id: <9803091022.AA07520@drfmc.ceng.cea.fr> + +class S0 +{ +public: + + S0() { }; + + virtual ~S0() { } +}; + + + +struct S { }; +class S1 : public S, public S0 +{ +public: + + S1() { } +}; + + +void test_ptr(void *ctxt) +{ + S0 *ctxt1 = static_cast<S0*>(ctxt); + + S1* ctxt2 = dynamic_cast<S1*>(ctxt1); +} + + +int main() +{ + S1 *ctxt = new S1(); + + test_ptr(ctxt); + + return 0; +} + + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb10.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb10.C new file mode 100644 index 0000000..7da5d75 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb10.C @@ -0,0 +1,30 @@ +// Build don't link: +template <int object_size> +class _fixed_size_allocator +{ + private: + + struct something { }; + static something * asdf; + + public: + + static void delete_object (); +}; + + +template <class T> +class object_allocator +{ + private: + + typedef _fixed_size_allocator<sizeof (T)> allocator; + + public: + + static void deallocate (T * p) + { + allocator::delete_object (reinterpret_cast<void *> (p)); + } +}; + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb100.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb100.C new file mode 100644 index 0000000..fdf7396 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb100.C @@ -0,0 +1,173 @@ +// Special g++ Options: -Wall + +#include <list> + +template < class N, class A > +class Base +{ +public: + class NN : public N + { + friend Base<N,A>; + friend ostream& operator<<(ostream &os, const NN& n) + { + n.print(os); + return os; + } + public: + void print(ostream &os) const + { + os << "Base<N,A>::print()" << endl; + N::print(os); + } + }; + + typedef NN* NNPtr; + typedef list<NNPtr> NList; + typedef NList::iterator n_list_iter; + + class n_iter : public n_list_iter + { + friend bool operator<(n_iter a, n_iter b) + { + return (a->ind() < b->ind()); + } + friend bool operator>(n_iter a, n_iter b) + { + return (a->ind() > b->ind()); + } + + public: + n_iter() {} + n_iter(n_list_iter i) : n_list_iter(i) {} + + NN& operator*() + { return *n_list_iter::operator*();}; + NN* operator->() + { return n_list_iter::operator*(); } + }; +private: + NList ns; + n_iter new_n_aux(NN* nd) + { + ns.push_back(nd); + n_iter nodi = --ns.end(); + return (nodi); + } +public: + n_iter new_n() + { + return new_n_aux(new NN()); + } + void del_n(n_iter itr) + { + NN* n = itr.operator->(); + ns.erase(itr); + delete n; + } + n_iter beg_n() { return (ns.begin()); } + n_iter end_n() { return (ns.end()); } +}; + +template <class XN, class XA> +class YN : public XN +{ +public: + YN() {}; + void print(ostream& os) const + { + os << "YN<XN,XA>::print() " << endl; + XN::print(os); + } + friend ostream& operator<< (ostream& os, const YN& wn) + { + wn.print(os); + return os; + } +}; + +template <class XN, class XA> +class YA : public XA +{ +public: + YA() {}; + void print(ostream &os) const + { + os << "YA<XN,XA>::print() " << endl; + XA::print(os); + } + + friend ostream& operator<<(ostream& os, const YA &wa) + { + wa.print(os); + return os; + } +}; + + +template<class XN, class XA> +class XBase : public Base< YN<XN, XA>, YA<XN, XA> > +{ +public: + typedef Base< YN<XN,XA>, YA<XN,XA> > Net; + typedef Net::n_iter n_iter; + XBase() {}; +}; + + +class MyClass +{ +public: + struct ZN + { + void print(ostream &os) const + { + os << "MyClass::ZN::print()" << endl; + } + inline friend ostream& operator<<(ostream& os, const MyClass::ZN& nd) + { + nd.print(os); + return os; + } + }; + struct ZA + { + void print(ostream& os) const + { + os << "MyClass::ZA::print()" << endl; + } + inline friend ostream& operator<<(ostream& os, const MyClass::ZA& ar) + { + ar.print(os); + return os; + } + }; + + typedef XBase<ZN,ZA> MyXBase; + typedef MyXBase::n_iter my_n_iter; + MyXBase xbase; +}; + +main () +{ + MyClass mine; + MyClass::my_n_iter n1, n2, n3, n4; + + n1 = mine.xbase.new_n(); + n2 = mine.xbase.new_n(); + n3 = mine.xbase.new_n(); + n4 = mine.xbase.new_n(); + + cout << *n1 << endl; + cout << *n2 << endl; + cout << *n3 << endl; + cout << *n4 << endl; + + mine.xbase.del_n(n1); + mine.xbase.del_n(n2); + mine.xbase.del_n(n3); + mine.xbase.del_n(n4); +} + + + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb101.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb101.C new file mode 100644 index 0000000..9d37141 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb101.C @@ -0,0 +1,3937 @@ +// Special g++ Options: -fcheck-memory-usage +// Build don't link: + +# 0 "/udd/bonnaud/prg/src/LS.cc" +# 1 "/udd/bonnaud/prg/src/LS.cc" +# 1 "/udd/bonnaud/poubelle/sparc-egcs/include/g++/iostream.h" 1 3 + + + + + + + + + + + + + + + + + + + + + + + + + + +#pragma interface + +#define _IOSTREAM_H + +# 1 "/udd/bonnaud/poubelle/sparc-egcs/include/g++/streambuf.h" 1 3 + + + + + + + + + + + + + + + + + + + + + + + + + +#define _STREAMBUF_H + +#pragma interface + + + + +#define _IO_NEW_STREAMS + +extern "C" { +# 1 "/udd/bonnaud/poubelle/sparc-egcs/include/g++/libio.h" 1 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + +#define _IO_STDIO_H + +# 1 "/udd/bonnaud/prg/lib_src/libg++-include/_G_config.h" 1 + + +#define _G_config_h +#define _G_LIB_VERSION "0.67" +#define _G_NAMES_HAVE_UNDERSCORE 1 +#define _G_VTABLE_LABEL_HAS_LENGTH 1 +#define _G_VTABLE_LABEL_PREFIX "__vt$" +#define _G_HAVE_ST_BLKSIZE 1 +typedef long _G_clock_t; +typedef short _G_dev_t; +typedef long _G_fpos_t; +typedef unsigned short _G_gid_t; +typedef unsigned long _G_ino_t; +typedef unsigned short _G_mode_t; +typedef short _G_nlink_t; +typedef long _G_off_t; +typedef int _G_pid_t; + + + +typedef int _G_ptrdiff_t; +typedef int _G_sigset_t; + + + +typedef unsigned int _G_size_t; +typedef long _G_time_t; +typedef unsigned short _G_uid_t; + + + +typedef __wchar_t _G_wchar_t; +typedef int _G_ssize_t; +typedef int _G_wint_t; +typedef char * _G_va_list; +#define _G_signal_return_type void +#define _G_sprintf_return_type char* + +typedef signed char _G_int8_t; + +typedef unsigned char _G_uint8_t; +typedef short _G_int16_t; +typedef unsigned short _G_uint16_t; +typedef long _G_int32_t; +typedef unsigned long _G_uint32_t; + +#define HAVE_INT64 +typedef long long _G_int64_t; +typedef unsigned long long _G_uint64_t; + +#define _G_BUFSIZ 1024 +#define _G_FOPEN_MAX 32 +#define _G_FILENAME_MAX 1024 +#define _G_NULL 0 + +#define _G_ARGS(ARGLIST) ARGLIST + + + + + + + + + +#define _G_HAVE_ATEXIT 0 +#define _G_HAVE_SYS_RESOURCE 1 +#define _G_HAVE_SYS_SOCKET 1 +#define _G_HAVE_SYS_WAIT 1 +#define _G_HAVE_UNISTD 1 +#define _G_HAVE_DIRENT 1 +#define _G_HAVE_CURSES 1 +#define _G_MATH_H_INLINES 0 +#define _G_HAVE_BOOL 1 + +# 30 "/udd/bonnaud/poubelle/sparc-egcs/include/g++/libio.h" 2 3 + +#define _IO_pos_t _G_fpos_t +#define _IO_fpos_t _G_fpos_t +#define _IO_size_t _G_size_t +#define _IO_ssize_t _G_ssize_t +#define _IO_off_t _G_off_t +#define _IO_pid_t _G_pid_t +#define _IO_uid_t _G_uid_t +#define _IO_HAVE_SYS_WAIT _G_HAVE_SYS_WAIT +#define _IO_HAVE_ST_BLKSIZE _G_HAVE_ST_BLKSIZE +#define _IO_BUFSIZ _G_BUFSIZ +#define _IO_va_list _G_va_list + +# 51 "/udd/bonnaud/poubelle/sparc-egcs/include/g++/libio.h" 3 + + + + + + + +#define __P(protos) protos + + + + + + + + +#define _PARAMS(protos) __P(protos) + + + + + +#define _IO_UNIFIED_JUMPTABLES 1 + +#define _IO_USE_DTOA 1 + + + +#define EOF (-1) + + + + +#define NULL (__null) + + + + + + + + + +#define _IOS_INPUT 1 +#define _IOS_OUTPUT 2 +#define _IOS_ATEND 4 +#define _IOS_APPEND 8 +#define _IOS_TRUNC 16 +#define _IOS_NOCREATE 32 +#define _IOS_NOREPLACE 64 +#define _IOS_BIN 128 + + + + + + + +#define _IO_MAGIC 0xFBAD0000 +#define _OLD_STDIO_MAGIC 0xFABC0000 +#define _IO_MAGIC_MASK 0xFFFF0000 +#define _IO_USER_BUF 1 +#define _IO_UNBUFFERED 2 +#define _IO_NO_READS 4 +#define _IO_NO_WRITES 8 +#define _IO_EOF_SEEN 0x10 +#define _IO_ERR_SEEN 0x20 +#define _IO_DELETE_DONT_CLOSE 0x40 +#define _IO_LINKED 0x80 +#define _IO_IN_BACKUP 0x100 +#define _IO_LINE_BUF 0x200 +#define _IO_TIED_PUT_GET 0x400 +#define _IO_CURRENTLY_PUTTING 0x800 +#define _IO_IS_APPENDING 0x1000 +#define _IO_IS_FILEBUF 0x2000 +#define _IO_BAD_SEEN 0x4000 + + +#define _IO_SKIPWS 01 +#define _IO_LEFT 02 +#define _IO_RIGHT 04 +#define _IO_INTERNAL 010 +#define _IO_DEC 020 +#define _IO_OCT 040 +#define _IO_HEX 0100 +#define _IO_SHOWBASE 0200 +#define _IO_SHOWPOINT 0400 +#define _IO_UPPERCASE 01000 +#define _IO_SHOWPOS 02000 +#define _IO_SCIENTIFIC 04000 +#define _IO_FIXED 010000 +#define _IO_UNITBUF 020000 +#define _IO_STDIO 040000 +#define _IO_DONT_CLOSE 0100000 +#define _IO_BOOLALPHA 0200000 + + +struct _IO_jump_t; struct _IO_FILE; + + +# 162 "/udd/bonnaud/poubelle/sparc-egcs/include/g++/libio.h" 3 + + + + + + + + + + typedef void _IO_lock_t; + + + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 195 "/udd/bonnaud/poubelle/sparc-egcs/include/g++/libio.h" 3 + +}; + +struct _IO_FILE { + int _flags; +#define _IO_file_flags _flags + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + int _blksize; + _G_off_t _offset; + +#define __HAVE_COLUMN + + unsigned short _cur_column; + char _unused; + char _shortbuf[1]; + + + + + + +}; + + + + + +struct _IO_FILE_plus; +extern struct _IO_FILE_plus _IO_stdin_, _IO_stdout_, _IO_stderr_; +#define _IO_stdin ((_IO_FILE*)(&_IO_stdin_)) +#define _IO_stdout ((_IO_FILE*)(&_IO_stdout_)) +#define _IO_stderr ((_IO_FILE*)(&_IO_stderr_)) + + + +typedef struct +{ + _G_ssize_t (*read) (struct _IO_FILE *, void *, _G_ssize_t ) ; + _G_ssize_t (*write) (struct _IO_FILE *, const void *, _G_ssize_t ) ; + _G_fpos_t (*seek) (struct _IO_FILE *, _G_off_t , int) ; + int (*close) (struct _IO_FILE *) ; +} _IO_cookie_io_functions_t; + + +struct _IO_cookie_file +{ + struct _IO_FILE file; + const void *vtable; + void *cookie; + _IO_cookie_io_functions_t io_functions; +}; + + + +extern "C" { + + +extern int __underflow (_IO_FILE *) ; +extern int __uflow (_IO_FILE *) ; +extern int __overflow (_IO_FILE *, int) ; + +#define _IO_getc_unlocked(_fp) ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end ? __uflow (_fp) : *(unsigned char *) (_fp)->_IO_read_ptr++) + + +#define _IO_peekc_unlocked(_fp) ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end && __underflow (_fp) == EOF ? EOF : *(unsigned char *) (_fp)->_IO_read_ptr) + + + + +#define _IO_putc_unlocked(_ch, _fp) (((_fp)->_IO_write_ptr >= (_fp)->_IO_write_end) ? __overflow (_fp, (unsigned char) (_ch)) : (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch))) + + + + +#define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0) +#define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0) + +extern int _IO_getc (_IO_FILE *__fp) ; +extern int _IO_putc (int __c, _IO_FILE *__fp) ; +extern int _IO_feof (_IO_FILE *__fp) ; +extern int _IO_ferror (_IO_FILE *__fp) ; + +extern int _IO_peekc_locked (_IO_FILE *__fp) ; + + +#define _IO_PENDING_OUTPUT_COUNT(_fp) ((_fp)->_IO_write_ptr - (_fp)->_IO_write_base) + + +extern void _IO_flockfile (_IO_FILE *) ; +extern void _IO_funlockfile (_IO_FILE *) ; +extern int _IO_ftrylockfile (_IO_FILE *) ; + + + + +#define _IO_peekc(_fp) _IO_peekc_unlocked (_fp) +#define _IO_flockfile(_fp) +#define _IO_funlockfile(_fp) +#define _IO_ftrylockfile(_fp) +#define _IO_cleanup_region_start(_fct, _fp) +#define _IO_cleanup_region_end(_Doit) + + + +extern int _IO_vfscanf (_IO_FILE *, const char *, _G_va_list , int *) ; +extern int _IO_vfprintf (_IO_FILE *, const char *, _G_va_list ) ; +extern _G_ssize_t _IO_padn (_IO_FILE *, int, _G_ssize_t ) ; +extern _G_size_t _IO_sgetn (_IO_FILE *, void *, _G_size_t ) ; + +extern _G_fpos_t _IO_seekoff (_IO_FILE *, _G_off_t , int, int) ; +extern _G_fpos_t _IO_seekpos (_IO_FILE *, _G_fpos_t , int) ; + +extern void _IO_free_backup_area (_IO_FILE *) ; + + +} + + + +# 36 "/udd/bonnaud/poubelle/sparc-egcs/include/g++/streambuf.h" 2 3 + +} + + + + + + + + + + + + + + + + + + + + +#define _IO_wchar_t short + + +extern "C++" { +class istream; +class ostream; class streambuf; + + + + + +typedef _G_off_t streamoff; +typedef _G_fpos_t streampos; +typedef _G_ssize_t streamsize; + +typedef unsigned long __fmtflags; +typedef unsigned char __iostate; + +struct _ios_fields +{ + streambuf *_strbuf; + ostream* _tie; + int _width; + __fmtflags _flags; + short _fill; + __iostate _state; + __iostate _exceptions; + int _precision; + + void *_arrays; +}; + +#define _IOS_GOOD 0 +#define _IOS_EOF 1 +#define _IOS_FAIL 2 +#define _IOS_BAD 4 + +#define _IO_INPUT 1 +#define _IO_OUTPUT 2 +#define _IO_ATEND 4 +#define _IO_APPEND 8 +#define _IO_TRUNC 16 +#define _IO_NOCREATE 32 +#define _IO_NOREPLACE 64 +#define _IO_BIN 128 + +# 115 "/udd/bonnaud/poubelle/sparc-egcs/include/g++/streambuf.h" 3 + + +class ios : public _ios_fields { + ios& operator=(ios&); + ios (const ios&); + public: + typedef __fmtflags fmtflags; + typedef int iostate; + typedef int openmode; + typedef int streamsize; + enum io_state { + goodbit = 0 , + eofbit = 1 , + failbit = 2 , + badbit = 4 }; + enum open_mode { + in = 1 , + out = 2 , + ate = 4 , + app = 8 , + trunc = 16 , + nocreate = 32 , + noreplace = 64 , + bin = 128 , + binary = 128 }; + enum seek_dir { beg, cur, end}; + typedef enum seek_dir seekdir; + + enum { skipws= 01 , + left= 02 , right= 04 , internal= 010 , + dec= 020 , oct= 040 , hex= 0100 , + showbase= 0200 , showpoint= 0400 , + uppercase= 01000 , showpos= 02000 , + scientific= 04000 , fixed= 010000 , + unitbuf= 020000 , stdio= 040000 + + + + }; + enum { + basefield=dec+oct+hex, + floatfield = scientific+fixed, + adjustfield = left+right+internal + }; + +# 168 "/udd/bonnaud/poubelle/sparc-egcs/include/g++/streambuf.h" 3 + + + ostream* tie() const { return _tie; } + ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; } + + + short fill() const { return (short )_fill; } + short fill(short newf) + {short oldf = (short )_fill; _fill = (char)newf; return oldf;} + fmtflags flags() const { return _flags; } + fmtflags flags(fmtflags new_val) { + fmtflags old_val = _flags; _flags = new_val; return old_val; } + int precision() const { return _precision; } + int precision(int newp) { + unsigned short oldp = _precision; _precision = (unsigned short)newp; + return oldp; } + fmtflags setf(fmtflags val) { + fmtflags oldbits = _flags; + _flags |= val; return oldbits; } + fmtflags setf(fmtflags val, fmtflags mask) { + fmtflags oldbits = _flags; + _flags = (_flags & ~mask) | (val & mask); return oldbits; } + fmtflags unsetf(fmtflags mask) { + fmtflags oldbits = _flags; + _flags &= ~mask; return oldbits; } + int width() const { return _width; } + int width(int val) { int save = _width; _width = val; return save; } + + + + + void _throw_failure() const { } + + void clear(iostate state = 0) { + _state = _strbuf ? state : state|badbit; + if (_state & _exceptions) _throw_failure(); } + void set(iostate flag) { _state |= flag; + if (_state & _exceptions) _throw_failure(); } + void setstate(iostate flag) { _state |= flag; + if (_state & _exceptions) _throw_failure(); } + int good() const { return _state == 0; } + int eof() const { return _state & ios::eofbit; } + int fail() const { return _state & (ios::badbit|ios::failbit); } + int bad() const { return _state & ios::badbit; } + iostate rdstate() const { return _state; } + operator void*() const { return fail() ? (void*)0 : (void*)(-1); } + int operator!() const { return fail(); } + iostate exceptions() const { return _exceptions; } + void exceptions(iostate enable) { + _exceptions = enable; + if (_state & _exceptions) _throw_failure(); } + + streambuf* rdbuf() const { return _strbuf; } + streambuf* rdbuf(streambuf *_s) { + streambuf *_old = _strbuf; _strbuf = _s; clear (); return _old; } + + static int sync_with_stdio(int on); + static void sync_with_stdio() { sync_with_stdio(1); } + static fmtflags bitalloc(); + static int xalloc(); + void*& pword(int); + void* pword(int) const; + long& iword(int); + long iword(int) const; + + + + + + + + + + + class Init { + public: + Init () { } + }; + + protected: + inline ios(streambuf* sb = 0, ostream* tie_to = 0); + inline virtual ~ios(); + inline void init(streambuf* sb, ostream* tie = 0); +}; + + + + +typedef ios::seek_dir _seek_dir; + + + + + + + + + + +class streammarker : private _IO_marker { + friend class streambuf; + void set_offset(int offset) { _pos = offset; } + public: + streammarker(streambuf *sb); + ~streammarker(); + int saving() { return 1; } + int delta(streammarker&); + int delta(); +}; + +struct streambuf : public _IO_FILE { + friend class ios; + friend class istream; + friend class ostream; + friend class streammarker; + const void *&_vtable() { return *(const void**)((_IO_FILE*)this + 1); } + protected: + static streambuf* _list_all; + _IO_FILE*& xchain() { return _chain; } + void _un_link(); + void _link_in(); + char* gptr() const + { return _flags & 0x100 ? _IO_save_base : _IO_read_ptr; } + char* pptr() const { return _IO_write_ptr; } + char* egptr() const + { return _flags & 0x100 ? _IO_save_end : _IO_read_end; } + char* epptr() const { return _IO_write_end; } + char* pbase() const { return _IO_write_base; } + char* eback() const + { return _flags & 0x100 ? _IO_save_base : _IO_read_base;} + char* base() const { return _IO_buf_base; } + char* ebuf() const { return _IO_buf_end; } + int blen() const { return _IO_buf_end - _IO_buf_base; } + void xput_char(char c) { *_IO_write_ptr++ = c; } + int xflags() { return _flags ; } + int xflags(int f) {int fl = _flags ; _flags = f; return fl;} + void xsetflags(int f) { _flags |= f; } + void xsetflags(int f, int mask) + { _flags = (_flags & ~mask) | (f & mask); } + void gbump(int n) + { _flags & 0x100 ? (_IO_save_base+=n):(_IO_read_ptr+=n);} + void pbump(int n) { _IO_write_ptr += n; } + void setb(char* b, char* eb, int a=0); + void setp(char* p, char* ep) + { _IO_write_base=_IO_write_ptr=p; _IO_write_end=ep; } + void setg(char* eb, char* g, char *eg) { + if (_flags & 0x100 ) _IO_free_backup_area(this); + _IO_read_base = eb; _IO_read_ptr = g; _IO_read_end = eg; } + char *shortbuf() { return _shortbuf; } + + int in_backup() { return _flags & 0x100 ; } + + char *Gbase() { return in_backup() ? _IO_save_base : _IO_read_base; } + + char *eGptr() { return in_backup() ? _IO_save_end : _IO_read_end; } + + char *Bbase() { return in_backup() ? _IO_read_base : _IO_save_base; } + char *Bptr() { return _IO_backup_base; } + + char *eBptr() { return in_backup() ? _IO_read_end : _IO_save_end; } + char *Nbase() { return _IO_save_base; } + char *eNptr() { return _IO_save_end; } + int have_backup() { return _IO_save_base != (__null) ; } + int have_markers() { return _markers != (__null) ; } + void free_backup_area(); + void unsave_markers(); + int put_mode() { return _flags & 0x800 ; } + int switch_to_get_mode(); + + streambuf(int flags=0); + public: + static int flush_all(); + static void flush_all_linebuffered(); + virtual ~streambuf(); + virtual int overflow(int c = (-1) ); + virtual int underflow(); + virtual int uflow(); + virtual int pbackfail(int c); + + virtual streamsize xsputn(const char* s, streamsize n); + virtual streamsize xsgetn(char* s, streamsize n); + virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); + virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out); + + streampos pubseekoff(streamoff o, _seek_dir d, int mode=ios::in|ios::out) + { return _IO_seekoff (this, o, d, mode); } + streampos pubseekpos(streampos pos, int mode = ios::in|ios::out) + { return _IO_seekpos (this, pos, mode); } + streampos sseekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); + streampos sseekpos(streampos pos, int mode = ios::in|ios::out); + virtual streambuf* setbuf(char* p, int len); + virtual int sync(); + virtual int doallocate(); + + int seekmark(streammarker& mark, int delta = 0); + int sputbackc(char c); + int sungetc(); + int unbuffered() { return _flags & 2 ? 1 : 0; } + int linebuffered() { return _flags & 0x200 ? 1 : 0; } + void unbuffered(int i) + { if (i) _flags |= 2 ; else _flags &= ~2 ; } + void linebuffered(int i) + { if (i) _flags |= 0x200 ; else _flags &= ~0x200 ; } + int allocate() { + if (base() || unbuffered()) return 0; + else return doallocate(); } + + void allocbuf() { if (base() == (__null) ) doallocbuf(); } + void doallocbuf(); + int in_avail() { return _IO_read_end - _IO_read_ptr; } + int out_waiting() { return _IO_write_ptr - _IO_write_base; } + streamsize sputn(const char* s, streamsize n) { return xsputn(s, n); } + streamsize padn(char pad, streamsize n) { return _IO_padn(this, pad, n); } + streamsize sgetn(char* s, streamsize n) { return _IO_sgetn(this, s, n); } + int ignore(int); + int get_column(); + int set_column(int); + long sgetline(char* buf, _G_size_t n, char delim, int putback_delim); + int sputc(int c) { return _IO_putc(c, this); } + int sbumpc() { return _IO_getc(this); } + int sgetc() { return (( this )->_IO_read_ptr >= ( this )->_IO_read_end && __underflow ( this ) == (-1) ? (-1) : *(unsigned char *) ( this )->_IO_read_ptr) ; } + int snextc() { + if (_IO_read_ptr >= _IO_read_end && __underflow(this) == (-1) ) + return (-1) ; + else return _IO_read_ptr++, sgetc(); } + void stossc() { if (_IO_read_ptr < _IO_read_end) _IO_read_ptr++; } + int vscan(char const *fmt0, _G_va_list ap, ios* stream = (__null) ); + int scan(char const *fmt0 ...); + int vform(char const *fmt0, _G_va_list ap); + int form(char const *fmt0 ...); + + + + + virtual streamsize sys_read(char* buf, streamsize size); + virtual streamsize sys_write(const char*, streamsize); + virtual streampos sys_seek(streamoff, _seek_dir); + virtual int sys_close(); + virtual int sys_stat(void*); +}; + + + + +class filebuf : public streambuf { + protected: + void init(); + public: + static const int openprot; + filebuf(); + filebuf(int fd); + filebuf(int fd, char* p, int len); + + + + ~filebuf(); + filebuf* attach(int fd); + filebuf* open(const char *filename, const char *mode); + filebuf* open(const char *filename, ios::openmode mode, int prot = 0664); + virtual int underflow(); + virtual int overflow(int c = (-1) ); + int is_open() const { return _fileno >= 0; } + int fd() const { return is_open() ? _fileno : (-1) ; } + filebuf* close(); + virtual int doallocate(); + virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); + virtual streambuf* setbuf(char* p, int len); + streamsize xsputn(const char* s, streamsize n); + streamsize xsgetn(char* s, streamsize n); + virtual int sync(); + protected: + + int is_reading() { return eback() != egptr(); } + char* cur_ptr() { return is_reading() ? gptr() : pptr(); } + + char* file_ptr() { return eGptr(); } + + virtual streamsize sys_read(char* buf, streamsize size); + virtual streampos sys_seek(streamoff, _seek_dir); + virtual streamsize sys_write(const char*, streamsize); + virtual int sys_stat(void*); + virtual int sys_close(); + + + + +}; + +inline void ios::init(streambuf* sb, ostream* tie_to) { + _state = sb ? ios::goodbit : ios::badbit; _exceptions=0; + _strbuf=sb; _tie = tie_to; _width=0; _fill=' '; + + _flags=ios::skipws|ios::dec; + + + + _precision=6; _arrays = 0; } + +inline ios::ios(streambuf* sb, ostream* tie_to) { init(sb, tie_to); } + +inline ios::~ios() { + + + + if (_arrays) delete [] _arrays; +} +} + +# 31 "/udd/bonnaud/poubelle/sparc-egcs/include/g++/iostream.h" 2 3 + + +extern "C++" { +class istream; class ostream; +typedef ios& (*__manip)(ios&); +typedef istream& (*__imanip)(istream&); +typedef ostream& (*__omanip)(ostream&); + +extern istream& ws(istream& ins); +extern ostream& flush(ostream& outs); +extern ostream& endl(ostream& outs); +extern ostream& ends(ostream& outs); + +class ostream : virtual public ios +{ + + void do_osfx(); + public: + ostream() { } + ostream(streambuf* sb, ostream* tied= (__null) ); + int opfx() { + if (!good()) return 0; + else { if (_tie) _tie->flush(); ; return 1;} } + void osfx() { ; + if (flags() & (ios::unitbuf|ios::stdio)) + do_osfx(); } + ostream& flush(); + ostream& put(char c) { _strbuf->sputc(c); return *this; } + + + + + + ostream& write(const char *s, streamsize n); + ostream& write(const unsigned char *s, streamsize n) + { return write((const char*)s, n);} + ostream& write(const signed char *s, streamsize n) + { return write((const char*)s, n);} + ostream& write(const void *s, streamsize n) + { return write((const char*)s, n);} + ostream& seekp(streampos); + ostream& seekp(streamoff, _seek_dir); + streampos tellp(); + ostream& form(const char *format ...); + ostream& vform(const char *format, _G_va_list args); + + ostream& operator<<(char c); + ostream& operator<<(unsigned char c) { return (*this) << (char)c; } + ostream& operator<<(signed char c) { return (*this) << (char)c; } + ostream& operator<<(const char *s); + ostream& operator<<(const unsigned char *s) + { return (*this) << (const char*)s; } + ostream& operator<<(const signed char *s) + { return (*this) << (const char*)s; } + ostream& operator<<(const void *p); + ostream& operator<<(int n); + ostream& operator<<(unsigned int n); + ostream& operator<<(long n); + ostream& operator<<(unsigned long n); + + __extension__ ostream& operator<<(long long n); + __extension__ ostream& operator<<(unsigned long long n); + + ostream& operator<<(short n) {return operator<<((int)n);} + ostream& operator<<(unsigned short n) {return operator<<((unsigned int)n);} + + ostream& operator<<(bool b) { return operator<<((int)b); } + + ostream& operator<<(double n); + ostream& operator<<(float n) { return operator<<((double)n); } + + + + ostream& operator<<(long double n) { return operator<<((double)n); } + + ostream& operator<<(__omanip func) { return (*func)(*this); } + ostream& operator<<(__manip func) {(*func)(*this); return *this;} + ostream& operator<<(streambuf*); + + + +}; + +class istream : virtual public ios +{ + +protected: + _G_size_t _gcount; + + int _skip_ws(); + public: + istream(): _gcount (0) { } + istream(streambuf* sb, ostream*tied= (__null) ); + istream& get(char* ptr, int len, char delim = '\n'); + istream& get(unsigned char* ptr, int len, char delim = '\n') + { return get((char*)ptr, len, delim); } + istream& get(char& c); + istream& get(unsigned char& c) { return get((char&)c); } + istream& getline(char* ptr, int len, char delim = '\n'); + istream& getline(unsigned char* ptr, int len, char delim = '\n') + { return getline((char*)ptr, len, delim); } + istream& get(signed char& c) { return get((char&)c); } + istream& get(signed char* ptr, int len, char delim = '\n') + { return get((char*)ptr, len, delim); } + istream& getline(signed char* ptr, int len, char delim = '\n') + { return getline((char*)ptr, len, delim); } + istream& read(char *ptr, streamsize n); + istream& read(unsigned char *ptr, streamsize n) + { return read((char*)ptr, n); } + istream& read(signed char *ptr, streamsize n) + { return read((char*)ptr, n); } + istream& read(void *ptr, streamsize n) + { return read((char*)ptr, n); } + istream& get(streambuf& sb, char delim = '\n'); + istream& gets(char **s, char delim = '\n'); + int ipfx(int need = 0) { + if (!good()) { set(ios::failbit); return 0; } + else { + ; + if (_tie && (need == 0 || rdbuf()->in_avail() < need)) _tie->flush(); + if (!need && (flags() & ios::skipws)) return _skip_ws(); + else return 1; + } + } + int ipfx0() { + if (!good()) { set(ios::failbit); return 0; } + else { + ; + if (_tie) _tie->flush(); + if (flags() & ios::skipws) return _skip_ws(); + else return 1; + } + } + int ipfx1() { + if (!good()) { set(ios::failbit); return 0; } + else { + ; + if (_tie && rdbuf()->in_avail() == 0) _tie->flush(); + return 1; + } + } + void isfx() { ; } + int get() { if (!ipfx1()) return (-1) ; + else { int ch = _strbuf->sbumpc(); + if (ch == (-1) ) set(ios::eofbit); + return ch; + } } + int peek(); + _G_size_t gcount() { return _gcount; } + istream& ignore(int n=1, int delim = (-1) ); + int sync (); + istream& seekg(streampos); + istream& seekg(streamoff, _seek_dir); + streampos tellg(); + istream& putback(char ch) { + if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit); + return *this;} + istream& unget() { + if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit); + return *this;} + istream& scan(const char *format ...); + istream& vscan(const char *format, _G_va_list args); + + + + + + + istream& operator>>(char*); + istream& operator>>(unsigned char* p) { return operator>>((char*)p); } + istream& operator>>(signed char*p) { return operator>>((char*)p); } + istream& operator>>(char& c); + istream& operator>>(unsigned char& c) {return operator>>((char&)c);} + istream& operator>>(signed char& c) {return operator>>((char&)c);} + istream& operator>>(int&); + istream& operator>>(long&); + + __extension__ istream& operator>>(long long&); + __extension__ istream& operator>>(unsigned long long&); + + istream& operator>>(short&); + istream& operator>>(unsigned int&); + istream& operator>>(unsigned long&); + istream& operator>>(unsigned short&); + + istream& operator>>(bool&); + + istream& operator>>(float&); + istream& operator>>(double&); + istream& operator>>(long double&); + istream& operator>>( __manip func) {(*func)(*this); return *this;} + istream& operator>>(__imanip func) { return (*func)(*this); } + istream& operator>>(streambuf*); +}; + +class iostream : public istream, public ostream +{ + public: + iostream() { } + iostream(streambuf* sb, ostream*tied= (__null) ); +}; + +class _IO_istream_withassign : public istream { +public: + _IO_istream_withassign& operator=(istream&); + _IO_istream_withassign& operator=(_IO_istream_withassign& rhs) + { return operator= (static_cast<istream&> (rhs)); } +}; + +class _IO_ostream_withassign : public ostream { +public: + _IO_ostream_withassign& operator=(ostream&); + _IO_ostream_withassign& operator=(_IO_ostream_withassign& rhs) + { return operator= (static_cast<ostream&> (rhs)); } +}; + +extern _IO_istream_withassign cin; + +extern _IO_ostream_withassign cout, cerr; + +extern _IO_ostream_withassign clog + + + +; + +extern istream& lock(istream& ins); +extern istream& unlock(istream& ins); +extern ostream& lock(ostream& outs); +extern ostream& unlock(ostream& outs); + +struct Iostream_init { } ; + +inline ios& dec(ios& i) +{ i.setf(ios::dec, ios::dec|ios::hex|ios::oct); return i; } +inline ios& hex(ios& i) +{ i.setf(ios::hex, ios::dec|ios::hex|ios::oct); return i; } +inline ios& oct(ios& i) +{ i.setf(ios::oct, ios::dec|ios::hex|ios::oct); return i; } +} + + +# 1 "/udd/bonnaud/prg/src/LS.cc" 2 + +# 1 "/udd/bonnaud/poubelle/sparc-egcs/include/g++/iomanip.h" 1 3 + + + + + + + + + + + + + + + + + + + + + + + + + + +#pragma interface + +#define _IOMANIP_H + + + +extern "C++" { + + + + + + + + +template<class TP> class smanip; + +template<class TP> class sapp { + ios& (*_f)(ios&, TP); +public: + sapp(ios& (*f)(ios&, TP)) : _f(f) {} + + smanip<TP> operator()(TP a) + { return smanip<TP>(_f, a); } +}; + +template<class TP> +inline istream& operator>>(istream& i, const smanip<TP>& m); +template<class TP> +inline ostream& operator<<(ostream& o, const smanip<TP>& m); + +template <class TP> class smanip { + ios& (*_f)(ios&, TP); + TP _a; +public: + smanip(ios& (*f)(ios&, TP), TP a) : _f(f), _a(a) {} + + friend + istream& operator>> <>(istream& i, const smanip<TP>& m); + friend + ostream& operator<< <>(ostream& o, const smanip<TP>& m); +}; + + +extern template class smanip<int>; +extern template class smanip<ios::fmtflags>; + + +template<class TP> +inline istream& operator>>(istream& i, const smanip<TP>& m) +{ (*m._f)(i, m._a); return i; } + +template<class TP> +inline ostream& operator<<(ostream& o, const smanip<TP>& m) +{ (*m._f)(o, m._a); return o;} + + +extern template istream& operator>>(istream&, const smanip<int>&); +extern template istream& operator>>(istream&, const smanip<ios::fmtflags>&); +extern template ostream& operator<<(ostream&, const smanip<int>&); +extern template ostream& operator<<(ostream&, const smanip<ios::fmtflags>&); + + + + + + +template<class TP> class imanip; + +template<class TP> class iapp { + istream& (*_f)(istream&, TP); +public: + iapp(istream& (*f)(istream&,TP)) : _f(f) {} + + imanip<TP> operator()(TP a) + { return imanip<TP>(_f, a); } +}; + +template <class TP> +inline istream& operator>>(istream&, const imanip<TP>&); + +template <class TP> class imanip { + istream& (*_f)(istream&, TP); + TP _a; +public: + imanip(istream& (*f)(istream&, TP), TP a) : _f(f), _a(a) {} + + friend + istream& operator>> <>(istream& i, const imanip<TP>& m); +}; + +template <class TP> +inline istream& operator>>(istream& i, const imanip<TP>& m) +{ return (*m._f)( i, m._a); } + + + + + +template<class TP> class omanip; + +template<class TP> class oapp { + ostream& (*_f)(ostream&, TP); +public: + oapp(ostream& (*f)(ostream&,TP)) : _f(f) {} + + omanip<TP> operator()(TP a) + { return omanip<TP>(_f, a); } +}; + +template <class TP> +inline ostream& operator<<(ostream&, const omanip<TP>&); + +template <class TP> class omanip { + ostream& (*_f)(ostream&, TP); + TP _a; +public: + omanip(ostream& (*f)(ostream&, TP), TP a) : _f(f), _a(a) {} + + friend + ostream& operator<< <>(ostream& o, const omanip<TP>& m); +}; + +template <class TP> +inline ostream& operator<<(ostream& o, const omanip<TP>& m) +{ return (*m._f)(o, m._a); } + + + + + + + + + +#define __DEFINE_IOMANIP_FN1(type,param,function) extern ios& __iomanip_##function (ios&, param); inline type<param> function (param n) { return type<param> (__iomanip_##function, n); } + + + + +extern ios& __iomanip_setbase (ios&, int ); inline smanip < int > setbase ( int n) { return smanip < int > (__iomanip_setbase , n); } +extern ios& __iomanip_setfill (ios&, int ); inline smanip < int > setfill ( int n) { return smanip < int > (__iomanip_setfill , n); } +extern ios& __iomanip_setprecision (ios&, int ); inline smanip < int > setprecision ( int n) { return smanip < int > (__iomanip_setprecision , n); } +extern ios& __iomanip_setw (ios&, int ); inline smanip < int > setw ( int n) { return smanip < int > (__iomanip_setw , n); } + +extern ios& __iomanip_resetiosflags (ios&, ios::fmtflags ); inline smanip < ios::fmtflags > resetiosflags ( ios::fmtflags n) { return smanip < ios::fmtflags > (__iomanip_resetiosflags , n); } +extern ios& __iomanip_setiosflags (ios&, ios::fmtflags ); inline smanip < ios::fmtflags > setiosflags ( ios::fmtflags n) { return smanip < ios::fmtflags > (__iomanip_setiosflags , n); } +} + + +# 2 "/udd/bonnaud/prg/src/LS.cc" 2 + +# 1 "/udd/bonnaud/prg/src/LS.hh" 1 + +#define LS_hh + +# 1 "/udd/bonnaud/prg/src/Mouvement.hh" 1 + +#define Mouvement_hh + + +# 1 "/udd/bonnaud/prg/src/usuel.hh" 1 + +#define usuel_hh + +# 1 "/udd/bonnaud/poubelle/sparc-egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.02/include/math.h" 1 3 4 + + + + + +#define _MATH_H + + +extern "C" { + + +#pragma ident "@(#)math.h 2.5 95/02/07" + + + + + + + + + + + + + + + + + + +typedef union _h_val { + unsigned long _i[2]; + double _d; +} _h_val; + + +extern const _h_val __huge_val; + + + + + +#define HUGE_VAL __huge_val._d + + + + + + + +#define M_E 2.7182818284590452354 +#define M_LOG2E 1.4426950408889634074 +#define M_LOG10E 0.43429448190325182765 +#define M_LN2 0.69314718055994530942 +#define M_LN10 2.30258509299404568402 +#define M_PI 3.14159265358979323846 +#define M_PI_2 1.57079632679489661923 +#define M_PI_4 0.78539816339744830962 +#define M_1_PI 0.31830988618379067154 +#define M_2_PI 0.63661977236758134308 +#define M_2_SQRTPI 1.12837916709551257390 +#define M_SQRT2 1.41421356237309504880 +#define M_SQRT1_2 0.70710678118654752440 + +extern int signgam; + +#define MAXFLOAT ((float)3.40282346638528860e+38) + + + + + +enum version {libm_ieee = -1, c_issue_4, ansi_1, strict_ansi}; + + +extern const enum version _lib_version; + + + + + +#define exception __math_exception + +struct __math_exception { + +#undef exception + + int type; + char *name; + double arg1; + double arg2; + double retval; +}; + +#define HUGE MAXFLOAT + +#define _ABS(x) ((x) < 0 ? -(x) : (x)) + +#define _REDUCE(TYPE, X, XN, C1, C2) { double x1 = (double)(TYPE)X, x2 = X - x1; X = x1 - (XN) * (C1); X += x2; X -= (XN) * (C2); } + + + +#define DOMAIN 1 +#define SING 2 +#define OVERFLOW 3 +#define UNDERFLOW 4 +#define TLOSS 5 +#define PLOSS 6 + +#define _POLY1(x, c) ((c)[0] * (x) + (c)[1]) +#define _POLY2(x, c) (_POLY1((x), (c)) * (x) + (c)[2]) +#define _POLY3(x, c) (_POLY2((x), (c)) * (x) + (c)[3]) +#define _POLY4(x, c) (_POLY3((x), (c)) * (x) + (c)[4]) +#define _POLY5(x, c) (_POLY4((x), (c)) * (x) + (c)[5]) +#define _POLY6(x, c) (_POLY5((x), (c)) * (x) + (c)[6]) +#define _POLY7(x, c) (_POLY6((x), (c)) * (x) + (c)[7]) +#define _POLY8(x, c) (_POLY7((x), (c)) * (x) + (c)[8]) +#define _POLY9(x, c) (_POLY8((x), (c)) * (x) + (c)[9]) + + + + + + +extern double acos (double) ; +extern double asin (double) ; +extern double atan (double) ; +extern double atan2 (double, double) ; +extern double cos (double) ; +extern double sin (double) ; +extern double tan (double) ; + +extern double cosh (double) ; +extern double sinh (double) ; +extern double tanh (double) ; + +extern double exp (double) ; +extern double frexp (double, int *) ; +extern double ldexp (double, int) ; +extern double log (double) ; +extern double log10 (double) ; +extern double modf (double, double *) ; + +extern double pow (double, double) ; +extern double sqrt (double) ; + +extern double ceil (double) ; +extern double fabs (double) ; +extern double floor (double) ; +extern double fmod (double, double) ; + + + + + + +extern double erf (double) ; +extern double erfc (double) ; +extern double gamma (double) ; +extern double hypot (double, double) ; +extern int isnan (double) ; +extern double j0 (double) ; +extern double j1 (double) ; +extern double jn (int, double) ; +extern double lgamma (double) ; +extern double y0 (double) ; +extern double y1 (double) ; +extern double yn (int, double) ; + + + + + + +extern double acosh (double) ; +extern double asinh (double) ; +extern double atanh (double) ; +extern double cbrt (double) ; +extern double logb (double) ; +extern double nextafter (double, double) ; +extern double remainder (double, double) ; +extern double scalb (double, double) ; + + + + +extern double expm1 (double) ; +extern int ilogb (double) ; +extern double log1p (double) ; +extern double rint (double) ; + + + + + + + +#define exception __math_exception + +extern int matherr (struct __math_exception *) ; + +#undef exception + + + + + +extern double significand (double) ; + + + + +extern double copysign (double, double) ; +extern double scalbn (double, int) ; + + + + + + + + + + + + + +extern float modff (float, float *) ; + +# 1 "/udd/bonnaud/poubelle/sparc-egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.02/include/floatingpoint.h" 1 3 4 + + + + + + + + +#define _FLOATINGPOINT_H + + +extern "C" { + + +#pragma ident "@(#)floatingpoint.h 2.4 94/06/09" + + + + + + + + + + + + + + + + + +# 1 "/udd/bonnaud/poubelle/sparc-egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.02/include/stdio.h" 1 3 4 + + + + + + + + + + + + +#define _STDIO_H + +#pragma ident "@(#)stdio.h 1.39 95/12/04 SMI" + +# 1 "/usr/include/sys/feature_tests.h" 1 3 4 + + + + + + + + +#define _SYS_FEATURE_TESTS_H + +#pragma ident "@(#)feature_tests.h 1.7 94/12/06 SMI" + + +extern "C" { + + + + + + + + + + + + + + + +} + + + +# 17 "/udd/bonnaud/poubelle/sparc-egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.02/include/stdio.h" 2 3 4 + +# 1 "/usr/include/sys/va_list.h" 1 3 4 + + + + + + +#define _SYS_VA_LIST_H + +#pragma ident "@(#)va_list.h 1.6 96/01/26 SMI" + + + + + + + + + + + + +extern "C" { + + +# 41 "/usr/include/sys/va_list.h" 3 4 + + + +typedef void *__va_list; + + + + + + + +} + + + +# 18 "/udd/bonnaud/poubelle/sparc-egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.02/include/stdio.h" 2 3 4 + + + +extern "C" { + + + +#define _SIZE_T +typedef unsigned int size_t; + + +typedef long fpos_t; + + + + + + + + + + +#define BUFSIZ 1024 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#define _NFILE 20 + +# 81 "/udd/bonnaud/poubelle/sparc-egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.02/include/stdio.h" 3 4 + + +#define _SBFSIZ 8 + +#define _IOFBF 0000 +#define _IOLBF 0100 +#define _IONBF 0004 +#define _IOEOF 0020 +#define _IOERR 0040 + +#define _IOREAD 0001 +#define _IOWRT 0002 +#define _IORW 0200 +#define _IOMYBUF 0010 + + + + + +#define FOPEN_MAX _NFILE +#define FILENAME_MAX 1024 + +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 +#define TMP_MAX 17576 + + + + +#define L_ctermid 9 +#define L_cuserid 9 + + + + + +#define P_tmpdir "/var/tmp/" + + +#define L_tmpnam 25 + + +#define stdin (&__iob[0]) +#define stdout (&__iob[1]) +#define stderr (&__iob[2]) + + + + + + +typedef struct +{ + + + + + int _cnt; + unsigned char *_ptr; + + unsigned char *_base; + unsigned char _flag; + unsigned char _file; +} FILE; + + +extern FILE __iob[20 ]; + + + +extern FILE *_lastbuf; +extern unsigned char *_bufendtab[]; + +extern unsigned char _sibuf[], _sobuf[]; + + + + +extern int remove(const char *); +extern int rename(const char *, const char *); +extern FILE *tmpfile(void); +extern char *tmpnam(char *); + + + +extern int fclose(FILE *); +extern int fflush(FILE *); +extern FILE *fopen(const char *, const char *); +extern FILE *freopen(const char *, const char *, FILE *); +extern void setbuf(FILE *, char *); +extern int setvbuf(FILE *, char *, int, size_t); + +extern int fprintf(FILE *, const char *, ...); + +extern int fscanf(FILE *, const char *, ...); + +extern int printf(const char *, ...); + +extern int scanf(const char *, ...); + +extern int sprintf(char *, const char *, ...); + +extern int sscanf(const char *, const char *, ...); +extern int vfprintf(FILE *, const char *, __va_list); +extern int vprintf(const char *, __va_list); +extern int vsprintf(char *, const char *, __va_list); +extern int fgetc(FILE *); +extern char *fgets(char *, int, FILE *); +extern int fputc(int, FILE *); +extern int fputs(const char *, FILE *); +extern int getc(FILE *); +extern int getchar(void); +extern char *gets(char *); +extern int putc(int, FILE *); +extern int putchar(int); +extern int puts(const char *); +extern int ungetc(int, FILE *); +extern size_t fread(void *, size_t, size_t, FILE *); +extern size_t fwrite(const void *, size_t, size_t, FILE *); +extern int fgetpos(FILE *, fpos_t *); +extern int fseek(FILE *, long, int); +extern int fsetpos(FILE *, const fpos_t *); +extern long ftell(FILE *); +extern void rewind(FILE *); +extern void clearerr(FILE *); +extern int feof(FILE *); +extern int ferror(FILE *); +extern void perror(const char *); + +extern int __filbuf(FILE *); +extern int __flsbuf(int, FILE *); + + + + + + + +extern FILE *fdopen(int, const char *); +extern char *ctermid(char *); +extern int fileno(FILE *); + + + + + + +# 239 "/udd/bonnaud/poubelle/sparc-egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.02/include/stdio.h" 3 4 + + + + + + + +extern FILE *popen(const char *, const char *); +extern char *cuserid(char *); +extern char *tempnam(const char *, const char *); +extern int getopt(int, char *const *, const char *); + +extern int getsubopt(char **, char *const *, char **); + +extern char *optarg; +extern int optind, opterr, optopt; +extern int getw(FILE *); +extern int putw(int, FILE *); +extern int pclose(FILE *); + + + +# 343 "/udd/bonnaud/poubelle/sparc-egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.02/include/stdio.h" 3 4 + + + + + + + + + + + + + + +#define getc(p) (--(p)->_cnt < 0 ? __filbuf(p) : (int)*(p)->_ptr++) +#define putc(x, p) (--(p)->_cnt < 0 ? __flsbuf((unsigned char) (x), (p)) : (int)(*(p)->_ptr++ = (x))) + + + + + + + +#define getchar() getc(stdin) +#define putchar(x) putc((x), stdout) +#define clearerr(p) ((void)((p)->_flag &= ~(_IOERR | _IOEOF))) +#define feof(p) ((p)->_flag & _IOEOF) +#define ferror(p) ((p)->_flag & _IOERR) + + + + +#define fileno(p) ((p)->_file) + + +# 397 "/udd/bonnaud/poubelle/sparc-egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.02/include/stdio.h" 3 4 + + + + + +} + + + +# 33 "/udd/bonnaud/poubelle/sparc-egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.02/include/floatingpoint.h" 2 3 4 + + +# 1 "/udd/bonnaud/poubelle/sparc-egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.02/include/sys/ieeefp.h" 1 3 4 + + + + + +#define _SYS_IEEEFP_H + +#pragma ident "@(#)ieeefp.h 2.7 94/11/09" + + +extern "C" { + + + + + + +enum fp_direction_type { + fp_nearest = 0, + fp_tozero = 1, + fp_positive = 2, + fp_negative = 3 +}; + +enum fp_precision_type { + fp_extended = 0, + fp_single = 1, + fp_double = 2, + fp_precision_3 = 3 +}; + +enum fp_exception_type { + fp_inexact = 0, + fp_division = 1, + fp_underflow = 2, + fp_overflow = 3, + fp_invalid = 4 +}; + +enum fp_trap_enable_type { + fp_trap_inexact = 0, + fp_trap_division = 1, + fp_trap_underflow = 2, + fp_trap_overflow = 3, + fp_trap_invalid = 4 +}; + + +# 81 "/udd/bonnaud/poubelle/sparc-egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.02/include/sys/ieeefp.h" 3 4 + + +# 122 "/udd/bonnaud/poubelle/sparc-egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.02/include/sys/ieeefp.h" 3 4 + + +enum fp_class_type { + fp_zero = 0, + fp_subnormal = 1, + fp_normal = 2, + fp_infinity = 3, + fp_quiet = 4, + fp_signaling = 5 +}; + + +} + + + +# 35 "/udd/bonnaud/poubelle/sparc-egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.02/include/floatingpoint.h" 2 3 4 + + + + + + + + + + + + +#define N_IEEE_EXCEPTION 5 + +typedef int sigfpe_code_type; + +typedef void (*sigfpe_handler_type)(); + +#define SIGFPE_DEFAULT (void (*)())0 +#define SIGFPE_IGNORE (void (*)())1 +#define SIGFPE_ABORT (void (*)())2 + +extern sigfpe_handler_type sigfpe (sigfpe_code_type, sigfpe_handler_type) ; + + + + +typedef float single; + + +#define _EXTENDED +typedef unsigned extended[3]; + + +typedef long double quadruple; + +typedef unsigned fp_exception_field_type; + + + + + + + +#define DECIMAL_STRING_LENGTH 512 + +typedef char decimal_string[512 ]; + + +typedef struct { + enum fp_class_type fpclass; + int sign; + int exponent; + decimal_string ds; + + + int more; + + + int ndigits; + + +} decimal_record; + +enum decimal_form { + fixed_form, + + + floating_form + +}; + +typedef struct { + enum fp_direction_type rd; + + enum decimal_form df; + + int ndigits; +} decimal_mode; + +enum decimal_string_form { + invalid_form, + whitespace_form, + fixed_int_form, + fixed_intdot_form, + fixed_dotfrac_form, + fixed_intdotfrac_form, + floating_int_form, + floating_intdot_form, + floating_dotfrac_form, + floating_intdotfrac_form, + inf_form, + infinity_form, + nan_form, + nanstring_form +}; + +extern void single_to_decimal (single *, decimal_mode *, decimal_record *, + fp_exception_field_type *) ; +extern void double_to_decimal (double *, decimal_mode *, decimal_record *, + fp_exception_field_type *) ; +extern void extended_to_decimal (extended *, decimal_mode *, + decimal_record *, fp_exception_field_type *) ; +extern void quadruple_to_decimal (quadruple *, decimal_mode *, + decimal_record *, fp_exception_field_type *) ; + +extern void decimal_to_single (single *, decimal_mode *, decimal_record *, + fp_exception_field_type *) ; +extern void decimal_to_double (double *, decimal_mode *, decimal_record *, + fp_exception_field_type *) ; +extern void decimal_to_extended (extended *, decimal_mode *, + decimal_record *, fp_exception_field_type *) ; +extern void decimal_to_quadruple (quadruple *, decimal_mode *, + decimal_record *, fp_exception_field_type *) ; + +extern void string_to_decimal (char **, int, int, decimal_record *, + enum decimal_string_form *, char **) ; +extern void func_to_decimal (char **, int, int, decimal_record *, + enum decimal_string_form *, char **, + int (*)(void), int *, int (*)(int)) ; +extern void file_to_decimal (char **, int, int, decimal_record *, + enum decimal_string_form *, char **, + FILE *, int *) ; + +extern char *seconvert (single *, int, int *, int *, char *) ; +extern char *sfconvert (single *, int, int *, int *, char *) ; +extern char *sgconvert (single *, int, int, char *) ; +extern char *econvert (double, int, int *, int *, char *) ; +extern char *fconvert (double, int, int *, int *, char *) ; +extern char *gconvert (double, int, int, char *) ; +extern char *qeconvert (quadruple *, int, int *, int *, char *) ; +extern char *qfconvert (quadruple *, int, int *, int *, char *) ; +extern char *qgconvert (quadruple *, int, int, char *) ; + +extern char *ecvt (double, int, int *, int *) ; +extern char *fcvt (double, int, int *, int *) ; +extern char *gcvt (double, int, char *) ; + + + + + +extern double atof (const char *) ; +extern double strtod (const char *, char **) ; + + +} + + + +# 230 "/udd/bonnaud/poubelle/sparc-egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.02/include/math.h" 2 3 4 + + + + + +} + + + +# 4 "/udd/bonnaud/prg/src/usuel.hh" 2 + +# 1 "/udd/bonnaud/prg/lib_src/libg++-include/String.h" 1 + + + + + + + + + + + + + + + + + + + + + +#pragma interface + +#define _String_h 1 + + +# 1 "/udd/bonnaud/prg/lib_src/libg++-include/Regex.h" 1 + + + + + + + + + + + + + + + + + + + + + +#pragma interface + +#define _Regex_h 1 + + + + + + + +struct re_pattern_buffer; +struct re_registers; + +class Regex +{ +private: + + Regex(const Regex&) {} + void operator = (const Regex&) {} + +protected: + re_pattern_buffer* buf; + re_registers* reg; + +public: + Regex(const char* t, + int fast = 0, + int bufsize = 40, + const char* transtable = 0); + + ~Regex(); + + int match(const char* s, int len, int pos = 0) const; + int search(const char* s, int len, + int& matchlen, int startpos = 0) const; + int match_info(int& start, int& length, int nth = 0) const; + + int OK() const; +}; + + + + + + + + + + + + + + + + +# 27 "/udd/bonnaud/prg/lib_src/libg++-include/String.h" 2 + + +struct StrRep +{ + unsigned short len; + unsigned short sz; + char s[1]; + + +}; + + + +StrRep* Salloc(StrRep*, const char*, int, int); +StrRep* Scopy(StrRep*, const StrRep*); +StrRep* Scat(StrRep*, const char*, int, const char*, int); +StrRep* Scat(StrRep*, const char*, int,const char*,int, const char*,int); +StrRep* Sprepend(StrRep*, const char*, int); +StrRep* Sreverse(const StrRep*, StrRep*); +StrRep* Supcase(const StrRep*, StrRep*); +StrRep* Sdowncase(const StrRep*, StrRep*); +StrRep* Scapitalize(const StrRep*, StrRep*); + + + +class String; +class SubString; + +class SubString +{ + friend class String; +protected: + + String& S; + unsigned short pos; + unsigned short len; + + void assign(const StrRep*, const char*, int = -1); + SubString(String& x, int p, int l); + +public: + SubString(const SubString& x); + + + + + ~SubString(); + + SubString& operator = (const String& y); + SubString& operator = (const SubString& y); + SubString& operator = (const char* t); + SubString& operator = (char c); + + + + int contains(char c) const; + int contains(const String& y) const; + int contains(const SubString& y) const; + int contains(const char* t) const; + int contains(const Regex& r) const; + + + + int matches(const Regex& r) const; + + + + friend ostream& operator<<(ostream& s, const SubString& x); + + + + unsigned int length() const; + int empty() const; + const char* chars() const; + + int OK() const; + +}; + + +class String +{ + friend class SubString; + +protected: + StrRep* rep; + + + + int search(int, int, const char*, int = -1) const; + int search(int, int, char) const; + int match(int, int, int, const char*, int = -1) const; + int _gsub(const char*, int, const char* ,int); + int _gsub(const Regex&, const char*, int); + SubString _substr(int, int); + +public: + + + + String(); + String(const String& x); + String(const SubString& x); + String(const char* t); + String(const char* t, int len); + String(char c); + + ~String(); + + String& operator = (const String& y); + String& operator = (const char* y); + String& operator = (char c); + String& operator = (const SubString& y); + + + + String& operator += (const String& y); + String& operator += (const SubString& y); + String& operator += (const char* t); + String& operator += (char c); + + void prepend(const String& y); + void prepend(const SubString& y); + void prepend(const char* t); + void prepend(char c); + + + + + + friend inline void cat(const String&, const String&, String&); + friend inline void cat(const String&, const SubString&, String&); + friend inline void cat(const String&, const char*, String&); + friend inline void cat(const String&, char, String&); + + friend inline void cat(const SubString&, const String&, String&); + friend inline void cat(const SubString&, const SubString&, String&); + friend inline void cat(const SubString&, const char*, String&); + friend inline void cat(const SubString&, char, String&); + + friend inline void cat(const char*, const String&, String&); + friend inline void cat(const char*, const SubString&, String&); + friend inline void cat(const char*, const char*, String&); + friend inline void cat(const char*, char, String&); + + + + + + friend inline void cat(const String&,const String&, const String&,String&); + friend inline void cat(const String&,const String&,const SubString&,String&); + friend inline void cat(const String&,const String&, const char*, String&); + friend inline void cat(const String&,const String&, char, String&); + friend inline void cat(const String&,const SubString&,const String&,String&); + inline friend void cat(const String&,const SubString&,const SubString&,String&); + friend inline void cat(const String&,const SubString&, const char*, String&); + friend inline void cat(const String&,const SubString&, char, String&); + friend inline void cat(const String&,const char*, const String&, String&); + friend inline void cat(const String&,const char*, const SubString&, String&); + friend inline void cat(const String&,const char*, const char*, String&); + friend inline void cat(const String&,const char*, char, String&); + + friend inline void cat(const char*, const String&, const String&,String&); + friend inline void cat(const char*,const String&,const SubString&,String&); + friend inline void cat(const char*,const String&, const char*, String&); + friend inline void cat(const char*,const String&, char, String&); + friend inline void cat(const char*,const SubString&,const String&,String&); + friend inline void cat(const char*,const SubString&,const SubString&,String&); + friend inline void cat(const char*,const SubString&, const char*, String&); + friend inline void cat(const char*,const SubString&, char, String&); + friend inline void cat(const char*,const char*, const String&, String&); + friend inline void cat(const char*,const char*, const SubString&, String&); + friend inline void cat(const char*,const char*, const char*, String&); + friend inline void cat(const char*,const char*, char, String&); + + + + + + + int index(char c, int startpos = 0) const; + int index(const String& y, int startpos = 0) const; + int index(const SubString& y, int startpos = 0) const; + int index(const char* t, int startpos = 0) const; + int index(const Regex& r, int startpos = 0) const; + + + + int contains(char c) const; + int contains(const String& y) const; + int contains(const SubString& y) const; + int contains(const char* t) const; + int contains(const Regex& r) const; + + + + + int contains(char c, int pos) const; + int contains(const String& y, int pos) const; + int contains(const SubString& y, int pos) const; + int contains(const char* t, int pos) const; + int contains(const Regex& r, int pos) const; + + + + int matches(char c, int pos = 0) const; + int matches(const String& y, int pos = 0) const; + int matches(const SubString& y, int pos = 0) const; + int matches(const char* t, int pos = 0) const; + int matches(const Regex& r, int pos = 0) const; + + + + int freq(char c) const; + int freq(const String& y) const; + int freq(const SubString& y) const; + int freq(const char* t) const; + + + + + + + + SubString at(int pos, int len); + SubString operator () (int pos, int len); + + SubString at(const String& x, int startpos = 0); + SubString at(const SubString& x, int startpos = 0); + SubString at(const char* t, int startpos = 0); + SubString at(char c, int startpos = 0); + SubString at(const Regex& r, int startpos = 0); + + SubString before(int pos); + SubString before(const String& x, int startpos = 0); + SubString before(const SubString& x, int startpos = 0); + SubString before(const char* t, int startpos = 0); + SubString before(char c, int startpos = 0); + SubString before(const Regex& r, int startpos = 0); + + SubString through(int pos); + SubString through(const String& x, int startpos = 0); + SubString through(const SubString& x, int startpos = 0); + SubString through(const char* t, int startpos = 0); + SubString through(char c, int startpos = 0); + SubString through(const Regex& r, int startpos = 0); + + SubString from(int pos); + SubString from(const String& x, int startpos = 0); + SubString from(const SubString& x, int startpos = 0); + SubString from(const char* t, int startpos = 0); + SubString from(char c, int startpos = 0); + SubString from(const Regex& r, int startpos = 0); + + SubString after(int pos); + SubString after(const String& x, int startpos = 0); + SubString after(const SubString& x, int startpos = 0); + SubString after(const char* t, int startpos = 0); + SubString after(char c, int startpos = 0); + SubString after(const Regex& r, int startpos = 0); + + + + + + void del(int pos, int len); + + + + void del(const String& y, int startpos = 0); + void del(const SubString& y, int startpos = 0); + void del(const char* t, int startpos = 0); + void del(char c, int startpos = 0); + void del(const Regex& r, int startpos = 0); + + + + int gsub(const String& pat, const String& repl); + int gsub(const SubString& pat, const String& repl); + int gsub(const char* pat, const String& repl); + int gsub(const char* pat, const char* repl); + int gsub(const Regex& pat, const String& repl); + + + + + + friend int split(const String& x, String res[], int maxn, + const String& sep); + friend int split(const String& x, String res[], int maxn, + const Regex& sep); + + friend String common_prefix(const String& x, const String& y, + int startpos = 0); + friend String common_suffix(const String& x, const String& y, + int startpos = -1); + friend String replicate(char c, int n); + friend String replicate(const String& y, int n); + friend String join(String src[], int n, const String& sep); + + + + friend inline String reverse(const String& x); + friend inline String upcase(const String& x); + friend inline String downcase(const String& x); + friend inline String capitalize(const String& x); + + + + void reverse(); + void upcase(); + void downcase(); + void capitalize(); + + + + char& operator [] (int i); + const char& operator [] (int i) const; + char elem(int i) const; + char firstchar() const; + char lastchar() const; + + + + operator const char*() const; + const char* chars() const; + + + + + friend inline ostream& operator<<(ostream& s, const String& x); + friend ostream& operator<<(ostream& s, const SubString& x); + friend istream& operator>>(istream& s, String& x); + + friend int readline(istream& s, String& x, + char terminator = '\n', + int discard_terminator = 1); + + + + unsigned int length() const; + int empty() const; + + + void alloc(int newsize); + + + + int allocation() const; + + + void error(const char* msg) const; + + int OK() const; +}; + +typedef String StrTmp; + + + +int compare(const String& x, const String& y); +int compare(const String& x, const SubString& y); +int compare(const String& x, const char* y); +int compare(const SubString& x, const String& y); +int compare(const SubString& x, const SubString& y); +int compare(const SubString& x, const char* y); +int fcompare(const String& x, const String& y); + +extern StrRep _nilStrRep; +extern String _nilString; + + + +inline unsigned int String::length() const { return rep->len; } +inline int String::empty() const { return rep->len == 0; } +inline const char* String::chars() const { return &(rep->s[0]); } +inline int String::allocation() const { return rep->sz; } + +inline unsigned int SubString::length() const { return len; } +inline int SubString::empty() const { return len == 0; } +inline const char* SubString::chars() const { return &(S.rep->s[pos]); } + + + + +inline String::String() + : rep(&_nilStrRep) {} +inline String::String(const String& x) + : rep(Scopy(0, x.rep)) {} +inline String::String(const char* t) + : rep(Salloc(0, t, -1, -1)) {} +inline String::String(const char* t, int tlen) + : rep(Salloc(0, t, tlen, tlen)) {} +inline String::String(const SubString& y) + : rep(Salloc(0, y.chars(), y.length(), y.length())) {} +inline String::String(char c) + : rep(Salloc(0, &c, 1, 1)) {} + +inline String::~String() { if (rep != &_nilStrRep) delete rep; } + +inline SubString::SubString(const SubString& x) + :S(x.S), pos(x.pos), len(x.len) {} +inline SubString::SubString(String& x, int first, int l) + :S(x), pos(first), len(l) {} + +inline SubString::~SubString() {} + + + +inline String& String::operator = (const String& y) +{ + rep = Scopy(rep, y.rep); + return *this; +} + +inline String& String::operator=(const char* t) +{ + rep = Salloc(rep, t, -1, -1); + return *this; +} + +inline String& String::operator=(const SubString& y) +{ + rep = Salloc(rep, y.chars(), y.length(), y.length()); + return *this; +} + +inline String& String::operator=(char c) +{ + rep = Salloc(rep, &c, 1, 1); + return *this; +} + + +inline SubString& SubString::operator = (const char* ys) +{ + assign(0, ys); + return *this; +} + +inline SubString& SubString::operator = (char ch) +{ + assign(0, &ch, 1); + return *this; +} + +inline SubString& SubString::operator = (const String& y) +{ + assign(y.rep, y.chars(), y.length()); + return *this; +} + +inline SubString& SubString::operator = (const SubString& y) +{ + assign(y.S.rep, y.chars(), y.length()); + return *this; +} + + + +inline void cat(const String& x, const String& y, String& r) +{ + r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const String& x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const String& x, const char* y, String& r) +{ + r.rep = Scat(r.rep, x.chars(), x.length(), y, -1); +} + +inline void cat(const String& x, char y, String& r) +{ + r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1); +} + +inline void cat(const SubString& x, const String& y, String& r) +{ + r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const SubString& x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const SubString& x, const char* y, String& r) +{ + r.rep = Scat(r.rep, x.chars(), x.length(), y, -1); +} + +inline void cat(const SubString& x, char y, String& r) +{ + r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1); +} + +inline void cat(const char* x, const String& y, String& r) +{ + r.rep = Scat(r.rep, x, -1, y.chars(), y.length()); +} + +inline void cat(const char* x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, x, -1, y.chars(), y.length()); +} + +inline void cat(const char* x, const char* y, String& r) +{ + r.rep = Scat(r.rep, x, -1, y, -1); +} + +inline void cat(const char* x, char y, String& r) +{ + r.rep = Scat(r.rep, x, -1, &y, 1); +} + +inline void cat(const String& a, const String& x, const String& y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const String& a, const String& x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const String& a, const String& x, const char* y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1); +} + +inline void cat(const String& a, const String& x, char y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), &y, 1); +} + +inline void cat(const String& a, const SubString& x, const String& y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const String& a, const SubString& x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const String& a, const SubString& x, const char* y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1); +} + +inline void cat(const String& a, const SubString& x, char y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), &y, 1); +} + +inline void cat(const String& a, const char* x, const String& y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y.chars(), y.length()); +} + +inline void cat(const String& a, const char* x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y.chars(), y.length()); +} + +inline void cat(const String& a, const char* x, const char* y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y, -1); +} + +inline void cat(const String& a, const char* x, char y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, &y, 1); +} + + +inline void cat(const char* a, const String& x, const String& y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const char* a, const String& x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const char* a, const String& x, const char* y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1); +} + +inline void cat(const char* a, const String& x, char y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), &y, 1); +} + +inline void cat(const char* a, const SubString& x, const String& y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const char* a, const SubString& x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const char* a, const SubString& x, const char* y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1); +} + +inline void cat(const char* a, const SubString& x, char y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), &y, 1); +} + +inline void cat(const char* a, const char* x, const String& y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x, -1, y.chars(), y.length()); +} + +inline void cat(const char* a, const char* x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x, -1, y.chars(), y.length()); +} + +inline void cat(const char* a, const char* x, const char* y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x, -1, y, -1); +} + +inline void cat(const char* a, const char* x, char y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x, -1, &y, 1); +} + + + + +inline String& String::operator +=(const String& y) +{ + cat(*this, y, *this); + return *this; +} + +inline String& String::operator +=(const SubString& y) +{ + cat(*this, y, *this); + return *this; +} + +inline String& String::operator += (const char* y) +{ + cat(*this, y, *this); + return *this; +} + +inline String& String:: operator +=(char y) +{ + cat(*this, y, *this); + return *this; +} + + + + + +inline String operator + (const String& x, const String& y) return r; +{ + cat(x, y, r); +} + +inline String operator + (const String& x, const SubString& y) return r; +{ + cat(x, y, r); +} + +inline String operator + (const String& x, const char* y) return r; +{ + cat(x, y, r); +} + +inline String operator + (const String& x, char y) return r; +{ + cat(x, y, r); +} + +inline String operator + (const SubString& x, const String& y) return r; +{ + cat(x, y, r); +} + +inline String operator + (const SubString& x, const SubString& y) return r; +{ + cat(x, y, r); +} + +inline String operator + (const SubString& x, const char* y) return r; +{ + cat(x, y, r); +} + +inline String operator + (const SubString& x, char y) return r; +{ + cat(x, y, r); +} + +inline String operator + (const char* x, const String& y) return r; +{ + cat(x, y, r); +} + +inline String operator + (const char* x, const SubString& y) return r; +{ + cat(x, y, r); +} + +inline String reverse(const String& x) return r; +{ + r.rep = Sreverse(x.rep, r.rep); +} + +inline String upcase(const String& x) return r; +{ + r.rep = Supcase(x.rep, r.rep); +} + +inline String downcase(const String& x) return r; +{ + r.rep = Sdowncase(x.rep, r.rep); +} + +inline String capitalize(const String& x) return r; +{ + r.rep = Scapitalize(x.rep, r.rep); +} + +# 841 "/udd/bonnaud/prg/lib_src/libg++-include/String.h" + + + + +inline void String::prepend(const String& y) +{ + rep = Sprepend(rep, y.chars(), y.length()); +} + +inline void String::prepend(const char* y) +{ + rep = Sprepend(rep, y, -1); +} + +inline void String::prepend(char y) +{ + rep = Sprepend(rep, &y, 1); +} + +inline void String::prepend(const SubString& y) +{ + rep = Sprepend(rep, y.chars(), y.length()); +} + + + + +inline void String::reverse() +{ + rep = Sreverse(rep, rep); +} + + +inline void String::upcase() +{ + rep = Supcase(rep, rep); +} + + +inline void String::downcase() +{ + rep = Sdowncase(rep, rep); +} + + +inline void String::capitalize() +{ + rep = Scapitalize(rep, rep); +} + + + +inline char& String::operator [] (int i) +{ + if (((unsigned)i) >= length()) error("invalid index"); + return rep->s[i]; +} + +inline const char& String::operator [] (int i) const +{ + if (((unsigned)i) >= length()) error("invalid index"); + return rep->s[i]; +} + +inline char String::elem (int i) const +{ + if (((unsigned)i) >= length()) error("invalid index"); + return rep->s[i]; +} + +inline char String::firstchar() const +{ + return elem(0); +} + +inline char String::lastchar() const +{ + return elem(length() - 1); +} + + + +inline int String::index(char c, int startpos) const +{ + return search(startpos, length(), c); +} + +inline int String::index(const char* t, int startpos) const +{ + return search(startpos, length(), t); +} + +inline int String::index(const String& y, int startpos) const +{ + return search(startpos, length(), y.chars(), y.length()); +} + +inline int String::index(const SubString& y, int startpos) const +{ + return search(startpos, length(), y.chars(), y.length()); +} + +inline int String::index(const Regex& r, int startpos) const +{ + int unused; return r.search(chars(), length(), unused, startpos); +} + +inline int String::contains(char c) const +{ + return search(0, length(), c) >= 0; +} + +inline int String::contains(const char* t) const +{ + return search(0, length(), t) >= 0; +} + +inline int String::contains(const String& y) const +{ + return search(0, length(), y.chars(), y.length()) >= 0; +} + +inline int String::contains(const SubString& y) const +{ + return search(0, length(), y.chars(), y.length()) >= 0; +} + +inline int String::contains(char c, int p) const +{ + return match(p, length(), 0, &c, 1) >= 0; +} + +inline int String::contains(const char* t, int p) const +{ + return match(p, length(), 0, t) >= 0; +} + +inline int String::contains(const String& y, int p) const +{ + return match(p, length(), 0, y.chars(), y.length()) >= 0; +} + +inline int String::contains(const SubString& y, int p) const +{ + return match(p, length(), 0, y.chars(), y.length()) >= 0; +} + +inline int String::contains(const Regex& r) const +{ + int unused; return r.search(chars(), length(), unused, 0) >= 0; +} + +inline int String::contains(const Regex& r, int p) const +{ + return r.match(chars(), length(), p) >= 0; +} + + +inline int String::matches(const SubString& y, int p) const +{ + return match(p, length(), 1, y.chars(), y.length()) >= 0; +} + +inline int String::matches(const String& y, int p) const +{ + return match(p, length(), 1, y.chars(), y.length()) >= 0; +} + +inline int String::matches(const char* t, int p) const +{ + return match(p, length(), 1, t) >= 0; +} + +inline int String::matches(char c, int p) const +{ + return match(p, length(), 1, &c, 1) >= 0; +} + +inline int String::matches(const Regex& r, int p) const +{ + int l = (p < 0)? -p : length() - p; + return r.match(chars(), length(), p) == l; +} + + +inline int SubString::contains(const char* t) const +{ + return S.search(pos, pos+len, t) >= 0; +} + +inline int SubString::contains(const String& y) const +{ + return S.search(pos, pos+len, y.chars(), y.length()) >= 0; +} + +inline int SubString::contains(const SubString& y) const +{ + return S.search(pos, pos+len, y.chars(), y.length()) >= 0; +} + +inline int SubString::contains(char c) const +{ + return S.search(pos, pos+len, c) >= 0; +} + +inline int SubString::contains(const Regex& r) const +{ + int unused; return r.search(chars(), len, unused, 0) >= 0; +} + +inline int SubString::matches(const Regex& r) const +{ + return r.match(chars(), len, 0) == len; +} + + +inline int String::gsub(const String& pat, const String& r) +{ + return _gsub(pat.chars(), pat.length(), r.chars(), r.length()); +} + +inline int String::gsub(const SubString& pat, const String& r) +{ + return _gsub(pat.chars(), pat.length(), r.chars(), r.length()); +} + +inline int String::gsub(const Regex& pat, const String& r) +{ + return _gsub(pat, r.chars(), r.length()); +} + +inline int String::gsub(const char* pat, const String& r) +{ + return _gsub(pat, -1, r.chars(), r.length()); +} + +inline int String::gsub(const char* pat, const char* r) +{ + return _gsub(pat, -1, r, -1); +} + + + +inline ostream& operator<<(ostream& s, const String& x) +{ + s << x.chars(); return s; +} + + + +inline int operator==(const String& x, const String& y) +{ + return compare(x, y) == 0; +} + +inline int operator!=(const String& x, const String& y) +{ + return compare(x, y) != 0; +} + +inline int operator>(const String& x, const String& y) +{ + return compare(x, y) > 0; +} + +inline int operator>=(const String& x, const String& y) +{ + return compare(x, y) >= 0; +} + +inline int operator<(const String& x, const String& y) +{ + return compare(x, y) < 0; +} + +inline int operator<=(const String& x, const String& y) +{ + return compare(x, y) <= 0; +} + +inline int operator==(const String& x, const SubString& y) +{ + return compare(x, y) == 0; +} + +inline int operator!=(const String& x, const SubString& y) +{ + return compare(x, y) != 0; +} + +inline int operator>(const String& x, const SubString& y) +{ + return compare(x, y) > 0; +} + +inline int operator>=(const String& x, const SubString& y) +{ + return compare(x, y) >= 0; +} + +inline int operator<(const String& x, const SubString& y) +{ + return compare(x, y) < 0; +} + +inline int operator<=(const String& x, const SubString& y) +{ + return compare(x, y) <= 0; +} + +inline int operator==(const String& x, const char* t) +{ + return compare(x, t) == 0; +} + +inline int operator!=(const String& x, const char* t) +{ + return compare(x, t) != 0; +} + +inline int operator>(const String& x, const char* t) +{ + return compare(x, t) > 0; +} + +inline int operator>=(const String& x, const char* t) +{ + return compare(x, t) >= 0; +} + +inline int operator<(const String& x, const char* t) +{ + return compare(x, t) < 0; +} + +inline int operator<=(const String& x, const char* t) +{ + return compare(x, t) <= 0; +} + +inline int operator==(const SubString& x, const String& y) +{ + return compare(y, x) == 0; +} + +inline int operator!=(const SubString& x, const String& y) +{ + return compare(y, x) != 0; +} + +inline int operator>(const SubString& x, const String& y) +{ + return compare(y, x) < 0; +} + +inline int operator>=(const SubString& x, const String& y) +{ + return compare(y, x) <= 0; +} + +inline int operator<(const SubString& x, const String& y) +{ + return compare(y, x) > 0; +} + +inline int operator<=(const SubString& x, const String& y) +{ + return compare(y, x) >= 0; +} + +inline int operator==(const SubString& x, const SubString& y) +{ + return compare(x, y) == 0; +} + +inline int operator!=(const SubString& x, const SubString& y) +{ + return compare(x, y) != 0; +} + +inline int operator>(const SubString& x, const SubString& y) +{ + return compare(x, y) > 0; +} + +inline int operator>=(const SubString& x, const SubString& y) +{ + return compare(x, y) >= 0; +} + +inline int operator<(const SubString& x, const SubString& y) +{ + return compare(x, y) < 0; +} + +inline int operator<=(const SubString& x, const SubString& y) +{ + return compare(x, y) <= 0; +} + +inline int operator==(const SubString& x, const char* t) +{ + return compare(x, t) == 0; +} + +inline int operator!=(const SubString& x, const char* t) +{ + return compare(x, t) != 0; +} + +inline int operator>(const SubString& x, const char* t) +{ + return compare(x, t) > 0; +} + +inline int operator>=(const SubString& x, const char* t) +{ + return compare(x, t) >= 0; +} + +inline int operator<(const SubString& x, const char* t) +{ + return compare(x, t) < 0; +} + +inline int operator<=(const SubString& x, const char* t) +{ + return compare(x, t) <= 0; +} + + + + +inline SubString String::_substr(int first, int l) +{ + if (first < 0 || (unsigned)(first + l) > length() ) + return SubString(_nilString, 0, 0) ; + else + return SubString(*this, first, l); +} + + +# 5 "/udd/bonnaud/prg/src/usuel.hh" 2 + + +# 1 "/udd/bonnaud/prg/src/booleen.hh" 1 + +#define booleen_hh + + +typedef int booleen; + +const booleen VRAI=1; +const booleen FAUX=0; + + +# 7 "/udd/bonnaud/prg/src/usuel.hh" 2 + + +#define valeur_bidon 12345678 + +#define fors(type, i, imin, imax) for(type i=imin; i< imax; i++) +#define fore(type, i, imin, imax) for(type i=imin; i<=imax; i++) + +void verif_nb_param(int argc, char* argv[], int nb_params); + +booleen f_exists(String nom); + + +template<class Type> +inline Type carre(const Type x) +{ + return x*x; +} + +template<class Type> +inline Type cube(const Type x) +{ + return x*x*x; +} + +template<class Type> +inline Type rac3(const Type x) +{ + if(fabs(x)<1E-5) + return 0; + else + if(x>0) + return exp(log(x)/3); + else + return -exp(log(-x)/3); +} + +template<class Type> +inline Type min(const Type a,const Type b) +{ + return (a>b)?b:a; +} + +template<class Type> +inline Type max(const Type a,const Type b) +{ + return (a<b)?b:a; +} + +template<class Type> +inline Type min(const Type a,const Type b,const Type c) +{ + return min(a,min(b,c)); +} + +template<class Type> +inline Type max(const Type a,const Type b,const Type c) +{ + return max(a,max(b,c)); +} + +template <class Type> +inline void echange(Type& a,Type& b) +{ + Type t=a; + a=b; + b=t; +} + + +String i2S(int n,int l=0); + +template <class Type> +inline booleen dans(Type x, Type a, Type b) +{ + return (a<=x) && (x<=b); +} + +template <class Type> +inline Type mabs(Type x) +{ + return (x<0) ? -x : x ; +} + +template <class Type> +inline booleen dans2(Type x, Type a, Type b) + +{ + return mabs(x-(a+b)/2) <= mabs((a-b)/2) ; +} + +template <class Type> +inline booleen proche(Type x, Type y, Type eps) +{ + return mabs(x-y)<eps; +} + +template <class Type> +inline int arrondi(Type x) +{ + return int(x+0.5); +} + +template<class Type> +unsigned char arrondi_ng(Type x) +{ + if((-0.5<x) && (x<255.5)) + return (unsigned char)(x+0.5); + else + { + if(x<-3.0 || x>268.0) + cerr<<"arrondi_ng : attention x= "<<x<<endl; + + if(x<0.0) + return 0; + else + return 255; + } +} + +template<class Type> +unsigned char arrondi_ng_err(Type x) +{ + if((-0.5<x) && (x<255.5)) + return (unsigned char)(x+0.5); + else + { + if(x<0.0) + return 0; + else + return 255; + } +} + +inline int nb_diff2(int a,int b) +{ + if(a==b) + return 1; + else + return 2; +} + +inline int nb_diff3(int a,int b,int c) +{ + if(a==b || a==c) + return nb_diff2(b,c); + else + return 1+nb_diff2(b,c); +} + +inline int nb_diff4(int a,int b,int c,int d) +{ + if(a==b || a==c || a==d) + return nb_diff3(b,c,d); + else + return 1+nb_diff3(b,c,d); +} + +float echMSB(float a); + +void plante(); +void arrete(); + +void touche(); + +template<class Type> +void lis_param(istream& f, Type& param) +{ + f>>param; + f.ignore(20000,'\n'); +} + +void lis_chaine(istream& s, String chaine); + +template<class Type_dest, class Type_source> +void convert(Type_dest& dest, const Type_source& source) +{ + dest=source; +} + + +# 5 "/udd/bonnaud/prg/src/Mouvement.hh" 2 + + +struct Vect2Dent +{ + int di; + int dj; +}; + + + + + + +struct depl2D +{ + double x; + double y; + depl2D() : x(0.0), y(0.0) + { } + + + depl2D(double xx, double yy) : x(xx), y(yy) + { } + double amplitude() + { + return max(mabs(x),mabs(y)); + } +}; + +ostream& operator<<(ostream& s, depl2D m); + +class Mouvement +{ +private: + Mouvement* read_mv(istream& s); +protected: + double t_x; + double t_y; + double centre_x; + double centre_y; +public: + Mouvement(); + Mouvement(double i_t_x, double i_t_y, double i_centre_x, double i_centre_y); + virtual void Id()=0; + virtual void centre(double x,double y)=0; + virtual void applique(double& xx, double& yy, double x, double y) const=0; + virtual void applique(float& xx, float& yy, float x, float y) const=0; + virtual depl2D calc_depl(double x, double y)=0; + double Centre_x() const + { + return centre_x; + } + double Centre_y() const + { + return centre_y; + } + + virtual int nb_param() const=0; + + + virtual void init_from_vect_d(const double param[])=0; + virtual void init_vect_d(double param[]) const=0; + virtual void init_from_vect_f(const float param[])=0; + virtual void init_vect_f(float param[]) const=0; + + virtual Mouvement* clone() const=0; + virtual String nom() const=0; + virtual void dump(ostream& s) const=0; + + virtual booleen trop_grand(float seuil) const=0; + booleen trop_grand2(float seuil, float seuil_t) const; +}; + +ostream& operator<<(ostream& s, const Mouvement& m); +Mouvement* read_mv(istream& s); + + +# 4 "/udd/bonnaud/prg/src/LS.hh" 2 + + +class AFF; + +class LS : public Mouvement +{ +protected: + double k; + double theta; +public: + LS(); + LS(double i_t_x, double i_t_y, double i_k, double i_theta, double i_centre_x, double i_centre_y); + LS(istream& s); + LS(const AFF& aff); + int nb_param() const; + void update(double d_t_x, double d_t_y, double d_k, double d_theta); + void init_from_vect_d(const double param[]); + void init_vect_d(double param[]) const; + void init_from_vect_f(const float param[]); + void init_vect_f(float param[]) const; + friend class AFF; + void dump(ostream& s) const; +}; + +ostream& operator<<(ostream& s, const LS& m); + + +# 3 "/udd/bonnaud/prg/src/LS.cc" 2 + +# 1 "/udd/bonnaud/prg/src/AFF.hh" 1 + +#define AFF_hh + + + +class LS; + +class AFF: public Mouvement +{ +protected: + double a; + double b; + double c; + double d; +public: + AFF(); + AFF(double i_t_x, double i_t_y, + double i_a, double i_b, double i_c, double i_d, + double i_centre_x, double i_centre_y); + AFF(istream& s); + AFF(const LS& ls); + int nb_param() const; + void init_from_vect_d(const double param[]); + void init_vect_d(double param[]) const; + void init_from_vect_f(const float param[]); + void init_vect_f(float param[]) const; + + friend class LS; + void dump(ostream& s) const; +}; + +ostream& operator<<(ostream& s, const AFF& m); + + +# 4 "/udd/bonnaud/prg/src/LS.cc" 2 + + + + + + + +LS::LS() : + k(0.0), theta(0.0) +{ } + +LS::LS(double i_t_x, double i_t_y, + double i_k, double i_theta, + double i_centre_x, double i_centre_y) : + Mouvement(i_t_x, i_t_y, i_centre_x, i_centre_y), + k(i_k), + theta(i_theta) +{ } + +LS::LS(istream& s) +{ + s>>k>>theta>>t_x>>theta>>k>>t_y>>centre_x>>centre_y; +} + +LS::LS(const AFF& aff): Mouvement(aff.t_x, aff.t_y, aff.centre_x, aff.centre_y) +{ + const double eps_k=1E-6; + if(mabs(aff.a-aff.d)>eps_k) + { + cout<<"AFF_2_LS : delta k < "<<eps_k<<endl; + cout<<aff.a<<endl<<aff.d<<endl; + plante(); + } + else + k=(aff.a+aff.d)/2; + + const double eps_theta=1E-6; + if(mabs(aff.c+aff.b)>eps_theta) + { + cout<<"AFF_2_LS : delta theta < "<<eps_theta<<endl; + plante(); + } + else + theta=(aff.c-aff.b)/2; +} + +int LS::nb_param() const +{ + return 4; +} + +void LS::update(double d_t_x, + double d_t_y, + double d_k, + double d_theta) +{ + t_x+=d_t_x; + t_y+=d_t_y; + k+=d_k; + theta+=d_theta; +} + +void LS::init_from_vect_d(const double param[]) +{ + t_x=param[0]; + t_y=param[1]; + k=param[2]; + theta=param[3]; +} + +void LS::init_vect_d(double param[]) const +{ + param[0]=t_x; + param[1]=t_y; + param[2]=k; + param[3]=theta; +} + +void LS::init_from_vect_f(const float param[]) +{ + t_x=param[0]; + t_y=param[1]; + k=param[2]; + theta=param[3]; +} + +void LS::init_vect_f(float param[]) const +{ + param[0]=t_x; + param[1]=t_y; + param[2]=k; + param[3]=theta; +} + + + + + + + + + + + + + + + +void LS::dump(ostream& s) const +{ + const int largeur=14; + s.setf(ios::left,ios::adjustfield); + s<<nom()<<endl + <<setw(largeur)<<k<<setw(largeur)<<-theta<<setw(largeur)<<t_x<<endl + <<setw(largeur)<<theta<<setw(largeur)<<k<<setw(largeur)<<t_y<<endl + <<centre_x<<' '<<centre_y<<endl; +} + +ostream& operator<<(ostream& s, const LS& m) +{ + m.dump(s); + return s; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb102.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb102.C new file mode 100644 index 0000000..9bbd47f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb102.C @@ -0,0 +1,34 @@ +// Error: intenral compiler error on 1998/05/28 snapshot. +#include <stdio.h> +#include <stdlib.h> + +void evilRises (void **ptr) +{ + int *pi; + + pi = new int; + + *pi = 0; + + *ptr = (void *)pi; +} + +int main (int argc, char *argv[]) +{ +#ifdef WORKAROUND + union foo +#else + union +#endif + { + int a; + int b; + int c; + } *fred, barney; + + evilRises((void **)&fred); + + barney = *fred; + + return EXIT_SUCCESS; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb103.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb103.C new file mode 100644 index 0000000..5bd796a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb103.C @@ -0,0 +1,11 @@ +// Build don't link: +// Error: Internal compiler error in 2.7.2 & EGCS 1.0.0 + +template <int nlimb, int i> +inline unsigned f (unsigned* ptr); +template <int nlimb> +inline unsigned f<nlimb,nlimb> (unsigned* ptr) +{ + return 1; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb104.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb104.C new file mode 100644 index 0000000..10c5945 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb104.C @@ -0,0 +1,29 @@ +#include <string.h> + +class SomeClass_t { +public: + SomeClass_t () : x (11) {} +protected: + float x; +}; + +class DynamicOnly_t { +public: + static DynamicOnly_t* create (const char* name = "UNDEF", + const SomeClass_t& somec = *(new SomeClass_t +())) { + return new DynamicOnly_t (name, somec); + } + DynamicOnly_t (const char* name, const SomeClass_t& somec) : + m_somec (somec) { + strncpy (m_Name, name, sizeof (m_Name)); + } +private: + SomeClass_t m_somec; + char m_Name[255]; +}; + +int main (int argc, char* argv[]) { + DynamicOnly_t* ptr = DynamicOnly_t::create (); + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb105.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb105.C new file mode 100644 index 0000000..f431fba --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb105.C @@ -0,0 +1,13 @@ +// Build don't link: +template< class T > +void sort( T* t, int n ) + { + struct +/*line5*/ { + int operator()(T i, T j) + { + return (i < j) ? -1 : ((j < i) ? 1 : 0) ; + } + } c ; + sort(t, n, c, 0) ; + } diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb106.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb106.C new file mode 100644 index 0000000..64408de --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb106.C @@ -0,0 +1,36 @@ +// Special g++ Options: -O2 -fPIC +// Build don't link: +struct T +{ + char* f1; + int f2; +}; + +void f(T*); +int g(); + +extern char a1[]; + +inline int m(int a, int b) {return b < a ? 2 : 1;} + +void +h() +{ + T a[10]; + int i(0); + + bool c; + if (c) + { + a[i++].f1 = "asf"; + f(a); + i = 0; + } + + a[i].f1 = &a1[1]; + a[i].f2 = m(1, g()); + i++; + + a[i].f1 = "zxv"; + a[i].f2 = 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb107.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb107.C new file mode 100644 index 0000000..8d0f3cb --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb107.C @@ -0,0 +1,20 @@ +// Build don't link: +template <class T> +struct X +{ + virtual void f(int) const; +}; + +template <class T> +struct Y: public X<T> +{ + virtual void f(int) const; +}; + +template <class T> +void Y<T>::f(int) const +{ +} + +template <> +void Y<bool>::f(int) const; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb108.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb108.C new file mode 100644 index 0000000..3bf71b0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb108.C @@ -0,0 +1,21 @@ +// Build don't link: +class X +{ + public: + virtual void f() const = 0; +}; + +template <class T> +class Y: public X +{ + public: + virtual void f() const; +}; + +template <class T> +void Y<T>::f() const +{ +} + +template <> +void Y<bool>::f() const; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb109.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb109.C new file mode 100644 index 0000000..88bab1e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb109.C @@ -0,0 +1,71 @@ +#include<map> +#include<iostream.h> +#include<vector> +#include<string> + +// empty parameter class with a minimal set of operations +// if there are no weights for edges necessary +struct Empty +{ + public: + Empty(int=0) {} + bool operator<(const Empty&) const { return true;} +}; +inline ostream& operator<<(ostream& os, const Empty&) { return os;} +inline istream& operator>>(istream& is, Empty& ) { return is;} + + +template<class VertexType, class EdgeType> +class Graph +{ + public: + // public type interface + typedef map<int, EdgeType > Successor; + typedef pair<VertexType, Successor> vertex; + typedef vector<vertex> GraphType; + typedef typename GraphType::iterator iterator; + typedef typename GraphType::const_iterator const_iterator; + + // a lot of stuff deleted .... + + private: + bool directed; + GraphType C; // container + ostream* pOut; +}; // class Graph + +// all graph-methods delet +template<class VertexType, class EdgeType> +ostream& operator<<(ostream& os, Graph<VertexType,EdgeType>& G) +{ + // display of vertices with successors + for(int i = 0; i < G.size(); ++i) + { + os << G[i].first << " <"; + + // The compiler does not like this line!!!!!! + typename Graph<VertexType, EdgeType>::Successor::iterator + startN = G[i].second.begin(), + endN = G[i].second.end(); + + while(startN != endN) + { + os << G[(*startN).first].first << ' ' // vertex + << (*startN).second << ' '; // edge value + ++startN; + } + os << ">\n"; + } + return os; +} + +int main() +{ + // no edge weighting, therefore type Empty: + Graph<string, Empty> V(true); // directed + // ReadGraph(V, "gra1.dat"); + + // display of vertices with successors + cout << V; + +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb11.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb11.C new file mode 100644 index 0000000..553d4e2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb11.C @@ -0,0 +1,32 @@ +// Build don't link: + +#define NO_META_MAX +#ifndef NO_META_MAX +template<int N1, int N2> +struct meta_max { + enum { max = (N1 > N2) ? N1 : N2 }; +}; +#endif + +struct X { + enum { + a = 0, + n = 0 + }; +}; + +template<class T1, class T2> +struct Y { + + enum { + a = T1::a + T2::a, + + // NB: if the next line is changed to + // n = (T1::n > T2::n) ? T1::n : T2::n + // the problem goes away. + + n = meta_max<T1::n,T2::n>::max + }; +}; + +int z = Y<X,X>::a; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb110.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb110.C new file mode 100644 index 0000000..54a1c8b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb110.C @@ -0,0 +1,26 @@ +// Build don't link: +class X +{ + public: + virtual void f() const = 0; +}; + +template <class T> +class Y: public X +{ + public: + virtual void f() const; +}; + +template <class T> +void Y<T>::f() const +{ +} + +template <> +void Y<bool>::f() const; + +template <> +void Y<bool>::f() const +{ +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb111.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb111.C new file mode 100644 index 0000000..8afc921 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb111.C @@ -0,0 +1,6 @@ + int main() { + for(int i=1; i < 9; i++); + for(int i=1; i < 9; i++); + + return 0; + } diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb112.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb112.C new file mode 100644 index 0000000..3233287 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb112.C @@ -0,0 +1,12 @@ +// Build don't link: +template <class STRUCT, class MEMBER> inline STRUCT * +setback(MEMBER *bp, MEMBER STRUCT::*offset) +{ + // The implementation of this function may be platform dependend + if(!bp) return 0; // NULL pointers remain NULL + union { int i; MEMBER STRUCT::*of; } u; // Switch types. Casting won't ++work. + u.of = offset; + return (STRUCT *) ((int) bp - u.i); +} + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb113.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb113.C new file mode 100644 index 0000000..f3c28b9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb113.C @@ -0,0 +1,6 @@ +// Build don't link: +#include <iostream.h> + +class X : public std::streambuf +{ +} ; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb114.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb114.C new file mode 100644 index 0000000..020b88b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb114.C @@ -0,0 +1,29 @@ +#include <string.h> + +class SomeClass_t { +public: + SomeClass_t () : x (11) {} +protected: + float x; +}; + +class DynamicOnly_t { +public: + static DynamicOnly_t* create (const char* name = "UNDEF", + const SomeClass_t& somec = *(new SomeClass_t +())) { + return new DynamicOnly_t (name, somec); + } + DynamicOnly_t (const char* name, const SomeClass_t& somec) : + m_somec (somec) { + strncpy (m_Name, name, sizeof (m_Name)); + } +private: + SomeClass_t m_somec; + char m_Name[255]; +}; + +int main (int argc, char* argv[]) { + DynamicOnly_t* ptr = DynamicOnly_t::create (); //* + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb115.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb115.C new file mode 100644 index 0000000..30eab78 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb115.C @@ -0,0 +1,9 @@ +// Special g++ Options: -O + +#include <iostream.h> +#include <typeinfo> + +int main() { + int *i1, *i2; + cerr << (typeid(i1)==typeid(i2)) << endl; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb116.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb116.C new file mode 100644 index 0000000..63f5e79 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb116.C @@ -0,0 +1,23 @@ +template <class INT> +class b +{ +private: + char a(int x) + { + union { + int i; + char c; + } val; + val.i = x; + return val.c; + }; + +public: + b() { + } +}; + +int main() { + b<int> n; + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb117.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb117.C new file mode 100644 index 0000000..492abb8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb117.C @@ -0,0 +1,26 @@ +#include <stdio.h> +#include <assert.h> + +struct F { + int i; +}; + +F f; + +int main( int, char** ) { + + int F:: *of; + int *i = (int *) &of; + of = &F::i; + + F *b = ((F*) ((int) &f.i - *i)); + F *a = &f; + + + printf("%d\n", a-b); + printf("%d\n", b-a); + + assert( (a-b) == -(b-a) ); // will fail with egcs-1.0 + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb118.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb118.C new file mode 100644 index 0000000..01fb4a3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb118.C @@ -0,0 +1,34 @@ +#include <iostream.h> +#include <typeinfo> + +template <typename T> +class A { +public: + void test (); +}; + +template <typename T> +void +A<T>::test(){ + cerr << "test for " << typeid(*this).name() << endl; +} +// Specialization declaration +void +A<double>::test(); + +// Specialization definition +void +A<double>::test(){ // ============= LINE 21 ================== + cerr << "specialization for " << typeid(*this).name() << endl; +} + + +int +main(){ + A<int> ai; + A<double> ad; + ai.test(); + ad.test(); + return 0; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb119.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb119.C new file mode 100644 index 0000000..8a25dab --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb119.C @@ -0,0 +1,10 @@ +template<bool B> +void f() +{ +} + +int main() +{ + f<bool>(); +} + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb12.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb12.C new file mode 100644 index 0000000..5c948f1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb12.C @@ -0,0 +1,32 @@ +// Build don't link: +// Error: Internal Compiler Error in 2.7.2. & egcs 1.0.0 + +#ifndef NO_META_MAX +template<int N1, int N2> +struct meta_max { + enum { max = (N1 > N2) ? N1 : N2 }; +}; +#endif + +struct X { + enum { + a = 0, + n = 0 + }; +}; + +template<class T1, class T2> +struct Y { + + enum { + a = T1::a + T2::a, + + // NB: if the next line is changed to + // n = (T1::n > T2::n) ? T1::n : T2::n + // the problem goes away. + + n = meta_max<T1::n,T2::n>::max + }; +}; + +int z = Y<X,X>::a; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb120.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb120.C new file mode 100644 index 0000000..b94820c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb120.C @@ -0,0 +1,22 @@ +template<double functionToIntegrate(double)> +double integrate(double a, double b, int numSamplePoints) +{ + // PRECONDITION(numSamplePoints > 1); + double delta = (b-a) / (numSamplePoints-1); + double sum = 0.; + for (int i=0; i < numSamplePoints; ++i) + sum += functionToIntegrate(a + i*delta); + return sum * (b-a) / numSamplePoints; +} + +inline double myFunction(double x) +{ + return 1 / (1 + x); +} + +// Example use +int main() { +double z = integrate<myFunction>(0.0, 1.0, 50); + return 0 ; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb121.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb121.C new file mode 100644 index 0000000..1f003f3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb121.C @@ -0,0 +1,22 @@ +// Compiles. Shouldn't. +class A { +private: + int i1_; +public: + void f(int const i1 = 1); +}; + +void +A::f(int const i1 = 1) // !!! SHOULD TRIGGER AN ERROR !!! +{ + i1_ = i1; +} + +int +main() +{ + A a; + a.f(); + return 0; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb122.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb122.C new file mode 100644 index 0000000..edb6b32 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb122.C @@ -0,0 +1,8 @@ +// Build don't link: +template<class foo> +class bar { +public: + void baz() { (({ while( foo::baz() );})); } +}; +template<class foo> +void baz() { (({ while( foo::baz() );})); } diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb123.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb123.C new file mode 100644 index 0000000..b4c595e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb123.C @@ -0,0 +1,10 @@ +// Special g++ OPtions: -O2 -W +// Build don't link: +#include "stdio.h" + +void writeNote() throw( int ) +{ + printf( "hello world\n" ); + try { } + catch( int ){ throw; } +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb124.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb124.C new file mode 100644 index 0000000..7fbb311 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb124.C @@ -0,0 +1,7 @@ +#include <stdexcept> +#if WORK_AROUND +typedef std::runtime_error std_runtime_error; +class X : public std_runtime_error {}; +#else +class X : public std::runtime_error {}; +#endif diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb125.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb125.C new file mode 100644 index 0000000..165dc77 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb125.C @@ -0,0 +1,1259 @@ + + +#pragma interface + + + +extern "C" { + + + + + + + + + + + + + + + + +typedef int _G_int8_t __attribute__((__mode__(__QI__))); +typedef unsigned int _G_uint8_t __attribute__((__mode__(__QI__))); +typedef int _G_int16_t __attribute__((__mode__(__HI__))); +typedef unsigned int _G_uint16_t __attribute__((__mode__(__HI__))); +typedef int _G_int32_t __attribute__((__mode__(__SI__))); +typedef unsigned int _G_uint32_t __attribute__((__mode__(__SI__))); +typedef int _G_int64_t __attribute__((__mode__(__DI__))); +typedef unsigned int _G_uint64_t __attribute__((__mode__(__DI__))); +__extension__ typedef long long _G_llong; +__extension__ typedef unsigned long long _G_ullong; + + + + + + + +typedef long _G_clock_t; +typedef short _G_dev_t; +typedef long _G_fpos_t; +typedef unsigned short _G_gid_t; +typedef unsigned long _G_ino_t; +typedef unsigned short _G_mode_t; +typedef short _G_nlink_t; +typedef long _G_off_t; +typedef short _G_pid_t; + + + +typedef int _G_ptrdiff_t; +typedef long _G_sigset_t; + + + +typedef unsigned int _G_size_t; +typedef long _G_time_t; +typedef unsigned short _G_uid_t; +typedef long int _G_wchar_t; + + + + + + + + + + + + + + + +typedef int _G_ssize_t; +typedef unsigned int _G_wint_t; +typedef char * _G_va_list; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +struct _IO_jump_t; struct _IO_FILE; + + + + + + + + + + + + typedef void _IO_lock_t; + + + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; + +}; + +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + int _blksize; + _G_off_t _offset; + + + + unsigned short _cur_column; + char _unused; + char _shortbuf[1]; + + + + + + +}; + + + + + +struct _IO_FILE_plus; +extern struct _IO_FILE_plus _IO_stdin_, _IO_stdout_, _IO_stderr_; + + + + + + +typedef struct +{ + _G_ssize_t (*read) (struct _IO_FILE *, void *, _G_ssize_t ) ; + _G_ssize_t (*write) (struct _IO_FILE *, const void *, _G_ssize_t ) ; + _G_fpos_t (*seek) (struct _IO_FILE *, _G_off_t , int) ; + int (*close) (struct _IO_FILE *) ; +} _IO_cookie_io_functions_t; + + +struct _IO_cookie_file +{ + struct _IO_FILE file; + const void *vtable; + void *cookie; + _IO_cookie_io_functions_t io_functions; +}; + + + +extern "C" { + + +extern int __underflow (_IO_FILE *) ; +extern int __uflow (_IO_FILE *) ; +extern int __overflow (_IO_FILE *, int) ; + + + + + + + + + + + + + + + + + +extern int _IO_getc (_IO_FILE *__fp) ; +extern int _IO_putc (int __c, _IO_FILE *__fp) ; +extern int _IO_feof (_IO_FILE *__fp) ; +extern int _IO_ferror (_IO_FILE *__fp) ; + +extern int _IO_peekc_locked (_IO_FILE *__fp) ; + + + + + +extern void _IO_flockfile (_IO_FILE *) ; +extern void _IO_funlockfile (_IO_FILE *) ; +extern int _IO_ftrylockfile (_IO_FILE *) ; + + + + + + + + + + + + + +extern int _IO_vfscanf (_IO_FILE *, const char *, _G_va_list , int *) ; +extern int _IO_vfprintf (_IO_FILE *, const char *, _G_va_list ) ; +extern _G_ssize_t _IO_padn (_IO_FILE *, int, _G_ssize_t ) ; +extern _G_size_t _IO_sgetn (_IO_FILE *, void *, _G_size_t ) ; + +extern _G_fpos_t _IO_seekoff (_IO_FILE *, _G_off_t , int, int) ; +extern _G_fpos_t _IO_seekpos (_IO_FILE *, _G_fpos_t , int) ; + +extern void _IO_free_backup_area (_IO_FILE *) ; + + +} + + + + +} + + + + + + + + + + + + + + + + + + + + + + + +extern "C++" { +class istream; +class ostream; class streambuf; + + + + + +typedef _G_off_t streamoff; +typedef _G_fpos_t streampos; +typedef _G_ssize_t streamsize; + +typedef unsigned long __fmtflags; +typedef unsigned char __iostate; + +struct _ios_fields +{ + streambuf *_strbuf; + ostream* _tie; + int _width; + __fmtflags _flags; + short _fill; + __iostate _state; + __iostate _exceptions; + int _precision; + + void *_arrays; +}; + + + + + + + + + + + + + + + + + +class ios : public _ios_fields { + ios& operator=(ios&); + ios (const ios&); + public: + typedef __fmtflags fmtflags; + typedef int iostate; + typedef int openmode; + typedef int streamsize; + enum io_state { + goodbit = 0 , + eofbit = 1 , + failbit = 2 , + badbit = 4 }; + enum open_mode { + in = 1 , + out = 2 , + ate = 4 , + app = 8 , + trunc = 16 , + nocreate = 32 , + noreplace = 64 , + bin = 128 , + binary = 128 }; + enum seek_dir { beg, cur, end}; + typedef enum seek_dir seekdir; + + enum { skipws= 01 , + left= 02 , right= 04 , internal= 010 , + dec= 020 , oct= 040 , hex= 0100 , + showbase= 0200 , showpoint= 0400 , + uppercase= 01000 , showpos= 02000 , + scientific= 04000 , fixed= 010000 , + unitbuf= 020000 , stdio= 040000 + + + + }; + enum { + basefield=dec+oct+hex, + floatfield = scientific+fixed, + adjustfield = left+right+internal + }; + + + + ostream* tie() const { return _tie; } + ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; } + + + short fill() const { return (short )_fill; } + short fill(short newf) + {short oldf = (short )_fill; _fill = (char)newf; return oldf;} + fmtflags flags() const { return _flags; } + fmtflags flags(fmtflags new_val) { + fmtflags old_val = _flags; _flags = new_val; return old_val; } + int precision() const { return _precision; } + int precision(int newp) { + unsigned short oldp = _precision; _precision = (unsigned short)newp; + return oldp; } + fmtflags setf(fmtflags val) { + fmtflags oldbits = _flags; + _flags |= val; return oldbits; } + fmtflags setf(fmtflags val, fmtflags mask) { + fmtflags oldbits = _flags; + _flags = (_flags & ~mask) | (val & mask); return oldbits; } + fmtflags unsetf(fmtflags mask) { + fmtflags oldbits = _flags; + _flags &= ~mask; return oldbits; } + int width() const { return _width; } + int width(int val) { int save = _width; _width = val; return save; } + + + + + void _throw_failure() const { } + + void clear(iostate state = 0) { + _state = _strbuf ? state : state|badbit; + if (_state & _exceptions) _throw_failure(); } + void set(iostate flag) { _state |= flag; + if (_state & _exceptions) _throw_failure(); } + void setstate(iostate flag) { _state |= flag; + if (_state & _exceptions) _throw_failure(); } + int good() const { return _state == 0; } + int eof() const { return _state & ios::eofbit; } + int fail() const { return _state & (ios::badbit|ios::failbit); } + int bad() const { return _state & ios::badbit; } + iostate rdstate() const { return _state; } + operator void*() const { return fail() ? (void*)0 : (void*)(-1); } + int operator!() const { return fail(); } + iostate exceptions() const { return _exceptions; } + void exceptions(iostate enable) { + _exceptions = enable; + if (_state & _exceptions) _throw_failure(); } + + streambuf* rdbuf() const { return _strbuf; } + streambuf* rdbuf(streambuf *_s) { + streambuf *_old = _strbuf; _strbuf = _s; clear (); return _old; } + + static int sync_with_stdio(int on); + static void sync_with_stdio() { sync_with_stdio(1); } + static fmtflags bitalloc(); + static int xalloc(); + void*& pword(int); + void* pword(int) const; + long& iword(int); + long iword(int) const; + + + + + + + + + + + class Init { + public: + Init () { } + }; + + protected: + inline ios(streambuf* sb = 0, ostream* tie_to = 0); + inline virtual ~ios(); + inline void init(streambuf* sb, ostream* tie = 0); +}; + + + + +typedef ios::seek_dir _seek_dir; + + + + + + + + + + +class streammarker : private _IO_marker { + friend class streambuf; + void set_offset(int offset) { _pos = offset; } + public: + streammarker(streambuf *sb); + ~streammarker(); + int saving() { return 1; } + int delta(streammarker&); + int delta(); +}; + +struct streambuf : public _IO_FILE { + friend class ios; + friend class istream; + friend class ostream; + friend class streammarker; + const void *&_vtable() { return *(const void**)((_IO_FILE*)this + 1); } + protected: + static streambuf* _list_all; + _IO_FILE*& xchain() { return _chain; } + void _un_link(); + void _link_in(); + char* gptr() const + { return _flags & 0x100 ? _IO_save_base : _IO_read_ptr; } + char* pptr() const { return _IO_write_ptr; } + char* egptr() const + { return _flags & 0x100 ? _IO_save_end : _IO_read_end; } + char* epptr() const { return _IO_write_end; } + char* pbase() const { return _IO_write_base; } + char* eback() const + { return _flags & 0x100 ? _IO_save_base : _IO_read_base;} + char* base() const { return _IO_buf_base; } + char* ebuf() const { return _IO_buf_end; } + int blen() const { return _IO_buf_end - _IO_buf_base; } + void xput_char(char c) { *_IO_write_ptr++ = c; } + int xflags() { return _flags ; } + int xflags(int f) {int fl = _flags ; _flags = f; return fl;} + void xsetflags(int f) { _flags |= f; } + void xsetflags(int f, int mask) + { _flags = (_flags & ~mask) | (f & mask); } + void gbump(int n) + { _flags & 0x100 ? (_IO_save_base+=n):(_IO_read_ptr+=n);} + void pbump(int n) { _IO_write_ptr += n; } + void setb(char* b, char* eb, int a=0); + void setp(char* p, char* ep) + { _IO_write_base=_IO_write_ptr=p; _IO_write_end=ep; } + void setg(char* eb, char* g, char *eg) { + if (_flags & 0x100 ) _IO_free_backup_area(this); + _IO_read_base = eb; _IO_read_ptr = g; _IO_read_end = eg; } + char *shortbuf() { return _shortbuf; } + + int in_backup() { return _flags & 0x100 ; } + + char *Gbase() { return in_backup() ? _IO_save_base : _IO_read_base; } + + char *eGptr() { return in_backup() ? _IO_save_end : _IO_read_end; } + + char *Bbase() { return in_backup() ? _IO_read_base : _IO_save_base; } + char *Bptr() { return _IO_backup_base; } + + char *eBptr() { return in_backup() ? _IO_read_end : _IO_save_end; } + char *Nbase() { return _IO_save_base; } + char *eNptr() { return _IO_save_end; } + int have_backup() { return _IO_save_base != __null ; } + int have_markers() { return _markers != __null ; } + void free_backup_area(); + void unsave_markers(); + int put_mode() { return _flags & 0x800 ; } + int switch_to_get_mode(); + + streambuf(int flags=0); + public: + static int flush_all(); + static void flush_all_linebuffered(); + virtual ~streambuf(); + virtual int overflow(int c = (-1) ); + virtual int underflow(); + virtual int uflow(); + virtual int pbackfail(int c); + + virtual streamsize xsputn(const char* s, streamsize n); + virtual streamsize xsgetn(char* s, streamsize n); + virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); + virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out); + + streampos pubseekoff(streamoff o, _seek_dir d, int mode=ios::in|ios::out) + { return _IO_seekoff (this, o, d, mode); } + streampos pubseekpos(streampos pos, int mode = ios::in|ios::out) + { return _IO_seekpos (this, pos, mode); } + streampos sseekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); + streampos sseekpos(streampos pos, int mode = ios::in|ios::out); + virtual streambuf* setbuf(char* p, int len); + virtual int sync(); + virtual int doallocate(); + + int seekmark(streammarker& mark, int delta = 0); + int sputbackc(char c); + int sungetc(); + int unbuffered() { return _flags & 2 ? 1 : 0; } + int linebuffered() { return _flags & 0x200 ? 1 : 0; } + void unbuffered(int i) + { if (i) _flags |= 2 ; else _flags &= ~2 ; } + void linebuffered(int i) + { if (i) _flags |= 0x200 ; else _flags &= ~0x200 ; } + int allocate() { + if (base() || unbuffered()) return 0; + else return doallocate(); } + + void allocbuf() { if (base() == __null ) doallocbuf(); } + void doallocbuf(); + int in_avail() { return _IO_read_end - _IO_read_ptr; } + int out_waiting() { return _IO_write_ptr - _IO_write_base; } + streamsize sputn(const char* s, streamsize n) { return xsputn(s, n); } + streamsize padn(char pad, streamsize n) { return _IO_padn(this, pad, n); } + streamsize sgetn(char* s, streamsize n) { return _IO_sgetn(this, s, n); } + int ignore(int); + int get_column(); + int set_column(int); + long sgetline(char* buf, _G_size_t n, char delim, int putback_delim); + int sputc(int c) { return _IO_putc(c, this); } + int sbumpc() { return _IO_getc(this); } + int sgetc() { return (( this )->_IO_read_ptr >= ( this )->_IO_read_end && __underflow ( this ) == (-1) ? (-1) : *(unsigned char *) ( this )->_IO_read_ptr) ; } + int snextc() { + if (_IO_read_ptr >= _IO_read_end && __underflow(this) == (-1) ) + return (-1) ; + else return _IO_read_ptr++, sgetc(); } + void stossc() { if (_IO_read_ptr < _IO_read_end) _IO_read_ptr++; } + int vscan(char const *fmt0, _G_va_list ap, ios* stream = __null ); + int scan(char const *fmt0 ...); + int vform(char const *fmt0, _G_va_list ap); + int form(char const *fmt0 ...); + + + + + virtual streamsize sys_read(char* buf, streamsize size); + virtual streamsize sys_write(const char*, streamsize); + virtual streampos sys_seek(streamoff, _seek_dir); + virtual int sys_close(); + virtual int sys_stat(void*); +}; + + + + +class filebuf : public streambuf { + protected: + void init(); + public: + static const int openprot; + filebuf(); + filebuf(int fd); + filebuf(int fd, char* p, int len); + + + + ~filebuf(); + filebuf* attach(int fd); + filebuf* open(const char *filename, const char *mode); + filebuf* open(const char *filename, ios::openmode mode, int prot = 0664); + virtual int underflow(); + virtual int overflow(int c = (-1) ); + int is_open() const { return _fileno >= 0; } + int fd() const { return is_open() ? _fileno : (-1) ; } + filebuf* close(); + virtual int doallocate(); + virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); + virtual streambuf* setbuf(char* p, int len); + streamsize xsputn(const char* s, streamsize n); + streamsize xsgetn(char* s, streamsize n); + virtual int sync(); + protected: + + int is_reading() { return eback() != egptr(); } + char* cur_ptr() { return is_reading() ? gptr() : pptr(); } + + char* file_ptr() { return eGptr(); } + + virtual streamsize sys_read(char* buf, streamsize size); + virtual streampos sys_seek(streamoff, _seek_dir); + virtual streamsize sys_write(const char*, streamsize); + virtual int sys_stat(void*); + virtual int sys_close(); + + + + +}; + +inline void ios::init(streambuf* sb, ostream* tie_to) { + _state = sb ? ios::goodbit : ios::badbit; _exceptions=0; + _strbuf=sb; _tie = tie_to; _width=0; _fill=' '; + + _flags=ios::skipws|ios::dec; + + + + _precision=6; _arrays = 0; } + +inline ios::ios(streambuf* sb, ostream* tie_to) { init(sb, tie_to); } + +inline ios::~ios() { + + + + if (_arrays) delete [] _arrays; +} +} + + + +extern "C++" { +class istream; class ostream; +typedef ios& (*__manip)(ios&); +typedef istream& (*__imanip)(istream&); +typedef ostream& (*__omanip)(ostream&); + +extern istream& ws(istream& ins); +extern ostream& flush(ostream& outs); +extern ostream& endl(ostream& outs); +extern ostream& ends(ostream& outs); + +class ostream : virtual public ios +{ + + void do_osfx(); + public: + ostream() { } + ostream(streambuf* sb, ostream* tied= __null ); + int opfx() { + if (!good()) return 0; + else { if (_tie) _tie->flush(); ; return 1;} } + void osfx() { ; + if (flags() & (ios::unitbuf|ios::stdio)) + do_osfx(); } + ostream& flush(); + ostream& put(char c) { _strbuf->sputc(c); return *this; } + + + + + + ostream& write(const char *s, streamsize n); + ostream& write(const unsigned char *s, streamsize n) + { return write((const char*)s, n);} + ostream& write(const signed char *s, streamsize n) + { return write((const char*)s, n);} + ostream& write(const void *s, streamsize n) + { return write((const char*)s, n);} + ostream& seekp(streampos); + ostream& seekp(streamoff, _seek_dir); + streampos tellp(); + ostream& form(const char *format ...); + ostream& vform(const char *format, _G_va_list args); + + ostream& operator<<(char c); + ostream& operator<<(unsigned char c) { return (*this) << (char)c; } + ostream& operator<<(signed char c) { return (*this) << (char)c; } + ostream& operator<<(const char *s); + ostream& operator<<(const unsigned char *s) + { return (*this) << (const char*)s; } + ostream& operator<<(const signed char *s) + { return (*this) << (const char*)s; } + ostream& operator<<(const void *p); + ostream& operator<<(int n); + ostream& operator<<(unsigned int n); + ostream& operator<<(long n); + ostream& operator<<(unsigned long n); + + __extension__ ostream& operator<<(long long n); + __extension__ ostream& operator<<(unsigned long long n); + + ostream& operator<<(short n) {return operator<<((int)n);} + ostream& operator<<(unsigned short n) {return operator<<((unsigned int)n);} + + ostream& operator<<(bool b) { return operator<<((int)b); } + + ostream& operator<<(double n); + ostream& operator<<(float n) { return operator<<((double)n); } + + + + ostream& operator<<(long double n) { return operator<<((double)n); } + + ostream& operator<<(__omanip func) { return (*func)(*this); } + ostream& operator<<(__manip func) {(*func)(*this); return *this;} + ostream& operator<<(streambuf*); + + + +}; + +class istream : virtual public ios +{ + +protected: + _G_size_t _gcount; + + int _skip_ws(); + public: + istream(): _gcount (0) { } + istream(streambuf* sb, ostream*tied= __null ); + istream& get(char* ptr, int len, char delim = '\n'); + istream& get(unsigned char* ptr, int len, char delim = '\n') + { return get((char*)ptr, len, delim); } + istream& get(char& c); + istream& get(unsigned char& c) { return get((char&)c); } + istream& getline(char* ptr, int len, char delim = '\n'); + istream& getline(unsigned char* ptr, int len, char delim = '\n') + { return getline((char*)ptr, len, delim); } + istream& get(signed char& c) { return get((char&)c); } + istream& get(signed char* ptr, int len, char delim = '\n') + { return get((char*)ptr, len, delim); } + istream& getline(signed char* ptr, int len, char delim = '\n') + { return getline((char*)ptr, len, delim); } + istream& read(char *ptr, streamsize n); + istream& read(unsigned char *ptr, streamsize n) + { return read((char*)ptr, n); } + istream& read(signed char *ptr, streamsize n) + { return read((char*)ptr, n); } + istream& read(void *ptr, streamsize n) + { return read((char*)ptr, n); } + istream& get(streambuf& sb, char delim = '\n'); + istream& gets(char **s, char delim = '\n'); + int ipfx(int need = 0) { + if (!good()) { set(ios::failbit); return 0; } + else { + ; + if (_tie && (need == 0 || rdbuf()->in_avail() < need)) _tie->flush(); + if (!need && (flags() & ios::skipws)) return _skip_ws(); + else return 1; + } + } + int ipfx0() { + if (!good()) { set(ios::failbit); return 0; } + else { + ; + if (_tie) _tie->flush(); + if (flags() & ios::skipws) return _skip_ws(); + else return 1; + } + } + int ipfx1() { + if (!good()) { set(ios::failbit); return 0; } + else { + ; + if (_tie && rdbuf()->in_avail() == 0) _tie->flush(); + return 1; + } + } + void isfx() { ; } + int get() { if (!ipfx1()) return (-1) ; + else { int ch = _strbuf->sbumpc(); + if (ch == (-1) ) set(ios::eofbit); + return ch; + } } + int peek(); + _G_size_t gcount() { return _gcount; } + istream& ignore(int n=1, int delim = (-1) ); + int sync (); + istream& seekg(streampos); + istream& seekg(streamoff, _seek_dir); + streampos tellg(); + istream& putback(char ch) { + if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit); + return *this;} + istream& unget() { + if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit); + return *this;} + istream& scan(const char *format ...); + istream& vscan(const char *format, _G_va_list args); + + + + + + + istream& operator>>(char*); + istream& operator>>(unsigned char* p) { return operator>>((char*)p); } + istream& operator>>(signed char*p) { return operator>>((char*)p); } + istream& operator>>(char& c); + istream& operator>>(unsigned char& c) {return operator>>((char&)c);} + istream& operator>>(signed char& c) {return operator>>((char&)c);} + istream& operator>>(int&); + istream& operator>>(long&); + + __extension__ istream& operator>>(long long&); + __extension__ istream& operator>>(unsigned long long&); + + istream& operator>>(short&); + istream& operator>>(unsigned int&); + istream& operator>>(unsigned long&); + istream& operator>>(unsigned short&); + + istream& operator>>(bool&); + + istream& operator>>(float&); + istream& operator>>(double&); + istream& operator>>(long double&); + istream& operator>>( __manip func) {(*func)(*this); return *this;} + istream& operator>>(__imanip func) { return (*func)(*this); } + istream& operator>>(streambuf*); +}; + +class iostream : public istream, public ostream +{ + public: + iostream() { } + iostream(streambuf* sb, ostream*tied= __null ); +}; + +class _IO_istream_withassign : public istream { +public: + _IO_istream_withassign& operator=(istream&); + _IO_istream_withassign& operator=(_IO_istream_withassign& rhs) + { return operator= (static_cast<istream&> (rhs)); } +}; + +class _IO_ostream_withassign : public ostream { +public: + _IO_ostream_withassign& operator=(ostream&); + _IO_ostream_withassign& operator=(_IO_ostream_withassign& rhs) + { return operator= (static_cast<ostream&> (rhs)); } +}; + +extern _IO_istream_withassign cin; + +extern _IO_ostream_withassign cout, cerr; + +extern _IO_ostream_withassign clog + + + +; + +extern istream& lock(istream& ins); +extern istream& unlock(istream& ins); +extern ostream& lock(ostream& outs); +extern ostream& unlock(ostream& outs); + +struct Iostream_init { } ; + +inline ios& dec(ios& i) +{ i.setf(ios::dec, ios::dec|ios::hex|ios::oct); return i; } +inline ios& hex(ios& i) +{ i.setf(ios::hex, ios::dec|ios::hex|ios::oct); return i; } +inline ios& oct(ios& i) +{ i.setf(ios::oct, ios::dec|ios::hex|ios::oct); return i; } +} + + + + +struct test_box + { + void print(void) {cout << "this is a test" << endl;} + }; + +void test<class BOX> (test_box *); + +class test_square + { + friend void test<class BOX> (test_box *); + } + + + +template <class BOX> void test(BOX *the_box) + { + the_box->print(); + }; + +template void test<> (test_box *); + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb126.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb126.C new file mode 100644 index 0000000..8c634e8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb126.C @@ -0,0 +1,29 @@ +#include <string.h> + +class SomeClass_t { +public: + SomeClass_t () : x (11) {} +protected: + float x; +}; + +class DynamicOnly_t { +public: + static DynamicOnly_t* create (const char* name = "UNDEF", + const SomeClass_t& somec = *(new SomeClass_t +())) { + return new DynamicOnly_t (name, somec); + } + DynamicOnly_t (const char* name, const SomeClass_t& somec) : + m_somec (somec) { + strncpy (m_Name, name, sizeof (m_Name)); + } +private: + SomeClass_t m_somec; + char m_Name[255]; +}; + +int main (int argc, char* argv[]) { + DynamicOnly_t* ptr = DynamicOnly_t::create (); + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb127.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb127.C new file mode 100644 index 0000000..b3f36dd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb127.C @@ -0,0 +1,57 @@ +#include <vector> +#include<string> + +using namespace std; + +class ODEsolver +{ + private: + void eulerODE(vector<double>& y, double& t, double& dt); + void midpointODE(vector<double>& y, double& t, double& dt); + + protected: + void (ODEsolver::*useMethod)(vector<double>&, double&, double&); + void init(); + + public: + ODEsolver(); + void timeloop(vector<double>& y, double ts, double te, double dt); +}; + + +ODEsolver::ODEsolver() +{ + init(); +} + + +void ODEsolver::eulerODE(vector<double>& y, double& t, double& dt) +{ + y[0] = dt * 2.; +} + +void ODEsolver::midpointODE(vector<double>& y, double& t, double& dt) +{ + y[0] = dt * 3.; +} + + + +void ODEsolver::init() +{ + ODEsolver::useMethod = ODEsolver::midpointODE; +} + +void ODEsolver::timeloop(vector<double>& y, double ts, double te, double dt) +{ + (ODEsolver::useMethod)(y,ts,dt); +} + +int main (int nargs, char** args) +{ + ODEsolver solver; + vector<double> y(2); double t_start=5.; double t_end=7.; double dt=2.; + solver.timeloop(y,t_start,t_end,dt); + cout << y[0] << endl; + return(0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb13.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb13.C new file mode 100644 index 0000000..f0e4848 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb13.C @@ -0,0 +1,16 @@ +// Build don't link: +template<class T> +class Array { +public: + typedef T T_numtype; +}; + +template<class T_array> +void f(T_array, typename T_array::T_numtype) +{ +} + +void g() +{ + f(Array<float>(), float()); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb14.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb14.C new file mode 100644 index 0000000..de00e7b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb14.C @@ -0,0 +1,36 @@ +template<int N> +struct I { +}; + +template<class T> +struct A { + + int r; + + template<class T1, class T2> + void operator()(T1, T2) + { r = 0; } + + template<int N1, int N2> + void operator()(I<N1>, I<N2>) + { r = 1; } +}; + +int main() +{ + A<float> x; + I<0> a; + I<1> b; + + x(a,b); + if (x.r != 1) + abort(); + + x(float(), double()); + if (x.r != 0) + abort(); + + return 0; +} + + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb15.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb15.C new file mode 100644 index 0000000..ef15764 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb15.C @@ -0,0 +1,24 @@ +// Build don't link: +#include<iostream.h> + +struct A { + A() { + cerr<<"A constructing\n"; + throw 1; + } + void *operator new(unsigned sz) { + cerr<<"A allocated\n"; + return ::operator new(sz); + } + void operator delete (void *p) { + cerr<<"A deleted\n"; + ::operator delete (p); + } +}; + +int main() { + try { + new A(); + } catch (...) { + } +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb16.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb16.C new file mode 100644 index 0000000..5dc259d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb16.C @@ -0,0 +1,14 @@ +// Build don't link: +template<class T> +struct A { + typedef T T1; +}; + +template<class T> +struct B : T::T1 { // insert `typename' before T::T1 +}; + +struct C { }; + +B<A<C> > z; + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb17.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb17.C new file mode 100644 index 0000000..86b5424 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb17.C @@ -0,0 +1,54 @@ +#include <stdio.h> + +class A { +public: + virtual void print(); + virtual A * clone(); +}; + +class B : virtual public A { +public: + void print(); + B * clone(); +}; + +void A::print() +{ + printf("A\n"); +} + +void B::print() +{ + printf("B\n"); +} + + +A * A::clone() +{ + return this; +} + +B * B::clone() +{ + return this; +} + + +int main() +{ + A * a = new B; + B * b = dynamic_cast<B *>(a); + + printf("%p\n",b); // (*2*) + b->print(); + + a = b; + printf("%p\n",a); + a->print(); + + a = a->clone(); + printf("%p\n",a); + a->print(); // (*1*) + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb18.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb18.C new file mode 100644 index 0000000..acd336d4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb18.C @@ -0,0 +1,8 @@ +// Build don't link: +class C { }; + +void foo() +{ + C c; + void * v = static_cast<void *>(c); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb19.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb19.C new file mode 100644 index 0000000..a5ddd36 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb19.C @@ -0,0 +1,16 @@ +// Build don't link: + +#define CRASH 1 +#ifdef CRASH +#define VIRTUAL virtual +#else +#define VIRTUAL +#endif + +class A {}; +class B : public VIRTUAL A {}; +template <class Imp> class C : public /*virtual*/ Imp {}; +// define CRASH and uncomment here ^^^^^^^^^^^ +// and the crash goes away!!!! + +template class C<B>; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb2.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb2.C new file mode 100644 index 0000000..a4b8e20 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb2.C @@ -0,0 +1,17 @@ +// Build don't link: +typedef unsigned int size_t; +inline void *operator new(size_t, void *place) throw() { return place; } + +struct A +{ + A(); + ~A(); +}; + +void testfunc( void ) +{ + A* mybuf; + A v[1]; + + new (mybuf) A(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb20.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb20.C new file mode 100644 index 0000000..08c76d0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb20.C @@ -0,0 +1,33 @@ +// Error: ICE on 2.7.2.3 and EGCS 1.0.0. +// Build don't link: + +template<int N1, int N2> +struct meta_max { + enum { max = (N1 > N2) ? N1 : N2 }; +}; + +struct X { + enum { + a = 0, + n = 0 + }; +}; + +template<class T1, class T2, class T3> +struct Y { + + enum { + a = T1::a + T2::a + T3::a, + n = meta_max<meta_max<T1::n,T2::n>::max, T3::n>::max + }; +}; + +template<class T> +struct Z { + enum { + a = T::a, + n = T::n + }; +}; + +Z<Y<X,X,X> > z; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb21.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb21.C new file mode 100644 index 0000000..b3468d9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb21.C @@ -0,0 +1,22 @@ +#include <vector> + +#include <strstream.h> + +/*----------------------------------------*/ + +struct connection_t { + connection_t() {} +}; + +vector<connection_t> connections; + +/*----------------------------------------*/ + +int +main() { + ostrstream str; + + connections.insert(connections.end(), connection_t()); + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb22.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb22.C new file mode 100644 index 0000000..b2d6ab6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb22.C @@ -0,0 +1,24 @@ +// Build don't link: +// XFAIL, doesn't. + +class MyInt +{ +public: + MyInt(int = 0) {} + operator int() const {return 2;} +}; + +bool operator==(const MyInt& a, const int& b) +{ + return (int)a == b; +} + +bool operator==(const MyInt& a, const MyInt& b) +{ + return (int)a == (int)b; +} + +bool f() +{ + return 3 == MyInt(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb23.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb23.C new file mode 100644 index 0000000..8a0602a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb23.C @@ -0,0 +1,20 @@ +// Build don't link: +class foo { +protected: + void __duplicate (); + +}; + +class bar : public virtual foo { +protected: + void __duplicate() { + foo::__duplicate (); + } +}; + +class oops : public virtual bar { +protected: + void __duplicate() { + foo::__duplicate (); + } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb24.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb24.C new file mode 100644 index 0000000..b1f0104 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb24.C @@ -0,0 +1,23 @@ +// Build don't link: +#include <iostream.h> + +template < class T > +class X +{ + protected: + + union { + int x; + double y; + }; +}; + +template < class T > +class Y : public X<T> +{ + public: + + using X<T>::x; + + void f () { cout << x << endl; } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb25.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb25.C new file mode 100644 index 0000000..f764a05 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb25.C @@ -0,0 +1,9 @@ +#include <stack> +#include <vector> + + +int main() +{ + priority_queue< int, vector<int>, greater<int> > pq; + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb26.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb26.C new file mode 100644 index 0000000..38d51bc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb26.C @@ -0,0 +1,23 @@ +// +// egcs-2.90.06 +// cannot declare friend of enclosing class using its scope, works fine +// without scope or for definition of foo::bar::f +// + +class foo +{ + public: + static int f(); + class bar { + friend int foo::f(); +// friend int f(); + static int x; + public: + static int f() {return foo::f();}; + }; +}; + +int foo::f() { + return bar::x; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb27.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb27.C new file mode 100644 index 0000000..3b0ffd6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb27.C @@ -0,0 +1,42 @@ +/* bug.cc */ +/* simple program to demonstrate the bug with named return values in gcc +*/ +/* (w) 4.9.97 by Kurt Garloff <K.Garloff@ping.de> */ + +#include <iostream.h> + +// A simple numerical class +template <class T> +class test +{ + T elem; + public: + test () { elem = 0; }; + test (const T& a) { elem = a; }; + test<T>& operator += (const test<T>& a) { elem += a.elem; return *this; }; + friend test<T> operator + (const test<T>&, const test<T>&); + friend ostream& operator << (ostream& os, const test<T>& a) + { return os << a.elem; }; +}; + +#ifndef NOBUG +// named return value version +template <class T> +test<T> operator + (const test<T>& a, const test<T>& b) return c(a); +{ c += b; }; + +#else +// equiv. version without named ret val +template <class T> +test<T> operator + (const test<T>& a, const test<T>& b) +{ test<T> c(a); c += b; return c; }; + +#endif + +int main() +{ + test<int> x, y; + x += 5; cout << x << endl; + y = x + 2; cout << y << endl; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb28.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb28.C new file mode 100644 index 0000000..1e1aed1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb28.C @@ -0,0 +1,16 @@ +#include <vector.h> +enum s { S }; +class a +{ + vector<s> vs; + friend class b; +}; +class b +{ + vector<a> va; + operator vector< vector<s> >() + { + vector< vector<s> > vvs(va.size()); + return vvs; + } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb29.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb29.C new file mode 100644 index 0000000..17b11ea --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb29.C @@ -0,0 +1,15 @@ +#include <vector.h> +enum s { S }; +class a +{ + vector<s> vs; + friend class b; +}; +class b +{ + vector<a> va; + operator vector< vector<s> >() + { + return vector< vector<s> >(va.size()); + } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb3.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb3.C new file mode 100644 index 0000000..d257043 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb3.C @@ -0,0 +1,11 @@ +// Build don't link: +#include <complex.h> +template<class T> +class Vec { +public: + Vec() { data = new T; } + Vec<T> split() { Vec<T> tmp; operator=(tmp); return tmp; } + void operator=(const Vec<T> &v) { data = new T; } + T *data; +}; +template class Vec<complex<double> >; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb30.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb30.C new file mode 100644 index 0000000..c116ab4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb30.C @@ -0,0 +1,16 @@ +// Build don't link: +#include <fstream.h> + +class bifstream : public ifstream { +public: + bifstream(); +// ~bifstream(); +}; + +void load_bin() +{ + bifstream InFile; + + if (!InFile) + return; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb31.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb31.C new file mode 100644 index 0000000..1a18af5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb31.C @@ -0,0 +1,17 @@ +#include<iostream.h> + +int main() { + try { + throw 1; + } catch(...) { + try { + throw; + } catch(int) { + } + try { + throw; + } catch(int) { + } + } + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb32.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb32.C new file mode 100644 index 0000000..b5bc839 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb32.C @@ -0,0 +1,12 @@ +// Build don't link: +class A { +public: + void malloc(unsigned int); +}; + +void A::malloc(unsigned int) {} + +int foo() { + A a; + a.malloc(3); // <-- line 10 +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb33.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb33.C new file mode 100644 index 0000000..3797ab3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb33.C @@ -0,0 +1,11 @@ +#include <fstream.h> +#include <stdio.h> + +int +main() +{ + printf("If you see this, you don't have a problem!\n"); +#ifdef EXPOSE_BUG + ifstream a; +#endif +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb34.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb34.C new file mode 100644 index 0000000..08167b5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb34.C @@ -0,0 +1,19 @@ +// Build don't link: +class Base { +public: + class Bar { public: virtual ~Bar() {}; }; +}; + +class Derived : public Base { +public: + class Bar : public Base::Bar {}; +}; + +template <class T> +class XYZ : public T::Bar { +}; + +void test() { + XYZ<Base> b; + XYZ<Derived> d; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb35.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb35.C new file mode 100644 index 0000000..e28fb49 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb35.C @@ -0,0 +1,38 @@ +// Build don't link: + +class string +{ +public: + string(); + string(const string& x); + string(const char* t); + + ~string(); +}; + +void set_status(string message); + +class StatusDelay { +private: + string cause; + +public: + StatusDelay(const string& c) + : cause(c) + { + set_status(cause); + } + + ~StatusDelay() + { + set_status(cause); + } +}; + +static char delay_message[] = "Filtering files"; + +static void searchRemote() +{ + StatusDelay delay(delay_message); + return; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb36.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb36.C new file mode 100644 index 0000000..07fc4c5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb36.C @@ -0,0 +1,15 @@ + #include <vector> + + template <typename T=float> class foo { + public: + foo(); + foo(vector<int> v); + private: + vector<int> v; + T t; + }; + + template <typename T=float> foo<T>::foo() :v(), t() {} + template <typename T=float> foo<T>::foo(vector<int> v_) :v(v_), t() {} + + foo<float> a; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb37.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb37.C new file mode 100644 index 0000000..be4b57d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb37.C @@ -0,0 +1,26 @@ +// Build don't link: +template<class T> +struct A { + typedef T T1; +}; + +template<class T> +struct B { + typedef T T2; +}; + +template<class T> +struct C { +}; + +template<class E> +C<typename E::T2::T1> +foo (E) +{ + return C<typename E::T2::T1>(); +} + +void test() +{ + foo(B<A<int> >()); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb38.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb38.C new file mode 100644 index 0000000..9a75405 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb38.C @@ -0,0 +1,37 @@ +// Build don't link: +class string +{ +public: + string(); + string(const string& x); + string(const char* t); + + ~string(); +}; + +void set_status(string message); + +class StatusDelay { +private: + string cause; + +public: + StatusDelay(const string& c) + : cause(c) + { + set_status(cause); + } + + ~StatusDelay() + { + set_status(cause); + } +}; + +static char delay_message[] = "Filtering files"; + +static void searchRemote() +{ + StatusDelay delay(delay_message); + return; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb39.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb39.C new file mode 100644 index 0000000..feefca7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb39.C @@ -0,0 +1,16 @@ +// Build don't link: +#include <ctype.h> +#include <iostream.h> +// #include <streambuf.h> +#include <libio.h> +#include <strstream.h> + +extern bool foo2 (ostream &out, istream &in); + +bool +foo1 (ostream &out, const char *in) +{ + strstreambuf sb (in, (int) strlen (in)); + istream fmt (&sb); + return foo2 (out, fmt); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb4.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb4.C new file mode 100644 index 0000000..152f963 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb4.C @@ -0,0 +1,48 @@ +// Error: Internal Compiler Error in GCC 2.7.2 and EGCS 1998/05/28 snapshot. + +#include <iostream.h> + +class some_base + { +public: + class base_func_args; + virtual void func(base_func_args &) = 0; + }; + +class some_base::base_func_args + { +public: + int i; + }; + +class some_derived : public some_base + { +public: + class derived_func_args; + void func(derived_func_args &); + }; + + +class derived_func_args : public some_base::base_func_args + { +public: + float f; + }; + +class some_derived::func(derived_func_args &a) + { + cout << a.i << ' ' << a.f << endl; + } + +int +main() + { + some_derived d; + some_derived::derived_func_args dfa; + some_base *b = &d; + + dfa.i = 10; + dfa.f = 20; + b->func(dfs); + return 0; + } diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb40.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb40.C new file mode 100644 index 0000000..2529fef --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb40.C @@ -0,0 +1,7 @@ +#include <complex> + +void foo() { + complex<double> x(0, 0); + complex<double> y = 1.0 + x; // OK + complex<double> z = 1 + x; // line 6: <<<< 1 doesn't match double +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb41.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb41.C new file mode 100644 index 0000000..3c97e01 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb41.C @@ -0,0 +1,13 @@ +#include <iostream.h> +#include <iterator.h> +#include <string> + +ostream_iterator<string> oo(cout); + +int main() +{ + *oo = "Hello, "; + ++oo; + *oo = "world!\n"; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb42.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb42.C new file mode 100644 index 0000000..0602d16 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb42.C @@ -0,0 +1,23 @@ +#define TEMPLATE 1 +#include <vector.h> +#include <algo.h> + +template <class T> class Expr +{ +public : +Expr(){}; +Expr(const T&){}; +}; + +#ifdef TEMPLATE +template <class T > +inline bool compare(const Expr<T> a, const Expr<T> b){ return true; }; +#else +inline bool compare(const Expr<int> a, const Expr<int> b){ return true; }; +#endif + +void main() +{ +vector<int> a(3); +sort( a.begin(), a.end(), compare ); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb43.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb43.C new file mode 100644 index 0000000..deba6cb --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb43.C @@ -0,0 +1,48 @@ +#include <vector.h> +#include <algo.h> + +template <class T> class Expr +{ +public : +Expr(){}; +Expr(const T&){}; +}; + +#ifdef TEMPLATE +template <class T > +inline bool compare(const Expr<T> a, const Expr<T> b){ return true; }; +#else +inline bool compare(const Expr<int> a, const Expr<int> b){ return true; }; +#endif + +void main() +{ + vector<int> a(3); +#if TEMPLATE == 1 + sort( a.begin(), a.end(), + static_cast<bool (*)(const Expr<int>,const Expr<int>)>(compare) ); +#elif TEMPLATE == 2 + sort( a.begin(), a.end(), compare<int> ); +#elif TEMPLATE == 3 + sort<vector<int>::iterator, + pointer_to_binary_function<const Expr<int>, const Expr<int>, bool> > + ( a.begin(), a.end(), compare ); +#elif TEMPLATE == 4 + sort( a.begin(), a.end(), + ptr_fun<const Expr<int>, const Expr<int>, bool> (compare) ); +#elif TEMPLATE == 5 + sort( a.begin(), a.end(), + ptr_fun(compare<int>) ); +#elif TEMPLATE == 6 + sort( a.begin(), a.end(), + pointer_to_binary_function<const Expr<int>, const Expr<int>, bool>(compare) ); +#elif TEMPLATE == 7 + sort( a.begin(), a.end(), + pointer_to_binary_function<const Expr<int>, const Expr<int>, bool>(compare<int>) ); +#elif TEMPLATE == 8 + sort( a.begin(), a.end(), + pointer_to_binary_function<const Expr<int>, const Expr<int>, bool>(compare<>) ); +#else + sort( a.begin(), a.end(), compare ); +#endif +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb44.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb44.C new file mode 100644 index 0000000..8a60df4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb44.C @@ -0,0 +1,24 @@ +// spurious 'const' in error. + +#include <stdio.h> +#include <iostream.h> + +template <class T> +class Vector +{ + friend ostream& operator<< (ostream& out, const Vector<T> & vec); +}; + +template <class T> +ostream& operator<< (ostream& out, const Vector<T> & vec) +{} + +template class Vector<char>; +template ostream& operator<< (ostream& out, const Vector<char> &); + +main() +{ + Vector<char> vc; + ostream out; + out << vc; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb45.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb45.C new file mode 100644 index 0000000..9e2642c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb45.C @@ -0,0 +1,6 @@ +// Build don't link: +class A {}; +class B : public virtual A {}; +template <class Imp> class C : public Imp {}; + +template class C<B>; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb46.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb46.C new file mode 100644 index 0000000..4b40322 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb46.C @@ -0,0 +1,26 @@ +#include <iostream.h> + +class A1 { + public: + virtual void foo() {friend class B;}; +}; + +class A2 : public virtual A1 {friend class B;}; + +class A3 : public virtual A1, private A2 {friend class B;}; + +class B +{ + public: + B(A1* a) : itsA(dynamic_cast<A2*>(a)) {}; + A2* itsA; +}; + +int main() +{ + A1* a=new A3; + B b(a); + + if (b.itsA) cout << "cast ok" << endl; else cout << "cast failed" << endl; + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb47.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb47.C new file mode 100644 index 0000000..d615d1c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb47.C @@ -0,0 +1,42 @@ +/* + * Test program to isolate internal compiler error. + */ + +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <iostream.h> +#include <fstream.h> +#include <ctype.h> + +#include <vector.h> + +class MESSAGE { +public: + int MessNum; + int Size; + + // constructors + MESSAGE(int MN, int Sz); + + MESSAGE(); + +}; + +// Make a message if message rule is triggered by event. +// Returns either a MESSAGE * (if successful) or NULL (if not). +MESSAGE *MakMessage(int ev, int sz); + +int main(int argc, char **argv) { + vector<MESSAGE &> Messages; + vector<MESSAGE &>::iterator itMess; + + int MN, SZ; + + MN=SZ=1; + + MESSAGE *Messg=MakMessage(MN,SZ); + if (Messg) Messages.push_back(*Messg); +} + + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb48.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb48.C new file mode 100644 index 0000000..1d10bed --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb48.C @@ -0,0 +1,10 @@ +// Build don't link: +char *t1 (const char *s) +{ + return const_cast<char *>(s); +} + +char *&t1 (const char *&s) +{ + return const_cast<char *&>(s); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb49.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb49.C new file mode 100644 index 0000000..3d39b43 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb49.C @@ -0,0 +1,48 @@ +// Build don't link: + +// Here we declare ::S +typedef struct s1 *S; + +struct s1 +{ + int s; +}; + +struct A +{ + // Here we declare A::S + typedef struct s1 *S; +}; + +template<class T, class U> class XX; + +template<class T, class U> +class X +{ +public: + static T *do_something (); + friend class T; + friend class XX<T, U>; +}; + +struct N +{ + // Here we declare N::S + class S + { + }; + + // Should use N::S and A::S. + typedef X<S, A::S> X_S; + + void bug (); +}; + +void +N::bug () +{ + // X_S is template class X<N::S, A::S> + // `s' is N::S. + S *s = X_S::do_something (); +} + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb5.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb5.C new file mode 100644 index 0000000..6609be8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb5.C @@ -0,0 +1,13 @@ +// Build don't link: +enum { a, b }; + +class Bug { + int pri:8; + int flags:24; +public: + void bug() { + flags |= a; // this does not work + } +}; + +void dummy(Bug x) { x.bug(); } diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb50.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb50.C new file mode 100644 index 0000000..c6eb4aa --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb50.C @@ -0,0 +1,16 @@ +struct foo { }; +int f(int a, int b) +{ + if (b == 0) + throw foo(); + return a / b; +} +int main() +{ + try { + f(0, 0); + return 0; + } catch (foo x) { + return 1; + } +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb51.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb51.C new file mode 100644 index 0000000..0357f92 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb51.C @@ -0,0 +1,36 @@ +// Build don't link: +typedef unsigned long Xv_opaque; + +class DynaString +{ +public: + DynaString(); + DynaString( const DynaString& dynaStr ); + DynaString( const long n ); + ~DynaString(); + + int operator ==( const char* const string ) const; +}; + +class DDE_Defaults +{ +public: + DynaString GetHost(); + DynaString GetService(); + DynaString GetDatabase(); +}; + +extern DDE_Defaults* ddeDefaults; + +void +f() +{ + DynaString tempHost, tempService, tempDatabase; + if( (tempHost = ddeDefaults->GetHost()) == 0 + || (tempService = ddeDefaults->GetService()) == 0 + || (tempDatabase = ddeDefaults->GetDatabase()) == 0 + ) + { + } +} + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb52.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb52.C new file mode 100644 index 0000000..50b4516 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb52.C @@ -0,0 +1,37 @@ +// Build don't link: +class base { +protected: + virtual void f(); +}; + +class d1 : public virtual base { +protected: + void f(); +}; + +void d1::f() +{ + base::f(); +} + +class dd1 : public virtual d1 { +protected: + void f(); +}; + +void dd1::f() +{ + d1::f(); + base::f(); +} + +class d1_and_base : public virtual d1, public virtual base { +protected: + void f(); +}; + +void d1_and_base::f() +{ + d1::f(); + base::f(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb53.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb53.C new file mode 100644 index 0000000..328fee9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb53.C @@ -0,0 +1,7 @@ +#include <list> + +main() +{ + list<int&> kill_the_compiler_now(1); +} + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb54.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb54.C new file mode 100644 index 0000000..dfcf3a9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb54.C @@ -0,0 +1,7 @@ +#include <iomanip.h> + +int main() +{ + cout << setbase(3) << endl; + exit (0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb55.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb55.C new file mode 100644 index 0000000..56b7e43 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb55.C @@ -0,0 +1,9 @@ +// Build don't link: +#include <strstream.h> + +void +t( char* buf ) +{ + istrstream str = buf; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb56.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb56.C new file mode 100644 index 0000000..3d260c3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb56.C @@ -0,0 +1,9 @@ + +// Error: Internal compiler error on 1998/05/28 snapshot. + + class foo { + typedef int sometype; + }; + + struct die : public foo::sometype { + }; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb57.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb57.C new file mode 100644 index 0000000..5f7de55 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb57.C @@ -0,0 +1,7 @@ +// Build don't link: +#include <exception> +//using namespace std; +class A { + class B : public std::exception {} + ; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb58.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb58.C new file mode 100644 index 0000000..05b2f72 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb58.C @@ -0,0 +1,11 @@ +class A { +public: + A(int i) {} +private: + A( const A & ) {} +}; + +main() +{ + A *list = new A[10](4); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb59.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb59.C new file mode 100644 index 0000000..4bc50b1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb59.C @@ -0,0 +1,28 @@ +#define INC_FUNCTIONAL 1 +#define USE_STATIC_CAST 1 + +#include <vector> +#include <numeric> +#ifdef INC_FUNCTIONAL +#include <functional> +#endif + +template<class R> int p( int val, R& r ) +{ + return val + r; +} + +template<class R> void f( vector<R>& v ) +{ +#ifdef USE_STATIC_CAST + accumulate( v.begin(), v.end(), 0, static_cast<int (*)(int, R&)>(p) ); +#else + accumulate( v.begin(), v.end(), 0, p<R> ); +#endif +} + +main() +{ + vector<int> r; + f( r ); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb6.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb6.C new file mode 100644 index 0000000..157bf47 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb6.C @@ -0,0 +1,14 @@ +// Build don't link: +class A { +public: + A() { t=0; } + double t; +}; +template <class T> +class B { +public: + void f1() { new T; f2(); } + void f2() { new T; } +}; +template class B<A>; + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb60.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb60.C new file mode 100644 index 0000000..e036d90 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb60.C @@ -0,0 +1,17 @@ +#include <string> + +class t { +public: + t(const string& s) : s_(s) {} + string s_; + static t* t_; +}; + +t* t::t_; + +t* makeT() +{ + return new t("test"); + return t::t_ ? t::t_ : + t::t_ = new t("test"); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb61.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb61.C new file mode 100644 index 0000000..370273a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb61.C @@ -0,0 +1,8 @@ +// Build don't link: +void +action0(float& arg1) +{ + long cn0 = 1; + + arg1 = cn0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb62.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb62.C new file mode 100644 index 0000000..3c1008c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb62.C @@ -0,0 +1,6 @@ +#include <vector> + +void f(void) +{ + vector<int> l(5, 0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb63.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb63.C new file mode 100644 index 0000000..79b153e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb63.C @@ -0,0 +1,13 @@ +#include <stdio.h> + +class A { +public: + A(bool b) { abort(); } + A(int a, bool b) { printf("cool\n"); } +}; + +main() { + A* a; + a = new A[2] = { A(1,false), A(1,false) } ; + a = new A[2](1,false); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb64.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb64.C new file mode 100644 index 0000000..da043af --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb64.C @@ -0,0 +1,25 @@ +// Build don't link: +template <class A> +class B:public A { + B(){} +}; + +template <class A> +class C:public B<A> { + C(){} +}; + +/* +g++ bugsol.C +bugsol.C:9: Internal compiler error. +bugsol.C:9: Please submit a full bug report to `egcs-bugs@cygnus.com'. + +g++ -v +Reading specs from +/home/pierre/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.16/specs +gcc version egcs-2.90.16 971105 (gcc2-970802 experimental) + +egcc compiled with gcc version 2.7.2.1 on debian 1.3.1 + +*/ + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb65.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb65.C new file mode 100644 index 0000000..94be7ec --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb65.C @@ -0,0 +1,22 @@ +#include <iterator> + +template<size_t n, size_t i> struct PartialDotProduct { + template<class T> + static T Expand(T* a, T* b) { return T(); } +}; + +const int N = 10; + +template<class In1, class In2> +typename iterator_traits<In1>::value_type +dot(In1 f1, In2 f2) +{ + return PartialDotProduct<N, 0>::Expand(f1, f2); // line 14 +} + +int main() +{ + double a[N], b[N]; + + double s = dot(&a[0], &b[0]); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb66.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb66.C new file mode 100644 index 0000000..e9a303a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb66.C @@ -0,0 +1,22 @@ +#include <assert.h> +#include <iostream.h> + +int bar () +{ + throw 100; +} + +main () +{ + int i = 0; + try + { + i = bar (); + } + catch (...) + { + } + +// cout << "i = " << i << endl; + assert (i == 0) ; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb67.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb67.C new file mode 100644 index 0000000..f73ece9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb67.C @@ -0,0 +1,15 @@ +// Build don't link: +/* +The 971114 "gcc/cp/parse.y" doesn't properly identify non-aggregate +types used as base classes. + +First, the rule: + + base_class: base_class_access_list see_typename base_class.1 + +uses "IS_AGGR_TYPE" instead of "is_aggr_type" to check "base_class.1", +so no error is reported for code like: + +*/ + typedef int an_int; + class bar : public an_int {}; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb68.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb68.C new file mode 100644 index 0000000..ebbc33b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb68.C @@ -0,0 +1,7 @@ + +// Error: Internal Compiler Error. + + class foo { + typedef int an_int; + }; + class bar : foo::an_int {}; // causes internal compiler error diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb69.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb69.C new file mode 100644 index 0000000..bd413dd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb69.C @@ -0,0 +1,9 @@ + #include <iostream.h> + struct foo { + foo(int x) { cerr << "foo's int constructor (" << x << ")\n"; }; + }; + struct bar : foo { + typedef int an_int; + bar() : bar::an_int(3) {}; // will call foo::foo(3) + }; + main() { bar b; } diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb7.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb7.C new file mode 100644 index 0000000..fc43aab --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb7.C @@ -0,0 +1,16 @@ +// Build don't link: +#include <vector> + +class T +{ + public: + T(); + +}; + +vector <T> tp; + +void f() +{ + tp.insert(tp.begin(), 10 , T()); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb70.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb70.C new file mode 100644 index 0000000..346eda2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb70.C @@ -0,0 +1,17 @@ +// Build don't link: + +class X { +public: + inline operator bool() const { return true; } +}; + +class Y : public X { +private: + inline operator void*() const { return 0; } +}; + + +void f(Y const& y) { + if( bool(y) ) { + } +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb71.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb71.C new file mode 100644 index 0000000..5e4dacb --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb71.C @@ -0,0 +1,37 @@ +// Build don't link: +typedef unsigned int size_t; + +class A { + +public: + void operator delete(void*, size_t); + void* operator new(size_t); +}; + +class B : public A { +friend class D; + + B(); + unsigned counter; +}; + +class D { + + int ins( B*&); +}; + +int +D::ins( B*& tempN) +{ + unsigned i; + + if (i == 10) { + } + else { + } + + tempN = new B(); + tempN->counter = 20; + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb72.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb72.C new file mode 100644 index 0000000..fbdf507 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb72.C @@ -0,0 +1,16 @@ +#include <vector> + +template <class T> +class TPROGRAM + { + typedef vector< T > ITEMS; + + class const_iterator + { + /*typename*/ ITEMS::const_iterator i; + + const_iterator(const /*typename*/ ITEMS::const_iterator i2) { + i=i2; + } + }; + }; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb73.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb73.C new file mode 100644 index 0000000..b5aae39 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb73.C @@ -0,0 +1,14 @@ +// Special g++ Options: -O -Wall +// Depeletes VM. + +#include <iostream.h> +#include <list> +#include <algorithm> +using namespace std; + +int main() +{ + int daten [16] = { 1, 4, 4, 6, 1, 2, 2, 3, 6, 6, 6, 5, 7, 5, 4, 4}; + list<int> menge; + copy (daten, daten+16, back_inserter(menge)); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb74.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb74.C new file mode 100644 index 0000000..1ec7da6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb74.C @@ -0,0 +1,33 @@ +// Build don't link: +class base { +public: + virtual ~base(); +}; + + +class foo : public base { + +public : + + foo (char *cs); + + virtual void op (unsigned char dummy = false); + unsigned char m_dummy; +}; + + +void foo :: op ( unsigned char dummy) + +{ + bool bar; + + if (dummy) { + foo IT_tempPhase( 0 ); + return; + } + + if ((m_dummy || bar)) { + + } + +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb75.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb75.C new file mode 100644 index 0000000..41ad816 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb75.C @@ -0,0 +1,19 @@ +// Build don't link: +int*& foo (int const *& x) +{ + return const_cast<int*&> (x); +} + +/* +If the references in this example are changed to pointers (change +all `&''s to `*'), no warnings result. + +I think this is incorrect according to CD2 5.2.11, para 4: + +4 An lvalue of type T1 can be explicitly converted to an lvalue of type + T2 using the cast const_cast<T2&> (where T1 and T2 are object types) + if a pointer to T1 can be explicitly converted to the type pointer to + T2 using a const_cast. The result of a reference const_cast refers to + the original object. + +*/ diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb76.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb76.C new file mode 100644 index 0000000..c32b104 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb76.C @@ -0,0 +1,19 @@ +// from include/g++/stl_relops.h +template <class T> +inline bool operator!=(const T& x, const T& y) { + return !(x == y); +} + +enum T { + V1, +}; + +struct X { + T t : 31; +}; + +void +f(X& v) { + if( v.t != V1 ) { + } +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb77.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb77.C new file mode 100644 index 0000000..206b27d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb77.C @@ -0,0 +1,30 @@ +#include <stream.h> +#include <strstream.h> + +int +main(int, char* []) +{ + strstream s; + + s << "line 1\nline 2\n\nline 4"; + s << ends; + + int nLine = 0; + + while( true ) { + char* line = 0; + s.gets(&line); + + if( ! line ) { + break; + } + + ++nLine; + cout << nLine << ": " << line << endl; + + if( nLine > 10 ) { // stop infinite loop + break; + } + } + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb78.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb78.C new file mode 100644 index 0000000..3221d86 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb78.C @@ -0,0 +1,135 @@ +// Special g++ Options: -W -Wall -O + +//This is the source code from FAQ-259, found in chapter 20 of "C++ FAQs." +//Copyright (C) 1994, Addison-Wesley Publishers, Inc.; All rights reserved. +// +//The book, "C++ FAQs" is by Marshall P. Cline and Greg A. Lomow, +//Copyright (C) 1994, Addison-Wesley Publishers, Inc.; All rights reserved. +// +//This code is presented for its instructional value. It has been tested with +//care, but it is not guaranteed for any particular purpose. Neither the +//publisher nor the authors offer any warranties or representations, nor do +//they accept any liabilities with respect to this code. + +#include <string.h> +#include <iostream.h> + +class BadIndex { }; + +class String { +public: + + String() + : len_(0), data_(new char[1]) + { data_[0] = '\0'; } + + String(const char* s) + : len_(strlen(s)), data_(new char[len_ + 1]) + { memcpy(data_, s, len_ + 1); } + + ~String() + { delete [] data_; } + + String(const String& s) + : len_(s.len_), data_(new char[s.len_ + 1]) + { memcpy(data_, s.data_, len_ + 1); } + + String& operator= (const String& s) + { + if (len_ != s.len_) { //makes self-assignment harmless + char* newData = new char[s.len_ + 1]; + delete [] data_; + data_ = newData; + len_ = s.len_; + } + memcpy(data_, s.data_, len_ + 1); + return *this; + } + + unsigned len() const + { return len_; } + + char& operator[] (unsigned i) + { indexTest(i); return data_[i]; } + char operator[] (unsigned i) const + { indexTest(i); return data_[i]; } + + friend ostream& operator<< (ostream& o, const String& s) + { return o.write(s.data_, s.len_); } + + friend int operator== (const String& a, const String& b) + { return a.len_ == b.len_ && + memcmp(a.data_, b.data_, a.len_) == 0; } + friend int operator!= (const String& a, const String& b) + { return ! (a == b); } + +private: + void indexTest(unsigned i) const + { if (i >= len_) throw BadIndex(); } + unsigned len_; //ORDER DEPENDENCY; see FAQ-190 + char* data_; //ORDER DEPENDENCY; see FAQ-190 +}; + +class AccessViolation { }; +class BadFileName { }; + +class File { +public: + File(const String& filename) + throw(AccessViolation, BadFileName) + { + cout << "Open " << filename << "\n"; + if (filename == "badAccess.txt") + throw AccessViolation(); + if (filename == "badName.txt") + throw BadFileName(); + } +}; + +class UserClass { +public: + void f(const String& filename) throw(BadFileName); +}; + +void +UserClass::f(const String& filename) throw(BadFileName) +{ + try { + File f(filename); + } + catch (const AccessViolation& e) { + cout << " FULLY recover from access-violation\n"; + } + catch (const BadFileName& e) { + cout << " PARTIALLY recover from bad-file-name\n"; + throw; + } +} + +void +tryIt(const String& filename) +{ + try { + UserClass u; + u.f(filename); + cout << " OK\n"; + } + catch (const BadFileName& e) { + cout << " Finish recovering from bad-file-name\n"; + } +} + +main() +{ + tryIt("goodFile.txt"); + tryIt("badAccess.txt"); + tryIt("badName.txt"); +} + +// g++ -O -o warn warn.C -W -Wall +// warn.C: In method `void UserClass::f(const class String &)': +// warn.C:96: warning: unused variable `class File f' +// warn.C:101: warning: `struct cp_eh_info * __exception_info' might +// be used uninitialized in this function + + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb79.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb79.C new file mode 100644 index 0000000..599d042 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb79.C @@ -0,0 +1,23 @@ +// Makes bogus x86 assembly code. +#include <iostream.h> + +template<class T> +T max(T a, T b) +{ + return (a > b) ? a : b; +} + +// Prototypes (enable one or the other) +double max<>(double, double); +// int max(int, int); + +int main() +{ + int i = 123; + double d = 1234.5678; + + cout.precision(12); + cout << max(d, i) << endl; // #1 + cout << max(i, d) << endl; // #2 + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb8.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb8.C new file mode 100644 index 0000000..c7619b3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb8.C @@ -0,0 +1,13 @@ + +class foo { +public: + operator <<(const void *); + operator <<(char *); +}; + +void main() +{ + foo f; + f << (void*)0; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb80.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb80.C new file mode 100644 index 0000000..7161423 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb80.C @@ -0,0 +1,7 @@ +// Build don't link: +#include <exception> + +class A { + class B : public std::exception {} + ; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb81.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb81.C new file mode 100644 index 0000000..919fd58 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb81.C @@ -0,0 +1,42 @@ +// Build don't link: +class x +{ +public: + x (int init_buffer_size=0); + ~x (); +}; + + + +class xSequence +{ +public: + xSequence (); + ~xSequence (); + x Get(int index)const; +}; + + + +class foo +{ +public: + bool bar(const x & name, x & value); + +}; + + + +bool foo::bar(const x & name, x & value) +{ + bool result = false; + + xSequence seq; + x v1, v2; + if(result ? bar(seq.Get(1),v2) : bar(seq.Get(2),v2)) + + ; + + return result; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb82.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb82.C new file mode 100644 index 0000000..3c85dc3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb82.C @@ -0,0 +1,12 @@ +#include <stdio.h> + +template <int n1> +double val <int> () +{ + return (double) n1; +}; + +int main () +{ + printf ("%d\n", val<(int)3> ()); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb83.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb83.C new file mode 100644 index 0000000..b16c834 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb83.C @@ -0,0 +1,15 @@ +// Special g++ Options: -fprofile-arcs -ftest-coverage +void +swap(int& x, int& y) throw() +{ + int tmp = x; + x = y; + y = tmp; +} + +main() +{ + int i = 5; + int j = 7; + swap(i, j); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb84.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb84.C new file mode 100644 index 0000000..dce51d8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb84.C @@ -0,0 +1,17 @@ +// Error: Internal Compiler error on GCC 2.7.2.3 & EGCS 1998/05/23 snapshot. + +class A { +public: + enum { ONE, TWO, THREE }; +}; + +template <const unsigned c1,const unsigned c2,const unsigned c3> +void f() { + +} + +int +main() +{ + f<A::ONE,A::TWO,A::THREE>(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb85.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb85.C new file mode 100644 index 0000000..3e55fb7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb85.C @@ -0,0 +1,12 @@ +// This SHOULDn't compile, becuase 'foo' is never a valid asm. + +template <const unsigned c> +void f() { + asm("foo"); +} + +int +main() +{ + f<1>(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb86.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb86.C new file mode 100644 index 0000000..463d2d1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb86.C @@ -0,0 +1,5 @@ +// Build don't link: +template <class T> +class Q { + friend void foo<T> (); +}; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb87.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb87.C new file mode 100644 index 0000000..5147e8c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb87.C @@ -0,0 +1,6 @@ +template <unsigned X, class T> struct Foo { + friend void operator<<(int, Foo const &) {} +}; +template <unsigned X> class Bar : public Foo<X,int> {}; +inline Bar<0> bar(int,int,int) { return Bar<3>(); } + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb88.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb88.C new file mode 100644 index 0000000..ba2a081 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb88.C @@ -0,0 +1,7 @@ +#include <stddef.h> +int main() +{ + throw(NULL); +} +// The code works as expected, when NULL is cast to void* explicitly [ +// throw((void*)NULL); ]. diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb89.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb89.C new file mode 100644 index 0000000..71995bf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb89.C @@ -0,0 +1,10 @@ +#include <vector> + +int +main() +{ + int i; + vector<int&> v; + v.push_back(i); + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb9.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb9.C new file mode 100644 index 0000000..cec7002 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb9.C @@ -0,0 +1,21 @@ +// Build don't link: +template <class Key> +class d0om_Hashmap +{ +public: + typedef int value_type; + + class iterator + { + public: + value_type* operator-> () const; + }; + +}; + + +template <class Key> +d0om_Hashmap<Key>::value_type* d0om_Hashmap<Key>::iterator::operator-> () const +{ + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb90.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb90.C new file mode 100644 index 0000000..2a43645 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb90.C @@ -0,0 +1,22 @@ +// Special g++ Options: -O2 +// Build don't link: + +#ifdef HIDE_BUG +#define realloc Realloc +#endif + +class TmpRgn { +public: + void + realloc(); +}; + +class TmpActor { + TmpRgn tmpRgn; + +public: + void + realloc() { + tmpRgn.realloc(); + } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb91.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb91.C new file mode 100644 index 0000000..c2abeb1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb91.C @@ -0,0 +1,83 @@ +#include <sys/types.h> +#include <algorithm> +typedef short int16_t; +typedef unsigned short u_int16_t; + +template <class INT> +class other_endian +{ +private: + + INT value; + + + u_int16_t change_endian(u_int16_t x) + { + union { + u_int16_t i; + u_int8_t c[2]; + } val; + val.i = x; + swap(val.c[0], val.c[1]); + return val.i; + }; + + int16_t change_endian(int16_t x) + { + union { + int16_t i; + int8_t c[2]; + } val; + val.i = x; + swap(val.c[0], val.c[1]); + return val.i; + }; +public: + other_endian(const INT i = 0) + { + value = change_endian(i); + } + + operator INT() + { + return change_endian(value); + } +}; + +template <class INT> +class same_endian +{ + INT value; + +public: + same_endian(const INT i = 0) + { + value = i; + } + + operator INT() + { + return value; + } +}; + + + + + + + + + + + + + + + + + +int main() { + other_endian <u_int16_t> little_endian_16_bit_int; + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb92.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb92.C new file mode 100644 index 0000000..c08ec42 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb92.C @@ -0,0 +1 @@ +template<int N> f<0>(){} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb93.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb93.C new file mode 100644 index 0000000..e05177b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb93.C @@ -0,0 +1,30 @@ +// Error: Internal compiler error on egcs 1998/05/28 snapshot. + +const double M_PI=3.14159265358979323846; + +template<int N,int I,int J,int K> +inline double SineSeries() +{ + const double x=I*2*M_PI/N; + const bool go=K+1!=J; + return 1.0-x*x/(2*K+2)/(2*K+3)*SineSeries<N*go,I*go,J*go,(K+1)*go>(); +} + +template<> +inline double SineSeries<0,0,0,0>() +{ + return 1.0; +} + +template<int N,int I> +inline double Sine() +{ + const double x=(I*2*M_PI/N); + return x * SineSeries<N,I,10,0>(); +} + +int main() +{ + double f=Sine<32,5>() + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb94.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb94.C new file mode 100644 index 0000000..a40eafb --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb94.C @@ -0,0 +1,15 @@ + + +class baseClass +{ +private: +static int variable; +}; + +class myClass : public baseClass +{ +private: +static int variable; // this is intentionally duplicated +}; + +myClass::variable = 0; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb95.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb95.C new file mode 100644 index 0000000..0d8e405 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb95.C @@ -0,0 +1,17 @@ +struct A {}; + +template <class T> +void operator+ (A &i, T &b) {} + +template<class T> +void func (A &a, T &b) {} + +int main() +{ + A a; + +#if STRANGE + func(a, "egcs"); +#endif + a+"egcs"; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb96.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb96.C new file mode 100644 index 0000000..840b2d8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb96.C @@ -0,0 +1,14 @@ +class foo +{ + public: + static int f(); + + class bar { + friend int foo::f(); + }; +}; + +int main() +{ + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb97.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb97.C new file mode 100644 index 0000000..e05cc41 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb97.C @@ -0,0 +1,24 @@ +// Creates bad assembly on sparc and x86 +template<unsigned long SIZE> +struct Array { }; + +template<unsigned long SIZE> +Array<SIZE> test_ok(const Array<SIZE>& a) { + Array<SIZE> result; + return(result); +} + +template<unsigned long SIZE> +Array<SIZE + 1> test_error(const Array<SIZE>& a) { + Array<SIZE + 1> result; + return(result); +} + +int main(int argc, char* argv[]) { + Array<2> a; + + test_ok(a); + test_error(a); // <<< MARKED LINE! + + return(0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb98.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb98.C new file mode 100644 index 0000000..2e86824 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb98.C @@ -0,0 +1,17 @@ +// Error: Internal compiler error in egcs 1998/05/28 snapshot. + + + template<class T, unsigned int Length> + inline + unsigned int + extent(T (&x)[Length]) + { + return Length; + } + + extern int b[]; + + void f() + { + extent(b); + } diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb99.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb99.C new file mode 100644 index 0000000..a5f8624 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb99.C @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + +class ref_counted +{ + +protected: + ref_counted( void ) : _count( 0 ) {} + +public: + + unsigned int add_ref( void ) { return ++_count; } + unsigned int release( void ) { return --_count; } + unsigned int count( void ) const { return _count; } + + +protected: + unsigned int _count; +}; + + + + + +template < class T > +class ref_ptr +{ + +public: + ref_ptr( T* ptr = 0 ) : _ptr( ptr ) + { + add_ref(); + } + + ref_ptr( const ref_ptr & rptr ) : _ptr( rptr.get() ) + { + add_ref(); + } + + ~ref_ptr( void ) { release(); } + + + T* get( void ) const { return _ptr; } + T* operator->( void ) const { return get(); } + T& operator*( void ) const { return *get(); } + + bool operator!( void ) const { return get() == 0; } + bool operator==( const ref_ptr & rptr ) const { return *get() == *rptr; +} + bool operator<( const ref_ptr & rptr ) const { return *get() < *rptr; } + + + bool operator==( T* ptr ) const { return *get() == *ptr; } + bool operator<( T* ptr ) const { return *get() < *ptr; } + + const ref_ptr & operator=( const ref_ptr & rptr ) + { + release(); + _ptr = rptr.get(); + add_ref(); + + return *this; + } + + T* operator=( T* ptr ) + { + release(); + _ptr = ptr; + add_ref(); + + return _ptr; + } + +protected: + void add_ref( void ) + { + if( _ptr ) + _ptr->add_ref(); + } + + void release( void ) + { + if( _ptr && 0 == _ptr->release() ) + { + delete _ptr; + _ptr = 0; + } + } + + +protected: + T * _ptr; +}; + + +template< class T > +bool operator==( T* ptr, const ref_ptr< T > & rptr ) +{ + return *ptr == *rptr; +} + +template< class T > +bool operator<( T* ptr, const ref_ptr< T > & rptr ) +{ + return *ptr < *rptr; +} + + + +class Baz : public ref_counted { + int dummy; +}; + + +class Bar; + +void main() { + ref_ptr<Baz> foo; + static_cast<Bar *> (foo)->DoSomething; +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/float1.C b/gcc/testsuite/g++.old-deja/g++.robertl/float1.C new file mode 100644 index 0000000..4bd49bf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/float1.C @@ -0,0 +1,30 @@ +// test fails on egcs 1.0.1 on x86. +#include <cstdlib> + +void f(double j, double& v) +{ + size_t sz = size_t(2*j+1); + double norm_ = j*(j+1); + double m = j; + int sign_ = -1; + for (size_t c=1;c<=sz;++c) + for (size_t r=1;r<=sz;++r) + if (r+sign_*1 == c) + { + double val = (norm_-m*(m+sign_)); + for (size_t k=1;k<2;++k) + val *= (norm_ - (m+sign_*k)*(m+sign_*(k+1))); + v = val; + } +} + +int main() +{ + double v; + f(1,v); + if (v != 4) abort(); + + return 0; +} + + diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/rtti5.C b/gcc/testsuite/g++.old-deja/g++.robertl/rtti5.C new file mode 100644 index 0000000..155dc0b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.robertl/rtti5.C @@ -0,0 +1,37 @@ +class S0 +{ +public: + + S0() { }; + + virtual ~S0() { } +}; + + + +struct S { }; +class S1 : public S, public S0 +{ +public: + + S1() { } +}; + + +void test_ptr(void *ctxt) +{ + S0 *ctxt1 = static_cast<S0*>(ctxt); + + S1* ctxt2 = dynamic_cast<S1*>(ctxt1); +} + + + +int main() +{ + S1 *ctxt = new S1(); + + test_ptr(ctxt); + + return 0; +} |