# HG changeset patch # User Jaroslav Hajek # Date 1245738133 -7200 # Node ID 610bf90fce2a2e2db0b268addaac3c8638b99d0d # Parent d58086453171b5a476cbb809b91e3fd4b3a453ce update unwind_protect usage everywhere diff -r d58086453171 -r 610bf90fce2a src/ChangeLog --- a/src/ChangeLog Tue Jun 23 07:55:44 2009 +0200 +++ b/src/ChangeLog Tue Jun 23 08:22:13 2009 +0200 @@ -1,3 +1,39 @@ +2009-06-23 Jaroslav Hajek + + * 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 * unwind-prot.h (unwind_protect): Rewrite. diff -r d58086453171 -r 610bf90fce2a src/DLD-FUNCTIONS/cellfun.cc --- a/src/DLD-FUNCTIONS/cellfun.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/DLD-FUNCTIONS/cellfun.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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; diff -r d58086453171 -r 610bf90fce2a src/DLD-FUNCTIONS/daspk.cc --- a/src/DLD-FUNCTIONS/daspk.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/DLD-FUNCTIONS/daspk.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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; } diff -r d58086453171 -r 610bf90fce2a src/DLD-FUNCTIONS/dasrt.cc --- a/src/DLD-FUNCTIONS/dasrt.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/DLD-FUNCTIONS/dasrt.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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; } diff -r d58086453171 -r 610bf90fce2a src/DLD-FUNCTIONS/dassl.cc --- a/src/DLD-FUNCTIONS/dassl.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/DLD-FUNCTIONS/dassl.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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; } diff -r d58086453171 -r 610bf90fce2a src/DLD-FUNCTIONS/eigs.cc --- a/src/DLD-FUNCTIONS/eigs.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/DLD-FUNCTIONS/eigs.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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 diff -r d58086453171 -r 610bf90fce2a src/DLD-FUNCTIONS/lsode.cc --- a/src/DLD-FUNCTIONS/lsode.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/DLD-FUNCTIONS/lsode.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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; } diff -r d58086453171 -r 610bf90fce2a src/DLD-FUNCTIONS/quad.cc --- a/src/DLD-FUNCTIONS/quad.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/DLD-FUNCTIONS/quad.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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; } diff -r d58086453171 -r 610bf90fce2a src/DLD-FUNCTIONS/rand.cc --- a/src/DLD-FUNCTIONS/rand.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/DLD-FUNCTIONS/rand.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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; diff -r d58086453171 -r 610bf90fce2a src/debug.cc --- a/src/debug.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/debug.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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; } diff -r d58086453171 -r 610bf90fce2a src/dynamic-ld.cc --- a/src/dynamic-ld.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/dynamic-ld.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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; } diff -r d58086453171 -r 610bf90fce2a src/error.cc --- a/src/error.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/error.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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; } diff -r d58086453171 -r 610bf90fce2a src/graphics.cc --- a/src/graphics.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/graphics.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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 (); diff -r d58086453171 -r 610bf90fce2a src/help.cc --- a/src/help.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/help.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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); diff -r d58086453171 -r 610bf90fce2a src/input.cc --- a/src/input.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/input.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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); diff -r d58086453171 -r 610bf90fce2a src/load-path.cc --- a/src/load-path.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/load-path.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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 diff -r d58086453171 -r 610bf90fce2a src/ls-mat4.cc --- a/src/ls-mat4.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/ls-mat4.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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 (buf), nrow*ncol*sizeof(double)); - unwind_protect::run_frame ("save_mat_binary_data"); + unwind_protect::run_frame (uwp_frame); } else if (tc.is_range ()) { diff -r d58086453171 -r 610bf90fce2a src/ls-mat5.cc --- a/src/ls-mat5.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/ls-mat5.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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 { diff -r d58086453171 -r 610bf90fce2a src/mex.cc --- a/src/mex.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/mex.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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; diff -r d58086453171 -r 610bf90fce2a src/oct-hist.cc --- a/src/oct-hist.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/oct-hist.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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. diff -r d58086453171 -r 610bf90fce2a src/octave.cc --- a/src/octave.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/octave.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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. diff -r d58086453171 -r 610bf90fce2a src/ov-builtin.cc --- a/src/ov-builtin.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/ov-builtin.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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; diff -r d58086453171 -r 610bf90fce2a src/ov-class.cc --- a/src/ov-class.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/ov-class.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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 << " "; newline (os); - unwind_protect::run_frame ("octave_class_print"); + unwind_protect::run_frame (uwp_frame); } bool diff -r d58086453171 -r 610bf90fce2a src/ov-fcn-handle.cc --- a/src/ov-fcn-handle.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/ov-fcn-handle.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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 { diff -r d58086453171 -r 610bf90fce2a src/ov-list.cc --- a/src/ov-list.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/ov-list.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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 diff -r d58086453171 -r 610bf90fce2a src/ov-mex-fcn.cc --- a/src/ov-mex-fcn.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/ov-mex-fcn.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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; diff -r d58086453171 -r 610bf90fce2a src/ov-struct.cc --- a/src/ov-struct.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/ov-struct.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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 diff -r d58086453171 -r 610bf90fce2a src/ov-usr-fcn.cc --- a/src/ov-usr-fcn.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/ov-usr-fcn.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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; } diff -r d58086453171 -r 610bf90fce2a src/pager.cc --- a/src/pager.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/pager.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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); } } diff -r d58086453171 -r 610bf90fce2a src/pr-output.cc --- a/src/pr-output.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/pr-output.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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; diff -r d58086453171 -r 610bf90fce2a src/pt-arg-list.cc --- a/src/pt-arg-list.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/pt-arg-list.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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; } diff -r d58086453171 -r 610bf90fce2a src/pt-eval.cc --- a/src/pt-eval.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/pt-eval.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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 diff -r d58086453171 -r 610bf90fce2a src/toplev.cc --- a/src/toplev.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/toplev.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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; } diff -r d58086453171 -r 610bf90fce2a src/variables.cc --- a/src/variables.cc Tue Jun 23 07:55:44 2009 +0200 +++ b/src/variables.cc Tue Jun 23 08:22:13 2009 +0200 @@ -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;