GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
variables.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1993-2017 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_variables_h)
24 #define octave_variables_h 1
25 
26 #include "octave-config.h"
27 
28 class octave_function;
30 
31 class tree_identifier;
32 class octave_value;
33 class octave_value_list;
34 class octave_builtin;
35 class string_vector;
36 
37 #include <cfloat>
38 
39 #include <limits>
40 #include <string>
41 
42 #include "lo-ieee.h"
43 
44 #include "ov.h"
45 #include "ov-builtin.h"
46 #include "symtab.h"
47 
48 extern OCTINTERP_API void clear_mex_functions (void);
49 
51 is_valid_function (const octave_value&, const std::string& = "",
52  bool warn = false);
53 
55 is_valid_function (const std::string&, const std::string& = "",
56  bool warn = false);
57 
59 extract_function (const octave_value& arg, const std::string& warn_for,
60  const std::string& fname, const std::string& header,
61  const std::string& trailer);
62 
65 
68  std::string& hint);
69 
70 extern OCTINTERP_API bool
71 looks_like_struct (const std::string& text, char prev_char);
72 
73 extern OCTINTERP_API int
74 symbol_exist (const std::string& name, const std::string& type = "any");
75 
78 
81 
83 get_global_value (const std::string& nm, bool silent = false);
84 
85 extern OCTINTERP_API void
87 
89 get_top_level_value (const std::string& nm, bool silent = false);
90 
91 extern OCTINTERP_API void
93 
96  int nargout, const char *nm);
97 
100  int nargout, const char *nm);
101 
104  int nargout, const char *nm,
105  int minval = std::numeric_limits<int>::min (),
106  int maxval = std::numeric_limits<int>::max ());
107 
109 set_internal_variable (double& var, const octave_value_list& args,
110  int nargout, const char *nm,
111  double minval = -octave::numeric_limits<double>::Inf (),
112  double maxval = octave::numeric_limits<double>::Inf ());
113 
116  int nargout, const char *nm, bool empty_ok = true);
117 
120  int nargout, const char *nm, const char **choices);
121 
123 set_internal_variable (int& var, const octave_value_list& args,
124  int nargout, const char *nm, const char **choices);
125 
126 #define SET_INTERNAL_VARIABLE(NM) \
127  set_internal_variable (V ## NM, args, nargout, #NM)
128 
129 #define SET_NONEMPTY_INTERNAL_STRING_VARIABLE(NM) \
130  set_internal_variable (V ## NM, args, nargout, #NM, false)
131 
132 #define SET_INTERNAL_VARIABLE_WITH_LIMITS(NM, MINVAL, MAXVAL) \
133  set_internal_variable (V ## NM, args, nargout, #NM, MINVAL, MAXVAL)
134 
135 // in the following, CHOICES must be a C string array terminated by null.
136 #define SET_INTERNAL_VARIABLE_CHOICES(NM, CHOICES) \
137  set_internal_variable (V ## NM, args, nargout, #NM, CHOICES)
138 
141  double&);
143 
144 extern OCTINTERP_API void bind_ans (const octave_value& val, bool print);
145 
146 OCTAVE_DEPRECATED ("note: internal variables have been replaced by functions; use 'feval' instead")
147 OCTINTERP_API extern void
148 bind_internal_variable (const std::string& fname, const octave_value& val);
149 
150 extern OCTINTERP_API void mlock (void);
151 extern OCTINTERP_API void munlock (const std::string&);
152 extern OCTINTERP_API bool mislocked (const std::string&);
153 
154 extern OCTINTERP_API void clear_function (const std::string& nm);
155 extern OCTINTERP_API void clear_variable (const std::string& nm);
156 extern OCTINTERP_API void clear_symbol (const std::string& nm);
157 
158 extern OCTINTERP_API void maybe_missing_function_hook (const std::string& name);
159 
160 #endif
OCTINTERP_API void clear_function(const std::string &nm)
Definition: variables.cc:79
OCTINTERP_API void set_top_level_value(const std::string &nm, const octave_value &val)
OCTINTERP_API void clear_symbol(const std::string &nm)
Definition: variables.cc:91
OCTINTERP_API int symbol_exist(const std::string &name, const std::string &type="any")
Definition: variables.cc:382
OCTINTERP_API string_vector generate_struct_completions(const std::string &text, std::string &prefix, std::string &hint)
Definition: variables.cc:236
fname
Definition: load-save.cc:754
in that an updated permutation matrix is returned Note that if var
Definition: lu.cc:606
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:5068
OCTINTERP_API void clear_variable(const std::string &nm)
Definition: variables.cc:85
OCTINTERP_API std::string unique_symbol_name(const std::string &basename)
Definition: variables.cc:491
STL namespace.
OCTINTERP_API void maybe_missing_function_hook(const std::string &name)
Definition: variables.cc:2268
OCTINTERP_API std::string builtin_string_variable(const std::string &)
octave_value arg
Definition: pr-output.cc:3440
JNIEnv void * args
Definition: ov-java.cc:67
OCTINTERP_API octave_value get_top_level_value(const std::string &nm, bool silent=false)
OCTINTERP_API bool looks_like_struct(const std::string &text, char prev_char)
Definition: variables.cc:305
OCTAVE_EXPORT octave_value_list any number nd example oindent prints the prompt xample Pick a any number!nd example oindent and waits for the user to enter a value The string entered by the user is evaluated as an so it may be a literal a variable name
Definition: input.cc:871
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
Definition: utils.cc:941
static std::string basename(const std::string &s, bool strip_path=false)
Definition: mkoctfile.cc:342
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
Definition: ov-usr-fcn.cc:935
#define OCTINTERP_API
Definition: mexproto.h:69
OCTINTERP_API bool mislocked(const std::string &)
OCTINTERP_API octave_function * extract_function(const octave_value &arg, const std::string &warn_for, const std::string &fname, const std::string &header, const std::string &trailer)
Definition: variables.cc:145
OCTINTERP_API octave_value set_internal_variable(bool &var, const octave_value_list &args, int nargout, const char *nm)
OCTINTERP_API octave_function * is_valid_function(const octave_value &, const std::string &="", bool warn=false)
Definition: variables.cc:123
OCTINTERP_API octave_value lookup_function_handle(const std::string &nm)
OCTINTERP_API void munlock(const std::string &)
OCTINTERP_API void bind_ans(const octave_value &val, bool print)
idx type
Definition: ov.cc:3129
OCTINTERP_API void set_global_value(const std::string &nm, const octave_value &val)
OCTINTERP_API octave_value builtin_any_variable(const std::string &)
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:228
#define Inf
Definition: Faddeeva.cc:247
OCTINTERP_API octave_value get_global_value(const std::string &nm, bool silent=false)
OCTINTERP_API string_vector get_struct_elts(const std::string &text)
Definition: variables.cc:184
OCTINTERP_API void bind_internal_variable(const std::string &fname, const octave_value &val)
OCTINTERP_API int builtin_real_scalar_variable(const std::string &, double &)
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:854
OCTINTERP_API void clear_mex_functions(void)
Definition: variables.cc:73
charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:205
OCTINTERP_API void mlock(void)