comparison src/parse.y @ 9396:17af7cce7d1b

yet more unwind_protect improvements
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 25 Jun 2009 13:57:38 +0200
parents 1de00ca9c9f2
children 24df2e66abbe
comparison
equal deleted inserted replaced
9395:1de00ca9c9f2 9396:17af7cce7d1b
1545 static tree_expression * 1545 static tree_expression *
1546 fold (tree_binary_expression *e) 1546 fold (tree_binary_expression *e)
1547 { 1547 {
1548 tree_expression *retval = e; 1548 tree_expression *retval = e;
1549 1549
1550 unwind_protect::begin_frame ("fold_binary_expression"); 1550 unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame ();
1551 1551
1552 unwind_protect_int (error_state); 1552 unwind_protect::protect_var (error_state);
1553 unwind_protect_int (warning_state); 1553 unwind_protect::protect_var (warning_state);
1554 1554
1555 unwind_protect_bool (discard_error_messages); 1555 unwind_protect::protect_var (discard_error_messages);
1556 unwind_protect_bool (discard_warning_messages); 1556 unwind_protect::protect_var (discard_warning_messages);
1557 1557
1558 discard_error_messages = true; 1558 discard_error_messages = true;
1559 discard_warning_messages = true; 1559 discard_warning_messages = true;
1560 1560
1561 tree_expression *op1 = e->lhs (); 1561 tree_expression *op1 = e->lhs ();
1588 1588
1589 retval = tc_retval; 1589 retval = tc_retval;
1590 } 1590 }
1591 } 1591 }
1592 1592
1593 unwind_protect::run_frame ("fold_binary_expression"); 1593 unwind_protect::run_frame (uwp_frame);
1594 1594
1595 return retval; 1595 return retval;
1596 } 1596 }
1597 1597
1598 static tree_expression * 1598 static tree_expression *
1599 fold (tree_unary_expression *e) 1599 fold (tree_unary_expression *e)
1600 { 1600 {
1601 tree_expression *retval = e; 1601 tree_expression *retval = e;
1602 1602
1603 unwind_protect::begin_frame ("fold_unary_expression"); 1603 unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame ();
1604 1604
1605 unwind_protect_int (error_state); 1605 unwind_protect::protect_var (error_state);
1606 unwind_protect_int (warning_state); 1606 unwind_protect::protect_var (warning_state);
1607 1607
1608 unwind_protect_bool (discard_error_messages); 1608 unwind_protect::protect_var (discard_error_messages);
1609 unwind_protect_bool (discard_warning_messages); 1609 unwind_protect::protect_var (discard_warning_messages);
1610 1610
1611 discard_error_messages = true; 1611 discard_error_messages = true;
1612 discard_warning_messages = true; 1612 discard_warning_messages = true;
1613 1613
1614 tree_expression *op = e->operand (); 1614 tree_expression *op = e->operand ();
1634 1634
1635 retval = tc_retval; 1635 retval = tc_retval;
1636 } 1636 }
1637 } 1637 }
1638 1638
1639 unwind_protect::run_frame ("fold_unary_expression"); 1639 unwind_protect::run_frame (uwp_frame);
1640 1640
1641 return retval; 1641 return retval;
1642 } 1642 }
1643 1643
1644 // Finish building a range. 1644 // Finish building a range.
1646 static tree_expression * 1646 static tree_expression *
1647 finish_colon_expression (tree_colon_expression *e) 1647 finish_colon_expression (tree_colon_expression *e)
1648 { 1648 {
1649 tree_expression *retval = e; 1649 tree_expression *retval = e;
1650 1650
1651 unwind_protect::begin_frame ("finish_colon_expression"); 1651 unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame ();
1652 1652
1653 unwind_protect_int (error_state); 1653 unwind_protect::protect_var (error_state);
1654 unwind_protect_int (warning_state); 1654 unwind_protect::protect_var (warning_state);
1655 1655
1656 unwind_protect_bool (discard_error_messages); 1656 unwind_protect::protect_var (discard_error_messages);
1657 unwind_protect_bool (discard_warning_messages); 1657 unwind_protect::protect_var (discard_warning_messages);
1658 1658
1659 discard_error_messages = true; 1659 discard_error_messages = true;
1660 discard_warning_messages = true; 1660 discard_warning_messages = true;
1661 1661
1662 tree_expression *base = e->base (); 1662 tree_expression *base = e->base ();
1700 // too (we need a generic way to do that). 1700 // too (we need a generic way to do that).
1701 retval = base; 1701 retval = base;
1702 } 1702 }
1703 } 1703 }
1704 1704
1705 unwind_protect::run_frame ("finish_colon_expression"); 1705 unwind_protect::run_frame (uwp_frame);
1706 1706
1707 return retval; 1707 return retval;
1708 } 1708 }
1709 1709
1710 // Make a constant. 1710 // Make a constant.
2857 static tree_expression * 2857 static tree_expression *
2858 finish_matrix (tree_matrix *m) 2858 finish_matrix (tree_matrix *m)
2859 { 2859 {
2860 tree_expression *retval = m; 2860 tree_expression *retval = m;
2861 2861
2862 unwind_protect::begin_frame ("finish_matrix"); 2862 unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame ();
2863 2863
2864 unwind_protect_int (error_state); 2864 unwind_protect::protect_var (error_state);
2865 unwind_protect_int (warning_state); 2865 unwind_protect::protect_var (warning_state);
2866 2866
2867 unwind_protect_bool (discard_error_messages); 2867 unwind_protect::protect_var (discard_error_messages);
2868 unwind_protect_bool (discard_warning_messages); 2868 unwind_protect::protect_var (discard_warning_messages);
2869 2869
2870 discard_error_messages = true; 2870 discard_error_messages = true;
2871 discard_warning_messages = true; 2871 discard_warning_messages = true;
2872 2872
2873 if (m->all_elements_are_constant ()) 2873 if (m->all_elements_are_constant ())
2891 2891
2892 retval = tc_retval; 2892 retval = tc_retval;
2893 } 2893 }
2894 } 2894 }
2895 2895
2896 unwind_protect::run_frame ("finish_matrix"); 2896 unwind_protect::run_frame (uwp_frame);
2897 2897
2898 return retval; 2898 return retval;
2899 } 2899 }
2900 2900
2901 // Finish building a cell list. 2901 // Finish building a cell list.
3137 fseek (ffile, pos, SEEK_SET); 3137 fseek (ffile, pos, SEEK_SET);
3138 3138
3139 return status; 3139 return status;
3140 } 3140 }
3141 3141
3142 static void
3143 restore_command_history (void *)
3144 {
3145 command_history::ignore_entries (! Vsaving_history);
3146 }
3147
3148 static void
3149 restore_input_stream (void *f)
3150 {
3151 command_editor::set_input_stream (static_cast<FILE *> (f));
3152 }
3153
3154 static octave_function * 3142 static octave_function *
3155 parse_fcn_file (const std::string& ff, const std::string& dispatch_type, 3143 parse_fcn_file (const std::string& ff, const std::string& dispatch_type,
3156 bool force_script = false, bool require_file = true, 3144 bool force_script = false, bool require_file = true,
3157 const std::string& warn_for = std::string ()) 3145 const std::string& warn_for = std::string ())
3158 { 3146 {
3159 unwind_protect::begin_frame ("parse_fcn_file"); 3147 unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame ();
3160 3148
3161 octave_function *fcn_ptr = 0; 3149 octave_function *fcn_ptr = 0;
3162 3150
3163 // Open function file and parse. 3151 // Open function file and parse.
3164 3152
3165 bool old_reading_fcn_file_state = reading_fcn_file; 3153 bool old_reading_fcn_file_state = reading_fcn_file;
3166 3154
3167 FILE *in_stream = command_editor::get_input_stream (); 3155 FILE *in_stream = command_editor::get_input_stream ();
3168 3156
3169 unwind_protect::add (restore_input_stream, in_stream); 3157 unwind_protect::add_fcn (command_editor::set_input_stream,
3170 3158 in_stream);
3171 unwind_protect_ptr (ff_instream); 3159
3172 3160 unwind_protect::protect_var (ff_instream);
3173 unwind_protect_int (input_line_number); 3161
3174 unwind_protect_int (current_input_column); 3162 unwind_protect::protect_var (input_line_number);
3175 unwind_protect_int (end_tokens_expected); 3163 unwind_protect::protect_var (current_input_column);
3176 unwind_protect_bool (reading_fcn_file); 3164 unwind_protect::protect_var (end_tokens_expected);
3177 unwind_protect_bool (line_editing); 3165 unwind_protect::protect_var (reading_fcn_file);
3178 unwind_protect_str (parent_function_name); 3166 unwind_protect::protect_var (line_editing);
3179 unwind_protect_str (current_class_name); 3167 unwind_protect::protect_var (parent_function_name);
3168 unwind_protect::protect_var (current_class_name);
3180 3169
3181 input_line_number = 1; 3170 input_line_number = 1;
3182 current_input_column = 1; 3171 current_input_column = 1;
3183 end_tokens_expected = 0; 3172 end_tokens_expected = 0;
3184 reading_fcn_file = true; 3173 reading_fcn_file = true;
3185 line_editing = false; 3174 line_editing = false;
3186 parent_function_name = ""; 3175 parent_function_name = "";
3187 current_class_name = dispatch_type; 3176 current_class_name = dispatch_type;
3188 3177
3189 // The next four lines must be in this order. 3178 // The next four lines must be in this order.
3190 unwind_protect::add (restore_command_history, 0); 3179 unwind_protect::add_fcn (command_history::ignore_entries, ! Vsaving_history);
3191 3180
3192 // FIXME -- we shouldn't need both the 3181 // FIXME -- we shouldn't need both the
3193 // command_history object and the 3182 // command_history object and the
3194 // Vsaving_history variable... 3183 // Vsaving_history variable...
3195 command_history::ignore_entries (); 3184 command_history::ignore_entries ();
3196 3185
3197 unwind_protect_bool (Vsaving_history); 3186 unwind_protect::protect_var (Vsaving_history);
3198 3187
3199 Vsaving_history = false; 3188 Vsaving_history = false;
3200 3189
3201 FILE *ffile = get_input_from_file (ff, 0); 3190 FILE *ffile = get_input_from_file (ff, 0);
3202 3191
3212 { 3201 {
3213 std::string file_type; 3202 std::string file_type;
3214 3203
3215 bool parsing_script = false; 3204 bool parsing_script = false;
3216 3205
3217 unwind_protect_bool (get_input_from_eval_string); 3206 unwind_protect::protect_var (get_input_from_eval_string);
3218 unwind_protect_bool (parser_end_of_input); 3207 unwind_protect::protect_var (parser_end_of_input);
3219 3208
3220 get_input_from_eval_string = false; 3209 get_input_from_eval_string = false;
3221 parser_end_of_input = false; 3210 parser_end_of_input = false;
3222 3211
3223 if (! force_script && looking_at_function_keyword (ffile)) 3212 if (! force_script && looking_at_function_keyword (ffile))
3224 { 3213 {
3225 file_type = "function"; 3214 file_type = "function";
3226 3215
3227 unwind_protect_int (Vecho_executing_commands); 3216 unwind_protect::protect_var (Vecho_executing_commands);
3228 unwind_protect_bool (reading_fcn_file); 3217 unwind_protect::protect_var (reading_fcn_file);
3229 3218
3230 Vecho_executing_commands = ECHO_OFF; 3219 Vecho_executing_commands = ECHO_OFF;
3231 reading_fcn_file = true; 3220 reading_fcn_file = true;
3232 } 3221 }
3233 else 3222 else
3236 3225
3237 // The value of `reading_fcn_file' will be restored to the 3226 // The value of `reading_fcn_file' will be restored to the
3238 // proper value when we unwind from this frame. 3227 // proper value when we unwind from this frame.
3239 reading_fcn_file = old_reading_fcn_file_state; 3228 reading_fcn_file = old_reading_fcn_file_state;
3240 3229
3241 unwind_protect_bool (reading_script_file); 3230 unwind_protect::protect_var (reading_script_file);
3242 3231
3243 reading_script_file = true; 3232 reading_script_file = true;
3244 3233
3245 parsing_script = true; 3234 parsing_script = true;
3246 } 3235 }
3247 3236
3248 YY_BUFFER_STATE old_buf = current_buffer (); 3237 YY_BUFFER_STATE old_buf = current_buffer ();
3249 YY_BUFFER_STATE new_buf = create_buffer (ffile); 3238 YY_BUFFER_STATE new_buf = create_buffer (ffile);
3250 3239
3251 unwind_protect::add (restore_input_buffer, old_buf); 3240 unwind_protect::add_fcn (switch_to_buffer, old_buf);
3252 unwind_protect::add (delete_input_buffer, new_buf); 3241 unwind_protect::add_fcn (delete_buffer, new_buf);
3253 3242
3254 switch_to_buffer (new_buf); 3243 switch_to_buffer (new_buf);
3255 3244
3256 unwind_protect_ptr (curr_fcn_ptr); 3245 unwind_protect::protect_var (curr_fcn_ptr);
3257 curr_fcn_ptr = 0; 3246 curr_fcn_ptr = 0;
3258 3247
3259 reset_parser (); 3248 reset_parser ();
3260 3249
3261 // Do this with an unwind-protect cleanup function so that 3250 // Do this with an unwind-protect cleanup function so that
3262 // the forced variables will be unmarked in the event of an 3251 // the forced variables will be unmarked in the event of an
3263 // interrupt. 3252 // interrupt.
3264 symbol_table::scope_id scope = symbol_table::top_scope (); 3253 symbol_table::scope_id scope = symbol_table::top_scope ();
3265 unwind_protect::add_action_var (symbol_table::unmark_forced_variables, scope); 3254 unwind_protect::add_fcn (symbol_table::unmark_forced_variables, scope);
3266 3255
3267 if (! help_txt.empty ()) 3256 if (! help_txt.empty ())
3268 help_buf.push (help_txt); 3257 help_buf.push (help_txt);
3269 3258
3270 if (parsing_script) 3259 if (parsing_script)
3284 else if (require_file) 3273 else if (require_file)
3285 error ("no such file, `%s'", ff.c_str ()); 3274 error ("no such file, `%s'", ff.c_str ());
3286 else if (! warn_for.empty ()) 3275 else if (! warn_for.empty ())
3287 error ("%s: unable to open file `%s'", warn_for.c_str (), ff.c_str ()); 3276 error ("%s: unable to open file `%s'", warn_for.c_str (), ff.c_str ());
3288 3277
3289 unwind_protect::run_frame ("parse_fcn_file"); 3278 unwind_protect::run_frame (uwp_frame);
3290 3279
3291 return fcn_ptr; 3280 return fcn_ptr;
3292 } 3281 }
3293 3282
3294 std::string 3283 std::string
3384 const std::string& dispatch_type, 3373 const std::string& dispatch_type,
3385 const std::string& fcn_name, bool autoload) 3374 const std::string& fcn_name, bool autoload)
3386 { 3375 {
3387 octave_function *retval = 0; 3376 octave_function *retval = 0;
3388 3377
3389 unwind_protect::begin_frame ("load_fcn_from_file"); 3378 unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame ();
3390 3379
3391 std::string nm = file_name; 3380 std::string nm = file_name;
3392 3381
3393 size_t nm_len = nm.length (); 3382 size_t nm_len = nm.length ();
3394 3383
3395 std::string file; 3384 std::string file;
3396 3385
3397 unwind_protect_bool (fcn_file_from_relative_lookup); 3386 unwind_protect::protect_var (fcn_file_from_relative_lookup);
3398 3387
3399 fcn_file_from_relative_lookup = false; 3388 fcn_file_from_relative_lookup = false;
3400 3389
3401 file = nm; 3390 file = nm;
3402 3391
3408 nm = nm.substr (0, nm.find_last_of ('.')); 3397 nm = nm.substr (0, nm.find_last_of ('.'));
3409 } 3398 }
3410 3399
3411 if (autoload) 3400 if (autoload)
3412 { 3401 {
3413 unwind_protect_bool (autoloading); 3402 unwind_protect::protect_var (autoloading);
3414 autoloading = true; 3403 autoloading = true;
3415 } 3404 }
3416 3405
3417 fcn_file_from_relative_lookup = ! octave_env::absolute_pathname (file); 3406 fcn_file_from_relative_lookup = ! octave_env::absolute_pathname (file);
3418 3407
3431 retval = octave_dynamic_loader::load_mex (nm, file, fcn_file_from_relative_lookup); 3420 retval = octave_dynamic_loader::load_mex (nm, file, fcn_file_from_relative_lookup);
3432 else if (len > 2) 3421 else if (len > 2)
3433 { 3422 {
3434 // These are needed by yyparse. 3423 // These are needed by yyparse.
3435 3424
3436 unwind_protect_str (curr_fcn_file_name); 3425 unwind_protect::protect_var (curr_fcn_file_name);
3437 unwind_protect_str (curr_fcn_file_full_name); 3426 unwind_protect::protect_var (curr_fcn_file_full_name);
3438 3427
3439 curr_fcn_file_name = nm; 3428 curr_fcn_file_name = nm;
3440 curr_fcn_file_full_name = file; 3429 curr_fcn_file_full_name = file;
3441 3430
3442 retval = parse_fcn_file (file, dispatch_type, autoloading); 3431 retval = parse_fcn_file (file, dispatch_type, autoloading);
3452 3441
3453 symbol_table::stash_dir_name_for_subfunctions (id, dir_name); 3442 symbol_table::stash_dir_name_for_subfunctions (id, dir_name);
3454 } 3443 }
3455 } 3444 }
3456 3445
3457 unwind_protect::run_frame ("load_fcn_from_file"); 3446 unwind_protect::run_frame (uwp_frame);
3458 3447
3459 return retval; 3448 return retval;
3460 } 3449 }
3461 3450
3462 DEFUN (autoload, args, , 3451 DEFUN (autoload, args, ,
3568 source_file (const std::string& file_name, const std::string& context, 3557 source_file (const std::string& file_name, const std::string& context,
3569 bool verbose, bool require_file, const std::string& warn_for) 3558 bool verbose, bool require_file, const std::string& warn_for)
3570 { 3559 {
3571 std::string file_full_name = file_ops::tilde_expand (file_name); 3560 std::string file_full_name = file_ops::tilde_expand (file_name);
3572 3561
3573 unwind_protect::begin_frame ("source_file"); 3562 unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame ();
3574 3563
3575 unwind_protect_str (curr_fcn_file_name); 3564 unwind_protect::protect_var (curr_fcn_file_name);
3576 unwind_protect_str (curr_fcn_file_full_name); 3565 unwind_protect::protect_var (curr_fcn_file_full_name);
3577 3566
3578 curr_fcn_file_name = file_name; 3567 curr_fcn_file_name = file_name;
3579 curr_fcn_file_full_name = file_full_name; 3568 curr_fcn_file_full_name = file_full_name;
3580 3569
3581 if (! context.empty ()) 3570 if (! context.empty ())
3586 octave_call_stack::goto_base_frame (); 3575 octave_call_stack::goto_base_frame ();
3587 else 3576 else
3588 error ("source: context must be \"caller\" or \"base\""); 3577 error ("source: context must be \"caller\" or \"base\"");
3589 3578
3590 if (! error_state) 3579 if (! error_state)
3591 unwind_protect::add (octave_call_stack::unwind_pop); 3580 unwind_protect::add_fcn (octave_call_stack::pop);
3592 } 3581 }
3593 3582
3594 if (! error_state) 3583 if (! error_state)
3595 { 3584 {
3596 octave_function *fcn = parse_fcn_file (file_full_name, "", true, 3585 octave_function *fcn = parse_fcn_file (file_full_name, "", true,
3620 else 3609 else
3621 error ("source: error sourcing file `%s'", 3610 error ("source: error sourcing file `%s'",
3622 file_full_name.c_str ()); 3611 file_full_name.c_str ());
3623 } 3612 }
3624 3613
3625 unwind_protect::run_frame ("source_file"); 3614 unwind_protect::run_frame (uwp_frame);
3626 } 3615 }
3627 3616
3628 DEFUN (mfilename, args, , 3617 DEFUN (mfilename, args, ,
3629 "-*- texinfo -*-\n\ 3618 "-*- texinfo -*-\n\
3630 @deftypefn {Built-in Function} {} mfilename ()\n\ 3619 @deftypefn {Built-in Function} {} mfilename ()\n\
3876 octave_value_list 3865 octave_value_list
3877 eval_string (const std::string& s, bool silent, int& parse_status, int nargout) 3866 eval_string (const std::string& s, bool silent, int& parse_status, int nargout)
3878 { 3867 {
3879 octave_value_list retval; 3868 octave_value_list retval;
3880 3869
3881 unwind_protect::begin_frame ("eval_string"); 3870 unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame ();
3882 3871
3883 unwind_protect_int (input_line_number); 3872 unwind_protect::protect_var (input_line_number);
3884 unwind_protect_int (current_input_column); 3873 unwind_protect::protect_var (current_input_column);
3885 unwind_protect_bool (get_input_from_eval_string); 3874 unwind_protect::protect_var (get_input_from_eval_string);
3886 unwind_protect_bool (input_from_eval_string_pending); 3875 unwind_protect::protect_var (input_from_eval_string_pending);
3887 unwind_protect_bool (parser_end_of_input); 3876 unwind_protect::protect_var (parser_end_of_input);
3888 unwind_protect_bool (line_editing); 3877 unwind_protect::protect_var (line_editing);
3889 unwind_protect_str (current_eval_string); 3878 unwind_protect::protect_var (current_eval_string);
3890 3879
3891 input_line_number = 1; 3880 input_line_number = 1;
3892 current_input_column = 1; 3881 current_input_column = 1;
3893 get_input_from_eval_string = true; 3882 get_input_from_eval_string = true;
3894 input_from_eval_string_pending = true; 3883 input_from_eval_string_pending = true;
3898 current_eval_string = s; 3887 current_eval_string = s;
3899 3888
3900 YY_BUFFER_STATE old_buf = current_buffer (); 3889 YY_BUFFER_STATE old_buf = current_buffer ();
3901 YY_BUFFER_STATE new_buf = create_buffer (0); 3890 YY_BUFFER_STATE new_buf = create_buffer (0);
3902 3891
3903 unwind_protect::add (restore_input_buffer, old_buf); 3892 unwind_protect::add_fcn (switch_to_buffer, old_buf);
3904 unwind_protect::add (delete_input_buffer, new_buf); 3893 unwind_protect::add_fcn (delete_buffer, new_buf);
3905 3894
3906 switch_to_buffer (new_buf); 3895 switch_to_buffer (new_buf);
3907 3896
3908 do 3897 do
3909 { 3898 {
3910 reset_parser (); 3899 reset_parser ();
3911 3900
3912 unwind_protect_ptr (global_command); 3901 unwind_protect::protect_var (global_command);
3913 3902
3914 // Do this with an unwind-protect cleanup function so that the 3903 // Do this with an unwind-protect cleanup function so that the
3915 // forced variables will be unmarked in the event of an 3904 // forced variables will be unmarked in the event of an
3916 // interrupt. 3905 // interrupt.
3917 symbol_table::scope_id scope = symbol_table::top_scope (); 3906 symbol_table::scope_id scope = symbol_table::top_scope ();
3918 unwind_protect::add (symbol_table::unmark_forced_variables, &scope); 3907 unwind_protect::add_fcn (symbol_table::unmark_forced_variables, scope);
3919 3908
3920 parse_status = yyparse (); 3909 parse_status = yyparse ();
3921 3910
3922 tree_statement_list *command_list = global_command; 3911 tree_statement_list *command_list = global_command;
3923 3912
3981 break; 3970 break;
3982 } 3971 }
3983 } 3972 }
3984 while (parse_status == 0); 3973 while (parse_status == 0);
3985 3974
3986 unwind_protect::run_frame ("eval_string"); 3975 unwind_protect::run_frame (uwp_frame);
3987 3976
3988 return retval; 3977 return retval;
3989 } 3978 }
3990 3979
3991 octave_value 3980 octave_value
4046 4035
4047 int nargin = args.length (); 4036 int nargin = args.length ();
4048 4037
4049 if (nargin > 0) 4038 if (nargin > 0)
4050 { 4039 {
4051 unwind_protect::begin_frame ("Feval"); 4040 unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame ();
4052 4041
4053 if (nargin > 1) 4042 if (nargin > 1)
4054 { 4043 {
4055 unwind_protect_int (buffer_error_messages); 4044 unwind_protect::protect_var (buffer_error_messages);
4056 buffer_error_messages++; 4045 buffer_error_messages++;
4057 } 4046 }
4058 4047
4059 int parse_status = 0; 4048 int parse_status = 0;
4060 4049
4076 retval = tmp; 4065 retval = tmp;
4077 } 4066 }
4078 else if (nargout > 0) 4067 else if (nargout > 0)
4079 retval = tmp; 4068 retval = tmp;
4080 4069
4081 unwind_protect::run_frame ("Feval"); 4070 unwind_protect::run_frame (uwp_frame);
4082 } 4071 }
4083 else 4072 else
4084 print_usage (); 4073 print_usage ();
4085 4074
4086 return retval; 4075 return retval;
4184 { 4173 {
4185 std::string context = args(0).string_value (); 4174 std::string context = args(0).string_value ();
4186 4175
4187 if (! error_state) 4176 if (! error_state)
4188 { 4177 {
4189 unwind_protect::begin_frame ("Fassignin"); 4178 unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame ();
4190 4179
4191 if (context == "caller") 4180 if (context == "caller")
4192 octave_call_stack::goto_caller_frame (); 4181 octave_call_stack::goto_caller_frame ();
4193 else if (context == "base") 4182 else if (context == "base")
4194 octave_call_stack::goto_base_frame (); 4183 octave_call_stack::goto_base_frame ();
4195 else 4184 else
4196 error ("assignin: context must be \"caller\" or \"base\""); 4185 error ("assignin: context must be \"caller\" or \"base\"");
4197 4186
4198 if (! error_state) 4187 if (! error_state)
4199 { 4188 {
4200 unwind_protect::add (octave_call_stack::unwind_pop); 4189 unwind_protect::add_fcn (octave_call_stack::pop);
4201 4190
4202 std::string nm = args(1).string_value (); 4191 std::string nm = args(1).string_value ();
4203 4192
4204 if (! error_state) 4193 if (! error_state)
4205 { 4194 {
4210 } 4199 }
4211 else 4200 else
4212 error ("assignin: expecting variable name as second argument"); 4201 error ("assignin: expecting variable name as second argument");
4213 } 4202 }
4214 4203
4215 unwind_protect::run_frame ("Fassignin"); 4204 unwind_protect::run_frame (uwp_frame);
4216 } 4205 }
4217 else 4206 else
4218 error ("assignin: expecting string as first argument"); 4207 error ("assignin: expecting string as first argument");
4219 } 4208 }
4220 else 4209 else
4239 { 4228 {
4240 std::string context = args(0).string_value (); 4229 std::string context = args(0).string_value ();
4241 4230
4242 if (! error_state) 4231 if (! error_state)
4243 { 4232 {
4244 unwind_protect::begin_frame ("Fevalin"); 4233 unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame ();
4245 4234
4246 if (context == "caller") 4235 if (context == "caller")
4247 octave_call_stack::goto_caller_frame (); 4236 octave_call_stack::goto_caller_frame ();
4248 else if (context == "base") 4237 else if (context == "base")
4249 octave_call_stack::goto_base_frame (); 4238 octave_call_stack::goto_base_frame ();
4250 else 4239 else
4251 error ("evalin: context must be \"caller\" or \"base\""); 4240 error ("evalin: context must be \"caller\" or \"base\"");
4252 4241
4253 if (! error_state) 4242 if (! error_state)
4254 { 4243 {
4255 unwind_protect::add (octave_call_stack::unwind_pop); 4244 unwind_protect::add_fcn (octave_call_stack::pop);
4256 4245
4257 if (nargin > 2) 4246 if (nargin > 2)
4258 { 4247 {
4259 unwind_protect_int (buffer_error_messages); 4248 unwind_protect::protect_var (buffer_error_messages);
4260 buffer_error_messages++; 4249 buffer_error_messages++;
4261 } 4250 }
4262 4251
4263 int parse_status = 0; 4252 int parse_status = 0;
4264 4253
4281 4270
4282 retval = octave_value_list (); 4271 retval = octave_value_list ();
4283 } 4272 }
4284 } 4273 }
4285 4274
4286 unwind_protect::run_frame ("Fevalin"); 4275 unwind_protect::run_frame (uwp_frame);
4287 } 4276 }
4288 else 4277 else
4289 error ("evalin: expecting string as first argument"); 4278 error ("evalin: expecting string as first argument");
4290 } 4279 }
4291 else 4280 else