]> www.ginac.de Git - ginac.git/blobdiff - ginac/function.pl
- rotate_31() and golden_hash_ratio() moved to utils.h
[ginac.git] / ginac / function.pl
index e40478d051d83f2d8492ed566391d4c89f9264c1..7167d984a20a45d41c9b66f0fcf6dec2b3f641d8 100755 (executable)
@@ -32,11 +32,11 @@ sub generate {
 }
 
 $declare_function_macro=generate(
 }
 
 $declare_function_macro=generate(
-    <<'END_OF_DECLARE_FUNCTION_MACRO','ex const & p${N}','p${N}');
+    <<'END_OF_DECLARE_FUNCTION_MACRO','GiNaC::ex const & p${N}','p${N}');
 #define DECLARE_FUNCTION_${N}P(NAME) \\
 extern unsigned function_index_##NAME; \\
 #define DECLARE_FUNCTION_${N}P(NAME) \\
 extern unsigned function_index_##NAME; \\
-inline function NAME(${SEQ1}) { \\
-    return function(function_index_##NAME, ${SEQ2}); \\
+inline GiNaC::function NAME(${SEQ1}) { \\
+    return GiNaC::function(function_index_##NAME, ${SEQ2}); \\
 }
 
 END_OF_DECLARE_FUNCTION_MACRO
 }
 
 END_OF_DECLARE_FUNCTION_MACRO
@@ -72,7 +72,7 @@ function::function(unsigned ser, ${SEQ1})
     : exprseq(${SEQ2}), serial(ser)
 {
     debugmsg(\"function constructor from unsigned,${N}*ex\",LOGLEVEL_CONSTRUCT);
     : exprseq(${SEQ2}), serial(ser)
 {
     debugmsg(\"function constructor from unsigned,${N}*ex\",LOGLEVEL_CONSTRUCT);
-    tinfo_key = TINFO_FUNCTION;
+    tinfo_key = TINFO_function;
 }
 END_OF_CONSTRUCTORS_IMPLEMENTATION
 
 }
 END_OF_CONSTRUCTORS_IMPLEMENTATION
 
@@ -119,8 +119,9 @@ END_OF_REGISTER_NEW_IMPLEMENTATION
 $interface=<<END_OF_INTERFACE;
 /** \@file function.h
  *
 $interface=<<END_OF_INTERFACE;
 /** \@file function.h
  *
- *  Interface to abstract class function (new function concept).
- *
+ *  Interface to abstract class function (new function concept). */
+
+/*
  *  This file was generated automatically by function.pl.
  *  Please do not modify it directly, edit the perl script instead!
  *  function.pl options: \$maxargs=${maxargs}
  *  This file was generated automatically by function.pl.
  *  Please do not modify it directly, edit the perl script instead!
  *  function.pl options: \$maxargs=${maxargs}
@@ -147,15 +148,14 @@ $interface=<<END_OF_INTERFACE;
 
 #include <string>
 #include <vector>
 
 #include <string>
 #include <vector>
-
-class function;
+#include <ginac/exprseq.h>
 
 // the following lines have been generated for max. ${maxargs} parameters
 $declare_function_macro
 // end of generated lines
 
 #define REGISTER_FUNCTION(NAME,E,EF,D,S) \\
 
 // the following lines have been generated for max. ${maxargs} parameters
 $declare_function_macro
 // end of generated lines
 
 #define REGISTER_FUNCTION(NAME,E,EF,D,S) \\
-unsigned function_index_##NAME=function::register_new(#NAME,E,EF,D,S);
+unsigned function_index_##NAME=GiNaC::function::register_new(#NAME,E,EF,D,S);
 
 #define BEGIN_TYPECHECK \\
 bool automatic_typecheck=true;
 
 #define BEGIN_TYPECHECK \\
 bool automatic_typecheck=true;
@@ -166,7 +166,7 @@ if (!is_ex_exactly_of_type(VAR,TYPE)) { \\
 } else
 
 #define TYPECHECK_INTEGER(VAR) \\
 } else
 
 #define TYPECHECK_INTEGER(VAR) \\
-if (!(VAR).info(info_flags::integer)) { \\
+if (!(VAR).info(GiNaC::info_flags::integer)) { \\
     automatic_typecheck=false; \\
 } else
 
     automatic_typecheck=false; \\
 } else
 
@@ -176,6 +176,10 @@ if (!automatic_typecheck) { \\
     return RV.hold(); \\
 }
 
     return RV.hold(); \\
 }
 
+namespace GiNaC {
+
+class function;
+
 typedef ex (* eval_funcp)();
 typedef ex (* evalf_funcp)();
 typedef ex (* diff_funcp)();
 typedef ex (* eval_funcp)();
 typedef ex (* evalf_funcp)();
 typedef ex (* diff_funcp)();
@@ -268,13 +272,15 @@ protected:
 // utility macros
 
 #define is_ex_the_function(OBJ, FUNCNAME) \\
 // utility macros
 
 #define is_ex_the_function(OBJ, FUNCNAME) \\
-    (is_ex_exactly_of_type(OBJ, function) && static_cast<function *>(OBJ.bp)->getserial() == function_index_##FUNCNAME)
+    (is_ex_exactly_of_type(OBJ, function) && static_cast<GiNaC::function *>(OBJ.bp)->getserial() == function_index_##FUNCNAME)
 
 // global constants
 
 extern const function some_function;
 extern type_info const & typeid_function;
 
 
 // global constants
 
 extern const function some_function;
 extern type_info const & typeid_function;
 
+} // namespace GiNaC
+
 #endif // ndef __GINAC_FUNCTION_H__
 
 END_OF_INTERFACE
 #endif // ndef __GINAC_FUNCTION_H__
 
 END_OF_INTERFACE
@@ -282,8 +288,9 @@ END_OF_INTERFACE
 $implementation=<<END_OF_IMPLEMENTATION;
 /** \@file function.cpp
  *
 $implementation=<<END_OF_IMPLEMENTATION;
 /** \@file function.cpp
  *
- *  Implementation of class function.
- *
+ *  Implementation of class function. */
+
+/*
  *  This file was generated automatically by function.pl.
  *  Please do not modify it directly, edit the perl script instead!
  *  function.pl options: \$maxargs=${maxargs}
  *  This file was generated automatically by function.pl.
  *  Please do not modify it directly, edit the perl script instead!
  *  function.pl options: \$maxargs=${maxargs}
@@ -308,7 +315,11 @@ $implementation=<<END_OF_IMPLEMENTATION;
 #include <string>
 #include <stdexcept>
 
 #include <string>
 #include <stdexcept>
 
-#include "ginac.h"
+#include "function.h"
+#include "ex.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
 
 //////////
 // default constructor, destructor, copy constructor assignment operator and helpers
 
 //////////
 // default constructor, destructor, copy constructor assignment operator and helpers
@@ -319,7 +330,7 @@ $implementation=<<END_OF_IMPLEMENTATION;
 function::function() : serial(0)
 {
     debugmsg("function default constructor",LOGLEVEL_CONSTRUCT);
 function::function() : serial(0)
 {
     debugmsg("function default constructor",LOGLEVEL_CONSTRUCT);
-    tinfo_key = TINFO_FUNCTION;
+    tinfo_key = TINFO_function;
 }
 
 function::~function()
 }
 
 function::~function()
@@ -366,7 +377,7 @@ void function::destroy(bool call_parent)
 function::function(unsigned ser) : serial(ser)
 {
     debugmsg("function constructor from unsigned",LOGLEVEL_CONSTRUCT);
 function::function(unsigned ser) : serial(ser)
 {
     debugmsg("function constructor from unsigned",LOGLEVEL_CONSTRUCT);
-    tinfo_key = TINFO_FUNCTION;
+    tinfo_key = TINFO_function;
 }
 
 // the following lines have been generated for max. ${maxargs} parameters
 }
 
 // the following lines have been generated for max. ${maxargs} parameters
@@ -376,21 +387,21 @@ $constructors_implementation
 function::function(unsigned ser, exprseq const & es) : exprseq(es), serial(ser)
 {
     debugmsg("function constructor from unsigned,exprseq",LOGLEVEL_CONSTRUCT);
 function::function(unsigned ser, exprseq const & es) : exprseq(es), serial(ser)
 {
     debugmsg("function constructor from unsigned,exprseq",LOGLEVEL_CONSTRUCT);
-    tinfo_key = TINFO_FUNCTION;
+    tinfo_key = TINFO_function;
 }
 
 function::function(unsigned ser, exvector const & v, bool discardable) 
     : exprseq(v,discardable), serial(ser)
 {
     debugmsg("function constructor from string,exvector,bool",LOGLEVEL_CONSTRUCT);
 }
 
 function::function(unsigned ser, exvector const & v, bool discardable) 
     : exprseq(v,discardable), serial(ser)
 {
     debugmsg("function constructor from string,exvector,bool",LOGLEVEL_CONSTRUCT);
-    tinfo_key = TINFO_FUNCTION;
+    tinfo_key = TINFO_function;
 }
 
 function::function(unsigned ser, exvector * vp) 
     : exprseq(vp), serial(ser)
 {
     debugmsg("function constructor from unsigned,exvector *",LOGLEVEL_CONSTRUCT);
 }
 
 function::function(unsigned ser, exvector * vp) 
     : exprseq(vp), serial(ser)
 {
     debugmsg("function constructor from unsigned,exvector *",LOGLEVEL_CONSTRUCT);
-    tinfo_key = TINFO_FUNCTION;
+    tinfo_key = TINFO_function;
 }
 
 //////////
 }
 
 //////////
@@ -627,6 +638,8 @@ $register_new_implementation
 const function some_function;
 type_info const & typeid_function=typeid(some_function);
 
 const function some_function;
 type_info const & typeid_function=typeid(some_function);
 
+} // namespace GiNaC
+
 END_OF_IMPLEMENTATION
 
 print "Creating interface file function.h...";
 END_OF_IMPLEMENTATION
 
 print "Creating interface file function.h...";