Mercurial > hg > octave-terminal
changeset 7437:3e450caf93f2
[project @ 2008-02-01 08:19:05 by jwe]
author | jwe |
---|---|
date | Fri, 01 Feb 2008 08:19:05 +0000 |
parents | 7d06a404b8f9 |
children | 6873fe003323 |
files | src/ChangeLog src/symtab.cc |
diffstat | 2 files changed, 54 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-02-01 John W. Eaton <jwe@octave.org> + + * symtab.cc (Fset_variable, Fvariable_value): + New functions, but commented out for now. + 2008-01-30 Michael Goffioul <michael.goffioul@gmail.com> * graphics.h.in (axes::properties::get_transform_matrix,
--- a/src/symtab.cc +++ b/src/symtab.cc @@ -798,6 +798,55 @@ return retval; } +#if 0 + +// FIXME -- should we have functions like this in Octave? + +DEFUN (set_variable, args, , "set_variable (NAME, VALUE)") +{ + octave_value retval; + + if (args.length () == 2) + { + std::string name = args(0).string_value (); + + if (! error_state) + symbol_table::varref (name) = args(1); + else + error ("set_variable: expecting variable name as first argument"); + } + else + print_usage (); + + return retval; +} + +DEFUN (variable_value, args, , "VALUE = variable_value (NAME)") +{ + octave_value retval; + + if (args.length () == 1) + { + std::string name = args(0).string_value (); + + if (! error_state) + { + retval = symbol_table::varval (name); + + if (retval.is_undefined ()) + error ("variable_value: `%s' is not a variable in the current scope", + name.c_str ()); + } + else + error ("variable_value: expecting variable name as first argument"); + } + else + print_usage (); + + return retval; +} +#endif + /* ;;; Local Variables: *** ;;; mode: C++ ***