X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Ffunction.pl;h=9e303d070196a0d06d3ced1a9ef7c80f297cbdc0;hp=f6e7b33276ea306d6bd6c7df7d2a46d26962c539;hb=a23befbfe262832c398f4742eb54f8b19fe9f2d0;hpb=aef64ef1f63f7b4cb9236c5c189873e48c6c999b diff --git a/ginac/function.pl b/ginac/function.pl index f6e7b332..9e303d07 100755 --- a/ginac/function.pl +++ b/ginac/function.pl @@ -264,6 +264,7 @@ public: ~function_options(); void initialize(void); function_options & set_name(std::string const & n, std::string const & tn=std::string()); + function_options & latex_name(std::string const & tn); // the following lines have been generated for max. ${maxargs} parameters $eval_func_interface $evalf_func_interface @@ -333,10 +334,7 @@ $constructors_interface // functions overriding virtual functions from bases classes public: - void printraw(std::ostream & os) const; - void print(std::ostream & os, unsigned upper_precedence=0) const; - void printtree(std::ostream & os, unsigned indent) const; - void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const; + void print(const print_context & c, unsigned level = 0) const; int degree(const ex & s) const; int ldegree(const ex & s) const; ex coeff(const ex & s, int n = 1) const; @@ -345,7 +343,6 @@ public: ex evalf(int level=0) const; unsigned calchash(void) const; ex series(const relational & r, int order, unsigned options = 0) const; - ex subs(const lst & ls, const lst & lr) const; ex thisexprseq(const exvector & v) const; ex thisexprseq(exvector * vp) const; protected: @@ -366,7 +363,8 @@ protected: public: static unsigned register_new(function_options const & opt); static unsigned find_function(const std::string &name, unsigned nparams); - unsigned getserial(void) const {return serial;} + unsigned get_serial(void) const {return serial;} + std::string get_name(void) const; // member variables @@ -381,12 +379,7 @@ inline const function &ex_to_function(const ex &e) } #define is_ex_the_function(OBJ, FUNCNAME) \\ - (is_ex_exactly_of_type(OBJ, function) && static_cast(OBJ.bp)->getserial() == function_index_##FUNCNAME) - -// global constants - -extern const function some_function; -extern const std::type_info & typeid_function; + (is_ex_exactly_of_type(OBJ, function) && static_cast(OBJ.bp)->get_serial() == function_index_##FUNCNAME) } // namespace GiNaC @@ -428,6 +421,7 @@ $implementation=<print(os); - } - os << ")"; -} - -void function::print(std::ostream & os, unsigned upper_precedence) const +void function::print(const print_context & c, unsigned level) const { - debugmsg("function print",LOGLEVEL_PRINT); + debugmsg("function print", LOGLEVEL_PRINT); GINAC_ASSERT(serialprint(c); + it++; + if (it != itend) + c.s << ","; + } + c.s << ")"; - // Print function name in lowercase - std::string lname; - lname=registered_functions()[serial].name; - for (unsigned i=0; ibp->printcsrc(os, type, 0); - it++; - if (it != itend) - os << ","; + } else if is_of_type(c, print_latex) { + c.s << registered_functions()[serial].TeX_name; + printseq(c, '(', ',', ')', exprseq::precedence, function::precedence); + } else { + c.s << registered_functions()[serial].name; + printseq(c, '(', ',', ')', exprseq::precedence, function::precedence); } - os << ")"; } ex function::expand(unsigned options) const @@ -822,19 +800,6 @@ ${series_switch_statement} throw(std::logic_error("function::series(): invalid nparams")); } -ex function::subs(const lst & ls, const lst & lr) const -{ - GINAC_ASSERT(ls.nops() == lr.nops()); - - for (unsigned i=0; i