]> www.ginac.de Git - ginac.git/commitdiff
- carried on with felonious plot about making ex::bp private.
authorRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Sat, 18 Aug 2001 21:46:14 +0000 (21:46 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Sat, 18 Aug 2001 21:46:14 +0000 (21:46 +0000)
ginac/basic.cpp
ginac/numeric.cpp
ginac/operators.cpp
ginac/power.cpp
ginac/pseries.cpp
ginac/symbol.cpp
ginac/wildcard.cpp
ginsh/ginsh_parser.yy

index 8baa3536a83d296e78facabc7436d4cdefa46a2e..1aff2e16671edfbd530c06dd6e0392ee35902b01 100644 (file)
@@ -196,9 +196,9 @@ ex & basic::let_op(int i)
 
 ex basic::operator[](const ex & index) const
 {
-       if (is_exactly_of_type(*index.bp,numeric))
-               return op(static_cast<const numeric &>(*index.bp).to_int());
-       
+       if (is_ex_exactly_of_type(index,numeric))
+               return op(ex_to<numeric>(index).to_int());
+
        throw(std::invalid_argument("non-numeric indices not supported by this type"));
 }
 
index 0303b6d7ccee81b647e6d4777819b8a061c8f662..bdd8903c72068f4bb254cb277273af5f3be75342 100644 (file)
@@ -537,9 +537,9 @@ bool numeric::info(unsigned inf) const
  *  sign as a multiplicative factor. */
 bool numeric::has(const ex &other) const
 {
-       if (!is_exactly_of_type(*other.bp, numeric))
+       if (!is_ex_exactly_of_type(other, numeric))
                return false;
-       const numeric &o = static_cast<const numeric &>(*other.bp);
+       const numeric &o = ex_to<numeric>(other);
        if (this->is_equal(o) || this->is_equal(-o))
                return true;
        if (o.imag().is_zero())  // e.g. scan for 3 in -3*I
index 00c33a73c0a0971bd71cae6d767fd558c62d04f7..31c4cf03c3994f39a83b0bb4ffec8197083cf193 100644 (file)
@@ -223,7 +223,7 @@ const ex operator++(ex & lh, int)
        return tmp;
 }
 
-/** Expression Postfix decrement.  Returns the ex and leaves the original
+/** Expression postfix decrement.  Returns the ex and leaves the original
  *  decremented by 1. */
 const ex operator--(ex & lh, int)
 {
@@ -259,7 +259,7 @@ const numeric operator++(numeric & lh, int)
        return tmp;
 }
 
-/** Numeric Postfix decrement.  Returns the number and leaves the original
+/** Numeric postfix decrement.  Returns the number and leaves the original
  *  decremented by 1. */
 const numeric operator--(numeric & lh, int)
 {
index c1568145d706157e250375ff8189f5caee944872..c3f348da095c4d4f0f824de7dd3ae99332a1338b 100644 (file)
@@ -240,7 +240,7 @@ ex power::map(map_function & f) const
 
 int power::degree(const ex & s) const
 {
-       if (is_exactly_of_type(*exponent.bp, numeric) && ex_to<numeric>(exponent).is_integer()) {
+       if (is_ex_exactly_of_type(exponent, numeric) && ex_to<numeric>(exponent).is_integer()) {
                if (basis.is_equal(s))
                        return ex_to<numeric>(exponent).to_int();
                else
@@ -251,7 +251,7 @@ int power::degree(const ex & s) const
 
 int power::ldegree(const ex & s) const 
 {
-       if (is_exactly_of_type(*exponent.bp, numeric) && ex_to<numeric>(exponent).is_integer()) {
+       if (is_ex_exactly_of_type(exponent, numeric) && ex_to<numeric>(exponent).is_integer()) {
                if (basis.is_equal(s))
                        return ex_to<numeric>(exponent).to_int();
                else
@@ -270,7 +270,7 @@ ex power::coeff(const ex & s, int n) const
                        return _ex0();
        } else {
                // basis equal to s
-               if (is_exactly_of_type(*exponent.bp, numeric) && ex_to<numeric>(exponent).is_integer()) {
+               if (is_ex_exactly_of_type(exponent, numeric) && ex_to<numeric>(exponent).is_integer()) {
                        // integer exponent
                        int int_exp = ex_to<numeric>(exponent).to_int();
                        if (n == int_exp)
@@ -318,13 +318,13 @@ ex power::eval(int level) const
        const numeric *num_basis;
        const numeric *num_exponent;
        
-       if (is_exactly_of_type(*ebasis.bp,numeric)) {
+       if (is_ex_exactly_of_type(ebasis, numeric)) {
                basis_is_numerical = true;
-               num_basis = static_cast<const numeric *>(ebasis.bp);
+               num_basis = &ex_to<numeric>(ebasis);
        }
-       if (is_exactly_of_type(*eexponent.bp,numeric)) {
+       if (is_ex_exactly_of_type(eexponent, numeric)) {
                exponent_is_numerical = true;
-               num_exponent = static_cast<const numeric *>(eexponent.bp);
+               num_exponent = &ex_to<numeric>(eexponent);
        }
        
        // ^(x,0) -> 1  (0^0 also handled here)
index 7ae30a9c7266a17e5d9481b1776cb975e8079783..441ee40842b4e514ee623c37f0e472986ccf2277 100644 (file)
@@ -489,7 +489,7 @@ bool pseries::is_terminating(void) const
 ex basic::series(const relational & r, int order, unsigned options) const
 {
        epvector seq;
-       numeric fac(1);
+       numeric fac = 1;
        ex deriv = *this;
        ex coeff = deriv.subs(r);
        const symbol &s = ex_to<symbol>(r.lhs());
index f5fd4a090b0df1f1ab66440b730d31b520104ada..322a45c4e790da602d4cafab565aee492fa50c2e 100644 (file)
@@ -182,17 +182,17 @@ bool symbol::info(unsigned inf) const
 
 int symbol::degree(const ex & s) const
 {
-       return is_equal(*s.bp) ? 1 : 0;
+       return is_equal(ex_to<basic>(s)) ? 1 : 0;
 }
 
 int symbol::ldegree(const ex & s) const
 {
-       return is_equal(*s.bp) ? 1 : 0;
+       return is_equal(ex_to<basic>(s)) ? 1 : 0;
 }
 
 ex symbol::coeff(const ex & s, int n) const
 {
-       if (is_equal(*s.bp))
+       if (is_equal(ex_to<basic>(s)))
                return n==1 ? _ex1() : _ex0();
        else
                return n==0 ? *this : _ex0();
index 5d88146f1b76d763c9f94e6dfd44e6a5c0d96b5d..c6dca58cb32a6400a200c0ca754f8709729f64f3 100644 (file)
@@ -118,7 +118,7 @@ bool wildcard::match(const ex & pattern, lst & repl_lst) const
        // Wildcards must match each other exactly (this is required for
        // subs() to work properly because in the final step it substitutes
        // all wildcards by their matching expressions)
-       return is_equal(*pattern.bp);
+       return is_equal(ex_to<basic>(pattern));
 }
 
 } // namespace GiNaC
index 6020efbcb4575233eba5c517771434d526339fb6..50d2a23baeda22cece30cdd2f607cfa2edf5dd66 100644 (file)
@@ -203,9 +203,9 @@ exp : T_NUMBER              {$$ = $1;}
        | T_SYMBOL '(' exprseq ')' {
                fcn_tab::const_iterator i = find_function($1, $3.nops());
                if (i->second.is_ginac) {
-                       $$ = ((fcnp2)(i->second.p))(static_cast<const exprseq &>(*($3.bp)), i->second.serial);
+                       $$ = ((fcnp2)(i->second.p))(ex_to<exprseq>($3), i->second.serial);
                } else {
-                       $$ = (i->second.p)(static_cast<const exprseq &>(*($3.bp)));
+                       $$ = (i->second.p)(ex_to<exprseq>($3));
                }
        }
        | T_DIGITS '=' T_NUMBER {$$ = $3; Digits = ex_to<numeric>($3).to_int();}
@@ -230,7 +230,7 @@ exp : T_NUMBER              {$$ = $1;}
        ;
 
 exprseq        : exp                   {$$ = exprseq($1);}
-       | exprseq ',' exp       {exprseq es(static_cast<exprseq &>(*($1.bp))); $$ = es.append($3);}
+       | exprseq ',' exp       {exprseq es(ex_to<exprseq>($1)); $$ = es.append($3);}
        ;
 
 list_or_empty: /* empty */     {$$ = *new lst;}
@@ -238,15 +238,15 @@ list_or_empty: /* empty */        {$$ = *new lst;}
        ;
 
 list   : exp                   {$$ = lst($1);}
-       | list ',' exp          {lst l(static_cast<lst &>(*($1.bp))); $$ = l.append($3);}
+       | list ',' exp          {lst l(ex_to<lst>($1)); $$ = l.append($3);}
        ;
 
 matrix : '[' row ']'           {$$ = lst($2);}
-       | matrix ',' '[' row ']' {lst l(static_cast<lst &>(*($1.bp))); $$ = l.append($4);}
+       | matrix ',' '[' row ']' {lst l(ex_to<lst>($1)); $$ = l.append($4);}
        ;
 
 row    : exp                   {$$ = lst($1);}
-       | row ',' exp           {lst l(static_cast<lst &>(*($1.bp))); $$ = l.append($3);}
+       | row ',' exp           {lst l(ex_to<lst>($1)); $$ = l.append($3);}
        ;