Mercurial > octave-nkf
diff src/mex.cc @ 7901:3e4c9b69069d
call stack changes
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 08 Jul 2008 12:00:32 -0400 |
parents | 40c428ea3408 |
children | 25bc2d31e1bf |
line wrap: on
line diff
--- a/src/mex.cc Sat Jun 28 05:15:02 2008 -0400 +++ b/src/mex.cc Tue Jul 08 12:00:32 2008 -0400 @@ -3268,16 +3268,22 @@ val = get_global_value (name); else { - symbol_table::scope_id scope = -1; - - if (! strcmp (space, "caller")) - scope = symbol_table::current_caller_scope (); - else if (! strcmp (space, "base")) - scope = symbol_table::top_scope (); + bool caller = ! strcmp (space, "caller"); + bool base = ! strcmp (space, "base"); + + if (caller || base) + { + if (caller) + octave_call_stack::goto_caller_frame (); + else + octave_call_stack::goto_base_frame (); + + val = symbol_table::varval (name); + + octave_call_stack::pop (); + } else mexErrMsgTxt ("mexGetVariable: symbol table does not exist"); - - val = symbol_table::varval (name, scope); } if (val.is_defined ()) @@ -3317,16 +3323,22 @@ { // FIXME -- should this be in variables.cc? - symbol_table::scope_id scope = -1; - - if (! strcmp (space, "caller")) - scope = symbol_table::current_caller_scope (); - else if (! strcmp (space, "base")) - scope = symbol_table::top_scope (); + bool caller = ! strcmp (space, "caller"); + bool base = ! strcmp (space, "base"); + + if (caller || base) + { + if (caller) + octave_call_stack::goto_caller_frame (); + else + octave_call_stack::goto_base_frame (); + + symbol_table::varref (name) = mxArray::as_octave_value (ptr); + + octave_call_stack::pop (); + } else mexErrMsgTxt ("mexPutVariable: symbol table does not exist"); - - symbol_table::varref (name, scope) = mxArray::as_octave_value (ptr); } return 0;