Mercurial > hg > octave-nkf
changeset 2849:5338beb20eb9
[project @ 1997-03-28 21:33:27 by jwe]
author | jwe |
---|---|
date | Fri, 28 Mar 1997 21:33:27 +0000 |
parents | 170b53ff36ac |
children | b7f43611d1e8 |
files | src/variables.cc src/variables.h |
diffstat | 2 files changed, 39 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/variables.cc +++ b/src/variables.cc @@ -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) {
--- a/src/variables.h +++ b/src/variables.h @@ -107,6 +107,10 @@ extern symbol_record *lookup_by_name (const string& nm, int exec_script = 1); +extern octave_value get_global_value (const string& nm); + +extern void set_global_value (const string& nm, const octave_value& val); + extern string get_help_from_file (const string& f); extern string builtin_string_variable (const string&);