X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Ffunction.pl;h=318e46c19bda4143f4f77908f19928de6cbdf203;hp=6b25c70df7203cba947af9518ff7019079f4136c;hb=c734f9bb6a1ce0aad913aa19a56542d84d86c60d;hpb=30b6666cc3c35756cd952dbb52314e0e2f93f7c0 diff --git a/ginac/function.pl b/ginac/function.pl index 6b25c70d..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