+/** Construct object from archive_node. */
+symbol::symbol(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
+{
+ debugmsg("symbol ctor from archive_node", LOGLEVEL_CONSTRUCT);
+ serial = next_serial++;
+ if (!(n.find_string("name", name)))
+ name = autoname_prefix() + ToString(serial);
+ if (!(n.find_string("TeXname", TeX_name)))
+ TeX_name = default_TeX_name();
+ asexinfop = new assigned_ex_info;
+ setflag(status_flags::evaluated);
+}
+
+/** Unarchive the object. */
+ex symbol::unarchive(const archive_node &n, const 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 (unsigned i=0; i<sym_lst.nops(); i++) {
+ if (is_ex_of_type(sym_lst.op(i), symbol) && (ex_to<symbol>(sym_lst.op(i)).name == ex_to<symbol>(s).name))
+ return sym_lst.op(i);
+ }
+ return s;
+}