From 47837c4973890ce46756f0865f2347f76bd2b015 Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Wed, 26 Mar 2003 19:59:47 +0000 Subject: [PATCH] - added stream manipulators index_dimensions and no_index_dimensions - using print() and print_context (and derived classes) in user code is now deprecated in favor of the manipulators - print_options moved from flags.h to print.h - a symbol that appears multiple times in archives but is not listed in the sym_lst passed to unarchive_ex() now receives the same serial number in all occurrences, so GiNaC will treat it as one and the same symbol; this made it necessary to remove the "const" from the second argument of basic::unarchive() and the unarchiving constructor --- ginac/archive.cpp | 14 +++++++---- ginac/archive.h | 4 ++-- ginac/basic.cpp | 8 +++---- ginac/clifford.cpp | 2 +- ginac/color.cpp | 2 +- ginac/constant.cpp | 4 ++-- ginac/container.pl | 4 ++-- ginac/ex.cpp | 7 ------ ginac/ex.h | 1 - ginac/expairseq.cpp | 2 +- ginac/fderivative.cpp | 2 +- ginac/flags.h | 8 ------- ginac/function.pl | 4 ++-- ginac/idx.cpp | 6 ++--- ginac/indexed.cpp | 2 +- ginac/matrix.cpp | 2 +- ginac/numeric.cpp | 2 +- ginac/operators.cpp | 56 ++++++++++++++++++++++++++++++++++++------- ginac/operators.h | 5 +++- ginac/power.cpp | 2 +- ginac/print.h | 17 +++++++++++++ ginac/pseries.cpp | 2 +- ginac/registrar.h | 6 ++--- ginac/relational.cpp | 2 +- ginac/symbol.cpp | 9 ++++--- ginac/symmetry.cpp | 2 +- ginac/tensor.cpp | 4 ++-- ginac/utils.h | 4 ++-- ginac/wildcard.cpp | 2 +- 29 files changed, 117 insertions(+), 68 deletions(-) diff --git a/ginac/archive.cpp b/ginac/archive.cpp index 28d8afc3..69a73441 100644 --- a/ginac/archive.cpp +++ b/ginac/archive.cpp @@ -26,6 +26,7 @@ #include "archive.h" #include "registrar.h" #include "ex.h" +#include "lst.h" #include "config.h" #include "tostring.h" @@ -89,7 +90,8 @@ ex archive::unarchive_ex(const lst &sym_lst, const char *name) const found: // Recursively unarchive all nodes, starting at the root node - return nodes[i->root].unarchive(sym_lst); + lst sym_lst_copy = sym_lst; + return nodes[i->root].unarchive(sym_lst_copy); } ex archive::unarchive_ex(const lst &sym_lst, unsigned index) const @@ -98,7 +100,8 @@ ex archive::unarchive_ex(const lst &sym_lst, unsigned index) const throw (std::range_error("index of archived expression out of range")); // Recursively unarchive all nodes, starting at the root node - return nodes[exprs[index].root].unarchive(sym_lst); + lst sym_lst_copy = sym_lst; + return nodes[exprs[index].root].unarchive(sym_lst_copy); } ex archive::unarchive_ex(const lst &sym_lst, std::string &name, unsigned index) const @@ -110,7 +113,8 @@ ex archive::unarchive_ex(const lst &sym_lst, std::string &name, unsigned index) name = unatomize(exprs[index].name); // Recursively unarchive all nodes, starting at the root node - return nodes[exprs[index].root].unarchive(sym_lst); + lst sym_lst_copy = sym_lst; + return nodes[exprs[index].root].unarchive(sym_lst_copy); } unsigned archive::num_expressions(void) const @@ -432,7 +436,7 @@ bool archive_node::find_string(const std::string &name, std::string &ret, unsign return false; } -bool archive_node::find_ex(const std::string &name, ex &ret, const lst &sym_lst, unsigned index) const +bool archive_node::find_ex(const std::string &name, ex &ret, lst &sym_lst, unsigned index) const { archive_atom name_atom = a.atomize(name); std::vector::const_iterator i = props.begin(), iend = props.end(); @@ -493,7 +497,7 @@ void archive_node::get_properties(propinfovector &v) const /** Convert archive node to GiNaC expression. */ -ex archive_node::unarchive(const lst &sym_lst) const +ex archive_node::unarchive(lst &sym_lst) const { // Already unarchived? Then return cached unarchived expression. if (has_expression) diff --git a/ginac/archive.h b/ginac/archive.h index b7e9ba98..8b7ae4f3 100644 --- a/ginac/archive.h +++ b/ginac/archive.h @@ -110,7 +110,7 @@ public: /** Retrieve property of type "ex" from node. * @return "true" if property was found, "false" otherwise */ - bool find_ex(const std::string &name, ex &ret, const lst &sym_lst, unsigned index = 0) const; + bool find_ex(const std::string &name, ex &ret, lst &sym_lst, unsigned index = 0) const; /** Retrieve property of type "ex" from node, returning the node of * the sub-expression. */ @@ -119,7 +119,7 @@ public: /** Return vector of properties stored in node. */ void get_properties(propinfovector &v) const; - ex unarchive(const lst &sym_lst) const; + ex unarchive(lst &sym_lst) const; bool has_same_ex_as(const archive_node &other) const; void forget(void); diff --git a/ginac/basic.cpp b/ginac/basic.cpp index a79ac065..85294cac 100644 --- a/ginac/basic.cpp +++ b/ginac/basic.cpp @@ -79,7 +79,7 @@ const basic & basic::operator=(const basic & other) ////////// /** Construct object from archive_node. */ -basic::basic(const archive_node &n, const lst &sym_lst) : flags(0), refcount(0) +basic::basic(const archive_node &n, lst &sym_lst) : flags(0), refcount(0) { // Reconstruct tinfo_key from class name std::string class_name; @@ -128,7 +128,8 @@ void basic::print(const print_context & c, unsigned level) const * debugger because it might not know what cout is. This method can be * invoked with no argument and it will simply print to stdout. * - * @see basic::print */ + * @see basic::print + * @see basic::dbgprinttree */ void basic::dbgprint(void) const { this->print(std::cerr); @@ -137,8 +138,7 @@ void basic::dbgprint(void) const /** Little wrapper around printtree to be called within a debugger. * - * @see basic::dbgprint - * @see basic::printtree */ + * @see basic::dbgprint */ void basic::dbgprinttree(void) const { this->print(print_tree(std::cerr)); diff --git a/ginac/clifford.cpp b/ginac/clifford.cpp index 1ab5eef5..a8b87343 100644 --- a/ginac/clifford.cpp +++ b/ginac/clifford.cpp @@ -104,7 +104,7 @@ clifford::clifford(unsigned char rl, exvector * vp) : inherited(sy_none(), vp), // archiving ////////// -clifford::clifford(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +clifford::clifford(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { unsigned rl; n.find_unsigned("label", rl); diff --git a/ginac/color.cpp b/ginac/color.cpp index 9600065d..7405c4aa 100644 --- a/ginac/color.cpp +++ b/ginac/color.cpp @@ -99,7 +99,7 @@ color::color(unsigned char rl, exvector * vp) : inherited(sy_none(), vp), repres // archiving ////////// -color::color(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +color::color(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { unsigned rl; n.find_unsigned("label", rl); diff --git a/ginac/constant.cpp b/ginac/constant.cpp index 1557bc00..6fc37366 100644 --- a/ginac/constant.cpp +++ b/ginac/constant.cpp @@ -96,9 +96,9 @@ constant::constant(const std::string & initname, const numeric & initnumber, con // archiving ////////// -constant::constant(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) {} +constant::constant(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) {} -ex constant::unarchive(const archive_node &n, const lst &sym_lst) +ex constant::unarchive(const archive_node &n, lst &sym_lst) { // Find constant by name (!! this is bad: 'twould be better if there // was a list of all global constants that we could search) diff --git a/ginac/container.pl b/ginac/container.pl index 945622fe..7dcd0be6 100755 --- a/ginac/container.pl +++ b/ginac/container.pl @@ -398,7 +398,7 @@ ${constructors_implementation} ////////// /** Construct object from archive_node. */ -${CONTAINER}::${CONTAINER}(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +${CONTAINER}::${CONTAINER}(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { for (unsigned int i=0; true; i++) { ex e; @@ -410,7 +410,7 @@ ${CONTAINER}::${CONTAINER}(const archive_node &n, const lst &sym_lst) : inherite } /** Unarchive the object. */ -ex ${CONTAINER}::unarchive(const archive_node &n, const lst &sym_lst) +ex ${CONTAINER}::unarchive(const archive_node &n, lst &sym_lst) { return (new ${CONTAINER}(n, sym_lst))->setflag(status_flags::dynallocated); } diff --git a/ginac/ex.cpp b/ginac/ex.cpp index 2c31212c..3c6d5048 100644 --- a/ginac/ex.cpp +++ b/ginac/ex.cpp @@ -59,13 +59,6 @@ void ex::print(const print_context & c, unsigned level) const bp->print(c, level); } -/** Print expression to stream in a tree-like format suitable for debugging. */ -void ex::printtree(std::ostream & os) const -{ - GINAC_ASSERT(bp!=0); - bp->print(print_tree(os)); -} - /** Little wrapper arount print to be called within a debugger. */ void ex::dbgprint(void) const { diff --git a/ginac/ex.h b/ginac/ex.h index 5e8ac0de..3c8094b1 100644 --- a/ginac/ex.h +++ b/ginac/ex.h @@ -111,7 +111,6 @@ public: } void print(const print_context & c, unsigned level = 0) const; - void printtree(std::ostream & os) const; void dbgprint(void) const; void dbgprinttree(void) const; bool info(unsigned inf) const { return bp->info(inf); } diff --git a/ginac/expairseq.cpp b/ginac/expairseq.cpp index 3e2b549c..c41c694b 100644 --- a/ginac/expairseq.cpp +++ b/ginac/expairseq.cpp @@ -146,7 +146,7 @@ expairseq::expairseq(epvector *vp, const ex &oc) // archiving ////////// -expairseq::expairseq(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +expairseq::expairseq(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) #if EXPAIRSEQ_USE_HASHTAB , hashtabsize(0) #endif diff --git a/ginac/fderivative.cpp b/ginac/fderivative.cpp index 8216179d..3b209387 100644 --- a/ginac/fderivative.cpp +++ b/ginac/fderivative.cpp @@ -73,7 +73,7 @@ fderivative::fderivative(unsigned ser, const paramset & params, exvector * vp) : // archiving ////////// -fderivative::fderivative(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +fderivative::fderivative(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { unsigned i = 0; while (true) { diff --git a/ginac/flags.h b/ginac/flags.h index 0427bc51..04c430c4 100644 --- a/ginac/flags.h +++ b/ginac/flags.h @@ -248,14 +248,6 @@ public: }; }; -/** Flags to control the behavior of print(). */ -class print_options { -public: - enum { - print_index_dimensions = 0x0001 ///< print the dimensions of indices - }; -}; - } // namespace GiNaC #endif // ndef __GINAC_FLAGS_H__ diff --git a/ginac/function.pl b/ginac/function.pl index fba34e20..ad372f55 100755 --- a/ginac/function.pl +++ b/ginac/function.pl @@ -630,7 +630,7 @@ function::function(unsigned ser, exvector * vp) ////////// /** Construct object from archive_node. */ -function::function(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +function::function(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { // Find serial number by function name std::string s; @@ -650,7 +650,7 @@ function::function(const archive_node &n, const lst &sym_lst) : inherited(n, sym } /** Unarchive the object. */ -ex function::unarchive(const archive_node &n, const lst &sym_lst) +ex function::unarchive(const archive_node &n, lst &sym_lst) { return (new function(n, sym_lst))->setflag(status_flags::dynallocated); } diff --git a/ginac/idx.cpp b/ginac/idx.cpp index 277bc316..55475568 100644 --- a/ginac/idx.cpp +++ b/ginac/idx.cpp @@ -103,18 +103,18 @@ spinidx::spinidx(const ex & v, const ex & d, bool cov, bool dot) : inherited(v, // archiving ////////// -idx::idx(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +idx::idx(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { n.find_ex("value", value, sym_lst); n.find_ex("dim", dim, sym_lst); } -varidx::varidx(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +varidx::varidx(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { n.find_bool("covariant", covariant); } -spinidx::spinidx(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +spinidx::spinidx(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { n.find_bool("dotted", dotted); } diff --git a/ginac/indexed.cpp b/ginac/indexed.cpp index 5799642a..695768f6 100644 --- a/ginac/indexed.cpp +++ b/ginac/indexed.cpp @@ -144,7 +144,7 @@ indexed::indexed(const symmetry & symm, exvector * vp) : inherited(vp), symtree( // archiving ////////// -indexed::indexed(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +indexed::indexed(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { if (!n.find_ex("symmetry", symtree, sym_lst)) { // GiNaC versions <= 0.9.0 had an unsigned "symmetry" property diff --git a/ginac/matrix.cpp b/ginac/matrix.cpp index fe24e09e..df1b4c91 100644 --- a/ginac/matrix.cpp +++ b/ginac/matrix.cpp @@ -108,7 +108,7 @@ matrix::matrix(unsigned r, unsigned c, const lst & l) // archiving ////////// -matrix::matrix(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +matrix::matrix(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { if (!(n.find_unsigned("row", row)) || !(n.find_unsigned("col", col))) throw (std::runtime_error("unknown matrix dimensions in archive")); diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index 9eaa715b..37a1ba3f 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -245,7 +245,7 @@ numeric::numeric(const cln::cl_N &z) : basic(TINFO_numeric) // archiving ////////// -numeric::numeric(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +numeric::numeric(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { cln::cl_N ctorval = 0; diff --git a/ginac/operators.cpp b/ginac/operators.cpp index ae198706..d588b98d 100644 --- a/ginac/operators.cpp +++ b/ginac/operators.cpp @@ -283,26 +283,29 @@ static int my_ios_index() return i; } +// Stream format gets copied or destroyed static void my_ios_callback(std::ios_base::event ev, std::ios_base & s, int i) { print_context *p = static_cast(s.pword(i)); if (ev == std::ios_base::erase_event) { delete p; s.pword(i) = 0; - } else if (ev == std::ios_base::copyfmt_event && p != 0) { + } else if (ev == std::ios_base::copyfmt_event && p != 0) s.pword(i) = p->duplicate(); - } } enum { callback_registered = 1 }; -static print_context *get_print_context(std::ios_base & s) +// Get print_context associated with stream, may return 0 if no context has +// been associated yet +static inline print_context *get_print_context(std::ios_base & s) { return static_cast(s.pword(my_ios_index())); } +// Set print_context associated with stream, retain options static void set_print_context(std::ios_base & s, const print_context & c) { int i = my_ios_index(); @@ -311,16 +314,38 @@ static void set_print_context(std::ios_base & s, const print_context & c) s.register_callback(my_ios_callback, i); s.iword(i) = flags | callback_registered; } - delete static_cast(s.pword(i)); - s.pword(i) = c.duplicate(); + print_context *p = static_cast(s.pword(i)); + unsigned options = p ? p->options : c.options; + delete p; + p = c.duplicate(); + p->options = options; + s.pword(i) = p; +} + +// Get options for print_context associated with stream +static inline unsigned get_print_options(std::ios_base & s) +{ + print_context *p = get_print_context(s); + return p ? p->options : 0; +} + +// Set options for print_context associated with stream +static void set_print_options(std::ostream & s, unsigned options) +{ + print_context *p = get_print_context(s); + if (p == 0) + set_print_context(s, print_context(s, options)); + else + p->options = options; } std::ostream & operator<<(std::ostream & os, const ex & e) { - if (get_print_context(os) == 0) + print_context *p = get_print_context(os); + if (p == 0) e.print(print_context(os)); else - e.print(*get_print_context(os)); + e.print(*p); return os; } @@ -332,6 +357,7 @@ std::istream & operator>>(std::istream & is, ex & e) std::ostream & dflt(std::ostream & os) { set_print_context(os, print_context(os)); + set_print_options(os, 0); return os; } @@ -359,6 +385,12 @@ std::ostream & tree(std::ostream & os) return os; } +std::ostream & csrc(std::ostream & os) +{ + set_print_context(os, print_csrc_double(os)); + return os; +} + std::ostream & csrc_float(std::ostream & os) { set_print_context(os, print_csrc_float(os)); @@ -377,9 +409,15 @@ std::ostream & csrc_cl_N(std::ostream & os) return os; } -std::ostream & csrc(std::ostream & os) +std::ostream & index_dimensions(std::ostream & os) { - set_print_context(os, print_csrc_double(os)); + set_print_options(os, get_print_options(os) | print_options::print_index_dimensions); + return os; +} + +std::ostream & no_index_dimensions(std::ostream & os) +{ + set_print_options(os, get_print_options(os) & ~print_options::print_index_dimensions); return os; } diff --git a/ginac/operators.h b/ginac/operators.h index fe72e6e3..33e1c3e6 100644 --- a/ginac/operators.h +++ b/ginac/operators.h @@ -91,10 +91,13 @@ std::ostream & latex(std::ostream & os); std::ostream & python(std::ostream & os); std::ostream & python_repr(std::ostream & os); std::ostream & tree(std::ostream & os); +std::ostream & csrc(std::ostream & os); // same as csrc_double std::ostream & csrc_float(std::ostream & os); std::ostream & csrc_double(std::ostream & os); std::ostream & csrc_cl_N(std::ostream & os); -std::ostream & csrc(std::ostream & os); // same as csrc_double + +std::ostream & index_dimensions(std::ostream & os); +std::ostream & no_index_dimensions(std::ostream & os); } // namespace GiNaC diff --git a/ginac/power.cpp b/ginac/power.cpp index 6ca771a8..07a52ebe 100644 --- a/ginac/power.cpp +++ b/ginac/power.cpp @@ -73,7 +73,7 @@ DEFAULT_DESTROY(power) // archiving ////////// -power::power(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +power::power(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { n.find_ex("basis", basis, sym_lst); n.find_ex("exponent", exponent, sym_lst); diff --git a/ginac/print.h b/ginac/print.h index b98318c0..8d4fc2f8 100644 --- a/ginac/print.h +++ b/ginac/print.h @@ -28,6 +28,23 @@ namespace GiNaC { + +/* + * The following classes remain publicly visible for compatibility + * reasons only. New code should use the iostream manipulators defined + * in operators.h instead. + */ + + +/** Flags to control the behavior of a print_context. */ +class print_options { +public: + enum { + print_index_dimensions = 0x0001 ///< print the dimensions of indices + }; +}; + + /** Context for default (ginsh-parsable) output. */ class print_context { diff --git a/ginac/pseries.cpp b/ginac/pseries.cpp index 0f1f08d9..0d2dde29 100644 --- a/ginac/pseries.cpp +++ b/ginac/pseries.cpp @@ -85,7 +85,7 @@ pseries::pseries(const ex &rel_, const epvector &ops_) : basic(TINFO_pseries), s * Archiving */ -pseries::pseries(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +pseries::pseries(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { for (unsigned int i=0; true; ++i) { ex rest; diff --git a/ginac/registrar.h b/ginac/registrar.h index e620250e..77a6e873 100644 --- a/ginac/registrar.h +++ b/ginac/registrar.h @@ -34,7 +34,7 @@ class lst; /** Unarchiving function (static member function of every GiNaC class). */ -typedef ex (*unarch_func)(const archive_node &n, const lst &sym_lst); +typedef ex (*unarch_func)(const archive_node &n, lst &sym_lst); /** Head of list of all registered_class_info structures. */ @@ -65,9 +65,9 @@ public: \ typedef supername inherited; \ static registered_class_info reg_info; \ virtual const char *class_name(void) const; \ - classname(const archive_node &n, const lst &sym_lst); \ + classname(const archive_node &n, lst &sym_lst); \ virtual void archive(archive_node &n) const; \ - static ex unarchive(const archive_node &n, const lst &sym_lst); + static ex unarchive(const archive_node &n, lst &sym_lst); /** Macro for inclusion in the declaration of each registered class. * It declares some functions that are common to all classes derived diff --git a/ginac/relational.cpp b/ginac/relational.cpp index 70dc5bd0..24fd7a05 100644 --- a/ginac/relational.cpp +++ b/ginac/relational.cpp @@ -62,7 +62,7 @@ relational::relational(const ex & lhs, const ex & rhs, operators oper) : basic(T // archiving ////////// -relational::relational(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +relational::relational(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { unsigned int opi; if (!(n.find_unsigned("op", opi))) diff --git a/ginac/symbol.cpp b/ginac/symbol.cpp index af98215a..43e3684c 100644 --- a/ginac/symbol.cpp +++ b/ginac/symbol.cpp @@ -93,7 +93,7 @@ symbol::symbol(const std::string & initname, const std::string & texname) : inhe ////////// /** Construct object from archive_node. */ -symbol::symbol(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +symbol::symbol(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { serial = next_serial++; if (!(n.find_string("name", name))) @@ -105,15 +105,18 @@ symbol::symbol(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst } /** Unarchive the object. */ -ex symbol::unarchive(const archive_node &n, const lst &sym_lst) +ex symbol::unarchive(const archive_node &n, lst &sym_lst) { ex s = (new symbol(n, sym_lst))->setflag(status_flags::dynallocated); - + // If symbol is in sym_lst, return the existing symbol for (size_t i=0; i(sym_lst.op(i)) && (ex_to(sym_lst.op(i)).name == ex_to(s).name)) return sym_lst.op(i); } + + // Otherwise add new symbol to list and return it + sym_lst.append(s); return s; } diff --git a/ginac/symmetry.cpp b/ginac/symmetry.cpp index 473bd5b9..2058a279 100644 --- a/ginac/symmetry.cpp +++ b/ginac/symmetry.cpp @@ -90,7 +90,7 @@ symmetry::symmetry(symmetry_type t, const symmetry &c1, const symmetry &c2) : ty ////////// /** Construct object from archive_node. */ -symmetry::symmetry(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +symmetry::symmetry(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { unsigned t; if (!(n.find_unsigned("type", t))) diff --git a/ginac/tensor.cpp b/ginac/tensor.cpp index eef89a1e..5e95a414 100644 --- a/ginac/tensor.cpp +++ b/ginac/tensor.cpp @@ -107,7 +107,7 @@ DEFAULT_ARCHIVING(spinmetric) DEFAULT_UNARCHIVE(minkmetric) DEFAULT_UNARCHIVE(tensepsilon) -minkmetric::minkmetric(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +minkmetric::minkmetric(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { n.find_bool("pos_sig", pos_sig); } @@ -118,7 +118,7 @@ void minkmetric::archive(archive_node &n) const n.add_bool("pos_sig", pos_sig); } -tensepsilon::tensepsilon(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +tensepsilon::tensepsilon(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) { n.find_bool("minkowski", minkowski); n.find_bool("pos_sig", pos_sig); diff --git a/ginac/utils.h b/ginac/utils.h index b2ae4b1b..f21dfed4 100644 --- a/ginac/utils.h +++ b/ginac/utils.h @@ -465,13 +465,13 @@ DEFAULT_COPY(classname) \ DEFAULT_DESTROY(classname) #define DEFAULT_UNARCHIVE(classname) \ -ex classname::unarchive(const archive_node &n, const lst &sym_lst) \ +ex classname::unarchive(const archive_node &n, lst &sym_lst) \ { \ return (new classname(n, sym_lst))->setflag(status_flags::dynallocated); \ } #define DEFAULT_ARCHIVING(classname) \ -classname::classname(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) {} \ +classname::classname(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) {} \ DEFAULT_UNARCHIVE(classname) \ void classname::archive(archive_node &n) const \ { \ diff --git a/ginac/wildcard.cpp b/ginac/wildcard.cpp index c389c98f..22ab5f07 100644 --- a/ginac/wildcard.cpp +++ b/ginac/wildcard.cpp @@ -61,7 +61,7 @@ wildcard::wildcard(unsigned l) : label(l) // 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) { n.find_unsigned("label", label); } -- 2.47.0