]> www.ginac.de Git - ginac.git/commitdiff
- New tinfo mechanism
authorJens Vollinga <vollinga@thep.physik.uni-mainz.de>
Thu, 19 Jan 2006 19:36:07 +0000 (19:36 +0000)
committerJens Vollinga <vollinga@thep.physik.uni-mainz.de>
Thu, 19 Jan 2006 19:36:07 +0000 (19:36 +0000)
  (Remark: return_type_tinfo returns basic* now)
- Removed rtt from class symbol.

58 files changed:
ginac/Makefile.am
ginac/add.cpp
ginac/add.h
ginac/basic.cpp
ginac/basic.h
ginac/clifford.cpp
ginac/clifford.h
ginac/color.cpp
ginac/color.h
ginac/constant.cpp
ginac/constant.h
ginac/container.h
ginac/ex.h
ginac/expairseq.cpp
ginac/expairseq.h
ginac/exprseq.cpp
ginac/exprseq.h
ginac/fail.h
ginac/fderivative.cpp
ginac/fderivative.h
ginac/function.pl
ginac/idx.cpp
ginac/idx.h
ginac/indexed.cpp
ginac/indexed.h
ginac/integral.cpp
ginac/integral.h
ginac/lst.cpp
ginac/lst.h
ginac/matrix.cpp
ginac/matrix.h
ginac/mul.cpp
ginac/mul.h
ginac/ncmul.cpp
ginac/ncmul.h
ginac/numeric.cpp
ginac/numeric.h
ginac/operators.cpp
ginac/power.cpp
ginac/power.h
ginac/pseries.cpp
ginac/pseries.h
ginac/registrar.cpp
ginac/registrar.h
ginac/relational.cpp
ginac/relational.h
ginac/structure.cpp [deleted file]
ginac/structure.h
ginac/symbol.cpp
ginac/symbol.h
ginac/symmetry.cpp
ginac/symmetry.h
ginac/tensor.cpp
ginac/tensor.h
ginac/tinfos.h [deleted file]
ginac/utils.h
ginac/wildcard.cpp
ginac/wildcard.h

index 7ae845500be832c1d553b57a0b2c83020f166ca5..54558958da8528c6a6b8a3adc962129e19f0ca50 100644 (file)
@@ -7,7 +7,7 @@ libginac_la_SOURCES = add.cpp archive.cpp basic.cpp clifford.cpp color.cpp \
   inifcns_trans.cpp inifcns_gamma.cpp inifcns_nstdsums.cpp \
   integral.cpp lst.cpp matrix.cpp mul.cpp ncmul.cpp normal.cpp numeric.cpp \
   operators.cpp power.cpp registrar.cpp relational.cpp remember.cpp \
-  pseries.cpp print.cpp structure.cpp symbol.cpp symmetry.cpp tensor.cpp \
+  pseries.cpp print.cpp symbol.cpp symmetry.cpp tensor.cpp \
   utils.cpp wildcard.cpp input_parser.yy input_lexer.ll \
   input_lexer.h remember.h tostring.h utils.h
 libginac_la_LDFLAGS = -version-info $(LT_VERSION_INFO) -release $(LT_RELEASE)
@@ -17,7 +17,7 @@ ginacinclude_HEADERS = ginac.h add.h archive.h assertion.h basic.h class_info.h
   exprseq.h fail.h fderivative.h flags.h function.h hash_map.h idx.h indexed.h \
   inifcns.h integral.h lst.h matrix.h mul.h ncmul.h normal.h numeric.h operators.h \
   power.h print.h pseries.h ptr.h registrar.h relational.h structure.h \
-  symbol.h symmetry.h tensor.h tinfos.h version.h wildcard.h
+  symbol.h symmetry.h tensor.h version.h wildcard.h
 AM_LFLAGS = -Pginac_yy -olex.yy.c
 AM_YFLAGS = -p ginac_yy -d
 EXTRA_DIST = function.pl input_parser.h version.h.in
index 74e639aebe27e0d003740c23ea5cc3278999cbbb..88024bdf29a6028b0a86ca6dab400bb3ead7d86f 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's sums of expressions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -47,7 +47,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(add, expairseq,
 
 add::add()
 {
-       tinfo_key = TINFO_add;
+       tinfo_key = &add::tinfo_static;
 }
 
 //////////
@@ -58,7 +58,7 @@ add::add()
 
 add::add(const ex & lh, const ex & rh)
 {
-       tinfo_key = TINFO_add;
+       tinfo_key = &add::tinfo_static;
        overall_coeff = _ex0;
        construct_from_2_ex(lh,rh);
        GINAC_ASSERT(is_canonical());
@@ -66,7 +66,7 @@ add::add(const ex & lh, const ex & rh)
 
 add::add(const exvector & v)
 {
-       tinfo_key = TINFO_add;
+       tinfo_key = &add::tinfo_static;
        overall_coeff = _ex0;
        construct_from_exvector(v);
        GINAC_ASSERT(is_canonical());
@@ -74,7 +74,7 @@ add::add(const exvector & v)
 
 add::add(const epvector & v)
 {
-       tinfo_key = TINFO_add;
+       tinfo_key = &add::tinfo_static;
        overall_coeff = _ex0;
        construct_from_epvector(v);
        GINAC_ASSERT(is_canonical());
@@ -82,7 +82,7 @@ add::add(const epvector & v)
 
 add::add(const epvector & v, const ex & oc)
 {
-       tinfo_key = TINFO_add;
+       tinfo_key = &add::tinfo_static;
        overall_coeff = oc;
        construct_from_epvector(v);
        GINAC_ASSERT(is_canonical());
@@ -90,7 +90,7 @@ add::add(const epvector & v, const ex & oc)
 
 add::add(std::auto_ptr<epvector> vp, const ex & oc)
 {
-       tinfo_key = TINFO_add;
+       tinfo_key = &add::tinfo_static;
        GINAC_ASSERT(vp.get()!=0);
        overall_coeff = oc;
        construct_from_epvector(*vp);
@@ -465,10 +465,10 @@ unsigned add::return_type() const
                return seq.begin()->rest.return_type();
 }
 
-unsigned add::return_type_tinfo() const
+const basic* add::return_type_tinfo() const
 {
        if (seq.empty())
-               return tinfo_key;
+               return this;
        else
                return seq.begin()->rest.return_type_tinfo();
 }
index ca7b9d57d706c61cca10556be7644af8a206c831..1b0873be8a3dfeabd6ae192d228830875c3df616 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to GiNaC's sums of expressions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -63,7 +63,7 @@ public:
 protected:
        ex derivative(const symbol & s) const;
        unsigned return_type() const;
-       unsigned return_type_tinfo() const;
+       const basic* return_type_tinfo() const;
        ex thisexpairseq(const epvector & v, const ex & oc) const;
        ex thisexpairseq(std::auto_ptr<epvector> vp, const ex & oc) const;
        expair split_ex_to_pair(const ex & e) const;
@@ -83,14 +83,6 @@ protected:
        void do_print_python_repr(const print_python_repr & c, unsigned level) const;
 };
 
-// utility functions
-
-/** Specialization of is_exactly_a<add>(obj) for add objects. */
-template<> inline bool is_exactly_a<add>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_add;
-}
-
 } // namespace GiNaC
 
 #endif // ndef __GINAC_ADD_H__
index 9cb480f9f56ba06c9e4486316593da6ad570ebe7..b4e38614aaa2942306d085f68c45046f162813c3 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's ABC. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -775,9 +775,9 @@ unsigned basic::return_type() const
        return return_types::commutative;
 }
 
-unsigned basic::return_type_tinfo() const
+const basic* basic::return_type_tinfo() const
 {
-       return tinfo();
+       return this;
 }
 
 /** Compute the hash value of an object and if it makes sense to store it in
@@ -788,7 +788,7 @@ unsigned basic::return_type_tinfo() const
  *  would all end up with the same hashvalue. */
 unsigned basic::calchash() const
 {
-       unsigned v = golden_ratio_hash(tinfo());
+       unsigned v = golden_ratio_hash((unsigned)tinfo());
        for (size_t i=0; i<nops(); i++) {
                v = rotate_left(v);
                v ^= this->op(i).gethash();
@@ -845,8 +845,8 @@ int basic::compare(const basic & other) const
        compare_statistics.compare_same_hashvalue++;
 #endif
 
-       const unsigned typeid_this = tinfo();
-       const unsigned typeid_other = other.tinfo();
+       const tinfo_t typeid_this = tinfo();
+       const tinfo_t typeid_other = other.tinfo();
        if (typeid_this==typeid_other) {
                GINAC_ASSERT(typeid(*this)==typeid(other));
 //             int cmpval = compare_same_type(other);
index 1434d2ba732612622efc2298acf83d590ada57b8..b2dc0ade2b30c123d41ff52d0b537444b31596fa 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to GiNaC's ABC. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -30,7 +30,6 @@
 #include <algorithm>
 
 #include "flags.h"
-#include "tinfos.h"
 #include "ptr.h"
 #include "assertion.h"
 #include "registrar.h"
@@ -48,7 +47,6 @@ class print_context;
 typedef std::vector<ex> exvector;
 typedef std::map<ex, ex, ex_is_less> exmap;
 
-
 // Define this to enable some statistical output for comparisons and hashing
 #undef GINAC_COMPARE_STATISTICS
 
@@ -108,7 +106,7 @@ class basic : public refcounted
        
        // default constructor, destructor, copy constructor and assignment operator
 protected:
-       basic() : tinfo_key(TINFO_basic), flags(0) {}
+       basic() : tinfo_key(&tinfo_static), flags(0) {}
 
 public:
        /** basic destructor, virtual because class ex will delete objects of
@@ -123,7 +121,7 @@ public:
 protected:
        /** Constructor with specified tinfo_key (used by derived classes instead
         *  of the default constructor to avoid assigning tinfo_key twice). */
-       basic(unsigned ti) : tinfo_key(ti), flags(0) {}
+       basic(tinfo_t ti) : tinfo_key(ti), flags(0) {}
        
        // new virtual functions which can be overridden by derived classes
 public: // only const functions please (may break reference counting)
@@ -214,7 +212,7 @@ public:
 
        // noncommutativity
        virtual unsigned return_type() const;
-       virtual unsigned return_type_tinfo() const;
+       virtual const basic* return_type_tinfo() const;
 
        // complex conjugation
        virtual ex conjugate() const;
@@ -262,7 +260,7 @@ public:
                }
        }
 
-       unsigned tinfo() const {return tinfo_key;}
+       tinfo_t tinfo() const {return tinfo_key;}
 
        /** Set some status_flags. */
        const basic & setflag(unsigned f) const {flags |= f; return *this;}
@@ -279,7 +277,7 @@ protected:
        
        // member variables
 protected:
-       unsigned tinfo_key;                 ///< typeinfo
+       tinfo_t tinfo_key;                  ///< type info
        mutable unsigned flags;             ///< of type status_flags
        mutable unsigned hashvalue;         ///< hash value
 };
@@ -299,13 +297,11 @@ inline bool is_a(const basic &obj)
        return dynamic_cast<const T *>(&obj) != 0;
 }
 
-/** Check if obj is a T, not including base classes.  This one is just an
- *  inefficient default.  It should in all time-critical cases be overridden
- *  by template specializations that use the TINFO_* constants directly. */
+/** Check if obj is a T, not including base classes. */
 template <class T>
-inline bool is_exactly_a(const basic &obj)
+inline bool is_exactly_a(const basic & obj)
 {
-       return obj.tinfo() == T::get_class_info_static().options.get_id();
+       return obj.tinfo() == &T::tinfo_static;
 }
 
 } // namespace GiNaC
index e166d0847bac8b273d1f4e1fa4cc456ec25827fc..03f972f836c063c799c52efa8dea6d7c6ad96ecb 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's clifford algebra (Dirac gamma) objects. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -76,7 +76,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(diracgammaR, tensor,
 
 clifford::clifford() : representation_label(0), metric(0), anticommuting(true), commutator_sign(-1)
 {
-       tinfo_key = TINFO_clifford;
+       tinfo_key = &clifford::tinfo_static;
 }
 
 DEFAULT_CTOR(diracone)
@@ -95,7 +95,7 @@ DEFAULT_CTOR(diracgammaR)
  *  @see dirac_ONE */
 clifford::clifford(const ex & b, unsigned char rl, bool anticommut) : inherited(b), representation_label(rl), metric(0), anticommuting(anticommut), commutator_sign(-1)
 {
-       tinfo_key = TINFO_clifford;
+       tinfo_key = &clifford::tinfo_static;
 }
 
 /** Construct object with one Lorentz index. This constructor is for internal
@@ -105,17 +105,17 @@ clifford::clifford(const ex & b, unsigned char rl, bool anticommut) : inherited(
 clifford::clifford(const ex & b, const ex & mu, const ex & metr, unsigned char rl, bool anticommut, int comm_sign) : inherited(b, mu), representation_label(rl), metric(metr), anticommuting(anticommut), commutator_sign(comm_sign)
 {
        GINAC_ASSERT(is_a<varidx>(mu));
-       tinfo_key = TINFO_clifford;
+       tinfo_key = &clifford::tinfo_static;
 }
 
 clifford::clifford(unsigned char rl, const ex & metr, bool anticommut, int comm_sign, const exvector & v, bool discardable) : inherited(not_symmetric(), v, discardable), representation_label(rl), metric(metr), anticommuting(anticommut), commutator_sign(comm_sign)
 {
-       tinfo_key = TINFO_clifford;
+       tinfo_key = &clifford::tinfo_static;
 }
 
 clifford::clifford(unsigned char rl, const ex & metr, bool anticommut, int comm_sign, std::auto_ptr<exvector> vp) : inherited(not_symmetric(), vp), representation_label(rl), metric(metr), anticommuting(anticommut), commutator_sign(comm_sign)
 {
-       tinfo_key = TINFO_clifford;
+       tinfo_key = &clifford::tinfo_static;
 }
 
 //////////
@@ -836,25 +836,18 @@ ex dirac_slash(const ex & e, const ex & dim, unsigned char rl)
    return clifford(e, varidx(0, dim), indexed((new minkmetric)->setflag(status_flags::dynallocated), symmetric2(), xi, chi), rl, true);
 }
 
-/** Check whether a given tinfo key (as returned by return_type_tinfo()
- *  is that of a clifford object with the specified representation label. */
-static bool is_clifford_tinfo(unsigned ti, unsigned char rl)
-{
-       return ti == (TINFO_clifford + rl);
-}
-
 /** Check whether a given tinfo key (as returned by return_type_tinfo()
  *  is that of a clifford object (with an arbitrary representation label). */
-static bool is_clifford_tinfo(unsigned ti)
+static bool is_clifford_tinfo(const basic* ti)
 {
-       return (ti & ~0xff) == TINFO_clifford;
+       return ti->tinfo() == &clifford::tinfo_static;
 }
 
 /** Extract representation label from tinfo key (as returned by
  *  return_type_tinfo()). */
-static unsigned char get_representation_label(unsigned ti)
+static unsigned char get_representation_label(const basic* ti)
 {
-       return ti & 0xff;
+       return ((clifford*)ti)->get_representation_label();
 }
 
 /** Take trace of a string of an even number of Dirac gammas given a vector
index 4fb5fad57c9aec73e34428b6efc306ed299182a0..48d28139f5cfdf84c486175f03662e182f761c02 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to GiNaC's clifford algebra (Dirac gamma) objects. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -60,7 +60,7 @@ protected:
        ex thiscontainer(const exvector & v) const;
        ex thiscontainer(std::auto_ptr<exvector> vp) const;
        unsigned return_type() const { return return_types::noncommutative; }
-       unsigned return_type_tinfo() const { return TINFO_clifford + representation_label; }
+       const basic* return_type_tinfo() const { return this; }
 
        // non-virtual functions in this class
 public:
@@ -107,7 +107,7 @@ class cliffordunit : public tensor
 
        // other constructors
 protected:
-       cliffordunit(unsigned ti) : inherited(ti) {}
+       cliffordunit(tinfo_t ti) : inherited(ti) {}
                                                                                                     
        // functions overriding virtual functions from base classes
 public:
@@ -186,12 +186,6 @@ protected:
 
 // global functions
 
-/** Specialization of is_exactly_a<clifford>(obj) for clifford objects. */
-template<> inline bool is_exactly_a<clifford>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_clifford;
-}
-
 /** Create a Clifford unity object.
  *
  *  @param rl Representation label
index 2693d9266d30a68c32cf851778f3e40c3b74a621..ebe66e7e2f8dcadb5338b07b93eb96a39d5682a6 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's color (SU(3) Lie algebra) objects. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -61,7 +61,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(su3d, tensor,
 
 color::color() : representation_label(0)
 {
-       tinfo_key = TINFO_color;
+       tinfo_key = &color::tinfo_static;
 }
 
 DEFAULT_CTOR(su3one)
@@ -78,7 +78,7 @@ DEFAULT_CTOR(su3d)
  *  @see color_ONE */
 color::color(const ex & b, unsigned char rl) : inherited(b), representation_label(rl)
 {
-       tinfo_key = TINFO_color;
+       tinfo_key = &color::tinfo_static;
 }
 
 /** Construct object with one color index. This constructor is for internal
@@ -86,17 +86,17 @@ color::color(const ex & b, unsigned char rl) : inherited(b), representation_labe
  *  @see color_T */
 color::color(const ex & b, const ex & i1, unsigned char rl) : inherited(b, i1), representation_label(rl)
 {
-       tinfo_key = TINFO_color;
+       tinfo_key = &color::tinfo_static;
 }
 
 color::color(unsigned char rl, const exvector & v, bool discardable) : inherited(not_symmetric(), v, discardable), representation_label(rl)
 {
-       tinfo_key = TINFO_color;
+       tinfo_key = &color::tinfo_static;
 }
 
 color::color(unsigned char rl, std::auto_ptr<exvector> vp) : inherited(not_symmetric(), vp), representation_label(rl)
 {
-       tinfo_key = TINFO_color;
+       tinfo_key = &color::tinfo_static;
 }
 
 //////////
@@ -520,25 +520,18 @@ ex color_h(const ex & a, const ex & b, const ex & c)
        return color_d(a, b, c) + I * color_f(a, b, c);
 }
 
-/** Check whether a given tinfo key (as returned by return_type_tinfo()
- *  is that of a color object with the specified representation label. */
-static bool is_color_tinfo(unsigned ti, unsigned char rl)
-{
-       return ti == (TINFO_color + rl);
-}
-
 /** Check whether a given tinfo key (as returned by return_type_tinfo()
  *  is that of a color object (with an arbitrary representation label). */
-static bool is_color_tinfo(unsigned ti)
+static bool is_color_tinfo(const basic* ti)
 {
-       return (ti & ~0xff) == TINFO_color;
+       return ti->tinfo() == &color::tinfo_static;
 }
 
 /** Extract representation label from tinfo key (as returned by
  *  return_type_tinfo()). */
-static unsigned char get_representation_label(unsigned ti)
+static unsigned char get_representation_label(const basic* ti)
 {
-       return ti & 0xff;
+       return ((color*)ti)->get_representation_label();
 }
 
 ex color_trace(const ex & e, const std::set<unsigned char> & rls)
index 9d9ba26e88e1e540b914f24185e2814e27493bd7..ebf28f698a0b8fc506ffe64bd8a527a3a158f842 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to GiNaC's color (SU(3) Lie algebra) objects. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -58,7 +58,7 @@ protected:
        ex thiscontainer(const exvector & v) const;
        ex thiscontainer(std::auto_ptr<exvector> vp) const;
        unsigned return_type() const { return return_types::noncommutative; }
-       unsigned return_type_tinfo() const { return TINFO_color + representation_label; }
+       const basic* return_type_tinfo() const { return this; }
 
        // non-virtual functions in this class
 public:
@@ -134,12 +134,6 @@ protected:
 
 // global functions
 
-/** Specialization of is_exactly_a<color>(obj) for color objects. */
-template<> inline bool is_exactly_a<color>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_color;
-}
-
 /** Create the su(3) unity element. This is an indexed object, although it
  *  has no indices.
  *
index 749803f00123abcc73f36fe5c73bf7f79448bde2..35f5ea02f308c6dc76559958d387f1663f9ce0c9 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's constant types and some special constants. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -44,7 +44,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(constant, basic,
 
 // public
 
-constant::constant() : basic(TINFO_constant), ef(0), serial(next_serial++)
+constant::constant() : basic(&constant::tinfo_static), ef(0), serial(next_serial++)
 {
        setflag(status_flags::evaluated | status_flags::expanded);
 }
@@ -56,7 +56,7 @@ constant::constant() : basic(TINFO_constant), ef(0), serial(next_serial++)
 // public
 
 constant::constant(const std::string & initname, evalffunctype efun, const std::string & texname)
-  : basic(TINFO_constant), name(initname), ef(efun), serial(next_serial++)
+  : basic(&constant::tinfo_static), name(initname), ef(efun), serial(next_serial++)
 {
        if (texname.empty())
                TeX_name = "\\mbox{" + name + "}";
@@ -66,7 +66,7 @@ constant::constant(const std::string & initname, evalffunctype efun, const std::
 }
 
 constant::constant(const std::string & initname, const numeric & initnumber, const std::string & texname)
-  : basic(TINFO_constant), name(initname), ef(0), number(initnumber), serial(next_serial++)
+  : basic(&constant::tinfo_static), name(initname), ef(0), number(initnumber), serial(next_serial++)
 {
        if (texname.empty())
                TeX_name = "\\mbox{" + name + "}";
@@ -177,7 +177,7 @@ bool constant::is_equal_same_type(const basic & other) const
 
 unsigned constant::calchash() const
 {
-       hashvalue = golden_ratio_hash(tinfo() ^ serial);
+       hashvalue = golden_ratio_hash((unsigned)tinfo() ^ serial);
 
        setflag(status_flags::hash_calculated);
 
index 9cf9d74d41dcf2013d24b6343392b745c8b064f8..331ad209e74e7c377fbcf22ec4d8fb4662474f58 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to GiNaC's constant types and some special constants. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -75,14 +75,6 @@ extern const constant Pi;
 extern const constant Catalan;
 extern const constant Euler;
 
-// utility functions
-
-/** Specialization of is_exactly_a<constant>(obj) for constant objects. */
-template<> inline bool is_exactly_a<constant>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_constant;
-}
-
 } // namespace GiNaC
 
 #endif // ndef __GINAC_CONSTANT_H__
index 39106cefd4779bf05b3cbfb165f3c4b8226d1c08..5774d5ace53d49ca09d6eddc308a4564e08c3f6a 100644 (file)
@@ -3,7 +3,7 @@
  *  Wrapper template for making GiNaC classes out of STL containers. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -137,7 +137,7 @@ public:
 
 protected:
        // helpers
-       static unsigned get_tinfo() { return TINFO_fail; }
+       static tinfo_t get_tinfo() { return NULL; }
        static unsigned get_default_flags() { return 0; }
        static char get_open_delim() { return '('; }
        static char get_close_delim() { return ')'; }
index 05b6c5b71ae89bbc94671fffb07950eaa850354e..82ac4ab570db6a5fbd6e3c5944c1a39f8bcb8809 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to GiNaC's light-weight expression handles. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -213,7 +213,7 @@ public:
 
        // noncommutativity
        unsigned return_type() const { return bp->return_type(); }
-       unsigned return_type_tinfo() const { return bp->return_type_tinfo(); }
+       const basic* return_type_tinfo() const { return bp->return_type_tinfo(); }
 
        unsigned gethash() const { return bp->gethash(); }
 
index 8cf8d7413b47fed7a7d09302f31d0628ee989e26..bd1604e1f4e94a5277d39eff4a32dc121af02295 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of sequences of expression pairs. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -67,7 +67,7 @@ public:
 
 // public
 
-expairseq::expairseq() : inherited(TINFO_expairseq)
+expairseq::expairseq() : inherited(&expairseq::tinfo_static)
 #if EXPAIRSEQ_USE_HASHTAB
                                                    , hashtabsize(0)
 #endif // EXPAIRSEQ_USE_HASHTAB
@@ -106,20 +106,20 @@ void expairseq::copy(const expairseq &other)
 // other constructors
 //////////
 
-expairseq::expairseq(const ex &lh, const ex &rh) : inherited(TINFO_expairseq)
+expairseq::expairseq(const ex &lh, const ex &rh) : inherited(&expairseq::tinfo_static)
 {
        construct_from_2_ex(lh,rh);
        GINAC_ASSERT(is_canonical());
 }
 
-expairseq::expairseq(const exvector &v) : inherited(TINFO_expairseq)
+expairseq::expairseq(const exvector &v) : inherited(&expairseq::tinfo_static)
 {
        construct_from_exvector(v);
        GINAC_ASSERT(is_canonical());
 }
 
 expairseq::expairseq(const epvector &v, const ex &oc)
-  : inherited(TINFO_expairseq), overall_coeff(oc)
+  : inherited(&expairseq::tinfo_static), overall_coeff(oc)
 {
        GINAC_ASSERT(is_a<numeric>(oc));
        construct_from_epvector(v);
@@ -127,7 +127,7 @@ expairseq::expairseq(const epvector &v, const ex &oc)
 }
 
 expairseq::expairseq(std::auto_ptr<epvector> vp, const ex &oc)
-  : inherited(TINFO_expairseq), overall_coeff(oc)
+  : inherited(&expairseq::tinfo_static), overall_coeff(oc)
 {
        GINAC_ASSERT(vp.get()!=0);
        GINAC_ASSERT(is_a<numeric>(oc));
@@ -571,7 +571,7 @@ unsigned expairseq::return_type() const
 
 unsigned expairseq::calchash() const
 {
-       unsigned v = golden_ratio_hash(this->tinfo());
+       unsigned v = golden_ratio_hash((unsigned)this->tinfo());
        epvector::const_iterator i = seq.begin();
        const epvector::const_iterator end = seq.end();
        while (i != end) {
@@ -861,6 +861,7 @@ void expairseq::construct_from_2_expairseq(const expairseq &s1,
        
        while (first1!=last1 && first2!=last2) {
                int cmpval = (*first1).rest.compare((*first2).rest);
+
                if (cmpval==0) {
                        // combine terms
                        const numeric &newcoeff = ex_to<numeric>(first1->coeff).
index 8edda5ce460ec1479b3d55a701d215c87a80c9ce..acc2ce1e397307b7b172e8ba2d3dc5c8ba4b51a4 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to sequences of expression pairs. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -170,14 +170,6 @@ protected:
 #endif // EXPAIRSEQ_USE_HASHTAB
 };
 
-// utility functions
-
-/** Specialization of is_exactly_a<expairseq>(obj) for expairseq objects. */
-template<> inline bool is_exactly_a<expairseq>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_expairseq;
-}
-
 } // namespace GiNaC
 
 #endif // ndef __GINAC_EXPAIRSEQ_H__
index bf25c82087d553530eb68e86f5459bdd48c362f3..bee19277a5c1cb358f4bf7fae2f0cc339eb7d723 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's exprseq. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -24,7 +24,7 @@
 
 namespace GiNaC {
 
-template <> GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(exprseq, basic,
+template <> GINAC_IMPLEMENT_REGISTERED_CLASS_OPT_T(exprseq, basic,
   print_func<print_context>(&exprseq::do_print).
   print_func<print_tree>(&exprseq::do_print_tree))
 
index ea755c34150b0e925c6f55f968a1f826f32ab447..a99ab567181dd1801f43fd63e85e4f1cc8260d10 100644 (file)
@@ -3,7 +3,7 @@
  *  Definition of GiNaC's exprseq. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -32,17 +32,11 @@ namespace GiNaC {
 typedef container<std::vector> exprseq;
 
 /** Specialization of container::get_tinfo() for exprseq. */
-template<> inline unsigned exprseq::get_tinfo() { return TINFO_exprseq; }
+template<> inline tinfo_t exprseq::get_tinfo() { return &exprseq::tinfo_static; }
 
 // defined in exprseq.cpp
 template<> bool exprseq::info(unsigned inf) const;
 
-/** Specialization of is_exactly_a<exprseq>(obj) for exprseq objects. */
-template<> inline bool is_exactly_a<exprseq>(const basic & obj)
-{
-       return obj.tinfo() == TINFO_exprseq;
-}
-
 } // namespace GiNaC
 
 #endif // ndef __GINAC_EXPRSEQ_H__
index d4826c13731d54272a0a8cea91ea94560610bf2f..6984ae92918cf2e9db70cc19be7766fa056006b6 100644 (file)
@@ -4,7 +4,7 @@
  *  somewhat obsolete (most of this can be replaced by exceptions). */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -41,12 +41,6 @@ protected:
        void do_print(const print_context & c, unsigned level) const;
 };
 
-/** Specialization of is_exactly_a<fail>(obj) for fail objects. */
-template<> inline bool is_exactly_a<fail>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_fail;
-}
-
 } // namespace GiNaC
 
 #endif // ndef __GINAC_FAIL_H__
index 296e2939b64c9ffba8cf0865a1d5b1d6a697f1c4..0671123229824a734e3b9c621cd4996bd3ebc58c 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of abstract derivatives of functions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -39,7 +39,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(fderivative, function,
 
 fderivative::fderivative()
 {
-       tinfo_key = TINFO_fderivative;
+       tinfo_key = &fderivative::tinfo_static;
 }
 
 //////////
@@ -49,17 +49,17 @@ fderivative::fderivative()
 fderivative::fderivative(unsigned ser, unsigned param, const exvector & args) : function(ser, args)
 {
        parameter_set.insert(param);
-       tinfo_key = TINFO_fderivative;
+       tinfo_key = &fderivative::tinfo_static;
 }
 
 fderivative::fderivative(unsigned ser, const paramset & params, const exvector & args) : function(ser, args), parameter_set(params)
 {
-       tinfo_key = TINFO_fderivative;
+       tinfo_key = &fderivative::tinfo_static;
 }
 
 fderivative::fderivative(unsigned ser, const paramset & params, std::auto_ptr<exvector> vp) : function(ser, vp), parameter_set(params)
 {
-       tinfo_key = TINFO_fderivative;
+       tinfo_key = &fderivative::tinfo_static;
 }
 
 //////////
index a6765aea29e4d8c7af14fdcfb1a1fde56c01f53c..91146e0e6ae8a547e9841ab634b12120c1cc5708 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to abstract derivatives of functions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -81,14 +81,6 @@ protected:
        paramset parameter_set; /**< Set of parameter numbers with respect to which to take the derivative */
 };
 
-// utility functions
-
-/** Specialization of is_exactly_a<T>(obj) for derivatives. */
-template<> inline bool is_exactly_a<fderivative>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_fderivative;
-}
-
 } // namespace GiNaC
 
 #endif // ndef __GINAC_DERIVATIVE_H__
index 6f6c6e7e918a92461fded9756da871405edffdf2..bb9e81ec1473f6907f11ac5a75fbcfc02b87ec87 100755 (executable)
@@ -2,7 +2,7 @@
 
 #  function.pl options: \$maxargs=${maxargs}
 # 
-#  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+#  GiNaC Copyright (C) 1999-2006 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
@@ -126,7 +126,7 @@ $constructors_implementation=generate(
 function::function(unsigned ser, ${SEQ1})
        : exprseq(${SEQ2}), serial(ser)
 {
-       tinfo_key = TINFO_function;
+       tinfo_key = &function::tinfo_static;
 }
 END_OF_CONSTRUCTORS_IMPLEMENTATION
 
@@ -356,7 +356,7 @@ $print_func_interface
                return *this;
        }
 
-       function_options & set_return_type(unsigned rt, unsigned rtt=0);
+       function_options & set_return_type(unsigned rt);
        function_options & do_not_evalf_params();
        function_options & remember(unsigned size, unsigned assoc_size=0,
                                    unsigned strategy=remember_strategies::delete_never);
@@ -389,7 +389,7 @@ protected:
 
        bool use_return_type;
        unsigned return_type;
-       unsigned return_type_tinfo;
+       const basic* return_type_tinfo;
 
        bool use_remember;
        unsigned remember_size;
@@ -459,7 +459,7 @@ protected:
        bool is_equal_same_type(const basic & other) const;
        bool match_same_type(const basic & other) const;
        unsigned return_type() const;
-       unsigned return_type_tinfo() const;
+       const basic* return_type_tinfo() const;
        
        // new virtual functions which can be overridden by derived classes
        // none
@@ -486,12 +486,6 @@ protected:
 
 // utility functions/macros
 
-/** Specialization of is_exactly_a<function>(obj) for objects of type function. */
-template<> inline bool is_exactly_a<function>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_function;
-}
-
 template <typename T>
 inline bool is_the_function(const ex & x)
 {
@@ -665,11 +659,10 @@ function_options& function_options::series_func(series_funcp_exvector s)
        return *this;
 }
 
-function_options & function_options::set_return_type(unsigned rt, unsigned rtt)
+function_options & function_options::set_return_type(unsigned rt)
 {
        use_return_type = true;
        return_type = rt;
-       return_type_tinfo = rtt;
        return *this;
 }
 
@@ -737,7 +730,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS(function, exprseq)
 
 function::function() : serial(0)
 {
-       tinfo_key = TINFO_function;
+       tinfo_key = &function::tinfo_static;
 }
 
 //////////
@@ -748,7 +741,7 @@ function::function() : serial(0)
 
 function::function(unsigned ser) : serial(ser)
 {
-       tinfo_key = TINFO_function;
+       tinfo_key = &function::tinfo_static;
 }
 
 // the following lines have been generated for max. ${maxargs} parameters
@@ -757,7 +750,7 @@ $constructors_implementation
 
 function::function(unsigned ser, const exprseq & es) : exprseq(es), serial(ser)
 {
-       tinfo_key = TINFO_function;
+       tinfo_key = &function::tinfo_static;
 
        // Force re-evaluation even if the exprseq was already evaluated
        // (the exprseq copy constructor copies the flags)
@@ -767,13 +760,13 @@ function::function(unsigned ser, const exprseq & es) : exprseq(es), serial(ser)
 function::function(unsigned ser, const exvector & v, bool discardable) 
   : exprseq(v,discardable), serial(ser)
 {
-       tinfo_key = TINFO_function;
+       tinfo_key = &function::tinfo_static;
 }
 
 function::function(unsigned ser, std::auto_ptr<exvector> vp) 
   : exprseq(vp), serial(ser)
 {
-       tinfo_key = TINFO_function;
+       tinfo_key = &function::tinfo_static;
 }
 
 //////////
@@ -982,7 +975,7 @@ ${evalf_switch_statement}
 
 unsigned function::calchash() const
 {
-       unsigned v = golden_ratio_hash(golden_ratio_hash(tinfo()) ^ serial);
+       unsigned v = golden_ratio_hash(golden_ratio_hash((unsigned)tinfo()) ^ serial);
        for (size_t i=0; i<nops(); i++) {
                v = rotate_left(v);
                v ^= this->op(i).gethash();
@@ -1133,19 +1126,19 @@ unsigned function::return_type() const
        }
 }
 
-unsigned function::return_type_tinfo() const
+const basic* function::return_type_tinfo() const
 {
        GINAC_ASSERT(serial<registered_functions().size());
        const function_options &opt = registered_functions()[serial];
 
        if (opt.use_return_type) {
                // Return type was explicitly specified
-               return opt.return_type_tinfo;
+               return this;
        } else {
                // Default behavior is to use the return type of the first
                // argument. Thus, exp() of a matrix behaves like a matrix, etc.
                if (seq.empty())
-                       return tinfo_key;
+                       return this;
                else
                        return seq.begin()->return_type_tinfo();
        }
index 9550b22a5098d1a5a689c2b187003d9481f20a12..9211294b5cefc124d0cffe59ccbf44422c30ac6b 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's indices. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -53,23 +53,23 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(spinidx, varidx,
 // default constructor
 //////////
 
-idx::idx() : inherited(TINFO_idx) {}
+idx::idx() : inherited(&idx::tinfo_static) {}
 
 varidx::varidx() : covariant(false)
 {
-       tinfo_key = TINFO_varidx;
+       tinfo_key = &varidx::tinfo_static;
 }
 
 spinidx::spinidx() : dotted(false)
 {
-       tinfo_key = TINFO_spinidx;
+       tinfo_key = &spinidx::tinfo_static;
 }
 
 //////////
 // other constructors
 //////////
 
-idx::idx(const ex & v, const ex & d) : inherited(TINFO_idx), value(v), dim(d)
+idx::idx(const ex & v, const ex & d) : inherited(&idx::tinfo_static), value(v), dim(d)
 {
        if (is_dim_numeric())
                if (!dim.info(info_flags::posint))
@@ -78,12 +78,12 @@ idx::idx(const ex & v, const ex & d) : inherited(TINFO_idx), value(v), dim(d)
 
 varidx::varidx(const ex & v, const ex & d, bool cov) : inherited(v, d), covariant(cov)
 {
-       tinfo_key = TINFO_varidx;
+       tinfo_key = &varidx::tinfo_static;
 }
 
 spinidx::spinidx(const ex & v, const ex & d, bool cov, bool dot) : inherited(v, d, cov), dotted(dot)
 {
-       tinfo_key = TINFO_spinidx;
+       tinfo_key = &spinidx::tinfo_static;
 }
 
 //////////
@@ -338,7 +338,7 @@ unsigned idx::calchash() const
        // hash keys. That is, the hash values must not depend on the index
        // dimensions or other attributes (variance etc.).
        // The compare_same_type() methods will take care of the rest.
-       unsigned v = golden_ratio_hash(tinfo());
+       unsigned v = golden_ratio_hash((unsigned)tinfo());
        v = rotate_left(v);
        v ^= value.gethash();
 
index cd1864694ff4cc10b330d4df12fa767e3799a15c..6517185ff630877b07b59388c060f54776bdb290 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to GiNaC's indices. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -207,24 +207,6 @@ protected:
 
 // utility functions
 
-/** Specialization of is_exactly_a<idx>(obj) for idx objects. */
-template<> inline bool is_exactly_a<idx>(const basic & obj)
-{
-        return obj.tinfo()==TINFO_idx;
-}
-
-/** Specialization of is_exactly_a<varidx>(obj) for varidx objects. */
-template<> inline bool is_exactly_a<varidx>(const basic & obj)
-{
-        return obj.tinfo()==TINFO_varidx;
-}
-
-/** Specialization of is_exactly_a<spinidx>(obj) for spinidx objects. */
-template<> inline bool is_exactly_a<spinidx>(const basic & obj)
-{
-        return obj.tinfo()==TINFO_spinidx;
-}
-
 /** Check whether two indices form a dummy pair. */
 bool is_dummy_pair(const idx & i1, const idx & i2);
 
index d39692c4e859d2a8be1f381052caeba203551996..b8b70f7e9d5ae853649c85c709fb895182aaf91d 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's indexed expressions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -53,7 +53,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(indexed, exprseq,
 
 indexed::indexed() : symtree(not_symmetric())
 {
-       tinfo_key = TINFO_indexed;
+       tinfo_key = &indexed::tinfo_static;
 }
 
 //////////
@@ -62,79 +62,79 @@ indexed::indexed() : symtree(not_symmetric())
 
 indexed::indexed(const ex & b) : inherited(b), symtree(not_symmetric())
 {
-       tinfo_key = TINFO_indexed;
+       tinfo_key = &indexed::tinfo_static;
        validate();
 }
 
 indexed::indexed(const ex & b, const ex & i1) : inherited(b, i1), symtree(not_symmetric())
 {
-       tinfo_key = TINFO_indexed;
+       tinfo_key = &indexed::tinfo_static;
        validate();
 }
 
 indexed::indexed(const ex & b, const ex & i1, const ex & i2) : inherited(b, i1, i2), symtree(not_symmetric())
 {
-       tinfo_key = TINFO_indexed;
+       tinfo_key = &indexed::tinfo_static;
        validate();
 }
 
 indexed::indexed(const ex & b, const ex & i1, const ex & i2, const ex & i3) : inherited(b, i1, i2, i3), symtree(not_symmetric())
 {
-       tinfo_key = TINFO_indexed;
+       tinfo_key = &indexed::tinfo_static;
        validate();
 }
 
 indexed::indexed(const ex & b, const ex & i1, const ex & i2, const ex & i3, const ex & i4) : inherited(b, i1, i2, i3, i4), symtree(not_symmetric())
 {
-       tinfo_key = TINFO_indexed;
+       tinfo_key = &indexed::tinfo_static;
        validate();
 }
 
 indexed::indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2) : inherited(b, i1, i2), symtree(symm)
 {
-       tinfo_key = TINFO_indexed;
+       tinfo_key = &indexed::tinfo_static;
        validate();
 }
 
 indexed::indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2, const ex & i3) : inherited(b, i1, i2, i3), symtree(symm)
 {
-       tinfo_key = TINFO_indexed;
+       tinfo_key = &indexed::tinfo_static;
        validate();
 }
 
 indexed::indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2, const ex & i3, const ex & i4) : inherited(b, i1, i2, i3, i4), symtree(symm)
 {
-       tinfo_key = TINFO_indexed;
+       tinfo_key = &indexed::tinfo_static;
        validate();
 }
 
 indexed::indexed(const ex & b, const exvector & v) : inherited(b), symtree(not_symmetric())
 {
        seq.insert(seq.end(), v.begin(), v.end());
-       tinfo_key = TINFO_indexed;
+       tinfo_key = &indexed::tinfo_static;
        validate();
 }
 
 indexed::indexed(const ex & b, const symmetry & symm, const exvector & v) : inherited(b), symtree(symm)
 {
        seq.insert(seq.end(), v.begin(), v.end());
-       tinfo_key = TINFO_indexed;
+       tinfo_key = &indexed::tinfo_static;
        validate();
 }
 
 indexed::indexed(const symmetry & symm, const exprseq & es) : inherited(es), symtree(symm)
 {
-       tinfo_key = TINFO_indexed;
+       tinfo_key = &indexed::tinfo_static;
 }
 
 indexed::indexed(const symmetry & symm, const exvector & v, bool discardable) : inherited(v, discardable), symtree(symm)
 {
-       tinfo_key = TINFO_indexed;
+       tinfo_key = &indexed::tinfo_static;
 }
 
 indexed::indexed(const symmetry & symm, std::auto_ptr<exvector> vp) : inherited(vp), symtree(symm)
 {
-       tinfo_key = TINFO_indexed;
+       tinfo_key = &indexed::tinfo_static;
 }
 
 //////////
@@ -297,7 +297,7 @@ ex indexed::eval(int level) const
                return f * thiscontainer(v);
        }
 
-       if(this->tinfo()==TINFO_indexed && seq.size()==1)
+       if(this->tinfo()==&indexed::tinfo_static && seq.size()==1)
                return base;
 
        // Canonicalize indices according to the symmetry properties
index 0da2c421233385482ef4116c449d09b54245582d..478bc9953058b24321ad4b4237fb50c823defa7a 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to GiNaC's indexed expressions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -154,7 +154,7 @@ protected:
        ex thiscontainer(const exvector & v) const;
        ex thiscontainer(std::auto_ptr<exvector> vp) const;
        unsigned return_type() const;
-       unsigned return_type_tinfo() const { return op(0).return_type_tinfo(); }
+       const basic* return_type_tinfo() const { return op(0).return_type_tinfo(); }
        ex expand(unsigned options = 0) const;
 
        // new virtual functions which can be overridden by derived classes
@@ -245,12 +245,6 @@ protected:
 
 // utility functions
 
-/** Specialization of is_exactly_a<indexed>(obj) for indexed objects. */
-template<> inline bool is_exactly_a<indexed>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_indexed;
-}
-
 /** Returns all dummy indices from the expression */
 exvector get_all_dummy_indices(const ex & e);
 
index 3daad3efcf8d0419dbb792443df353e668555c13..2f54b503bb9ef5b160b60e1f9193faf0c89b30b0 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's symbolic  integral. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -48,7 +48,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(integral, basic,
 //////////
 
 integral::integral()
-               : inherited(TINFO_integral),
+               : inherited(&integral::tinfo_static),
                x((new symbol())->setflag(status_flags::dynallocated))
 {}
 
@@ -59,7 +59,7 @@ integral::integral()
 // public
 
 integral::integral(const ex & x_, const ex & a_, const ex & b_, const ex & f_)
-               : inherited(TINFO_integral), x(x_), a(a_), b(b_), f(f_)
+               : inherited(&integral::tinfo_static), x(x_), a(a_), b(b_), f(f_)
 {
        if (!is_a<symbol>(x)) {
                throw(std::invalid_argument("first argument of integral must be of type symbol"));
@@ -436,7 +436,7 @@ unsigned integral::return_type() const
        return f.return_type();
 }
 
-unsigned integral::return_type_tinfo() const
+const basic* integral::return_type_tinfo() const
 {
        return f.return_type_tinfo();
 }
index 08c8f23edeeeae318928efd12da65d8ee614a0fa..553dab135fa222563362fb5202c8f2bb898961d4 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to GiNaC's symbolic  integral. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -51,7 +51,7 @@ public:
        ex expand(unsigned options = 0) const;
        exvector get_free_indices() const;
        unsigned return_type() const;
-       unsigned return_type_tinfo() const;
+       const basic* return_type_tinfo() const;
        ex conjugate() const;
        ex eval_integ() const;
 protected:
@@ -77,13 +77,6 @@ private:
 
 // utility functions
 
-/** Specialization of is_exactly_a<integral>(obj) for integral objects. */
-template<> inline bool is_exactly_a<integral>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_integral;
-}
-
-
 GiNaC::ex adaptivesimpson(
        const GiNaC::ex &x,
        const GiNaC::ex &a,
index c480e39b3a78fcaea09ec8f3c058f11f03c36882..15deb186e0d47032556586131b925c5be9cabde8 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's lst. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -24,7 +24,7 @@
 
 namespace GiNaC {
 
-template <> GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(lst, basic,
+template <> GINAC_IMPLEMENT_REGISTERED_CLASS_OPT_T(lst, basic,
   print_func<print_context>(&lst::do_print).
   print_func<print_tree>(&lst::do_print_tree))
 
index be3c4855ccf5d452b098f553f6db0b45e8d3e9e1..1aa484f48e3f6f238eac135a0f6fadd798016ad4 100644 (file)
@@ -3,7 +3,7 @@
  *  Definition of GiNaC's lst. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -32,7 +32,7 @@ namespace GiNaC {
 typedef container<std::list> lst;
 
 /** Specialization of container::get_tinfo() for lst. */
-template<> inline unsigned lst::get_tinfo() { return TINFO_lst; }
+template<> inline tinfo_t lst::get_tinfo() { return &lst::tinfo_static; }
 
 /** Specialization of container::get_default_flags() for lst. */
 template<> inline unsigned lst::get_default_flags() { return status_flags::not_shareable; }
@@ -46,12 +46,6 @@ template<> inline char lst::get_close_delim() { return '}'; }
 // defined in lst.cpp
 template<> bool lst::info(unsigned inf) const;
 
-/** Specialization of is_exactly_a<lst>(obj) for lst objects. */
-template<> inline bool is_exactly_a<lst>(const basic & obj)
-{
-       return obj.tinfo() == TINFO_lst;
-}
-
 } // namespace GiNaC
 
 #endif // ndef __GINAC_LST_H__
index 710190376a1c28b59c787d902655aa24d97ccf73..5dc90e26e514b487181b27230d8fcb7c663d425a 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of symbolic matrices */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -53,7 +53,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(matrix, basic,
 //////////
 
 /** Default ctor.  Initializes to 1 x 1-dimensional zero-matrix. */
-matrix::matrix() : inherited(TINFO_matrix), row(1), col(1), m(1, _ex0)
+matrix::matrix() : inherited(&matrix::tinfo_static), row(1), col(1), m(1, _ex0)
 {
        setflag(status_flags::not_shareable);
 }
@@ -69,7 +69,7 @@ matrix::matrix() : inherited(TINFO_matrix), row(1), col(1), m(1, _ex0)
  *  @param r number of rows
  *  @param c number of cols */
 matrix::matrix(unsigned r, unsigned c)
-  : inherited(TINFO_matrix), row(r), col(c), m(r*c, _ex0)
+  : inherited(&matrix::tinfo_static), row(r), col(c), m(r*c, _ex0)
 {
        setflag(status_flags::not_shareable);
 }
@@ -78,7 +78,7 @@ matrix::matrix(unsigned r, unsigned c)
 
 /** Ctor from representation, for internal use only. */
 matrix::matrix(unsigned r, unsigned c, const exvector & m2)
-  : inherited(TINFO_matrix), row(r), col(c), m(m2)
+  : inherited(&matrix::tinfo_static), row(r), col(c), m(m2)
 {
        setflag(status_flags::not_shareable);
 }
@@ -88,7 +88,7 @@ matrix::matrix(unsigned r, unsigned c, const exvector & m2)
  *  If the list has more elements than the matrix, the excessive elements are
  *  thrown away. */
 matrix::matrix(unsigned r, unsigned c, const lst & l)
-  : inherited(TINFO_matrix), row(r), col(c), m(r*c, _ex0)
+  : inherited(&matrix::tinfo_static), row(r), col(c), m(r*c, _ex0)
 {
        setflag(status_flags::not_shareable);
 
index 3941d3c5bd21630dcb9ca58493fbe9c990ef07fd..a1ac7cbcb968883c19c68620bc73e7392d406e93 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to symbolic matrices */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -209,12 +209,6 @@ inline unsigned rank(const matrix & m)
 
 // utility functions
 
-/** Specialization of is_exactly_a<matrix>(obj) for matrix objects. */
-template<> inline bool is_exactly_a<matrix>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_matrix;
-}
-
 /** Convert list of lists to matrix. */
 extern ex lst_to_matrix(const lst & l);
 
index ab46ae0e91c8a589a8599ca3300de76352636eed..962947898baf696c245ab816866fb286a39c5fdf 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's products of expressions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -27,6 +27,8 @@
 
 #include "mul.h"
 #include "add.h"
+#include "color.h"
+#include "clifford.h"
 #include "power.h"
 #include "operators.h"
 #include "matrix.h"
@@ -51,7 +53,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(mul, expairseq,
 
 mul::mul()
 {
-       tinfo_key = TINFO_mul;
+       tinfo_key = &mul::tinfo_static;
 }
 
 //////////
@@ -62,7 +64,7 @@ mul::mul()
 
 mul::mul(const ex & lh, const ex & rh)
 {
-       tinfo_key = TINFO_mul;
+       tinfo_key = &mul::tinfo_static;
        overall_coeff = _ex1;
        construct_from_2_ex(lh,rh);
        GINAC_ASSERT(is_canonical());
@@ -70,7 +72,7 @@ mul::mul(const ex & lh, const ex & rh)
 
 mul::mul(const exvector & v)
 {
-       tinfo_key = TINFO_mul;
+       tinfo_key = &mul::tinfo_static;
        overall_coeff = _ex1;
        construct_from_exvector(v);
        GINAC_ASSERT(is_canonical());
@@ -78,7 +80,7 @@ mul::mul(const exvector & v)
 
 mul::mul(const epvector & v)
 {
-       tinfo_key = TINFO_mul;
+       tinfo_key = &mul::tinfo_static;
        overall_coeff = _ex1;
        construct_from_epvector(v);
        GINAC_ASSERT(is_canonical());
@@ -86,7 +88,7 @@ mul::mul(const epvector & v)
 
 mul::mul(const epvector & v, const ex & oc)
 {
-       tinfo_key = TINFO_mul;
+       tinfo_key = &mul::tinfo_static;
        overall_coeff = oc;
        construct_from_epvector(v);
        GINAC_ASSERT(is_canonical());
@@ -94,7 +96,7 @@ mul::mul(const epvector & v, const ex & oc)
 
 mul::mul(std::auto_ptr<epvector> vp, const ex & oc)
 {
-       tinfo_key = TINFO_mul;
+       tinfo_key = &mul::tinfo_static;
        GINAC_ASSERT(vp.get()!=0);
        overall_coeff = oc;
        construct_from_epvector(*vp);
@@ -103,7 +105,7 @@ mul::mul(std::auto_ptr<epvector> vp, const ex & oc)
 
 mul::mul(const ex & lh, const ex & mh, const ex & rh)
 {
-       tinfo_key = TINFO_mul;
+       tinfo_key = &mul::tinfo_static;
        exvector factors;
        factors.reserve(3);
        factors.push_back(lh);
@@ -714,9 +716,22 @@ unsigned mul::return_type() const
                }
                if ((rt == return_types::noncommutative) && (!all_commutative)) {
                        // another nc element found, compare type_infos
-                       if (noncommutative_element->rest.return_type_tinfo() != i->rest.return_type_tinfo()) {
-                               // diffent types -> mul is ncc
-                               return return_types::noncommutative_composite;
+                       if (noncommutative_element->rest.return_type_tinfo()->tinfo() == &clifford::tinfo_static) {
+                               if (i->rest.return_type_tinfo()->tinfo() != &clifford::tinfo_static ||
+                                   ((clifford*)(noncommutative_element->rest.return_type_tinfo()))->get_representation_label() !=
+                                   ((clifford*)(i->rest.return_type_tinfo()))->get_representation_label()) {
+                                       // diffent types -> mul is ncc
+                                       return return_types::noncommutative_composite;
+                               }
+                       } else if (noncommutative_element->rest.return_type_tinfo()->tinfo() == &color::tinfo_static) {
+                               if (i->rest.return_type_tinfo()->tinfo() != &color::tinfo_static ||
+                                   ((color*)(noncommutative_element->rest.return_type_tinfo()))->get_representation_label() !=
+                                   ((color*)(i->rest.return_type_tinfo()))->get_representation_label()) {
+                                       // diffent types -> mul is ncc
+                                       return return_types::noncommutative_composite;
+                               }
+                       } else if (noncommutative_element->rest.return_type_tinfo()->tinfo() != i->rest.return_type_tinfo()->tinfo()) {
+                                       return return_types::noncommutative_composite;
                        }
                }
                ++i;
@@ -725,10 +740,10 @@ unsigned mul::return_type() const
        return all_commutative ? return_types::commutative : return_types::noncommutative;
 }
    
-unsigned mul::return_type_tinfo() const
+const basic* mul::return_type_tinfo() const
 {
        if (seq.empty())
-               return tinfo_key;  // mul without factors: should not happen
+               return this;  // mul without factors: should not happen
        
        // return type_info of first noncommutative element
        epvector::const_iterator i = seq.begin(), end = seq.end();
@@ -738,7 +753,7 @@ unsigned mul::return_type_tinfo() const
                ++i;
        }
        // no noncommutative element found, should not happen
-       return tinfo_key;
+       return this;
 }
 
 ex mul::thisexpairseq(const epvector & v, const ex & oc) const
index b94c8fda607a844f9088e1a8e7df229167077341..afb9abc80e05ccf9a31ba4d1c02e3b752ccd5810 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to GiNaC's products of expressions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -65,7 +65,7 @@ protected:
        ex derivative(const symbol & s) const;
        ex eval_ncmul(const exvector & v) const;
        unsigned return_type() const;
-       unsigned return_type_tinfo() const;
+       const basic* return_type_tinfo() const;
        ex thisexpairseq(const epvector & v, const ex & oc) const;
        ex thisexpairseq(std::auto_ptr<epvector> vp, const ex & oc) const;
        expair split_ex_to_pair(const ex & e) const;
@@ -95,14 +95,6 @@ protected:
        std::auto_ptr<epvector> expandchildren(unsigned options) const;
 };
 
-// utility functions
-
-/** Specialization of is_exactly_a<mul>(obj) for mul objects. */
-template<> inline bool is_exactly_a<mul>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_mul;
-}
-
 } // namespace GiNaC
 
 #endif // ndef __GINAC_MUL_H__
index c72b608ae3756f19119849098cba08f82e01564b..efa4af5bce7bc48b7a1e19a5c6aca2cdba49fdac 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's non-commutative products of expressions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -28,6 +28,8 @@
 #include "ex.h"
 #include "add.h"
 #include "mul.h"
+#include "clifford.h"
+#include "color.h"
 #include "matrix.h"
 #include "archive.h"
 #include "indexed.h"
@@ -48,7 +50,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(ncmul, exprseq,
 
 ncmul::ncmul()
 {
-       tinfo_key = TINFO_ncmul;
+       tinfo_key = &ncmul::tinfo_static;
 }
 
 //////////
@@ -59,40 +61,40 @@ ncmul::ncmul()
 
 ncmul::ncmul(const ex & lh, const ex & rh) : inherited(lh,rh)
 {
-       tinfo_key = TINFO_ncmul;
+       tinfo_key = &ncmul::tinfo_static;
 }
 
 ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3) : inherited(f1,f2,f3)
 {
-       tinfo_key = TINFO_ncmul;
+       tinfo_key = &ncmul::tinfo_static;
 }
 
 ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3,
              const ex & f4) : inherited(f1,f2,f3,f4)
 {
-       tinfo_key = TINFO_ncmul;
+       tinfo_key = &ncmul::tinfo_static;
 }
 
 ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3,
              const ex & f4, const ex & f5) : inherited(f1,f2,f3,f4,f5)
 {
-       tinfo_key = TINFO_ncmul;
+       tinfo_key = &ncmul::tinfo_static;
 }
 
 ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3,
              const ex & f4, const ex & f5, const ex & f6) : inherited(f1,f2,f3,f4,f5,f6)
 {
-       tinfo_key = TINFO_ncmul;
+       tinfo_key = &ncmul::tinfo_static;
 }
 
 ncmul::ncmul(const exvector & v, bool discardable) : inherited(v,discardable)
 {
-       tinfo_key = TINFO_ncmul;
+       tinfo_key = &ncmul::tinfo_static;
 }
 
 ncmul::ncmul(std::auto_ptr<exvector> vp) : inherited(vp)
 {
-       tinfo_key = TINFO_ncmul;
+       tinfo_key = &ncmul::tinfo_static;
 }
 
 //////////
@@ -339,7 +341,7 @@ ex ncmul::eval(int level) const
        
        // ncmul(x) -> x
        if (assocseq.size()==1) return *(seq.begin());
-
        // ncmul() -> 1
        if (assocseq.empty()) return _ex1;
 
@@ -397,19 +399,32 @@ ex ncmul::eval(int level) const
 
                size_t assoc_num = assocseq.size();
                exvectorvector evv;
-               unsignedvector rttinfos;
+               std::vector<const basic*> rttinfos;
                evv.reserve(assoc_num);
                rttinfos.reserve(assoc_num);
 
                cit = assocseq.begin(), citend = assocseq.end();
                while (cit != citend) {
-                       unsigned ti = cit->return_type_tinfo();
+                       const basic* ti = cit->return_type_tinfo();
                        size_t rtt_num = rttinfos.size();
                        // search type in vector of known types
                        for (i=0; i<rtt_num; ++i) {
-                               if (ti == rttinfos[i]) {
-                                       evv[i].push_back(*cit);
-                                       break;
+                               tinfo_t tinf = ti->tinfo();
+                               if (tinf == rttinfos[i]->tinfo()) {
+                                       if (tinf == &clifford::tinfo_static) {
+                                               if (((clifford*)ti)->get_representation_label() == ((clifford*)rttinfos[i])->get_representation_label()) {
+                                                       evv[i].push_back(*cit);
+                                                       break;
+                                               }
+                                       } else if (tinf == &color::tinfo_static) {
+                                               if (((color*)ti)->get_representation_label() == ((color*)rttinfos[i])->get_representation_label()) {
+                                                       evv[i].push_back(*cit);
+                                                       break;
+                                               }
+                                       } else {
+                                               evv[i].push_back(*cit);
+                                               break;
+                                       }
                                }
                        }
                        if (i >= rtt_num) {
@@ -433,8 +448,9 @@ ex ncmul::eval(int level) const
 #endif // def DO_GINAC_ASSERT
                
                // if all elements are of same type, simplify the string
-               if (evv_num == 1)
+               if (evv_num == 1) {
                        return evv[0][0].eval_ncmul(evv[0]);
+               }
                
                exvector splitseq;
                splitseq.reserve(evv_num);
@@ -493,7 +509,7 @@ ex ncmul::conjugate() const
                return exprseq::conjugate();
        }
 
-       if ((return_type_tinfo() & 0xffffff00U) != TINFO_clifford) {
+       if (return_type_tinfo()->tinfo() != &clifford::tinfo_static) {
                return exprseq::conjugate();
        }
 
@@ -553,9 +569,22 @@ unsigned ncmul::return_type() const
                }
                if ((rt == return_types::noncommutative) && (!all_commutative)) {
                        // another nc element found, compare type_infos
-                       if (noncommutative_element->return_type_tinfo() != i->return_type_tinfo()) {
-                               // diffent types -> mul is ncc
-                               return return_types::noncommutative_composite;
+                       if (noncommutative_element->return_type_tinfo()->tinfo() == &clifford::tinfo_static) {
+                               if (i->return_type_tinfo()->tinfo() != &clifford::tinfo_static ||
+                                   ((clifford*)(noncommutative_element->return_type_tinfo()))->get_representation_label() !=
+                                   ((clifford*)(i->return_type_tinfo()))->get_representation_label()) {
+                                       // diffent types -> mul is ncc
+                                       return return_types::noncommutative_composite;
+                               }
+                       } else if (noncommutative_element->return_type_tinfo()->tinfo() == &color::tinfo_static) {
+                               if (i->return_type_tinfo()->tinfo() != &color::tinfo_static ||
+                                   ((color*)(noncommutative_element->return_type_tinfo()))->get_representation_label() !=
+                                   ((color*)(i->return_type_tinfo()))->get_representation_label()) {
+                                       // diffent types -> mul is ncc
+                                       return return_types::noncommutative_composite;
+                               }
+                       } else if (noncommutative_element->return_type_tinfo()->tinfo() != i->return_type_tinfo()->tinfo()) {
+                                       return return_types::noncommutative_composite;
                        }
                }
                ++i;
@@ -565,10 +594,10 @@ unsigned ncmul::return_type() const
        return all_commutative ? return_types::commutative : return_types::noncommutative;
 }
    
-unsigned ncmul::return_type_tinfo() const
+const basic* ncmul::return_type_tinfo() const
 {
        if (seq.empty())
-               return tinfo_key;
+               return this;
 
        // return type_info of first noncommutative element
        exvector::const_iterator i = seq.begin(), end = seq.end();
@@ -579,7 +608,7 @@ unsigned ncmul::return_type_tinfo() const
        }
 
        // no noncommutative element found, should not happen
-       return tinfo_key;
+       return this;
 }
 
 //////////
index 65faed2e4e534f06d5eb275056a8cde562c8d41f..c99cd7af9d301ce6a5d1b34d3e26ee61b2e7d78f 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to GiNaC's non-commutative products of expressions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -69,7 +69,7 @@ public:
 protected:
        ex derivative(const symbol & s) const;
        unsigned return_type() const;
-       unsigned return_type_tinfo() const;
+       const basic* return_type_tinfo() const;
        
        // new virtual functions which can be overridden by derived classes
        // none
@@ -90,14 +90,6 @@ public:
 ex reeval_ncmul(const exvector & v);
 ex hold_ncmul(const exvector & v);
 
-// utility functions
-
-/** Specialization of is_exactly_a<ncmul>(obj) for ncmul objects. */
-template<> inline bool is_exactly_a<ncmul>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_ncmul;
-}
-
 } // namespace GiNaC
 
 #endif // ndef __GINAC_NCMUL_H__
index 965368625a9343dfe59ee2f82aa7803f66561a55..9687f23ea6d0c59030e2bd3d3be4509a372c490e 100644 (file)
@@ -7,7 +7,7 @@
  *  of special functions or implement the interface to the bignum package. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -73,7 +73,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(numeric, basic,
 //////////
 
 /** default ctor. Numerically it initializes to an integer zero. */
-numeric::numeric() : basic(TINFO_numeric)
+numeric::numeric() : basic(&numeric::tinfo_static)
 {
        value = cln::cl_I(0);
        setflag(status_flags::evaluated | status_flags::expanded);
@@ -85,7 +85,7 @@ numeric::numeric() : basic(TINFO_numeric)
 
 // public
 
-numeric::numeric(int i) : basic(TINFO_numeric)
+numeric::numeric(int i) : basic(&numeric::tinfo_static)
 {
        // Not the whole int-range is available if we don't cast to long
        // first.  This is due to the behaviour of the cl_I-ctor, which
@@ -100,7 +100,7 @@ numeric::numeric(int i) : basic(TINFO_numeric)
 }
 
 
-numeric::numeric(unsigned int i) : basic(TINFO_numeric)
+numeric::numeric(unsigned int i) : basic(&numeric::tinfo_static)
 {
        // Not the whole uint-range is available if we don't cast to ulong
        // first.  This is due to the behaviour of the cl_I-ctor, which
@@ -115,14 +115,14 @@ numeric::numeric(unsigned int i) : basic(TINFO_numeric)
 }
 
 
-numeric::numeric(long i) : basic(TINFO_numeric)
+numeric::numeric(long i) : basic(&numeric::tinfo_static)
 {
        value = cln::cl_I(i);
        setflag(status_flags::evaluated | status_flags::expanded);
 }
 
 
-numeric::numeric(unsigned long i) : basic(TINFO_numeric)
+numeric::numeric(unsigned long i) : basic(&numeric::tinfo_static)
 {
        value = cln::cl_I(i);
        setflag(status_flags::evaluated | status_flags::expanded);
@@ -132,7 +132,7 @@ numeric::numeric(unsigned long i) : basic(TINFO_numeric)
 /** Constructor for rational numerics a/b.
  *
  *  @exception overflow_error (division by zero) */
-numeric::numeric(long numer, long denom) : basic(TINFO_numeric)
+numeric::numeric(long numer, long denom) : basic(&numeric::tinfo_static)
 {
        if (!denom)
                throw std::overflow_error("division by zero");
@@ -141,7 +141,7 @@ numeric::numeric(long numer, long denom) : basic(TINFO_numeric)
 }
 
 
-numeric::numeric(double d) : basic(TINFO_numeric)
+numeric::numeric(double d) : basic(&numeric::tinfo_static)
 {
        // We really want to explicitly use the type cl_LF instead of the
        // more general cl_F, since that would give us a cl_DF only which
@@ -153,7 +153,7 @@ numeric::numeric(double d) : basic(TINFO_numeric)
 
 /** ctor from C-style string.  It also accepts complex numbers in GiNaC
  *  notation like "2+5*I". */
-numeric::numeric(const char *s) : basic(TINFO_numeric)
+numeric::numeric(const char *s) : basic(&numeric::tinfo_static)
 {
        cln::cl_N ctorval = 0;
        // parse complex numbers (functional but not completely safe, unfortunately
@@ -232,7 +232,7 @@ numeric::numeric(const char *s) : basic(TINFO_numeric)
 
 /** Ctor from CLN types.  This is for the initiated user or internal use
  *  only. */
-numeric::numeric(const cln::cl_N &z) : basic(TINFO_numeric)
+numeric::numeric(const cln::cl_N &z) : basic(&numeric::tinfo_static)
 {
        value = z;
        setflag(status_flags::evaluated | status_flags::expanded);
index f2a1adbdc52d8cc070a15c8ad4460fa151d6db3e..e6596bdf0232b15a4ca60bef25b60e01d4cfe41c 100644 (file)
@@ -3,7 +3,7 @@
  *  Makes the interface to the underlying bignum package available. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -317,14 +317,6 @@ ex EulerEvalf();
 ex CatalanEvalf();
 
 
-// utility functions
-
-/** Specialization of is_exactly_a<numeric>(obj) for numeric objects. */
-template<> inline bool is_exactly_a<numeric>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_numeric;
-}
-
 } // namespace GiNaC
 
 #ifdef __MAKECINT__
index 2b68206c7ac7c03fd26fc932709bad8b00417751..0ad960d4aaac5c582df8953f69c55e8a4dc9ad2d 100644 (file)
@@ -48,10 +48,11 @@ static inline const ex exmul(const ex & lh, const ex & rh)
        // ncmul::eval()'s rule to pull out commutative elements we need to check
        // only one of the elements.
        if (rh.return_type()==return_types::commutative ||
-           lh.return_type()==return_types::commutative)
+           lh.return_type()==return_types::commutative) {
                return (new mul(lh,rh))->setflag(status_flags::dynallocated);
-       else
+       } else {
                return (new ncmul(lh,rh))->setflag(status_flags::dynallocated);
+       }
 }
 
 /** Used internally by operator-() and friends to change the sign of an argument. */
index f9dfafbfb80c55a5856195a4be9127a0f538c0fc..60d138bd428b285e9bcd34cd9cfe4f6569411a7a 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's symbolic exponentiation (basis^exponent). */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -56,7 +56,7 @@ typedef std::vector<int> intvector;
 // default constructor
 //////////
 
-power::power() : inherited(TINFO_power) { }
+power::power() : inherited(&power::tinfo_static) { }
 
 //////////
 // other constructors
@@ -619,7 +619,7 @@ unsigned power::return_type() const
        return basis.return_type();
 }
 
-unsigned power::return_type_tinfo() const
+const basic* power::return_type_tinfo() const
 {
        return basis.return_type_tinfo();
 }
index d93bf9812c6e89c9c9d8f896f709c64168baf6fa..0fe37d4c00d229362f3a09c0d027e14c823f61f5 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to GiNaC's symbolic exponentiation (basis^exponent). */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -44,8 +44,8 @@ class power : public basic
        
        // other constructors
 public:
-       power(const ex & lh, const ex & rh) : inherited(TINFO_power), basis(lh), exponent(rh) {}
-       template<typename T> power(const ex & lh, const T & rh) : inherited(TINFO_power), basis(lh), exponent(rh) {}
+       power(const ex & lh, const ex & rh) : inherited(&power::tinfo_static), basis(lh), exponent(rh) {}
+       template<typename T> power(const ex & lh, const T & rh) : inherited(&power::tinfo_static), basis(lh), exponent(rh) {}
        
        // functions overriding virtual functions from base classes
 public:
@@ -70,7 +70,7 @@ protected:
        ex derivative(const symbol & s) const;
        ex eval_ncmul(const exvector & v) const;
        unsigned return_type() const;
-       unsigned return_type_tinfo() const;
+       const basic* return_type_tinfo() const;
        ex expand(unsigned options = 0) const;
        
        // new virtual functions which can be overridden by derived classes
@@ -96,14 +96,6 @@ protected:
        ex exponent;
 };
 
-// utility functions
-
-/** Efficient specialization of is_exactly_a<power>(obj) for power objects. */
-template<> inline bool is_exactly_a<power>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_power;
-}
-
 // wrapper functions
 
 /** Symbolic exponentiation.  Returns a power-object as a new expression.
index d416b3500ca11dbe9bb60fb121043e042df62669..41ec9036c00dc78559bff80e1f730032e434c634 100644 (file)
@@ -4,7 +4,7 @@
  *  methods for series expansion. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -51,7 +51,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(pseries, basic,
  *  Default constructor
  */
 
-pseries::pseries() : inherited(TINFO_pseries) { }
+pseries::pseries() : inherited(&pseries::tinfo_static) { }
 
 
 /*
@@ -67,7 +67,7 @@ pseries::pseries() : inherited(TINFO_pseries) { }
  *  @param rel_  expansion variable and point (must hold a relational)
  *  @param ops_  vector of {coefficient, power} pairs (coefficient must not be zero)
  *  @return newly constructed pseries */
-pseries::pseries(const ex &rel_, const epvector &ops_) : basic(TINFO_pseries), seq(ops_)
+pseries::pseries(const ex &rel_, const epvector &ops_) : basic(&pseries::tinfo_static), seq(ops_)
 {
        GINAC_ASSERT(is_a<relational>(rel_));
        GINAC_ASSERT(is_a<symbol>(rel_.lhs()));
index 07682c6bc7f4e4cb37e1e5c0682847f2270a2655..fe88508cd7668e928c39a817b94d446edcb05739 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to class for extended truncated power series. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -116,12 +116,6 @@ protected:
 
 // utility functions
 
-/** Specialization of is_exactly_a<pseries>(obj) for pseries objects. */
-template<> inline bool is_exactly_a<pseries>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_pseries;
-}
-
 /** Convert the pseries object embedded in an expression to an ordinary
  *  polynomial in the expansion variable. The result is undefined if the
  *  expression does not contain a pseries object at its top level.
index 992e7ac2b5068537dd2572ad0a3810d02f39dde8..e51a706f62528cb98c1d74e749377c2ecc019cf4 100644 (file)
@@ -28,7 +28,7 @@
 
 namespace GiNaC {
 
-unsigned find_tinfo_key(const std::string &class_name)
+tinfo_t find_tinfo_key(const std::string &class_name)
 {
        return registered_class_info::find(class_name)->options.get_id();
 }
index 16f39020d9ec1d1b89834077b8a733de4d78687c..50dbbb549a80cdd374b4d2553808dfdc1992c40e 100644 (file)
@@ -3,7 +3,7 @@
  *  GiNaC's class registrar (for class basic and all classes derived from it). */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -38,6 +38,9 @@ class archive_node;
 template <template <class> class> class container;
 typedef container<std::list> lst;
 
+/** Definitions for the tinfo mechanism. */
+typedef const void * tinfo_t;
+struct tinfo_static_t {};
 
 /** Unarchiving function (static member function of every GiNaC class). */
 typedef ex (*unarch_func)(const archive_node &n, lst &sym_lst);
@@ -46,12 +49,12 @@ typedef ex (*unarch_func)(const archive_node &n, lst &sym_lst);
 /** This class stores information about a registered GiNaC class. */
 class registered_class_options {
 public:
-       registered_class_options(const char *n, const char *p, unsigned ti, unarch_func f)
+       registered_class_options(const char *n, const char *p, tinfo_t ti, unarch_func f)
         : name(n), parent_name(p), tinfo_key(ti), unarchive(f) {}
 
        const char *get_name() const { return name; }
        const char *get_parent_name() const { return parent_name; }
-       unsigned get_id() const { return tinfo_key; }
+       tinfo_t get_id() const { return tinfo_key; }
        unarch_func get_unarch_func() const { return unarchive; }
        const std::vector<print_functor> &get_print_dispatch_table() const { return print_dispatch_table; }
 
@@ -86,7 +89,7 @@ public:
 private:
        const char *name;         /**< Class name. */
        const char *parent_name;  /**< Name of superclass. */
-       unsigned tinfo_key;       /**< TINFO_* key. */
+       tinfo_t tinfo_key;        /**< Type information key. */
        unarch_func unarchive;    /**< Pointer to unarchiving function. */
        std::vector<print_functor> print_dispatch_table; /**< Method table for print() dispatch */
 };
@@ -98,6 +101,7 @@ typedef class_info<registered_class_options> registered_class_info;
 #define GINAC_DECLARE_REGISTERED_CLASS_NO_CTORS(classname, supername) \
 public: \
        typedef supername inherited; \
+    static const tinfo_static_t tinfo_static; \
 private: \
        static GiNaC::registered_class_info reg_info; \
 public: \
@@ -137,18 +141,27 @@ protected: \
        virtual int compare_same_type(const GiNaC::basic & other) const; \
 private:
 
+
 /** Macro for inclusion in the implementation of each registered class. */
 #define GINAC_IMPLEMENT_REGISTERED_CLASS(classname, supername) \
-       GiNaC::registered_class_info classname::reg_info = GiNaC::registered_class_info(GiNaC::registered_class_options(#classname, #supername, TINFO_##classname, &classname::unarchive));
+       GiNaC::registered_class_info classname::reg_info = GiNaC::registered_class_info(GiNaC::registered_class_options(#classname, #supername, &classname::tinfo_static, &classname::unarchive)); \
+       const tinfo_static_t classname::tinfo_static = {};
 
 /** Macro for inclusion in the implementation of each registered class.
  *  Additional options can be specified. */
 #define GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(classname, supername, options) \
-       GiNaC::registered_class_info classname::reg_info = GiNaC::registered_class_info(GiNaC::registered_class_options(#classname, #supername, TINFO_##classname, &classname::unarchive).options);
+       GiNaC::registered_class_info classname::reg_info = GiNaC::registered_class_info(GiNaC::registered_class_options(#classname, #supername, &classname::tinfo_static, &classname::unarchive).options); \
+       const tinfo_static_t classname::tinfo_static = {};
+
+/** Macro for inclusion in the implementation of each registered class.
+ *  Additional options can be specified. */
+#define GINAC_IMPLEMENT_REGISTERED_CLASS_OPT_T(classname, supername, options) \
+       GiNaC::registered_class_info classname::reg_info = GiNaC::registered_class_info(GiNaC::registered_class_options(#classname, #supername, &classname::tinfo_static, &classname::unarchive).options); \
+       template<> const tinfo_static_t classname::tinfo_static = {};
 
 
-/** Find TINFO_* key by class name. */
-extern unsigned find_tinfo_key(const std::string &class_name);
+/** Find type information key by class name. */
+extern tinfo_t find_tinfo_key(const std::string &class_name);
 
 /** Find unarchiving function by class name. */
 extern unarch_func find_unarch_func(const std::string &class_name);
index 247b75f09105add531a7824a72046243cd8daf0f..63dd2459c610d8295c1421e7dd4aa5361be7efdc 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of relations between expressions */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -40,7 +40,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(relational, basic,
 // default constructor
 //////////
 
-relational::relational() : basic(TINFO_relational) {}
+relational::relational() : basic(&relational::tinfo_static) {}
 
 //////////
 // other constructors
@@ -48,7 +48,7 @@ relational::relational() : basic(TINFO_relational) {}
 
 // public
 
-relational::relational(const ex & lhs, const ex & rhs, operators oper) : basic(TINFO_relational), lh(lhs), rh(rhs), o(oper) {}
+relational::relational(const ex & lhs, const ex & rhs, operators oper) : basic(&relational::tinfo_static), lh(lhs), rh(rhs), o(oper) {}
 
 //////////
 // archiving
@@ -250,7 +250,7 @@ unsigned relational::return_type() const
        return lh.return_type();
 }
    
-unsigned relational::return_type_tinfo() const
+const basic* relational::return_type_tinfo() const
 {
        GINAC_ASSERT(lh.return_type_tinfo()==rh.return_type_tinfo());
        return lh.return_type_tinfo();
@@ -258,7 +258,7 @@ unsigned relational::return_type_tinfo() const
 
 unsigned relational::calchash() const
 {
-       unsigned v = golden_ratio_hash(tinfo());
+       unsigned v = golden_ratio_hash((unsigned)tinfo());
        unsigned lhash = lh.gethash();
        unsigned rhash = rh.gethash();
 
index 64ea0ff8e311dc4766a99534ad83cb9890f87e06..27007f56a3184ca4d22257a7738d57547e58e1f1 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to relations between expressions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -63,7 +63,7 @@ protected:
        ex eval_ncmul(const exvector & v) const;
        bool match_same_type(const basic & other) const;
        unsigned return_type() const;
-       unsigned return_type_tinfo() const;
+       const basic* return_type_tinfo() const;
        unsigned calchash() const;
 
        // new virtual functions which can be overridden by derived classes
@@ -103,12 +103,6 @@ protected:
 
 // utility functions
 
-/** Specialization of is_exactly_a<relational>(obj) for relational objects. */
-template<> inline bool is_exactly_a<relational>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_relational;
-}
-
 // inlined functions for efficiency
 inline relational::safe_bool relational::operator!() const
 {
diff --git a/ginac/structure.cpp b/ginac/structure.cpp
deleted file mode 100644 (file)
index fae3b2a..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file structure.cpp
- *
- *  Wrapper template for making GiNaC classes out of C++ structures. */
-
-/*
- *  GiNaC Copyright (C) 1999-2005 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include "structure.h"
-
-namespace GiNaC {
-
-/** Next free tinfo_key for structure types. */
-unsigned next_structure_tinfo_key = TINFO_structure;
-
-} // namespace GiNaC
index 23ae9c29bc43c911d09070f9712ad631b7d0c1a3..1ed46cb86818bcabfaaa3980bfb2b0800f6f7eba 100644 (file)
@@ -3,7 +3,7 @@
  *  Wrapper template for making GiNaC classes out of C++ structures. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -33,8 +33,6 @@
 
 namespace GiNaC {
 
-extern unsigned next_structure_tinfo_key;
-
 
 /** Comparison policy: all structures of one type are equal */
 template <class T>
@@ -119,8 +117,9 @@ class structure : public basic, public ComparisonPolicy<T> {
        GINAC_DECLARE_REGISTERED_CLASS(structure, basic)
 
        // helpers
-       static unsigned get_tinfo() { return reg_info.options.get_id(); }
+       static tinfo_t get_tinfo() { return reg_info.options.get_id(); }
        static const char *get_class_name() { return "structure"; }
+       static tinfo_t next_structure_tinfo_key() { return new tinfo_static_t; }
 
        // constructors
 public:
@@ -201,7 +200,7 @@ public:
 
        // noncommutativity
        unsigned return_type() const { return return_types::commutative; }
-       unsigned return_type_tinfo() const { return tinfo(); }
+       const basic* return_type_tinfo() const { return this; }
 
 protected:
        bool is_equal_same_type(const basic & other) const
@@ -220,7 +219,6 @@ public:
        const T *operator->() const { return &obj; }
        T &get_struct() { return obj; }
        const T &get_struct() const { return obj; }
-
 private:
        T obj;
 };
@@ -259,7 +257,7 @@ int structure<T, CP>::compare_same_type(const basic & other) const
 }
 
 template <class T, template <class> class CP>
-registered_class_info structure<T, CP>::reg_info = registered_class_info(registered_class_options(structure::get_class_name(), "basic", next_structure_tinfo_key++, &structure::unarchive));
+registered_class_info structure<T, CP>::reg_info = registered_class_info(registered_class_options(structure::get_class_name(), "basic", structure::next_structure_tinfo_key(), &structure::unarchive));
 
 
 } // namespace GiNaC
index cb7c52490f9c810fa1e5fdb1e4ba518b77552f14..6c0c6960769f8a166b615cb80f89c7d13ab6087f 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's symbolic objects. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -45,7 +45,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(symbol, basic,
 // symbol
 
 symbol::symbol()
- : inherited(TINFO_symbol), asexinfop(new assigned_ex_info), serial(next_serial++), name(autoname_prefix() + ToString(serial)), TeX_name(name), ret_type(return_types::commutative), ret_type_tinfo(TINFO_symbol), domain(domain::complex)
+ : inherited(&symbol::tinfo_static), asexinfop(new assigned_ex_info), serial(next_serial++), name(autoname_prefix() + ToString(serial)), TeX_name(name), ret_type(return_types::commutative), domain(domain::complex)
 {
        setflag(status_flags::evaluated | status_flags::expanded);
 }
@@ -66,25 +66,25 @@ realsymbol::realsymbol()
 // symbol
 
 symbol::symbol(const std::string & initname, unsigned domain)
- : inherited(TINFO_symbol), asexinfop(new assigned_ex_info), serial(next_serial++), name(initname), TeX_name(default_TeX_name()), ret_type(return_types::commutative), ret_type_tinfo(TINFO_symbol), domain(domain)
+ : inherited(&symbol::tinfo_static), asexinfop(new assigned_ex_info), serial(next_serial++), name(initname), TeX_name(default_TeX_name()), ret_type(return_types::commutative), domain(domain)
 {
        setflag(status_flags::evaluated | status_flags::expanded);
 }
 
-symbol::symbol(const std::string & initname, const std::string & texname, unsigned domain)
- : inherited(TINFO_symbol), asexinfop(new assigned_ex_info), serial(next_serial++), name(initname), TeX_name(texname), ret_type(return_types::commutative), ret_type_tinfo(TINFO_symbol), domain(domain)
+symbol::symbol(const std::string & initname, unsigned rt, unsigned domain)
+ : inherited(&symbol::tinfo_static), asexinfop(new assigned_ex_info), serial(next_serial++), name(initname), TeX_name(default_TeX_name()), ret_type(rt), domain(domain)
 {
        setflag(status_flags::evaluated | status_flags::expanded);
 }
 
-symbol::symbol(const std::string & initname, unsigned rt, unsigned rtt, unsigned domain)
- : inherited(TINFO_symbol), asexinfop(new assigned_ex_info), serial(next_serial++), name(initname), TeX_name(default_TeX_name()), ret_type(rt), ret_type_tinfo(rtt), domain(domain)
+symbol::symbol(const std::string & initname, const std::string & texname, unsigned domain)
+ : inherited(&symbol::tinfo_static), asexinfop(new assigned_ex_info), serial(next_serial++), name(initname), TeX_name(texname), ret_type(return_types::commutative), domain(domain)
 {
        setflag(status_flags::evaluated | status_flags::expanded);
 }
 
-symbol::symbol(const std::string & initname, const std::string & texname, unsigned rt, unsigned rtt, unsigned domain)
- : inherited(TINFO_symbol), asexinfop(new assigned_ex_info), serial(next_serial++), name(initname), TeX_name(texname), ret_type(rt), ret_type_tinfo(rtt), domain(domain)
+symbol::symbol(const std::string & initname, const std::string & texname, unsigned rt, unsigned domain)
+ : inherited(&symbol::tinfo_static), asexinfop(new assigned_ex_info), serial(next_serial++), name(initname), TeX_name(texname), ret_type(rt), domain(domain)
 {
        setflag(status_flags::evaluated | status_flags::expanded);
 }
@@ -97,11 +97,11 @@ realsymbol::realsymbol(const std::string & initname, unsigned domain)
 realsymbol::realsymbol(const std::string & initname, const std::string & texname, unsigned domain)
  : symbol(initname, texname, domain) { }
 
-realsymbol::realsymbol(const std::string & initname, unsigned rt, unsigned rtt, unsigned domain)
- : symbol(initname, rt, rtt, domain) { }
+realsymbol::realsymbol(const std::string & initname, unsigned rt, unsigned domain)
+ : symbol(initname, rt, domain) { }
 
-realsymbol::realsymbol(const std::string & initname, const std::string & texname, unsigned rt, unsigned rtt, unsigned domain)
- : symbol(initname, texname, rt, rtt, domain) { }
+realsymbol::realsymbol(const std::string & initname, const std::string & texname, unsigned rt, unsigned domain)
+ : symbol(initname, texname, rt, domain) { }
 
 //////////
 // archiving
@@ -119,8 +119,6 @@ symbol::symbol(const archive_node &n, lst &sym_lst)
                domain = domain::complex;
        if (!n.find_unsigned("return_type", ret_type))
                ret_type = return_types::commutative;
-       if (!n.find_unsigned("return_type_tinfo", ret_type_tinfo))
-               ret_type_tinfo = TINFO_symbol;
        setflag(status_flags::evaluated | status_flags::expanded);
 }
 
@@ -151,8 +149,6 @@ void symbol::archive(archive_node &n) const
                n.add_unsigned("domain", domain);
        if (ret_type != return_types::commutative)
                n.add_unsigned("return_type", ret_type);
-       if (ret_type_tinfo != TINFO_symbol)
-               n.add_unsigned("return_type_tinfo", ret_type_tinfo);
 }
 
 //////////
@@ -261,7 +257,7 @@ bool symbol::is_equal_same_type(const basic & other) const
 
 unsigned symbol::calchash() const
 {
-       hashvalue = golden_ratio_hash(tinfo() ^ serial);
+       hashvalue = golden_ratio_hash((unsigned)tinfo() ^ serial);
        setflag(status_flags::hash_calculated);
        return hashvalue;
 }
index a166382f5d3b7b21317d20004a16a8d3c63cc31f..e13341f021052aaf0875ed67d7535ba15656dc61 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to GiNaC's symbolic objects. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -57,9 +57,9 @@ class symbol : public basic
        // other constructors
 public:
        explicit symbol(const std::string & initname, unsigned domain = domain::complex);
+       symbol(const std::string & initname, unsigned rt, unsigned domain);
        symbol(const std::string & initname, const std::string & texname, unsigned domain = domain::complex);
-       symbol(const std::string & initname, unsigned rt, unsigned rtt, unsigned domain = domain::complex);
-       symbol(const std::string & initname, const std::string & texname, unsigned rt, unsigned rtt, unsigned domain = domain::complex);
+       symbol(const std::string & initname, const std::string & texname, unsigned rt, unsigned domain);
        
        // functions overriding virtual functions from base classes
 public:
@@ -72,7 +72,6 @@ public:
        ex to_rational(exmap & repl) const;
        ex to_polynomial(exmap & repl) const;
        unsigned return_type() const { return ret_type; }
-       unsigned return_type_tinfo() const { return ret_type_tinfo; }
        ex conjugate() const;
 protected:
        ex derivative(const symbol & s) const;
@@ -104,7 +103,6 @@ protected:
        std::string TeX_name;            ///< LaTeX name of this symbol
        unsigned domain;                 ///< domain of symbol, complex (default) or real
        unsigned ret_type;               ///< value returned by return_type()
-       unsigned ret_type_tinfo;         ///< value returned by return_type_tinfo()
 private:
        static unsigned next_serial;
 };
@@ -118,23 +116,17 @@ public:
        realsymbol();
        explicit realsymbol(const std::string & initname, unsigned domain = domain::real);
        realsymbol(const std::string & initname, const std::string & texname, unsigned domain = domain::real);
-       realsymbol(const std::string & initname, unsigned rt, unsigned rtt, unsigned domain = domain::real);
-       realsymbol(const std::string & initname, const std::string & texname, unsigned rt, unsigned rtt, unsigned domain = domain::real);
+       realsymbol(const std::string & initname, unsigned rt, unsigned domain = domain::real);
+       realsymbol(const std::string & initname, const std::string & texname, unsigned rt, unsigned domain = domain::real);
 };
 
 
 // utility functions
 
-/** Specialization of is_exactly_a<symbol>(obj) for symbol objects. */
-template<> inline bool is_exactly_a<symbol>(const basic & obj)
-{
-       return obj.tinfo() == TINFO_symbol;
-}
-
 /** Specialization of is_exactly_a<realsymbol>(obj) for realsymbol objects. */
 template<> inline bool is_exactly_a<realsymbol>(const basic & obj)
 {
-       return (obj.tinfo() == TINFO_symbol) && (static_cast<const symbol &>(obj).get_domain() == domain::real);
+       return (obj.tinfo() == &symbol::tinfo_static) && (static_cast<const symbol &>(obj).get_domain() == domain::real);
 }
 
 // wrapper functions around member functions
index 39b194a6933cd274cb45d7dfe8033186b478bbef..96225e7416437068816a422f51cc5de6a6116513 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's symmetry definitions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -55,7 +55,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(symmetry, basic,
 // default constructor
 //////////
 
-symmetry::symmetry() : inherited(TINFO_symmetry), type(none)
+symmetry::symmetry() : inherited(&symmetry::tinfo_static), type(none)
 {
        setflag(status_flags::evaluated | status_flags::expanded);
 }
@@ -64,13 +64,13 @@ symmetry::symmetry() : inherited(TINFO_symmetry), type(none)
 // other constructors
 //////////
 
-symmetry::symmetry(unsigned i) : inherited(TINFO_symmetry), type(none)
+symmetry::symmetry(unsigned i) : inherited(&symmetry::tinfo_static), type(none)
 {
        indices.insert(i);
        setflag(status_flags::evaluated | status_flags::expanded);
 }
 
-symmetry::symmetry(symmetry_type t, const symmetry &c1, const symmetry &c2) : inherited(TINFO_symmetry), type(t)
+symmetry::symmetry(symmetry_type t, const symmetry &c1, const symmetry &c2) : inherited(&symmetry::tinfo_static), type(t)
 {
        add(c1); add(c2);
        setflag(status_flags::evaluated | status_flags::expanded);
index d2ce4e94a769dbc32e2188e45fa63dbab7c92272..3720ee727012ba83a8b920fe76b09658316861d1 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to GiNaC's symmetry definitions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -168,14 +168,6 @@ inline ex symmetrize_cyclic(const ex & e, const exvector & v)
        return symmetrize(e, v.begin(), v.end());
 }
 
-// utility functions
-
-/** Specialization of is_exactly_a<symmetry>(obj) for symmetry objects. */
-template<> inline bool is_exactly_a<symmetry>(const basic & obj)
-{
-       return obj.tinfo()==TINFO_symmetry;
-}
-
 } // namespace GiNaC
 
 #endif // ndef __GINAC_SYMMETRY_H__
index 1a8f8e4041e542661e83b7190bfb2bd34fb052dd..7b1e32338c2b6ead77cb260f6a1e6d54d76c2628 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's special tensors. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -64,7 +64,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(tensepsilon, tensor,
 // constructors
 //////////
 
-tensor::tensor() : inherited(TINFO_tensor)
+tensor::tensor() : inherited(&tensor::tinfo_static)
 {
        setflag(status_flags::evaluated | status_flags::expanded);
 }
@@ -74,27 +74,27 @@ DEFAULT_CTOR(tensmetric)
 
 minkmetric::minkmetric() : pos_sig(false)
 {
-       tinfo_key = TINFO_minkmetric;
+       tinfo_key = &minkmetric::tinfo_static;
 }
 
 spinmetric::spinmetric()
 {
-       tinfo_key = TINFO_spinmetric;
+       tinfo_key = &spinmetric::tinfo_static;
 }
 
 minkmetric::minkmetric(bool ps) : pos_sig(ps)
 {
-       tinfo_key = TINFO_minkmetric;
+       tinfo_key = &minkmetric::tinfo_static;
 }
 
 tensepsilon::tensepsilon() : minkowski(false), pos_sig(false)
 {
-       tinfo_key = TINFO_tensepsilon;
+       tinfo_key = &tensepsilon::tinfo_static;
 }
 
 tensepsilon::tensepsilon(bool mink, bool ps) : minkowski(mink), pos_sig(ps)
 {
-       tinfo_key = TINFO_tensepsilon;
+       tinfo_key = &tensepsilon::tinfo_static;
 }
 
 //////////
index 0ebfb0f56d76b93633c8a635d30c20e2cf763982..b424cedf4f47f28af1dd6207b78e4b4e75728941 100644 (file)
@@ -37,7 +37,7 @@ class tensor : public basic
 
        // other constructors
 protected:
-       tensor(unsigned ti) : inherited(ti) {}
+       tensor(tinfo_t ti) : inherited(ti) {}
 
        // functions overriding virtual functions from base classes
 protected:
diff --git a/ginac/tinfos.h b/ginac/tinfos.h
deleted file mode 100644 (file)
index 6f14bf0..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/** @file tinfos.h
- *
- *  Values for a do-it-yourself typeinfo scheme. */
-
-/*
- *  GiNaC Copyright (C) 1999-2005 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifndef __GINAC_TINFOS_H__
-#define __GINAC_TINFOS_H__
-
-namespace GiNaC {
-
-const unsigned TINFO_basic         = 0x00000001U;
-
-const unsigned TINFO_expairseq     = 0x00010001U;
-const unsigned TINFO_add           = 0x00011001U;
-const unsigned TINFO_mul           = 0x00011002U;
-
-const unsigned TINFO_symbol        = 0x00020001U;
-const unsigned TINFO_constant      = 0x00021001U;
-
-const unsigned TINFO_exprseq       = 0x00030001U;
-const unsigned TINFO_function      = 0x00031001U;
-const unsigned TINFO_fderivative   = 0x00032001U;
-const unsigned TINFO_ncmul         = 0x00031002U;
-const unsigned TINFO_integral      = 0x00033001U;
-
-const unsigned TINFO_lst           = 0x00040001U;
-
-const unsigned TINFO_matrix        = 0x00050001U;
-
-const unsigned TINFO_power         = 0x00060001U;
-
-const unsigned TINFO_relational    = 0x00070001U;
-
-const unsigned TINFO_fail          = 0x00080001U;
-
-const unsigned TINFO_numeric       = 0x00090001U;
-
-const unsigned TINFO_pseries       = 0x000a0001U;
-
-const unsigned TINFO_indexed       = 0x000b0001U;
-const unsigned TINFO_color         = 0x000b1000U;
-// reserved up to                    0x000b10ffU
-// for color algebras (only used for return_type_tinfo())
-const unsigned TINFO_clifford      = 0x000b1100U;
-// reserved up to                    0x000b11ffU
-// for clifford algebras (only used for return_type_tinfo())
-
-const unsigned TINFO_structure     = 0x000c0001U;
-// reserved up to                    0x000cffffU
-// for user defined structures
-
-const unsigned TINFO_idx           = 0x000d0001U;
-const unsigned TINFO_varidx        = 0x000d1001U;
-const unsigned TINFO_spinidx       = 0x000d2001U;
-
-const unsigned TINFO_tensor        = 0x000e0001U;
-const unsigned TINFO_tensdelta     = 0x000e1001U;
-const unsigned TINFO_tensmetric    = 0x000e1002U;
-const unsigned TINFO_minkmetric    = 0x000e2001U;
-const unsigned TINFO_spinmetric    = 0x000e2002U;
-const unsigned TINFO_tensepsilon   = 0x000e1003U;
-const unsigned TINFO_su3one        = 0x000e1008U;
-const unsigned TINFO_su3t          = 0x000e1009U;
-const unsigned TINFO_su3f          = 0x000e100aU;
-const unsigned TINFO_su3d          = 0x000e100bU;
-const unsigned TINFO_diracone      = 0x000e100cU;
-const unsigned TINFO_diracgamma    = 0x000e100dU;
-const unsigned TINFO_cliffordunit  = 0x000e101dU;
-const unsigned TINFO_diracgamma5   = 0x000e100eU;
-const unsigned TINFO_diracgammaL   = 0x000e100fU;
-const unsigned TINFO_diracgammaR   = 0x000e1010U;
-
-const unsigned TINFO_wildcard      = 0x000f0001U;
-
-const unsigned TINFO_symmetry      = 0x00100001U;
-
-} // namespace GiNaC
-
-#endif // ndef __GINAC_TINFOS_H__
index ae17f53ae34df211c07fd1a0f02c001a219b8e1e..6a8739cf2048d89f0b0b94154abe81b267bdce65 100644 (file)
@@ -4,7 +4,7 @@
  *  of any interest to the user of the library. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -391,7 +391,7 @@ extern const ex _ex120;
 // Helper macros for class implementations (mostly useful for trivial classes)
 
 #define DEFAULT_CTOR(classname) \
-classname::classname() : inherited(TINFO_##classname) { setflag(status_flags::evaluated | status_flags::expanded); }
+classname::classname() : inherited(&classname::tinfo_static) { setflag(status_flags::evaluated | status_flags::expanded); }
 
 #define DEFAULT_UNARCHIVE(classname) \
 ex classname::unarchive(const archive_node &n, lst &sym_lst) \
index 8bf8c6a739c1b7e5c6307f21805c5f33cd879159..84a67317a3542cfca4b964ec0a9c1a978bd03e26 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's wildcard objects. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2006 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
@@ -37,7 +37,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(wildcard, basic,
 // default constructor
 //////////
 
-wildcard::wildcard() : inherited(TINFO_wildcard), label(0)
+wildcard::wildcard() : inherited(&wildcard::tinfo_static), label(0)
 {
        setflag(status_flags::evaluated | status_flags::expanded);
 }
@@ -46,7 +46,7 @@ wildcard::wildcard() : inherited(TINFO_wildcard), label(0)
 // other constructors
 //////////
 
-wildcard::wildcard(unsigned l) : inherited(TINFO_wildcard), label(l)
+wildcard::wildcard(unsigned l) : inherited(&wildcard::tinfo_static), label(l)
 {
        setflag(status_flags::evaluated | status_flags::expanded);
 }
@@ -106,7 +106,7 @@ unsigned wildcard::calchash() const
        // this is where the schoolbook method
        // (golden_ratio_hash(tinfo()) ^ label)
        // is not good enough yet...
-       hashvalue = golden_ratio_hash(golden_ratio_hash(tinfo()) ^ label);
+       hashvalue = golden_ratio_hash(golden_ratio_hash((unsigned)tinfo()) ^ label);
        setflag(status_flags::hash_calculated);
        return hashvalue;
 }
index 68fe2b99654c31fa1097cfdd91d9d88faad37737..1e51b3768ad181693132a39a9c683a72f84ecce3 100644 (file)
@@ -63,12 +63,6 @@ private:
 
 // utility functions
 
-/** Specialization of is_exactly_a<wildcard>(obj) for wildcard objects. */
-template<> inline bool is_exactly_a<wildcard>(const basic & obj)
-{
-        return obj.tinfo()==TINFO_wildcard;
-}
-
 /** Create a wildcard object with the specified label. */
 inline ex wild(unsigned label = 0)
 {