X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;ds=sidebyside;f=ginac%2Fwildcard.cpp;h=9409938d1e6de86a9b61f9fc7d9b22376f14ba92;hb=2b0ad5c381dc081cc4066b0c5f939f5169ad9ab3;hp=ea2a7f7742948781585716b2484ba01f47599e90;hpb=67467d256b44f5e08498ca81c946d9ffaa25d1e2;p=ginac.git diff --git a/ginac/wildcard.cpp b/ginac/wildcard.cpp index ea2a7f77..9409938d 100644 --- a/ginac/wildcard.cpp +++ b/ginac/wildcard.cpp @@ -37,7 +37,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(wildcard, basic, // default constructor ////////// -wildcard::wildcard() : inherited(&wildcard::tinfo_static), label(0) +wildcard::wildcard() : label(0) { setflag(status_flags::evaluated | status_flags::expanded); } @@ -46,7 +46,7 @@ wildcard::wildcard() : inherited(&wildcard::tinfo_static), label(0) // other constructors ////////// -wildcard::wildcard(unsigned l) : inherited(&wildcard::tinfo_static), label(l) +wildcard::wildcard(unsigned l) : label(l) { setflag(status_flags::evaluated | status_flags::expanded); } @@ -55,11 +55,13 @@ wildcard::wildcard(unsigned l) : inherited(&wildcard::tinfo_static), label(l) // archiving ////////// -wildcard::wildcard(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) +void wildcard::read_archive(const archive_node& n, lst& sym_lst) { + inherited::read_archive(n, sym_lst); n.find_unsigned("label", label); setflag(status_flags::evaluated | status_flags::expanded); } +GINAC_BIND_UNARCHIVER(wildcard); void wildcard::archive(archive_node &n) const { @@ -67,8 +69,6 @@ void wildcard::archive(archive_node &n) const n.add_unsigned("label", label); } -DEFAULT_UNARCHIVE(wildcard) - ////////// // functions overriding virtual functions from base classes ////////// @@ -104,14 +104,15 @@ void wildcard::do_print_python_repr(const print_python_repr & c, unsigned level) unsigned wildcard::calchash() const { // this is where the schoolbook method - // (golden_ratio_hash(tinfo()) ^ label) + // (golden_ratio_hash(typeid(*this).name()) ^ label) // is not good enough yet... - hashvalue = golden_ratio_hash(golden_ratio_hash((p_int)tinfo()) ^ label); + const void* this_tinfo = (const void*)typeid(*this).name(); + hashvalue = golden_ratio_hash(golden_ratio_hash((p_int)this_tinfo) ^ label); setflag(status_flags::hash_calculated); return hashvalue; } -bool wildcard::match(const ex & pattern, lst & repl_lst) const +bool wildcard::match(const ex & pattern, exmap& repl_lst) const { // Wildcards must match each other exactly (this is required for // subs() to work properly because in the final step it substitutes