]> www.ginac.de Git - ginac.git/blobdiff - ginac/container.pl
#ifndef around namespace GiNaC { }
[ginac.git] / ginac / container.pl
index d7b860bc586d8290fd25a7bbbf14ca63f8aa5f6a..02893995da07e588f1346624f536799d72a48269 100755 (executable)
@@ -72,8 +72,8 @@ if ($let_op) {
     $LET_OP_IMPLEMENTATION=<<END_OF_LET_OP_IMPLEMENTATION
 ex & ${CONTAINER}::let_op(int const i)
 {
-    ASSERT(i>=0);
-    ASSERT(i<nops());
+    GINAC_ASSERT(i>=0);
+    GINAC_ASSERT(i<nops());
 
     ${STLT}::iterator it=seq.begin();
     for (int j=0; j<i; j++) {
@@ -89,7 +89,9 @@ END_OF_LET_OP_IMPLEMENTATION
 $interface=<<END_OF_INTERFACE;
 /** \@file ${CONTAINER}.h
  *
- *  Definition of GiNaC's ${CONTAINER}. 
+ *  Definition of GiNaC's ${CONTAINER}. */
+
+/*
  *  This file was generated automatically by container.pl.
  *  Please do not modify it directly, edit the perl script instead!
  *  container.pl options: \$CONTAINER=${CONTAINER}
@@ -98,16 +100,42 @@ $interface=<<END_OF_INTERFACE;
  *                        \$prepend=${prepend}
  *                        \$let_op=${let_op}
  *                        \$open_bracket=${open_bracket}
- *                        \$close_bracket=${close_bracket} */
+ *                        \$close_bracket=${close_bracket}
+ *
+ *  GiNaC Copyright (C) 1999 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
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
-#ifndef _${CONTAINER_UC}_H_
-#define _${CONTAINER_UC}_H_
+#ifndef __GINAC_${CONTAINER_UC}_H__
+#define __GINAC_${CONTAINER_UC}_H__
 
 #include <${STLHEADER}>
 
-#include <ginac/ginac.h>
+// CINT needs <algorithm> to work properly with <vector> and <list> 
+#include <algorithm>
+
+#include <ginac/basic.h>
+#include <ginac/ex.h>
 
-typedef ${STLHEADER}<ex> ${STLT};
+#ifndef NO_GINAC_NAMESPACE
+namespace GiNaC {
+#endif // ndef NO_GINAC_NAMESPACE
+
+// typedef ${STLHEADER}<ex> ${STLT};
+typedef ${STLHEADER}<ex,malloc_alloc> ${STLT}; // CINT does not like ${STLHEADER}<...,default_alloc>
 
 class ${CONTAINER} : public basic
 {
@@ -196,18 +224,26 @@ protected:
 extern const ${CONTAINER} some_${CONTAINER};
 extern type_info const & typeid_${CONTAINER};
 
-// macros
+// utility functions
+inline const ${CONTAINER} &ex_to_${CONTAINER}(const ex &e)
+{
+    return static_cast<const ${CONTAINER} &>(*e.bp);
+}
 
-#define ex_to_${CONTAINER}(X) (static_cast<${CONTAINER} const &>(*(X).bp))
+#ifndef NO_GINAC_NAMESPACE
+} // namespace GiNaC
+#endif // ndef NO_GINAC_NAMESPACE
 
-#endif // ndef _${CONTAINER_UC}_H_
+#endif // ndef __GINAC_${CONTAINER_UC}_H__
 
 END_OF_INTERFACE
 
 $implementation=<<END_OF_IMPLEMENTATION;
 /** \@file ${CONTAINER}.cpp
  *
- *  Implementation of GiNaC's ${CONTAINER}. 
+ *  Implementation of GiNaC's ${CONTAINER}. */
+
+/*
  *  This file was generated automatically by container.pl.
  *  Please do not modify it directly, edit the perl script instead!
  *  container.pl options: \$CONTAINER=${CONTAINER}
@@ -216,12 +252,35 @@ $implementation=<<END_OF_IMPLEMENTATION;
  *                        \$prepend=${prepend}
  *                        \$let_op=${let_op}
  *                        \$open_bracket=${open_bracket}
- *                        \$close_bracket=${close_bracket} */
+ *                        \$close_bracket=${close_bracket}
+ *
+ *  GiNaC Copyright (C) 1999 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
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
 #include <iostream>
 #include <stdexcept>
 
-#include "ginac.h"
+#include "${CONTAINER}.h"
+#include "ex.h"
+#include "debugmsg.h"
+
+#ifndef NO_GINAC_NAMESPACE
+namespace GiNaC {
+#endif // ndef NO_GINAC_NAMESPACE
 
 ${RESERVE_IMPLEMENTATION}
 
@@ -231,7 +290,7 @@ ${RESERVE_IMPLEMENTATION}
 
 // public
 
-${CONTAINER}::${CONTAINER}() : basic(TINFO_${CONTAINER_UC})
+${CONTAINER}::${CONTAINER}() : basic(TINFO_${CONTAINER})
 {
     debugmsg("${CONTAINER} default constructor",LOGLEVEL_CONSTRUCT);
 }
@@ -278,7 +337,7 @@ void ${CONTAINER}::destroy(bool call_parent)
 
 // public
 
-${CONTAINER}::${CONTAINER}(${STLT} const & s, bool discardable) :  basic(TINFO_${CONTAINER_UC})
+${CONTAINER}::${CONTAINER}(${STLT} const & s, bool discardable) :  basic(TINFO_${CONTAINER})
 {
     debugmsg("${CONTAINER} constructor from ${STLT}",
              LOGLEVEL_CONSTRUCT);
@@ -289,15 +348,15 @@ ${CONTAINER}::${CONTAINER}(${STLT} const & s, bool discardable) :  basic(TINFO_$
     }
 }
 
-${CONTAINER}::${CONTAINER}(${STLT} * vp) : basic(TINFO_${CONTAINER_UC})
+${CONTAINER}::${CONTAINER}(${STLT} * vp) : basic(TINFO_${CONTAINER})
 {
     debugmsg("${CONTAINER} constructor from ${STLT} *",LOGLEVEL_CONSTRUCT);
-    ASSERT(vp!=0);
+    GINAC_ASSERT(vp!=0);
     seq.swap(*vp);
     delete vp;
 }
 
-${CONTAINER}::${CONTAINER}(ex const & e1) :  basic(TINFO_${CONTAINER_UC})
+${CONTAINER}::${CONTAINER}(ex const & e1) :  basic(TINFO_${CONTAINER})
 {
     debugmsg("${CONTAINER} constructor from 1 ex",
              LOGLEVEL_CONSTRUCT);
@@ -305,7 +364,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1) :  basic(TINFO_${CONTAINER_UC})
     seq.push_back(e1);
 }
 
-${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2) : basic(TINFO_${CONTAINER_UC})
+${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2) : basic(TINFO_${CONTAINER})
 {
     debugmsg("${CONTAINER} constructor from 2 ex",
              LOGLEVEL_CONSTRUCT);
@@ -315,7 +374,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2) : basic(TINFO_${CONTAIN
 }
 
 ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3)
-    : basic(TINFO_${CONTAINER_UC})
+    : basic(TINFO_${CONTAINER})
 {
     debugmsg("${CONTAINER} constructor from 3 ex",
              LOGLEVEL_CONSTRUCT);
@@ -326,7 +385,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3)
 }
 
 ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
-                     ex const & e4) : basic(TINFO_${CONTAINER_UC})
+                     ex const & e4) : basic(TINFO_${CONTAINER})
 {
     debugmsg("${CONTAINER} constructor from 4 ex",
              LOGLEVEL_CONSTRUCT);
@@ -338,7 +397,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
 }
 
 ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
-                     ex const & e4, ex const & e5) : basic(TINFO_${CONTAINER_UC})
+                     ex const & e4, ex const & e5) : basic(TINFO_${CONTAINER})
 {
     debugmsg("${CONTAINER} constructor from 5 ex",
              LOGLEVEL_CONSTRUCT);
@@ -352,7 +411,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
 
 ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
                      ex const & e4, ex const & e5, ex const & e6)
-    : basic(TINFO_${CONTAINER_UC})
+    : basic(TINFO_${CONTAINER})
 {
     debugmsg("${CONTAINER} constructor from 6 ex",
              LOGLEVEL_CONSTRUCT);
@@ -367,7 +426,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
 
 ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
                      ex const & e4, ex const & e5, ex const & e6,
-                     ex const & e7) : basic(TINFO_${CONTAINER_UC})
+                     ex const & e7) : basic(TINFO_${CONTAINER})
 {
     debugmsg("${CONTAINER} constructor from 7 ex",
              LOGLEVEL_CONSTRUCT);
@@ -383,7 +442,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
 
 ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
                      ex const & e4, ex const & e5, ex const & e6,
-                     ex const & e7, ex const & e8) : basic(TINFO_${CONTAINER_UC})
+                     ex const & e7, ex const & e8) : basic(TINFO_${CONTAINER})
 {
     debugmsg("${CONTAINER} constructor from 8 ex",
              LOGLEVEL_CONSTRUCT);
@@ -401,7 +460,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
 ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
                      ex const & e4, ex const & e5, ex const & e6,
                      ex const & e7, ex const & e8, ex const & e9)
-    : basic(TINFO_${CONTAINER_UC})
+    : basic(TINFO_${CONTAINER})
 {
     debugmsg("${CONTAINER} constructor from 9 ex",
              LOGLEVEL_CONSTRUCT);
@@ -421,7 +480,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
                      ex const & e4, ex const & e5, ex const & e6,
                      ex const & e7, ex const & e8, ex const & e9,
                      ex const &e10)
-    : basic(TINFO_${CONTAINER_UC})
+    : basic(TINFO_${CONTAINER})
 {
     debugmsg("${CONTAINER} constructor from 10 ex",
              LOGLEVEL_CONSTRUCT);
@@ -507,7 +566,7 @@ ex ${CONTAINER}::expand(unsigned options) const
 
 bool ${CONTAINER}::has(ex const & other) const
 {
-    ASSERT(other.bp!=0);
+    GINAC_ASSERT(other.bp!=0);
     if (is_equal(*other.bp)) return true;
     for (${STLT}::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
         if ((*it).has(other)) return true;
@@ -555,7 +614,7 @@ ex ${CONTAINER}::subs(lst const & ls, lst const & lr) const
 
 int ${CONTAINER}::compare_same_type(basic const & other) const
 {
-    ASSERT(is_of_type(other,${CONTAINER}));
+    GINAC_ASSERT(is_of_type(other,${CONTAINER}));
     ${CONTAINER} const & o=static_cast<${CONTAINER} const &>
                                     (const_cast<basic &>(other));
     int cmpval;
@@ -576,7 +635,7 @@ int ${CONTAINER}::compare_same_type(basic const & other) const
 
 bool ${CONTAINER}::is_equal_same_type(basic const & other) const
 {
-    ASSERT(is_of_type(other,${CONTAINER}));
+    GINAC_ASSERT(is_of_type(other,${CONTAINER}));
     ${CONTAINER} const & o=static_cast<${CONTAINER} const &>
                                     (const_cast<basic &>(other));
     if (seq.size()!=o.seq.size()) return false;
@@ -799,6 +858,10 @@ unsigned ${CONTAINER}::precedence=10;
 const ${CONTAINER} some_${CONTAINER};
 type_info const & typeid_${CONTAINER}=typeid(some_${CONTAINER});
 
+#ifndef NO_GINAC_NAMESPACE
+} // namespace GiNaC
+#endif // ndef NO_GINAC_NAMESPACE
+
 END_OF_IMPLEMENTATION
 
 print "Creating interface file ${CONTAINER}.h...";