X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Ffunction.pl;h=7167d984a20a45d41c9b66f0fcf6dec2b3f641d8;hp=6ebdada4080be3dba8bf6db65d0e68f469b1d6f9;hb=8bcccf834ad41e94a1a4f3a0304c2945b228b4f4;hpb=6b3768e8c544739ae53321539cb4d1e3112ded1b diff --git a/ginac/function.pl b/ginac/function.pl index 6ebdada4..7167d984 100755 --- a/ginac/function.pl +++ b/ginac/function.pl @@ -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 @@ -72,7 +72,7 @@ function::function(unsigned ser, ${SEQ1}) : 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 @@ -119,29 +119,43 @@ END_OF_REGISTER_NEW_IMPLEMENTATION $interface=< #include -#include "config.h" - -class function; - -#include "exprseq.h" +#include // 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; @@ -152,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 @@ -162,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)(); @@ -254,30 +272,54 @@ protected: // utility macros #define is_ex_the_function(OBJ, FUNCNAME) \\ - (is_ex_exactly_of_type(OBJ, function) && static_cast(OBJ.bp)->getserial() == function_index_##FUNCNAME) + (is_ex_exactly_of_type(OBJ, function) && static_cast(OBJ.bp)->getserial() == function_index_##FUNCNAME) // global constants extern const function some_function; extern type_info const & typeid_function; -#endif // ndef _FUNCTION_H_ +} // namespace GiNaC + +#endif // ndef __GINAC_FUNCTION_H__ END_OF_INTERFACE $implementation=< #include -#include "ginac.h" +#include "function.h" +#include "ex.h" +#include "debugmsg.h" + +namespace GiNaC { ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -288,7 +330,7 @@ $implementation=<