1
|
1 /* |
|
2 |
1884
|
3 Copyright (C) 1996 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 |
|
26 class symbol_record; |
|
27 class symbol_table; |
1738
|
28 |
490
|
29 class tree_fvc; |
2086
|
30 class octave_value; |
|
31 class octave_value_list; |
1755
|
32 class string_vector; |
|
33 |
|
34 #include <string> |
1
|
35 |
529
|
36 struct builtin_mapper_function; |
|
37 |
|
38 typedef int (*sv_Function)(void); |
195
|
39 |
529
|
40 struct builtin_variable |
|
41 { |
2086
|
42 builtin_variable (const string& n, octave_value *v, int iaf, int p, |
1755
|
43 int e, sv_Function svf, const string& h) |
|
44 : name (n), value (v), install_as_function (iaf), protect (p), |
|
45 eternal (e), sv_function (svf), help_string (h) { } |
|
46 |
|
47 string name; |
2086
|
48 octave_value *value; |
529
|
49 int install_as_function; |
|
50 int protect; |
|
51 int eternal; |
|
52 sv_Function sv_function; |
1755
|
53 string help_string; |
529
|
54 }; |
|
55 |
2086
|
56 typedef octave_value_list (*Octave_builtin_fcn)(const octave_value_list&, int); |
529
|
57 |
|
58 struct builtin_function |
|
59 { |
1755
|
60 builtin_function (const string& n, int itf, Octave_builtin_fcn f, |
|
61 const string& h) |
|
62 : name (n), is_text_fcn (itf), fcn (f), help_string (h) { } |
|
63 |
|
64 string name; |
529
|
65 int is_text_fcn; |
|
66 Octave_builtin_fcn fcn; |
1755
|
67 string help_string; |
529
|
68 }; |
195
|
69 |
|
70 extern void initialize_symbol_tables (void); |
|
71 |
1827
|
72 extern bool lookup (symbol_record *s, int exec_script = 1); |
581
|
73 |
1755
|
74 extern symbol_record *lookup_by_name (const string& nm, int exec_script = 1); |
581
|
75 |
1755
|
76 extern string get_help_from_file (const string& f); |
991
|
77 |
1755
|
78 extern string builtin_string_variable (const string&); |
|
79 extern int builtin_real_scalar_variable (const string&, double&); |
2086
|
80 extern octave_value builtin_any_variable (const string&); |
593
|
81 |
|
82 extern void link_to_global_variable (symbol_record *sr); |
|
83 extern void link_to_builtin_variable (symbol_record *sr); |
|
84 extern void link_to_builtin_or_function (symbol_record *sr); |
|
85 |
1755
|
86 extern void force_link_to_function (const string&); |
593
|
87 |
1827
|
88 extern bool is_builtin_variable (const string&); |
|
89 extern bool is_text_function_name (const string&); |
2293
|
90 extern bool is_mapper_function_name (const string&); |
|
91 extern bool is_builtin_function_name (const string&); |
1827
|
92 extern bool is_globally_visible (const string&); |
593
|
93 |
2086
|
94 extern tree_fvc *is_valid_function (const octave_value&, const string&, |
593
|
95 int warn = 0); |
|
96 |
1755
|
97 extern string_vector make_name_list (void); |
195
|
98 |
1755
|
99 extern void install_builtin_mapper (const builtin_mapper_function& mf); |
195
|
100 |
1755
|
101 extern void install_builtin_function (const builtin_function& gf); |
195
|
102 |
1755
|
103 extern void install_builtin_variable (const builtin_variable& v); |
195
|
104 |
1755
|
105 extern void |
|
106 install_builtin_variable_as_function |
2086
|
107 (const string& name, octave_value *val, int protect = 0, |
1755
|
108 int eternal = 0, const string& help = string ()); |
|
109 |
|
110 extern void alias_builtin (const string& alias, const string& name); |
548
|
111 |
1160
|
112 #if 0 |
195
|
113 extern void bind_nargin_and_nargout (symbol_table *sym_tab, |
|
114 int nargin, int nargout); |
1160
|
115 #endif |
195
|
116 |
2086
|
117 extern void bind_ans (const octave_value& val, int print); |
1162
|
118 |
1489
|
119 extern void bind_global_error_variable (void); |
|
120 |
|
121 extern void clear_global_error_variable (void *); |
|
122 |
2086
|
123 extern void bind_builtin_variable (const string&, octave_value *, |
195
|
124 int protect = 0, int eternal = 0, |
|
125 sv_Function f = (sv_Function) 0, |
1755
|
126 const string& help = string ()); |
195
|
127 |
2086
|
128 extern void bind_builtin_variable (const string&, const octave_value&, |
1406
|
129 int protect = 0, int eternal = 0, |
|
130 sv_Function f = (sv_Function) 0, |
1755
|
131 const string& help = string ()); |
1406
|
132 |
529
|
133 extern void install_builtin_variables (void); |
|
134 |
1
|
135 // Symbol table for symbols at the top level. |
|
136 extern symbol_table *top_level_sym_tab; |
|
137 |
|
138 // Symbol table for the current scope. |
|
139 extern symbol_table *curr_sym_tab; |
|
140 |
|
141 // Symbol table for global symbols. |
|
142 extern symbol_table *global_sym_tab; |
|
143 |
2204
|
144 enum echo_state |
|
145 { |
|
146 ECHO_OFF = 0, |
|
147 ECHO_SCRIPTS = 1, |
|
148 ECHO_FUNCTIONS = 2, |
|
149 ECHO_CMD_LINE = 4 |
|
150 }; |
|
151 |
|
152 extern int Vecho_executing_commands; |
|
153 |
1
|
154 #endif |
|
155 |
|
156 /* |
|
157 ;;; Local Variables: *** |
|
158 ;;; mode: C++ *** |
|
159 ;;; End: *** |
|
160 */ |