]> www.ginac.de Git - ginac.git/blobdiff - ginac/structure.pl
* fixed some mindboggling tremendous superhuge gigantic #*@$&! memory leaks.
[ginac.git] / ginac / structure.pl
index 7521016a377e2013188261c485d0dd5ca74ac205..901c5722d11da5b2f459d2d83c83a0cc3cc35b47 100755 (executable)
@@ -125,7 +125,7 @@ $interface=<<END_OF_INTERFACE;
  *  This file was generated automatically by structure.pl.
  *  Please do not modify it directly, edit the perl script instead!
  *
- *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2001 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
@@ -150,15 +150,13 @@ ${input_structure}
 
 #include "structure.h"
 
-#ifndef NO_NAMESPACE_GINAC
 namespace GiNaC {
-#endif // ndef NO_NAMESPACE_GINAC
 
 class ${STRUCTURE} : public structure
 {
 // member functions
 
-       // default constructor, destructor, copy constructor assignment operator and helpers
+       // default ctor, dtor, copy ctor assignment operator and helpers
 public:
        ${STRUCTURE}();
        ~${STRUCTURE}();
@@ -168,16 +166,14 @@ protected:
        void copy(${STRUCTURE} const & other);
        void destroy(bool call_parent);
 
-       // other constructors
+       // other ctors
 public:
        ${STRUCTURE}(${constructor_arglist});
 
        // functions overriding virtual functions from bases classes
 public:
        basic * duplicate() const;
-       void printraw(ostream & os) const;
-       void print(ostream & os, unsigned upper_precedence=0) const;
-       void printtree(ostream & os, unsigned indent) const;
+       void print(const print_context & c, unsigned level = 0) const;
        int nops() const;
        ex & let_op(int i);
        ex expand(unsigned options=0) const;
@@ -217,9 +213,7 @@ extern const unsigned tinfo_${STRUCTURE};
 
 #define ex_to_${STRUCTURE}(X) (static_cast<${STRUCTURE} const &>(*(X).bp))
 
-#ifndef NO_NAMESPACE_GINAC
 } // namespace GiNaC
-#endif // ndef NO_NAMESPACE_GINAC
 
 #endif // ndef _${STRUCTURE_UC}_H_
 
@@ -234,7 +228,7 @@ $implementation=<<END_OF_IMPLEMENTATION;
  *  This file was generated automatically by STRUCTURE.pl.
  *  Please do not modify it directly, edit the perl script instead!
  *
- *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2001 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
@@ -255,22 +249,22 @@ $implementation=<<END_OF_IMPLEMENTATION;
 ${input_structure}
 
 #include <iostream>
+#include <stdexcept>
 
 #include "${STRUCTURE}.h"
+#include "print.h"
 
-#ifndef NO_NAMESPACE_GINAC
 namespace GiNaC {
-#endif // ndef NO_NAMESPACE_GINAC
 
 //////////
-// default constructor, destructor, copy constructor assignment operator and helpers
+// default ctor, destructor, copy ctor assignment operator and helpers
 //////////
 
 // public
 
 ${STRUCTURE}::${STRUCTURE}()
 {
-       debugmsg("${STRUCTURE} default constructor",LOGLEVEL_CONSTRUCT);
+       debugmsg("${STRUCTURE} default ctor",LOGLEVEL_CONSTRUCT);
        tinfo_key=tinfo_${STRUCTURE};
 }
 
@@ -282,7 +276,7 @@ ${STRUCTURE}::~${STRUCTURE}()
 
 ${STRUCTURE}::${STRUCTURE}(${STRUCTURE} const & other)
 {
-       debugmsg("${STRUCTURE} copy constructor",LOGLEVEL_CONSTRUCT);
+       debugmsg("${STRUCTURE} copy ctor",LOGLEVEL_CONSTRUCT);
        copy(other);
 }
 
@@ -310,7 +304,7 @@ void ${STRUCTURE}::destroy(bool call_parent)
 }
 
 //////////
-// other constructors
+// other ctors
 //////////
 
 // public
@@ -318,7 +312,7 @@ void ${STRUCTURE}::destroy(bool call_parent)
 ${STRUCTURE}::${STRUCTURE}(${constructor_arglist}) 
        : ${constructor_statements}
 {
-       debugmsg("${STRUCTURE} constructor from children", LOGLEVEL_CONSTRUCT);
+       debugmsg("${STRUCTURE} ctor from children", LOGLEVEL_CONSTRUCT);
        tinfo_key=tinfo_${STRUCTURE};
 }
 
@@ -334,22 +328,10 @@ basic * ${STRUCTURE}::duplicate() const
        return new ${STRUCTURE}(*this);
 }
 
-void ${STRUCTURE}::printraw(ostream & os) const
+void ${STRUCTURE}::print(const print_context & c, unsigned level) const
 {
-       debugmsg("${STRUCTURE} printraw",LOGLEVEL_PRINT);
-       os << "${STRUCTURE}()";
-}
-
-void ${STRUCTURE}::print(ostream & os, unsigned upper_precedence) const
-{
-       debugmsg("${STRUCTURE} print",LOGLEVEL_PRINT);
-       os << "${STRUCTURE}()";
-}
-
-void ${STRUCTURE}::printtree(ostream & os, unsigned indent) const
-{
-       debugmsg("${STRUCTURE} printtree",LOGLEVEL_PRINT);
-       os << "${STRUCTURE}()";
+       debugmsg("${STRUCTURE} print", LOGLEVEL_PRINT);
+       c.s << class_name() << "()";
 }
 
 int ${STRUCTURE}::nops() const
@@ -365,8 +347,7 @@ ex & ${STRUCTURE}::let_op(int i)
        switch (i) {
 ${let_op_statements}
        }
-       errormsg("${STRUCTURE}::let_op(): should not reach this point");
-       return *new ex(fail());
+       throw(std::runtime_error("${STRUCTURE}::let_op(): should not have reached this point"));
 }
 
 ex ${STRUCTURE}::expand(unsigned options) const
@@ -513,9 +494,7 @@ const ${STRUCTURE} some_${STRUCTURE};
 const type_info & typeid_${STRUCTURE}=typeid(some_${STRUCTURE});
 const unsigned tinfo_${STRUCTURE}=structure::register_new("${STRUCTURE}");
 
-#ifndef NO_NAMESPACE_GINAC
 } // namespace GiNaC
-#endif // ndef NO_NAMESPACE_GINAC
 
 END_OF_IMPLEMENTATION