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