+ debugmsg("constant ctor from string, numeric",LOGLEVEL_CONSTRUCT);
+ if (texname.empty())
+ TeX_name = "\\mbox{" + name + "}";
+ else
+ TeX_name = texname;
+ setflag(status_flags::evaluated);
+}
+
+//////////
+// archiving
+//////////
+
+constant::constant(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
+{
+ debugmsg("constant ctor from archive_node", LOGLEVEL_CONSTRUCT);
+}
+
+ex constant::unarchive(const archive_node &n, const 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)
+ std::string s;
+ if (n.find_string("name", s)) {
+ if (s == Pi.name)
+ return Pi;
+ else if (s == Catalan.name)
+ return Catalan;
+ else if (s == Euler.name)
+ return Euler;
+ else
+ throw (std::runtime_error("unknown constant '" + s + "' in archive"));
+ } else
+ throw (std::runtime_error("unnamed constant in archive"));
+}
+
+void constant::archive(archive_node &n) const
+{
+ inherited::archive(n);
+ n.add_string("name", name);