Mercurial > hg > octave-max
changeset 7487:1e01db14700b
catch octave_execution_exception for built-in and mex functions
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 15 Feb 2008 19:49:14 -0500 |
parents | 6a6d2abe51ff |
children | 6470f946a425 |
files | src/ChangeLog src/ov-builtin.cc src/ov-mex-fcn.cc src/ov.cc |
diffstat | 4 files changed, 132 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2008-02-15 John W. Eaton <jwe@octave.org> + + * ov-builtin.cc (octave_builtin::do_multi_index_op): + Catch possible octave_execution_exception. + * ov-mex-fcn.cc (octave_mex_function::do_multi_index_op): Likewise. + * ov.cc (do_binary_op, do_cat_op, do_unary_op, + octave_value::do_non_const_unary_op): Likewise. + 2008-02-14 John W. Eaton <jwe@octave.org> * DLD-FUNCTIONS/balance.cc, DLD-FUNCTIONS/qz.cc:
--- a/src/ov-builtin.cc +++ b/src/ov-builtin.cc @@ -101,7 +101,15 @@ unwind_protect::add (octave_call_stack::unwind_pop, 0); - retval = (*f) (args, nargout); + try + { + retval = (*f) (args, nargout); + } + catch (octave_execution_exception) + { + octave_exception_state = octave_no_exception; + error ("caught execution error in library function"); + } unwind_protect::run_frame ("builtin_func_eval"); }
--- a/src/ov-mex-fcn.cc +++ b/src/ov-mex-fcn.cc @@ -143,7 +143,15 @@ unwind_protect::add (octave_call_stack::unwind_pop, 0); - retval = call_mex (have_fmex, mex_fcn_ptr, args, nargout, this); + try + { + retval = call_mex (have_fmex, mex_fcn_ptr, args, nargout, this); + } + catch (octave_execution_exception) + { + octave_exception_state = octave_no_exception; + error ("caught execution error in library function"); + } unwind_protect::run_frame ("mex_func_eval"); }
--- a/src/ov.cc +++ b/src/ov.cc @@ -1526,7 +1526,17 @@ = octave_value_typeinfo::lookup_binary_class_op (op); if (f) - retval = f (v1, v2); + { + try + { + retval = f (v1, v2); + } + catch (octave_execution_exception) + { + octave_exception_state = octave_no_exception; + error ("caught execution error in library function"); + } + } else gripe_binary_op (octave_value::binary_op_as_string (op), v1.class_name (), v2.class_name ()); @@ -1540,7 +1550,17 @@ = octave_value_typeinfo::lookup_binary_op (op, t1, t2); if (f) - retval = f (*v1.rep, *v2.rep); + { + try + { + retval = f (*v1.rep, *v2.rep); + } + catch (octave_execution_exception) + { + octave_exception_state = octave_no_exception; + error ("caught execution error in library function"); + } + } else { octave_value tv1; @@ -1590,7 +1610,17 @@ f = octave_value_typeinfo::lookup_binary_op (op, t1, t2); if (f) - retval = f (*tv1.rep, *tv2.rep); + { + try + { + retval = f (*tv1.rep, *tv2.rep); + } + catch (octave_execution_exception) + { + octave_exception_state = octave_no_exception; + error ("caught execution error in library function"); + } + } else gripe_binary_op (octave_value::binary_op_as_string (op), v1.type_name (), v2.type_name ()); @@ -1637,7 +1667,17 @@ = octave_value_typeinfo::lookup_cat_op (t1, t2); if (f) - retval = f (*v1.rep, *v2.rep, ra_idx); + { + try + { + retval = f (*v1.rep, *v2.rep, ra_idx); + } + catch (octave_execution_exception) + { + octave_exception_state = octave_no_exception; + error ("caught execution error in library function"); + } + } else { octave_value tv1; @@ -1687,7 +1727,17 @@ f = octave_value_typeinfo::lookup_cat_op (t1, t2); if (f) - retval = f (*tv1.rep, *tv2.rep, ra_idx); + { + try + { + retval = f (*tv1.rep, *tv2.rep, ra_idx); + } + catch (octave_execution_exception) + { + octave_exception_state = octave_no_exception; + error ("caught execution error in library function"); + } + } else gripe_cat_op (v1.type_name (), v2.type_name ()); } @@ -1734,7 +1784,17 @@ = octave_value_typeinfo::lookup_unary_class_op (op); if (f) - retval = f (v); + { + try + { + retval = f (v); + } + catch (octave_execution_exception) + { + octave_exception_state = octave_no_exception; + error ("caught execution error in library function"); + } + } else gripe_unary_op (octave_value::unary_op_as_string (op), v.class_name ()); @@ -1748,7 +1808,17 @@ = octave_value_typeinfo::lookup_unary_op (op, t); if (f) - retval = f (*v.rep); + { + try + { + retval = f (*v.rep); + } + catch (octave_execution_exception) + { + octave_exception_state = octave_no_exception; + error ("caught execution error in library function"); + } + } else { octave_value tv; @@ -1767,7 +1837,17 @@ f = octave_value_typeinfo::lookup_unary_op (op, t); if (f) - retval = f (*tv.rep); + { + try + { + retval = f (*tv.rep); + } + catch (octave_execution_exception) + { + octave_exception_state = octave_no_exception; + error ("caught execution error in library function"); + } + } else gripe_unary_op (octave_value::unary_op_as_string (op), v.type_name ()); @@ -1806,7 +1886,15 @@ { make_unique (); - f (*rep); + try + { + f (*rep); + } + catch (octave_execution_exception) + { + octave_exception_state = octave_no_exception; + error ("caught execution error in library function"); + } } else { @@ -1827,7 +1915,15 @@ if (f) { - f (*rep); + try + { + f (*rep); + } + catch (octave_execution_exception) + { + octave_exception_state = octave_no_exception; + error ("caught execution error in library function"); + } if (old_rep && --old_rep->count == 0) delete old_rep;