]> www.ginac.de Git - ginac.git/blobdiff - ginac/utils.h
fixed operator precedence
[ginac.git] / ginac / utils.h
index 0af6707afbb85c4a911d7404c58a0f4426e23dc4..117e84ca7e294a265192765597d288a998c26ee7 100644 (file)
@@ -4,7 +4,7 @@
  *  of any interest to the user of the library. */
 
 /*
- *  GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2004 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
@@ -38,10 +38,12 @@ namespace GiNaC {
 class dunno {};
 
 // some compilers (e.g. cygwin) define a macro log2, causing confusion
-#ifndef log2
-unsigned log2(unsigned n);
+#ifdef log2
+#undef log2
 #endif
 
+unsigned log2(unsigned n);
+
 /** Compare two pointers (just to establish some sort of canonical order).
  *  @return -1, 0, or 1 */
 template <class T>
@@ -438,7 +440,7 @@ extern const ex _ex120;
 // Helper macros for class implementations (mostly useful for trivial classes)
 
 #define DEFAULT_CTOR(classname) \
-classname::classname() : inherited(TINFO_##classname) {}
+classname::classname() : inherited(TINFO_##classname) { setflag(status_flags::evaluated | status_flags::expanded); }
 
 #define DEFAULT_UNARCHIVE(classname) \
 ex classname::unarchive(const archive_node &n, lst &sym_lst) \
@@ -462,23 +464,16 @@ int classname::compare_same_type(const basic & other) const \
 }
 
 #define DEFAULT_PRINT(classname, text) \
-void classname::print(const print_context & c, unsigned level) const \
+void classname::do_print(const print_context & c, unsigned level) const \
 { \
-       if (is_a<print_tree>(c)) \
-               inherited::print(c, level); \
-       else \
-               c.s << text; \
+       c.s << text; \
 }
 
 #define DEFAULT_PRINT_LATEX(classname, text, latex) \
-void classname::print(const print_context & c, unsigned level) const \
+DEFAULT_PRINT(classname, text) \
+void classname::do_print_latex(const print_latex & c, unsigned level) const \
 { \
-       if (is_a<print_tree>(c)) \
-               inherited::print(c, level); \
-       else if (is_a<print_latex>(c)) \
-               c.s << latex; \
-       else \
-               c.s << text; \
+       c.s << latex; \
 }
 
 } // namespace GiNaC