Mercurial > hg > octave-nkf
changeset 4929:585e9a8c2ef8
[project @ 2004-08-03 20:45:34 by jwe]
author | jwe |
---|---|
date | Tue, 03 Aug 2004 20:45:34 +0000 |
parents | 1cf16fb3459a |
children | bdb307dc8613 |
files | liboctave/Array.cc liboctave/ChangeLog src/ChangeLog src/ov-usr-fcn.cc |
diffstat | 4 files changed, 48 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -71,50 +71,45 @@ { Array<T> retval = *this; - bool dims_changed = false; - - dim_vector new_dimensions = dimensions; - - int k = 0; - - for (int i = 0; i < ndims (); i++) + if (ndims () > 2) { - if (dimensions(i) == 1) - dims_changed = true; - else - new_dimensions(k++) = dimensions(i); - } - - if (dims_changed) - { - switch (k) + bool dims_changed = false; + + dim_vector new_dimensions = dimensions; + + int k = 0; + + for (int i = 0; i < ndims (); i++) { - case 0: - new_dimensions = dim_vector (1, 1); - break; - - case 1: - { - int tmp = new_dimensions(0); - - new_dimensions.resize (2); - - if (dimensions(0) == 1) + if (dimensions(i) == 1) + dims_changed = true; + else + new_dimensions(k++) = dimensions(i); + } + + if (dims_changed) + { + switch (k) + { + case 0: + new_dimensions = dim_vector (1, 1); + break; + + case 1: { - new_dimensions(0) = 1; - new_dimensions(1) = tmp; - } - else - { + int tmp = new_dimensions(0); + + new_dimensions.resize (2); + new_dimensions(0) = tmp; new_dimensions(1) = 1; } - } - break; - - default: - new_dimensions.resize (k); - break; + break; + + default: + new_dimensions.resize (k); + break; + } } retval.make_unique ();
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,9 @@ +2004-08-03 John W. Eaton <jwe@octave.org> + + * Array.cc (Array<T>::squeeze): Do nothing for 2-d arrays. For + arrays with more than two dimensions and only one non-singleton + dimension, return a column vector. + 2004-07-28 John W. Eaton <jwe@octave.org> * oct-cmplx.h (pow (const Complex&, const double&):
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2004-08-03 John W. Eaton <jwe@octave.org> + * ov-usr-fcn.cc (octave_user_fcn::do_multi_index_op): Call + install_automatic_vars here. + (octave_user_fcn::octave_user_fcn): Not here. + (install_automatic_vars): Don't mark argn_sr, nargin_sr, + nargout_sr, or varargin_sr as static. + * oct-stream.cc (octave_scan): Avoid need for pushing two characters back on the input stream.
--- a/src/ov-usr-fcn.cc +++ b/src/ov-usr-fcn.cc @@ -79,8 +79,6 @@ curr_va_arg_number (0), vr_list (0), symtab_entry (0), argn_sr (0), nargin_sr (0), nargout_sr (0), varargin_sr (0) { - install_automatic_vars (); - if (param_list) { num_named_args = param_list->length (); @@ -379,6 +377,8 @@ if (vr_list) vr_list->clear (); + install_automatic_vars (); + // Force symbols to be undefined again when this function exits. unwind_protect::add (clear_symbol_table, sym_tab); @@ -556,15 +556,8 @@ nargin_sr = sym_tab->lookup ("__nargin__", true); nargout_sr = sym_tab->lookup ("__nargout__", true); - argn_sr->mark_as_static (); - nargin_sr->mark_as_static (); - nargout_sr->mark_as_static (); - if (takes_varargs ()) - { - varargin_sr = sym_tab->lookup ("varargin", true); - varargin_sr->mark_as_static (); - } + varargin_sr = sym_tab->lookup ("varargin", true); } }