X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fcontainer.pl;h=d187d0654d6973076b9bacc2431d732678b73d53;hp=8374b9b9065cc8c5563d57b2f9b33938603fe214;hb=6f5d126dee39bef256b9dbc108d9e4fd753bdd75;hpb=aa6281216091efd92dc5fcc3f96c7189114e80f1 diff --git a/ginac/container.pl b/ginac/container.pl index 8374b9b9..d187d065 100755 --- a/ginac/container.pl +++ b/ginac/container.pl @@ -168,7 +168,6 @@ $constructors_implementation=generate( <<'END_OF_CONSTRUCTORS_IMPLEMENTATION','const ex & param${N}',', ',' seq.push_back(param${N});',"\n"); ${CONTAINER}::${CONTAINER}(${SEQ1}) : basic(TINFO_${CONTAINER}) { - debugmsg(\"${CONTAINER} ctor from ${N}*ex\",LOGLEVEL_CONSTRUCT); RESERVE(seq,${N}); ${SEQ2} } @@ -192,7 +191,7 @@ $interface=<(). - * This is unsafe: you need to check the type first. */ -inline const ${CONTAINER} &ex_to_${CONTAINER}(const ex &e) -{ - return static_cast(*e.bp); -} - /** Specialization of is_exactly_a<${CONTAINER}>(obj) for ${CONTAINER} objects. */ template<> inline bool is_exactly_a<${CONTAINER}>(const basic & obj) { return obj.tinfo()==TINFO_${CONTAINER}; } -inline ${CONTAINER} &ex_to_nonconst_${CONTAINER}(const ex &e) -{ - return static_cast<${CONTAINER} &>(*e.bp); -} - } // namespace GiNaC #endif // ndef __GINAC_${CONTAINER_UC}_H__ @@ -312,7 +299,7 @@ $implementation=<(s)); } else { @@ -387,7 +369,6 @@ ${CONTAINER}::${CONTAINER}(${STLT} const & s, bool discardable) : basic(TINFO_$ ${CONTAINER}::${CONTAINER}(${STLT} * vp) : basic(TINFO_${CONTAINER}) { - debugmsg("${CONTAINER} ctor from ${STLT} *",LOGLEVEL_CONSTRUCT); GINAC_ASSERT(vp!=0); seq.swap(*vp); delete vp; @@ -402,7 +383,6 @@ ${constructors_implementation} /** Construct object from archive_node. */ ${CONTAINER}::${CONTAINER}(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) { - debugmsg("${CONTAINER} ctor from archive_node", LOGLEVEL_CONSTRUCT); for (unsigned int i=0; true; i++) { ex e; if (n.find_ex("seq", e, sym_lst, i)) @@ -437,8 +417,6 @@ void ${CONTAINER}::archive(archive_node &n) const void ${CONTAINER}::print(const print_context & c, unsigned level) const { - debugmsg("${CONTAINER} print", LOGLEVEL_PRINT); - if (is_a(c)) { c.s << std::string(level, ' ') << class_name() @@ -452,7 +430,11 @@ void ${CONTAINER}::print(const print_context & c, unsigned level) const ++i; } c.s << std::string(level + delta_indent,' ') << "=====" << std::endl; - + } else if (is_a(c)) { + printseq(c, '[', ',', ']', precedence(), precedence()+1); + } else if (is_a(c)) { + c.s << class_name (); + printseq(c, '(', ',', ')', precedence(), precedence()+1); } else { // always print brackets around seq, ignore upper_precedence printseq(c, '${open_bracket}', ',', '${close_bracket}', precedence(), precedence()+1); @@ -495,7 +477,7 @@ ex ${CONTAINER}::subs(const lst & ls, const lst & lr, bool no_pattern) const { ${STLT} *vp = subschildren(ls, lr, no_pattern); if (vp) - return this${CONTAINER}(vp).bp->basic::subs(ls, lr, no_pattern); + return ex_to(this${CONTAINER}(vp)).basic::subs(ls, lr, no_pattern); else return basic::subs(ls, lr, no_pattern); }