X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fstructure.pl;h=8b644540ca4cee81776156d810c6c203b4abf5d5;hp=b43661d847bdb9e3464acc53811077bd452c669b;hb=cb85fdf34e2b96f35fa65d9b6b6a1a0b30512ea4;hpb=19c8f943c15dcc0d946fb4d5fef11e487d34857a diff --git a/ginac/structure.pl b/ginac/structure.pl index b43661d8..8b644540 100755 --- a/ginac/structure.pl +++ b/ginac/structure.pl @@ -125,7 +125,7 @@ $interface=<(*(X).bp)) - -#ifndef NO_NAMESPACE_GINAC } // namespace GiNaC -#endif // ndef NO_NAMESPACE_GINAC #endif // ndef _${STRUCTURE_UC}_H_ @@ -234,7 +224,7 @@ $implementation=< +#include #include "${STRUCTURE}.h" +#include "print.h" -#ifndef NO_NAMESPACE_GINAC namespace GiNaC { -#endif // ndef NO_NAMESPACE_GINAC ////////// -// default constructor, destructor, copy constructor assignment operator and helpers +// default ctor, destructor, copy ctor assignment operator and helpers ////////// // public ${STRUCTURE}::${STRUCTURE}() { - debugmsg("${STRUCTURE} default constructor",LOGLEVEL_CONSTRUCT); + debugmsg("${STRUCTURE} default ctor",LOGLEVEL_CONSTRUCT); tinfo_key=tinfo_${STRUCTURE}; } ${STRUCTURE}::~${STRUCTURE}() { debugmsg("${STRUCTURE} destructor",LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } ${STRUCTURE}::${STRUCTURE}(${STRUCTURE} const & other) { - debugmsg("${STRUCTURE} copy constructor",LOGLEVEL_CONSTRUCT); + debugmsg("${STRUCTURE} copy ctor",LOGLEVEL_CONSTRUCT); copy(other); } @@ -290,7 +280,7 @@ ${STRUCTURE} const & ${STRUCTURE}::operator=(${STRUCTURE} const & other) { debugmsg("${STRUCTURE} operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; @@ -310,7 +300,7 @@ void ${STRUCTURE}::destroy(bool call_parent) } ////////// -// other constructors +// other ctors ////////// // public @@ -318,7 +308,7 @@ void ${STRUCTURE}::destroy(bool call_parent) ${STRUCTURE}::${STRUCTURE}(${constructor_arglist}) : ${constructor_statements} { - debugmsg("${STRUCTURE} constructor from children", LOGLEVEL_CONSTRUCT); + debugmsg("${STRUCTURE} ctor from children", LOGLEVEL_CONSTRUCT); tinfo_key=tinfo_${STRUCTURE}; } @@ -334,22 +324,10 @@ basic * ${STRUCTURE}::duplicate() const return new ${STRUCTURE}(*this); } -void ${STRUCTURE}::printraw(ostream & os) const -{ - debugmsg("${STRUCTURE} printraw",LOGLEVEL_PRINT); - os << "${STRUCTURE}()"; -} - -void ${STRUCTURE}::print(ostream & os, unsigned upper_precedence) const -{ - debugmsg("${STRUCTURE} print",LOGLEVEL_PRINT); - os << "${STRUCTURE}()"; -} - -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}()"; + debugmsg("${STRUCTURE} print", LOGLEVEL_PRINT); + c.s << class_name() << "()"; } int ${STRUCTURE}::nops() const @@ -365,8 +343,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 @@ -513,9 +490,7 @@ const ${STRUCTURE} some_${STRUCTURE}; const type_info & typeid_${STRUCTURE}=typeid(some_${STRUCTURE}); const unsigned tinfo_${STRUCTURE}=structure::register_new("${STRUCTURE}"); -#ifndef NO_NAMESPACE_GINAC } // namespace GiNaC -#endif // ndef NO_NAMESPACE_GINAC END_OF_IMPLEMENTATION