-basic * constant::duplicate() const
-{
- debugmsg("constant duplicate",LOGLEVEL_DUPLICATE);
- return new constant(*this);
-}
-
-void constant::print(std::ostream & os, unsigned upper_precedence) const
-{
- debugmsg("constant print",LOGLEVEL_PRINT);
- os << name;
-}
-
-void constant::printraw(std::ostream & os) const
-{
- debugmsg("constant printraw",LOGLEVEL_PRINT);
- os << "constant(" << name << ")";
-}
-
-void constant::printtree(std::ostream & os, unsigned indent) const
-{
- debugmsg("constant printtree",LOGLEVEL_PRINT);
- os << std::string(indent,' ') << name
- << ", type=" << class_name()
- << ", hash=" << hashvalue
- << " (0x" << std::hex << hashvalue << std::dec << ")"
- << ", flags=" << flags << std::endl;
-}
-
-void constant::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
-{
- debugmsg("constant print csrc",LOGLEVEL_PRINT);
- os << name;
+void constant::print(const print_context & c, unsigned level) const
+{
+ if (is_a<print_tree>(c)) {
+ c.s << std::string(level, ' ') << name << " (" << class_name() << ")"
+ << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec
+ << std::endl;
+ } else if (is_a<print_latex>(c)) {
+ c.s << TeX_name;
+ } else if (is_a<print_python_repr>(c)) {
+ c.s << class_name() << "('" << name << "'";
+ if (TeX_name != "\\mbox{" + name + "}")
+ c.s << ",TeX_name='" << TeX_name << "'";
+ c.s << ')';
+ } else
+ c.s << name;