Subject: Mathemagix
List archive
- From: Grégoire Lecerf <address@concealed>
- To: address@concealed
- Subject: Re: [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs]
- Date: Fri, 19 Oct 2007 14:58:36 +0200
That would be better to agree on a uniform and clean solution :-)
Julien, could you try the attached file in replacement without any other previously discussed modification?
Joris, Bernard, does this solution seem ok?
Grégoire.
Joris van der Hoeven a écrit :
Yes, the problem is probably due to the order in which variables
are initialized. Please try to replace "generic" by "string"
for the types of the declarations in basix_globals.hpp and
basix_globals.cpp. Last time I compiled on MacOS X,
I also managed to get things working by chaning the order of
the sources to put basic_globals.cpp last instead of first.
The first solution is a bit more portable though, albeit slower.
/******************************************************************************
* MODULE : mixed_symbol.hpp
* DESCRIPTION: mixed_symbol<T> is an ad hoc union of T and symbol<T>
* This class is used for source tracking of compound expressions
* COPYRIGHT : (C) 2004 Joris van der Hoeven
*******************************************************************************
* This software falls under the GNU general public license and comes WITHOUT
* ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
* If you don't have this file, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
#ifndef __MMX_MIXED_SYMBOL_HPP
#define __MMX_MIXED_SYMBOL_HPP
#include "basix/table.hpp"
namespace mmx {
#define TMPL_DEF template<typename C>
#define TMPL template<typename C>
#define Mixed_symbol mixed_symbol<C>
#define Mixed_symbol_rep mixed_symbol_rep<C>
TMPL class mixed_symbol_rep;
TMPL class mixed_symbol;
TMPL inline nat soft_hash (const Mixed_symbol& s);
TMPL inline nat hash (const Mixed_symbol& s);
TMPL inline bool eq (const Mixed_symbol& s1, const Mixed_symbol& s2);
TMPL inline bool neq (const Mixed_symbol& s1, const Mixed_symbol& s2);
TMPL inline bool operator == (const Mixed_symbol& s1, const Mixed_symbol& s2);
TMPL inline bool operator != (const Mixed_symbol& s1, const Mixed_symbol& s2);
TMPL inline Mixed_symbol melt (const Mixed_symbol& s);
TMPL inline Mixed_symbol fuse (const Mixed_symbol& s);
/******************************************************************************
* Mixed_symbol class and its representation class
******************************************************************************/
TMPL_DEF
class mixed_symbol_rep REP_STRUCT {
public: // FIXME: should become private
static table<Mixed_symbol_rep*,C,eq_op>& mixed_symbol_entries () {
static table<Mixed_symbol_rep*,C,eq_op>* t =
new table<Mixed_symbol_rep*,C,eq_op>((Mixed_symbol_rep*) NULL);
return *t;
}
private:
C ref;
nat h;
bool shared;
public:
inline Mixed_symbol_rep (const C& ref2):
ref (ref2), h (soft_hash (ref)), shared (true) {
static table<Mixed_symbol_rep*,C,eq_op>& t =
Mixed_symbol_rep::mixed_symbol_entries ();
t [ref]= this;
}
inline Mixed_symbol_rep (const C& ref2, bool unique2):
ref (ref2), h (soft_hash (ref)), shared (false) {}
inline ~Mixed_symbol_rep () {
static table<Mixed_symbol_rep*,C,eq_op>& t
= Mixed_symbol_rep::mixed_symbol_entries ();
if (shared) reset (t, ref);
}
friend nat soft_hash LESSGTR (const Mixed_symbol& s);
friend nat hash LESSGTR (const Mixed_symbol& s);
friend bool eq LESSGTR (const Mixed_symbol& s1, const Mixed_symbol& s2);
friend bool neq LESSGTR (const Mixed_symbol& s1, const Mixed_symbol& s2);
friend bool operator == LESSGTR
(const Mixed_symbol& s1, const Mixed_symbol& s2);
friend bool operator != LESSGTR
(const Mixed_symbol& s1, const Mixed_symbol& s2);
friend Mixed_symbol melt LESSGTR (const Mixed_symbol& s);
friend Mixed_symbol fuse LESSGTR (const Mixed_symbol& s);
friend class Mixed_symbol;
};
TMPL_DEF
class mixed_symbol {
INDIRECT_PROTO_1 (mixed_symbol, mixed_symbol_rep, C)
public:
mixed_symbol (const C& ref) {
static table<Mixed_symbol_rep*,C,eq_op>& t =
Mixed_symbol_rep::mixed_symbol_entries ();
rep= read (t, ref);
if (rep == (Mixed_symbol_rep*) NULL) rep= new Mixed_symbol_rep (ref);
else INC_COUNT (rep);
}
mixed_symbol (const C& ref, bool unique) {
// the created object *this is not shared
ASSERT (unique, "unexpected situation (mixed_symbol)");
rep= new Mixed_symbol_rep (ref, true);
}
inline const C& operator * () const { return rep->ref; };
friend nat soft_hash LESSGTR (const Mixed_symbol& s);
friend nat hash LESSGTR (const Mixed_symbol& s);
friend bool eq LESSGTR (const Mixed_symbol& s1, const Mixed_symbol& s2);
friend bool neq LESSGTR (const Mixed_symbol& s1, const Mixed_symbol& s2);
friend bool operator == LESSGTR
(const Mixed_symbol& s1, const Mixed_symbol& s2);
friend bool operator != LESSGTR
(const Mixed_symbol& s1, const Mixed_symbol& s2);
friend Mixed_symbol melt LESSGTR (const Mixed_symbol& s);
friend Mixed_symbol fuse LESSGTR (const Mixed_symbol& s);
};
INDIRECT_IMPL_1 (mixed_symbol, mixed_symbol_rep, typename C, C)
/******************************************************************************
* Routines related to equality testing
******************************************************************************/
TMPL inline nat soft_hash (const Mixed_symbol& s) {
return s.rep->h; }
TMPL inline nat hash (const Mixed_symbol& s) {
return hash (s.rep->ref); }
TMPL inline bool eq (const Mixed_symbol& s1, const Mixed_symbol& s2) {
if (s1.rep->shared && s2.rep->shared) return s1.rep == s2.rep;
else return eq (s1.rep->ref, s2.rep->ref); }
TMPL inline bool neq (const Mixed_symbol& s1, const Mixed_symbol& s2) {
if (s1.rep->shared && s2.rep->shared) return s1.rep != s2.rep;
else return neq (s1.rep->ref, s2.rep->ref); }
TMPL inline bool operator == (const Mixed_symbol& s1, const Mixed_symbol& s2) {
return s1.rep == s2.rep || s1.rep->ref == s2.rep->ref; }
TMPL inline bool operator != (const Mixed_symbol& s1, const Mixed_symbol& s2) {
return s1.rep != s2.rep && s1.rep->ref != s2.rep->ref; }
TMPL inline Mixed_symbol melt (const Mixed_symbol& s) {
return Mixed_symbol (melt (*s), true); }
TMPL inline Mixed_symbol fuse (const Mixed_symbol& s) {
if (!s.rep->shared) return fuse (Mixed_symbol (*s));
inside (s)->ref= fuse (s->ref); return s; }
/******************************************************************************
* Printing
******************************************************************************/
TMPL inline generic flatten (const Mixed_symbol& s) {
return generic ("mixed_symbol") (flatten (*s)); }
PRINT_SUGAR(TMPL,Mixed_symbol)
#undef TMPL_DEF
#undef TMPL
#undef Mixed_symbol
#undef Mixed_symbol_rep
} // namespace mmx
#endif // __MMX_MIXED_SYMBOL_HPP
- [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs], Bernard . Mourrain, 10/18/2007
- Re: [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs], Grégoire Lecerf, 10/19/2007
- Re: [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs], Joris van der Hoeven, 10/19/2007
- Re: [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs], Grégoire Lecerf, 10/19/2007
- Re: [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs], Joris van der Hoeven, 10/19/2007
- Re: [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs], Julien Wintz, 10/19/2007
- Re: [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs], Grégoire Lecerf, 10/19/2007
- Re: [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs], Julien Wintz, 10/19/2007
- Re: [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs], Joris van der Hoeven, 10/22/2007
- Re: [Mathemagix] Re: [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs], Grégoire Lecerf, 10/22/2007
- Re: [Mathemagix] Re: [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs], Joris van der Hoeven, 10/22/2007
- Re: [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs], Grégoire Lecerf, 10/19/2007
- Re: [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs], Julien Wintz, 10/19/2007
- Re: [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs], Joris van der Hoeven, 10/19/2007
- Re: [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs], Grégoire Lecerf, 10/19/2007
- Re: [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs], Joris van der Hoeven, 10/19/2007
- Re: [Fwd: [Mmx-commits] Bug report: mmx crashes on intel based macs], Grégoire Lecerf, 10/19/2007
Archive powered by MHonArc 2.6.18.