Mercurial > hg > octave-avbm
changeset 5791:70215aff5ccf
[project @ 2006-05-04 18:38:45 by jwe]
author | jwe |
---|---|
date | Thu, 04 May 2006 18:38:45 +0000 |
parents | 60659f01c75b |
children | eb90c83b4f91 |
files | src/ChangeLog src/DLD-FUNCTIONS/__gnuplot_raw__.l src/variables.cc src/variables.h |
diffstat | 4 files changed, 67 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,16 @@ 2006-05-04 John W. Eaton <jwe@octave.org> + * variables.cc (set_internal_variable): Move here from + DLD-FUNCTIONS/__gnuplot_raw__.l. + * variables.h (SET_INTERNAL_VARIABLE): Likewise. + (set_internal_variable): Provide decls. + + * DLD-FUNCTIONS/__gnuplot_raw__.l: Convert all DEFVARs to DEFUN_DLDs. + (gnuplot::init): Delete. + (gnuplot::gnuplot): Don't call init here. + (set_internal_variable): New functions. + (SET_INTERNAL_VARIABLE): New macro. + * Makefile.in: Undo changes of 2006-03-16. * DLD-FUNCTINS/__gnuplot_raw__.l: Move here from __gnuplot_raw__.l. Undo changes of 2006-03-16.
--- a/src/DLD-FUNCTIONS/__gnuplot_raw__.l +++ b/src/DLD-FUNCTIONS/__gnuplot_raw__.l @@ -1460,54 +1460,6 @@ static gnuplot_X X; -static octave_value -set_internal_variable (bool& var, const octave_value_list& args, - const char *nm) -{ - octave_value retval = var; - - int nargin = args.length (); - - if (nargin == 1) - { - bool bval = args(0).bool_value (); - - if (! error_state) - var = bval; - else - error ("%s: expecting arg to be a logical value", nm); - } - else if (nargin > 1) - print_usage ("automatic_replot"); - - return retval; -} - -static octave_value -set_internal_variable (std::string& var, const octave_value_list& args, - const char *nm) -{ - octave_value retval = var; - - int nargin = args.length (); - - if (nargin == 1) - { - std::string sval = args(0).string_value (); - - if (! error_state) - var = sval; - else - error ("%s: expecting arg to be a character string", nm); - } - else if (nargin > 1) - print_usage ("automatic_replot"); - - return retval; -} - -#define SET_INTERNAL_VARIABLE(NM) set_internal_variable (V ## NM, args, #NM) - // ----------------------- // User-callable functions // -----------------------
--- a/src/variables.cc +++ b/src/variables.cc @@ -1256,6 +1256,52 @@ // Variable values. +octave_value +set_internal_variable (bool& var, const octave_value_list& args, + const char *nm) +{ + octave_value retval = var; + + int nargin = args.length (); + + if (nargin == 1) + { + bool bval = args(0).bool_value (); + + if (! error_state) + var = bval; + else + error ("%s: expecting arg to be a logical value", nm); + } + else if (nargin > 1) + print_usage ("automatic_replot"); + + return retval; +} + +octave_value +set_internal_variable (std::string& var, const octave_value_list& args, + const char *nm) +{ + octave_value retval = var; + + int nargin = args.length (); + + if (nargin == 1) + { + std::string sval = args(0).string_value (); + + if (! error_state) + var = sval; + else + error ("%s: expecting arg to be a character string", nm); + } + else if (nargin > 1) + print_usage ("automatic_replot"); + + return retval; +} + // Look for the given name in the global symbol table. If it refers // to a string, return a new copy. If not, return 0;
--- a/src/variables.h +++ b/src/variables.h @@ -107,6 +107,16 @@ extern void set_global_value (const std::string& nm, const octave_value& val); +extern octave_value +set_internal_variable (bool& var, const octave_value_list& args, + const char *nm); + +extern octave_value +set_internal_variable (std::string& var, const octave_value_list& args, + const char *nm); + +#define SET_INTERNAL_VARIABLE(NM) set_internal_variable (V ## NM, args, #NM) + extern std::string builtin_string_variable (const std::string&); extern int builtin_real_scalar_variable (const std::string&, double&); extern octave_value builtin_any_variable (const std::string&);