1
|
1 // variables.h -*- C++ -*- |
|
2 /* |
|
3 |
1009
|
4 Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton |
1
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1
|
21 |
|
22 */ |
|
23 |
383
|
24 #if !defined (octave_variables_h) |
|
25 #define octave_variables_h 1 |
1
|
26 |
|
27 class symbol_record; |
|
28 class symbol_table; |
1738
|
29 |
490
|
30 class tree_fvc; |
1
|
31 class tree_constant; |
529
|
32 class Octave_object; |
1755
|
33 class string_vector; |
|
34 |
|
35 #include <string> |
1
|
36 |
529
|
37 struct builtin_mapper_function; |
|
38 |
|
39 typedef int (*sv_Function)(void); |
195
|
40 |
529
|
41 struct builtin_variable |
|
42 { |
1755
|
43 builtin_variable (const string& n, tree_constant *v, int iaf, int p, |
|
44 int e, sv_Function svf, const string& h) |
|
45 : name (n), value (v), install_as_function (iaf), protect (p), |
|
46 eternal (e), sv_function (svf), help_string (h) { } |
|
47 |
|
48 string name; |
529
|
49 tree_constant *value; |
|
50 int install_as_function; |
|
51 int protect; |
|
52 int eternal; |
|
53 sv_Function sv_function; |
1755
|
54 string help_string; |
529
|
55 }; |
|
56 |
|
57 typedef Octave_object (*Octave_builtin_fcn)(const Octave_object&, int); |
|
58 |
|
59 struct builtin_function |
|
60 { |
1755
|
61 builtin_function (const string& n, int itf, Octave_builtin_fcn f, |
|
62 const string& h) |
|
63 : name (n), is_text_fcn (itf), fcn (f), help_string (h) { } |
|
64 |
|
65 string name; |
529
|
66 int is_text_fcn; |
|
67 Octave_builtin_fcn fcn; |
1755
|
68 string help_string; |
529
|
69 }; |
195
|
70 |
|
71 extern void initialize_symbol_tables (void); |
|
72 |
581
|
73 extern int lookup (symbol_record *s, int exec_script = 1); |
|
74 |
1755
|
75 extern symbol_record *lookup_by_name (const string& nm, int exec_script = 1); |
581
|
76 |
1755
|
77 extern string get_help_from_file (const string& f); |
991
|
78 |
1755
|
79 extern string builtin_string_variable (const string&); |
|
80 extern int builtin_real_scalar_variable (const string&, double&); |
|
81 extern tree_constant builtin_any_variable (const string&); |
593
|
82 |
|
83 extern void link_to_global_variable (symbol_record *sr); |
|
84 extern void link_to_builtin_variable (symbol_record *sr); |
|
85 extern void link_to_builtin_or_function (symbol_record *sr); |
|
86 |
1755
|
87 extern void force_link_to_function (const string&); |
593
|
88 |
1755
|
89 extern int is_builtin_variable (const string&); |
|
90 extern int is_text_function_name (const string&); |
|
91 extern int is_globally_visible (const string&); |
593
|
92 |
1755
|
93 extern tree_fvc *is_valid_function (const tree_constant&, const string&, |
593
|
94 int warn = 0); |
|
95 |
1755
|
96 extern string_vector make_name_list (void); |
195
|
97 |
1755
|
98 extern void install_builtin_mapper (const builtin_mapper_function& mf); |
195
|
99 |
1755
|
100 extern void install_builtin_function (const builtin_function& gf); |
195
|
101 |
1755
|
102 extern void install_builtin_variable (const builtin_variable& v); |
195
|
103 |
1755
|
104 extern void |
|
105 install_builtin_variable_as_function |
|
106 (const string& name, tree_constant *val, int protect = 0, |
|
107 int eternal = 0, const string& help = string ()); |
|
108 |
|
109 extern void alias_builtin (const string& alias, const string& name); |
548
|
110 |
1160
|
111 #if 0 |
195
|
112 extern void bind_nargin_and_nargout (symbol_table *sym_tab, |
|
113 int nargin, int nargout); |
1160
|
114 #endif |
195
|
115 |
1162
|
116 extern void bind_ans (const tree_constant& val, int print); |
|
117 |
1489
|
118 extern void bind_global_error_variable (void); |
|
119 |
|
120 extern void clear_global_error_variable (void *); |
|
121 |
1755
|
122 extern void bind_builtin_variable (const string&, tree_constant *, |
195
|
123 int protect = 0, int eternal = 0, |
|
124 sv_Function f = (sv_Function) 0, |
1755
|
125 const string& help = string ()); |
195
|
126 |
1755
|
127 extern void bind_builtin_variable (const string&, const tree_constant&, |
1406
|
128 int protect = 0, int eternal = 0, |
|
129 sv_Function f = (sv_Function) 0, |
1755
|
130 const string& help = string ()); |
1406
|
131 |
529
|
132 extern void install_builtin_variables (void); |
|
133 |
1755
|
134 extern string maybe_add_default_load_path (const string& p); |
1121
|
135 |
1755
|
136 extern string octave_lib_dir (void); |
|
137 extern string octave_arch_lib_dir (void); |
|
138 extern string octave_fcn_file_dir (void); |
|
139 extern string octave_bin_dir (void); |
|
140 extern string default_exec_path (void); |
|
141 extern string default_path (void); |
|
142 extern string default_info_file (void); |
|
143 extern string default_info_prog (void); |
|
144 extern string default_editor (void); |
|
145 extern string get_local_site_defaults (void); |
|
146 extern string get_site_defaults (void); |
529
|
147 |
1
|
148 // Symbol table for symbols at the top level. |
|
149 extern symbol_table *top_level_sym_tab; |
|
150 |
|
151 // Symbol table for the current scope. |
|
152 extern symbol_table *curr_sym_tab; |
|
153 |
|
154 // Symbol table for global symbols. |
|
155 extern symbol_table *global_sym_tab; |
|
156 |
|
157 #endif |
|
158 |
|
159 /* |
|
160 ;;; Local Variables: *** |
|
161 ;;; mode: C++ *** |
|
162 ;;; page-delimiter: "^/\\*" *** |
|
163 ;;; End: *** |
|
164 */ |