Mercurial > hg > octave-terminal
changeset 4247:fc9a075d10fb
[project @ 2002-12-30 23:05:27 by jwe]
author | jwe |
---|---|
date | Mon, 30 Dec 2002 23:05:27 +0000 |
parents | 0253850a08d7 |
children | eef64f3f9a4c |
files | src/ChangeLog src/defaults.cc src/load-save.cc src/octave.cc src/ov-base-mat.cc src/ov-base-mat.h src/ov-base-scalar.cc src/ov-base-scalar.h src/ov-base.cc src/ov-base.h src/ov-builtin.cc src/ov-builtin.h src/ov-cell.cc src/ov-cell.h src/ov-cs-list.cc src/ov-cs-list.h src/ov-list.cc src/ov-list.h src/ov-mapper.cc src/ov-mapper.h src/ov-range.cc src/ov-range.h src/ov-struct.cc src/ov-struct.h src/ov-usr-fcn.cc src/ov-usr-fcn.h src/ov.cc src/ov.h |
diffstat | 28 files changed, 86 insertions(+), 62 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,22 @@ +2002-12-30 John W. Eaton <jwe@bevo.che.wisc.edu> + + * load-save.cc (read_mat_ascii_data): Use isalpha and isalnum, not + ::isalpha and ::isalnum. + + * defaults.cc (maybe_add_or_del_packages): SCRIPT_FILE arg is now + a const reference type. + + * ov.h (octave_value::subsref, octave_value::subsasgn, + octave_value::assign, octave_value::do_non_const_unary_op, + octave_value::numeric_assign): TYPE arg is now a const reference + type. Change all derived classes. + + * ov.cc (octave_value::subsref (const std::string&, const + octave_value_list&)): Move body here, from ov.h. + + * octave.cc (octave_main): Return 0 at end of function to avoid + compiler warnings. + 2002-12-30 Paul Kienzle <pkienzle@users.sf.net> * parse.y: Fix typo in doc string.
--- a/src/defaults.cc +++ b/src/defaults.cc @@ -95,7 +95,7 @@ static void maybe_add_or_del_packages (const string_vector& a, const string_vector& b, - const std::string script_file) + const std::string& script_file) { if (! octave_interpreter_ready) return;
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -1993,11 +1993,11 @@ for (size_t i = 0; i < len; i++) { char c = varname[i]; - if (! (::isalnum (c) || c == '_')) + if (! (isalnum (c) || c == '_')) varname[i] = '_'; } - if (! ::isalpha (varname[0])) + if (! isalpha (varname[0])) varname.insert (0, "X"); if (valid_identifier (varname))
--- a/src/octave.cc +++ b/src/octave.cc @@ -601,6 +601,8 @@ retval = 0; clean_up_and_exit (retval); + + return 0; } /*
--- a/src/ov-base-mat.cc +++ b/src/ov-base-mat.cc @@ -39,7 +39,7 @@ template <class MT> octave_value -octave_base_matrix<MT>::subsref (const std::string type, +octave_base_matrix<MT>::subsref (const std::string& type, const std::list<octave_value_list>& idx) { octave_value retval; @@ -67,7 +67,7 @@ template <class MT> octave_value -octave_base_matrix<MT>::subsasgn (const std::string type, +octave_base_matrix<MT>::subsasgn (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs) {
--- a/src/ov-base-mat.h +++ b/src/ov-base-mat.h @@ -66,10 +66,10 @@ octave_value *clone (void) const { return new octave_base_matrix (*this); } octave_value *empty_clone (void) const { return new octave_base_matrix (); } - octave_value subsref (const std::string type, + octave_value subsref (const std::string& type, const std::list<octave_value_list>& idx); - octave_value subsasgn (const std::string type, + octave_value subsasgn (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs);
--- a/src/ov-base-scalar.cc +++ b/src/ov-base-scalar.cc @@ -39,7 +39,7 @@ template <class ST> octave_value -octave_base_scalar<ST>::subsref (const std::string type, +octave_base_scalar<ST>::subsref (const std::string& type, const std::list<octave_value_list>& idx) { octave_value retval; @@ -67,7 +67,7 @@ template <class ST> octave_value -octave_base_scalar<ST>::subsasgn (const std::string type, +octave_base_scalar<ST>::subsasgn (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs) {
--- a/src/ov-base-scalar.h +++ b/src/ov-base-scalar.h @@ -59,10 +59,10 @@ ~octave_base_scalar (void) { } - octave_value subsref (const std::string type, + octave_value subsref (const std::string& type, const std::list<octave_value_list>& idx); - octave_value subsasgn (const std::string type, + octave_value subsasgn (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs);
--- a/src/ov-base.cc +++ b/src/ov-base.cc @@ -53,7 +53,7 @@ DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_base_value, "<unknown type>"); octave_value -octave_base_value::subsref (const std::string, +octave_base_value::subsref (const std::string&, const std::list<octave_value_list>&) { std::string nm = type_name (); @@ -62,7 +62,7 @@ } octave_value_list -octave_base_value::subsref (const std::string, +octave_base_value::subsref (const std::string&, const std::list<octave_value_list>&, int) { std::string nm = type_name (); @@ -95,7 +95,7 @@ } octave_value -octave_base_value::subsasgn (const std::string type, +octave_base_value::subsasgn (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs) {
--- a/src/ov-base.h +++ b/src/ov-base.h @@ -71,10 +71,10 @@ octave_value *try_narrowing_conversion (void) { return static_cast<octave_value *> (0); } - octave_value subsref (const std::string type, + octave_value subsref (const std::string& type, const std::list<octave_value_list>& idx); - octave_value_list subsref (const std::string type, + octave_value_list subsref (const std::string& type, const std::list<octave_value_list>& idx, int nargout); @@ -88,7 +88,7 @@ idx_vector index_vector (void) const; - octave_value subsasgn (const std::string type, + octave_value subsasgn (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs);
--- a/src/ov-builtin.cc +++ b/src/ov-builtin.cc @@ -52,7 +52,7 @@ } octave_value_list -octave_builtin::subsref (const std::string type, +octave_builtin::subsref (const std::string& type, const std::list<octave_value_list>& idx, int nargout) {
--- a/src/ov-builtin.h +++ b/src/ov-builtin.h @@ -50,7 +50,7 @@ ~octave_builtin (void) { } - octave_value_list subsref (const std::string type, + octave_value_list subsref (const std::string& type, const std::list<octave_value_list>& idx, int nargout);
--- a/src/ov-cell.cc +++ b/src/ov-cell.cc @@ -52,7 +52,7 @@ DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_cell, "cell"); octave_value -octave_cell::subsref (const std::string type, +octave_cell::subsref (const std::string& type, const std::list<octave_value_list>& idx) { octave_value retval; @@ -103,7 +103,7 @@ } octave_value -octave_cell::subsasgn (const std::string type, +octave_cell::subsasgn (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs) {
--- a/src/ov-cell.h +++ b/src/ov-cell.h @@ -73,10 +73,10 @@ octave_value *try_narrowing_conversion (void); #endif - octave_value subsref (const std::string type, + octave_value subsref (const std::string& type, const std::list<octave_value_list>& idx); - octave_value subsasgn (const std::string type, + octave_value subsasgn (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs);
--- a/src/ov-cs-list.cc +++ b/src/ov-cs-list.cc @@ -45,7 +45,7 @@ #if 0 octave_value -octave_list::subsref (const std::string type, +octave_list::subsref (const std::string& type, const std::list<octave_value_list>& idx) { octave_value retval; @@ -117,7 +117,7 @@ } octave_value -octave_list::subsasgn (const std::string type, +octave_list::subsasgn (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs) {
--- a/src/ov-cs-list.h +++ b/src/ov-cs-list.h @@ -65,12 +65,12 @@ octave_value *empty_clone (void) const { return new octave_cs_list (); } #if 0 - octave_value subsref (const std::string type, + octave_value subsref (const std::string& type, const std::list<octave_value_list>& idx); octave_value do_index_op (const octave_value_list& idx, int resize_ok); - octave_value subsasgn (const std::string type, + octave_value subsasgn (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs);
--- a/src/ov-list.cc +++ b/src/ov-list.cc @@ -43,7 +43,7 @@ DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_list, "list"); octave_value -octave_list::subsref (const std::string type, +octave_list::subsref (const std::string& type, const std::list<octave_value_list>& idx) { octave_value retval; @@ -115,7 +115,7 @@ } octave_value -octave_list::subsasgn (const std::string type, +octave_list::subsasgn (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs) {
--- a/src/ov-list.h +++ b/src/ov-list.h @@ -64,12 +64,12 @@ octave_value *clone (void) const { return new octave_list (*this); } octave_value *empty_clone (void) const { return new octave_list (); } - octave_value subsref (const std::string type, + octave_value subsref (const std::string& type, const std::list<octave_value_list>& idx); octave_value do_index_op (const octave_value_list& idx, int resize_ok); - octave_value subsasgn (const std::string type, + octave_value subsasgn (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs);
--- a/src/ov-mapper.cc +++ b/src/ov-mapper.cc @@ -244,7 +244,7 @@ } octave_value_list -octave_mapper::subsref (const std::string type, +octave_mapper::subsref (const std::string& type, const std::list<octave_value_list>& idx, int nargout) {
--- a/src/ov-mapper.h +++ b/src/ov-mapper.h @@ -66,7 +66,7 @@ octave_function *function_value (bool) { return this; } - octave_value_list subsref (const std::string type, + octave_value_list subsref (const std::string& type, const std::list<octave_value_list>& idx, int nargout);
--- a/src/ov-range.cc +++ b/src/ov-range.cc @@ -82,7 +82,7 @@ } octave_value -octave_range::subsref (const std::string type, +octave_range::subsref (const std::string& type, const std::list<octave_value_list>& idx) { octave_value retval;
--- a/src/ov-range.h +++ b/src/ov-range.h @@ -85,7 +85,7 @@ octave_value *try_narrowing_conversion (void); - octave_value subsref (const std::string type, + octave_value subsref (const std::string& type, const std::list<octave_value_list>& idx); octave_value do_index_op (const octave_value_list& idx, int resize_ok);
--- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -86,7 +86,7 @@ } octave_value -octave_struct::subsref (const std::string type, +octave_struct::subsref (const std::string& type, const std::list<octave_value_list>& idx) { octave_value retval; @@ -181,7 +181,7 @@ } octave_value -octave_struct::subsasgn (const std::string type, +octave_struct::subsasgn (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs) {
--- a/src/ov-struct.h +++ b/src/ov-struct.h @@ -69,13 +69,13 @@ octave_value_list dotref (const octave_value_list& idx); - octave_value subsref (const std::string type, + octave_value subsref (const std::string& type, const std::list<octave_value_list>& idx); static octave_value numeric_conv (const octave_value_list& val, const std::string& type); - octave_value subsasgn (const std::string type, + octave_value subsasgn (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs);
--- a/src/ov-usr-fcn.cc +++ b/src/ov-usr-fcn.cc @@ -305,7 +305,7 @@ } octave_value_list -octave_user_function::subsref (const std::string type, +octave_user_function::subsref (const std::string& type, const std::list<octave_value_list>& idx, int nargout) {
--- a/src/ov-usr-fcn.h +++ b/src/ov-usr-fcn.h @@ -143,7 +143,7 @@ } } - octave_value_list subsref (const std::string type, + octave_value_list subsref (const std::string& type, const std::list<octave_value_list>& idx, int nargout);
--- a/src/ov.cc +++ b/src/ov.cc @@ -572,8 +572,18 @@ } } +octave_value +octave_value::subsref (const std::string& type, const octave_value_list& idx) +{ + std::list<octave_value_list> i; + + i.push_back (idx); + + return rep->subsref (type, i); +} + octave_value_list -octave_value::subsref (const std::string type, +octave_value::subsref (const std::string& type, const std::list<octave_value_list>& idx, int nargout) { if (is_constant ()) @@ -583,7 +593,7 @@ } octave_value -octave_value::next_subsref (const std::string type, +octave_value::next_subsref (const std::string& type, const std::list<octave_value_list>& idx, size_t skip) { @@ -632,7 +642,7 @@ } octave_value -octave_value::subsasgn (const std::string type, +octave_value::subsasgn (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs) { @@ -640,7 +650,7 @@ } octave_value -octave_value::assign (assign_op op, const std::string type, +octave_value::assign (assign_op op, const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs) { @@ -1083,7 +1093,7 @@ } octave_value -octave_value::numeric_assign (const std::string type, +octave_value::numeric_assign (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs) { @@ -1436,7 +1446,7 @@ } octave_value -octave_value::do_non_const_unary_op (unary_op op, const std::string type, +octave_value::do_non_const_unary_op (unary_op op, const std::string& type, const std::list<octave_value_list>& idx) { octave_value retval;
--- a/src/ov.h +++ b/src/ov.h @@ -243,24 +243,17 @@ virtual octave_value *try_narrowing_conversion (void) { return rep->try_narrowing_conversion (); } - virtual octave_value subsref (const std::string type, + virtual octave_value subsref (const std::string& type, const std::list<octave_value_list>& idx) { return rep->subsref (type, idx); } - octave_value subsref (const std::string type, const octave_value_list& idx) - { - std::list<octave_value_list> i; + octave_value subsref (const std::string& type, const octave_value_list& idx); - i.push_back (idx); - - return rep->subsref (type, i); - } - - virtual octave_value_list subsref (const std::string type, + virtual octave_value_list subsref (const std::string& type, const std::list<octave_value_list>& idx, int nargout); - octave_value next_subsref (const std::string type, const + octave_value next_subsref (const std::string& type, const std::list<octave_value_list>& idx, size_t skip = 1); @@ -274,11 +267,11 @@ virtual octave_value_list do_multi_index_op (int nargout, const octave_value_list& idx); - virtual octave_value subsasgn (const std::string type, + virtual octave_value subsasgn (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs); - octave_value assign (assign_op op, const std::string type, + octave_value assign (assign_op op, const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs); @@ -528,7 +521,7 @@ void do_non_const_unary_op (unary_op op, const octave_value_list& idx); - octave_value do_non_const_unary_op (unary_op op, const std::string type, + octave_value do_non_const_unary_op (unary_op op, const std::string& type, const std::list<octave_value_list>& idx); friend octave_value do_binary_op (binary_op op, @@ -546,7 +539,7 @@ // This should only be called for derived types. - octave_value numeric_assign (const std::string type, + octave_value numeric_assign (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs);