]> www.ginac.de Git - cln.git/commitdiff
Equip vectors (cl_[SG]V_*) with STL-alike size() method.
authorAlexei Sheplyakov <varg@theor.jinr.ru>
Mon, 15 Sep 2008 21:26:08 +0000 (01:26 +0400)
committerAlexei Sheplyakov <varg@theor.jinr.ru>
Mon, 22 Sep 2008 08:50:37 +0000 (12:50 +0400)
20 files changed:
doc/cln.texi
include/cln/GV.h
include/cln/SV.h
include/cln/string.h
src/base/string/cl_spushstring.h
src/base/string/cl_st_debug.cc
src/base/string/cl_st_hashcode.cc
src/base/string/output/cl_st_print.cc
src/polynomial/elem/cl_UP_GF2.h
src/polynomial/elem/cl_UP_MI.h
src/polynomial/elem/cl_UP_gen.h
src/polynomial/elem/cl_UP_number.h
src/vector/cl_GV_I.cc
src/vector/cl_GV_I_copy.cc
src/vector/cl_GV_number.cc
src/vector/cl_GV_number_copy.cc
src/vector/cl_SV_copy.cc
src/vector/output/cl_GV_number_aprint.cc
src/vector/output/cl_SV_aprint.cc
src/vector/output/cl_SV_number_aprint.cc

index 963d0509859784a0ad2cb5e5d92b4599ddb8a8b7..546d788c4608be4abfc01a8f0719055591a2379a 100644 (file)
@@ -3151,8 +3151,8 @@ The following functions are available on strings:
 @item operator =
 Assignment from @code{cl_string} and @code{const char *}.
 
-@item s.length()
-@cindex @code{length ()}
+@item s.size()
+@cindex @code{size()}
 @itemx strlen(s)
 @cindex @code{strlen ()}
 Returns the length of the string @code{s}.
@@ -3160,7 +3160,7 @@ Returns the length of the string @code{s}.
 @item s[i]
 @cindex @code{operator [] ()}
 Returns the @code{i}th character of the string @code{s}.
-@code{i} must be in the range @code{0 <= i < s.length()}.
+@code{i} must be in the range @code{0 <= i < s.size()}.
 
 @item bool equal (const cl_string& s1, const cl_string& s2)
 @cindex @code{equal ()}
index 4f0a3691b1d0c3b939d866b2696cd449c4bcd960..d1f537731e52f45a339745e735c1f7f6f1f8c5eb 100644 (file)
@@ -11,7 +11,7 @@
 namespace cln {
 
 // A vector is a structure having the following interface:
-//     v.length()        returns the number of elements
+//     v.size()        returns the number of elements
 //     v[i]              returns the i-th element (0<=i<length), as a
 //                       pseudo-lvalue (you can assign to it, but not take its
 //                       address - exactly what you want for bit-vectors)
@@ -27,7 +27,7 @@ class cl_GV_inner {
 protected:
        uintC len; // number of elements
 public:
-       uintC length () const; // number of elements
+       uintC size() const; // number of elements
        cl_GV_vectorops<T>* vectorops; // get/set element
        const cl_GV_index<T> operator[] (unsigned long index);
        const cl_GV_constindex<T> operator[] (unsigned long index) const;
@@ -109,7 +109,7 @@ struct cl_GV_vectorops {
 // All member functions are inline.
 
 template <class T>
-inline uintC cl_GV_inner<T>::length () const
+inline uintC cl_GV_inner<T>::size() const
 {
        return len;
 }
@@ -219,9 +219,9 @@ template <class T, class BASE>
 struct cl_GV : public BASE {
 public:
        // Length.
-       uintC length () const
+       uintC size() const
        {
-               return ((const cl_heap_GV<T> *) this->pointer)->v.length();
+               return ((const cl_heap_GV<T> *) this->pointer)->v.size();
        }
        // Reference. Forbid modification of `const cl_GV&' arguments.
        const cl_GV_constindex<T> operator[] (unsigned long index) const
index 5881b6165090bf1eb585d7ca88e58f16ecb04df3..64342cd3202b121484b722a9346e763259b757fe 100644 (file)
@@ -46,18 +46,18 @@ private:
        T * data() { return (T *) (this+1); }
        const T * data() const { return (const T *) (this+1); }
 public:
-       uintC length () const { return len; } // number of elements
+       uintC size() const { return len; } // number of elements
        const T & operator[] (unsigned long index) const
        {
                #ifndef CL_SV_NO_RANGECHECKS
-               if (!(index < length())) throw runtime_exception();
+               if (!(index < size())) throw runtime_exception();
                #endif
                return data()[index];
        }
        T & operator[] (unsigned long index)
        {
                #ifndef CL_SV_NO_RANGECHECKS
-               if (!(index < length())) throw runtime_exception();
+               if (!(index < size())) throw runtime_exception();
                #endif
                return data()[index];
        }
@@ -115,9 +115,9 @@ template <class T, class BASE>
 struct cl_SV : public BASE {
 public:
        // Length.
-       uintC length () const
+       uintC size() const
        {
-               return ((const cl_heap_SV<T> *) this->pointer)->v.length();
+               return ((const cl_heap_SV<T> *) this->pointer)->v.size();
        }
        // Reference. Forbid modification of `const cl_SV&' arguments.
        const T & operator[] (unsigned long index) const
index f7da4a2c7b9d03d6d85704e09fe7ad7c642c6f98..03f61f54fa4190152d65122ef3a2b4c76b57d050 100644 (file)
@@ -45,14 +45,14 @@ public:
                return &((cl_heap_string*)pointer)->data[0];
        }
        // Return the length (number of characters).
-       unsigned long length () const
+       unsigned long size() const
        {
                return ((cl_heap_string*)pointer)->length;
        }
        // Return a specific character.
        char operator[] (unsigned long i) const
        {
-               if (!(i < length())) throw runtime_exception(); // Range check.
+               if (!(i < size())) throw runtime_exception(); // Range check.
                return ((cl_heap_string*)pointer)->data[i];
        }
        // New ANSI C++ compilers also want the following.
@@ -94,7 +94,7 @@ inline cl_string& cl_string::operator= (const char * s)
 // Length.
 inline unsigned long strlen (const cl_string& str)
 {
-       return str.length();
+       return str.size();
 }
 // Conversion to `const char *'.
 inline const char * asciz (const char * s) { return s; }
@@ -103,7 +103,7 @@ inline const char * asciz (const cl_string& s) { return s.asciz(); }
 // Comparison.
 inline bool equal (const cl_string& str1, const cl_string& str2)
 {
-    return str1.length() == str2.length()
+    return str1.size() == str2.size()
            && !strcmp(str1.asciz(), str2.asciz());
 }
 inline bool equal (const char * str1, const cl_string& str2)
index 67429e0b7d39cd16c5cdcae7a6f1cdabd6d26595..2bad3615a2f90b1024164f8c4e1991a77cc1666c 100644 (file)
@@ -29,7 +29,7 @@ public:
 // Get the contents as a string. Free it using free_hook() when done.
        char* contents ();
 // Look at the contents.
-       uintL length () const;
+       uintL size() const;
        char operator[] (uintL i) const;
 };
 inline cl_spushstring::cl_spushstring ()
@@ -50,7 +50,7 @@ inline char* cl_spushstring::contents ()
 {
        return cl_sstring(buffer,index);
 }
-inline uintL cl_spushstring::length () const
+inline uintL cl_spushstring::size() const
 {
        return index;
 }
index e5ceff1cea2883df96801083da1fcae3782e3283..dfe0d9832e3b493869bce72e4b5cad219cd647b9 100644 (file)
@@ -18,7 +18,7 @@ static void dprint (cl_heap* pointer)
 {
        var const cl_string& obj = *(const cl_string*)&pointer;
        fprint(cl_debugout, "(cl_string) \"");
-       var unsigned long l = obj.length();
+       var unsigned long l = obj.size();
        for (var unsigned long i = 0; i < l; i++) {
                var unsigned char c = obj[i];
                if (c >= 0x20) {
index b67cb649d5199ed95ec111f06fc6038619a47dce..5091a3c2d4e0a56ca789f8224cd0d7f42dc5908a 100644 (file)
@@ -16,7 +16,7 @@ unsigned long hashcode (const cl_string& str)
     var unsigned long code = 0x61284AF3;
     // We walk through all characters. It may take some time for very
     // long strings, but it's better than completely ignoring some characters.
-    var long len = str.length();
+    var long len = str.size();
     var const char * ptr = str.asciz();
     for (; len > 0; len--) {
         var unsigned char c = *ptr++;
index 91a69ecc705d9fe0e7f8ad98caf6622f02d0dbfa..7ccc881b44a3fe8d25a400fae8361f014b9026da 100644 (file)
@@ -15,7 +15,7 @@ namespace cln {
 
 void fprint (std::ostream& stream, const cl_string& str)
 {
-       stream.write(str.asciz(),str.length());
+       stream.write(str.asciz(),str.size());
 }
 
 }  // namespace cln
index 59635a23a7ffcffade5292ec6dce71f3bf3c9c63..1a348feed26514f5f27240bb4aa1471d2fc86621 100644 (file)
@@ -20,8 +20,8 @@ static bool gf2_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP
        unused UPR;
        var const cl_heap_GV_I_bits1 * xv = (const cl_heap_GV_I_bits1 *) x.heappointer;
        var const cl_heap_GV_I_bits1 * yv = (const cl_heap_GV_I_bits1 *) y.heappointer;
-       var uintL xlen = xv->v.length();
-       var uintL ylen = yv->v.length();
+       var uintL xlen = xv->v.size();
+       var uintL ylen = yv->v.size();
        if (!(xlen == ylen))
                return false;
        // We can compare full words since unused bits in the last word are 0.
@@ -37,8 +37,8 @@ static const _cl_UP gf2_plus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const
        DeclarePoly(cl_GV_MI,y);
        var const cl_heap_GV_I_bits1 * xv = (const cl_heap_GV_I_bits1 *) x.heappointer;
        var const cl_heap_GV_I_bits1 * yv = (const cl_heap_GV_I_bits1 *) y.heappointer;
-       var uintL xlen = xv->v.length();
-       var uintL ylen = yv->v.length();
+       var uintL xlen = xv->v.size();
+       var uintL ylen = yv->v.size();
        if (xlen == 0)
                return _cl_UP(UPR, y);
        if (ylen == 0)
@@ -822,8 +822,8 @@ static const _cl_UP gf2_mul (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const
        DeclarePoly(cl_GV_MI,y);
        var const cl_heap_GV_I_bits1 * xv = (const cl_heap_GV_I_bits1 *) x.heappointer;
        var const cl_heap_GV_I_bits1 * yv = (const cl_heap_GV_I_bits1 *) y.heappointer;
-       var uintL xlen = xv->v.length();
-       var uintL ylen = yv->v.length();
+       var uintL xlen = xv->v.size();
+       var uintL ylen = yv->v.size();
        if (xlen == 0)
                return _cl_UP(UPR, x);
        if (ylen == 0)
@@ -943,7 +943,7 @@ static const _cl_UP gf2_square (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
 {{
        DeclarePoly(cl_GV_MI,x);
        var const cl_heap_GV_I_bits1 * xv = (const cl_heap_GV_I_bits1 *) x.heappointer;
-       var uintL xlen = xv->v.length();
+       var uintL xlen = xv->v.size();
        if (xlen == 0)
                return _cl_UP(UPR, x);
        var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
@@ -985,7 +985,7 @@ static const cl_ring_element gf2_eval (cl_heap_univpoly_ring* UPR, const _cl_UP&
   {    DeclarePoly(_cl_MI,y);
        var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
        var const cl_heap_GV_I_bits1 * xv = (const cl_heap_GV_I_bits1 *) x.heappointer;
-       var uintL len = xv->v.length();
+       var uintL len = xv->v.size();
        if (len==0)
                return R->zero();
        if (R->_zerop(y))
index 9b672a67dc4752eeb7c1c41f3a371259aa99f6bf..a35c14d049716d02a9332d4b7d847e2432db158b 100644 (file)
@@ -36,7 +36,7 @@ static void modint_fprint (cl_heap_univpoly_ring* UPR, std::ostream& stream, con
 {{
        DeclarePoly(cl_GV_MI,x);
        var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
-       var sintL xlen = x.length();
+       var sintL xlen = x.size();
        if (xlen == 0)
                fprint(stream, "0");
        else {
@@ -65,8 +65,8 @@ static bool modint_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl
        DeclarePoly(cl_GV_MI,x);
        DeclarePoly(cl_GV_MI,y);
        var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
-       var sintL xlen = x.length();
-       var sintL ylen = y.length();
+       var sintL xlen = x.size();
+       var sintL ylen = y.size();
        if (!(xlen == ylen))
                return false;
        for (var sintL i = xlen-1; i >= 0; i--)
@@ -84,7 +84,7 @@ static bool modint_zerop (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
 {
        unused UPR;
  {     DeclarePoly(cl_GV_MI,x);
-       var sintL xlen = x.length();
+       var sintL xlen = x.size();
        if (xlen == 0)
                return true;
        else
@@ -96,8 +96,8 @@ static const _cl_UP modint_plus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, co
        DeclarePoly(cl_GV_MI,x);
        DeclarePoly(cl_GV_MI,y);
        var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
-       var sintL xlen = x.length();
-       var sintL ylen = y.length();
+       var sintL xlen = x.size();
+       var sintL ylen = y.size();
        if (xlen == 0)
                return _cl_UP(UPR, y);
        if (ylen == 0)
@@ -147,7 +147,7 @@ static const _cl_UP modint_uminus (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
 {{
        DeclarePoly(cl_GV_MI,x);
        var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
-       var sintL xlen = x.length();
+       var sintL xlen = x.size();
        if (xlen == 0)
                return _cl_UP(UPR, x);
        // Now xlen > 0.
@@ -167,8 +167,8 @@ static const _cl_UP modint_minus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, c
        DeclarePoly(cl_GV_MI,x);
        DeclarePoly(cl_GV_MI,y);
        var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
-       var sintL xlen = x.length();
-       var sintL ylen = y.length();
+       var sintL xlen = x.size();
+       var sintL ylen = y.size();
        if (ylen == 0)
                return _cl_UP(UPR, x);
        if (xlen == 0)
@@ -231,8 +231,8 @@ static const _cl_UP modint_mul (cl_heap_univpoly_ring* UPR, const _cl_UP& x, con
        DeclarePoly(cl_GV_MI,x);
        DeclarePoly(cl_GV_MI,y);
        var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
-       var sintL xlen = x.length();
-       var sintL ylen = y.length();
+       var sintL xlen = x.size();
+       var sintL ylen = y.size();
        if (xlen == 0)
                return _cl_UP(UPR, x);
        if (ylen == 0)
@@ -277,7 +277,7 @@ static const _cl_UP modint_square (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
 {{
        DeclarePoly(cl_GV_MI,x);
        var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
-       var sintL xlen = x.length();
+       var sintL xlen = x.size();
        if (xlen == 0)
                return cl_UP(UPR, x);
        var sintL len = 2*xlen-1;
@@ -333,7 +333,7 @@ static const _cl_UP modint_scalmul (cl_heap_univpoly_ring* UPR, const cl_ring_el
        DeclarePoly(_cl_MI,x);
        DeclarePoly(cl_GV_MI,y);
        var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
-       var sintL ylen = y.length();
+       var sintL ylen = y.size();
        if (ylen == 0)
                return _cl_UP(UPR, y);
        if (R->_zerop(x))
@@ -350,14 +350,14 @@ static sintL modint_degree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
 {
        unused UPR;
  {     DeclarePoly(cl_GV_MI,x);
-       return (sintL) x.length() - 1;
+       return (sintL) x.size() - 1;
 }}
 
 static sintL modint_ldegree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
 {{
        DeclarePoly(cl_GV_MI,x);
        var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
-       var sintL xlen = x.length();
+       var sintL xlen = x.size();
        for (sintL i = 0; i < xlen; i++) {
                if (!R->_zerop(x[i]))
                        return i;
@@ -384,7 +384,7 @@ static const cl_ring_element modint_coeff (cl_heap_univpoly_ring* UPR, const _cl
 {{
        DeclarePoly(cl_GV_MI,x);
        var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
-       if (index < x.length())
+       if (index < x.size())
                return cl_MI(R, x[index]);
        else
                return R->zero();
@@ -406,7 +406,7 @@ static void modint_set_coeff (cl_heap_univpoly_ring* UPR, _cl_UP& x, uintL index
        DeclareMutablePoly(cl_GV_MI,x);
        if (!(UPR->basering() == y.ring())) throw runtime_exception();
   {    DeclarePoly(_cl_MI,y);
-       if (!(index < x.length())) throw runtime_exception();
+       if (!(index < x.size())) throw runtime_exception();
        x[index] = y;
 }}}
 
@@ -414,7 +414,7 @@ static void modint_finalize (cl_heap_univpoly_ring* UPR, _cl_UP& x)
 {{
        DeclareMutablePoly(cl_GV_MI,x); // NB: x is modified by reference!
        var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
-       var uintL len = x.length();
+       var uintL len = x.size();
        if (len > 0)
                modint_normalize(R,x,len);
 }}
@@ -429,7 +429,7 @@ static const cl_ring_element modint_eval (cl_heap_univpoly_ring* UPR, const _cl_
        if (!(UPR->basering() == y.ring())) throw runtime_exception();
   {    DeclarePoly(_cl_MI,y);
        var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
-       var uintL len = x.length();
+       var uintL len = x.size();
        if (len==0)
                return R->zero();
        if (R->_zerop(y))
index e827afdc571af218265a1ace457e7aacad22c14b..623a212ddb43bfffee1fd58b9708cb75c5014094 100644 (file)
@@ -32,7 +32,7 @@ static void gen_fprint (cl_heap_univpoly_ring* UPR, std::ostream& stream, const
 {{
        DeclarePoly(cl_SV_ringelt,x);
        var cl_heap_ring* R = TheRing(UPR->basering());
-       var sintL xlen = x.length();
+       var sintL xlen = x.size();
        if (xlen == 0)
                fprint(stream, "0");
        else {
@@ -61,8 +61,8 @@ static bool gen_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP
        DeclarePoly(cl_SV_ringelt,x);
        DeclarePoly(cl_SV_ringelt,y);
        var cl_heap_ring* R = TheRing(UPR->basering());
-       var sintL xlen = x.length();
-       var sintL ylen = y.length();
+       var sintL xlen = x.size();
+       var sintL ylen = y.size();
        if (!(xlen == ylen))
                return false;
        for (var sintL i = xlen-1; i >= 0; i--)
@@ -80,7 +80,7 @@ static bool gen_zerop (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
 {
        unused UPR;
  {     DeclarePoly(cl_SV_ringelt,x);
-       var sintL xlen = x.length();
+       var sintL xlen = x.size();
        if (xlen == 0)
                return true;
        else
@@ -92,8 +92,8 @@ static const _cl_UP gen_plus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const
        DeclarePoly(cl_SV_ringelt,x);
        DeclarePoly(cl_SV_ringelt,y);
        var cl_heap_ring* R = TheRing(UPR->basering());
-       var sintL xlen = x.length();
-       var sintL ylen = y.length();
+       var sintL xlen = x.size();
+       var sintL ylen = y.size();
        if (xlen == 0)
                return _cl_UP(UPR, y);
        if (ylen == 0)
@@ -135,7 +135,7 @@ static const _cl_UP gen_uminus (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
 {{
        DeclarePoly(cl_SV_ringelt,x);
        var cl_heap_ring* R = TheRing(UPR->basering());
-       var sintL xlen = x.length();
+       var sintL xlen = x.size();
        if (xlen == 0)
                return _cl_UP(UPR, x);
        // Now xlen > 0.
@@ -155,8 +155,8 @@ static const _cl_UP gen_minus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, cons
        DeclarePoly(cl_SV_ringelt,x);
        DeclarePoly(cl_SV_ringelt,y);
        var cl_heap_ring* R = TheRing(UPR->basering());
-       var sintL xlen = x.length();
-       var sintL ylen = y.length();
+       var sintL xlen = x.size();
+       var sintL ylen = y.size();
        if (ylen == 0)
                return _cl_UP(UPR, x);
        if (xlen == 0)
@@ -215,8 +215,8 @@ static const _cl_UP gen_mul (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const
        DeclarePoly(cl_SV_ringelt,x);
        DeclarePoly(cl_SV_ringelt,y);
        var cl_heap_ring* R = TheRing(UPR->basering());
-       var sintL xlen = x.length();
-       var sintL ylen = y.length();
+       var sintL xlen = x.size();
+       var sintL ylen = y.size();
        if (xlen == 0)
                return _cl_UP(UPR, x);
        if (ylen == 0)
@@ -261,7 +261,7 @@ static const _cl_UP gen_square (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
 {{
        DeclarePoly(cl_SV_ringelt,x);
        var cl_heap_ring* R = TheRing(UPR->basering());
-       var sintL xlen = x.length();
+       var sintL xlen = x.size();
        if (xlen == 0)
                return cl_UP(UPR, x);
        var sintL len = 2*xlen-1;
@@ -316,7 +316,7 @@ static const _cl_UP gen_scalmul (cl_heap_univpoly_ring* UPR, const cl_ring_eleme
  {
        DeclarePoly(cl_SV_ringelt,y);
        var cl_heap_ring* R = TheRing(UPR->basering());
-       var sintL ylen = y.length();
+       var sintL ylen = y.size();
        if (ylen == 0)
                return _cl_UP(UPR, y);
        if (R->zerop(x))
@@ -334,13 +334,13 @@ static sintL gen_degree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
 {
        unused UPR;
  {     DeclarePoly(cl_SV_ringelt,x);
-       return (sintL) x.length() - 1;
+       return (sintL) x.size() - 1;
 }}
 
 static sintL gen_ldegree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
 {{     DeclarePoly(cl_SV_ringelt,x);
        var cl_heap_ring* R = TheRing(UPR->basering());
-       var sintL xlen = x.length();
+       var sintL xlen = x.size();
        for (sintL i = 0; i < xlen; i++) {
                if (!R->_zerop(x[i]))
                        return i;
@@ -366,7 +366,7 @@ static const cl_ring_element gen_coeff (cl_heap_univpoly_ring* UPR, const _cl_UP
 {{
        DeclarePoly(cl_SV_ringelt,x);
        var cl_heap_ring* R = TheRing(UPR->basering());
-       if (index < x.length())
+       if (index < x.size())
                return cl_ring_element(R, x[index]);
        else
                return R->zero();
@@ -386,7 +386,7 @@ static void gen_set_coeff (cl_heap_univpoly_ring* UPR, _cl_UP& x, uintL index, c
 {{
        DeclareMutablePoly(cl_SV_ringelt,x);
        if (!(UPR->basering() == y.ring())) throw runtime_exception();
-       if (!(index < x.length())) throw runtime_exception();
+       if (!(index < x.size())) throw runtime_exception();
        x[index] = y;
 }}
 
@@ -394,7 +394,7 @@ static void gen_finalize (cl_heap_univpoly_ring* UPR, _cl_UP& x)
 {{
        DeclareMutablePoly(cl_SV_ringelt,x); // NB: x is modified by reference!
        var cl_heap_ring* R = TheRing(UPR->basering());
-       var uintL len = x.length();
+       var uintL len = x.size();
        if (len > 0)
                gen_normalize(R,x,len);
 }}
@@ -408,7 +408,7 @@ static const cl_ring_element gen_eval (cl_heap_univpoly_ring* UPR, const _cl_UP&
        DeclarePoly(cl_SV_ringelt,x);
        var cl_heap_ring* R = TheRing(UPR->basering());
        if (!(y.ring() == R)) throw runtime_exception();
-       var uintL len = x.length();
+       var uintL len = x.size();
        if (len==0)
                return R->zero();
        if (R->_zerop(y))
index b6cb8a843bac1772cb32681678c177547b76665a..50e5cb1052bd5fccfea419929c03c409c59b626e 100644 (file)
@@ -33,7 +33,7 @@ static void num_fprint (cl_heap_univpoly_ring* UPR, std::ostream& stream, const
 {{
        DeclarePoly(cl_SV_number,x);
        var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
-       var sintL xlen = x.length();
+       var sintL xlen = x.size();
        if (xlen == 0)
                fprint(stream, "0");
        else {
@@ -61,8 +61,8 @@ static bool num_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP
        DeclarePoly(cl_SV_number,x);
        DeclarePoly(cl_SV_number,y);
        var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
-       var sintL xlen = x.length();
-       var sintL ylen = y.length();
+       var sintL xlen = x.size();
+       var sintL ylen = y.size();
        if (!(xlen == ylen))
                return false;
        for (var sintL i = xlen-1; i >= 0; i--)
@@ -80,7 +80,7 @@ static bool num_zerop (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
 {
        unused UPR;
  {     DeclarePoly(cl_SV_number,x);
-       var sintL xlen = x.length();
+       var sintL xlen = x.size();
        if (xlen == 0)
                return true;
        else
@@ -92,8 +92,8 @@ static const _cl_UP num_plus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const
        DeclarePoly(cl_SV_number,x);
        DeclarePoly(cl_SV_number,y);
        var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
-       var sintL xlen = x.length();
-       var sintL ylen = y.length();
+       var sintL xlen = x.size();
+       var sintL ylen = y.size();
        if (xlen == 0)
                return _cl_UP(UPR, y);
        if (ylen == 0)
@@ -135,7 +135,7 @@ static const _cl_UP num_uminus (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
 {{
        DeclarePoly(cl_SV_number,x);
        var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
-       var sintL xlen = x.length();
+       var sintL xlen = x.size();
        if (xlen == 0)
                return _cl_UP(UPR, x);
        // Now xlen > 0.
@@ -155,8 +155,8 @@ static const _cl_UP num_minus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, cons
        DeclarePoly(cl_SV_number,x);
        DeclarePoly(cl_SV_number,y);
        var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
-       var sintL xlen = x.length();
-       var sintL ylen = y.length();
+       var sintL xlen = x.size();
+       var sintL ylen = y.size();
        if (ylen == 0)
                return _cl_UP(UPR, x);
        if (xlen == 0)
@@ -213,8 +213,8 @@ static const _cl_UP num_mul (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const
        DeclarePoly(cl_SV_number,x);
        DeclarePoly(cl_SV_number,y);
        var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
-       var sintL xlen = x.length();
-       var sintL ylen = y.length();
+       var sintL xlen = x.size();
+       var sintL ylen = y.size();
        if (xlen == 0)
                return _cl_UP(UPR, x);
        if (ylen == 0)
@@ -259,7 +259,7 @@ static const _cl_UP num_square (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
 {{
        DeclarePoly(cl_SV_number,x);
        var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
-       var sintL xlen = x.length();
+       var sintL xlen = x.size();
        if (xlen == 0)
                return cl_UP(UPR, x);
        var sintL len = 2*xlen-1;
@@ -315,7 +315,7 @@ static const _cl_UP num_scalmul (cl_heap_univpoly_ring* UPR, const cl_ring_eleme
        DeclarePoly(cl_number,x);
        DeclarePoly(cl_SV_number,y);
        var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
-       var sintL ylen = y.length();
+       var sintL ylen = y.size();
        if (ylen == 0)
                return _cl_UP(UPR, y);
        if (ops.zerop(x))
@@ -332,14 +332,14 @@ static sintL num_degree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
 {
        unused UPR;
  {     DeclarePoly(cl_SV_number,x);
-       return (sintL) x.length() - 1;
+       return (sintL) x.size() - 1;
 }}
 
 static sintL num_ldegree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
 {{
        DeclarePoly(cl_SV_number,x);
        var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
-       var sintL xlen = x.length();
+       var sintL xlen = x.size();
        for (sintL i = 0; i < xlen; i++) {
                if (!ops.zerop(x[i]))
                        return i;
@@ -366,7 +366,7 @@ static const cl_ring_element num_coeff (cl_heap_univpoly_ring* UPR, const _cl_UP
 {{
        DeclarePoly(cl_SV_number,x);
        var cl_heap_number_ring* R = TheNumberRing(UPR->basering());
-       if (index < x.length())
+       if (index < x.size())
                return cl_ring_element(R, x[index]);
        else
                return R->zero();
@@ -387,7 +387,7 @@ static void num_set_coeff (cl_heap_univpoly_ring* UPR, _cl_UP& x, uintL index, c
        DeclareMutablePoly(cl_SV_number,x);
        if (!(UPR->basering() == y.ring())) throw runtime_exception();
   {    DeclarePoly(cl_number,y);
-       if (!(index < x.length())) throw runtime_exception();
+       if (!(index < x.size())) throw runtime_exception();
        x[index] = y;
 }}}
 
@@ -395,7 +395,7 @@ static void num_finalize (cl_heap_univpoly_ring* UPR, _cl_UP& x)
 {{
        DeclareMutablePoly(cl_SV_number,x); // NB: x is modified by reference!
        var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
-       var uintL len = x.length();
+       var uintL len = x.size();
        if (len > 0)
                num_normalize(ops,x,len);
 }}
@@ -411,7 +411,7 @@ static const cl_ring_element num_eval (cl_heap_univpoly_ring* UPR, const _cl_UP&
   {    DeclarePoly(cl_number,y);
        var cl_heap_number_ring* R = TheNumberRing(UPR->basering());
        var cl_number_ring_ops<cl_number>& ops = *R->ops;
-       var uintL len = x.length();
+       var uintL len = x.size();
        if (len==0)
                return R->zero();
        if (ops.zerop(y))
index 4162d681fc7eab807bf3b979299c12146e4cb0de..51a9b9c20860e9d9425f09b44b98443784634a22 100644 (file)
@@ -93,7 +93,7 @@ static void general_set_element (cl_GV_inner<cl_I>* vec, uintC index, const cl_I
 static void general_do_delete (cl_GV_inner<cl_I>* vec)
 {
        var cl_heap_GV_I_general* hv = (cl_heap_GV_I_general *) outcast(vec);
-       var uintC len = hv->v.length();
+       var uintC len = hv->v.size();
        for (var uintC i = 0; i < len; i++)
                hv->data[i].~cl_I();
 }
@@ -105,8 +105,8 @@ static void general_copy_elements (const cl_GV_inner<cl_I>* srcvec, uintC srcind
                  (const cl_heap_GV_I_general *) outcast(srcvec);
                var cl_heap_GV_I_general* destv =
                  (cl_heap_GV_I_general *) outcast(destvec);
-               var uintC srclen = srcv->v.length();
-               var uintC destlen = destv->v.length();
+               var uintC srclen = srcv->v.size();
+               var uintC destlen = destv->v.size();
                if (!(srcindex <= srcindex+count && srcindex+count <= srclen))
                        throw runtime_exception();
                if (!(destindex <= destindex+count && destindex+count <= destlen))
@@ -158,8 +158,8 @@ static void bits##m##_copy_elements (const cl_GV_inner<cl_I>* srcvec, uintC srci
                  (const cl_heap_GV_I_bits##m *) outcast(srcvec);               \
                var cl_heap_GV_I_bits##m * destv =                              \
                  (cl_heap_GV_I_bits##m *) outcast(destvec);                    \
-               var uintC srclen = srcv->v.length();                            \
-               var uintC destlen = destv->v.length();                          \
+               var uintC srclen = srcv->v.size();                              \
+               var uintC destlen = destv->v.size();                            \
                if (!(srcindex <= srcindex+count && srcindex+count <= srclen))  \
                        throw runtime_exception();                              \
                if (!(destindex <= destindex+count && destindex+count <= destlen)) \
index 5753cbca98c2ff8b88dfd4edf027ee78c0c14a8b..9f76c5c06d437baa39ef3c9c33d6d5f233ec125e 100644 (file)
@@ -14,7 +14,7 @@ namespace cln {
 
 const cl_GV_I copy (const cl_GV_I& v)
 {
-       var uintC len = v.length();
+       var uintC len = v.size();
        var cl_GV_I w = cl_GV_I(len,v.maxbits());
        cl_GV_I::copy_elements(v,0,w,0,len);
        return w;
index bdbc84e10429508b4555390c89d43ebcb21c5276..6f51aaf088a01fd68875b6b6da9fc0c224f21f49 100644 (file)
@@ -69,7 +69,7 @@ static void general_set_element (cl_GV_inner<cl_number>* vec, uintC index, const
 static void general_do_delete (cl_GV_inner<cl_number>* vec)
 {
        var cl_heap_GV_number_general* hv = (cl_heap_GV_number_general *) outcast(vec);
-       var uintC len = hv->v.length();
+       var uintC len = hv->v.size();
        for (var uintC i = 0; i < len; i++)
                hv->data[i].~cl_number();
 }
@@ -81,8 +81,8 @@ static void general_copy_elements (const cl_GV_inner<cl_number>* srcvec, uintC s
                  (const cl_heap_GV_number_general *) outcast(srcvec);
                var cl_heap_GV_number_general* destv =
                  (cl_heap_GV_number_general *) outcast(destvec);
-               var uintC srclen = srcv->v.length();
-               var uintC destlen = destv->v.length();
+               var uintC srclen = srcv->v.size();
+               var uintC destlen = destv->v.size();
                if (!(srcindex <= srcindex+count && srcindex+count <= srclen))
                        throw runtime_exception();
                if (!(destindex <= destindex+count && destindex+count <= destlen))
index 64b82a3c3e8f4049da8999e2e2342927bec159af..715aea1dd7b7248975996d7ae571e5ad618c33f5 100644 (file)
@@ -14,7 +14,7 @@ namespace cln {
 
 const cl_GV_number copy (const cl_GV_number& v)
 {
-       var uintC len = v.length();
+       var uintC len = v.size();
        var cl_GV_number w = cl_GV_number(len);
        cl_GV_number::copy_elements(v,0,w,0,len);
        return w;
index 4b9dcbbd24f5388c53a019c8e4a4713418b22c36..f41d0a3c0db6f68a5f7d4223dc4bb430aba93014 100644 (file)
@@ -16,7 +16,7 @@ namespace cln {
 
 const cl_SV_any copy (const cl_SV_any& src)
 {
-       var uintC len = src.length();
+       var uintC len = src.size();
        var cl_heap_SV_any* hv = (cl_heap_SV_any*) malloc_hook(sizeof(cl_heap_SV_any)+sizeof(cl_gcobject)*len);
        hv->refcount = 1;
        hv->type = src.pointer_type();
index c9513a8879776f2e4f99df0373bcaf417656d38c..999178742a012840b3e20e7709694c42fabf55b5 100644 (file)
@@ -19,7 +19,7 @@ namespace cln {
 
 void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* printfun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_GV_number& vector)
 {
-       var uintC len = vector.length();
+       var uintC len = vector.size();
        if (flags.vector_syntax == vsyntax_commonlisp) {
                fprintchar(stream,'#');
                fprintchar(stream,'(');
index 1f6e3cd209d1f557e0c32d4c4a86fd766cf4883b..d1d9d36a9fb9f8914597323289aa117dea6bc1d6 100644 (file)
@@ -16,7 +16,7 @@ namespace cln {
 void fprint (std::ostream& stream, const cl_ring& R, const cl_SV_ringelt& vector)
 {
        var const cl_print_flags& flags = default_print_flags;
-       var uintC len = vector.length();
+       var uintC len = vector.size();
        if (flags.vector_syntax == vsyntax_commonlisp) {
                fprintchar(stream,'#');
                fprintchar(stream,'(');
index cc282018622fc57d3a9606430f59b8187f45fe07..c01d6e830242434339fda0eda0e3ce1d2bc2faf8 100644 (file)
@@ -19,7 +19,7 @@ namespace cln {
 
 void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* printfun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_SV_number& vector)
 {
-       var uintC len = vector.length();
+       var uintC len = vector.size();
        if (flags.vector_syntax == vsyntax_commonlisp) {
                fprintchar(stream,'#');
                fprintchar(stream,'(');