2.1.39 : No more argn ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

2.1.39 : No more argn ?

Etienne Grossmann-4

  Hello, did the  argn  variable disappear between 2.1.36 and 2.1.39?

  Etienne

--
Etienne Grossmann ------ http://www.isr.ist.utl.pt/~etienne


Reply | Threaded
Open this post in threaded view
|

Re: 2.1.39 : No more argn ?

Paul Kienzle-2
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

- Paul

On Sat, Nov 02, 2002 at 10:50:04AM +0000, Etienne Grossmann wrote:

>
>   Hello, did the  argn  variable disappear between 2.1.36 and 2.1.39?
>
>   Etienne
>
> --
> Etienne Grossmann ------ http://www.isr.ist.utl.pt/~etienne
>
>
>
> -------------------------------------------------------------
> 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
> -------------------------------------------------------------
>


Reply | Threaded
Open this post in threaded view
|

Re: 2.1.39 : No more argn ?

John W. Eaton-6
On  3-Nov-2002, Paul Kienzle <[hidden email]> 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  <[hidden email]>

        * 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
@@ -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); }
@@ -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;
     }