* numeric.cpp: insert some missing cln:: namespace decls.
Why did this ever work?
* structure.cpp, structure.h: adjust to the new print scheme.
/** 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;
/** 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;
bool numeric::operator==(const numeric &other) const
{
- return equal(cln::the<cln::cl_N>(value), cln::the<cln::cl_N>(other.value));
+ return cln::equal(cln::the<cln::cl_N>(value), cln::the<cln::cl_N>(other.value));
}
bool numeric::operator!=(const numeric &other) const
{
- return !equal(cln::the<cln::cl_N>(value), cln::the<cln::cl_N>(other.value));
+ return !cln::equal(cln::the<cln::cl_N>(value), cln::the<cln::cl_N>(other.value));
}
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<cln::cl_RA>(value)));
if (!this->is_real()) { // complex case, handle Q(i):
const numeric iquo(const numeric &a, const numeric &b)
{
if (a.is_integer() && b.is_integer())
- return truncate1(cln::the<cln::cl_I>(a.to_cl_N()),
- cln::the<cln::cl_I>(b.to_cl_N()));
+ return cln::truncate1(cln::the<cln::cl_I>(a.to_cl_N()),
+ cln::the<cln::cl_I>(b.to_cl_N()));
else
return _num0();
}
#include "archive.h"
#include "debugmsg.h"
#include "utils.h"
+#include "print.h"
namespace GiNaC {
// 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
// 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;