X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fstructure.pl;h=809ae2682f7548e8be01123b05e921b30af2e381;hp=9a734c907acd0dac808457d4c4a3842c231cef49;hb=e187ba694051c0fcdb4e7aa3152a54c87c3c8e21;hpb=094911eb78cacb6f2877a70c9ac74766df58ccea diff --git a/ginac/structure.pl b/ginac/structure.pl index 9a734c90..809ae268 100755 --- a/ginac/structure.pl +++ b/ginac/structure.pl @@ -125,7 +125,7 @@ $interface=<(*(X).bp)) - } // namespace GiNaC #endif // ndef _${STRUCTURE_UC}_H_ @@ -230,7 +224,7 @@ $implementation=< +#include #include "${STRUCTURE}.h" +#include "print.h" namespace GiNaC { @@ -264,25 +260,21 @@ namespace GiNaC { ${STRUCTURE}::${STRUCTURE}() { - debugmsg("${STRUCTURE} default ctor",LOGLEVEL_CONSTRUCT); tinfo_key=tinfo_${STRUCTURE}; } ${STRUCTURE}::~${STRUCTURE}() { - debugmsg("${STRUCTURE} destructor",LOGLEVEL_DESTRUCT); destroy(false); } ${STRUCTURE}::${STRUCTURE}(${STRUCTURE} const & other) { - debugmsg("${STRUCTURE} copy ctor",LOGLEVEL_CONSTRUCT); copy(other); } ${STRUCTURE} const & ${STRUCTURE}::operator=(${STRUCTURE} const & other) { - debugmsg("${STRUCTURE} operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { destroy(true); copy(other); @@ -312,38 +304,23 @@ void ${STRUCTURE}::destroy(bool call_parent) ${STRUCTURE}::${STRUCTURE}(${constructor_arglist}) : ${constructor_statements} { - debugmsg("${STRUCTURE} ctor from children", LOGLEVEL_CONSTRUCT); tinfo_key=tinfo_${STRUCTURE}; } ////////// -// functions overriding virtual functions from bases classes +// functions overriding virtual functions from base classes ////////// // public basic * ${STRUCTURE}::duplicate() const { - debugmsg("${STRUCTURE} duplicate",LOGLEVEL_DUPLICATE); return new ${STRUCTURE}(*this); } -void ${STRUCTURE}::printraw(ostream & os) const -{ - debugmsg("${STRUCTURE} printraw",LOGLEVEL_PRINT); - os << class_name() << "()"; -} - -void ${STRUCTURE}::print(ostream & os, unsigned upper_precedence) const -{ - debugmsg("${STRUCTURE} print",LOGLEVEL_PRINT); - os << class_name() << "()"; -} - -void ${STRUCTURE}::printtree(ostream & os, unsigned indent) const +void ${STRUCTURE}::print(const print_context & c, unsigned level) const { - debugmsg("${STRUCTURE} printtree",LOGLEVEL_PRINT); - os << "${STRUCTURE}()"; + c.s << class_name() << "()"; } int ${STRUCTURE}::nops() const @@ -359,8 +336,7 @@ ex & ${STRUCTURE}::let_op(int i) switch (i) { ${let_op_statements} } - errormsg("${STRUCTURE}::let_op(): should not reach this point"); - return *new ex(fail()); + throw(std::runtime_error("${STRUCTURE}::let_op(): should not have reached this point")); } ex ${STRUCTURE}::expand(unsigned options) const @@ -450,8 +426,7 @@ ${subs_statements} int ${STRUCTURE}::compare_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other,${STRUCTURE})); - ${STRUCTURE} const & o=static_cast<${STRUCTURE} const &> - (const_cast(other)); + ${STRUCTURE} const &o = static_cast(other); int cmpval; ${compare_statements} return 0; @@ -460,8 +435,7 @@ ${compare_statements} bool ${STRUCTURE}::is_equal_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other,${STRUCTURE})); - ${STRUCTURE} const & o=static_cast<${STRUCTURE} const &> - (const_cast(other)); + ${STRUCTURE} const &o = static_cast(other); ${is_equal_statements} return true; }