]> www.ginac.de Git - ginac.git/blobdiff - ginac/function.pl
Allow user defined functions to be parsed.
[ginac.git] / ginac / function.pl
index af14a753ee1530fe55c0f214e920111a35959415..495432bbff3cd4e8d8fc8b56550a22f474f1a149 100644 (file)
@@ -2,7 +2,7 @@
 
 #  function.pl options: \$maxargs=${maxargs}
 # 
-#  GiNaC Copyright (C) 1999-2009 Johannes Gutenberg University Mainz, Germany
+#  GiNaC Copyright (C) 1999-2010 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
@@ -292,7 +292,7 @@ $interface=<<END_OF_INTERFACE;
  *  Please do not modify it directly, edit the perl script instead!
  *  function.pl options: \$maxargs=${maxargs}
  *
- *  GiNaC Copyright (C) 1999-2009 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2010 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
@@ -536,7 +536,6 @@ public:
        static unsigned register_new(function_options const & opt);
        static unsigned current_serial;
        static unsigned find_function(const std::string &name, unsigned nparams);
-       static std::vector<function_options> get_registered_functions() { return registered_functions(); };
        unsigned get_serial() const {return serial;}
        std::string get_name() const;
 
@@ -575,7 +574,7 @@ $implementation=<<END_OF_IMPLEMENTATION;
  *  Please do not modify it directly, edit the perl script instead!
  *  function.pl options: \$maxargs=${maxargs}
  *
- *  GiNaC Copyright (C) 1999-2009 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2010 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
@@ -1122,7 +1121,7 @@ ex function::conjugate() const
        const function_options & opt = registered_functions()[serial];
 
        if (opt.conjugate_f==0) {
-               return exprseq::conjugate();
+               return conjugate_function(*this).hold();
        }
 
        if (opt.conjugate_use_exvector_args) {
@@ -1312,8 +1311,8 @@ ex function::power(const ex & power_param) const // power of function
        
        // No derivative defined? Then return abstract derivative object
        if (opt.power_f == NULL)
-               return (new power::power(*this, power_param))->setflag(status_flags::dynallocated |
-                                                      status_flags::evaluated);
+               return (new GiNaC::power(*this, power_param))->setflag(status_flags::dynallocated |
+                                                                      status_flags::evaluated);
 
        current_serial = serial;
        if (opt.power_use_exvector_args)
@@ -1389,7 +1388,9 @@ unsigned function::find_function(const std::string &name, unsigned nparams)
 /** Return the print name of the function. */
 std::string function::get_name() const
 {
-       GINAC_ASSERT(serial<registered_functions().size());
+       if ( serial >= registered_functions().size() ) {
+               throw std::runtime_error("unknown function");
+       }
        return registered_functions()[serial].name;
 }