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 |
4700
|
48 extern bool at_top_level (void); |
|
49 |
195
|
50 extern void initialize_symbol_tables (void); |
6072
|
51 extern void clear_mex_functions (void); |
195
|
52 |
4208
|
53 extern bool is_command_name (const std::string&); |
5685
|
54 |
|
55 // The next three are here temporarily... |
|
56 extern bool is_marked_as_rawcommand (const std::string& s); |
|
57 extern void mark_as_rawcommand (const std::string& s); |
|
58 extern void unmark_rawcommand (const std::string& s); |
|
59 |
5102
|
60 extern bool is_rawcommand_name (const std::string&); |
3523
|
61 extern bool is_mapper_function_name (const std::string&); |
|
62 extern bool is_builtin_function_name (const std::string&); |
|
63 extern bool is_globally_visible (const std::string&); |
593
|
64 |
2975
|
65 extern octave_function * |
3523
|
66 is_valid_function (const octave_value&, const std::string& = std::string (), |
3308
|
67 bool warn = false); |
593
|
68 |
2975
|
69 extern octave_function * |
3523
|
70 is_valid_function (const std::string&, const std::string& = std::string (), |
3308
|
71 bool warn = false); |
3178
|
72 |
|
73 extern 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 |
2921
|
78 extern string_vector |
3523
|
79 get_struct_elts (const std::string& text); |
2921
|
80 |
3020
|
81 extern string_vector |
3523
|
82 generate_struct_completions (const std::string& text, std::string& prefix, |
|
83 std::string& hint); |
3020
|
84 |
2921
|
85 extern bool |
3523
|
86 looks_like_struct (const std::string& text); |
2921
|
87 |
4319
|
88 extern int |
4930
|
89 symbol_exist (const std::string& name, const std::string& type = "any"); |
4319
|
90 |
4954
|
91 extern std::string |
|
92 unique_symbol_name (const std::string& basename); |
|
93 |
5663
|
94 extern bool |
|
95 fcn_out_of_date (octave_function *fcn, const std::string& ff, time_t tp); |
|
96 |
3020
|
97 extern bool lookup (symbol_record *s, bool exec_script = true); |
|
98 |
|
99 extern symbol_record * |
3523
|
100 lookup_by_name (const std::string& nm, bool exec_script = true); |
3020
|
101 |
4930
|
102 extern octave_value lookup_function (const std::string& nm); |
4342
|
103 |
4930
|
104 extern octave_value lookup_user_function (const std::string& nm); |
4700
|
105 |
4988
|
106 extern octave_value lookup_function_handle (const std::string& nm); |
|
107 |
5027
|
108 extern octave_value |
|
109 get_global_value (const std::string& nm, bool silent = false); |
3020
|
110 |
3523
|
111 extern void set_global_value (const std::string& nm, const octave_value& val); |
3020
|
112 |
5791
|
113 extern octave_value |
|
114 set_internal_variable (bool& var, const octave_value_list& args, |
5794
|
115 int nargout, const char *nm); |
|
116 |
|
117 extern octave_value |
|
118 set_internal_variable (char& var, const octave_value_list& args, |
|
119 int nargout, const char *nm); |
|
120 |
|
121 extern octave_value |
|
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 |
|
126 extern octave_value |
|
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 |
|
131 extern octave_value |
|
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 |
3523
|
144 extern std::string builtin_string_variable (const std::string&); |
|
145 extern int builtin_real_scalar_variable (const std::string&, double&); |
|
146 extern octave_value builtin_any_variable (const std::string&); |
3020
|
147 |
|
148 extern void link_to_global_variable (symbol_record *sr); |
|
149 extern void link_to_builtin_or_function (symbol_record *sr); |
|
150 |
3523
|
151 extern void force_link_to_function (const std::string&); |
2921
|
152 |
2856
|
153 extern void bind_ans (const octave_value& val, bool print); |
1162
|
154 |
2892
|
155 extern void |
5794
|
156 bind_internal_variable (const std::string& fname, const octave_value& val); |
1406
|
157 |
4319
|
158 extern void mlock (const std::string&); |
|
159 extern void munlock (const std::string&); |
|
160 extern bool mislocked (const std::string&); |
4016
|
161 |
4954
|
162 extern bool clear_function (const std::string& nm); |
4988
|
163 extern bool clear_variable (const std::string& nm); |
|
164 extern bool clear_symbol (const std::string& nm); |
4954
|
165 |
1
|
166 // Symbol table for symbols at the top level. |
|
167 extern symbol_table *top_level_sym_tab; |
|
168 |
|
169 // Symbol table for the current scope. |
|
170 extern symbol_table *curr_sym_tab; |
|
171 |
4245
|
172 // Symbol table for the current caller scope. |
|
173 extern symbol_table *curr_caller_sym_tab; |
|
174 |
1
|
175 // Symbol table for global symbols. |
|
176 extern symbol_table *global_sym_tab; |
|
177 |
4009
|
178 // Symbol table for functions and built-in symbols. |
|
179 extern symbol_table *fbi_sym_tab; |
|
180 |
1
|
181 #endif |
|
182 |
|
183 /* |
|
184 ;;; Local Variables: *** |
|
185 ;;; mode: C++ *** |
|
186 ;;; End: *** |
|
187 */ |