[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing
From: |
Judd Storrs |
Subject: |
[Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions |
Date: |
Wed, 07 Apr 2010 03:34:39 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100214 Ubuntu/9.10 (karmic) Firefox/3.5.8 |
Follow-up Comment #10, bug #29447 (project octave):
Here's a different patch that addresses the criticisms of the first one.
Instead of returning a string it returns an invalid handle.
I think the behavior is clearer:
octave:1> func = @crash
warning: @crash: no function and no method found
func = @crash
octave:2> func()
error: crash: no longer valid function handle
octave:2> feval(func)
error: crash: not a valid function handle
octave:2>
Changes:
diff -r 6cf7d7665d57 src/ov-fcn-handle.cc
--- a/src/ov-fcn-handle.cc Fri Apr 02 13:08:11 2010 -0400
+++ b/src/ov-fcn-handle.cc Tue Apr 06 23:24:21 2010 -0400
@@ -1523,7 +1523,11 @@
}
}
else
- error ("@%s: no function and no method found", tnm.c_str ());
+ {
+ warning ("@%s: no function and no method found", tnm.c_str ());
+ octave_fcn_handle *fh = new octave_fcn_handle (f, tnm);
+ retval = fh;
+ }
}
return retval;
diff -r 6cf7d7665d57 src/ov-fcn-handle.h
--- a/src/ov-fcn-handle.h Fri Apr 02 13:08:11 2010 -0400
+++ b/src/ov-fcn-handle.h Tue Apr 06 23:24:21 2010 -0400
@@ -96,7 +96,14 @@
dim_vector dims (void) const { static dim_vector dv (1, 1); return dv; }
octave_function *function_value (bool = false)
- { return fcn.function_value (); }
+ {
+ octave_function *retval = 0;
+ if (fcn.is_defined ())
+ retval = fcn.function_value ();
+ else
+ error ("%s: not a valid function handle", nm.c_str ());
+ return retval ;
+ }
octave_user_function *user_function_value (bool = false)
{ return fcn.user_function_value (); }
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?29447>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, Jaroslav Hajek, 2010/04/06
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, Jaroslav Hajek, 2010/04/06
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, Judd Storrs, 2010/04/06
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, Judd Storrs, 2010/04/06
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, John W. Eaton, 2010/04/06
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, Søren Hauberg, 2010/04/06
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, Judd Storrs, 2010/04/06
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, John W. Eaton, 2010/04/06
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, Judd Storrs, 2010/04/06
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, Judd Storrs, 2010/04/06
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions,
Judd Storrs <=
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, Jaroslav Hajek, 2010/04/07
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, Judd Storrs, 2010/04/07
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, Jaroslav Hajek, 2010/04/07
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, Judd Storrs, 2010/04/07
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, Jaroslav Hajek, 2010/04/07
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, Jaroslav Hajek, 2010/04/07
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, Judd Storrs, 2010/04/07
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, Judd Storrs, 2010/04/07
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, John W. Eaton, 2010/04/07
- [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions, Jaroslav Hajek, 2010/04/07