X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Ffunction.pl;h=318e46c19bda4143f4f77908f19928de6cbdf203;hp=312640fe7c31d8b89b95fb47bb763148273acc8e;hb=6faa1dc08e887e3d9e0a2d0b1be6ccd50fc19422;hpb=0e474355d56a912573dc29bcaee4a1180171b066 diff --git a/ginac/function.pl b/ginac/function.pl index 312640fe..318e46c1 100755 --- a/ginac/function.pl +++ b/ginac/function.pl @@ -60,6 +60,7 @@ $declare_function_macro = generate( <<'END_OF_DECLARE_FUNCTION_MACRO','typename T${N}','const T${N} & p${N}','GiNaC::ex(p${N})'); #define DECLARE_FUNCTION_${N}P(NAME) \\ class NAME##_SERIAL { public: static unsigned serial; }; \\ +const unsigned NAME##_NPARAMS = ${N}; \\ template<${SEQ1}> const GiNaC::function NAME(${SEQ2}) { \\ return GiNaC::function(NAME##_SERIAL::serial, ${SEQ3}); \\ } @@ -260,7 +261,7 @@ $declare_function_macro #define REGISTER_FUNCTION(NAME,OPT) \\ unsigned NAME##_SERIAL::serial = \\ - GiNaC::function::register_new(GiNaC::function_options(#NAME).OPT); + GiNaC::function::register_new(GiNaC::function_options(#NAME, NAME##_NPARAMS).OPT); namespace GiNaC { @@ -300,6 +301,7 @@ class function_options public: function_options(); function_options(std::string const & n, std::string const & tn=std::string()); + function_options(std::string const & n, unsigned np); ~function_options(); void initialize(); @@ -537,6 +539,13 @@ function_options::function_options(std::string const & n, std::string const & tn set_name(n, tn); } +function_options::function_options(std::string const & n, unsigned np) +{ + initialize(); + set_name(n, std::string()); + nparams = np; +} + function_options::~function_options() { // nothing to clean up at the moment @@ -557,6 +566,7 @@ void function_options::initialize() print_use_exvector_args = false; use_remember = false; functions_with_same_name = 1; + symtree = 0; } function_options & function_options::set_name(std::string const & n,