]> www.ginac.de Git - ginac.git/blobdiff - ginac/function.pl
- ASSERT macro renamed to GINAC_ASSERT
[ginac.git] / ginac / function.pl
index 1a1fcbaaf073dac967107b31cf929ab2431755f0..06bf2d674c3c92d6aa4b615ad92b2b7ecf49f0cd 100755 (executable)
@@ -32,11 +32,11 @@ sub 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; \\
-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
@@ -119,8 +119,9 @@ END_OF_REGISTER_NEW_IMPLEMENTATION
 $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}
@@ -149,14 +150,12 @@ $interface=<<END_OF_INTERFACE;
 #include <vector>
 #include <ginac/exprseq.h>
 
-class function;
-
 // 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;
@@ -167,7 +166,7 @@ if (!is_ex_exactly_of_type(VAR,TYPE)) { \\
 } else
 
 #define TYPECHECK_INTEGER(VAR) \\
-if (!(VAR).info(info_flags::integer)) { \\
+if (!(VAR).info(GiNaC::info_flags::integer)) { \\
     automatic_typecheck=false; \\
 } else
 
@@ -177,6 +176,10 @@ if (!automatic_typecheck) { \\
     return RV.hold(); \\
 }
 
+namespace GiNaC {
+
+class function;
+
 typedef ex (* eval_funcp)();
 typedef ex (* evalf_funcp)();
 typedef ex (* diff_funcp)();
@@ -269,13 +272,15 @@ protected:
 // 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;
 
+} // namespace GiNaC
+
 #endif // ndef __GINAC_FUNCTION_H__
 
 END_OF_INTERFACE
@@ -283,8 +288,9 @@ END_OF_INTERFACE
 $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}
@@ -311,6 +317,9 @@ $implementation=<<END_OF_IMPLEMENTATION;
 
 #include "function.h"
 #include "ex.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
 
 //////////
 // default constructor, destructor, copy constructor assignment operator and helpers
@@ -411,7 +420,7 @@ void function::printraw(ostream & os) const
 {
     debugmsg("function printraw",LOGLEVEL_PRINT);
 
-    ASSERT(serial<registered_functions().size());
+    GINAC_ASSERT(serial<registered_functions().size());
 
     os << "function(name=" << registered_functions()[serial].name;
     for (exvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
@@ -425,7 +434,7 @@ void function::print(ostream & os, unsigned upper_precedence) const
 {
     debugmsg("function print",LOGLEVEL_PRINT);
 
-    ASSERT(serial<registered_functions().size());
+    GINAC_ASSERT(serial<registered_functions().size());
 
     os << registered_functions()[serial].name;
     printseq(os,'(',',',')',exprseq::precedence,function::precedence);
@@ -435,7 +444,7 @@ void function::printtree(ostream & os, unsigned indent) const
 {
     debugmsg("function printtree",LOGLEVEL_PRINT);
 
-    ASSERT(serial<registered_functions().size());
+    GINAC_ASSERT(serial<registered_functions().size());
 
     os << string(indent,' ') << "function "
        << registered_functions()[serial].name
@@ -452,7 +461,7 @@ void function::printcsrc(ostream & os, unsigned type, unsigned upper_precedence)
 {
     debugmsg("function print csrc",LOGLEVEL_PRINT);
 
-    ASSERT(serial<registered_functions().size());
+    GINAC_ASSERT(serial<registered_functions().size());
 
        // Print function name in lowercase
     string lname;
@@ -480,7 +489,7 @@ ex function::expand(unsigned options) const
 
 ex function::eval(int level) const
 {
-    ASSERT(serial<registered_functions().size());
+    GINAC_ASSERT(serial<registered_functions().size());
 
     exvector eseq=evalchildren(level);    
 
@@ -497,7 +506,7 @@ ${eval_switch_statement}
 
 ex function::evalf(int level) const
 {
-    ASSERT(serial<registered_functions().size());
+    GINAC_ASSERT(serial<registered_functions().size());
 
     exvector eseq=evalfchildren(level);
     
@@ -526,7 +535,7 @@ ex function::thisexprseq(exvector * vp) const
  *  \@see ex::series */
 ex function::series(symbol const & s, ex const & point, int order) const
 {
-    ASSERT(serial<registered_functions().size());
+    GINAC_ASSERT(serial<registered_functions().size());
 
     if (registered_functions()[serial].s==0) {
         return basic::series(s, point, order);
@@ -543,7 +552,7 @@ ${series_switch_statement}
 
 int function::compare_same_type(basic const & other) const
 {
-    ASSERT(is_of_type(other, function));
+    GINAC_ASSERT(is_of_type(other, function));
     function const & o=static_cast<function &>(const_cast<basic &>(other));
 
     if (serial!=o.serial) {
@@ -554,7 +563,7 @@ int function::compare_same_type(basic const & other) const
 
 bool function::is_equal_same_type(basic const & other) const
 {
-    ASSERT(is_of_type(other, function));
+    GINAC_ASSERT(is_of_type(other, function));
     function const & o=static_cast<function &>(const_cast<basic &>(other));
 
     if (serial!=o.serial) return false;
@@ -591,7 +600,7 @@ unsigned function::return_type_tinfo(void) const
 
 ex function::pdiff(unsigned diff_param) const // partial differentiation
 {
-    ASSERT(serial<registered_functions().size());
+    GINAC_ASSERT(serial<registered_functions().size());
     
     if (registered_functions()[serial].d==0) {
         throw(std::logic_error(string("function::pdiff(") + registered_functions()[serial].name + "): no diff function defined"));
@@ -629,6 +638,8 @@ $register_new_implementation
 const function some_function;
 type_info const & typeid_function=typeid(some_function);
 
+} // namespace GiNaC
+
 END_OF_IMPLEMENTATION
 
 print "Creating interface file function.h...";