GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
variables.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1993-2025 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
31class octave_function;
33
34class octave_value;
36class octave_builtin;
37class string_vector;
38
40
41class tree_identifier;
42
43OCTAVE_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
57extern OCTINTERP_API octave_function *
58is_valid_function (const octave_value&, const std::string& = "",
59 bool warn = false);
60
61extern OCTINTERP_API octave_function *
62is_valid_function (const std::string&, const std::string& = "",
63 bool warn = false);
64
66
67extern OCTINTERP_API int
68symbol_exist (const std::string& name, const std::string& type = "any");
69
70extern OCTINTERP_API std::string
71unique_symbol_name (const std::string& basename);
72
73extern OCTINTERP_API octave_value
74set_internal_variable (bool& var, const octave_value_list& args,
75 int nargout, const char *nm);
76
77extern OCTINTERP_API octave_value
78set_internal_variable (char& var, const octave_value_list& args,
79 int nargout, const char *nm);
80
81extern OCTINTERP_API octave_value
82set_internal_variable (int& var, const octave_value_list& args,
83 int nargout, const char *nm,
84 int minval = std::numeric_limits<int>::min (),
85 int maxval = std::numeric_limits<int>::max ());
86
87extern OCTINTERP_API octave_value
88set_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
93extern OCTINTERP_API octave_value
94set_internal_variable (std::string& var, const octave_value_list& args,
95 int nargout, const char *nm, bool empty_ok = true);
96
97extern OCTINTERP_API octave_value
98set_internal_variable (std::string& var, const octave_value_list& args,
99 int nargout, const char *nm, const char **choices);
100
101extern OCTINTERP_API octave_value
102set_internal_variable (int& var, const octave_value_list& args,
103 int nargout, const char *nm, const char **choices);
104
105extern OCTINTERP_API std::string
106maybe_missing_function_hook (const std::string& name);
107
108OCTAVE_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
std::string name() const
Definition pt-id.h:71
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)
Definition variables.cc:583
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")
Definition variables.cc:327
std::string maybe_missing_function_hook(const std::string &name)
std::string unique_symbol_name(const std::string &basename)
Definition variables.cc:339