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 |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1
|
20 |
|
21 */ |
|
22 |
383
|
23 #if !defined (octave_variables_h) |
|
24 #define octave_variables_h 1 |
1
|
25 |
2892
|
26 class octave_symbol; |
1
|
27 class symbol_record; |
|
28 class symbol_table; |
1738
|
29 |
2390
|
30 class tree_identifier; |
|
31 class tree_indirect_ref; |
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 |
|
38 #include <string> |
1
|
39 |
2390
|
40 #include "ov.h" |
2953
|
41 #include "symtab.h" |
195
|
42 |
529
|
43 struct builtin_variable |
|
44 { |
2856
|
45 builtin_variable (const string& n, const octave_value& v, bool iaf, |
|
46 bool p, bool e, sv_Function svf, const string& h) |
1755
|
47 : name (n), value (v), install_as_function (iaf), protect (p), |
2953
|
48 eternal (e), sv_fcn (svf), help_string (h) { } |
1755
|
49 |
|
50 string name; |
2390
|
51 octave_value value; |
2856
|
52 bool install_as_function; |
|
53 bool protect; |
|
54 bool eternal; |
2953
|
55 symbol_record::sv_function sv_fcn; |
1755
|
56 string help_string; |
529
|
57 }; |
|
58 |
2086
|
59 typedef octave_value_list (*Octave_builtin_fcn)(const octave_value_list&, int); |
529
|
60 |
195
|
61 extern void initialize_symbol_tables (void); |
|
62 |
2856
|
63 extern bool lookup (symbol_record *s, bool exec_script = true); |
581
|
64 |
2856
|
65 extern symbol_record *lookup_by_name (const string& nm, |
|
66 bool exec_script = true); |
581
|
67 |
2849
|
68 extern octave_value get_global_value (const string& nm); |
|
69 |
|
70 extern void set_global_value (const string& nm, const octave_value& val); |
|
71 |
1755
|
72 extern string get_help_from_file (const string& f); |
991
|
73 |
1755
|
74 extern string builtin_string_variable (const string&); |
|
75 extern int builtin_real_scalar_variable (const string&, double&); |
2086
|
76 extern octave_value builtin_any_variable (const string&); |
593
|
77 |
|
78 extern void link_to_global_variable (symbol_record *sr); |
|
79 extern void link_to_builtin_variable (symbol_record *sr); |
|
80 extern void link_to_builtin_or_function (symbol_record *sr); |
|
81 |
1755
|
82 extern void force_link_to_function (const string&); |
593
|
83 |
1827
|
84 extern bool is_builtin_variable (const string&); |
|
85 extern bool is_text_function_name (const string&); |
2293
|
86 extern bool is_mapper_function_name (const string&); |
|
87 extern bool is_builtin_function_name (const string&); |
1827
|
88 extern bool is_globally_visible (const string&); |
593
|
89 |
2892
|
90 extern octave_symbol * |
|
91 is_valid_function (const octave_value&, const string&, bool warn = false); |
593
|
92 |
2921
|
93 extern octave_symbol * |
2892
|
94 extract_function (const octave_value& arg, const string& warn_for, |
|
95 const string& fname, const string& header, |
|
96 const string& trailer); |
2796
|
97 |
2921
|
98 extern string_vector |
|
99 get_struct_elts (const string& text); |
|
100 |
|
101 extern bool |
|
102 looks_like_struct (const string& text); |
|
103 |
|
104 extern string_vector |
|
105 generate_struct_completions (const string& text, string& prefix, |
|
106 string& hint); |
|
107 |
1755
|
108 extern string_vector make_name_list (void); |
195
|
109 |
2892
|
110 extern void |
|
111 install_builtin_mapper (octave_mapper *mf); |
195
|
112 |
2892
|
113 extern void |
|
114 install_builtin_function (octave_builtin *f, bool is_text_fcn = false); |
195
|
115 |
2892
|
116 extern void |
|
117 install_builtin_variable (const builtin_variable& v); |
195
|
118 |
1755
|
119 extern void |
2390
|
120 install_builtin_variable_as_function (const string& name, |
|
121 const octave_value& val, |
2856
|
122 bool protect = false, |
|
123 bool eternal = false, |
2390
|
124 const string& help = string ()); |
1755
|
125 |
|
126 extern void alias_builtin (const string& alias, const string& name); |
548
|
127 |
2856
|
128 extern void bind_ans (const octave_value& val, bool print); |
1162
|
129 |
1489
|
130 extern void bind_global_error_variable (void); |
|
131 |
|
132 extern void clear_global_error_variable (void *); |
|
133 |
2892
|
134 extern void |
|
135 bind_builtin_variable (const string&, const octave_value&, |
|
136 bool protect = false, bool eternal = false, |
2953
|
137 symbol_record::sv_function f = 0, |
2892
|
138 const string& help = string ()); |
1406
|
139 |
1
|
140 // Symbol table for symbols at the top level. |
|
141 extern symbol_table *top_level_sym_tab; |
|
142 |
|
143 // Symbol table for the current scope. |
|
144 extern symbol_table *curr_sym_tab; |
|
145 |
|
146 // Symbol table for global symbols. |
|
147 extern symbol_table *global_sym_tab; |
|
148 |
2204
|
149 enum echo_state |
|
150 { |
|
151 ECHO_OFF = 0, |
|
152 ECHO_SCRIPTS = 1, |
|
153 ECHO_FUNCTIONS = 2, |
|
154 ECHO_CMD_LINE = 4 |
|
155 }; |
|
156 |
|
157 extern int Vecho_executing_commands; |
|
158 |
1
|
159 #endif |
|
160 |
|
161 /* |
|
162 ;;; Local Variables: *** |
|
163 ;;; mode: C++ *** |
|
164 ;;; End: *** |
|
165 */ |