1
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
1
|
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 |
7016
|
9 Free Software Foundation; either version 3 of the License, or (at your |
|
10 option) any later version. |
1
|
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 |
7016
|
18 along with Octave; see the file COPYING. If not, see |
|
19 <http://www.gnu.org/licenses/>. |
1
|
20 |
|
21 */ |
|
22 |
383
|
23 #if !defined (octave_variables_h) |
|
24 #define octave_variables_h 1 |
1
|
25 |
2975
|
26 class octave_function; |
4700
|
27 class octave_user_function; |
1
|
28 class symbol_record; |
|
29 class symbol_table; |
1738
|
30 |
2390
|
31 class tree_identifier; |
2086
|
32 class octave_value; |
|
33 class octave_value_list; |
2892
|
34 class octave_builtin; |
|
35 class octave_mapper; |
1755
|
36 class string_vector; |
|
37 |
5794
|
38 #include <climits> |
|
39 #include <cfloat> |
|
40 |
1755
|
41 #include <string> |
1
|
42 |
2390
|
43 #include "ov.h" |
2975
|
44 #include "ov-builtin.h" |
2953
|
45 #include "symtab.h" |
195
|
46 |
6109
|
47 extern OCTINTERP_API bool at_top_level (void); |
4700
|
48 |
6109
|
49 extern OCTINTERP_API void initialize_symbol_tables (void); |
|
50 extern OCTINTERP_API void clear_mex_functions (void); |
195
|
51 |
6109
|
52 extern OCTINTERP_API bool is_command_name (const std::string&); |
5685
|
53 |
|
54 // The next three are here temporarily... |
6109
|
55 extern OCTINTERP_API bool is_marked_as_rawcommand (const std::string& s); |
|
56 extern OCTINTERP_API void mark_as_rawcommand (const std::string& s); |
|
57 extern OCTINTERP_API void unmark_rawcommand (const std::string& s); |
5685
|
58 |
6109
|
59 extern OCTINTERP_API bool is_rawcommand_name (const std::string&); |
|
60 extern OCTINTERP_API bool is_mapper_function_name (const std::string&); |
|
61 extern OCTINTERP_API bool is_builtin_function_name (const std::string&); |
|
62 extern OCTINTERP_API bool is_globally_visible (const std::string&); |
593
|
63 |
6109
|
64 extern OCTINTERP_API octave_function * |
3523
|
65 is_valid_function (const octave_value&, const std::string& = std::string (), |
3308
|
66 bool warn = false); |
593
|
67 |
6109
|
68 extern OCTINTERP_API octave_function * |
3523
|
69 is_valid_function (const std::string&, const std::string& = std::string (), |
3308
|
70 bool warn = false); |
3178
|
71 |
6109
|
72 extern OCTINTERP_API octave_function * |
3523
|
73 extract_function (const octave_value& arg, const std::string& warn_for, |
|
74 const std::string& fname, const std::string& header, |
|
75 const std::string& trailer); |
2796
|
76 |
6109
|
77 extern OCTINTERP_API string_vector |
3523
|
78 get_struct_elts (const std::string& text); |
2921
|
79 |
6109
|
80 extern OCTINTERP_API string_vector |
3523
|
81 generate_struct_completions (const std::string& text, std::string& prefix, |
|
82 std::string& hint); |
3020
|
83 |
6109
|
84 extern OCTINTERP_API bool |
3523
|
85 looks_like_struct (const std::string& text); |
2921
|
86 |
6109
|
87 extern OCTINTERP_API int |
4930
|
88 symbol_exist (const std::string& name, const std::string& type = "any"); |
4319
|
89 |
6109
|
90 extern OCTINTERP_API std::string |
4954
|
91 unique_symbol_name (const std::string& basename); |
|
92 |
6109
|
93 extern OCTINTERP_API bool |
5663
|
94 fcn_out_of_date (octave_function *fcn, const std::string& ff, time_t tp); |
|
95 |
6109
|
96 extern OCTINTERP_API bool lookup (symbol_record *s, bool exec_script = true); |
3020
|
97 |
6109
|
98 extern OCTINTERP_API symbol_record * |
3523
|
99 lookup_by_name (const std::string& nm, bool exec_script = true); |
3020
|
100 |
6323
|
101 extern OCTINTERP_API octave_value |
|
102 lookup_function (const std::string& nm, |
|
103 const std::string& parent = std::string ()); |
4342
|
104 |
6109
|
105 extern OCTINTERP_API octave_value lookup_user_function (const std::string& nm); |
4700
|
106 |
6109
|
107 extern OCTINTERP_API octave_value lookup_function_handle (const std::string& nm); |
4988
|
108 |
6109
|
109 extern OCTINTERP_API octave_value |
5027
|
110 get_global_value (const std::string& nm, bool silent = false); |
3020
|
111 |
6109
|
112 extern OCTINTERP_API void set_global_value (const std::string& nm, const octave_value& val); |
3020
|
113 |
6109
|
114 extern OCTINTERP_API octave_value |
5791
|
115 set_internal_variable (bool& var, const octave_value_list& args, |
5794
|
116 int nargout, const char *nm); |
|
117 |
6109
|
118 extern OCTINTERP_API octave_value |
5794
|
119 set_internal_variable (char& var, const octave_value_list& args, |
|
120 int nargout, const char *nm); |
|
121 |
6109
|
122 extern OCTINTERP_API octave_value |
5794
|
123 set_internal_variable (int& var, const octave_value_list& args, |
|
124 int nargout, const char *nm, |
|
125 int minval = INT_MIN, int maxval = INT_MAX); |
|
126 |
6109
|
127 extern OCTINTERP_API octave_value |
5794
|
128 set_internal_variable (double& var, const octave_value_list& args, |
|
129 int nargout, const char *nm, |
|
130 double minval = DBL_MIN, double maxval = DBL_MAX); |
5791
|
131 |
6109
|
132 extern OCTINTERP_API octave_value |
5791
|
133 set_internal_variable (std::string& var, const octave_value_list& args, |
5794
|
134 int nargout, const char *nm, bool empty_ok = true); |
|
135 |
|
136 #define SET_INTERNAL_VARIABLE(NM) \ |
|
137 set_internal_variable (V ## NM, args, nargout, #NM) |
5791
|
138 |
5794
|
139 #define SET_NONEMPTY_INTERNAL_STRING_VARIABLE(NM) \ |
|
140 set_internal_variable (V ## NM, args, nargout, #NM, false) |
|
141 |
|
142 #define SET_INTERNAL_VARIABLE_WITH_LIMITS(NM, MINVAL, MAXVAL) \ |
|
143 set_internal_variable (V ## NM, args, nargout, #NM, MINVAL, MAXVAL) |
5791
|
144 |
6109
|
145 extern OCTINTERP_API std::string builtin_string_variable (const std::string&); |
|
146 extern OCTINTERP_API int builtin_real_scalar_variable (const std::string&, double&); |
|
147 extern OCTINTERP_API octave_value builtin_any_variable (const std::string&); |
3020
|
148 |
6109
|
149 extern OCTINTERP_API void link_to_global_variable (symbol_record *sr); |
|
150 extern OCTINTERP_API void link_to_builtin_or_function (symbol_record *sr); |
3020
|
151 |
6109
|
152 extern OCTINTERP_API void force_link_to_function (const std::string&); |
2921
|
153 |
6109
|
154 extern OCTINTERP_API void bind_ans (const octave_value& val, bool print); |
1162
|
155 |
6109
|
156 extern OCTINTERP_API void |
5794
|
157 bind_internal_variable (const std::string& fname, const octave_value& val); |
1406
|
158 |
6109
|
159 extern OCTINTERP_API void mlock (const std::string&); |
|
160 extern OCTINTERP_API void munlock (const std::string&); |
|
161 extern OCTINTERP_API bool mislocked (const std::string&); |
4016
|
162 |
6109
|
163 extern OCTINTERP_API bool clear_function (const std::string& nm); |
|
164 extern OCTINTERP_API bool clear_variable (const std::string& nm); |
|
165 extern OCTINTERP_API bool clear_symbol (const std::string& nm); |
4954
|
166 |
1
|
167 // Symbol table for symbols at the top level. |
6109
|
168 extern OCTINTERP_API symbol_table *top_level_sym_tab; |
1
|
169 |
|
170 // Symbol table for the current scope. |
6109
|
171 extern OCTINTERP_API symbol_table *curr_sym_tab; |
1
|
172 |
4245
|
173 // Symbol table for the current caller scope. |
6109
|
174 extern OCTINTERP_API symbol_table *curr_caller_sym_tab; |
4245
|
175 |
1
|
176 // Symbol table for global symbols. |
6109
|
177 extern OCTINTERP_API symbol_table *global_sym_tab; |
1
|
178 |
4009
|
179 // Symbol table for functions and built-in symbols. |
6109
|
180 extern OCTINTERP_API symbol_table *fbi_sym_tab; |
4009
|
181 |
1
|
182 #endif |
|
183 |
|
184 /* |
|
185 ;;; Local Variables: *** |
|
186 ;;; mode: C++ *** |
|
187 ;;; End: *** |
|
188 */ |