]> www.ginac.de Git - ginac.git/blobdiff - ginac/function.cppy
Update copyright statements.
[ginac.git] / ginac / function.cppy
index 2a9080cf698e43d519bce298bdc435833250125c..b8259f9810f260d8937a12d781ab4d25d4484651 100644 (file)
@@ -7,7 +7,7 @@
  *  Please do not modify it directly, edit function.cppy instead!
  *  function.py options: maxargs=@maxargs@
  *
- *  GiNaC Copyright (C) 1999-2010 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2014 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -80,6 +80,7 @@ void function_options::initialize()
        nparams = 0;
        eval_f = evalf_f = real_part_f = imag_part_f = conjugate_f = expand_f
                = derivative_f = power_f = series_f = 0;
+       info_f = 0;
        evalf_params_first = true;
        use_return_type = false;
        eval_use_exvector_args = false;
@@ -92,6 +93,7 @@ void function_options::initialize()
        power_use_exvector_args = false;
        series_use_exvector_args = false;
        print_use_exvector_args = false;
+       info_use_exvector_args = false;
        use_remember = false;
        functions_with_same_name = 1;
        symtree = 0;
@@ -594,6 +596,31 @@ ex function::imag_part() const
        throw(std::logic_error("function::imag_part(): invalid nparams"));
 }
 
+/** Implementation of ex::info for functions. */
+bool function::info(unsigned inf) const
+{
+       GINAC_ASSERT(serial<registered_functions().size());
+       const function_options & opt = registered_functions()[serial];
+
+       if (opt.info_f==0) {
+               return basic::info(inf);
+       }
+
+       if (opt.info_use_exvector_args) {
+               return ((info_funcp_exvector)(opt.info_f))(seq, inf);
+       }
+
+       switch (opt.nparams) {
+               // the following lines have been generated for max. @maxargs@ parameters
++++ for N in range(1, maxargs + 1):
+               case @N@:
+                       return ((info_funcp_@N@)(opt.info_f))(@seq('seq[%(n)d]', N, 0)@, inf);
+---
+               // end of generated lines
+       }
+       throw(std::logic_error("function::info(): invalid nparams"));
+}
+
 // protected
 
 /** Implementation of ex::diff() for functions. It applies the chain rule,