Mercurial > octave-nkf
diff src/variables.cc @ 2849:5338beb20eb9
[project @ 1997-03-28 21:33:27 by jwe]
author | jwe |
---|---|
date | Fri, 28 Mar 1997 21:33:27 +0000 |
parents | 8b262e771614 |
children | 8c516da3c1f7 |
line wrap: on
line diff
--- a/src/variables.cc Fri Mar 28 20:58:08 1997 +0000 +++ b/src/variables.cc Fri Mar 28 21:33:27 1997 +0000 @@ -832,6 +832,41 @@ return sym_rec; } +octave_value +get_global_value (const string& nm) +{ + octave_value retval; + + symbol_record *sr = global_sym_tab->lookup (nm); + + if (sr) + { + // Do something with the value in foo. + + tree_fvc *sr_def = sr->def (); + + if (sr_def) + retval = sr_def->eval (1); + else + error ("get_global_by_name: undefined symbol `%s'", nm.c_str ()); + } + else + error ("get_global_by_name: unknown symbol `%s'", nm.c_str ()); + + return retval; +} + +void +set_global_value (const string& nm, const octave_value& val) +{ + symbol_record *sr = global_sym_tab->lookup (nm, 1); + + if (sr) + sr->define (val); + else + panic_impossible (); +} + string get_help_from_file (const string& path) {