X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Futils.cpp;h=390036c5d495cfb0e4940a044cf933940ca336d3;hp=f05bb1d4ed939b81865a45408cd9f0aaedf388e8;hb=73081e1cccfec32a9e9dab6a5e4b063b3fa0e7fb;hpb=cfea748404dec5fb2f2e3310d36eeb6640f13824 diff --git a/ginac/utils.cpp b/ginac/utils.cpp index f05bb1d4..390036c5 100644 --- a/ginac/utils.cpp +++ b/ginac/utils.cpp @@ -4,7 +4,7 @@ * but not of any interest to the user of the library. */ /* - * GiNaC Copyright (C) 1999-2001 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 @@ -39,13 +39,11 @@ pole_error::pole_error(const std::string& what_arg, int degree) : domain_error(what_arg), deg(degree) { } /** Return the degree of the pole_error exception class. */ -int pole_error::degree(void) const +int pole_error::degree() const { return deg; } -// some compilers (e.g. cygwin) define a macro log2, causing confusion -#ifndef log2 /** Integer binary logarithm */ unsigned log2(unsigned n) { @@ -54,7 +52,6 @@ unsigned log2(unsigned n) ++k; return k; } -#endif ////////// @@ -187,6 +184,7 @@ const ex _ex_1_4= _num_1_4; // static numeric 0 const numeric *_num0_p; +const basic *_num0_bp; const numeric &_num0 = *_num0_p; const ex _ex0 = _num0; @@ -315,55 +313,71 @@ const ex _ex120 = _num120; library_init::library_init() { if (count++==0) { - _num_120_p= reinterpret_cast(&((new numeric(-120))->setflag(status_flags::dynallocated))); - _num_60_p = reinterpret_cast(&((new numeric(-60))->setflag(status_flags::dynallocated))); - _num_48_p = reinterpret_cast(&((new numeric(-48))->setflag(status_flags::dynallocated))); - _num_30_p = reinterpret_cast(&((new numeric(-30))->setflag(status_flags::dynallocated))); - _num_25_p = reinterpret_cast(&((new numeric(-25))->setflag(status_flags::dynallocated))); - _num_24_p = reinterpret_cast(&((new numeric(-24))->setflag(status_flags::dynallocated))); - _num_20_p = reinterpret_cast(&((new numeric(-20))->setflag(status_flags::dynallocated))); - _num_18_p = reinterpret_cast(&((new numeric(-18))->setflag(status_flags::dynallocated))); - _num_15_p = reinterpret_cast(&((new numeric(-15))->setflag(status_flags::dynallocated))); - _num_12_p = reinterpret_cast(&((new numeric(-12))->setflag(status_flags::dynallocated))); - _num_11_p = reinterpret_cast(&((new numeric(-11))->setflag(status_flags::dynallocated))); - _num_10_p = reinterpret_cast(&((new numeric(-10))->setflag(status_flags::dynallocated))); - _num_9_p = reinterpret_cast(&((new numeric(-9))->setflag(status_flags::dynallocated))); - _num_8_p = reinterpret_cast(&((new numeric(-8))->setflag(status_flags::dynallocated))); - _num_7_p = reinterpret_cast(&((new numeric(-7))->setflag(status_flags::dynallocated))); - _num_6_p = reinterpret_cast(&((new numeric(-6))->setflag(status_flags::dynallocated))); - _num_5_p = reinterpret_cast(&((new numeric(-5))->setflag(status_flags::dynallocated))); - _num_4_p = reinterpret_cast(&((new numeric(-4))->setflag(status_flags::dynallocated))); - _num_3_p = reinterpret_cast(&((new numeric(-3))->setflag(status_flags::dynallocated))); - _num_2_p = reinterpret_cast(&((new numeric(-2))->setflag(status_flags::dynallocated))); - _num_1_p = reinterpret_cast(&((new numeric(-1))->setflag(status_flags::dynallocated))); - _num_1_2_p= reinterpret_cast(&((new numeric(-1,2))->setflag(status_flags::dynallocated))); - _num_1_3_p= reinterpret_cast(&((new numeric(-1,3))->setflag(status_flags::dynallocated))); - _num_1_4_p= reinterpret_cast(&((new numeric(-1,4))->setflag(status_flags::dynallocated))); - _num0_p = reinterpret_cast(&((new numeric(0))->setflag(status_flags::dynallocated))); - _num1_4_p = reinterpret_cast(&((new numeric(1,4))->setflag(status_flags::dynallocated))); - _num1_3_p = reinterpret_cast(&((new numeric(1,3))->setflag(status_flags::dynallocated))); - _num1_2_p = reinterpret_cast(&((new numeric(1,2))->setflag(status_flags::dynallocated))); - _num1_p = reinterpret_cast(&((new numeric(1))->setflag(status_flags::dynallocated))); - _num2_p = reinterpret_cast(&((new numeric(2))->setflag(status_flags::dynallocated))); - _num3_p = reinterpret_cast(&((new numeric(3))->setflag(status_flags::dynallocated))); - _num4_p = reinterpret_cast(&((new numeric(4))->setflag(status_flags::dynallocated))); - _num5_p = reinterpret_cast(&((new numeric(5))->setflag(status_flags::dynallocated))); - _num6_p = reinterpret_cast(&((new numeric(6))->setflag(status_flags::dynallocated))); - _num7_p = reinterpret_cast(&((new numeric(7))->setflag(status_flags::dynallocated))); - _num8_p = reinterpret_cast(&((new numeric(8))->setflag(status_flags::dynallocated))); - _num9_p = reinterpret_cast(&((new numeric(9))->setflag(status_flags::dynallocated))); - _num10_p = reinterpret_cast(&((new numeric(10))->setflag(status_flags::dynallocated))); - _num11_p = reinterpret_cast(&((new numeric(11))->setflag(status_flags::dynallocated))); - _num12_p = reinterpret_cast(&((new numeric(12))->setflag(status_flags::dynallocated))); - _num15_p = reinterpret_cast(&((new numeric(15))->setflag(status_flags::dynallocated))); - _num18_p = reinterpret_cast(&((new numeric(18))->setflag(status_flags::dynallocated))); - _num20_p = reinterpret_cast(&((new numeric(20))->setflag(status_flags::dynallocated))); - _num24_p = reinterpret_cast(&((new numeric(24))->setflag(status_flags::dynallocated))); - _num25_p = reinterpret_cast(&((new numeric(25))->setflag(status_flags::dynallocated))); - _num30_p = reinterpret_cast(&((new numeric(30))->setflag(status_flags::dynallocated))); - _num48_p = reinterpret_cast(&((new numeric(48))->setflag(status_flags::dynallocated))); - _num60_p = reinterpret_cast(&((new numeric(60))->setflag(status_flags::dynallocated))); - _num120_p = reinterpret_cast(&((new numeric(120))->setflag(status_flags::dynallocated))); + _num_120_p= static_cast(&((new numeric(-120))->setflag(status_flags::dynallocated))); + _num_60_p = static_cast(&((new numeric(-60))->setflag(status_flags::dynallocated))); + _num_48_p = static_cast(&((new numeric(-48))->setflag(status_flags::dynallocated))); + _num_30_p = static_cast(&((new numeric(-30))->setflag(status_flags::dynallocated))); + _num_25_p = static_cast(&((new numeric(-25))->setflag(status_flags::dynallocated))); + _num_24_p = static_cast(&((new numeric(-24))->setflag(status_flags::dynallocated))); + _num_20_p = static_cast(&((new numeric(-20))->setflag(status_flags::dynallocated))); + _num_18_p = static_cast(&((new numeric(-18))->setflag(status_flags::dynallocated))); + _num_15_p = static_cast(&((new numeric(-15))->setflag(status_flags::dynallocated))); + _num_12_p = static_cast(&((new numeric(-12))->setflag(status_flags::dynallocated))); + _num_11_p = static_cast(&((new numeric(-11))->setflag(status_flags::dynallocated))); + _num_10_p = static_cast(&((new numeric(-10))->setflag(status_flags::dynallocated))); + _num_9_p = static_cast(&((new numeric(-9))->setflag(status_flags::dynallocated))); + _num_8_p = static_cast(&((new numeric(-8))->setflag(status_flags::dynallocated))); + _num_7_p = static_cast(&((new numeric(-7))->setflag(status_flags::dynallocated))); + _num_6_p = static_cast(&((new numeric(-6))->setflag(status_flags::dynallocated))); + _num_5_p = static_cast(&((new numeric(-5))->setflag(status_flags::dynallocated))); + _num_4_p = static_cast(&((new numeric(-4))->setflag(status_flags::dynallocated))); + _num_3_p = static_cast(&((new numeric(-3))->setflag(status_flags::dynallocated))); + _num_2_p = static_cast(&((new numeric(-2))->setflag(status_flags::dynallocated))); + _num_1_p = static_cast(&((new numeric(-1))->setflag(status_flags::dynallocated))); + _num_1_2_p= static_cast(&((new numeric(-1,2))->setflag(status_flags::dynallocated))); + _num_1_3_p= static_cast(&((new numeric(-1,3))->setflag(status_flags::dynallocated))); + _num_1_4_p= static_cast(&((new numeric(-1,4))->setflag(status_flags::dynallocated))); + _num0_p = static_cast(&((new numeric(0))->setflag(status_flags::dynallocated))); + _num0_bp = _num0_p; // Cf. class ex default ctor. + _num1_4_p = static_cast(&((new numeric(1,4))->setflag(status_flags::dynallocated))); + _num1_3_p = static_cast(&((new numeric(1,3))->setflag(status_flags::dynallocated))); + _num1_2_p = static_cast(&((new numeric(1,2))->setflag(status_flags::dynallocated))); + _num1_p = static_cast(&((new numeric(1))->setflag(status_flags::dynallocated))); + _num2_p = static_cast(&((new numeric(2))->setflag(status_flags::dynallocated))); + _num3_p = static_cast(&((new numeric(3))->setflag(status_flags::dynallocated))); + _num4_p = static_cast(&((new numeric(4))->setflag(status_flags::dynallocated))); + _num5_p = static_cast(&((new numeric(5))->setflag(status_flags::dynallocated))); + _num6_p = static_cast(&((new numeric(6))->setflag(status_flags::dynallocated))); + _num7_p = static_cast(&((new numeric(7))->setflag(status_flags::dynallocated))); + _num8_p = static_cast(&((new numeric(8))->setflag(status_flags::dynallocated))); + _num9_p = static_cast(&((new numeric(9))->setflag(status_flags::dynallocated))); + _num10_p = static_cast(&((new numeric(10))->setflag(status_flags::dynallocated))); + _num11_p = static_cast(&((new numeric(11))->setflag(status_flags::dynallocated))); + _num12_p = static_cast(&((new numeric(12))->setflag(status_flags::dynallocated))); + _num15_p = static_cast(&((new numeric(15))->setflag(status_flags::dynallocated))); + _num18_p = static_cast(&((new numeric(18))->setflag(status_flags::dynallocated))); + _num20_p = static_cast(&((new numeric(20))->setflag(status_flags::dynallocated))); + _num24_p = static_cast(&((new numeric(24))->setflag(status_flags::dynallocated))); + _num25_p = static_cast(&((new numeric(25))->setflag(status_flags::dynallocated))); + _num30_p = static_cast(&((new numeric(30))->setflag(status_flags::dynallocated))); + _num48_p = static_cast(&((new numeric(48))->setflag(status_flags::dynallocated))); + _num60_p = static_cast(&((new numeric(60))->setflag(status_flags::dynallocated))); + _num120_p = static_cast(&((new numeric(120))->setflag(status_flags::dynallocated))); + + // Initialize print context class info (this is not strictly necessary + // but we do it anyway to make print_context_class_info::dump_hierarchy() + // output the whole hierarchy whether or not the classes are actually + // used) + print_context::get_class_info_static(); + print_dflt::get_class_info_static(); + print_latex::get_class_info_static(); + print_python::get_class_info_static(); + print_python_repr::get_class_info_static(); + print_tree::get_class_info_static(); + print_csrc::get_class_info_static(); + print_csrc_float::get_class_info_static(); + print_csrc_double::get_class_info_static(); + print_csrc_cl_N::get_class_info_static(); } } @@ -384,10 +398,10 @@ library_init::~library_init() // member functions - // default ctor, dtor, copy ctor, assignment operator and helpers + // default constructor, destructor, copy constructor and assignment operator // none - // other ctors + // other constructors // none // functions overriding virtual functions from base classes @@ -408,14 +422,14 @@ library_init::~library_init() ////////// -// default ctor, dtor, copy ctor, assignment operator and helpers +// default constructor, destructor, copy constructor and assignment operator ////////// // public // protected ////////// -// other ctors +// other constructors ////////// // public