Mercurial > hg > octave-lyh
diff src/graphics.cc @ 7824:adb520646d7e
Fix execution of callback strings and allow execution of callback by name.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Fri, 08 Feb 2008 16:46:34 +0100 |
parents | edbaa13397ee |
children | 3584f37eac69 |
line wrap: on
line diff
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -200,7 +200,10 @@ octave_function *fcn = 0; args(0) = h.as_octave_value (); - args(1) = data; + if (data.is_defined ()) + args(1) = data; + else + args(1) = Matrix (); unwind_protect::begin_frame ("execute_callback"); unwind_protect::add (xreset_gcbo); @@ -213,14 +216,10 @@ fcn = cb.function_value (); else if (cb.is_string ()) { + int status; std::string s = cb.string_value (); - octave_value f = symbol_table::find_function (s); - int status; - - if (f.is_defined ()) - fcn = f.function_value (); - else - eval_string (s, false, status); + + eval_string (s, false, status); } else if (cb.is_cell () && cb.length () > 0 && (cb.rows () == 1 || cb.columns () == 1) @@ -562,6 +561,14 @@ execute_callback (callback, get_parent (), data); } +void +callback_property::execute (const octave_value& cb, const graphics_handle& h, + const octave_value& data) +{ + if (cb.is_defined () && ! cb.is_empty ()) + execute_callback (cb, h, data); +} + // --------------------------------------------------------------------- void