From: Richard Kreckel Date: Fri, 26 Oct 2001 17:19:24 +0000 (+0000) Subject: * Remove support for . It is too bug-ridden. X-Git-Tag: release_1-0-0~25 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=commitdiff_plain;h=0c8c12f5393a7ca5f78233af5ee81593184c35fb;p=ginac.git * Remove support for . It is too bug-ridden. --- diff --git a/INSTALL b/INSTALL index ee1eb2b0..721d6a25 100644 --- a/INSTALL +++ b/INSTALL @@ -80,13 +80,18 @@ libreadline and maybe libreadline-dev. If your system's vendor doesn't supply such packages, go to and compile it yourself. -Problems with missing -------------------------------- - -GCC-2.95.2 and earlier don't have support for this header. GiNaC can use - instead, but this may cause some trouble later. GCC-3.0 has a -completely new implementation of the STL-headers (libstdc++-v3) and there, -standard-conforming support for is present. If you can't upgrade -your compiler we recommend using the libstdc++-v2 header by -Magnus Fromreide. It was posted to the gcc-patches mailing list on -November 21 2000: . +Problems with missing standard header files +------------------------------------------- + +Building GiNaC requires many standard header files. If you get a +configure error complaining about such missing files your compiler and +library are probably not up to date enough and it's no worth +continuing. If the only file missing is , however, there is +a solution. GCC-2.95.2 and earlier don't ship with this file. A +working implementation has been available since GCC-2.95.3. GCC-3.0 +and later have an even better, fully standard-conforming +implementation, by default. If you are stuck with GCC-2.95.2 or +earliear and you cannot upgrade your compiler we recommend obtaining +the libstdc++-v2 header written by Magnus Fromreide. It was +posted to the gcc-patches mailing list on November 21 2000: +. diff --git a/check/check_lsolve.cpp b/check/check_lsolve.cpp index 59264d9d..a964c4b3 100644 --- a/check/check_lsolve.cpp +++ b/check/check_lsolve.cpp @@ -22,12 +22,7 @@ */ #include "checks.h" - -#if defined(HAVE_SSTREAM) -# include -#else -# include -#endif +#include static unsigned check_matrix_solve(unsigned m, unsigned n, unsigned p, unsigned degree) @@ -55,15 +50,9 @@ static unsigned check_matrix_solve(unsigned m, unsigned n, unsigned p, matrix X(n,p); for (unsigned i=0; i a; vector x; for (unsigned i=0; i a; ex e; for (unsigned i=0; i #include -#include "config.h" -#if defined(HAVE_SSTREAM) -# include -#else -# include -#endif +#include #include -using namespace std; - +#include "config.h" #include "ginac.h" +using namespace std; using namespace GiNaC; class timer { diff --git a/configure.in b/configure.in index aa0d315b..26627588 100644 --- a/configure.in +++ b/configure.in @@ -103,23 +103,17 @@ GINSH_LIBS=$LIBS LIBS=$save_LIBS AC_SUBST(GINSH_LIBS) -dnl Make sure all the necessary new-style headers are installed on the system. -dnl If one of them cannot be found the system is probably not ANSI-conform -dnl enough so trying the .h-style headers is a waste of time. -AC_CHECK_HEADERS(iostream vector map string list typeinfo iterator stdexcept algorithm, , - AC_MSG_ERROR([need to have ANSI compliant headers])) -dnl We need the sstream header. But since g++-2.95.n, n<3 does not provide -dnl it, we must fall back to strstream, which, however, suffers from fixed -dnl buffer sizes. So the fallback may produce a crippled library. NB: this -dnl fallback will disappear in future versions. -AC_CHECK_HEADERS(sstream strstream) -if test "x${ac_cv_header_sstream}" = "xno"; then - if test "x${ac_cv_header_strstream}" = "xno"; then - AC_MSG_ERROR([I could not find the or header.]) - else - GINAC_WARNING([I could not find . may cause trouble.]) - fi -fi +dnl Make sure all the necessary standard headers are installed on the system. +AC_CHECK_HEADER(iosfwd, , GINAC_ERROR([The standard header file could not be found.])) +AC_CHECK_HEADER(iostream, , GINAC_ERROR([The standard header file could not be found.])) +AC_CHECK_HEADER(vector, , GINAC_ERROR([The standard header file could not be found.])) +AC_CHECK_HEADER(list, , GINAC_ERROR([The standard header file could not be found.])) +AC_CHECK_HEADER(map, , GINAC_ERROR([The standard header file could not be found.])) +AC_CHECK_HEADER(string, , GINAC_ERROR([The standard header file could not be found.])) +AC_CHECK_HEADER(sstream, , GINAC_ERROR([The standard header file could not be found.])) +AC_CHECK_HEADER(typeinfo, , GINAC_ERROR([The standard header file could not be found.])) +AC_CHECK_HEADER(stdexcept, , GINAC_ERROR([The standard header file could not be found.])) +AC_CHECK_HEADER(algorithm, , GINAC_ERROR([The standard header file could not be found.])) dnl We need to have Bruno Haible's CLN installed. dnl (CLN versions >= 1.1.0 must have installed cln.m4 at a visible place, diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index b1a4033c..72668220 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -29,20 +29,14 @@ #include #include #include - -#if defined(HAVE_SSTREAM) #include -#elif defined(HAVE_STRSTREAM) -#include -#else -#error Need either sstream or strstream -#endif #include "numeric.h" #include "ex.h" #include "print.h" #include "archive.h" #include "debugmsg.h" +#include "tostring.h" #include "utils.h" // CLN should pollute the global namespace as little as possible. Hence, we @@ -219,15 +213,7 @@ numeric::numeric(const char *s) : basic(TINFO_numeric) // E to lower case term = term.replace(term.find("E"),1,"e"); // append _ to term -#if defined(HAVE_SSTREAM) - std::ostringstream buf; - buf << unsigned(Digits) << std::ends; - term += "_" + buf.str(); -#else - char buf[14]; - std::ostrstream(buf,sizeof(buf)) << unsigned(Digits) << std::ends; - term += "_" + std::string(buf); -#endif + term += "_" + ToString((unsigned)Digits); // construct float using cln::cl_F(const char *) ctor. if (imaginary) ctorval = ctorval + cln::complex(cln::cl_I(0),cln::cl_F(term.c_str())); @@ -267,11 +253,7 @@ numeric::numeric(const archive_node &n, const lst &sym_lst) : inherited(n, sym_l // Read number as string std::string str; if (n.find_string("number", str)) { -#ifdef HAVE_SSTREAM std::istringstream s(str); -#else - std::istrstream s(str.c_str(), str.size() + 1); -#endif cln::cl_idecoded_float re, im; char c; s.get(c); @@ -301,12 +283,7 @@ void numeric::archive(archive_node &n) const inherited::archive(n); // Write number as string -#ifdef HAVE_SSTREAM std::ostringstream s; -#else - char buf[1024]; - std::ostrstream s(buf, 1024); -#endif if (this->is_crational()) s << cln::the(value); else { @@ -324,13 +301,7 @@ void numeric::archive(archive_node &n) const s << im.sign << " " << im.mantissa << " " << im.exponent; } } -#ifdef HAVE_SSTREAM n.add_string("number", s.str()); -#else - s << ends; - std::string str(buf); - n.add_string("number", str); -#endif } DEFAULT_UNARCHIVE(numeric) diff --git a/ginac/tostring.h b/ginac/tostring.h index c82813bf..1a403eba 100644 --- a/ginac/tostring.h +++ b/ginac/tostring.h @@ -24,31 +24,16 @@ #ifndef __GINAC_TOSTRING_H__ #define __GINAC_TOSTRING_H__ -#include "config.h" - -#if defined(HAVE_SSTREAM) #include -#elif defined(HAVE_STRSTREAM) -#include -#else -#error Need either sstream or strstream -#endif namespace GiNaC { -// This should be obsoleted once is widely deployed. template std::string ToString(const T & t) { -#if defined(HAVE_SSTREAM) std::ostringstream buf; buf << t << std::ends; return buf.str(); -#else - char buf[256]; - std::ostrstream(buf,sizeof(buf)) << t << std::ends; - return buf; -#endif } } // namespace GiNaC