function_options::nparams is now always correctly initialized, even if no
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Thu, 29 Apr 2004 21:53:22 +0000 (21:53 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Thu, 29 Apr 2004 21:53:22 +0000 (21:53 +0000)
*_func() option was specified

ginac/function.pl
ginac/inifcns_gamma.cpp
ginac/inifcns_nstdsums.cpp

index 6b25c70df7203cba947af9518ff7019079f4136c..318e46c19bda4143f4f77908f19928de6cbdf203 100755 (executable)
@@ -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
index 0ae8d1a351c985effbcd5cc95b2f891651e25b5c..8d01127b9fc53490ab1d633e45342839b4739733 100644 (file)
@@ -423,7 +423,7 @@ static ex psi1_series(const ex & arg,
 }
 
 unsigned psi1_SERIAL::serial =
-       function::register_new(function_options("psi").
+       function::register_new(function_options("psi", 1).
                               eval_func(psi1_eval).
                               evalf_func(psi1_evalf).
                               derivative_func(psi1_deriv).
@@ -551,7 +551,7 @@ static ex psi2_series(const ex & n,
 }
 
 unsigned psi2_SERIAL::serial =
-       function::register_new(function_options("psi").
+       function::register_new(function_options("psi", 2).
                               eval_func(psi2_eval).
                               evalf_func(psi2_evalf).
                               derivative_func(psi2_deriv).
index ec9586ed9367160fcd3b5a97fb5a3dda4db84ebf..7b47e4910005d0ff88e5bda6a2872bfaefd40c44 100644 (file)
@@ -2635,7 +2635,7 @@ static void zeta1_print_latex(const ex& m_, const print_context& c)
 }
 
 
-unsigned zeta1_SERIAL::serial = function::register_new(function_options("zeta").
+unsigned zeta1_SERIAL::serial = function::register_new(function_options("zeta", 1).
                                 evalf_func(zeta1_evalf).
                                 eval_func(zeta1_eval).
                                 derivative_func(zeta1_deriv).
@@ -2772,7 +2772,7 @@ static void zeta2_print_latex(const ex& m_, const ex& s_, const print_context& c
 }
 
 
-unsigned zeta2_SERIAL::serial = function::register_new(function_options("zeta").
+unsigned zeta2_SERIAL::serial = function::register_new(function_options("zeta", 2).
                                 evalf_func(zeta2_evalf).
                                 eval_func(zeta2_eval).
                                 derivative_func(zeta2_deriv).