GNU Octave  3.8.0
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-2013 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 class octave_function;
28 
29 class tree_identifier;
30 class octave_value;
31 class octave_value_list;
32 class octave_builtin;
33 class string_vector;
34 
35 #include <cfloat>
36 
37 #include <limits>
38 #include <string>
39 
40 #include "lo-ieee.h"
41 
42 #include "ov.h"
43 #include "ov-builtin.h"
44 #include "symtab.h"
45 
46 extern OCTINTERP_API void clear_mex_functions (void);
47 
49 is_valid_function (const octave_value&, const std::string& = std::string (),
50  bool warn = false);
51 
53 is_valid_function (const std::string&, const std::string& = std::string (),
54  bool warn = false);
55 
57 extract_function (const octave_value& arg, const std::string& warn_for,
58  const std::string& fname, const std::string& header,
59  const std::string& trailer);
60 
62 get_struct_elts (const std::string& text);
63 
65 generate_struct_completions (const std::string& text, std::string& prefix,
66  std::string& hint);
67 
68 extern OCTINTERP_API bool
69 looks_like_struct (const std::string& text);
70 
71 extern OCTINTERP_API int
72 symbol_exist (const std::string& name, const std::string& type = "any");
73 
74 extern OCTINTERP_API std::string
75 unique_symbol_name (const std::string& basename);
76 
78 lookup_function_handle (const std::string& nm);
79 
81 get_global_value (const std::string& nm, bool silent = false);
82 
83 extern OCTINTERP_API void
84 set_global_value (const std::string& nm, const octave_value& val);
85 
87 get_top_level_value (const std::string& nm, bool silent = false);
88 
89 extern OCTINTERP_API void
90 set_top_level_value (const std::string& nm, const octave_value& val);
91 
93 set_internal_variable (bool& var, const octave_value_list& args,
94  int nargout, const char *nm);
95 
97 set_internal_variable (char& var, const octave_value_list& args,
98  int nargout, const char *nm);
99 
101 set_internal_variable (int& var, const octave_value_list& args,
102  int nargout, const char *nm,
103  int minval = std::numeric_limits<int>::min (),
104  int maxval = std::numeric_limits<int>::max ());
105 
107 set_internal_variable (double& var, const octave_value_list& args,
108  int nargout, const char *nm,
109  double minval = -octave_Inf,
110  double maxval = octave_Inf);
111 
113 set_internal_variable (std::string& var, const octave_value_list& args,
114  int nargout, const char *nm, bool empty_ok = true);
115 
117 set_internal_variable (int& var, const octave_value_list& args,
118  int nargout, const char *nm, const char **choices);
119 
120 #define SET_INTERNAL_VARIABLE(NM) \
121  set_internal_variable (V ## NM, args, nargout, #NM)
122 
123 #define SET_NONEMPTY_INTERNAL_STRING_VARIABLE(NM) \
124  set_internal_variable (V ## NM, args, nargout, #NM, false)
125 
126 #define SET_INTERNAL_VARIABLE_WITH_LIMITS(NM, MINVAL, MAXVAL) \
127  set_internal_variable (V ## NM, args, nargout, #NM, MINVAL, MAXVAL)
128 
129 // in the following, CHOICES must be a C string array terminated by null.
130 #define SET_INTERNAL_VARIABLE_CHOICES(NM, CHOICES) \
131  set_internal_variable (V ## NM, args, nargout, #NM, CHOICES)
132 
133 extern OCTINTERP_API std::string builtin_string_variable (const std::string&);
134 extern OCTINTERP_API int builtin_real_scalar_variable (const std::string&,
135  double&);
136 extern OCTINTERP_API octave_value builtin_any_variable (const std::string&);
137 
138 extern OCTINTERP_API void bind_ans (const octave_value& val, bool print);
139 
140 extern OCTINTERP_API void
141 bind_internal_variable (const std::string& fname,
142  const octave_value& val) GCC_ATTR_DEPRECATED;
143 
144 extern OCTINTERP_API void mlock (void);
145 extern OCTINTERP_API void munlock (const std::string&);
146 extern OCTINTERP_API bool mislocked (const std::string&);
147 
148 extern OCTINTERP_API void clear_function (const std::string& nm);
149 extern OCTINTERP_API void clear_variable (const std::string& nm);
150 extern OCTINTERP_API void clear_symbol (const std::string& nm);
151 
152 extern OCTINTERP_API void maybe_missing_function_hook (const std::string& name);
153 
154 #endif