Mercurial > hg > octave-terminal
changeset 9377:610bf90fce2a
update unwind_protect usage everywhere
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 23 Jun 2009 08:22:13 +0200 |
parents | d58086453171 |
children | bb0697c70c16 |
files | src/ChangeLog src/DLD-FUNCTIONS/cellfun.cc src/DLD-FUNCTIONS/daspk.cc src/DLD-FUNCTIONS/dasrt.cc src/DLD-FUNCTIONS/dassl.cc src/DLD-FUNCTIONS/eigs.cc src/DLD-FUNCTIONS/lsode.cc src/DLD-FUNCTIONS/quad.cc src/DLD-FUNCTIONS/rand.cc src/debug.cc src/dynamic-ld.cc src/error.cc src/graphics.cc src/help.cc src/input.cc src/load-path.cc src/ls-mat4.cc src/ls-mat5.cc src/mex.cc src/oct-hist.cc src/octave.cc src/ov-builtin.cc src/ov-class.cc src/ov-fcn-handle.cc src/ov-list.cc src/ov-mex-fcn.cc src/ov-struct.cc src/ov-usr-fcn.cc src/pager.cc src/pr-output.cc src/pt-arg-list.cc src/pt-eval.cc src/toplev.cc src/variables.cc |
diffstat | 34 files changed, 236 insertions(+), 198 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,39 @@ +2009-06-23 Jaroslav Hajek <highegg@gmail.com> + + * DLD-FUNCTIONS/cellfun.cc: Modernize unwind_protect usage. + * DLD-FUNCTIONS/daspk.cc: Ditto. + * DLD-FUNCTIONS/dasrt.cc: Ditto. + * DLD-FUNCTIONS/dassl.cc: Ditto. + * DLD-FUNCTIONS/eigs.cc: Ditto. + * DLD-FUNCTIONS/lsode.cc: Ditto. + * DLD-FUNCTIONS/quad.cc: Ditto. + * DLD-FUNCTIONS/rand.cc: Ditto. + * debug.cc: Ditto. + * dynamic-ld.cc: Ditto. + * error.cc: Ditto. + * graphics.cc: Ditto. + * help.cc: Ditto. + * input.cc: Ditto. + * load-path.cc: Ditto. + * ls-mat4.cc: Ditto. + * ls-mat5.cc: Ditto. + * mex.cc: Ditto. + * oct-hist.cc: Ditto. + * octave.cc: Ditto. + * ov-builtin.cc: Ditto. + * ov-class.cc: Ditto. + * ov-fcn-handle.cc: Ditto. + * ov-list.cc: Ditto. + * ov-mex-fcn.cc: Ditto. + * ov-struct.cc: Ditto. + * ov-usr-fcn.cc: Ditto. + * pager.cc: Ditto. + * pr-output.cc: Ditto. + * pt-arg-list.cc: Ditto. + * pt-eval.cc: Ditto. + * toplev.cc: Ditto. + * variables.cc: Ditto. + 2009-06-22 Jaroslav Hajek <highegg@gmail.com> * unwind-prot.h (unwind_protect): Rewrite.
--- a/src/DLD-FUNCTIONS/cellfun.cc +++ b/src/DLD-FUNCTIONS/cellfun.cc @@ -389,8 +389,8 @@ } else { - unwind_protect::begin_frame ("Fcellfun"); - unwind_protect_int (buffer_error_messages); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); + unwind_protect::protect_var (buffer_error_messages); std::string fcn_name; @@ -631,7 +631,7 @@ clear_function (err_name); } - unwind_protect::run_frame ("Fcellfun"); + unwind_protect::run_frame (uwp_frame); } return retval;
--- a/src/DLD-FUNCTIONS/daspk.cc +++ b/src/DLD-FUNCTIONS/daspk.cc @@ -155,7 +155,7 @@ #define DASPK_ABORT() \ do \ { \ - unwind_protect::run_frame ("Fdaspk"); \ + unwind_protect::run_frame (uwp_frame); \ return retval; \ } \ while (0) @@ -280,9 +280,9 @@ warned_fcn_imaginary = false; warned_jac_imaginary = false; - unwind_protect::begin_frame ("Fdaspk"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_int (call_depth); + unwind_protect::protect_var (call_depth); call_depth++; if (call_depth > 1) @@ -480,7 +480,7 @@ else print_usage (); - unwind_protect::run_frame ("Fdaspk"); + unwind_protect::run_frame (uwp_frame); return retval; }
--- a/src/DLD-FUNCTIONS/dasrt.cc +++ b/src/DLD-FUNCTIONS/dasrt.cc @@ -190,7 +190,7 @@ #define DASRT_ABORT \ do \ { \ - unwind_protect::run_frame ("Fdasrt"); \ + unwind_protect::run_frame (uwp_frame); \ return retval; \ } \ while (0) @@ -353,9 +353,9 @@ warned_jac_imaginary = false; warned_cf_imaginary = false; - unwind_protect::begin_frame ("Fdasrt"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_int (call_depth); + unwind_protect::protect_var (call_depth); call_depth++; if (call_depth > 1) @@ -368,7 +368,7 @@ if (nargin < 4 || nargin > 6) { print_usage (); - unwind_protect::run_frame ("Fdasrt"); + unwind_protect::run_frame (uwp_frame); return retval; } @@ -587,7 +587,7 @@ } } - unwind_protect::run_frame ("Fdasrt"); + unwind_protect::run_frame (uwp_frame); return retval; }
--- a/src/DLD-FUNCTIONS/dassl.cc +++ b/src/DLD-FUNCTIONS/dassl.cc @@ -155,7 +155,7 @@ #define DASSL_ABORT() \ do \ { \ - unwind_protect::run_frame ("Fdassl"); \ + unwind_protect::run_frame (uwp_frame); \ return retval; \ } \ while (0) @@ -285,9 +285,9 @@ warned_fcn_imaginary = false; warned_jac_imaginary = false; - unwind_protect::begin_frame ("Fdassl"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_int (call_depth); + unwind_protect::protect_var (call_depth); call_depth++; if (call_depth > 1) @@ -486,7 +486,7 @@ else print_usage (); - unwind_protect::run_frame ("Fdassl"); + unwind_protect::run_frame (uwp_frame); return retval; }
--- a/src/DLD-FUNCTIONS/eigs.cc +++ b/src/DLD-FUNCTIONS/eigs.cc @@ -346,9 +346,9 @@ warned_imaginary = false; - unwind_protect::begin_frame ("Feigs"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_int (call_depth); + unwind_protect::protect_var (call_depth); call_depth++; if (call_depth > 1) @@ -356,7 +356,7 @@ error ("eigs: invalid recursive call"); if (fcn_name.length()) clear_function (fcn_name); - unwind_protect::run_frame ("Feigs"); + unwind_protect::run_frame (uwp_frame); return retval; } @@ -741,7 +741,7 @@ if (! fcn_name.empty ()) clear_function (fcn_name); - unwind_protect::run_frame ("Feigs"); + unwind_protect::run_frame (uwp_frame); #else error ("eigs: not available in this version of Octave"); #endif
--- a/src/DLD-FUNCTIONS/lsode.cc +++ b/src/DLD-FUNCTIONS/lsode.cc @@ -141,7 +141,7 @@ #define LSODE_ABORT() \ do \ { \ - unwind_protect::run_frame ("Flsode"); \ + unwind_protect::run_frame (uwp_frame); \ return retval; \ } \ while (0) @@ -280,9 +280,9 @@ warned_fcn_imaginary = false; warned_jac_imaginary = false; - unwind_protect::begin_frame ("Flsode"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_int (call_depth); + unwind_protect::protect_var (call_depth); call_depth++; if (call_depth > 1) @@ -473,7 +473,7 @@ else print_usage (); - unwind_protect::run_frame ("Flsode"); + unwind_protect::run_frame (uwp_frame); return retval; }
--- a/src/DLD-FUNCTIONS/quad.cc +++ b/src/DLD-FUNCTIONS/quad.cc @@ -153,7 +153,7 @@ { \ if (fcn_name.length()) \ clear_function (fcn_name); \ - unwind_protect::run_frame ("Fquad"); \ + unwind_protect::run_frame (uwp_frame); \ return retval; \ } \ while (0) @@ -221,9 +221,9 @@ warned_imaginary = false; - unwind_protect::begin_frame ("Fquad"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_int (call_depth); + unwind_protect::protect_var (call_depth); call_depth++; if (call_depth > 1) @@ -471,7 +471,7 @@ else print_usage (); - unwind_protect::run_frame ("Fquad"); + unwind_protect::run_frame (uwp_frame); return retval; }
--- a/src/DLD-FUNCTIONS/rand.cc +++ b/src/DLD-FUNCTIONS/rand.cc @@ -490,7 +490,7 @@ int nargin = args.length (); - unwind_protect::begin_frame ("randn"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); // This relies on the fact that elements are popped from the unwind // stack in the reverse of the order they are pushed @@ -498,7 +498,7 @@ // reset_rand_generator()). unwind_protect::add (reset_rand_generator, 0); - unwind_protect_str (current_distribution); + unwind_protect::protect_var (current_distribution); current_distribution = "normal"; @@ -506,7 +506,7 @@ retval = do_rand (args, nargin, "randn"); - unwind_protect::run_frame ("randn"); + unwind_protect::run_frame (uwp_frame); return retval; } @@ -563,7 +563,7 @@ int nargin = args.length (); - unwind_protect::begin_frame ("rande"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); // This relies on the fact that elements are popped from the unwind // stack in the reverse of the order they are pushed @@ -571,7 +571,7 @@ // reset_rand_generator()). unwind_protect::add (reset_rand_generator, 0); - unwind_protect_str (current_distribution); + unwind_protect::protect_var (current_distribution); current_distribution = "exponential"; @@ -579,7 +579,7 @@ retval = do_rand (args, nargin, "rande"); - unwind_protect::run_frame ("rande"); + unwind_protect::run_frame (uwp_frame); return retval; } @@ -695,7 +695,7 @@ error ("randg: insufficient arguments"); else { - unwind_protect::begin_frame ("randg"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); // This relies on the fact that elements are popped from the unwind // stack in the reverse of the order they are pushed @@ -703,7 +703,7 @@ // reset_rand_generator()). unwind_protect::add (reset_rand_generator, 0); - unwind_protect_str (current_distribution); + unwind_protect::protect_var (current_distribution); current_distribution = "gamma"; @@ -711,7 +711,7 @@ retval = do_rand (args, nargin, "randg", true); - unwind_protect::run_frame ("randg"); + unwind_protect::run_frame (uwp_frame); } return retval; @@ -909,7 +909,7 @@ error ("randp: insufficient arguments"); else { - unwind_protect::begin_frame ("randp"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); // This relies on the fact that elements are popped from the unwind // stack in the reverse of the order they are pushed @@ -917,7 +917,7 @@ // reset_rand_generator()). unwind_protect::add (reset_rand_generator, 0); - unwind_protect_str (current_distribution); + unwind_protect::protect_var (current_distribution); current_distribution = "poisson"; @@ -925,7 +925,7 @@ retval = do_rand (args, nargin, "randp", true); - unwind_protect::run_frame ("randp"); + unwind_protect::run_frame (uwp_frame); } return retval;
--- a/src/debug.cc +++ b/src/debug.cc @@ -850,7 +850,7 @@ { octave_value_list retval; - unwind_protect::begin_frame ("Fdbstack"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); octave_idx_type curr_frame = -1; @@ -914,7 +914,7 @@ } } - unwind_protect::run_frame ("Fdbstack"); + unwind_protect::run_frame (uwp_frame); return retval; }
--- a/src/dynamic-ld.cc +++ b/src/dynamic-ld.cc @@ -330,9 +330,9 @@ { octave_function *retval = 0; - unwind_protect::begin_frame ("octave_dynamic_loader::do_load"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_bool (octave_dynamic_loader::doing_load); + unwind_protect::protect_var (octave_dynamic_loader::doing_load); doing_load = true; @@ -385,7 +385,7 @@ file_name.c_str ()); } - unwind_protect::run_frame ("octave_dynamic_loader::do_load"); + unwind_protect::run_frame (uwp_frame); return retval; } @@ -397,9 +397,9 @@ { octave_function *retval = 0; - unwind_protect::begin_frame ("octave_dynamic_loader::do_load"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_bool (octave_dynamic_loader::doing_load); + unwind_protect::protect_var (octave_dynamic_loader::doing_load); doing_load = true; @@ -461,7 +461,7 @@ file_name.c_str ()); } - unwind_protect::run_frame ("octave_dynamic_loader::do_load"); + unwind_protect::run_frame (uwp_frame); return retval; }
--- a/src/error.cc +++ b/src/error.cc @@ -453,7 +453,7 @@ && Vdebug_on_error && init_state == 0 && octave_call_stack::caller_user_code ()) { - unwind_protect_bool (Vdebug_on_error); + unwind_protect::protect_var (Vdebug_on_error); Vdebug_on_error = false; error_state = 0; @@ -614,7 +614,7 @@ && Vdebug_on_warning && octave_call_stack::caller_user_code ()) { - unwind_protect_bool (Vdebug_on_warning); + unwind_protect::protect_var (Vdebug_on_warning); Vdebug_on_warning = false; do_keyboard (octave_value_list ()); @@ -1451,9 +1451,9 @@ octave_value retval; int nargin = args.length(); - unwind_protect::begin_frame ("Flasterror"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_int (error_state); + unwind_protect::protect_var (error_state); error_state = 0; if (nargin < 2) @@ -1558,7 +1558,7 @@ else print_usage (); - unwind_protect::run_frame ("Flasterror"); + unwind_protect::run_frame (uwp_frame); return retval; } @@ -1573,9 +1573,9 @@ { octave_value_list retval; - unwind_protect::begin_frame ("Flasterr"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_int (error_state); + unwind_protect::protect_var (error_state); error_state = 0; int argc = args.length () + 1; @@ -1607,7 +1607,7 @@ else print_usage (); - unwind_protect::run_frame ("Flasterr"); + unwind_protect::run_frame (uwp_frame); return retval; }
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -1787,16 +1787,16 @@ { property p; - unwind_protect::begin_frame("base_properties::has_property"); - - unwind_protect_bool (discard_error_messages); - unwind_protect_int (error_state); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); + + unwind_protect::protect_var (discard_error_messages); + unwind_protect::protect_var (error_state); discard_error_messages = true; p = get_property (name); - unwind_protect::run_frame ("base_properties::has_property"); + unwind_protect::run_frame (uwp_frame); return (p.ok ()); } @@ -3638,7 +3638,7 @@ } - unwind_protect_bool (updating_axis_limits); + unwind_protect::protect_var (updating_axis_limits); updating_axis_limits = true; switch (update_type) @@ -4189,7 +4189,7 @@ else args(1) = Matrix (); - unwind_protect::begin_frame ("execute_callback"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); unwind_protect::add (gh_manager::restore_gcbo); if (true) @@ -4240,7 +4240,7 @@ END_INTERRUPT_WITH_EXCEPTIONS; - unwind_protect::run_frame ("execute_callback"); + unwind_protect::run_frame (uwp_frame); } void @@ -5015,10 +5015,10 @@ gh_manager::lock (); - unwind_protect::begin_frame ("Fdrawnow"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); unwind_protect::add (clear_drawnow_request); - unwind_protect_int (drawnow_executing); + unwind_protect::protect_var (drawnow_executing); if (++drawnow_executing <= 1) { @@ -5153,7 +5153,7 @@ print_usage (); } - unwind_protect::run_frame ("Fdrawnow"); + unwind_protect::run_frame (uwp_frame); gh_manager::unlock ();
--- a/src/help.cc +++ b/src/help.cc @@ -666,7 +666,7 @@ bool retval = false; // FIXME -- this is a bit of a kluge... - unwind_protect_bool (reading_script_file); + unwind_protect::protect_var (reading_script_file); reading_script_file = true; h = get_help_from_file (nm, symbol_found, file);
--- a/src/input.cc +++ b/src/input.cc @@ -652,9 +652,9 @@ std::cerr << msg << std::endl; } - unwind_protect::begin_frame ("get_debug_input"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_str (VPS1); + unwind_protect::protect_var (VPS1); VPS1 = prompt; while (Vdebugging) @@ -664,7 +664,7 @@ reset_parser (); // Save current value of global_command. - unwind_protect_ptr (global_command); + unwind_protect::protect_var (global_command); // Do this with an unwind-protect cleanup function so that the // forced variables will be unmarked in the event of an interrupt. @@ -701,7 +701,7 @@ OCTAVE_QUIT; } - unwind_protect::run_frame ("get_debug_input"); + unwind_protect::run_frame (uwp_frame); } // If the user simply hits return, this will produce an empty matrix. @@ -897,7 +897,7 @@ assert (nargin == 0 || nargin == 1); - unwind_protect::begin_frame ("do_keyboard"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); // FIXME -- we shouldn't need both the // command_history object and the @@ -906,12 +906,12 @@ unwind_protect::add (restore_command_history, 0); - unwind_protect_bool (Vsaving_history); - unwind_protect_bool (Vdebugging); + unwind_protect::protect_var (Vsaving_history); + unwind_protect::protect_var (Vdebugging); saved_frame = octave_call_stack::current_frame (); unwind_protect::add (restore_frame); - unwind_protect_size_t (saved_frame); + unwind_protect::protect_var (saved_frame); Vsaving_history = true; Vdebugging = true; @@ -923,7 +923,7 @@ if (! error_state) get_debug_input (prompt); - unwind_protect::run_frame ("do_keyboard"); + unwind_protect::run_frame (uwp_frame); return retval; } @@ -953,7 +953,7 @@ { saved_frame = octave_call_stack::current_frame (); unwind_protect::add (restore_frame); - unwind_protect_size_t (saved_frame); + unwind_protect::protect_var (saved_frame); // Skip the frame assigned to the keyboard function. octave_call_stack::goto_frame (1);
--- a/src/load-path.cc +++ b/src/load-path.cc @@ -557,7 +557,7 @@ // Temporarily disable add hook. - unwind_protect_fptr (add_hook); + unwind_protect::protect_var (add_hook); add_hook = 0; @@ -1781,9 +1781,9 @@ if (! octave_interpreter_ready) return; - unwind_protect::begin_frame ("execute_pkg_add_or_del"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_bool (input_from_startup_file); + unwind_protect::protect_var (input_from_startup_file); input_from_startup_file = true; @@ -1794,7 +1794,7 @@ if (fs.exists ()) source_file (file, "base"); - unwind_protect::run_frame ("execute_pkg_add_or_del"); + unwind_protect::run_frame (uwp_frame); } void
--- a/src/ls-mat4.cc +++ b/src/ls-mat4.cc @@ -492,7 +492,7 @@ if (tc.is_string ()) { - unwind_protect::begin_frame ("save_mat_binary_data"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); charMatrix chm = tc.char_matrix_value (); @@ -511,7 +511,7 @@ } os.write (reinterpret_cast<char *> (buf), nrow*ncol*sizeof(double)); - unwind_protect::run_frame ("save_mat_binary_data"); + unwind_protect::run_frame (uwp_frame); } else if (tc.is_range ()) {
--- a/src/ls-mat5.cc +++ b/src/ls-mat5.cc @@ -869,7 +869,7 @@ tc2 = m2.contents("MCOS")(0).cell_value()(1 + off).cell_value()(1); m2 = tc2.map_value(); - unwind_protect::begin_frame ("anon_mat5_load"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); // Set up temporary scope to use for evaluating the text // that defines the anonymous function. @@ -919,7 +919,7 @@ goto skip_ahead; } - unwind_protect::run_frame ("anon_mat5_load"); + unwind_protect::run_frame (uwp_frame); } else {
--- a/src/mex.cc +++ b/src/mex.cc @@ -3038,10 +3038,10 @@ for (int i = 0; i < nout; i++) argout[i] = 0; - unwind_protect::begin_frame ("call_mex"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); // Save old mex pointer. - unwind_protect_ptr (mex_context); + unwind_protect::protect_var (mex_context); mex context (curr_mex_fcn); @@ -3090,7 +3090,7 @@ } // Clean up mex resources. - unwind_protect::run_frame ("call_mex"); + unwind_protect::run_frame (uwp_frame); return retval; } @@ -3270,7 +3270,7 @@ { // FIXME -- should this be in variables.cc? - unwind_protect::begin_frame ("mexGetVariable"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); bool caller = ! strcmp (space, "caller"); bool base = ! strcmp (space, "base"); @@ -3290,7 +3290,7 @@ else mexErrMsgTxt ("mexGetVariable: symbol table does not exist"); - unwind_protect::run_frame ("mexGetVariable"); + unwind_protect::run_frame (uwp_frame); } if (val.is_defined ()) @@ -3330,7 +3330,7 @@ { // FIXME -- should this be in variables.cc? - unwind_protect::begin_frame ("mexPutVariable"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); bool caller = ! strcmp (space, "caller"); bool base = ! strcmp (space, "base"); @@ -3350,7 +3350,7 @@ else mexErrMsgTxt ("mexPutVariable: symbol table does not exist"); - unwind_protect::run_frame ("mexPutVariable"); + unwind_protect::run_frame (uwp_frame); } return 0;
--- a/src/oct-hist.cc +++ b/src/oct-hist.cc @@ -480,17 +480,17 @@ // Turn on command echo, so the output from this will make better // sense. - unwind_protect::begin_frame ("do_edit_history"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_int (Vecho_executing_commands); - unwind_protect_bool (input_from_tmp_history_file); + unwind_protect::protect_var (Vecho_executing_commands); + unwind_protect::protect_var (input_from_tmp_history_file); Vecho_executing_commands = ECHO_CMD_LINE; input_from_tmp_history_file = true; source_file (name); - unwind_protect::run_frame ("do_edit_history"); + unwind_protect::run_frame (uwp_frame); // Delete the temporary file. Should probably be done with an // unwind_protect. @@ -509,17 +509,17 @@ // Turn on command echo so the output from this will make better // sense. - unwind_protect::begin_frame ("do_run_history"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_int (Vecho_executing_commands); - unwind_protect_bool (input_from_tmp_history_file); + unwind_protect::protect_var (Vecho_executing_commands); + unwind_protect::protect_var (input_from_tmp_history_file); Vecho_executing_commands = ECHO_CMD_LINE; input_from_tmp_history_file = true; source_file (name); - unwind_protect::run_frame ("do_run_history"); + unwind_protect::run_frame (uwp_frame); // Delete the temporary file.
--- a/src/octave.cc +++ b/src/octave.cc @@ -291,9 +291,9 @@ static void execute_startup_files (void) { - unwind_protect::begin_frame ("execute_startup_files"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_bool (input_from_startup_file); + unwind_protect::protect_var (input_from_startup_file); input_from_startup_file = true; @@ -368,13 +368,13 @@ } } - unwind_protect::run_frame ("execute_startup_files"); + unwind_protect::run_frame (uwp_frame); } static int execute_eval_option_code (const std::string& code) { - unwind_protect::begin_frame ("execute_eval_option_code"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); octave_save_signal_mask (); @@ -388,7 +388,7 @@ octave_initialized = true; - unwind_protect_bool (interactive); + unwind_protect::protect_var (interactive); interactive = false; @@ -400,7 +400,7 @@ } catch (octave_quit_exception e) { - unwind_protect::run_frame ("execute_eval_option_code"); + unwind_protect::run_frame (uwp_frame); clean_up_and_exit (e.status); } catch (octave_interrupt_exception) @@ -414,7 +414,7 @@ << std::endl; } - unwind_protect::run_frame ("execute_eval_option_code"); + unwind_protect::run_frame (uwp_frame); return parse_status; } @@ -422,7 +422,7 @@ static void execute_command_line_file (const std::string& fname) { - unwind_protect::begin_frame ("execute_command_line_file"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); octave_save_signal_mask (); @@ -436,15 +436,15 @@ octave_initialized = true; - unwind_protect_bool (interactive); - unwind_protect_bool (reading_script_file); - unwind_protect_bool (input_from_command_line_file); + unwind_protect::protect_var (interactive); + unwind_protect::protect_var (reading_script_file); + unwind_protect::protect_var (input_from_command_line_file); - unwind_protect_str (curr_fcn_file_name); - unwind_protect_str (curr_fcn_file_full_name); + unwind_protect::protect_var (curr_fcn_file_name); + unwind_protect::protect_var (curr_fcn_file_full_name); - unwind_protect_str (octave_program_invocation_name); - unwind_protect_str (octave_program_name); + unwind_protect::protect_var (octave_program_invocation_name); + unwind_protect::protect_var (octave_program_name); interactive = false; reading_script_file = true; @@ -472,7 +472,7 @@ } catch (octave_quit_exception e) { - unwind_protect::run_frame ("execute_command_line_file"); + unwind_protect::run_frame (uwp_frame); clean_up_and_exit (e.status); } catch (octave_interrupt_exception) @@ -486,7 +486,7 @@ << fname << " failed" << std::endl; } - unwind_protect::run_frame ("execute_command_line_file"); + unwind_protect::run_frame (uwp_frame); } // Usage message with extra help.
--- a/src/ov-builtin.cc +++ b/src/ov-builtin.cc @@ -96,7 +96,7 @@ ::error ("invalid use of colon in function argument list"); else { - unwind_protect::begin_frame ("builtin_func_eval"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); octave_call_stack::push (this); @@ -114,7 +114,7 @@ gripe_library_execution_error (); } - unwind_protect::run_frame ("builtin_func_eval"); + unwind_protect::run_frame (uwp_frame); } return retval;
--- a/src/ov-class.cc +++ b/src/ov-class.cc @@ -880,15 +880,15 @@ void octave_class::print_raw (std::ostream& os, bool) const { - unwind_protect::begin_frame ("octave_class_print"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_int (Vstruct_levels_to_print); + unwind_protect::protect_var (Vstruct_levels_to_print); indent (os); os << " <class " << class_name () << ">"; newline (os); - unwind_protect::run_frame ("octave_class_print"); + unwind_protect::run_frame (uwp_frame); } bool
--- a/src/ov-fcn-handle.cc +++ b/src/ov-fcn-handle.cc @@ -313,7 +313,7 @@ pos = is.tellg (); - unwind_protect::begin_frame ("anon_ascii_load"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); // Set up temporary scope to use for evaluating the text that // defines the anonymous function. @@ -385,7 +385,7 @@ else success = false; - unwind_protect::run_frame ("anon_ascii_load"); + unwind_protect::run_frame (uwp_frame); } else success = set_fcn (octaveroot, fpath); @@ -494,7 +494,7 @@ OCTAVE_LOCAL_BUFFER (char, ctmp2, tmp+1); is.get (ctmp2, tmp+1, 0); - unwind_protect::begin_frame ("anon_binary_load"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); // Set up temporary scope to use for evaluating the text that // defines the anonymous function. @@ -555,7 +555,7 @@ success = false; } - unwind_protect::run_frame ("anon_binary_load"); + unwind_protect::run_frame (uwp_frame); } else { @@ -939,7 +939,7 @@ // restore error reporting: H5Eset_auto (err_func, err_func_data); - unwind_protect::begin_frame ("anon_hdf5_load"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); // Set up temporary scope to use for evaluating the text that // defines the anonymous function. @@ -1015,7 +1015,7 @@ success = false; } - unwind_protect::run_frame ("anon_hdf5_load"); + unwind_protect::run_frame (uwp_frame); } else {
--- a/src/ov-list.cc +++ b/src/ov-list.cc @@ -293,7 +293,7 @@ void octave_list::print_raw (std::ostream& os, bool) const { - unwind_protect::begin_frame ("octave_list_print"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); octave_idx_type n = data.length (); @@ -326,7 +326,7 @@ newline (os); - unwind_protect::run_frame ("octave_list_print"); + unwind_protect::run_frame (uwp_frame); } bool
--- a/src/ov-mex-fcn.cc +++ b/src/ov-mex-fcn.cc @@ -139,7 +139,7 @@ ::error ("invalid use of colon in function argument list"); else { - unwind_protect::begin_frame ("mex_func_eval"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); octave_call_stack::push (this); @@ -154,7 +154,7 @@ gripe_library_execution_error (); } - unwind_protect::run_frame ("mex_func_eval"); + unwind_protect::run_frame (uwp_frame); } return retval;
--- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -580,9 +580,9 @@ void octave_struct::print_raw (std::ostream& os, bool) const { - unwind_protect::begin_frame ("octave_struct_print"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_int (Vstruct_levels_to_print); + unwind_protect::protect_var (Vstruct_levels_to_print); if (Vstruct_levels_to_print >= 0) { @@ -648,7 +648,7 @@ newline (os); } - unwind_protect::run_frame ("octave_struct_print"); + unwind_protect::run_frame (uwp_frame); } bool
--- a/src/ov-usr-fcn.cc +++ b/src/ov-usr-fcn.cc @@ -111,7 +111,7 @@ { octave_value_list retval; - unwind_protect::begin_frame ("user_script_eval"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); if (! error_state) { @@ -119,7 +119,7 @@ { if (cmd_list) { - unwind_protect_int (call_depth); + unwind_protect::protect_var (call_depth); call_depth++; if (call_depth < Vmax_recursion_depth) @@ -128,7 +128,7 @@ unwind_protect::add (octave_call_stack::unwind_pop, 0); - unwind_protect_bool (tree_evaluator::in_fcn_or_script_body); + unwind_protect::protect_var (tree_evaluator::in_fcn_or_script_body); tree_evaluator::in_fcn_or_script_body = true; cmd_list->accept (*current_evaluator); @@ -150,7 +150,7 @@ error ("invalid call to script"); } - unwind_protect::run_frame ("user_script_eval"); + unwind_protect::run_frame (uwp_frame); return retval; } @@ -346,15 +346,15 @@ int nargin = args.length (); - unwind_protect::begin_frame ("user_func_eval"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_int (call_depth); + unwind_protect::protect_var (call_depth); call_depth++; if (call_depth >= Vmax_recursion_depth) { ::error ("max_recursion_limit exceeded"); - unwind_protect::run_frame ("user_func_eval"); + unwind_protect::run_frame (uwp_frame); return retval; } @@ -379,7 +379,7 @@ string_vector arg_names = args.name_tags (); - unwind_protect_int (num_args_passed); + unwind_protect::protect_var (num_args_passed); num_args_passed = nargin; if (param_list && ! param_list->varargs_only ()) @@ -430,7 +430,7 @@ // Evaluate the commands that make up the function. - unwind_protect_bool (tree_evaluator::in_fcn_or_script_body); + unwind_protect::protect_var (tree_evaluator::in_fcn_or_script_body); tree_evaluator::in_fcn_or_script_body = true; bool special_expr = (is_inline_function () @@ -495,7 +495,7 @@ } abort: - unwind_protect::run_frame ("user_func_eval"); + unwind_protect::run_frame (uwp_frame); return retval; }
--- a/src/pager.cc +++ b/src/pager.cc @@ -364,10 +364,10 @@ { if (! flushing_output_to_pager) { - unwind_protect::begin_frame ("flush_octave_stdout"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_bool (really_flush_to_pager); - unwind_protect_bool (flushing_output_to_pager); + unwind_protect::protect_var (really_flush_to_pager); + unwind_protect::protect_var (flushing_output_to_pager); really_flush_to_pager = true; flushing_output_to_pager = true; @@ -376,7 +376,7 @@ clear_external_pager (); - unwind_protect::run_frame ("flush_octave_stdout"); + unwind_protect::run_frame (uwp_frame); } }
--- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -3204,9 +3204,9 @@ print_usage (); else { - unwind_protect::begin_frame ("Frats"); - - unwind_protect_int (rat_string_len); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); + + unwind_protect::protect_var (rat_string_len); rat_string_len = 9; @@ -3219,7 +3219,7 @@ if (arg.is_numeric_type ()) { - unwind_protect_bool (rat_format); + unwind_protect::protect_var (rat_format); rat_format = true; @@ -3254,7 +3254,7 @@ error ("rats: expecting numeric input"); } - unwind_protect::run_frame ("Frats"); + unwind_protect::run_frame (uwp_frame); } return retval;
--- a/src/pt-arg-list.cc +++ b/src/pt-arg-list.cc @@ -162,12 +162,14 @@ && object && ! (object->is_function () || object->is_function_handle ())); + + unwind_protect::frame_id_t uwp_frame; if (stash_object) { - unwind_protect::begin_frame ("convert_to_const_vector"); + uwp_frame = unwind_protect::begin_frame (); - unwind_protect_const_ptr (indexed_object); + unwind_protect::protect_var (indexed_object); indexed_object = object; } @@ -181,8 +183,8 @@ { if (stash_object) { - unwind_protect_int (index_position); - unwind_protect_int (num_indices); + unwind_protect::protect_var (index_position); + unwind_protect::protect_var (num_indices); index_position = k; num_indices = len; @@ -216,7 +218,7 @@ } if (stash_object) - unwind_protect::run_frame ("convert_to_const_vector"); + unwind_protect::run_frame (uwp_frame); return args; }
--- a/src/pt-eval.cc +++ b/src/pt-eval.cc @@ -282,9 +282,9 @@ if (debug_mode) do_breakpoint (cmd.is_breakpoint (), cmd.line (), cmd.column ()); - unwind_protect::begin_frame ("tree_evaluator::visit_simple_for_command"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_bool (in_loop_command); + unwind_protect::protect_var (in_loop_command); in_loop_command = true; @@ -392,7 +392,7 @@ } cleanup: - unwind_protect::run_frame ("tree_evaluator::visit_simple_for_command"); + unwind_protect::run_frame (uwp_frame); } void @@ -404,9 +404,9 @@ if (debug_mode) do_breakpoint (cmd.is_breakpoint (), cmd.line (), cmd.column ()); - unwind_protect::begin_frame ("tree_evaluator::visit_complex_for_command"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_bool (in_loop_command); + unwind_protect::protect_var (in_loop_command); in_loop_command = true; @@ -463,7 +463,7 @@ error ("in statement `for [X, Y] = VAL', VAL must be a structure"); cleanup: - unwind_protect::run_frame ("tree_evaluator::visit_complex_for_command"); + unwind_protect::run_frame (uwp_frame); } void @@ -859,11 +859,11 @@ void tree_evaluator::visit_try_catch_command (tree_try_catch_command& cmd) { - unwind_protect::begin_frame ("tree_evaluator::visit_try_catch_command"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_int (buffer_error_messages); - unwind_protect_bool (Vdebug_on_error); - unwind_protect_bool (Vdebug_on_warning); + unwind_protect::protect_var (buffer_error_messages); + unwind_protect::protect_var (Vdebug_on_error); + unwind_protect::protect_var (Vdebug_on_warning); buffer_error_messages++; Vdebug_on_error = false; @@ -881,7 +881,7 @@ if (catch_code && error_state) { error_state = 0; - unwind_protect::run_frame ("tree_evaluator::visit_try_catch_command"); + unwind_protect::run_frame (uwp_frame); } else { @@ -900,7 +900,7 @@ unwind_protect::run (); // Also clear the frame marker. - unwind_protect::run_frame ("tree_evaluator::visit_try_catch_command"); + unwind_protect::run_frame (uwp_frame); } } @@ -914,10 +914,10 @@ // in the first part of the unwind_protect are not completely // ignored. - unwind_protect_int (error_state); + unwind_protect::protect_var (error_state); error_state = 0; - unwind_protect_int (octave_interrupt_state); + unwind_protect::protect_var (octave_interrupt_state); octave_interrupt_state = 0; // Similarly, if we have seen a return or break statement, allow all @@ -925,10 +925,10 @@ // We don't have to worry about continue statements because they can // only occur in loops. - unwind_protect_int (tree_return_command::returning); + unwind_protect::protect_var (tree_return_command::returning); tree_return_command::returning = 0; - unwind_protect_int (tree_break_command::breaking); + unwind_protect::protect_var (tree_break_command::breaking); tree_break_command::breaking = 0; if (list) @@ -1003,9 +1003,9 @@ if (error_state) return; - unwind_protect::begin_frame ("tree_evaluator::visit_while_command"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_bool (in_loop_command); + unwind_protect::protect_var (in_loop_command); in_loop_command = true; @@ -1042,7 +1042,7 @@ } cleanup: - unwind_protect::run_frame ("tree_evaluator::visit_while_command"); + unwind_protect::run_frame (uwp_frame); } void @@ -1051,9 +1051,9 @@ if (error_state) return; - unwind_protect::begin_frame ("tree_evaluator::visit_do_until_command"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_bool (in_loop_command); + unwind_protect::protect_var (in_loop_command); in_loop_command = true; @@ -1088,7 +1088,7 @@ } cleanup: - unwind_protect::run_frame ("tree_evaluator::visit_do_until_command"); + unwind_protect::run_frame (uwp_frame); } void
--- a/src/toplev.cc +++ b/src/toplev.cc @@ -548,7 +548,7 @@ { try { - unwind_protect::begin_frame ("main_loop"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); reset_error_handler (); @@ -611,7 +611,7 @@ break; } - unwind_protect::run_frame ("main_loop"); + unwind_protect::run_frame (uwp_frame); } catch (octave_quit_exception e) { @@ -857,7 +857,7 @@ { octave_value_list retval; - unwind_protect::begin_frame ("Fsystem"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); int nargin = args.length (); @@ -960,7 +960,7 @@ else print_usage (); - unwind_protect::run_frame ("Fsystem"); + unwind_protect::run_frame (uwp_frame); return retval; }
--- a/src/variables.cc +++ b/src/variables.cc @@ -264,20 +264,20 @@ { int parse_status; - unwind_protect::begin_frame ("generate_struct_completions"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_int (error_state); - unwind_protect_int (warning_state); + unwind_protect::protect_var (error_state); + unwind_protect::protect_var (warning_state); - unwind_protect_bool (discard_error_messages); - unwind_protect_bool (discard_warning_messages); + unwind_protect::protect_var (discard_error_messages); + unwind_protect::protect_var (discard_warning_messages); discard_error_messages = true; discard_warning_messages = true; octave_value tmp = eval_string (prefix, true, parse_status); - unwind_protect::run_frame ("generate_struct_completions"); + unwind_protect::run_frame (uwp_frame); if (tmp.is_defined () && tmp.is_map ()) names = tmp.map_keys (); @@ -306,16 +306,16 @@ { int parse_status; - unwind_protect::begin_frame ("looks_like_struct"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); - unwind_protect_bool (discard_error_messages); - unwind_protect_int (error_state); + unwind_protect::protect_var (discard_error_messages); + unwind_protect::protect_var (error_state); discard_error_messages = true; octave_value tmp = eval_string (text, true, parse_status); - unwind_protect::run_frame ("looks_like_struct"); + unwind_protect::run_frame (uwp_frame); retval = (tmp.is_defined () && tmp.is_map ()); } @@ -1384,7 +1384,7 @@ { std::string nm = argv [i + 1]; - unwind_protect::begin_frame ("do_who_file"); + unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); // Set up temporary scope. @@ -1408,7 +1408,7 @@ retval = do_who (i, argv, return_list, verbose, newmsg); } - unwind_protect::run_frame ("do_who_file"); + unwind_protect::run_frame (uwp_frame); } return retval;