[GiNaC-devel] Print function for user-defined function

Jan private jrheinlaender at gmx.de
Tue Sep 28 09:31:24 CEST 2010


Hello,

I did this (code shortened to what is interesting):

class imathprint : public print_dflt {
  GINAC_DECLARE_PRINT_CONTEXT(imathprint, print_dflt)
public:
  optstack* poptions; // imathprint-specific print options
  imathprint(std::ostream & os, optstack* popt, unsigned opt = 0) : 
    print_dflt(os, opt), poptions(popt) {};
  static void init();
};

DECLARE_FUNCTION_3P(partialdiff)
static void partialdiff_print_imath(..., const imathprint &c) {}
static void partialdiff_print_ltx(..., const print_context &c) {}

REGISTER_FUNCTION(partialdiff, ...
  print_func<print_latex>(&partialdiff_print_ltx).
  print_func<imathprint>(&partialdiff_print_imath).
  ...);

This gives me an error

func.cpp:1310: error: no matching function for call to
‘GiNaC::function_options::print_func(void (*)(const GiNaC::ex&, const
GiNaC::ex&, const GiNaC::ex&, const imathprint&))

But doing the same kind of thing in
GINAC_IMPLEMENT_REGISTERED_CLASS_OPT
works!

What I am trying to do is to create an extended print context imathprint
which has more options and also options of non-integer type.

Any better ideas?

Thank you,
	Jan




More information about the GiNaC-devel mailing list