From bug-octave-request at bevo dot che dot wisc dot edu Mon Nov 4 14:44:19 2002 Subject: Re: 2.1.39 : No more argn ? From: "John W. Eaton" To: Paul Kienzle Cc: etienne at isr dot ist dot utl dot pt, octave-maintainers@bevo.che.wisc.edu, bug-octave@bevo.che.wisc.edu Date: Mon, 4 Nov 2002 14:40:28 -0600 On 3-Nov-2002, Paul Kienzle wrote: | I can confirm that argn doesn't work for me in 2.1.38 or 2.1.36, but the code | for processing it is still in ov-usr-fcn.cc. The last working version is 2.1.35. | | octave:1> function f, nargin, end | octave:2> f(1) | nargin = 1 | octave:3> x=1; | octave:4> f(x) | nargin = 1 | octave:5> function f, argn, end | octave:6> f(x) | error: `argn' undefined near line 1 column 13 | error: called from `f' | | Presumably removing the initializer for arg_nm in the tree_index_expression constructor | is the source of the problem. See the following diff: | | http://www.octave.org/cgi-bin/cvsweb.cgi/octave/src/pt-idx.cc.diff?r1=1.11&r2=1.12&f=h No, because arg_nm was still handled in the append() function (or at least it is in the current sources). I think the following patch should solve the problem. Thanks, jwe 2002-11-04 John W. Eaton * oct-obj.h (octave_value_list::operator =): Copy names too. (octave_value_list::octave_value_list (const octave_value_list&)): Likewise. Index: oct-obj.h =================================================================== RCS file: /usr/local/cvsroot/octave/src/oct-obj.h,v retrieving revision 1.34 diff -u -r1.34 oct-obj.h --- oct-obj.h 26 Sep 2002 22:10:08 -0000 1.34 +++ oct-obj.h 4 Nov 2002 20:38:51 -0000 at @ -95,7 +95,7 @@ : data (1, octave_value (r)) { } octave_value_list (const octave_value_list& obj) - : data (obj.data) { } + : data (obj.data), names (obj.names) { } void *operator new (size_t size) { return allocator.alloc (size); } at @ -106,7 +106,10 @@ octave_value_list& operator = (const octave_value_list& obj) { if (this != &obj) - data = obj.data; + { + data = obj.data; + names = obj.names; + } return *this; } ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------