Mercurial > octave-nkf
comparison libinterp/corefcn/jit-typeinfo.cc @ 20569:b70cc4bd8109
begin removal of global error_state variable
* gripes.h, gripes.cc (gripe_library_execution_error): Delete.
* error.cc (warning_state): Delete unused variable.
(reset_error_handler): Don't set warning_state or error_state.
(debug_or_throw_exception): New static function.
(verror): Don't check error_state.
(vmessage): Call debug_or_throw_exception instead of setting
error_state.
(error_1, error_2): Combine into single function, error_1 that prints
error message and ultimately calls debug_or_throw_exception.
(verror, verror_with_cfn, verror_with_id_cfn): Call error_1. Don't
check or set warning_state.
(error): Don't check error_state.
(Flasterror, Flasterr): Adapt to not using error_state.
(interpreter_try): Don't unwind_protect error_state.
* NEWS: Update.
* doc/interpreter/external.txi: Explain octave_execution_exception
instead of error_state for matrix addition example.
* jit-typeinfo.cc (octave_jit_gripe_nan_to_logical_conversion,
octave_jit_ginvalid_index, octave_jit_gindex_range,
octave_jit_paren_scalar, octave_jit_paren_scalar_subsasgn):
Don't catch octave_execution_exception.
* cellfun.cc (Fcellfun): Use exceptions instead of error_state.
* ls-mat-ascii.cc (save_mat_ascii_data): Likewise.
* mex.cc (mexCallMATLAB, mexEvalString): Likewise.
* variables.cc (safe_symbol_lookup): Likewise.
* svd.cc (Fsvd): Eliminate use of error_state.
* __magick_read__.cc (read_file, write_file): Likewise.
* variables.cc (generate_struct_completions): Eliminate use of
obsolete warning_state variable.
* ov-builtin.cc (octave_builtin::do_multi_index_op): Don't catch
octave_execution_exception and call gripe_library_execution_error.
* ov-class.cc (octave_class::reconstruct_exemplar): Eliminate use of
error_state. Catch possible octave_execution_exception in
do_multi_index_op.
* ov-mex-fcn.cc (octave_mex_function::do_multi_index_op): Eliminate
use of error_state. Catch possible octave_execution_exception in
call_mex.
* ov-fcn-handle.cc (octave_fcn_binder::maybe_binder): Eliminate use of
error_state.
* ov-oncleanup.cc (octave_oncleanup::~octave_oncleanup): Eliminate use
of error_state. Propagate possible octave_execution_exception from
do_multi_index_op.
* ov.cc (octave_value::assign, do_binary_op, do_unary_op,
octave_value::do_non_const_unary_op): Don't catch
octave_execution_exception here.
* oct-parse.in.yy (octave_base_parser::finish_colon_expression,
octave_base_parser::finish_array_list): Eliminate use of warning_state
and error_state.
(Feval, Fevalin): Use exceptions instead of error_state.
* pt-eval.cc, pt-eval.h (tree_evaluator::unwind_protect_exception):
New static variable.
* (tree_evaluator::visit_statement): Don't catch
octave_execution_exception here.
(tree_evaluator::visit_try_catch_command,
tree_evaluator::do_unwind_protect_cleanup): Eliminate use of error_state.
(tree_evaluator::visit_unwind_protect_command): Use
unwind_protect_exception to track whether an exception has occurred in
the try block.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 01 Oct 2015 16:18:19 -0400 |
parents | 00cf2847355d |
children | d35201e5ce5d |
comparison
equal
deleted
inserted
replaced
20568:fcb792acab9b | 20569:b70cc4bd8109 |
---|---|
213 } | 213 } |
214 | 214 |
215 extern "C" void | 215 extern "C" void |
216 octave_jit_gripe_nan_to_logical_conversion (void) | 216 octave_jit_gripe_nan_to_logical_conversion (void) |
217 { | 217 { |
218 try | 218 gripe_nan_to_logical_conversion (); |
219 { | |
220 gripe_nan_to_logical_conversion (); | |
221 } | |
222 catch (const octave_execution_exception&) | |
223 { | |
224 gripe_library_execution_error (); | |
225 } | |
226 } | 219 } |
227 | 220 |
228 extern "C" void | 221 extern "C" void |
229 octave_jit_ginvalid_index (void) | 222 octave_jit_ginvalid_index (void) |
230 { | 223 { |
231 try | 224 gripe_invalid_index (); |
232 { | |
233 gripe_invalid_index (); | |
234 } | |
235 catch (const octave_execution_exception&) | |
236 { | |
237 gripe_library_execution_error (); | |
238 } | |
239 } | 225 } |
240 | 226 |
241 extern "C" void | 227 extern "C" void |
242 octave_jit_gindex_range (int nd, int dim, octave_idx_type iext, | 228 octave_jit_gindex_range (int nd, int dim, octave_idx_type iext, |
243 octave_idx_type ext) | 229 octave_idx_type ext) |
244 { | 230 { |
245 try | 231 gripe_index_out_of_range (nd, dim, iext, ext); |
246 { | |
247 gripe_index_out_of_range (nd, dim, iext, ext); | |
248 } | |
249 catch (const octave_execution_exception&) | |
250 { | |
251 gripe_library_execution_error (); | |
252 } | |
253 } | 232 } |
254 | 233 |
255 extern "C" jit_matrix | 234 extern "C" jit_matrix |
256 octave_jit_paren_subsasgn_impl (jit_matrix *mat, octave_idx_type index, | 235 octave_jit_paren_subsasgn_impl (jit_matrix *mat, octave_idx_type index, |
257 double value) | 236 double value) |
279 extern "C" double | 258 extern "C" double |
280 octave_jit_paren_scalar (jit_matrix *mat, double *indicies, | 259 octave_jit_paren_scalar (jit_matrix *mat, double *indicies, |
281 octave_idx_type idx_count) | 260 octave_idx_type idx_count) |
282 { | 261 { |
283 // FIXME: Replace this with a more optimal version | 262 // FIXME: Replace this with a more optimal version |
284 try | 263 Array<idx_vector> idx; |
285 { | 264 make_indices (indicies, idx_count, idx); |
286 Array<idx_vector> idx; | 265 |
287 make_indices (indicies, idx_count, idx); | 266 Array<double> ret = mat->array->index (idx); |
288 | 267 |
289 Array<double> ret = mat->array->index (idx); | 268 return ret.xelem (0); |
290 return ret.xelem (0); | |
291 } | |
292 catch (const octave_execution_exception&) | |
293 { | |
294 gripe_library_execution_error (); | |
295 return 0; | |
296 } | |
297 } | 269 } |
298 | 270 |
299 extern "C" jit_matrix | 271 extern "C" jit_matrix |
300 octave_jit_paren_scalar_subsasgn (jit_matrix *mat, double *indices, | 272 octave_jit_paren_scalar_subsasgn (jit_matrix *mat, double *indices, |
301 octave_idx_type idx_count, double value) | 273 octave_idx_type idx_count, double value) |
302 { | 274 { |
303 // FIXME: Replace this with a more optimal version | 275 // FIXME: Replace this with a more optimal version |
304 jit_matrix ret; | 276 jit_matrix ret; |
305 try | 277 |
306 { | 278 Array<idx_vector> idx; |
307 Array<idx_vector> idx; | 279 make_indices (indices, idx_count, idx); |
308 make_indices (indices, idx_count, idx); | 280 |
309 | 281 Matrix temp (1, 1); |
310 Matrix temp (1, 1); | 282 temp.xelem(0) = value; |
311 temp.xelem(0) = value; | 283 mat->array->assign (idx, temp); |
312 mat->array->assign (idx, temp); | 284 ret.update (mat->array); |
313 ret.update (mat->array); | |
314 } | |
315 catch (const octave_execution_exception&) | |
316 { | |
317 gripe_library_execution_error (); | |
318 } | |
319 | 285 |
320 return ret; | 286 return ret; |
321 } | 287 } |
322 | 288 |
323 extern "C" jit_matrix | 289 extern "C" jit_matrix |