Mercurial > octave-nkf
diff src/variables.cc @ 10071:e42b1bbd1052
variables.cc (get_top_level_value, set_top_level_value): new functions
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 07 Jan 2010 15:07:19 -0500 |
parents | 2cd940306a06 |
children | cd96d29c5efa |
line wrap: on
line diff
--- a/src/variables.cc Thu Jan 07 08:31:41 2010 +0100 +++ b/src/variables.cc Thu Jan 07 15:07:19 2010 -0500 @@ -607,7 +607,7 @@ octave_value val = symbol_table::global_varval (nm); if (val.is_undefined () && ! silent) - error ("get_global_by_name: undefined symbol `%s'", nm.c_str ()); + error ("get_global_value: undefined symbol `%s'", nm.c_str ()); return val; } @@ -618,6 +618,23 @@ symbol_table::global_varref (nm) = val; } +octave_value +get_top_level_value (const std::string& nm, bool silent) +{ + octave_value val = symbol_table::top_level_varval (nm); + + if (val.is_undefined () && ! silent) + error ("get_top_level_value: undefined symbol `%s'", nm.c_str ()); + + return val; +} + +void +set_top_level_value (const std::string& nm, const octave_value& val) +{ + symbol_table::top_level_varref (nm) = val; +} + // Variable values. octave_value