Mercurial > octave
diff src/mex.cc @ 9144:c6463412aebb
eliminate symbol_table::scope_stack; fix scoping issue with evalin
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 21 Apr 2009 15:39:57 -0400 |
parents | eb63fbe60fab |
children | d4b1314a7c31 |
line wrap: on
line diff
--- a/src/mex.cc Tue Apr 21 10:00:11 2009 -0700 +++ b/src/mex.cc Tue Apr 21 15:39:57 2009 -0400 @@ -3263,14 +3263,16 @@ { mxArray *retval = 0; - // FIXME -- should this be in variables.cc? - octave_value val; if (! strcmp (space, "global")) val = get_global_value (name); else { + // FIXME -- should this be in variables.cc? + + unwind_protect::begin_frame ("mexGetVariable"); + bool caller = ! strcmp (space, "caller"); bool base = ! strcmp (space, "base"); @@ -3281,12 +3283,15 @@ else octave_call_stack::goto_base_frame (); + if (! error_state) + unwind_protect::add (octave_call_stack::unwind_pop); + val = symbol_table::varval (name); - - octave_call_stack::pop (); } else mexErrMsgTxt ("mexGetVariable: symbol table does not exist"); + + unwind_protect::run_frame ("mexGetVariable"); } if (val.is_defined ()) @@ -3326,6 +3331,8 @@ { // FIXME -- should this be in variables.cc? + unwind_protect::begin_frame ("mexPutVariable"); + bool caller = ! strcmp (space, "caller"); bool base = ! strcmp (space, "base"); @@ -3336,12 +3343,15 @@ else octave_call_stack::goto_base_frame (); + if (! error_state) + unwind_protect::add (octave_call_stack::unwind_pop); + symbol_table::varref (name) = mxArray::as_octave_value (ptr); - - octave_call_stack::pop (); } else mexErrMsgTxt ("mexPutVariable: symbol table does not exist"); + + unwind_protect::run_frame ("mexPutVariable"); } return 0;