octave-bug-tracker
[Top][All Lists]
Advanced

[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:25:51 +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 #9, bug #29447 (project octave):

I've figured out how to get an inline function created and substituted (in
case anyone other than me was interested in how to do that). I'm actually not
a fan of this approach after seeing the results:


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 21:31:25 2010 -0400
@@ -1523,7 +1523,20 @@
             }
         }
       else
-        error ("@%s: no function and no method found", tnm.c_str ());
+        {
+          // Failed to resolve the handle
+          // Substitute an inline function that calls error()
+
+          warning ("@%s: no function and no method found", tnm.c_str ());
+
+          std::ostringstream buf;
+          buf << "@()error('@" << tnm << ": no function and no method
found')" ;
+
+          int parse_status ;
+          octave_value anon_fcn_handle = eval_string (buf.str (), true,
parse_status);
+
+          retval = anon_fcn_handle;
+        }
     }
 
   return retval;


This is how it behaves:


octave:1> func = @crash
warning: @crash: no function and no method found
func =

@() error ('@crash: no function and no method found')

octave:2> func()
error: @crash: no function and no method found
error: called from:
error:    at line -1, column -1
octave:2> feval(func)
error: @crash: no function and no method found
error: called from:
error:    at line -1, column -1
octave:2>  


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?29447>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]