Mercurial > hg > octave-lyh
diff src/variables.h @ 10638:e1559a8a60b4
general mechanism for string enum variables
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 17 May 2010 14:41:56 +0200 |
parents | 34e51d4e199b |
children | 5c594472f75e |
line wrap: on
line diff
--- a/src/variables.h +++ b/src/variables.h @@ -109,6 +109,11 @@ set_internal_variable (std::string& var, const octave_value_list& args, int nargout, const char *nm, bool empty_ok = true); +extern OCTINTERP_API octave_value +set_internal_variable (int& var, const octave_value_list& args, + int nargout, const char *nm, const char **choices, + int nchoices); + #define SET_INTERNAL_VARIABLE(NM) \ set_internal_variable (V ## NM, args, nargout, #NM) @@ -118,6 +123,11 @@ #define SET_INTERNAL_VARIABLE_WITH_LIMITS(NM, MINVAL, MAXVAL) \ set_internal_variable (V ## NM, args, nargout, #NM, MINVAL, MAXVAL) +// in the following, CHOICES must be a static C string array. +#define SET_INTERNAL_VARIABLE_CHOICES(NM, CHOICES) \ + set_internal_variable (V ## NM, args, nargout, #NM, CHOICES, \ + sizeof (CHOICES) / sizeof (const char *)) + extern OCTINTERP_API std::string builtin_string_variable (const std::string&); extern OCTINTERP_API int builtin_real_scalar_variable (const std::string&, double&); extern OCTINTERP_API octave_value builtin_any_variable (const std::string&);