Correct csrc output for fderivative [Grabner].
authorJens Vollinga <vollinga@thep.physik.uni-mainz.de>
Wed, 11 Jul 2007 18:43:22 +0000 (18:43 +0000)
committerJens Vollinga <vollinga@thep.physik.uni-mainz.de>
Wed, 11 Jul 2007 18:43:22 +0000 (18:43 +0000)
ginac/fderivative.cpp
ginac/fderivative.h

index 48a8e75..d207027 100644 (file)
@@ -31,6 +31,7 @@ namespace GiNaC {
 
 GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(fderivative, function,
   print_func<print_context>(&fderivative::do_print).
+  print_func<print_csrc>(&fderivative::do_print_csrc).
   print_func<print_tree>(&fderivative::do_print_tree))
 
 //////////
@@ -106,12 +107,24 @@ void fderivative::do_print(const print_context & c, unsigned level) const
        c.s << "D[";
        paramset::const_iterator i = parameter_set.begin(), end = parameter_set.end();
        --end;
-       while (i != end)
+       while (i != end) {
                c.s << *i++ << ",";
+       }
        c.s << *i << "](" << registered_functions()[serial].name << ")";
        printseq(c, '(', ',', ')', exprseq::precedence(), function::precedence());
 }
 
+void fderivative::do_print_csrc(const print_csrc & c, unsigned level) const
+{
+       c.s << "D_";
+       paramset::const_iterator i = parameter_set.begin(), end = parameter_set.end();
+       --end;
+       while (i != end)
+               c.s << *i++ << "_";
+       c.s << *i << "_" << registered_functions()[serial].name;
+       printseq(c, '(', ',', ')', exprseq::precedence(), function::precedence());
+}
+
 void fderivative::do_print_tree(const print_tree & c, unsigned level) const
 {
        c.s << std::string(level, ' ') << class_name() << " "
index bc2eb91..904538b 100644 (file)
@@ -74,6 +74,7 @@ protected:
        // non-virtual functions in this class
 protected:
        void do_print(const print_context & c, unsigned level) const;
+       void do_print_csrc(const print_csrc & c, unsigned level) const;
        void do_print_tree(const print_tree & c, unsigned level) const;
 
        // member variables