GNU Octave  6.2.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-2021 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 
39 namespace octave
40 {
41  class tree_identifier;
42 }
43 
44 #include <limits>
45 #include <string>
46 
47 #include "lo-ieee.h"
48 
49 #include "ov-builtin.h"
50 
51 extern OCTINTERP_API octave_function *
52 is_valid_function (const octave_value&, const std::string& = "",
53  bool warn = false);
54 
55 extern OCTINTERP_API octave_function *
56 is_valid_function (const std::string&, const std::string& = "",
57  bool warn = false);
58 
59 OCTAVE_DEPRECATED (6, "use 'octave::get_function_handle' instead")
60 extern OCTINTERP_API octave_function *
61 extract_function (const octave_value& arg, const std::string& warn_for,
62  const std::string& fname, const std::string& header,
63  const std::string& trailer);
64 
65 extern OCTINTERP_API int
66 symbol_exist (const std::string& name, const std::string& type = "any");
67 
68 extern OCTINTERP_API std::string
69 unique_symbol_name (const std::string& basename);
70 
71 extern OCTINTERP_API octave_value
72 set_internal_variable (bool& var, const octave_value_list& args,
73  int nargout, const char *nm);
74 
75 extern OCTINTERP_API octave_value
76 set_internal_variable (char& var, const octave_value_list& args,
77  int nargout, const char *nm);
78 
79 extern OCTINTERP_API octave_value
80 set_internal_variable (int& var, const octave_value_list& args,
81  int nargout, const char *nm,
82  int minval = std::numeric_limits<int>::min (),
83  int maxval = std::numeric_limits<int>::max ());
84 
85 extern OCTINTERP_API octave_value
86 set_internal_variable (double& var, const octave_value_list& args,
87  int nargout, const char *nm,
88  double minval = -octave::numeric_limits<double>::Inf (),
89  double maxval = octave::numeric_limits<double>::Inf ());
90 
91 extern OCTINTERP_API octave_value
92 set_internal_variable (std::string& var, const octave_value_list& args,
93  int nargout, const char *nm, bool empty_ok = true);
94 
95 extern OCTINTERP_API octave_value
96 set_internal_variable (std::string& var, const octave_value_list& args,
97  int nargout, const char *nm, const char **choices);
98 
99 extern OCTINTERP_API octave_value
100 set_internal_variable (int& var, const octave_value_list& args,
101  int nargout, const char *nm, const char **choices);
102 
103 #define SET_INTERNAL_VARIABLE(NM) \
104  set_internal_variable (V ## NM, args, nargout, #NM)
105 
106 #define SET_NONEMPTY_INTERNAL_STRING_VARIABLE(NM) \
107  set_internal_variable (V ## NM, args, nargout, #NM, false)
108 
109 #define SET_INTERNAL_VARIABLE_WITH_LIMITS(NM, MINVAL, MAXVAL) \
110  set_internal_variable (V ## NM, args, nargout, #NM, MINVAL, MAXVAL)
111 
112 // in the following, CHOICES must be a C string array terminated by null.
113 #define SET_INTERNAL_VARIABLE_CHOICES(NM, CHOICES) \
114  set_internal_variable (V ## NM, args, nargout, #NM, CHOICES)
115 
116 extern OCTINTERP_API std::string
117 maybe_missing_function_hook (const std::string& name);
118 
119 OCTAVE_DEPRECATED (5, "this function will be removed in a future version of Octave")
120 extern OCTINTERP_API string_vector
121 get_struct_elts (const std::string& text);
122 
123 #endif
#define Inf
Definition: Faddeeva.cc:247
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:230
charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:207
QString name
static std::string basename(const std::string &s, bool strip_path=false)
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:124
OCTINTERP_API string_vector get_struct_elts(const std::string &text)
Definition: variables.cc:1527
OCTINTERP_API std::string unique_symbol_name(const std::string &basename)
Definition: variables.cc:370
OCTINTERP_API std::string maybe_missing_function_hook(const std::string &name)
Definition: variables.cc:1433
OCTINTERP_API int symbol_exist(const std::string &name, const std::string &type="any")
Definition: variables.cc:358
OCTINTERP_API octave_value set_internal_variable(bool &var, const octave_value_list &args, int nargout, const char *nm)
Definition: variables.cc:608
OCTINTERP_API octave_function * is_valid_function(const octave_value &, const std::string &="", bool warn=false)
Definition: variables.cc:102