From: Alexander Frink Date: Thu, 2 Dec 1999 18:44:55 +0000 (+0000) Subject: #ifndef around namespace GiNaC { } X-Git-Tag: release_0-5-0~101 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=afdd7fa8c6c0a587f7c80789198551383e8beb7b;hp=48b41ea321ed9fa6115a1061d1a1d2f8d8ad0400 #ifndef around namespace GiNaC { } --- diff --git a/check/differentiation.cpp b/check/differentiation.cpp index 0d963fed..348b5fd5 100644 --- a/check/differentiation.cpp +++ b/check/differentiation.cpp @@ -21,7 +21,10 @@ */ #include + +#ifndef NO_GINAC_NAMESPACE using namespace GiNaC; +#endif // ndef NO_GINAC_NAMESPACE static unsigned check_diff(const ex &e, const symbol &x, const ex &d, unsigned nth=1) diff --git a/check/expand_subs.cpp b/check/expand_subs.cpp index b6ff16f0..4d78708b 100644 --- a/check/expand_subs.cpp +++ b/check/expand_subs.cpp @@ -32,7 +32,10 @@ #include + +#ifndef NO_GINAC_NAMESPACE using namespace GiNaC; +#endif // ndef NO_GINAC_NAMESPACE #define VECSIZE 100 diff --git a/check/inifcns_consist.cpp b/check/inifcns_consist.cpp index cabecc6a..024dad79 100644 --- a/check/inifcns_consist.cpp +++ b/check/inifcns_consist.cpp @@ -22,7 +22,10 @@ */ #include + +#ifndef NO_GINAC_NAMESPACE using namespace GiNaC; +#endif // ndef NO_GINAC_NAMESPACE /* Simple tests on the sine trigonometric function. */ static unsigned inifcns_consist_sin(void) diff --git a/check/lsolve_onedim.cpp b/check/lsolve_onedim.cpp index 448a1637..be113c2d 100644 --- a/check/lsolve_onedim.cpp +++ b/check/lsolve_onedim.cpp @@ -22,7 +22,10 @@ */ #include + +#ifndef NO_GINAC_NAMESPACE using namespace GiNaC; +#endif // ndef NO_GINAC_NAMESPACE unsigned lsolve_onedim(void) { diff --git a/check/matrix_checks.cpp b/check/matrix_checks.cpp index 80d8bf95..3da30af8 100644 --- a/check/matrix_checks.cpp +++ b/check/matrix_checks.cpp @@ -22,7 +22,10 @@ #include #include + +#ifndef NO_GINAC_NAMESPACE using namespace GiNaC; +#endif // ndef NO_GINAC_NAMESPACE static unsigned matrix_determinants(void) { diff --git a/check/normalization.cpp b/check/normalization.cpp index 3f814fde..bf761ffe 100644 --- a/check/normalization.cpp +++ b/check/normalization.cpp @@ -21,7 +21,10 @@ */ #include + +#ifndef NO_GINAC_NAMESPACE using namespace GiNaC; +#endif // ndef NO_GINAC_NAMESPACE static symbol x("x"), y("y"), z("z"); diff --git a/check/numeric_consist.cpp b/check/numeric_consist.cpp index 6c5fd6be..d6a3ffca 100644 --- a/check/numeric_consist.cpp +++ b/check/numeric_consist.cpp @@ -23,7 +23,10 @@ #include #include + +#ifndef NO_GINAC_NAMESPACE using namespace GiNaC; +#endif // ndef NO_GINAC_NAMESPACE /* Simple and maybe somewhat pointless consistency tests of assorted tests and * conversions. */ diff --git a/check/numeric_output.cpp b/check/numeric_output.cpp index 99f3afdc..50dd8c1f 100644 --- a/check/numeric_output.cpp +++ b/check/numeric_output.cpp @@ -21,7 +21,10 @@ */ #include + +#ifndef NO_GINAC_NAMESPACE using namespace GiNaC; +#endif // ndef NO_GINAC_NAMESPACE unsigned numeric_output(void) { diff --git a/check/paranoia_check.cpp b/check/paranoia_check.cpp index d84946f2..b42225ca 100644 --- a/check/paranoia_check.cpp +++ b/check/paranoia_check.cpp @@ -24,7 +24,10 @@ */ #include + +#ifndef NO_GINAC_NAMESPACE using namespace GiNaC; +#endif // ndef NO_GINAC_NAMESPACE // The very first pair of historic problems had its roots in power.cpp and was // finally resolved on April 27th. (Fixing the first on April 23rd actually diff --git a/check/poly_gcd.cpp b/check/poly_gcd.cpp index 484eb2d2..1448ae3c 100644 --- a/check/poly_gcd.cpp +++ b/check/poly_gcd.cpp @@ -22,7 +22,10 @@ */ #include + +#ifndef NO_GINAC_NAMESPACE using namespace GiNaC; +#endif // ndef NO_GINAC_NAMESPACE const int MAX_VARIABLES = 5; diff --git a/check/powerlaws.cpp b/check/powerlaws.cpp index c51bff8e..b7fdd60c 100644 --- a/check/powerlaws.cpp +++ b/check/powerlaws.cpp @@ -22,7 +22,10 @@ */ #include + +#ifndef NO_GINAC_NAMESPACE using namespace GiNaC; +#endif // ndef NO_GINAC_NAMESPACE static unsigned powerlaws1(void) { diff --git a/check/series_expansion.cpp b/check/series_expansion.cpp index 292f5b92..b648f9d7 100644 --- a/check/series_expansion.cpp +++ b/check/series_expansion.cpp @@ -21,7 +21,10 @@ */ #include + +#ifndef NO_GINAC_NAMESPACE using namespace GiNaC; +#endif // ndef NO_GINAC_NAMESPACE static symbol x("x"); diff --git a/ginac/add.cpp b/ginac/add.cpp index 6f5380cc..553b8272 100644 --- a/ginac/add.cpp +++ b/ginac/add.cpp @@ -27,7 +27,9 @@ #include "mul.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -653,4 +655,6 @@ unsigned add::precedence=40; const add some_add; type_info const & typeid_add=typeid(some_add); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/add.h b/ginac/add.h index 37d502a0..1acb03d1 100644 --- a/ginac/add.h +++ b/ginac/add.h @@ -25,7 +25,9 @@ #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE /** Sum of expressions. */ class add : public expairseq @@ -112,6 +114,8 @@ inline const add &ex_to_add(const ex &e) return static_cast(*e.bp); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_ADD_H__ diff --git a/ginac/basic.cpp b/ginac/basic.cpp index eb4a72e0..96fa259d 100644 --- a/ginac/basic.cpp +++ b/ginac/basic.cpp @@ -34,7 +34,9 @@ #include "utils.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -417,4 +419,6 @@ type_info const & typeid_basic=typeid(some_basic); int max_recursion_level=1024; +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/basic.h b/ginac/basic.h index a0e3f6ed..ae810476 100644 --- a/ginac/basic.h +++ b/ginac/basic.h @@ -27,11 +27,16 @@ #include #include +// CINT needs to work properly with +#include + #include #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE class basic; class ex; @@ -39,7 +44,8 @@ class symbol; class lst; class numeric; -typedef vector exvector; +//typedef vector exvector; +typedef vector exvector; // CINT does not like vector<...,default_alloc> #define INLINE_BASIC_CONSTRUCTORS @@ -180,6 +186,8 @@ extern int max_recursion_level; // convenience macros +#ifndef NO_GINAC_NAMESPACE + #define is_of_type(OBJ,TYPE) \ (dynamic_cast(const_cast(&OBJ))!=0) @@ -192,6 +200,25 @@ extern int max_recursion_level; #define is_ex_exactly_of_type(OBJ,TYPE) \ ((*(OBJ).bp).tinfo()==GiNaC::TINFO_##TYPE) +#else // ndef NO_GINAC_NAMESPACE + +#define is_of_type(OBJ,TYPE) \ + (dynamic_cast(const_cast(&OBJ))!=0) + +#define is_exactly_of_type(OBJ,TYPE) \ + ((OBJ).tinfo()==TINFO_##TYPE) + +#define is_ex_of_type(OBJ,TYPE) \ + (dynamic_cast(const_cast((OBJ).bp))!=0) + +#define is_ex_exactly_of_type(OBJ,TYPE) \ + ((*(OBJ).bp).tinfo()==TINFO_##TYPE) + +#endif // ndef NO_GINAC_NAMESPACE + +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_BASIC_H__ + diff --git a/ginac/clifford.cpp b/ginac/clifford.cpp index 16f9a4d4..ff98011f 100644 --- a/ginac/clifford.cpp +++ b/ginac/clifford.cpp @@ -29,7 +29,9 @@ #include "utils.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -211,4 +213,6 @@ unsigned clifford::next_serial=0; const clifford some_clifford; type_info const & typeid_clifford=typeid(some_clifford); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/clifford.h b/ginac/clifford.h index 49a3613b..3302f461 100644 --- a/ginac/clifford.h +++ b/ginac/clifford.h @@ -27,7 +27,9 @@ #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE /** Base class for clifford object */ class clifford : public indexed @@ -90,6 +92,8 @@ inline const clifford &ex_to_clifford(const ex &e) return static_cast(*e.bp); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_CLIFFORD_H__ diff --git a/ginac/color.cpp b/ginac/color.cpp index 095a3b0c..468645dd 100644 --- a/ginac/color.cpp +++ b/ginac/color.cpp @@ -35,7 +35,9 @@ #include "relational.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -965,4 +967,7 @@ void append_exvector_to_exvector(exvector & dest, exvector const & source) } } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE + diff --git a/ginac/color.h b/ginac/color.h index 9967f451..f72034d8 100644 --- a/ginac/color.h +++ b/ginac/color.h @@ -28,7 +28,9 @@ #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE const unsigned MAX_REPRESENTATION_LABELS = 4; const unsigned COLOR_EIGHT = 8; // N*N-1 @@ -162,6 +164,8 @@ ex brute_force_sum_color_indices(ex const & e); void append_exvector_to_exvector(exvector & dest, exvector const & source); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_COLOR_H__ diff --git a/ginac/coloridx.cpp b/ginac/coloridx.cpp index dc8eed7d..383e8bb0 100644 --- a/ginac/coloridx.cpp +++ b/ginac/coloridx.cpp @@ -26,7 +26,9 @@ #include "utils.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -213,4 +215,6 @@ bool coloridx::info(unsigned inf) const const coloridx some_coloridx; type_info const & typeid_coloridx=typeid(some_coloridx); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/coloridx.h b/ginac/coloridx.h index 7861c899..105f4a35 100644 --- a/ginac/coloridx.h +++ b/ginac/coloridx.h @@ -28,7 +28,9 @@ #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE class coloridx : public idx { @@ -82,6 +84,8 @@ inline const coloridx &ex_to_coloridx(const ex &e) return static_cast(*e.bp); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_COLORIDX_H__ diff --git a/ginac/constant.cpp b/ginac/constant.cpp index f21c05e8..12e9dde4 100644 --- a/ginac/constant.cpp +++ b/ginac/constant.cpp @@ -28,7 +28,9 @@ #include "ex.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -165,4 +167,6 @@ const constant EulerGamma("EulerGamma", EulerGammaEvalf); * Diverts straight into CLN for evalf(). */ const constant Catalan("Catalan", CatalanEvalf); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/constant.h b/ginac/constant.h index 89cb7eba..04fdc50a 100644 --- a/ginac/constant.h +++ b/ginac/constant.h @@ -26,7 +26,9 @@ #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE /** This class holds constants, symbols with specific numerical value. Each * object of this class must either provide their own function to evaluate it @@ -90,6 +92,8 @@ extern const constant Pi; extern const constant Catalan; extern const constant EulerGamma; +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_CONSTANT_H__ diff --git a/ginac/container.pl b/ginac/container.pl index 798d6868..02893995 100755 --- a/ginac/container.pl +++ b/ginac/container.pl @@ -123,12 +123,19 @@ $interface=< + +// CINT needs to work properly with and +#include + #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE -typedef ${STLHEADER} ${STLT}; +// typedef ${STLHEADER} ${STLT}; +typedef ${STLHEADER} ${STLT}; // CINT does not like ${STLHEADER}<...,default_alloc> class ${CONTAINER} : public basic { @@ -223,7 +230,9 @@ inline const ${CONTAINER} &ex_to_${CONTAINER}(const ex &e) return static_cast(*e.bp); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_${CONTAINER_UC}_H__ @@ -269,7 +278,9 @@ $implementation=< #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE class ex; class expand_options; @@ -36,7 +38,7 @@ class status_flags; class symbol; class lst; -typedef vector exvector; +// typedef vector exvector; // enum definitions @@ -284,6 +286,9 @@ inline ex subs(ex const & thisex, lst const & ls, lst const & lr) inline void swap(ex & e1, ex & e2) { e1.swap(e2); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_EX_H__ + diff --git a/ginac/expair.h b/ginac/expair.h index 320de73e..b130465b 100644 --- a/ginac/expair.h +++ b/ginac/expair.h @@ -26,7 +26,9 @@ #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE /** A pair of expressions. * This similar to, but slightly extended STL's pair<> but we need to account @@ -197,6 +199,8 @@ public: } }; +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_EXPAIR_H__ diff --git a/ginac/expairseq.cpp b/ginac/expairseq.cpp index 360c7b97..2e50b0e4 100644 --- a/ginac/expairseq.cpp +++ b/ginac/expairseq.cpp @@ -29,7 +29,9 @@ #include "debugmsg.h" #include "utils.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE #ifdef EXPAIRSEQ_USE_HASHTAB #error "FIXME: expair_needs_further_processing not yet implemented for hashtabs, sorry. A.F." @@ -1627,4 +1629,6 @@ unsigned expairseq::hashtabfactor=1; const expairseq some_expairseq; type_info const & typeid_expairseq=typeid(some_expairseq); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/expairseq.h b/ginac/expairseq.h index a14cecaa..72ac829c 100644 --- a/ginac/expairseq.h +++ b/ginac/expairseq.h @@ -25,9 +25,15 @@ #include #include + +// CINT needs to work properly with and +//#include + #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE //#define EXPAIRSEQ_USE_HASHTAB @@ -194,6 +200,8 @@ inline const expairseq &ex_to_expairseq(const ex &e) return static_cast(*e.bp); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_EXPAIRSEQ_H__ diff --git a/ginac/exprseq_suppl.cpp b/ginac/exprseq_suppl.cpp index 8ac31b8b..ef5f1c5b 100644 --- a/ginac/exprseq_suppl.cpp +++ b/ginac/exprseq_suppl.cpp @@ -24,7 +24,9 @@ #include "exprseq.h" #include "ex.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE bool exprseq::info(unsigned inf) const { @@ -40,4 +42,6 @@ ex & exprseq::let_op(int const i) return seq[i]; } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/fail.cpp b/ginac/fail.cpp index e5800a38..d4997196 100644 --- a/ginac/fail.cpp +++ b/ginac/fail.cpp @@ -24,7 +24,9 @@ #include "fail.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -123,4 +125,6 @@ int fail::compare_same_type(basic const & other) const const fail some_fail; type_info const & typeid_fail=typeid(some_fail); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/fail.h b/ginac/fail.h index 7edc7b1b..292bf797 100644 --- a/ginac/fail.h +++ b/ginac/fail.h @@ -26,7 +26,9 @@ #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE class fail : public basic { @@ -69,6 +71,8 @@ protected: extern const fail some_fail; extern type_info const & typeid_fail; +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_FAIL_H__ diff --git a/ginac/flags.h b/ginac/flags.h index 90f4e38d..6a1bfa4d 100644 --- a/ginac/flags.h +++ b/ginac/flags.h @@ -23,7 +23,9 @@ #ifndef __GINAC_FLAGS_H__ #define __GINAC_FLAGS_H__ +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE class expand_options { public: @@ -114,6 +116,8 @@ public: }; }; +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_FLAGS_H__ diff --git a/ginac/function.pl b/ginac/function.pl index 0e6cacfc..6493042b 100755 --- a/ginac/function.pl +++ b/ginac/function.pl @@ -31,15 +31,25 @@ sub generate { return $res; } -$declare_function_macro=generate( - <<'END_OF_DECLARE_FUNCTION_MACRO','GiNaC::ex const & p${N}','p${N}'); +$declare_function_macro_namespace=generate( + <<'END_OF_DECLARE_FUNCTION_MACRO_NAMESPACE','GiNaC::ex const & p${N}','p${N}'); #define DECLARE_FUNCTION_${N}P(NAME) \\ extern const unsigned function_index_##NAME; \\ inline GiNaC::function NAME(${SEQ1}) { \\ return GiNaC::function(function_index_##NAME, ${SEQ2}); \\ } -END_OF_DECLARE_FUNCTION_MACRO +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) \\ +extern unsigned function_index_##NAME; \\ +inline function NAME(${SEQ1}) { \\ + return function(function_index_##NAME, ${SEQ2}); \\ +} + +END_OF_DECLARE_FUNCTION_MACRO_NO_NAMESPACE $typedef_eval_funcp=generate( 'typedef ex (* eval_funcp_${N})(${SEQ1});'."\n", @@ -148,15 +158,40 @@ $interface=< #include + +#ifdef __CINT__ +// CINT needs to work properly with +#include +#endif // def __CINT__ + #include +#ifndef NO_GINAC_NAMESPACE + // the following lines have been generated for max. ${maxargs} parameters -$declare_function_macro +$declare_function_macro_namespace // end of generated lines +#else // ndef NO_GINAC_NAMESPACE + +// the following lines have been generated for max. ${maxargs} parameters +$declare_function_macro_no_namespace +// end of generated lines + +#endif // ndef NO_GINAC_NAMESPACE + +#ifndef NO_GINAC_NAMESPACE + #define REGISTER_FUNCTION(NAME,E,EF,D,S) \\ + const unsigned function_index_##NAME=GiNaC::function::register_new(#NAME,E,EF,D,S); +#else // ndef NO_GINAC_NAMESPACE + +const unsigned function_index_##NAME=function::register_new(#NAME,E,EF,D,S); + +#endif // ndef NO_GINAC_NAMESPACE + #define BEGIN_TYPECHECK \\ bool automatic_typecheck=true; @@ -165,18 +200,31 @@ if (!is_ex_exactly_of_type(VAR,TYPE)) { \\ automatic_typecheck=false; \\ } else +#ifndef NO_GINAC_NAMESPACE + #define TYPECHECK_INTEGER(VAR) \\ if (!(VAR).info(GiNaC::info_flags::integer)) { \\ automatic_typecheck=false; \\ } else +#else // ndef NO_GINAC_NAMESPACE + +#define TYPECHECK_INTEGER(VAR) \\ +if (!(VAR).info(info_flags::integer)) { \\ + automatic_typecheck=false; \\ +} else + +#endif // ndef NO_GINAC_NAMESPACE + #define END_TYPECHECK(RV) \\ {} \\ if (!automatic_typecheck) { \\ return RV.hold(); \\ } +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE class function; @@ -206,6 +254,7 @@ struct registered_function_info { and user defined functions */ class function : public exprseq { + // CINT has a linking problem friend void ginsh_get_ginac_functions(void); // member functions @@ -271,15 +320,26 @@ protected: // utility macros +#ifndef NO_GINAC_NAMESPACE + #define is_ex_the_function(OBJ, FUNCNAME) \\ (is_ex_exactly_of_type(OBJ, function) && static_cast(OBJ.bp)->getserial() == function_index_##FUNCNAME) +#else // ndef NO_GINAC_NAMESPACE + +#define is_ex_the_function(OBJ, FUNCNAME) \\ + (is_ex_exactly_of_type(OBJ, function) && static_cast(OBJ.bp)->getserial() == function_index_##FUNCNAME) + +#endif // ndef NO_GINAC_NAMESPACE + // global constants extern const function some_function; extern type_info const & typeid_function; +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_FUNCTION_H__ @@ -319,7 +379,9 @@ $implementation=< -#include +//#include #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE class idx : public basic { @@ -100,7 +102,7 @@ inline const idx &ex_to_idx(const ex &e) // global functions -typedef vector exvector; +// typedef vector exvector; int canonicalize_indices(exvector & iv, bool antisymmetric=false); exvector idx_intersect(exvector const & iv1, exvector const & iv2); @@ -111,6 +113,8 @@ ex subs_indices(ex const & e, exvector const & idxv_contra, exvector const & idxv_co); unsigned count_index(ex const & e, ex const & i); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_IDX_H__ diff --git a/ginac/indexed.cpp b/ginac/indexed.cpp index 6e36eb30..0364d997 100644 --- a/ginac/indexed.cpp +++ b/ginac/indexed.cpp @@ -27,7 +27,9 @@ #include "idx.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -292,4 +294,6 @@ bool indexed::all_of_type_idx(void) const const indexed some_indexed; type_info const & typeid_indexed=typeid(some_indexed); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/indexed.h b/ginac/indexed.h index 3707e629..a731769b 100644 --- a/ginac/indexed.h +++ b/ginac/indexed.h @@ -26,7 +26,9 @@ #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE /** Base class for non-commutative indexed objects */ class indexed : public exprseq @@ -94,6 +96,8 @@ inline const indexed &ex_to_indexed(const ex &e) return static_cast(*e.bp); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_INDEXED_H__ diff --git a/ginac/inifcns.cpp b/ginac/inifcns.cpp index 3f67d848..25eaae0d 100644 --- a/ginac/inifcns.cpp +++ b/ginac/inifcns.cpp @@ -36,7 +36,9 @@ #include "series.h" #include "symbol.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // dilogarithm @@ -252,4 +254,6 @@ ex ncpower(ex const &basis, unsigned exponent) unsigned force_include_gamma = function_index_gamma; unsigned force_include_zeta = function_index_zeta; +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/inifcns.h b/ginac/inifcns.h index 8be87d64..84e0dbcb 100644 --- a/ginac/inifcns.h +++ b/ginac/inifcns.h @@ -26,7 +26,9 @@ #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE /** Sine. */ DECLARE_FUNCTION_1P(sin) @@ -116,6 +118,8 @@ inline bool is_order_function(ex const & e) return is_ex_the_function(e, Order); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_INIFCNS_H__ diff --git a/ginac/inifcns_gamma.cpp b/ginac/inifcns_gamma.cpp index 5610d48e..2fd58cce 100644 --- a/ginac/inifcns_gamma.cpp +++ b/ginac/inifcns_gamma.cpp @@ -31,7 +31,9 @@ #include "power.h" #include "symbol.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // Gamma-function @@ -197,4 +199,6 @@ static ex psi2_diff(ex const & n, ex const & x, unsigned diff_param) const unsigned function_index_psi2 = function::register_new("psi", psi2_eval, psi2_evalf, psi2_diff, NULL); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/inifcns_trans.cpp b/ginac/inifcns_trans.cpp index db502ca9..01711a7f 100644 --- a/ginac/inifcns_trans.cpp +++ b/ginac/inifcns_trans.cpp @@ -30,7 +30,9 @@ #include "numeric.h" #include "power.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // exponential function @@ -740,4 +742,6 @@ static ex atanh_diff(ex const & x, unsigned diff_param) REGISTER_FUNCTION(atanh, atanh_eval, atanh_evalf, atanh_diff, NULL); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/inifcns_zeta.cpp b/ginac/inifcns_zeta.cpp index cd638765..c2a298a9 100644 --- a/ginac/inifcns_zeta.cpp +++ b/ginac/inifcns_zeta.cpp @@ -30,7 +30,9 @@ #include "power.h" #include "symbol.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // Riemann's Zeta-function @@ -85,4 +87,6 @@ static ex zeta_series(ex const & x, symbol const & s, ex const & point, int orde REGISTER_FUNCTION(zeta, zeta_eval, zeta_evalf, zeta_diff, zeta_series); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/isospin.cpp b/ginac/isospin.cpp index e5288e9c..8b80a97c 100644 --- a/ginac/isospin.cpp +++ b/ginac/isospin.cpp @@ -29,7 +29,9 @@ #include "utils.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -211,4 +213,7 @@ unsigned isospin::next_serial=0; const isospin some_isospin; type_info const & typeid_isospin=typeid(some_isospin); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE + diff --git a/ginac/isospin.h b/ginac/isospin.h index c4d23864..0d25a2a9 100644 --- a/ginac/isospin.h +++ b/ginac/isospin.h @@ -26,7 +26,9 @@ #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE /** Base class for isospin object */ class isospin : public indexed @@ -89,6 +91,8 @@ inline const isospin &ex_to_isospin(const ex &e) return static_cast(*e.bp); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_ISOSPIN_H__ diff --git a/ginac/lorentzidx.cpp b/ginac/lorentzidx.cpp index 6d09ee1f..62b01aa4 100644 --- a/ginac/lorentzidx.cpp +++ b/ginac/lorentzidx.cpp @@ -26,7 +26,9 @@ #include "utils.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -251,4 +253,6 @@ lorentzidx lorentzidx::create_anonymous_representative(void) const const lorentzidx some_lorentzidx; type_info const & typeid_lorentzidx=typeid(some_lorentzidx); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/lorentzidx.h b/ginac/lorentzidx.h index 1a429021..260296ef 100644 --- a/ginac/lorentzidx.h +++ b/ginac/lorentzidx.h @@ -27,7 +27,9 @@ #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE class lorentzidx : public idx { @@ -89,6 +91,8 @@ inline const lorentzidx &ex_to_lorentzidx(const ex &e) return static_cast(*e.bp); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_LORENTZIDX_H__ diff --git a/ginac/lst_suppl.cpp b/ginac/lst_suppl.cpp index 927a503c..67c7e5be 100644 --- a/ginac/lst_suppl.cpp +++ b/ginac/lst_suppl.cpp @@ -23,7 +23,9 @@ #include "lst.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE bool lst::info(unsigned inf) const { @@ -31,4 +33,6 @@ bool lst::info(unsigned inf) const return basic::info(inf); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/matrix.cpp b/ginac/matrix.cpp index bacacad8..43288df4 100644 --- a/ginac/matrix.cpp +++ b/ginac/matrix.cpp @@ -26,7 +26,9 @@ #include "matrix.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor, assignment operator @@ -872,4 +874,6 @@ int matrix::pivot(int ro) const matrix some_matrix; type_info const & typeid_matrix=typeid(some_matrix); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/matrix.h b/ginac/matrix.h index 769647ca..4ad11ea8 100644 --- a/ginac/matrix.h +++ b/ginac/matrix.h @@ -27,7 +27,9 @@ #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE /** Symbolic matrices. */ class matrix : public basic @@ -152,6 +154,8 @@ inline const matrix &ex_to_matrix(const ex &e) return static_cast(*e.bp); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_MATRIX_H__ diff --git a/ginac/mul.cpp b/ginac/mul.cpp index 78f2bd9e..9155b1a9 100644 --- a/ginac/mul.cpp +++ b/ginac/mul.cpp @@ -28,7 +28,9 @@ #include "power.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -1014,4 +1016,6 @@ unsigned mul::precedence=50; const mul some_mul; type_info const & typeid_mul=typeid(some_mul); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/mul.h b/ginac/mul.h index 19dad491..76546eb0 100644 --- a/ginac/mul.h +++ b/ginac/mul.h @@ -25,7 +25,9 @@ #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE /** Product of expressions. */ class mul : public expairseq @@ -119,6 +121,8 @@ inline const mul &ex_to_mul(const ex &e) return static_cast(*e.bp); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_MUL_H__ diff --git a/ginac/ncmul.cpp b/ginac/ncmul.cpp index 515a870c..9e14edc0 100644 --- a/ginac/ncmul.cpp +++ b/ginac/ncmul.cpp @@ -30,7 +30,9 @@ #include "mul.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -591,4 +593,6 @@ ex simplified_ncmul(exvector const & v) status_flags::evaluated); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/ncmul.h b/ginac/ncmul.h index 03b47ca7..de48b59e 100644 --- a/ginac/ncmul.h +++ b/ginac/ncmul.h @@ -25,7 +25,9 @@ #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE /** Non-commutative product of expressions. */ class ncmul : public exprseq @@ -114,6 +116,8 @@ inline const ncmul &ex_to_ncmul(const ex &e) return static_cast (*e.bp); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_NCMUL_H__ diff --git a/ginac/normal.cpp b/ginac/normal.cpp index 391b80b6..3846f408 100644 --- a/ginac/normal.cpp +++ b/ginac/normal.cpp @@ -46,7 +46,9 @@ #include "series.h" #include "symbol.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE // If comparing expressions (ex::compare()) is fast, you can set this to 1. // Some routines like quo(), rem() and gcd() will then return a quick answer @@ -908,7 +910,11 @@ ex basic::smod(const numeric &xi) const ex numeric::smod(const numeric &xi) const { +#ifndef NO_GINAC_NAMESPACE return GiNaC::smod(*this, xi); +#else // ndef NO_GINAC_NAMESPACE + return ::smod(*this, xi); +#endif // ndef NO_GINAC_NAMESPACE } ex add::smod(const numeric &xi) const @@ -919,13 +925,21 @@ ex add::smod(const numeric &xi) const epvector::const_iterator itend = seq.end(); while (it != itend) { GINAC_ASSERT(!is_ex_exactly_of_type(it->rest,numeric)); +#ifndef NO_GINAC_NAMESPACE numeric coeff = GiNaC::smod(ex_to_numeric(it->coeff), xi); +#else // ndef NO_GINAC_NAMESPACE + numeric coeff = ::smod(ex_to_numeric(it->coeff), xi); +#endif // ndef NO_GINAC_NAMESPACE if (!coeff.is_zero()) newseq.push_back(expair(it->rest, coeff)); it++; } GINAC_ASSERT(is_ex_exactly_of_type(overall_coeff,numeric)); +#ifndef NO_GINAC_NAMESPACE numeric coeff = GiNaC::smod(ex_to_numeric(overall_coeff), xi); +#else // ndef NO_GINAC_NAMESPACE + numeric coeff = ::smod(ex_to_numeric(overall_coeff), xi); +#endif // ndef NO_GINAC_NAMESPACE return (new add(newseq,coeff))->setflag(status_flags::dynallocated); } @@ -941,7 +955,11 @@ ex mul::smod(const numeric &xi) const #endif // def DO_GINAC_ASSERT mul * mulcopyp=new mul(*this); GINAC_ASSERT(is_ex_exactly_of_type(overall_coeff,numeric)); +#ifndef NO_GINAC_NAMESPACE mulcopyp->overall_coeff = GiNaC::smod(ex_to_numeric(overall_coeff),xi); +#else // ndef NO_GINAC_NAMESPACE + mulcopyp->overall_coeff = ::smod(ex_to_numeric(overall_coeff),xi); +#endif // ndef NO_GINAC_NAMESPACE mulcopyp->clearflag(status_flags::evaluated); mulcopyp->clearflag(status_flags::hash_calculated); return mulcopyp->setflag(status_flags::dynallocated); @@ -1484,4 +1502,6 @@ ex ex::normal(int level) const return e; } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/normal.h b/ginac/normal.h index 0fa3a441..6395ffe8 100644 --- a/ginac/normal.h +++ b/ginac/normal.h @@ -24,7 +24,9 @@ #ifndef __GINAC_NORMAL_H__ #define __GINAC_NORMAL_H__ +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE class ex; class symbol; @@ -50,6 +52,8 @@ extern ex lcm(const ex &a, const ex &b, bool check_args = true); // Square-free factorization of a polynomial a(x) extern ex sqrfree(const ex &a, const symbol &x); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_NORMAL_H__ diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index 1cc1fa69..4ab0c175 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -40,7 +40,9 @@ #include #endif +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE // linker has no problems finding text symbols for numerator or denominator //#define SANE_LINKER @@ -1453,4 +1455,6 @@ bool _numeric_digits::too_late = false; * assignment from C++ unsigned ints and evaluated like any built-in type. */ _numeric_digits Digits; +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/numeric.h b/ginac/numeric.h index eb356590..b7acbcea 100644 --- a/ginac/numeric.h +++ b/ginac/numeric.h @@ -30,7 +30,9 @@ class cl_N; // We want to include cln.h only in numeric.cpp in order to // avoid namespace pollution and keep compile-time low. +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE #define HASHVALUE_NUMERIC 0x80000001U @@ -329,6 +331,8 @@ inline const numeric &ex_to_numeric(const ex &e) return static_cast(*e.bp); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_NUMERIC_H__ diff --git a/ginac/operators.cpp b/ginac/operators.cpp index 4d762b30..c21e0ea6 100644 --- a/ginac/operators.cpp +++ b/ginac/operators.cpp @@ -31,7 +31,9 @@ #include "relational.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE // binary arithmetic operators ex with ex @@ -438,4 +440,6 @@ istream & operator>>(istream & is, ex & e) throw(std::logic_error("input from streams not yet implemented")); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/operators.h b/ginac/operators.h index fab2870b..01210fc1 100644 --- a/ginac/operators.h +++ b/ginac/operators.h @@ -25,7 +25,9 @@ #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE class ex; class numeric; @@ -129,6 +131,8 @@ relational operator>=(numeric const & lh, ex const & rh); ostream & operator<<(ostream & os, ex const & e); istream & operator>>(istream & is, ex & e); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_OPERATORS_H__ diff --git a/ginac/power.cpp b/ginac/power.cpp index bed6ed2f..64dd1fdc 100644 --- a/ginac/power.cpp +++ b/ginac/power.cpp @@ -33,7 +33,9 @@ #include "symbol.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE typedef vector intvector; @@ -721,4 +723,6 @@ unsigned power::precedence=60; const power some_power; type_info const & typeid_power=typeid(some_power); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/power.h b/ginac/power.h index 3d9ae574..25f4f8d7 100644 --- a/ginac/power.h +++ b/ginac/power.h @@ -26,7 +26,9 @@ #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE class numeric; class add; @@ -125,6 +127,8 @@ inline ex pow(ex const & b, ex const & e) inline ex sqrt(ex const & a) { return power(a,exHALF()); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_POWER_H__ diff --git a/ginac/print.cpp b/ginac/print.cpp index f90a40ce..c1e9841c 100644 --- a/ginac/print.cpp +++ b/ginac/print.cpp @@ -41,7 +41,9 @@ #include "symbol.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE void ex::print(ostream & os, unsigned upper_precedence) const { @@ -259,4 +261,6 @@ void matrix::print(ostream & os, unsigned upper_precedence) const os << m[row*col-1] << "]] ]]"; } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/printcsrc.cpp b/ginac/printcsrc.cpp index 2d0ccfd3..723b862b 100644 --- a/ginac/printcsrc.cpp +++ b/ginac/printcsrc.cpp @@ -39,7 +39,9 @@ #include "symbol.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE /** Print expression as a C++ statement. The output looks like * " = ;". The "type" parameter has an effect @@ -330,4 +332,6 @@ void relational::printcsrc(ostream & os, unsigned type, unsigned upper_precedenc os << ")"; } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/printraw.cpp b/ginac/printraw.cpp index 31f56065..331622a7 100644 --- a/ginac/printraw.cpp +++ b/ginac/printraw.cpp @@ -45,7 +45,9 @@ #include "symbol.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE void ex::printraw(ostream & os) const { @@ -225,4 +227,6 @@ void matrix::printraw(ostream & os) const os << m[row*col-1] << "))"; } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/printtree.cpp b/ginac/printtree.cpp index 99cf56e0..645799e1 100644 --- a/ginac/printtree.cpp +++ b/ginac/printtree.cpp @@ -40,7 +40,9 @@ #include "symbol.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE void ex::printtree(ostream & os, unsigned indent) const { @@ -181,4 +183,6 @@ void expairseq::printtree(ostream & os, unsigned indent) const #endif // def EXPAIRSEQ_USE_HASHTAB } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/relational.cpp b/ginac/relational.cpp index 76652e98..76bd7da2 100644 --- a/ginac/relational.cpp +++ b/ginac/relational.cpp @@ -26,7 +26,9 @@ #include "numeric.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -264,4 +266,6 @@ unsigned relational::precedence=20; const relational some_relational; type_info const & typeid_relational=typeid(some_relational); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/relational.h b/ginac/relational.h index 7426e19e..2767c89b 100644 --- a/ginac/relational.h +++ b/ginac/relational.h @@ -26,7 +26,9 @@ #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE /** This class holds a relation consisting of two expressions and a logical * relation between them. */ @@ -103,6 +105,8 @@ inline const relational &ex_to_relational(const ex &e) return static_cast(*e.bp); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_RELATIONAL_H__ diff --git a/ginac/series.cpp b/ginac/series.cpp index a390dd15..7f8d3928 100644 --- a/ginac/series.cpp +++ b/ginac/series.cpp @@ -30,8 +30,9 @@ #include "symbol.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { - +#endif // ndef NO_GINAC_NAMESPACE /* * Default constructor, destructor, copy constructor, assignment operator and helpers @@ -636,4 +637,6 @@ ex ex::series(symbol const &s, ex const &point, int order) const const series some_series; type_info const & typeid_series = typeid(some_series); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/series.h b/ginac/series.h index 5df4d822..08f859ff 100644 --- a/ginac/series.h +++ b/ginac/series.h @@ -26,7 +26,9 @@ #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE /** This class holds a extended truncated power series (positive and negative * integer powers). It consists of expression coefficients (only non-zero @@ -113,6 +115,8 @@ inline ex series_to_poly(const ex &e) return (static_cast(*e.bp).convert_to_poly(true)); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_SERIES_H__ diff --git a/ginac/simp_lor.cpp b/ginac/simp_lor.cpp index 05f96ae1..a102b74e 100644 --- a/ginac/simp_lor.cpp +++ b/ginac/simp_lor.cpp @@ -34,7 +34,9 @@ #include "symbol.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -513,4 +515,6 @@ spmapkey scalar_products::make_key(simp_lor const & v1, simp_lor const & v2) return spmapkey(strstrpair(v1.name,v2.name),anon); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/simp_lor.h b/ginac/simp_lor.h index 643a6d91..44543fc8 100644 --- a/ginac/simp_lor.h +++ b/ginac/simp_lor.h @@ -31,7 +31,9 @@ #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE typedef pair strstrpair; typedef pair spmapkey; @@ -170,6 +172,8 @@ ex simplify_simp_lor_mul(ex const & m, scalar_products const & sp); ex simplify_simp_lor(ex const & e, scalar_products const & sp); ex Dim(void); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef _SIMP__GINAC_LOR_H__ diff --git a/ginac/structure.cpp b/ginac/structure.cpp index 539eaf76..76ee847d 100644 --- a/ginac/structure.cpp +++ b/ginac/structure.cpp @@ -25,7 +25,9 @@ #include "structure.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -175,4 +177,6 @@ unsigned structure::register_new(char const * nm) const structure some_structure; type_info const & typeid_structure=typeid(some_structure); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/structure.h b/ginac/structure.h index 34788875..abde78d7 100644 --- a/ginac/structure.h +++ b/ginac/structure.h @@ -25,7 +25,9 @@ #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE struct registered_structure_info { char const * name; @@ -84,6 +86,8 @@ public: extern const structure some_structure; extern type_info const & typeid_structure; +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_STRUCTURE_H__ diff --git a/ginac/structure.pl b/ginac/structure.pl index 2ae1625a..d26f78a8 100755 --- a/ginac/structure.pl +++ b/ginac/structure.pl @@ -150,7 +150,9 @@ ${input_structure} #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE class ${STRUCTURE} : public structure { @@ -215,7 +217,9 @@ extern const unsigned tinfo_${STRUCTURE}; #define ex_to_${STRUCTURE}(X) (static_cast<${STRUCTURE} const &>(*(X).bp)) +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef _${STRUCTURE_UC}_H_ @@ -254,7 +258,9 @@ ${input_structure} #include "${STRUCTURE}.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -508,7 +514,9 @@ const ${STRUCTURE} some_${STRUCTURE}; type_info const & typeid_${STRUCTURE}=typeid(some_${STRUCTURE}); const unsigned tinfo_${STRUCTURE}=structure::register_new("${STRUCTURE}"); +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE END_OF_IMPLEMENTATION diff --git a/ginac/symbol.cpp b/ginac/symbol.cpp index f1dc18df..1bea2cec 100644 --- a/ginac/symbol.cpp +++ b/ginac/symbol.cpp @@ -29,7 +29,9 @@ #include "idx.h" #include "debugmsg.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -281,4 +283,6 @@ symbol::assigned_ex_info::assigned_ex_info(void) : is_assigned(0), refcount(1) { } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/symbol.h b/ginac/symbol.h index 9905f3c8..d315efc5 100644 --- a/ginac/symbol.h +++ b/ginac/symbol.h @@ -27,7 +27,9 @@ #include #include +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE /** Basic CAS symbol. It has a name because it must know how to output itself. * It may be assigned an expression, but this feature is only intended for @@ -127,6 +129,8 @@ inline int degree(symbol const & a, symbol const & s) inline int ldegree(symbol const & a, symbol const & s) { return a.ldegree(s); } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_SYMBOL_H__ diff --git a/ginac/tinfos.h b/ginac/tinfos.h index 2c807b12..d13e2b95 100644 --- a/ginac/tinfos.h +++ b/ginac/tinfos.h @@ -23,7 +23,9 @@ #ifndef __GINAC_TINFOS_H__ #define __GINAC_TINFOS_H__ +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE const unsigned TINFO_basic = 0x00000001U; @@ -67,6 +69,8 @@ const unsigned TINFO_idx = 0x000d0001U; const unsigned TINFO_coloridx = 0x000d1001U; const unsigned TINFO_lorentzidx = 0x000d1002U; +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_TINFOS_H__ diff --git a/ginac/utils.cpp b/ginac/utils.cpp index 0c99ad59..7592e403 100644 --- a/ginac/utils.cpp +++ b/ginac/utils.cpp @@ -22,7 +22,9 @@ #include "utils.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE /** Integer binary logarithm */ unsigned log2(unsigned n) @@ -119,4 +121,6 @@ int compare_pointers(void const * a, void const * b) // private // none +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE diff --git a/ginac/utils.h b/ginac/utils.h index 3c33162e..18a5e7bd 100644 --- a/ginac/utils.h +++ b/ginac/utils.h @@ -28,7 +28,9 @@ #include "config.h" #include "assertion.h" +#ifndef NO_GINAC_NAMESPACE namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE template string ToString(T const & t) @@ -131,6 +133,8 @@ OutputIterator mymerge3(InputIterator1 first1, InputIterator1 last1, } } +#ifndef NO_GINAC_NAMESPACE } // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_UTILS_H__ diff --git a/ginsh/ginsh.h b/ginsh/ginsh.h index c225fb09..2d32f0e7 100644 --- a/ginsh/ginsh.h +++ b/ginsh/ginsh.h @@ -42,7 +42,10 @@ extern "C" { #endif #include + +#ifndef NO_GINAC_NAMESPACE using namespace GiNaC; +#endif // ndef NO_GINAC_NAMESPACE // yacc stack type #define YYSTYPE ex diff --git a/ginsh/ginsh_parser.yy b/ginsh/ginsh_parser.yy index f8702d2a..b8409ea0 100644 --- a/ginsh/ginsh_parser.yy +++ b/ginsh/ginsh_parser.yy @@ -554,7 +554,10 @@ static ex f_ginac_function(const exprseq &es, int serial) } // All registered GiNaC functions -void GiNaC::ginsh_get_ginac_functions(void) +#ifndef NO_GINAC_NAMESPACE +#else // ndef NO_GINAC_NAMESPACE +void ginsh_get_ginac_functions(void) +#endif // ndef NO_GINAC_NAMESPACE { vector::const_iterator i = function::registered_functions().begin(), end = function::registered_functions().end(); unsigned serial = 0;