From: Richard Kreckel Date: Wed, 18 Apr 2001 19:30:21 +0000 (+0000) Subject: * color.cpp: remove duplicated default args. X-Git-Tag: release_0-8-2~13 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=bfb395b4e24e659fc46abc2d2ad4305168d1c6f2 * color.cpp: remove duplicated default args. * numeric.cpp: insert some missing cln:: namespace decls. Why did this ever work? * structure.cpp, structure.h: adjust to the new print scheme. --- diff --git a/ginac/color.cpp b/ginac/color.cpp index c31a83c9..4e7d6dd3 100644 --- a/ginac/color.cpp +++ b/ginac/color.cpp @@ -71,7 +71,7 @@ DEFAULT_CTORS(su3d) /** Construct object without any color index. This constructor is for * internal use only. Use the color_ONE() function instead. * @see color_ONE */ -color::color(const ex & b, unsigned rl = 0) : inherited(b), representation_label(rl) +color::color(const ex & b, unsigned rl) : inherited(b), representation_label(rl) { debugmsg("color constructor from ex,unsigned", LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_color; @@ -80,7 +80,7 @@ color::color(const ex & b, unsigned rl = 0) : inherited(b), representation_label /** Construct object with one color index. This constructor is for internal * use only. Use the color_T() function instead. * @see color_T */ -color::color(const ex & b, const ex & i1, unsigned rl = 0) : inherited(b, i1), representation_label(rl) +color::color(const ex & b, const ex & i1, unsigned rl) : inherited(b, i1), representation_label(rl) { debugmsg("color constructor from ex,ex,unsigned", LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_color; diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index 3af060d0..ef4e3e92 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -938,13 +938,13 @@ bool numeric::is_real(void) const bool numeric::operator==(const numeric &other) const { - return equal(cln::the(value), cln::the(other.value)); + return cln::equal(cln::the(value), cln::the(other.value)); } bool numeric::operator!=(const numeric &other) const { - return !equal(cln::the(value), cln::the(other.value)); + return !cln::equal(cln::the(value), cln::the(other.value)); } @@ -1114,7 +1114,7 @@ const numeric numeric::denom(void) const if (this->is_integer()) return _num1(); - if (instanceof(value, cln::cl_RA_ring)) + if (cln::instanceof(value, cln::cl_RA_ring)) return numeric(cln::denominator(cln::the(value))); if (!this->is_real()) { // complex case, handle Q(i): @@ -1750,8 +1750,8 @@ const numeric irem(const numeric &a, const numeric &b, numeric &q) const numeric iquo(const numeric &a, const numeric &b) { if (a.is_integer() && b.is_integer()) - return truncate1(cln::the(a.to_cl_N()), - cln::the(b.to_cl_N())); + return cln::truncate1(cln::the(a.to_cl_N()), + cln::the(b.to_cl_N())); else return _num0(); } diff --git a/ginac/structure.cpp b/ginac/structure.cpp index c084096c..54dc1dfc 100644 --- a/ginac/structure.cpp +++ b/ginac/structure.cpp @@ -26,6 +26,7 @@ #include "archive.h" #include "debugmsg.h" #include "utils.h" +#include "print.h" namespace GiNaC { @@ -47,33 +48,18 @@ DEFAULT_ARCHIVING(structure) // functions overriding virtual functions from bases classes ////////// -void structure::printraw(std::ostream & os) const -{ - debugmsg("structure printraw",LOGLEVEL_PRINT); - - os << class_name() << "(hash=" << hashvalue << ",flags=" << flags << ")"; -} - -void structure::print(std::ostream & os, unsigned upper_precedence) const +void structure::print(const print_context & c, unsigned level) const { debugmsg("structure print",LOGLEVEL_PRINT); - os << class_name() << "()"; -} - -void structure::printtree(std::ostream & os, unsigned indent) const -{ - debugmsg("structure printtree",LOGLEVEL_PRINT); + if (is_of_type(c, print_tree)) { - os << std::string(indent,' ') << class_name() << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec - << std::endl; -} - -void structure::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const -{ - debugmsg("structure print csrc",LOGLEVEL_PRINT); + c.s << std::string(level, ' ') << class_name() + << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec + << std::endl; - os << "structure()"; + } else + c.s << class_name() << "()"; } // protected diff --git a/ginac/structure.h b/ginac/structure.h index 9ad049fd..62848b22 100644 --- a/ginac/structure.h +++ b/ginac/structure.h @@ -43,10 +43,7 @@ class structure : public basic // functions overriding virtual functions from bases classes public: - void printraw(std::ostream & os) const; - void print(std::ostream & os, unsigned upper_precedence=0) const; - void printtree(std::ostream & os, unsigned indent) const; - void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const; + void print(const print_context & c, unsigned level=0) const; protected: bool is_equal_same_type(const basic & other) const;