comparison src/parse.y @ 7901:3e4c9b69069d

call stack changes
author John W. Eaton <jwe@octave.org>
date Tue, 08 Jul 2008 12:00:32 -0400
parents 5861b95e9879
children 8018e10d2b87
comparison
equal deleted inserted replaced
7900:5b077861d168 7901:3e4c9b69069d
3405 curr_fcn_file_full_name = file_full_name; 3405 curr_fcn_file_full_name = file_full_name;
3406 3406
3407 if (! context.empty ()) 3407 if (! context.empty ())
3408 { 3408 {
3409 if (context == "caller") 3409 if (context == "caller")
3410 symbol_table::push_scope (symbol_table::current_caller_scope ()); 3410 octave_call_stack::goto_caller_frame ();
3411 else if (context == "base") 3411 else if (context == "base")
3412 symbol_table::push_scope (symbol_table::top_scope ()); 3412 octave_call_stack::goto_base_frame ();
3413 else 3413 else
3414 error ("source: context must be \"caller\" or \"base\""); 3414 error ("source: context must be \"caller\" or \"base\"");
3415 3415
3416 if (! error_state) 3416 if (! error_state)
3417 unwind_protect::add (symbol_table::pop_scope); 3417 unwind_protect::add (octave_call_stack::unwind_pop);
3418 } 3418 }
3419 3419
3420 if (! error_state) 3420 if (! error_state)
3421 { 3421 {
3422 octave_function *fcn = parse_fcn_file (file_full_name, "", true, 3422 octave_function *fcn = parse_fcn_file (file_full_name, "", true,
3963 if (! error_state) 3963 if (! error_state)
3964 { 3964 {
3965 symbol_table::scope_id scope = -1; 3965 symbol_table::scope_id scope = -1;
3966 3966
3967 if (context == "caller") 3967 if (context == "caller")
3968 { 3968 octave_call_stack::goto_caller_frame ();
3969 if (symbol_table::current_scope () == symbol_table::current_caller_scope ())
3970 {
3971 error ("assignin: assignment in caller not implemented yet for direct recursion");
3972 return retval;
3973 }
3974 else
3975 scope = symbol_table::current_caller_scope ();
3976 }
3977 else if (context == "base") 3969 else if (context == "base")
3978 scope = symbol_table::top_scope (); 3970 octave_call_stack::goto_base_frame ();
3979 else 3971 else
3980 error ("assignin: context must be \"caller\" or \"base\""); 3972 error ("assignin: context must be \"caller\" or \"base\"");
3981 3973
3982 if (! error_state) 3974 if (! error_state)
3983 { 3975 {
3976 unwind_protect::add (octave_call_stack::unwind_pop);
3977
3984 std::string nm = args(1).string_value (); 3978 std::string nm = args(1).string_value ();
3985 3979
3986 if (! error_state) 3980 if (! error_state)
3987 { 3981 {
3988 if (valid_identifier (nm)) 3982 if (valid_identifier (nm))
4022 if (! error_state) 4016 if (! error_state)
4023 { 4017 {
4024 unwind_protect::begin_frame ("Fevalin"); 4018 unwind_protect::begin_frame ("Fevalin");
4025 4019
4026 if (context == "caller") 4020 if (context == "caller")
4027 { 4021 octave_call_stack::goto_caller_frame ();
4028 if (symbol_table::current_scope () == symbol_table::current_caller_scope ())
4029 {
4030 error ("evalin: evaluation in caller not implemented yet for direct recursion");
4031 return retval;
4032 }
4033 else
4034 symbol_table::push_scope (symbol_table::current_caller_scope ());
4035 }
4036 else if (context == "base") 4022 else if (context == "base")
4037 symbol_table::push_scope (symbol_table::top_scope ()); 4023 octave_call_stack::goto_base_frame ();
4038 else 4024 else
4039 error ("evalin: context must be \"caller\" or \"base\""); 4025 error ("evalin: context must be \"caller\" or \"base\"");
4040 4026
4041 if (! error_state) 4027 if (! error_state)
4042 { 4028 {
4043 unwind_protect::add (symbol_table::pop_scope); 4029 unwind_protect::add (octave_call_stack::unwind_pop);
4044 4030
4045 if (nargin > 2) 4031 if (nargin > 2)
4046 { 4032 {
4047 unwind_protect_int (buffer_error_messages); 4033 unwind_protect_int (buffer_error_messages);
4048 buffer_error_messages++; 4034 buffer_error_messages++;