X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Futils.h;h=117e84ca7e294a265192765597d288a998c26ee7;hp=0af6707afbb85c4a911d7404c58a0f4426e23dc4;hb=948071fb79e925111799128dacff49296c69f2ca;hpb=68fdf425abf14d016d5f95ee7b9d06a19a3c5926 diff --git a/ginac/utils.h b/ginac/utils.h index 0af6707a..117e84ca 100644 --- a/ginac/utils.h +++ b/ginac/utils.h @@ -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 @@ -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(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(c)) \ - inherited::print(c, level); \ - else if (is_a(c)) \ - c.s << latex; \ - else \ - c.s << text; \ + c.s << latex; \ } } // namespace GiNaC