Mercurial > hg > octave-lojdl
changeset 4587:7b957b442818
[project @ 2003-11-10 15:50:39 by jwe]
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-11-10 John W. Eaton <jwe@bevo.che.wisc.edu> + + * configure.in: Preserve CFLAGS and CXXFLAGS before doing anything. + Maybe add -Wshadow to CFLAGS and CXXFLAGS. + 2003-10-24 Stefan Monnier <monnier@iro.umontreal.ca> * emacs/octave-mod.el (octave-comment-start): Simplify.
--- a/configure.in +++ b/configure.in @@ -21,8 +21,15 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +### Preserve CFLAGS and CXXFLAGS from the environment before doing +### anything else because we don't know which macros might call +### AC_PROG_CC or AC_PROG_CXX. + +EXTERN_CFLAGS="$CFLAGS" +EXTERN_CXXFLAGS="$CXXFLAGS" + AC_INIT -AC_REVISION($Revision: 1.435 $) +AC_REVISION($Revision: 1.436 $) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -161,8 +168,6 @@ ### See which C++ compiler to use (we expect to find g++). -EXTERN_CXXFLAGS="$CXXFLAGS" - AC_PROG_CXX AC_PROG_CXXCPP @@ -193,8 +198,6 @@ ### See which C compiler to use (we expect to find gcc). -EXTERN_CFLAGS="$CFLAGS" - AC_PROG_CC AC_PROG_CPP AC_PROG_GCC_TRADITIONAL @@ -1275,15 +1278,17 @@ AC_MSG_RESULT([defining UGLY_DEFS to be $UGLY_DEFS]) AC_SUBST(UGLY_DEFS) -### Maybe add -Wall to compiler flags now that we're done feature -### testing. +### Maybe add -Wall and -Wshadow to compiler flags now that we're +### done feature testing. if test -z "$EXTERN_CFLAGS"; then OCTAVE_CC_FLAG(-Wall) + OCTAVE_CC_FLAG(-Wshadow) fi if test -z "$EXTERN_CXXFLAGS"; then OCTAVE_CXX_FLAG(-Wall) + OCTAVE_CXX_FLAG(-Wshadow) fi ### Someday, maybe include -ansi and even -pedantic in this list...
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -392,13 +392,13 @@ template <class T> void -Array<T>::resize_no_fill (const dim_vector& dims) +Array<T>::resize_no_fill (const dim_vector& dv) { - int n = dims.length (); + int n = dv.length (); for (int i = 0; i < n; i++) { - if (dims(i) < 0) + if (dv(i) < 0) { (*current_liboctave_error_handler) ("can't resize to negative dimension"); @@ -416,7 +416,7 @@ { for (int i = 0; i < n; i++) { - if (dims(i) != dimensions(i)) + if (dv(i) != dimensions(i)) { same_size = false; break; @@ -432,9 +432,9 @@ typename Array<T>::ArrayRep *old_rep = rep; const T *old_data = data (); - rep = new typename Array<T>::ArrayRep (get_size (dims)); - - dimensions = dims; + rep = new typename Array<T>::ArrayRep (get_size (dv)); + + dimensions = dv; Array<int> ra_idx (dimensions.length (), 0); @@ -705,13 +705,13 @@ template <class T> void -Array<T>::resize_and_fill (const dim_vector& dims, const T& val) +Array<T>::resize_and_fill (const dim_vector& dv, const T& val) { - int n = dims.length (); + int n = dv.length (); for (int i = 0; i < n; i++) { - if (dims(i) < 0) + if (dv(i) < 0) { (*current_liboctave_error_handler) ("can't resize to negative dimension"); @@ -729,7 +729,7 @@ { for (int i = 0; i < n; i++) { - if (dims(i) != dimensions(i)) + if (dv(i) != dimensions(i)) { same_size = false; break; @@ -745,11 +745,11 @@ int old_len = length (); - int len = get_size (dims); + int len = get_size (dv); rep = new typename Array<T>::ArrayRep (len); - dimensions = dims; + dimensions = dv; Array<int> ra_idx (dimensions.length (), 0); @@ -872,13 +872,13 @@ void Array<T>::maybe_delete_dims (void) { - int ndims = dimensions.length (); + int nd = dimensions.length (); dim_vector new_dims (1, 1); bool delete_dims = true; - for (int i = ndims - 1; i >= 0; i--) + for (int i = nd - 1; i >= 0; i--) { if (delete_dims) { @@ -893,7 +893,7 @@ new_dims(i) = dimensions(i); } - if (ndims != new_dims.length ()) + if (nd != new_dims.length ()) dimensions = new_dims; } @@ -1834,7 +1834,7 @@ int r_dims = result_dims.length (); - Array<int> index (r_dims, 0); + Array<int> iidx (r_dims, 0); int k = 0; @@ -1843,15 +1843,15 @@ int ii = ra_idx.elem (k++); if (ii >= orig_len) - retval.elem (index) = rfv; + retval.elem (iidx) = rfv; else { Array<int> temp = get_ra_idx (ii, dims ()); - retval.elem (index) = elem (temp); + retval.elem (iidx) = elem (temp); } if (i != n - 1) - increment_index (index, result_dims); + increment_index (iidx, result_dims); } } } @@ -2605,8 +2605,8 @@ dim_vector lhs_inc; lhs_inc.resize (lhs_dims.length ()); - for (int i = 0; i < lhs_dims.length (); i++) - lhs_inc(i) = lhs_dims(i) + 1; + for (int j = 0; j < lhs_dims.length (); j++) + lhs_inc(j) = lhs_dims(j) + 1; if (index_in_bounds(elt_idx, lhs_inc)) lhs.checkelem (elt_idx) = scalar;
--- a/liboctave/Array.h +++ b/liboctave/Array.h @@ -152,9 +152,9 @@ : rep (new typename Array<T>::ArrayRep (d, n)), dimensions (n), idx (0), idx_count (0) { } - Array (T *d, const dim_vector& dims) - : rep (new typename Array<T>::ArrayRep (d, get_size (dims))), - dimensions (dims), idx (0), idx_count (0) { } + Array (T *d, const dim_vector& dv) + : rep (new typename Array<T>::ArrayRep (d, get_size (dv))), + dimensions (dv), idx (0), idx_count (0) { } private: @@ -191,19 +191,19 @@ public: - Array (const dim_vector& dims) - : rep (new typename Array<T>::ArrayRep (get_size (dims))), - dimensions (dims), idx (0), idx_count (0) { } + Array (const dim_vector& dv) + : rep (new typename Array<T>::ArrayRep (get_size (dv))), + dimensions (dv), idx (0), idx_count (0) { } - Array (const dim_vector& dims, const T& val) - : rep (new typename Array<T>::ArrayRep (get_size (dims))), - dimensions (dims), idx (0), idx_count (0) + Array (const dim_vector& dv, const T& val) + : rep (new typename Array<T>::ArrayRep (get_size (dv))), + dimensions (dv), idx (0), idx_count (0) { fill (val); } - Array (const Array<T>& a, const dim_vector& dims) - : rep (a.rep), dimensions (dims), idx (0), idx_count (0) + Array (const Array<T>& a, const dim_vector& dv) + : rep (a.rep), dimensions (dv), idx (0), idx_count (0) { rep->count++; } @@ -251,7 +251,7 @@ static int get_size (int r, int c); static int get_size (int r, int c, int p); - static int get_size (const dim_vector& dims); + static int get_size (const dim_vector& dv); int compute_index (const Array<int>& ra_idx) const; @@ -424,8 +424,8 @@ void resize_no_fill (int r, int c, int p); void resize_and_fill (int r, int c, int p, const T& val); - void resize_no_fill (const dim_vector& dims); - void resize_and_fill (const dim_vector& dims, const T& val); + void resize_no_fill (const dim_vector& dv); + void resize_and_fill (const dim_vector& dv, const T& val); public: @@ -433,14 +433,14 @@ // void resize (int n, const T& val) { resize_and_fill (n, val); } - void resize (const dim_vector& dims) { resize_no_fill (dims); } + void resize (const dim_vector& dv) { resize_no_fill (dv); } - void resize (const dim_vector& dims, const T& val) - { resize_and_fill (dims, val); } + void resize (const dim_vector& dv, const T& val) + { resize_and_fill (dv, val); } Array<T>& insert (const Array<T>& a, int r, int c); - Array<T>& insert (const Array<T>& a, const Array<int>& dims); + Array<T>& insert (const Array<T>& a, const Array<int>& dv); bool is_square (void) const { return (dim1 () == dim2 ()); }
--- a/liboctave/ArrayN.h +++ b/liboctave/ArrayN.h @@ -52,7 +52,7 @@ static int get_size (const dim_vector& dims) { return Array<T>::get_size (dims); } - ArrayN (T *d, const dim_vector& dims) : Array<T> (d, dims) { } + ArrayN (T *d, const dim_vector& dv) : Array<T> (d, dv) { } public: @@ -62,10 +62,10 @@ ArrayN (void) : Array<T> () { } - ArrayN (const dim_vector& dims) : Array<T> (dims) { } + ArrayN (const dim_vector& dv) : Array<T> (dv) { } - ArrayN (const dim_vector& dims, const T& val) - : Array<T> (dims) { fill (val); } + ArrayN (const dim_vector& dv, const T& val) + : Array<T> (dv) { fill (val); } ArrayN (const Array2<T>& a) : Array<T> (a, a.dims ()) { } @@ -73,7 +73,7 @@ ArrayN (const Array<T>& a) : Array<T> (a) { } - ArrayN (const Array<T>& a, const dim_vector& dims) : Array<T> (a, dims) { } + ArrayN (const Array<T>& a, const dim_vector& dv) : Array<T> (a, dv) { } ~ArrayN (void) { } @@ -85,17 +85,17 @@ return *this; } - void resize (const dim_vector& dims) - { Array<T>::resize_no_fill (dims); } + void resize (const dim_vector& dv) + { Array<T>::resize_no_fill (dv); } - void resize (const dim_vector& dims, const T& val) - { Array<T>::resize (dims, val); } + void resize (const dim_vector& dv, const T& val) + { Array<T>::resize (dv, val); } ArrayN<T> squeeze (void) const { return Array<T>::squeeze (); } - ArrayN<T>& insert (const ArrayN<T>& a, const dim_vector& dims) + ArrayN<T>& insert (const ArrayN<T>& a, const dim_vector& dv) { - Array<T>::insert (a, dims); + Array<T>::insert (a, dv); return *this; }
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -1670,7 +1670,7 @@ int b_nc = b.cols (); - char job = 'N'; + job = 'N'; F77_XFCN (zgetrs, ZGETRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, b_nc, tmp_data, nr, pipvt, result, b.rows(), info @@ -1821,7 +1821,7 @@ retval = b; Complex *result = retval.fortran_vec (); - char job = 'N'; + job = 'N'; F77_XFCN (zgetrs, ZGETRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, 1, tmp_data, nr, pipvt, result, b.length(), info @@ -2784,12 +2784,12 @@ ComplexColumnVector ComplexMatrix::row_min (void) const { - Array<int> index; - return row_min (index); + Array<int> dummy_idx; + return row_min (dummy_idx); } ComplexColumnVector -ComplexMatrix::row_min (Array<int>& index) const +ComplexMatrix::row_min (Array<int>& idx_arg) const { ComplexColumnVector result; @@ -2799,7 +2799,7 @@ if (nr > 0 && nc > 0) { result.resize (nr); - index.resize (nr); + idx_arg.resize (nr); for (int i = 0; i < nr; i++) { @@ -2842,12 +2842,12 @@ if (octave_is_NaN_or_NA (tmp_min)) { result.elem (i) = Complex_NaN_result; - index.elem (i) = 0; + idx_arg.elem (i) = 0; } else { result.elem (i) = tmp_min; - index.elem (i) = idx_j; + idx_arg.elem (i) = idx_j; } } } @@ -2858,12 +2858,12 @@ ComplexColumnVector ComplexMatrix::row_max (void) const { - Array<int> index; - return row_max (index); + Array<int> dummy_idx; + return row_max (dummy_idx); } ComplexColumnVector -ComplexMatrix::row_max (Array<int>& index) const +ComplexMatrix::row_max (Array<int>& idx_arg) const { ComplexColumnVector result; @@ -2873,7 +2873,7 @@ if (nr > 0 && nc > 0) { result.resize (nr); - index.resize (nr); + idx_arg.resize (nr); for (int i = 0; i < nr; i++) { @@ -2916,12 +2916,12 @@ if (octave_is_NaN_or_NA (tmp_max)) { result.elem (i) = Complex_NaN_result; - index.elem (i) = 0; + idx_arg.elem (i) = 0; } else { result.elem (i) = tmp_max; - index.elem (i) = idx_j; + idx_arg.elem (i) = idx_j; } } } @@ -2932,12 +2932,12 @@ ComplexRowVector ComplexMatrix::column_min (void) const { - Array<int> index; - return column_min (index); + Array<int> dummy_idx; + return column_min (dummy_idx); } ComplexRowVector -ComplexMatrix::column_min (Array<int>& index) const +ComplexMatrix::column_min (Array<int>& idx_arg) const { ComplexRowVector result; @@ -2947,7 +2947,7 @@ if (nr > 0 && nc > 0) { result.resize (nc); - index.resize (nc); + idx_arg.resize (nc); for (int j = 0; j < nc; j++) { @@ -2990,12 +2990,12 @@ if (octave_is_NaN_or_NA (tmp_min)) { result.elem (j) = Complex_NaN_result; - index.elem (j) = 0; + idx_arg.elem (j) = 0; } else { result.elem (j) = tmp_min; - index.elem (j) = idx_i; + idx_arg.elem (j) = idx_i; } } } @@ -3006,12 +3006,12 @@ ComplexRowVector ComplexMatrix::column_max (void) const { - Array<int> index; - return column_max (index); + Array<int> dummy_idx; + return column_max (dummy_idx); } ComplexRowVector -ComplexMatrix::column_max (Array<int>& index) const +ComplexMatrix::column_max (Array<int>& idx_arg) const { ComplexRowVector result; @@ -3021,7 +3021,7 @@ if (nr > 0 && nc > 0) { result.resize (nc); - index.resize (nc); + idx_arg.resize (nc); for (int j = 0; j < nc; j++) { @@ -3064,12 +3064,12 @@ if (octave_is_NaN_or_NA (tmp_max)) { result.elem (j) = Complex_NaN_result; - index.elem (j) = 0; + idx_arg.elem (j) = 0; } else { result.elem (j) = tmp_max; - index.elem (j) = idx_i; + idx_arg.elem (j) = idx_i; } } }
--- a/liboctave/CNDArray.h +++ b/liboctave/CNDArray.h @@ -43,10 +43,10 @@ ComplexNDArray (void) : MArrayN<Complex> () { } - ComplexNDArray (const dim_vector& dims) : MArrayN<Complex> (dims) { } + ComplexNDArray (const dim_vector& dv) : MArrayN<Complex> (dv) { } - ComplexNDArray (const dim_vector& dims, const Complex& val) - : MArrayN<Complex> (dims, val) { } + ComplexNDArray (const dim_vector& dv, const Complex& val) + : MArrayN<Complex> (dv, val) { } ComplexNDArray (const ComplexNDArray& a) : MArrayN<Complex> (a) { } @@ -108,8 +108,8 @@ private: - ComplexNDArray (Complex *d, dim_vector& dims) - : MArrayN<Complex> (d, dims) { } + ComplexNDArray (Complex *d, dim_vector& dv) + : MArrayN<Complex> (d, dv) { } }; NDS_CMP_OP_DECLS (ComplexNDArray, Complex)
--- a/liboctave/CRowVector.cc +++ b/liboctave/CRowVector.cc @@ -334,9 +334,6 @@ gripe_nonconformant ("operator *", 1, len, a_nr, a_nc); else { - int a_nr = a.rows (); - int a_nc = a.cols (); - if (len == 0) retval.resize (a_nc, 0.0); else
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,4 +1,13 @@ -2003-11-08 John Eaton <osc0383@coe3.osc.edu> +2003-11-10 John W. Eaton <jwe@bevo.che.wisc.edu> + + * Array.cc, Array.h, ArrayN.h, CMatrix.cc, CNDArray.h, + CRowVector.cc, CmplxQR.cc, CollocWt.h, DASPK.h, DASRT.h, DASSL.h, + FEGrid.cc, LP.h, LSODE.h, MArrayN.h, ODE.h, ODES.h, ODESSA.cc, + boolNDArray.h, chNDArray.h, dMatrix.cc, dNDArray.h, dRowVector.cc, + dbleQR.cc, kpse.cc, oct-rl-hist.c, str-vec.cc, str-vec.h: + Avoid -Wshadow warnings. + +2003-11-08 John Eaton <jwe@bevo.che.wisc.edu> * Array.h (Array<T>::nil_rep): Qualify return type with typename.
--- a/liboctave/CmplxQR.cc +++ b/liboctave/CmplxQR.cc @@ -124,7 +124,7 @@ lwork = 32 * n2; work.resize (lwork); - Complex *pwork = work.fortran_vec (); + pwork = work.fortran_vec (); F77_XFCN (zungqr, ZUNGQR, (m, n2, min_mn, tmp_data, m, ptau, pwork, lwork, info));
--- a/liboctave/CollocWt.h +++ b/liboctave/CollocWt.h @@ -45,8 +45,8 @@ : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0), Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (0) { } - CollocWt (int nc, int il, int ir, double l, double r) - : n (nc), inc_left (il), inc_right (ir), lb (l), rb (r), + CollocWt (int nc, int il, int ir, double l, double rr) + : n (nc), inc_left (il), inc_right (ir), lb (l), rb (rr), Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (0) { } CollocWt (int nc, double a, double b, int il, int ir) @@ -54,8 +54,8 @@ Alpha (a), Beta (b), initialized (0) { } CollocWt (int nc, double a, double b, int il, int ir, - double l, double r) - : n (nc), inc_left (il), inc_right (ir), lb (l), rb (r), + double ll, double rr) + : n (nc), inc_left (il), inc_right (ir), lb (ll), rb (rr), Alpha (a), Beta (b), r (), q (), A (), B (), initialized (0) { } CollocWt (const CollocWt& a) @@ -84,9 +84,9 @@ ~CollocWt (void) { } - CollocWt& resize (int ncol) + CollocWt& resize (int nc) { - n = ncol; + n = nc; initialized = 0; return *this; }
--- a/liboctave/DASPK.h +++ b/liboctave/DASPK.h @@ -39,12 +39,12 @@ DASPK (void) : DAE (), DASPK_options (), initialized (false) { } - DASPK (const ColumnVector& state, double time, DAEFunc& f) - : DAE (state, time, f), DASPK_options (), initialized (false) { } + DASPK (const ColumnVector& s, double tm, DAEFunc& f) + : DAE (s, tm, f), DASPK_options (), initialized (false) { } - DASPK (const ColumnVector& state, const ColumnVector& deriv, - double time, DAEFunc& f) - : DAE (state, deriv, time, f), DASPK_options (), initialized (false) { } + DASPK (const ColumnVector& s, const ColumnVector& deriv, + double tm, DAEFunc& f) + : DAE (s, deriv, tm, f), DASPK_options (), initialized (false) { } ~DASPK (void) { }
--- a/liboctave/DASRT.h +++ b/liboctave/DASRT.h @@ -76,12 +76,12 @@ DASRT (void) : DAERT (), DASRT_options (), initialized (false) { } - DASRT (const ColumnVector& state, double time, DAERTFunc& f) - : DAERT (state, time, f), DASRT_options (), initialized (false) { } + DASRT (const ColumnVector& s, double tm, DAERTFunc& f) + : DAERT (s, tm, f), DASRT_options (), initialized (false) { } - DASRT (const ColumnVector& state, const ColumnVector& deriv, - double time, DAERTFunc& f) - : DAERT (state, deriv, time, f), DASRT_options (), initialized (false) { } + DASRT (const ColumnVector& s, const ColumnVector& deriv, + double tm, DAERTFunc& f) + : DAERT (s, deriv, tm, f), DASRT_options (), initialized (false) { } ~DASRT (void) { }
--- a/liboctave/DASSL.h +++ b/liboctave/DASSL.h @@ -39,12 +39,12 @@ DASSL (void) : DAE (), DASSL_options (), initialized (false) { } - DASSL (const ColumnVector& state, double time, DAEFunc& f) - : DAE (state, time, f), DASSL_options (), initialized (false) { } + DASSL (const ColumnVector& s, double tm, DAEFunc& f) + : DAE (s, tm, f), DASSL_options (), initialized (false) { } - DASSL (const ColumnVector& state, const ColumnVector& deriv, - double time, DAEFunc& f) - : DAE (state, deriv, time, f), DASSL_options (), initialized (false) { } + DASSL (const ColumnVector& s, const ColumnVector& deriv, + double tm, DAEFunc& f) + : DAE (s, deriv, tm, f), DASSL_options (), initialized (false) { } ~DASSL (void) { }
--- a/liboctave/FEGrid.cc +++ b/liboctave/FEGrid.cc @@ -63,7 +63,7 @@ elem.elem (i) = i * width; } -FEGrid::FEGrid (int nel, double left, double right) +FEGrid::FEGrid (int nel, double l, double r) { if (nel < 1) { @@ -73,10 +73,10 @@ elem.resize (nel+1); - double width = (right - left) / nel; + double width = (r - l) / nel; for (int i = 0; i <= nel; i++) - elem.elem (i) = i * width + left; + elem.elem (i) = i * width + l; check_grid (); }
--- a/liboctave/LP.h +++ b/liboctave/LP.h @@ -34,22 +34,22 @@ public: octave_LP (void) - : base_minimizer (), c (), bnds (), lc () { } + : base_minimizer (), cvec (), bnds (), lin_constr () { } - octave_LP (const ColumnVector& c_arg) - : base_minimizer (), c (c_arg), bnds (), lc () { } + octave_LP (const ColumnVector& c) + : base_minimizer (), cvec (c), bnds (), lin_constr () { } - octave_LP (const ColumnVector& c_arg, const Bounds& b) - : base_minimizer (), c (c_arg), bnds (b), lc () { } + octave_LP (const ColumnVector& c, const Bounds& b) + : base_minimizer (), cvec (c), bnds (b), lin_constr () { } - octave_LP (const ColumnVector& c_arg, const Bounds& b, const LinConst& l) - : base_minimizer (), c (c_arg), bnds (b), lc (l) { } + octave_LP (const ColumnVector& c, const Bounds& b, const LinConst& l) + : base_minimizer (), cvec (c), bnds (b), lin_constr (l) { } - octave_LP (const ColumnVector& c_arg, const LinConst& l) - : base_minimizer (), c (c_arg), bnds (), lc (l) { } + octave_LP (const ColumnVector& c, const LinConst& l) + : base_minimizer (), cvec (c), bnds (), lin_constr (l) { } octave_LP (const octave_LP& a) - : base_minimizer (a), c (a.c), bnds (a.bnds), lc (a.lc) { } + : base_minimizer (a), cvec (a.cvec), bnds (a.bnds), lin_constr (a.lin_constr) { } octave_LP& operator = (const octave_LP& a) { @@ -57,26 +57,26 @@ { base_minimizer::operator = (a); - c = a.c; + cvec = a.cvec; bnds = a.bnds; - lc = a.lc; + lin_constr = a.lin_constr; } return *this; } ~octave_LP (void) { } - ColumnVector linear_obj_coeff (void) const { return c; } + ColumnVector linear_obj_coeff (void) const { return cvec; } Bounds bounds (void) const { return bnds; } - LinConst linear_constraints (void) const { return lc; } + LinConst linear_constraints (void) const { return lin_constr; } protected: - ColumnVector c; + ColumnVector cvec; Bounds bnds; - LinConst lc; + LinConst lin_constr; }; #endif
--- a/liboctave/LSODE.h +++ b/liboctave/LSODE.h @@ -39,8 +39,8 @@ LSODE (void) : ODE (), LSODE_options (), initialized (false) { } - LSODE (const ColumnVector& state, double time, const ODEFunc& f) - : ODE (state, time, f), LSODE_options (), initialized (false) { } + LSODE (const ColumnVector& s, double tm, const ODEFunc& f) + : ODE (s, tm, f), LSODE_options (), initialized (false) { } ~LSODE (void) { }
--- a/liboctave/MArrayN.h +++ b/liboctave/MArrayN.h @@ -46,15 +46,15 @@ { protected: - MArrayN (T *d, const dim_vector& dims) : ArrayN<T> (d, dims) { } + MArrayN (T *d, const dim_vector& dv) : ArrayN<T> (d, dv) { } public: MArrayN (void) : ArrayN<T> () {} - MArrayN (const dim_vector& dims) : ArrayN<T> (dims) { } + MArrayN (const dim_vector& dv) : ArrayN<T> (dv) { } - MArrayN (const dim_vector& dims, const T& val) : ArrayN<T> (dims, val) { } + MArrayN (const dim_vector& dv, const T& val) : ArrayN<T> (dv, val) { } MArrayN (const Array2<T>& a) : ArrayN<T> (a) { }
--- a/liboctave/ODE.h +++ b/liboctave/ODE.h @@ -34,8 +34,8 @@ ODE (void) : base_diff_eqn (), ODEFunc () { } - ODE (const ColumnVector& state, double time, const ODEFunc& f) - : base_diff_eqn (state, time), ODEFunc (f) { } + ODE (const ColumnVector& s, double tm, const ODEFunc& f) + : base_diff_eqn (s, tm), ODEFunc (f) { } ODE (const ODE& a) : base_diff_eqn (a), ODEFunc (a) { }
--- a/liboctave/ODES.h +++ b/liboctave/ODES.h @@ -38,12 +38,12 @@ ODES (void) : base_diff_eqn (), ODESFunc (), theta () { } - ODES (const ColumnVector& x, double t, ODESFunc& f) - : base_diff_eqn (x, t), ODESFunc (f), xdot (x.length (), 0.0), theta () { } + ODES (const ColumnVector& s, double tm, ODESFunc& f) + : base_diff_eqn (s, tm), ODESFunc (f), xdot (s.length (), 0.0), theta () { } - ODES (const ColumnVector& x, const ColumnVector& xtheta, double t, + ODES (const ColumnVector& s, const ColumnVector& xtheta, double tm, ODESFunc& f) - : base_diff_eqn (x, t), ODESFunc (f), xdot (x.length (), 0.0), + : base_diff_eqn (s, tm), ODESFunc (f), xdot (s.length (), 0.0), theta (xtheta) { } ODES (const ODES& a)
--- a/liboctave/ODESSA.cc +++ b/liboctave/ODESSA.cc @@ -192,8 +192,8 @@ sanity_checked = false; } -ODESSA::ODESSA (const ColumnVector& state, double time, ODESFunc& f) - : ODES (state, time, f), ODESSA_options () +ODESSA::ODESSA (const ColumnVector& s, double tm, ODESFunc& f) + : ODES (s, tm, f), ODESSA_options () { initialized = false; @@ -215,14 +215,14 @@ y.resize (n, 1, 0.0); } -ODESSA::ODESSA (const ColumnVector& state, const ColumnVector& xtheta, - const Matrix& sensitivity_guess, double time, ODESFunc& f) - : ODES (state, xtheta, time, f) +ODESSA::ODESSA (const ColumnVector& s, const ColumnVector& xtheta, + const Matrix& sensitivity_guess, double tm, ODESFunc& f) + : ODES (s, xtheta, tm, f) { initialized = false; neq.resize(2); - n = state.length(); + n = s.length(); npar = xtheta.length(); neq(0) = n;
--- a/liboctave/boolNDArray.h +++ b/liboctave/boolNDArray.h @@ -43,10 +43,10 @@ boolNDArray (void) : ArrayN<bool> () { } - boolNDArray (dim_vector& dims) : ArrayN<bool> (dims) { } + boolNDArray (dim_vector& dv) : ArrayN<bool> (dv) { } - boolNDArray (dim_vector& dims, const bool& val) - : ArrayN<bool> (dims, val) { } + boolNDArray (dim_vector& dv, const bool& val) + : ArrayN<bool> (dv, val) { } boolNDArray (const boolNDArray& a) : ArrayN<bool> (a) { } @@ -94,7 +94,7 @@ private: - boolNDArray (bool *d, dim_vector& dims) : ArrayN<bool> (d, dims) { } + boolNDArray (bool *d, dim_vector& dv) : ArrayN<bool> (d, dv) { } }; NDND_CMP_OP_DECLS (boolNDArray, boolNDArray)
--- a/liboctave/chNDArray.h +++ b/liboctave/chNDArray.h @@ -43,9 +43,9 @@ charNDArray (void) : MArrayN<char> () { } - charNDArray (dim_vector& dims) : MArrayN<char> (dims) { } + charNDArray (dim_vector& dv) : MArrayN<char> (dv) { } - charNDArray (dim_vector& dims, char val) : MArrayN<char> (dims, val) { } + charNDArray (dim_vector& dv, char val) : MArrayN<char> (dv, val) { } charNDArray (const charNDArray& a) : MArrayN<char> (a) { } @@ -92,7 +92,7 @@ private: - charNDArray (char *d, dim_vector& dims) : MArrayN<char> (d, dims) { } + charNDArray (char *d, dim_vector& dv) : MArrayN<char> (d, dv) { } }; MARRAY_FORWARD_DEFS (MArrayN, charNDArray, char)
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -1307,7 +1307,7 @@ int b_nc = b.cols (); - char job = 'N'; + job = 'N'; F77_XFCN (dgetrs, DGETRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, b_nc, tmp_data, nr, pipvt, result, b.rows(), info @@ -1456,7 +1456,7 @@ retval = b; double *result = retval.fortran_vec (); - char job = 'N'; + job = 'N'; F77_XFCN (dgetrs, DGETRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, 1, tmp_data, nr, pipvt, result, b.length(), info @@ -2264,12 +2264,12 @@ ColumnVector Matrix::row_min (void) const { - Array<int> index; - return row_min (index); + Array<int> dummy_idx; + return row_min (dummy_idx); } ColumnVector -Matrix::row_min (Array<int>& index) const +Matrix::row_min (Array<int>& idx_arg) const { ColumnVector result; @@ -2279,7 +2279,7 @@ if (nr > 0 && nc > 0) { result.resize (nr); - index.resize (nr); + idx_arg.resize (nr); for (int i = 0; i < nr; i++) { @@ -2309,7 +2309,7 @@ } result.elem (i) = tmp_min; - index.elem (i) = octave_is_NaN_or_NA (tmp_min) ? 0 : idx_j; + idx_arg.elem (i) = octave_is_NaN_or_NA (tmp_min) ? 0 : idx_j; } } @@ -2319,12 +2319,12 @@ ColumnVector Matrix::row_max (void) const { - Array<int> index; - return row_max (index); + Array<int> dummy_idx; + return row_max (dummy_idx); } ColumnVector -Matrix::row_max (Array<int>& index) const +Matrix::row_max (Array<int>& idx_arg) const { ColumnVector result; @@ -2334,7 +2334,7 @@ if (nr > 0 && nc > 0) { result.resize (nr); - index.resize (nr); + idx_arg.resize (nr); for (int i = 0; i < nr; i++) { @@ -2364,7 +2364,7 @@ } result.elem (i) = tmp_max; - index.elem (i) = octave_is_NaN_or_NA (tmp_max) ? 0 : idx_j; + idx_arg.elem (i) = octave_is_NaN_or_NA (tmp_max) ? 0 : idx_j; } } @@ -2374,12 +2374,12 @@ RowVector Matrix::column_min (void) const { - Array<int> index; - return column_min (index); + Array<int> dummy_idx; + return column_min (dummy_idx); } RowVector -Matrix::column_min (Array<int>& index) const +Matrix::column_min (Array<int>& idx_arg) const { RowVector result; @@ -2389,7 +2389,7 @@ if (nr > 0 && nc > 0) { result.resize (nc); - index.resize (nc); + idx_arg.resize (nc); for (int j = 0; j < nc; j++) { @@ -2419,7 +2419,7 @@ } result.elem (j) = tmp_min; - index.elem (j) = octave_is_NaN_or_NA (tmp_min) ? 0 : idx_i; + idx_arg.elem (j) = octave_is_NaN_or_NA (tmp_min) ? 0 : idx_i; } } @@ -2429,12 +2429,12 @@ RowVector Matrix::column_max (void) const { - Array<int> index; - return column_max (index); + Array<int> dummy_idx; + return column_max (dummy_idx); } RowVector -Matrix::column_max (Array<int>& index) const +Matrix::column_max (Array<int>& idx_arg) const { RowVector result; @@ -2444,7 +2444,7 @@ if (nr > 0 && nc > 0) { result.resize (nc); - index.resize (nc); + idx_arg.resize (nc); for (int j = 0; j < nc; j++) { @@ -2474,7 +2474,7 @@ } result.elem (j) = tmp_max; - index.elem (j) = octave_is_NaN_or_NA (tmp_max) ? 0 : idx_i; + idx_arg.elem (j) = octave_is_NaN_or_NA (tmp_max) ? 0 : idx_i; } } @@ -2698,7 +2698,7 @@ int count = 0; - double *data = 0; + double *dat = 0; int max_size = 0; int final_nr = 0; @@ -2709,20 +2709,20 @@ if (nc > 0) { resize (nr, nc, 0.0); - data = fortran_vec (); + dat = fortran_vec (); max_size = nr * nc; } else { resize (nr, 32, 0.0); - data = fortran_vec (); + dat = fortran_vec (); max_size = nr * 32; } } else { resize (32, 1, 0.0); - data = fortran_vec (); + dat = fortran_vec (); max_size = 32; } @@ -2774,10 +2774,10 @@ else resize (max_size, 1, 0.0); - data = fortran_vec (); + dat = fortran_vec (); } - data[count++] = tmp; + dat[count++] = tmp; } if (skip != 0)
--- a/liboctave/dNDArray.h +++ b/liboctave/dNDArray.h @@ -43,10 +43,10 @@ NDArray (void) : MArrayN<double> () { } - NDArray (const dim_vector& dims) : MArrayN<double> (dims) { } + NDArray (const dim_vector& dv) : MArrayN<double> (dv) { } - NDArray (const dim_vector& dims, double val) - : MArrayN<double> (dims, val) { } + NDArray (const dim_vector& dv, double val) + : MArrayN<double> (dv, val) { } NDArray (const NDArray& a) : MArrayN<double> (a) { } @@ -106,7 +106,7 @@ private: - NDArray (double *d, dim_vector& dims) : MArrayN<double> (d, dims) { } + NDArray (double *d, dim_vector& dv) : MArrayN<double> (d, dv) { } }; NDS_CMP_OP_DECLS (NDArray, double)
--- a/liboctave/dRowVector.cc +++ b/liboctave/dRowVector.cc @@ -210,9 +210,6 @@ gripe_nonconformant ("operator *", 1, len, a_nr, a_nc); else { - int a_nr = a.rows (); - int a_nc = a.cols (); - if (len == 0) retval.resize (a_nc, 0.0); else
--- a/liboctave/dbleQR.cc +++ b/liboctave/dbleQR.cc @@ -115,7 +115,7 @@ lwork = 32 * n2; work.resize (lwork); - double *pwork = work.fortran_vec (); + pwork = work.fortran_vec (); F77_XFCN (dorgqr, DORGQR, (m, n2, min_mn, tmp_data, m, ptau, pwork, lwork, info));
--- a/liboctave/kpse.cc +++ b/liboctave/kpse.cc @@ -2519,10 +2519,10 @@ for (int k = 1; k < aliases_len && found.empty (); k++) { - std::string atry = db_dirs[j] + aliases[k]; - std::string tmp = kpse_readable_file (atry); + std::string aatry = db_dirs[j] + aliases[k]; + tmp = kpse_readable_file (aatry); if (! tmp.empty ()) - found = atry; + found = aatry; } }
--- a/liboctave/oct-rl-hist.c +++ b/liboctave/oct-rl-hist.c @@ -28,6 +28,7 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <readline/history.h>
--- a/liboctave/str-vec.cc +++ b/liboctave/str-vec.cc @@ -172,21 +172,21 @@ // Calculate the maximum number of columns that will fit. int line_length = command_editor::terminal_cols (); - int cols = line_length / max_name_length; - if (cols == 0) - cols = 1; + int nc = line_length / max_name_length; + if (nc == 0) + nc = 1; // Calculate the number of rows that will be in each column except // possibly for a short column on the right. - int rows = total_names / cols + (total_names % cols != 0); + int nr = total_names / nc + (total_names % nc != 0); // Recalculate columns based on rows. - cols = total_names / rows + (total_names % rows != 0); + nc = total_names / nr + (total_names % nr != 0); int count; - for (int row = 0; row < rows; row++) + for (int row = 0; nr < nr; row++) { count = row; int pos = 0; @@ -200,7 +200,7 @@ os << nm; int name_length = nm.length (); - count += rows; + count += nr; if (count >= total_names) break;
--- a/liboctave/str-vec.h +++ b/liboctave/str-vec.h @@ -81,11 +81,11 @@ static int compare (const void *a_arg, const void *b_arg); - string_vector& qsort (bool make_unique = false) + string_vector& qsort (bool make_uniq = false) { Array<std::string>::qsort (compare); - if (make_unique) + if (make_uniq) uniq (); return *this;
--- a/src/Cell.cc +++ b/src/Cell.cc @@ -47,17 +47,17 @@ } Cell -Cell::index (const octave_value_list& idx, bool resize_ok) const +Cell::index (const octave_value_list& idx_arg, bool resize_ok) const { Cell retval; - int n = idx.length (); + int n = idx_arg.length (); switch (n) { case 1: { - idx_vector i = idx(0).index_vector (); + idx_vector i = idx_arg(0).index_vector (); retval = index (i, resize_ok); } @@ -65,8 +65,8 @@ case 2: { - idx_vector i = idx(0).index_vector (); - idx_vector j = idx(1).index_vector (); + idx_vector i = idx_arg(0).index_vector (); + idx_vector j = idx_arg(1).index_vector (); retval = index (i, j, resize_ok); } @@ -77,7 +77,7 @@ Array<idx_vector> iv (n); for (int i = 0; i < n; i++) - iv(i) = idx(i).index_vector (); + iv(i) = idx_arg(i).index_vector (); retval = index (iv, resize_ok); } @@ -88,12 +88,12 @@ } Cell& -Cell::assign (const octave_value_list& idx, const Cell& rhs, +Cell::assign (const octave_value_list& idx_arg, const Cell& rhs, const octave_value& fill_val) { - for (int i = 0; i < idx.length (); i++) - set_index (idx(i).index_vector ()); + for (int i = 0; i < idx_arg.length (); i++) + set_index (idx_arg(i).index_vector ()); ::assign (*this, rhs, fill_val);
--- a/src/Cell.h +++ b/src/Cell.h @@ -56,9 +56,8 @@ Cell (int n, int m, const octave_value& val = resize_fill_value ()) : ArrayN<octave_value> (dim_vector (n, m), val) { } - Cell (const dim_vector& dims, - const octave_value& val = resize_fill_value ()) - : ArrayN<octave_value> (dims, val) { } + Cell (const dim_vector& dv, const octave_value& val = resize_fill_value ()) + : ArrayN<octave_value> (dv, val) { } Cell (const ArrayN<octave_value>& c) : ArrayN<octave_value> (c) { }
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,19 @@ +2003-11-10 John W. Eaton <jwe@bevo.che.wisc.edu> + + * ov-cell.cc (octave_cell::print_raw): Use dim_vector::str. + + * Cell.cc, Cell.h, debug.cc, file-io.cc, load-save.cc, + oct-fstrm.cc, oct-iostrm.cc, oct-iostrm.h, oct-map.cc, oct-map.h, + oct-prcstrm.cc, oct-stdstrm.h, oct-stream.cc, oct-strstrm.h, + octave.cc, ov-base.h, ov-cell.cc, ov.cc, ov.h, pt-cell.h, + pt-mat.cc, pt-mat.h, pt-plot.cc, pt-stmt.cc, variables.cc, + DLD-FUNCTIONS/rand.cc: Avoid -Wshadow warnings. + +2003-11-01 John W. Eaton <jwe@bevo.che.wisc.edu> + + * ov.h (octave_base_value::is_bool_matrix): New virtual function. + * ov-base.h (octave_base_value::is_bool_matrix): New function. + 2003-10-31 John W. Eaton <jwe@bevo.che.wisc.edu> * ov.cc (octave_value::length): If any dim is zero, return 0.
--- a/src/DLD-FUNCTIONS/rand.cc +++ b/src/DLD-FUNCTIONS/rand.cc @@ -190,8 +190,6 @@ } else { - int nargin = args.length (); - dims.resize (nargin); for (int i = 0; i < nargin; i++)
--- a/src/debug.cc +++ b/src/debug.cc @@ -64,7 +64,7 @@ } else { - symbol_record *ptr = lookup_by_name (str, false); + ptr = lookup_by_name (str, false); if (ptr && ptr->is_user_function ()) {
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -688,8 +688,6 @@ if (! error_state) { - std::string who; - if (args(fmt_n).is_string ()) { std::string fmt = args(fmt_n).string_value ();
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -413,7 +413,7 @@ { while (len) { - char c = retval[len-1]; + c = retval[len-1]; if (c == ' ' || c == '\t') len--; @@ -1064,16 +1064,16 @@ goto data_read_error; if (swap) swap_4_bytes (X_CAST (char *, &len)); - OCTAVE_LOCAL_BUFFER (char, tmp, len+1); - if (! is.read (X_CAST (char *, tmp), len)) + OCTAVE_LOCAL_BUFFER (char, btmp, len+1); + if (! is.read (X_CAST (char *, btmp), len)) goto data_read_error; if (len > max_len) { max_len = len; chm.resize (elements, max_len, 0); } - tmp [len] = '\0'; - chm.insert (tmp, i, 0); + btmp [len] = '\0'; + chm.insert (btmp, i, 0); } tc = octave_value (chm, true); } @@ -2673,7 +2673,7 @@ // dimensions array subelement { - std::streampos pos; + std::streampos tmp_pos; if (read_mat5_tag (is, swap, type, dimension_length) || type != miINT32) { @@ -2681,19 +2681,19 @@ goto early_read_error; } - pos = is.tellg (); + tmp_pos = is.tellg (); read_int (is, swap, nr); read_int (is, swap, nc); re.resize (nr, nc); // delay checking for a multidimensional array until we have read // the variable name - is.seekg (pos + static_cast<std::streamoff> (dimension_length)); + is.seekg (tmp_pos + static_cast<std::streamoff> (dimension_length)); } // array name subelement { - std::streampos pos; + std::streampos tmp_pos; if (read_mat5_tag (is, swap, type, len) || type != miINT8) { @@ -2701,7 +2701,7 @@ goto early_read_error; } - pos = is.tellg (); + tmp_pos = is.tellg (); OCTAVE_LOCAL_BUFFER (char, name, len+1); if (len) // structure field subelements have @@ -2710,7 +2710,7 @@ if (! is.read (X_CAST (char *, name), len )) goto data_read_error; - is.seekg (pos + static_cast<std::streamoff> (PAD (len))); + is.seekg (tmp_pos + static_cast<std::streamoff> (PAD (len))); } name[len] = '\0'; @@ -2763,8 +2763,8 @@ case mxSTRUCT_CLASS: { Octave_map m; - FOUR_BYTE_INT type; - FOUR_BYTE_INT len; + FOUR_BYTE_INT fn_type; + FOUR_BYTE_INT fn_len; FOUR_BYTE_INT field_name_length; int i; @@ -2773,13 +2773,13 @@ // be 32. We read and use the actual value, on the theory // that eventually someone will recognize that's a waste of // space. - if (read_mat5_tag (is, swap, type, len) || type != miINT32) + if (read_mat5_tag (is, swap, fn_type, fn_len) || fn_type != miINT32) { error ("load: invalid field name subelement"); goto data_read_error; } - if (! is.read (X_CAST (char *, &field_name_length), len )) + if (! is.read (X_CAST (char *, &field_name_length), fn_len )) goto data_read_error; if (swap) @@ -2787,19 +2787,19 @@ // field name subelement. The length of this subelement tells // us how many fields there are. - if (read_mat5_tag (is, swap, type, len) || type != miINT8) + if (read_mat5_tag (is, swap, fn_type, fn_len) || fn_type != miINT8) { error ("load: invalid field name subelement"); goto data_read_error; } - int n_fields = len/field_name_length; - - len = PAD (len); - - OCTAVE_LOCAL_BUFFER (char, elname, len); - - if (! is.read (elname, len)) + int n_fields = fn_len/field_name_length; + + fn_len = PAD (fn_len); + + OCTAVE_LOCAL_BUFFER (char, elname, fn_len); + + if (! is.read (elname, fn_len)) goto data_read_error; int n; @@ -2826,12 +2826,12 @@ } } - for (int i = n_fields-1; i >= 0; i--) + for (int j = n_fields-1; j >= 0; j--) { - const char *key = elname + i*field_name_length; - - for (int j = n-1; j >=0; j--) - m[key](j) = field_elts(i,j); + const char *key = elname + j*field_name_length; + + for (int k = n-1; k >=0; k--) + m[key](k) = field_elts(j,k); } tc = m; @@ -2854,7 +2854,7 @@ // real data subelement { - std::streampos pos; + std::streampos tmp_pos; if (read_mat5_tag (is, swap, type, len)) { @@ -2862,7 +2862,7 @@ goto data_read_error; } - pos = is.tellg (); + tmp_pos = is.tellg (); read_mat5_binary_data (is, re.fortran_vec (), nr*nc, swap, (enum mat5_data_type) type, flt_fmt); @@ -2872,7 +2872,7 @@ goto data_read_error; } - is.seekg (pos + static_cast<std::streamoff> (PAD (len))); + is.seekg (tmp_pos + static_cast<std::streamoff> (PAD (len))); } // imaginary data subelement @@ -3610,8 +3610,8 @@ FOUR_BYTE_INT len = chm.cols (); os.write (X_CAST (char *, &len), 4); std::string tstr = chm.row_as_string (i); - const char *tmp = tstr.data (); - os.write (X_CAST (char *, tmp), len); + const char *btmp = tstr.data (); + os.write (X_CAST (char *, btmp), len); } } else if (tc.is_range ()) @@ -3634,8 +3634,8 @@ os.write (X_CAST (char *, &tmp), 1); tmp = (char) LS_DOUBLE; os.write (X_CAST (char *, &tmp), 1); - double tmp = tc.double_value (); - os.write (X_CAST (char *, &tmp), 8); + double dtmp = tc.double_value (); + os.write (X_CAST (char *, &dtmp), 8); } else if (tc.is_real_matrix ()) { @@ -3673,8 +3673,8 @@ os.write (X_CAST (char *, &tmp), 1); tmp = (char) LS_DOUBLE; os.write (X_CAST (char *, &tmp), 1); - Complex tmp = tc.complex_value (); - os.write (X_CAST (char *, &tmp), 16); + Complex ctmp = tc.complex_value (); + os.write (X_CAST (char *, &ctmp), 16); } else if (tc.is_complex_matrix ()) { @@ -4350,11 +4350,11 @@ if (tc.is_string ()) { charMatrix chm = tc.char_matrix_value (); - int nc = chm.cols (); - int len = nr*nc*2; - int paddedlength = PAD (nr*nc*2); - - OCTAVE_LOCAL_BUFFER (TWO_BYTE_INT, buf, nc*nr+3); + int ncol = chm.cols (); + int len = nr*ncol*2; + int paddedlength = PAD (nr*ncol*2); + + OCTAVE_LOCAL_BUFFER (TWO_BYTE_INT, buf, ncol*nr+3); write_mat5_tag (os, miUINT16, len); for (int i = 0; i < nr; i++) @@ -4362,10 +4362,10 @@ std::string tstr = chm.row_as_string (i); const char *s = tstr.data (); - for (int j = 0; j < nc; j++) + for (int j = 0; j < ncol; j++) buf[j*nr+i] = *s++ & 0x00FF; } - os.write ((char *)buf, nr*nc*2); + os.write ((char *)buf, nr*ncol*2); if (paddedlength > len) os.write ((char *)buf, paddedlength - len); @@ -4500,20 +4500,20 @@ charMatrix chm = tc.char_matrix_value (); - int nr = chm.rows (); - int nc = chm.cols (); + int nrow = chm.rows (); + int ncol = chm.cols (); - OCTAVE_LOCAL_BUFFER (double, buf, nc*nr); + OCTAVE_LOCAL_BUFFER (double, buf, ncol*nrow); - for (int i = 0; i < nr; i++) + for (int i = 0; i < nrow; i++) { std::string tstr = chm.row_as_string (i); const char *s = tstr.data (); - for (int j = 0; j < nc; j++) - buf[j*nr+i] = static_cast<double> (*s++ & 0x00FF); + for (int j = 0; j < ncol; j++) + buf[j*nrow+i] = static_cast<double> (*s++ & 0x00FF); } - os.write ((char *)buf, nr*nc*sizeof(double)); + os.write ((char *)buf, nrow*ncol*sizeof(double)); unwind_protect::run_frame ("save_mat_binary_data"); }
--- a/src/oct-fstrm.cc +++ b/src/oct-fstrm.cc @@ -32,15 +32,15 @@ octave_stream octave_fstream::create (const std::string& nm_arg, std::ios::openmode arg_md, - oct_mach_info::float_format flt_fmt) + oct_mach_info::float_format ff) { - return octave_stream (new octave_fstream (nm_arg, arg_md, flt_fmt)); + return octave_stream (new octave_fstream (nm_arg, arg_md, ff)); } octave_fstream::octave_fstream (const std::string& nm_arg, std::ios::openmode arg_md, - oct_mach_info::float_format flt_fmt) - : octave_base_stream (arg_md, flt_fmt), nm (nm_arg) + oct_mach_info::float_format ff) + : octave_base_stream (arg_md, ff), nm (nm_arg) { #if CXX_ISO_COMPLIANT_LIBRARY
--- a/src/oct-iostrm.cc +++ b/src/oct-iostrm.cc @@ -69,9 +69,9 @@ } octave_stream -octave_istream::create (std::istream *arg, const std::string& nm) +octave_istream::create (std::istream *arg, const std::string& n) { - return octave_stream (new octave_istream (arg, nm)); + return octave_stream (new octave_istream (arg, n)); } // Return non-zero if EOF has been reached on this stream. @@ -83,9 +83,9 @@ } octave_stream -octave_ostream::create (std::ostream *arg, const std::string& nm) +octave_ostream::create (std::ostream *arg, const std::string& n) { - return octave_stream (new octave_ostream (arg, nm)); + return octave_stream (new octave_ostream (arg, n)); } /*
--- a/src/oct-iostrm.h +++ b/src/oct-iostrm.h @@ -33,10 +33,10 @@ public: octave_base_iostream (const std::string& n = std::string (), - std::ios::openmode md = std::ios::in|std::ios::out, - oct_mach_info::float_format flt_fmt = + std::ios::openmode m = std::ios::in|std::ios::out, + oct_mach_info::float_format ff = oct_mach_info::flt_fmt_native) - : octave_base_stream (md, flt_fmt), nm (n) { } + : octave_base_stream (m, ff), nm (n) { } // Position a stream at OFFSET relative to ORIGIN. @@ -78,12 +78,12 @@ { public: - octave_istream (std::istream *arg = 0, const std::string& nm = std::string ()) - : octave_base_iostream (nm, std::ios::in, oct_mach_info::flt_fmt_native), + octave_istream (std::istream *arg = 0, const std::string& n = std::string ()) + : octave_base_iostream (n, std::ios::in, oct_mach_info::flt_fmt_native), is (arg) { } static octave_stream - create (std::istream *arg = 0, const std::string& nm = std::string ()); + create (std::istream *arg = 0, const std::string& n = std::string ()); // Return non-zero if EOF has been reached on this stream. @@ -115,12 +115,12 @@ { public: - octave_ostream (std::ostream *arg, const std::string& nm = std::string ()) - : octave_base_iostream (nm, std::ios::out, oct_mach_info::flt_fmt_native), + octave_ostream (std::ostream *arg, const std::string& n = std::string ()) + : octave_base_iostream (n, std::ios::out, oct_mach_info::flt_fmt_native), os (arg) { } static octave_stream - create (std::ostream *arg, const std::string& nm = std::string ()); + create (std::ostream *arg, const std::string& n = std::string ()); // Return non-zero if EOF has been reached on this stream.
--- a/src/oct-map.cc +++ b/src/oct-map.cc @@ -35,9 +35,9 @@ #include "utils.h" Cell -Octave_map::operator [] (const std::string& key) const +Octave_map::operator [] (const std::string& k) const { - const_iterator p = seek (key); + const_iterator p = seek (k); return p != end () ? p->second : Cell (); } @@ -124,11 +124,11 @@ for (int i = 0; i < len; i++) { - std::string key = t_keys[i]; + std::string k = t_keys[i]; - Cell t_rhs = rhs[key]; + Cell t_rhs = rhs[k]; - assign (idx, key, t_rhs); + assign (idx, k, t_rhs); if (error_state) break; @@ -171,10 +171,10 @@ } Octave_map& -Octave_map::assign (const octave_value_list& idx, const std::string& key, +Octave_map::assign (const octave_value_list& idx, const std::string& k, const Cell& rhs) { - Cell tmp = map[key]; + Cell tmp = map[k]; octave_value fill_value = Matrix (); @@ -200,25 +200,25 @@ dimensions = new_dims; - map[key] = tmp; + map[k] = tmp; } return *this; } Octave_map& -Octave_map::assign (const std::string& key, const Cell& rhs) +Octave_map::assign (const std::string& k, const Cell& rhs) { if (empty ()) { - map[key] = rhs; + map[k] = rhs; dimensions = dim_vector (1, 1); } else { if (dims () == rhs.dims ()) - map[key] = rhs; + map[k] = rhs; else error ("invalid structure assignment"); }
--- a/src/oct-map.h +++ b/src/oct-map.h @@ -44,17 +44,17 @@ Octave_map (void) : map (), dimensions (0, 0) { } - Octave_map (const std::string& key, const octave_value& value) + Octave_map (const std::string& k, const octave_value& value) : map (), dimensions (1, 1) - { map[key] = value; } + { map[k] = value; } - Octave_map (const std::string& key, const Cell& vals) + Octave_map (const std::string& k, const Cell& vals) : map (), dimensions (vals.dims ()) - { map[key] = vals; } + { map[k] = vals; } - Octave_map (const std::string& key, const octave_value_list& val_list) + Octave_map (const std::string& k, const octave_value_list& val_list) : map (), dimensions (1, val_list.length ()) - { map[key] = val_list; } + { map[k] = val_list; } Octave_map (const Octave_map& m) : map (m.map), dimensions (m.dimensions) { } @@ -76,13 +76,13 @@ int empty (void) const { return map.empty (); } - Cell& operator [] (const std::string& key) { return map[key]; } + Cell& operator [] (const std::string& k) { return map[k]; } - Cell operator [] (const std::string& key) const; + Cell operator [] (const std::string& k) const; - void del (const std::string& key) + void del (const std::string& k) { - iterator p = map.find (key); + iterator p = map.find (k); if (p != map.end ()) map.erase (p); } @@ -101,10 +101,10 @@ Cell contents (const_iterator p) const { return operator [] (key(p)); } - const_iterator seek (const std::string& key) const { return map.find (key); } + const_iterator seek (const std::string& k) const { return map.find (k); } - int contains (const std::string& key) const - { return (seek (key) != map.end ()); } + int contains (const std::string& k) const + { return (seek (k) != map.end ()); } void clear (void) { map.clear (); } @@ -122,10 +122,10 @@ Octave_map& assign (const octave_value_list& idx, const Octave_map& rhs); - Octave_map& assign (const octave_value_list& idx, const std::string& key, + Octave_map& assign (const octave_value_list& idx, const std::string& k, const Cell& rhs); - Octave_map& assign (const std::string& key, const Cell& rhs); + Octave_map& assign (const std::string& k, const Cell& rhs); Octave_map index (const octave_value_list& idx);
--- a/src/oct-prcstrm.cc +++ b/src/oct-prcstrm.cc @@ -36,16 +36,16 @@ octave_stream octave_iprocstream::create (const std::string& n, std::ios::openmode arg_md, - oct_mach_info::float_format flt_fmt) + oct_mach_info::float_format ff) { - return octave_stream (new octave_iprocstream (n, arg_md, flt_fmt)); + return octave_stream (new octave_iprocstream (n, arg_md, ff)); } octave_iprocstream::octave_iprocstream (const std::string& n, std::ios::openmode arg_md, - oct_mach_info::float_format flt_fmt) + oct_mach_info::float_format ff) : octave_stdiostream (n, ::popen (n.c_str (), "r"), - arg_md, flt_fmt, cxx_pclose) + arg_md, ff, cxx_pclose) { } @@ -56,16 +56,16 @@ octave_stream octave_oprocstream::create (const std::string& n, std::ios::openmode arg_md, - oct_mach_info::float_format flt_fmt) + oct_mach_info::float_format ff) { - return octave_stream (new octave_oprocstream (n, arg_md, flt_fmt)); + return octave_stream (new octave_oprocstream (n, arg_md, ff)); } octave_oprocstream::octave_oprocstream (const std::string& n, std::ios::openmode arg_md, - oct_mach_info::float_format flt_fmt) + oct_mach_info::float_format ff) : octave_stdiostream (n, ::popen (n.c_str (), "w"), - arg_md, flt_fmt, cxx_pclose) + arg_md, ff, cxx_pclose) { }
--- a/src/oct-stdstrm.h +++ b/src/oct-stdstrm.h @@ -32,10 +32,11 @@ public: octave_stdiostream (const std::string& n, FILE *f = 0, - std::ios::openmode arg_md = std::ios::in|std::ios::out, - oct_mach_info::float_format flt_fmt = oct_mach_info::flt_fmt_native, + std::ios::openmode m = std::ios::in|std::ios::out, + oct_mach_info::float_format ff = + oct_mach_info::flt_fmt_native, c_file_ptr_buf::close_fcn cf = c_file_ptr_buf::fclose) - : octave_base_stream (arg_md, flt_fmt), nm (n), md (arg_md), s(0) + : octave_base_stream (m, ff), nm (n), md (m), s(0) { if (f) s = new io_c_file_ptr_stream (f, cf); @@ -43,11 +44,11 @@ static octave_stream create (const std::string& n, FILE *f = 0, - std::ios::openmode arg_md = std::ios::in|std::ios::out, - oct_mach_info::float_format flt_fmt = oct_mach_info::flt_fmt_native, + std::ios::openmode m = std::ios::in|std::ios::out, + oct_mach_info::float_format ff = oct_mach_info::flt_fmt_native, c_file_ptr_buf::close_fcn cf = c_file_ptr_buf::fclose) { - return octave_stream (new octave_stdiostream (n, f, arg_md, flt_fmt, cf)); + return octave_stream (new octave_stdiostream (n, f, m, ff, cf)); } // Position a stream at OFFSET relative to ORIGIN.
--- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -710,7 +710,7 @@ *buf << s[i++]; - bool next = false; + bool nxt = false; while (i < n) { @@ -722,11 +722,11 @@ break; default: - next = true; + nxt = true; break; } - if (next) + if (nxt) break; } @@ -742,9 +742,9 @@ { if (isdigit (s[i])) { - int n = 0; + int nn = 0; std::string tmp = s.substr (i); - sscanf (tmp.c_str (), "%d%n", &fw, &n); + sscanf (tmp.c_str (), "%d%n", &fw, &nn); } while (i < n && isdigit (s[i])) @@ -768,9 +768,9 @@ { if (isdigit (s[i])) { - int n = 0; + int nn = 0; std::string tmp = s.substr (i); - sscanf (tmp.c_str (), "%d%n", &prec, &n); + sscanf (tmp.c_str (), "%d%n", &prec, &nn); } while (i < n && isdigit (s[i]))
--- a/src/oct-strstrm.h +++ b/src/oct-strstrm.h @@ -34,10 +34,10 @@ { public: - octave_base_strstream (std::ios::openmode arg_md = std::ios::out, - oct_mach_info::float_format flt_fmt = + octave_base_strstream (std::ios::openmode m = std::ios::out, + oct_mach_info::float_format ff = oct_mach_info::flt_fmt_native) - : octave_base_stream (arg_md, flt_fmt) { } + : octave_base_stream (m, ff) { } // Position a stream at OFFSET relative to ORIGIN. @@ -77,23 +77,23 @@ octave_istrstream (const char *data, std::ios::openmode arg_md = std::ios::out, - oct_mach_info::float_format flt_fmt = + oct_mach_info::float_format ff = oct_mach_info::flt_fmt_native) - : octave_base_strstream (arg_md, flt_fmt), is (data) { } + : octave_base_strstream (arg_md, ff), is (data) { } octave_istrstream (const std::string& data, std::ios::openmode arg_md = std::ios::out, - oct_mach_info::float_format flt_fmt = + oct_mach_info::float_format ff = oct_mach_info::flt_fmt_native) - : octave_base_strstream (arg_md, flt_fmt), is (data.c_str ()) { } + : octave_base_strstream (arg_md, ff), is (data.c_str ()) { } static octave_stream create (const char *data, std::ios::openmode arg_md = std::ios::out, - oct_mach_info::float_format flt_fmt = oct_mach_info::flt_fmt_native); + oct_mach_info::float_format ff = oct_mach_info::flt_fmt_native); static octave_stream create (const std::string& data, std::ios::openmode arg_md = std::ios::out, - oct_mach_info::float_format flt_fmt = oct_mach_info::flt_fmt_native); + oct_mach_info::float_format ff = oct_mach_info::flt_fmt_native); // Return non-zero if EOF has been reached on this stream. @@ -130,13 +130,13 @@ public: octave_ostrstream (std::ios::openmode arg_md = std::ios::out, - oct_mach_info::float_format flt_fmt = + oct_mach_info::float_format ff = oct_mach_info::flt_fmt_native) - : octave_base_strstream (arg_md, flt_fmt) { } + : octave_base_strstream (arg_md, ff) { } static octave_stream create (std::ios::openmode arg_md = std::ios::out, - oct_mach_info::float_format flt_fmt = oct_mach_info::flt_fmt_native); + oct_mach_info::float_format ff = oct_mach_info::flt_fmt_native); // Return non-zero if EOF has been reached on this stream.
--- a/src/octave.cc +++ b/src/octave.cc @@ -166,7 +166,7 @@ { bind_builtin_variable ("nargin", argc-1, true, true, 0); - Cell octave_argv; + Cell args; if (argc > 1) { @@ -177,10 +177,10 @@ while (--i > 0) tmp(i-1) = octave_value (*(argv+i)); - octave_argv = Cell (tmp, argc-1, 1); + args = Cell (tmp, argc-1, 1); } - bind_builtin_constant ("argv", octave_argv, true, true); + bind_builtin_constant ("argv", args, true, true); } static void
--- a/src/ov-base.h +++ b/src/ov-base.h @@ -112,6 +112,8 @@ bool is_complex_matrix (void) const { return false; } + bool is_bool_matrix (void) const { return false; } + bool is_char_matrix (void) const { return false; } bool is_string (void) const { return false; }
--- a/src/ov-cell.cc +++ b/src/ov-cell.cc @@ -334,9 +334,9 @@ void octave_cell::print_raw (std::ostream& os, bool) const { - int ndims = matrix.ndims (); + int nd = matrix.ndims (); - if (ndims == 2) + if (nd == 2) { int nr = rows (); int nc = columns (); @@ -383,15 +383,8 @@ else { indent (os); - os << "{"; dim_vector dv = matrix.dims (); - for (int i = 0; i < ndims; i++) - { - if (i > 0) - os << "x"; - os << dv(i); - } - os << " Cell Array}"; + os << "{" << dv.str () << " Cell Array}"; newline (os); } }
--- a/src/ov.cc +++ b/src/ov.cc @@ -399,10 +399,10 @@ rep->count = 1; } -octave_value::octave_value (const Cell& c, bool is_cs_list) +octave_value::octave_value (const Cell& c, bool is_csl) : rep (0) { - if (is_cs_list) + if (is_csl) rep = new octave_cs_list (c); else rep = new octave_cell (c); @@ -410,12 +410,12 @@ rep->count = 1; } -octave_value::octave_value (const ArrayN<octave_value>& a, bool is_cs_list) +octave_value::octave_value (const ArrayN<octave_value>& a, bool is_csl) : rep (0) { Cell c (a); - if (is_cs_list) + if (is_csl) rep = new octave_cs_list (c); else rep = new octave_cell (c); @@ -548,8 +548,8 @@ maybe_mutate (); } -octave_value::octave_value (const charMatrix& chm, bool is_string) - : rep (is_string +octave_value::octave_value (const charMatrix& chm, bool is_str) + : rep (is_str ? new octave_char_matrix_str (chm) : new octave_char_matrix (chm)) { @@ -557,8 +557,8 @@ maybe_mutate (); } -octave_value::octave_value (const charNDArray& chm, bool is_string) - : rep (is_string +octave_value::octave_value (const charNDArray& chm, bool is_str) + : rep (is_str ? new octave_char_matrix_str (chm) : new octave_char_matrix (chm)) { @@ -604,8 +604,8 @@ rep->count = 1; } -octave_value::octave_value (const octave_value_list& l, bool is_cs_list) - : rep (is_cs_list ? new octave_cs_list (l) : new octave_list (l)) +octave_value::octave_value (const octave_value_list& l, bool is_csl) + : rep (is_csl ? new octave_cs_list (l) : new octave_list (l)) { rep->count = 1; } @@ -1472,8 +1472,7 @@ if (cf1 || cf2) { - binary_op_fcn f - = octave_value_typeinfo::lookup_binary_op (op, t1, t2); + f = octave_value_typeinfo::lookup_binary_op (op, t1, t2); if (f) retval = f (*tv1.rep, *tv2.rep); @@ -1537,7 +1536,7 @@ tv = octave_value (tmp); t = tv.type_id (); - unary_op_fcn f = octave_value_typeinfo::lookup_unary_op (op, t); + f = octave_value_typeinfo::lookup_unary_op (op, t); if (f) retval = f (*tv.rep);
--- a/src/ov.h +++ b/src/ov.h @@ -329,8 +329,8 @@ int numel (void) const; - virtual octave_value reshape (const dim_vector& dims) const - { return rep->reshape (dims); } + virtual octave_value reshape (const dim_vector& dv) const + { return rep->reshape (dv); } // Does this constant have a type? Both of these are provided since // it is sometimes more natural to write is_undefined() instead of @@ -363,6 +363,9 @@ virtual bool is_complex_matrix (void) const { return rep->is_complex_matrix (); } + virtual bool is_bool_matrix (void) const + { return rep->is_bool_matrix (); } + virtual bool is_char_matrix (void) const { return rep->is_char_matrix (); }
--- a/src/pt-cell.h +++ b/src/pt-cell.h @@ -44,7 +44,8 @@ { public: - tree_cell (tree_argument_list *row = 0, int line = -1, int column = -1) : tree_matrix (row, line, column) { } + tree_cell (tree_argument_list *row = 0, int l = -1, int c = -1) + : tree_matrix (row, l, c) { } ~tree_cell (void) { }
--- a/src/pt-mat.cc +++ b/src/pt-mat.cc @@ -232,11 +232,11 @@ { if (tmp.is_cs_list ()) { - octave_value_list lst = tmp.list_value (); + octave_value_list tlst = tmp.list_value (); - for (int i = 0; i < lst.length (); i++) + for (int i = 0; i < tlst.length (); i++) { - if (! do_init_element (elt, lst(i), first_elem)) + if (! do_init_element (elt, tlst(i), first_elem)) goto done; } }
--- a/src/pt-mat.h +++ b/src/pt-mat.h @@ -47,8 +47,8 @@ { public: - tree_matrix (tree_argument_list *row = 0, int line = -1, int column = -1) - : tree_expression (line, column) + tree_matrix (tree_argument_list *row = 0, int l = -1, int c = -1) + : tree_expression (l, c) { if (row) append (row);
--- a/src/pt-plot.cc +++ b/src/pt-plot.cc @@ -776,7 +776,8 @@ if (sp_axes_clause) { - int status = sp_axes_clause->print (plot_buf); + status = sp_axes_clause->print (plot_buf); + if (status < 0) return -1; } @@ -801,7 +802,8 @@ if (sp_style_clause) { - int status = sp_style_clause->print (plot_buf); + status = sp_style_clause->print (plot_buf); + if (status < 0) return -1; }
--- a/src/pt-stmt.cc +++ b/src/pt-stmt.cc @@ -204,9 +204,9 @@ int len = bp_lst.length (); - for (int line = 0; line < len; line++) + for (int i = 0; i < len; i++) { - tree_breakpoint tbp (line, tree_breakpoint::clear); + tree_breakpoint tbp (i, tree_breakpoint::clear); accept (tbp); } }
--- a/src/variables.cc +++ b/src/variables.cc @@ -377,7 +377,7 @@ for (int i = 0; i < n; i++) { - size_t len = text.find ('.', pos); + len = text.find ('.', pos); if (len != NPOS) len -= pos; @@ -1171,8 +1171,8 @@ octave_value_list ovl (len, octave_value ()); - for (int i = 0; i < len; i++) - ovl(i) = names(i); + for (int j = 0; j < len; i++) + ovl(j) = names(j); retval = Octave_map ("name", ovl); }