# HG changeset patch # User jwe # Date 1152908975 0 # Node ID bd3041e30d97fbe0c0c2eb8345b4c502bd7e67b7 # Parent 9a5a0d5ef82ab8b739299a0247137374c951d992 [project @ 2006-07-14 20:29:35 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,13 @@ 2006-07-14 John W. Eaton + * ov-base-mat.cc, ov-base-mat.h, ov-base-sparse.cc, + ov-base-sparse.h, ov-base.cc, ov-base.h, ov-bool.cc, + ov-bool.h, ov-complex.cc, ov-complex.h, ov-intx.h, ov-list.cc, + ov-list.h, ov-range.cc, ov-range.h, ov-scalar.cc, ov-scalar.h, + ov-str-mat.cc, ov-str-mat.h, ov.h (do_index_op): + Declare resize_ok arg as bool, not int. + Provide default value for resize_ok. + * c-file-ptr-stream.h (c_file_ptr_stream::c_file_ptr_stream): Qualify init. diff --git a/src/ov-base-mat.cc b/src/ov-base-mat.cc --- a/src/ov-base-mat.cc +++ b/src/ov-base-mat.cc @@ -128,7 +128,7 @@ template octave_value octave_base_matrix::do_index_op (const octave_value_list& idx, - int resize_ok) + bool resize_ok) { octave_value retval; diff --git a/src/ov-base-mat.h b/src/ov-base-mat.h --- a/src/ov-base-mat.h +++ b/src/ov-base-mat.h @@ -94,10 +94,8 @@ const std::list& idx, const octave_value& rhs); - octave_value do_index_op (const octave_value_list& idx, int resize_ok); - - octave_value do_index_op (const octave_value_list& idx) - { return do_index_op (idx, 0); } + octave_value do_index_op (const octave_value_list& idx, + bool resize_ok = false); void assign (const octave_value_list& idx, const MT& rhs); diff --git a/src/ov-base-sparse.cc b/src/ov-base-sparse.cc --- a/src/ov-base-sparse.cc +++ b/src/ov-base-sparse.cc @@ -45,7 +45,7 @@ template octave_value octave_base_sparse::do_index_op (const octave_value_list& idx, - int resize_ok) + bool resize_ok) { octave_value retval; diff --git a/src/ov-base-sparse.h b/src/ov-base-sparse.h --- a/src/ov-base-sparse.h +++ b/src/ov-base-sparse.h @@ -101,10 +101,8 @@ dim_vector dims (void) const { return matrix.dims (); } - octave_value do_index_op (const octave_value_list& idx, int resize_ok); - - octave_value do_index_op (const octave_value_list& idx) - { return do_index_op (idx, 0); } + octave_value do_index_op (const octave_value_list& idx, + bool resize_ok = false); octave_value reshape (const dim_vector& new_dims) const { return T (matrix.reshape (new_dims)); } diff --git a/src/ov-base.cc b/src/ov-base.cc --- a/src/ov-base.cc +++ b/src/ov-base.cc @@ -92,19 +92,13 @@ } octave_value -octave_base_value::do_index_op (const octave_value_list&, int) +octave_base_value::do_index_op (const octave_value_list&, bool) { std::string nm = type_name (); error ("can't perform indexing operations for %s type", nm.c_str ()); return octave_value (); } -octave_value -octave_base_value::do_index_op (const octave_value_list& idx) -{ - return do_index_op (idx, 0); -} - octave_value_list octave_base_value::do_multi_index_op (int, const octave_value_list&) { diff --git a/src/ov-base.h b/src/ov-base.h --- a/src/ov-base.h +++ b/src/ov-base.h @@ -135,10 +135,7 @@ int nargout); virtual octave_value - do_index_op (const octave_value_list& idx, int resize_ok); - - virtual octave_value - do_index_op (const octave_value_list& idx); + do_index_op (const octave_value_list& idx, bool resize_ok = false); virtual octave_value_list do_multi_index_op (int nargout, const octave_value_list& idx); diff --git a/src/ov-bool.cc b/src/ov-bool.cc --- a/src/ov-bool.cc +++ b/src/ov-bool.cc @@ -77,7 +77,7 @@ } octave_value -octave_bool::do_index_op (const octave_value_list& idx, int resize_ok) +octave_bool::do_index_op (const octave_value_list& idx, bool resize_ok) { octave_value retval; diff --git a/src/ov-bool.h b/src/ov-bool.h --- a/src/ov-bool.h +++ b/src/ov-bool.h @@ -67,7 +67,8 @@ type_conv_fcn numeric_conversion_function (void) const; - octave_value do_index_op (const octave_value_list& idx, int resize_ok); + octave_value do_index_op (const octave_value_list& idx, + bool resize_ok = false); idx_vector index_vector (void) const { return idx_vector (scalar); } diff --git a/src/ov-complex.cc b/src/ov-complex.cc --- a/src/ov-complex.cc +++ b/src/ov-complex.cc @@ -65,7 +65,7 @@ } octave_value -octave_complex::do_index_op (const octave_value_list& idx, int resize_ok) +octave_complex::do_index_op (const octave_value_list& idx, bool resize_ok) { octave_value retval; diff --git a/src/ov-complex.h b/src/ov-complex.h --- a/src/ov-complex.h +++ b/src/ov-complex.h @@ -75,7 +75,8 @@ octave_base_value *try_narrowing_conversion (void); - octave_value do_index_op (const octave_value_list& idx, int resize_ok); + octave_value do_index_op (const octave_value_list& idx, + bool resize_ok = false); octave_value any (int = 0) const { diff --git a/src/ov-intx.h b/src/ov-intx.h --- a/src/ov-intx.h +++ b/src/ov-intx.h @@ -174,7 +174,8 @@ octave_base_value *empty_clone (void) const { return new OCTAVE_VALUE_INT_SCALAR_T (); } - octave_value do_index_op (const octave_value_list& idx, int resize_ok) + octave_value do_index_op (const octave_value_list& idx, + bool resize_ok = false) { octave_value retval; diff --git a/src/ov-list.cc b/src/ov-list.cc --- a/src/ov-list.cc +++ b/src/ov-list.cc @@ -125,7 +125,7 @@ } octave_value -octave_list::do_index_op (const octave_value_list& idx, int resize_ok) +octave_list::do_index_op (const octave_value_list& idx, bool resize_ok) { octave_value retval; diff --git a/src/ov-list.h b/src/ov-list.h --- a/src/ov-list.h +++ b/src/ov-list.h @@ -74,7 +74,8 @@ const std::list& idx, int nargout); - octave_value do_index_op (const octave_value_list& idx, int resize_ok); + octave_value do_index_op (const octave_value_list& idx, + bool resize_ok = false); octave_value subsasgn (const std::string& type, const std::list& idx, diff --git a/src/ov-range.cc b/src/ov-range.cc --- a/src/ov-range.cc +++ b/src/ov-range.cc @@ -110,7 +110,7 @@ } octave_value -octave_range::do_index_op (const octave_value_list& idx, int resize_ok) +octave_range::do_index_op (const octave_value_list& idx, bool resize_ok) { // FIXME -- this doesn't solve the problem of // diff --git a/src/ov-range.h b/src/ov-range.h --- a/src/ov-range.h +++ b/src/ov-range.h @@ -93,10 +93,8 @@ return octave_value_list (); } - octave_value do_index_op (const octave_value_list& idx, int resize_ok); - - octave_value do_index_op (const octave_value_list& idx) - { return do_index_op (idx, 0); } + octave_value do_index_op (const octave_value_list& idx, + bool resize_ok = false); idx_vector index_vector (void) const { return idx_vector (range); } diff --git a/src/ov-scalar.cc b/src/ov-scalar.cc --- a/src/ov-scalar.cc +++ b/src/ov-scalar.cc @@ -54,7 +54,7 @@ DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_scalar, "scalar", "double"); octave_value -octave_scalar::do_index_op (const octave_value_list& idx, int resize_ok) +octave_scalar::do_index_op (const octave_value_list& idx, bool resize_ok) { octave_value retval; diff --git a/src/ov-scalar.h b/src/ov-scalar.h --- a/src/ov-scalar.h +++ b/src/ov-scalar.h @@ -71,7 +71,8 @@ // undefined), A will be empty instead of a 1x1 object. octave_base_value *empty_clone (void) const { return new octave_matrix (); } - octave_value do_index_op (const octave_value_list& idx, int resize_ok); + octave_value do_index_op (const octave_value_list& idx, + bool resize_ok = false); idx_vector index_vector (void) const { return idx_vector (scalar); } diff --git a/src/ov-str-mat.cc b/src/ov-str-mat.cc --- a/src/ov-str-mat.cc +++ b/src/ov-str-mat.cc @@ -83,7 +83,7 @@ octave_value octave_char_matrix_str::do_index_op_internal (const octave_value_list& idx, - int resize_ok, char type) + bool resize_ok, char type) { octave_value retval; diff --git a/src/ov-str-mat.h b/src/ov-str-mat.h --- a/src/ov-str-mat.h +++ b/src/ov-str-mat.h @@ -85,7 +85,8 @@ type_conv_fcn numeric_conversion_function (void) const; - octave_value do_index_op (const octave_value_list& idx, int resize_ok) + octave_value do_index_op (const octave_value_list& idx, + bool resize_ok = false) { return do_index_op_internal (idx, resize_ok); } void assign (const octave_value_list& idx, const charMatrix& rhs); @@ -152,7 +153,7 @@ protected: octave_value do_index_op_internal (const octave_value_list& idx, - int resize_ok, char type = '"'); + bool resize_ok, char type = '"'); private: @@ -215,7 +216,8 @@ bool is_sq_string (void) const { return true; } - octave_value do_index_op (const octave_value_list& idx, int resize_ok) + octave_value do_index_op (const octave_value_list& idx, + bool resize_ok = false) { return do_index_op_internal (idx, resize_ok, '\''); } private: diff --git a/src/ov.h b/src/ov.h --- a/src/ov.h +++ b/src/ov.h @@ -299,12 +299,9 @@ size_t skip = 1); octave_value do_index_op (const octave_value_list& idx, - int resize_ok) + bool resize_ok = false) { return rep->do_index_op (idx, resize_ok); } - octave_value do_index_op (const octave_value_list& idx) - { return do_index_op (idx, 0); } - octave_value_list do_multi_index_op (int nargout, const octave_value_list& idx);