GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
variables.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1993-2024 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_variables_h)
27 #define octave_variables_h 1
28 
29 #include "octave-config.h"
30 
31 class octave_function;
33 
34 class octave_value;
35 class octave_value_list;
36 class octave_builtin;
37 class string_vector;
38 
40 
41 class tree_identifier;
42 
43 OCTAVE_END_NAMESPACE(octave)
44 
45 #include <limits>
46 #include <string>
47 
48 #include "lo-ieee.h"
49 
50 #include "ov-builtin.h"
51 
52 // The following two functions should be removed or the return type
53 // should be changed when we remove octave_function from the interpreter
54 // interface. See the discussion about this topic here:
55 // https://octave.discourse.group/t/refactoring-octave-value-function-objects-backward-incompatible-change/971
56 
57 extern OCTINTERP_API octave_function *
58 is_valid_function (const octave_value&, const std::string& = "",
59  bool warn = false);
60 
61 extern OCTINTERP_API octave_function *
62 is_valid_function (const std::string&, const std::string& = "",
63  bool warn = false);
64 
66 
67 extern OCTINTERP_API int
68 symbol_exist (const std::string& name, const std::string& type = "any");
69 
70 extern OCTINTERP_API std::string
71 unique_symbol_name (const std::string& basename);
72 
73 extern OCTINTERP_API octave_value
74 set_internal_variable (bool& var, const octave_value_list& args,
75  int nargout, const char *nm);
76 
77 extern OCTINTERP_API octave_value
78 set_internal_variable (char& var, const octave_value_list& args,
79  int nargout, const char *nm);
80 
81 extern OCTINTERP_API octave_value
83  int nargout, const char *nm,
84  int minval = std::numeric_limits<int>::min (),
85  int maxval = std::numeric_limits<int>::max ());
86 
87 extern OCTINTERP_API octave_value
88 set_internal_variable (double& var, const octave_value_list& args,
89  int nargout, const char *nm,
90  double minval = -octave::numeric_limits<double>::Inf (),
91  double maxval = octave::numeric_limits<double>::Inf ());
92 
93 extern OCTINTERP_API octave_value
94 set_internal_variable (std::string& var, const octave_value_list& args,
95  int nargout, const char *nm, bool empty_ok = true);
96 
97 extern OCTINTERP_API octave_value
98 set_internal_variable (std::string& var, const octave_value_list& args,
99  int nargout, const char *nm, const char **choices);
100 
101 extern OCTINTERP_API octave_value
103  int nargout, const char *nm, const char **choices);
104 
105 extern OCTINTERP_API std::string
106 maybe_missing_function_hook (const std::string& name);
107 
108 OCTAVE_END_NAMESPACE(octave)
109 
110 // The following macros should also be considered obsolete.
111 
112 #define SET_INTERNAL_VARIABLE(NM) \
113  set_internal_variable (V ## NM, args, nargout, #NM)
114 
115 #define SET_NONEMPTY_INTERNAL_STRING_VARIABLE(NM) \
116  set_internal_variable (V ## NM, args, nargout, #NM, false)
117 
118 #define SET_INTERNAL_VARIABLE_WITH_LIMITS(NM, MINVAL, MAXVAL) \
119  set_internal_variable (V ## NM, args, nargout, #NM, MINVAL, MAXVAL)
120 
121 // in the following, CHOICES must be a C string array terminated by null.
122 #define SET_INTERNAL_VARIABLE_CHOICES(NM, CHOICES) \
123  set_internal_variable (V ## NM, args, nargout, #NM, CHOICES)
124 
125 #endif
#define Inf
Definition: Faddeeva.cc:260
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:230
charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:207
std::string name() const
Definition: pt-id.h:69
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
octave_value set_internal_variable(bool &var, const octave_value_list &args, int nargout, const char *nm)
octave_function * is_valid_function(const octave_value &, const std::string &="", bool warn=false)
Definition: variables.cc:100
int symbol_exist(const std::string &name, const std::string &type="any")
std::string maybe_missing_function_hook(const std::string &name)
std::string unique_symbol_name(const std::string &basename)