]> www.ginac.de Git - ginac.git/blobdiff - ginac/symbol.cpp
adapted to change symbol::getname() -> symbol::get_name()
[ginac.git] / ginac / symbol.cpp
index 8547ffefede2f3059f9f38ec6eabd7496c42ac83..e093e6c74a07a989a747dd6285952073848916eb 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "symbol.h"
 #include "lst.h"
+#include "print.h"
 #include "archive.h"
 #include "debugmsg.h"
 #include "utils.h"
@@ -131,33 +132,19 @@ basic *symbol::duplicate() const
        return new symbol(*this);
 }
 
-void symbol::print(std::ostream & os, unsigned upper_precedence) const
+void symbol::print(const print_context & c, unsigned level) const
 {
-       debugmsg("symbol print",LOGLEVEL_PRINT);
-       os << name;
-}
+       debugmsg("symbol print", LOGLEVEL_PRINT);
 
-void symbol::printraw(std::ostream & os) const
-{
-       debugmsg("symbol printraw",LOGLEVEL_PRINT);
-       os << class_name() << "(" << "name=" << name << ",serial=" << serial
-          << ",hash=" << hashvalue << ",flags=" << flags << ")";
-}
+       if (is_of_type(c, print_tree)) {
 
-void symbol::printtree(std::ostream & os, unsigned indent) const
-{
-       debugmsg("symbol printtree",LOGLEVEL_PRINT);
-       os << std::string(indent,' ') << name << " (symbol): "
-          << "serial=" << serial
-          << ", hash=" << hashvalue
-          << " (0x" << std::hex << hashvalue << std::dec << ")"
-          << ", flags=" << flags << std::endl;
-}
+               c.s << std::string(level, ' ') << name << " (" << class_name() << ")"
+                   << ", serial=" << serial
+                   << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec
+                   << std::endl;
 
-void symbol::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
-{
-       debugmsg("symbol print csrc", LOGLEVEL_PRINT);
-       os << name;
+       } else
+               c.s << name;
 }
 
 bool symbol::info(unsigned inf) const
@@ -221,19 +208,6 @@ ex symbol::eval(int level) const
        }
 }
 
-ex symbol::subs(const lst & ls, const lst & lr) const
-{
-       GINAC_ASSERT(ls.nops() == lr.nops());
-
-       for (unsigned i=0; i<ls.nops(); i++) {
-               if (is_ex_exactly_of_type(ls.op(i),symbol)) {
-                       if (compare_same_type(ex_to_symbol(ls.op(i)))==0)
-                               return lr.op(i);
-               }
-       }
-       return *this;
-}
-
 // protected
 
 /** Implementation of ex::diff() for single differentiation of a symbol.