]> www.ginac.de Git - ginac.git/blobdiff - ginac/function.pl
- made nops() return unsigned instead of int
[ginac.git] / ginac / function.pl
index 41018c93428c8cee29b830411ab43f92fc6a5e6f..f08990d9fdd47b636a54835632a003943a1282c1 100755 (executable)
@@ -44,7 +44,7 @@ END_OF_DECLARE_FUNCTION_MACRO_NAMESPACE
 $declare_function_macro_no_namespace=generate(
     <<'END_OF_DECLARE_FUNCTION_MACRO_NO_NAMESPACE','ex const & p${N}','p${N}');
 #define DECLARE_FUNCTION_${N}P(NAME) \\
 $declare_function_macro_no_namespace=generate(
     <<'END_OF_DECLARE_FUNCTION_MACRO_NO_NAMESPACE','ex const & p${N}','p${N}');
 #define DECLARE_FUNCTION_${N}P(NAME) \\
-extern unsigned function_index_##NAME; \\
+extern const unsigned function_index_##NAME; \\
 inline function NAME(${SEQ1}) { \\
     return function(function_index_##NAME, ${SEQ2}); \\
 }
 inline function NAME(${SEQ1}) { \\
     return function(function_index_##NAME, ${SEQ2}); \\
 }
@@ -110,7 +110,12 @@ END_OF_DIFF_SWITCH_STATEMENT
 $series_switch_statement=generate(
     <<'END_OF_SERIES_SWITCH_STATEMENT','seq[${N}-1]','');
     case ${N}:
 $series_switch_statement=generate(
     <<'END_OF_SERIES_SWITCH_STATEMENT','seq[${N}-1]','');
     case ${N}:
-        return ((series_funcp_${N})(registered_functions()[serial].s))(${SEQ1},s,point,order);
+        try {
+            res = ((series_funcp_${N})(registered_functions()[serial].s))(${SEQ1},s,point,order);
+        } catch (do_taylor) {
+            res = basic::series(s, point, order);
+        }
+        return res;
         break;
 END_OF_SERIES_SWITCH_STATEMENT
 
         break;
 END_OF_SERIES_SWITCH_STATEMENT
 
@@ -136,7 +141,7 @@ $interface=<<END_OF_INTERFACE;
  *  Please do not modify it directly, edit the perl script instead!
  *  function.pl options: \$maxargs=${maxargs}
  *
  *  Please do not modify it directly, edit the perl script instead!
  *  function.pl options: \$maxargs=${maxargs}
  *
- *  GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2000 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
  *
  *  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
@@ -355,7 +360,7 @@ $implementation=<<END_OF_IMPLEMENTATION;
  *  Please do not modify it directly, edit the perl script instead!
  *  function.pl options: \$maxargs=${maxargs}
  *
  *  Please do not modify it directly, edit the perl script instead!
  *  function.pl options: \$maxargs=${maxargs}
  *
- *  GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2000 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
  *
  *  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
@@ -377,6 +382,7 @@ $implementation=<<END_OF_IMPLEMENTATION;
 
 #include "function.h"
 #include "ex.h"
 
 #include "function.h"
 #include "ex.h"
+#include "utils.h"
 #include "debugmsg.h"
 
 #ifndef NO_GINAC_NAMESPACE
 #include "debugmsg.h"
 
 #ifndef NO_GINAC_NAMESPACE
@@ -513,7 +519,7 @@ void function::printtree(ostream & os, unsigned indent) const
        << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
        << ", flags=" << flags
        << ", nops=" << nops() << endl;
        << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
        << ", flags=" << flags
        << ", nops=" << nops() << endl;
-    for (int i=0; i<nops(); ++i) {
+    for (unsigned i=0; i<nops(); ++i) {
         seq[i].printtree(os,indent+delta_indent);
     }
     os << string(indent+delta_indent,' ') << "=====" << endl;
         seq[i].printtree(os,indent+delta_indent);
     }
     os << string(indent+delta_indent,' ') << "=====" << endl;
@@ -602,6 +608,7 @@ ex function::series(symbol const & s, ex const & point, int order) const
     if (registered_functions()[serial].s==0) {
         return basic::series(s, point, order);
     }
     if (registered_functions()[serial].s==0) {
         return basic::series(s, point, order);
     }
+    ex res;
     switch (registered_functions()[serial].nparams) {
         // the following lines have been generated for max. ${maxargs} parameters
 ${series_switch_statement}
     switch (registered_functions()[serial].nparams) {
         // the following lines have been generated for max. ${maxargs} parameters
 ${series_switch_statement}