]> www.ginac.de Git - ginac.git/blobdiff - ginac/symbol.cpp
Fix some warnings about comparison of signed with unsigned.
[ginac.git] / ginac / symbol.cpp
index 06016984f58f6fb1feeb4bccb9778e20b8d33761..cb7c52490f9c810fa1e5fdb1e4ba518b77552f14 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's symbolic objects. */
 
 /*
- *  GiNaC Copyright (C) 1999-2004 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2005 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
@@ -17,7 +17,7 @@
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <string>
@@ -42,18 +42,29 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(symbol, basic,
 // default constructor
 //////////
 
+// symbol
+
 symbol::symbol()
- : inherited(TINFO_symbol), asexinfop(new assigned_ex_info), serial(next_serial++), name(autoname_prefix() + ToString(serial)), TeX_name(name), ret_type(return_types::commutative), ret_type_tinfo(TINFO_symbol), domain(symbol_options::complex)
+ : inherited(TINFO_symbol), asexinfop(new assigned_ex_info), serial(next_serial++), name(autoname_prefix() + ToString(serial)), TeX_name(name), ret_type(return_types::commutative), ret_type_tinfo(TINFO_symbol), domain(domain::complex)
 {
        setflag(status_flags::evaluated | status_flags::expanded);
 }
 
+// realsymbol
+
+realsymbol::realsymbol()
+{
+       domain = domain::real;
+}
+
 //////////
 // other constructors
 //////////
 
 // public
 
+// symbol
+
 symbol::symbol(const std::string & initname, unsigned domain)
  : inherited(TINFO_symbol), asexinfop(new assigned_ex_info), serial(next_serial++), name(initname), TeX_name(default_TeX_name()), ret_type(return_types::commutative), ret_type_tinfo(TINFO_symbol), domain(domain)
 {
@@ -78,6 +89,20 @@ symbol::symbol(const std::string & initname, const std::string & texname, unsign
        setflag(status_flags::evaluated | status_flags::expanded);
 }
 
+// realsymbol
+       
+realsymbol::realsymbol(const std::string & initname, unsigned domain)
+ : symbol(initname, domain) { }
+
+realsymbol::realsymbol(const std::string & initname, const std::string & texname, unsigned domain)
+ : symbol(initname, texname, domain) { }
+
+realsymbol::realsymbol(const std::string & initname, unsigned rt, unsigned rtt, unsigned domain)
+ : symbol(initname, rt, rtt, domain) { }
+
+realsymbol::realsymbol(const std::string & initname, const std::string & texname, unsigned rt, unsigned rtt, unsigned domain)
+ : symbol(initname, texname, rt, rtt, domain) { }
+
 //////////
 // archiving
 //////////
@@ -91,7 +116,7 @@ symbol::symbol(const archive_node &n, lst &sym_lst)
        if (!n.find_string("TeXname", TeX_name))
                TeX_name = default_TeX_name();
        if (!n.find_unsigned("domain", domain))
-               domain = symbol_options::complex;
+               domain = domain::complex;
        if (!n.find_unsigned("return_type", ret_type))
                ret_type = return_types::commutative;
        if (!n.find_unsigned("return_type_tinfo", ret_type_tinfo))
@@ -122,7 +147,7 @@ void symbol::archive(archive_node &n) const
        n.add_string("name", name);
        if (TeX_name != default_TeX_name())
                n.add_string("TeX_name", TeX_name);
-       if (domain != symbol_options::complex)
+       if (domain != domain::complex)
                n.add_unsigned("domain", domain);
        if (ret_type != return_types::commutative)
                n.add_unsigned("return_type", ret_type);
@@ -175,7 +200,7 @@ bool symbol::info(unsigned inf) const
            inf == info_flags::rational_function)
                return true;
        if (inf == info_flags::real)
-               return domain == symbol_options::real;
+               return domain == domain::real;
        else
                return inherited::info(inf);
 }
@@ -198,8 +223,8 @@ ex symbol::eval(int level) const
 
 ex symbol::conjugate() const
 {
-       if (this->domain == symbol_options::complex) {
-               return GiNaC::conjugate(*this).hold();
+       if (this->domain == domain::complex) {
+               return GiNaC::conjugate_function(*this).hold();
        } else {
                return *this;
        }