* Implementation of GiNaC's wildcard objects. */
/*
- * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2003 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <iostream>
+
#include "wildcard.h"
#include "print.h"
#include "archive.h"
#include "utils.h"
-#include "debugmsg.h"
namespace GiNaC {
GINAC_IMPLEMENT_REGISTERED_CLASS(wildcard, basic)
//////////
-// default constructor, destructor, copy constructor assignment operator and helpers
+// default constructor
//////////
-wildcard::wildcard() : label(0)
-{
- debugmsg("wildcard default constructor", LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_wildcard;
-}
-
-void wildcard::copy(const wildcard & other)
+wildcard::wildcard() : inherited(TINFO_wildcard), label(0)
{
- inherited::copy(other);
- label = other.label;
+ setflag(status_flags::evaluated | status_flags::expanded);
}
-DEFAULT_DESTROY(wildcard)
-
//////////
// other constructors
//////////
-wildcard::wildcard(unsigned l) : label(l)
+wildcard::wildcard(unsigned l) : inherited(TINFO_wildcard), label(l)
{
- debugmsg("wildcard constructor from unsigned", LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_wildcard;
+ setflag(status_flags::evaluated | status_flags::expanded);
}
//////////
// archiving
//////////
-wildcard::wildcard(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
+wildcard::wildcard(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst)
{
- debugmsg("wildcard constructor from archive_node", LOGLEVEL_CONSTRUCT);
n.find_unsigned("label", label);
+ setflag(status_flags::evaluated | status_flags::expanded);
}
void wildcard::archive(archive_node &n) const
void wildcard::print(const print_context & c, unsigned level) const
{
- debugmsg("wildcard print", LOGLEVEL_PRINT);
-
if (is_a<print_tree>(c)) {
c.s << std::string(level, ' ') << class_name() << " (" << label << ")"
<< std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec
<< std::endl;
+ } else if (is_a<print_python_repr>(c)) {
+ c.s << class_name() << '(' << label << ')';
} else
c.s << "$" << label;
}
-unsigned wildcard::calchash(void) const
+unsigned wildcard::calchash() const
{
// this is where the schoolbook method
// (golden_ratio_hash(tinfo()) ^ label)