Mercurial > octave-nkf
comparison 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 |
comparison
equal
deleted
inserted
replaced
7900:5b077861d168 | 7901:3e4c9b69069d |
---|---|
3266 | 3266 |
3267 if (! strcmp (space, "global")) | 3267 if (! strcmp (space, "global")) |
3268 val = get_global_value (name); | 3268 val = get_global_value (name); |
3269 else | 3269 else |
3270 { | 3270 { |
3271 symbol_table::scope_id scope = -1; | 3271 bool caller = ! strcmp (space, "caller"); |
3272 | 3272 bool base = ! strcmp (space, "base"); |
3273 if (! strcmp (space, "caller")) | 3273 |
3274 scope = symbol_table::current_caller_scope (); | 3274 if (caller || base) |
3275 else if (! strcmp (space, "base")) | 3275 { |
3276 scope = symbol_table::top_scope (); | 3276 if (caller) |
3277 octave_call_stack::goto_caller_frame (); | |
3278 else | |
3279 octave_call_stack::goto_base_frame (); | |
3280 | |
3281 val = symbol_table::varval (name); | |
3282 | |
3283 octave_call_stack::pop (); | |
3284 } | |
3277 else | 3285 else |
3278 mexErrMsgTxt ("mexGetVariable: symbol table does not exist"); | 3286 mexErrMsgTxt ("mexGetVariable: symbol table does not exist"); |
3279 | |
3280 val = symbol_table::varval (name, scope); | |
3281 } | 3287 } |
3282 | 3288 |
3283 if (val.is_defined ()) | 3289 if (val.is_defined ()) |
3284 { | 3290 { |
3285 retval = mex_context->make_value (val); | 3291 retval = mex_context->make_value (val); |
3315 set_global_value (name, mxArray::as_octave_value (ptr)); | 3321 set_global_value (name, mxArray::as_octave_value (ptr)); |
3316 else | 3322 else |
3317 { | 3323 { |
3318 // FIXME -- should this be in variables.cc? | 3324 // FIXME -- should this be in variables.cc? |
3319 | 3325 |
3320 symbol_table::scope_id scope = -1; | 3326 bool caller = ! strcmp (space, "caller"); |
3321 | 3327 bool base = ! strcmp (space, "base"); |
3322 if (! strcmp (space, "caller")) | 3328 |
3323 scope = symbol_table::current_caller_scope (); | 3329 if (caller || base) |
3324 else if (! strcmp (space, "base")) | 3330 { |
3325 scope = symbol_table::top_scope (); | 3331 if (caller) |
3332 octave_call_stack::goto_caller_frame (); | |
3333 else | |
3334 octave_call_stack::goto_base_frame (); | |
3335 | |
3336 symbol_table::varref (name) = mxArray::as_octave_value (ptr); | |
3337 | |
3338 octave_call_stack::pop (); | |
3339 } | |
3326 else | 3340 else |
3327 mexErrMsgTxt ("mexPutVariable: symbol table does not exist"); | 3341 mexErrMsgTxt ("mexPutVariable: symbol table does not exist"); |
3328 | |
3329 symbol_table::varref (name, scope) = mxArray::as_octave_value (ptr); | |
3330 } | 3342 } |
3331 | 3343 |
3332 return 0; | 3344 return 0; |
3333 } | 3345 } |
3334 | 3346 |