Mercurial > octave-nkf
annotate src/ov-usr-fcn.h @ 7731:2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 24 Apr 2008 03:21:57 -0400 |
parents | 87eda1f8faaa |
children | 40c428ea3408 |
rev | line source |
---|---|
2974 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
4 2005, 2006, 2007 John W. Eaton | |
2974 | 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 | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
2974 | 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 | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
2974 | 21 |
22 */ | |
23 | |
24 #if !defined (octave_user_function_h) | |
25 #define octave_user_function_h 1 | |
26 | |
27 #include <ctime> | |
28 | |
29 #include <string> | |
4214 | 30 #include <stack> |
2974 | 31 |
3665 | 32 #include "comment-list.h" |
2974 | 33 #include "oct-obj.h" |
34 #include "ov-fcn.h" | |
35 #include "ov-typeinfo.h" | |
7336 | 36 #include "symtab.h" |
2974 | 37 |
38 class string_vector; | |
39 | |
40 class octave_value; | |
41 class tree_parameter_list; | |
42 class tree_statement_list; | |
43 class tree_va_return_list; | |
44 class tree_walker; | |
45 | |
7719
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
46 class |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
47 octave_user_code : public octave_function |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
48 { |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
49 public: |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
50 octave_user_code (void) |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
51 : octave_function () { } |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
52 |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
53 ~octave_user_code (void) { } |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
54 |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
55 bool is_user_code (void) const { return true; } |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
56 |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
57 virtual tree_statement_list *body (void) = 0; |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
58 |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
59 protected: |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
60 |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
61 octave_user_code (const std::string& nm, |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
62 const std::string& ds = std::string ()) |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
63 : octave_function (nm, ds) { } |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
64 |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
65 private: |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
66 |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
67 // No copying! |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
68 |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
69 octave_user_code (const octave_user_code& f); |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
70 |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
71 octave_user_code& operator = (const octave_user_code& f); |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
72 }; |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
73 |
5744 | 74 // Scripts. |
75 | |
76 class | |
7719
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
77 octave_user_script : public octave_user_code |
5744 | 78 { |
79 public: | |
80 | |
7731
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
81 octave_user_script (void); |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
82 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
83 octave_user_script (const std::string& fnm, const std::string& nm, |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
84 tree_statement_list *cmds, |
7731
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
85 const std::string& ds = std::string ()); |
5744 | 86 |
87 octave_user_script (const std::string& fnm, const std::string& nm, | |
7731
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
88 const std::string& ds = std::string ()); |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
89 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
90 ~octave_user_script (void); |
5744 | 91 |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
92 octave_function *function_value (bool = false) { return this; } |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
93 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
94 octave_user_script *user_script_value (bool = false) { return this; } |
5744 | 95 |
7719
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
96 octave_user_code *user_code_value (bool = false) { return this; } |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
97 |
5744 | 98 // Scripts and user functions are both considered "scripts" because |
99 // they are written in Octave's scripting language. | |
100 | |
101 bool is_user_script (void) const { return true; } | |
102 | |
103 void stash_fcn_file_name (const std::string& nm) { file_name = nm; } | |
104 | |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
105 void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; } |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
106 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
107 void stash_fcn_file_time (const octave_time& t) |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
108 { |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
109 t_parsed = t; |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
110 mark_fcn_file_up_to_date (t); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
111 } |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
112 |
5744 | 113 std::string fcn_file_name (void) const { return file_name; } |
114 | |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
115 octave_time time_parsed (void) const { return t_parsed; } |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
116 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
117 octave_time time_checked (void) const { return t_checked; } |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
118 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
119 octave_value subsref (const std::string& type, |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
120 const std::list<octave_value_list>& idx) |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
121 { |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
122 octave_value_list tmp = subsref (type, idx, 1); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
123 return tmp.length () > 0 ? tmp(0) : octave_value (); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
124 } |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
125 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
126 octave_value_list subsref (const std::string& type, |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
127 const std::list<octave_value_list>& idx, |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
128 int nargout); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
129 |
7336 | 130 octave_value_list |
131 do_multi_index_op (int nargout, const octave_value_list& args); | |
132 | |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
133 tree_statement_list *body (void) { return cmd_list; } |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
134 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
135 void traceback_error (void) const; |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
136 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
137 void accept (tree_walker& tw); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
138 |
5744 | 139 private: |
140 | |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
141 // The list of commands that make up the body of this function. |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
142 tree_statement_list *cmd_list; |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
143 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
144 // The name of the file we parsed. |
5744 | 145 std::string file_name; |
146 | |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
147 // The time the file was parsed. |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
148 octave_time t_parsed; |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
149 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
150 // The time the file was last checked to see if it needs to be |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
151 // parsed again. |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
152 octave_time t_checked; |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
153 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
154 // Used to keep track of recursion depth. |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
155 int call_depth; |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
156 |
5744 | 157 // No copying! |
158 | |
159 octave_user_script (const octave_user_script& f); | |
160 | |
161 octave_user_script& operator = (const octave_user_script& f); | |
162 | |
163 DECLARE_OCTAVE_ALLOCATOR | |
164 | |
165 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |
166 }; | |
167 | |
168 // User-defined functions. | |
2974 | 169 |
170 class | |
7719
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
171 octave_user_function : public octave_user_code |
2974 | 172 { |
173 public: | |
174 | |
7336 | 175 octave_user_function (symbol_table::scope_id sid = -1, |
176 tree_parameter_list *pl = 0, | |
2974 | 177 tree_parameter_list *rl = 0, |
7336 | 178 tree_statement_list *cl = 0); |
2974 | 179 |
180 ~octave_user_function (void); | |
181 | |
4654 | 182 octave_function *function_value (bool = false) { return this; } |
2974 | 183 |
4700 | 184 octave_user_function *user_function_value (bool = false) { return this; } |
185 | |
7719
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
186 octave_user_code *user_code_value (bool = false) { return this; } |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
187 |
2974 | 188 octave_user_function *define_param_list (tree_parameter_list *t); |
189 | |
190 octave_user_function *define_ret_list (tree_parameter_list *t); | |
191 | |
4343 | 192 void stash_fcn_file_name (const std::string& nm); |
2974 | 193 |
6323 | 194 void stash_parent_fcn_name (const std::string& p) { parent_name = p; } |
195 | |
3665 | 196 void stash_leading_comment (octave_comment_list *lc) { lead_comm = lc; } |
197 | |
198 void stash_trailing_comment (octave_comment_list *tc) { trail_comm = tc; } | |
199 | |
3325 | 200 void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; } |
3165 | 201 |
3255 | 202 void stash_fcn_file_time (const octave_time& t) |
3165 | 203 { |
204 t_parsed = t; | |
205 mark_fcn_file_up_to_date (t); | |
206 } | |
2974 | 207 |
4346 | 208 std::string fcn_file_name (void) const { return file_name; } |
2974 | 209 |
6323 | 210 std::string parent_fcn_name (void) const { return parent_name; } |
211 | |
7336 | 212 symbol_table::scope_id scope (void) { return local_scope; } |
213 | |
4346 | 214 octave_time time_parsed (void) const { return t_parsed; } |
2974 | 215 |
4346 | 216 octave_time time_checked (void) const { return t_checked; } |
3165 | 217 |
2974 | 218 void mark_as_system_fcn_file (void); |
219 | |
4346 | 220 bool is_system_fcn_file (void) const { return system_fcn_file; } |
2974 | 221 |
4748 | 222 bool is_user_function (void) const { return true; } |
223 | |
2974 | 224 bool takes_varargs (void) const; |
225 | |
5848 | 226 bool takes_var_return (void) const; |
2974 | 227 |
228 octave_value_list octave_all_va_args (void); | |
229 | |
4748 | 230 void stash_function_name (const std::string& s) { my_name = s; } |
2974 | 231 |
4238 | 232 void mark_as_nested_function (void) { nested_function = true; } |
233 | |
234 bool is_nested_function (void) const { return nested_function; } | |
235 | |
6149 | 236 void mark_as_inline_function (void) { inline_function = true; } |
237 | |
238 bool is_inline_function (void) const { return inline_function; } | |
239 | |
7336 | 240 void mark_as_class_constructor (void) { class_constructor = true; } |
241 | |
242 bool is_class_constructor (void) const { return class_constructor; } | |
243 | |
244 void mark_as_class_method (void) { class_method = true; } | |
245 | |
246 bool is_class_method (void) const { return class_method; } | |
247 | |
248 void stash_dispatch_class (const std::string& nm) { xdispatch_class = nm; } | |
249 | |
250 std::string dispatch_class (void) const { return xdispatch_class; } | |
251 | |
3875 | 252 void save_args_passed (const octave_value_list& args) |
253 { | |
254 if (call_depth > 1) | |
255 saved_args.push (args_passed); | |
256 | |
257 args_passed = args; | |
258 } | |
259 | |
260 void restore_args_passed (void) | |
261 { | |
3933 | 262 if (saved_args.empty ()) |
263 args_passed = octave_value_list (); | |
264 else | |
4214 | 265 { |
266 args_passed = saved_args.top (); | |
267 saved_args.pop (); | |
268 } | |
3875 | 269 } |
3239 | 270 |
7651
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
271 octave_value subsref (const std::string& type, |
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
272 const std::list<octave_value_list>& idx) |
4271 | 273 { |
7651
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
274 octave_value_list tmp = subsref (type, idx, 1); |
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
275 return tmp.length () > 0 ? tmp(0) : octave_value (); |
4271 | 276 } |
277 | |
4247 | 278 octave_value_list subsref (const std::string& type, |
4219 | 279 const std::list<octave_value_list>& idx, |
3933 | 280 int nargout); |
281 | |
3544 | 282 octave_value_list |
283 do_multi_index_op (int nargout, const octave_value_list& args); | |
2974 | 284 |
4346 | 285 void traceback_error (void) const; |
2974 | 286 |
287 tree_parameter_list *parameter_list (void) { return param_list; } | |
288 | |
289 tree_parameter_list *return_list (void) { return ret_list; } | |
290 | |
291 tree_statement_list *body (void) { return cmd_list; } | |
292 | |
3665 | 293 octave_comment_list *leading_comment (void) { return lead_comm; } |
294 | |
295 octave_comment_list *trailing_comment (void) { return trail_comm; } | |
296 | |
2974 | 297 void accept (tree_walker& tw); |
298 | |
7336 | 299 #if 0 |
3933 | 300 void print_symtab_info (std::ostream& os) const; |
7336 | 301 #endif |
3933 | 302 |
2974 | 303 private: |
304 | |
305 // List of arguments for this function. These are local variables. | |
306 tree_parameter_list *param_list; | |
307 | |
308 // List of parameters we return. These are also local variables in | |
309 // this function. | |
310 tree_parameter_list *ret_list; | |
311 | |
312 // The list of commands that make up the body of this function. | |
313 tree_statement_list *cmd_list; | |
314 | |
3665 | 315 // The comments preceding the FUNCTION token. |
316 octave_comment_list *lead_comm; | |
317 | |
318 // The comments preceding the ENDFUNCTION token. | |
319 octave_comment_list *trail_comm; | |
320 | |
6323 | 321 // The name of the file we parsed. |
3523 | 322 std::string file_name; |
2974 | 323 |
6323 | 324 // The name of the parent function, if any. |
325 std::string parent_name; | |
326 | |
2974 | 327 // The time the file was parsed. |
3255 | 328 octave_time t_parsed; |
2974 | 329 |
3165 | 330 // The time the file was last checked to see if it needs to be |
331 // parsed again. | |
3255 | 332 octave_time t_checked; |
3165 | 333 |
2974 | 334 // True if this function came from a file that is considered to be a |
335 // system function. This affects whether we check the time stamp | |
336 // on the file to see if it has changed. | |
337 bool system_fcn_file; | |
338 | |
339 // Used to keep track of recursion depth. | |
340 int call_depth; | |
341 | |
342 // The number of arguments that have names. | |
343 int num_named_args; | |
344 | |
4238 | 345 // TRUE means this is a nested function. |
346 bool nested_function; | |
347 | |
6149 | 348 // TRUE means this is an inline function. |
349 bool inline_function; | |
350 | |
7336 | 351 // TRUE means this function is the constructor for class object. |
352 bool class_constructor; | |
353 | |
354 // TRUE means this function is a method for a class. | |
355 bool class_method; | |
356 | |
357 // If this object is a class method or constructor, this is the name | |
358 // of the class to which the method belongs. | |
359 std::string xdispatch_class; | |
360 | |
2974 | 361 // The values that were passed as arguments. |
362 octave_value_list args_passed; | |
363 | |
3875 | 364 // A place to store the passed args for recursive calls. |
4214 | 365 std::stack<octave_value_list> saved_args; |
3875 | 366 |
2974 | 367 // The number of arguments passed in. |
368 int num_args_passed; | |
369 | |
7336 | 370 symbol_table::scope_id local_scope; |
2974 | 371 |
7336 | 372 #if 0 |
2974 | 373 // The symbol record for argn in the local symbol table. |
7336 | 374 octave_value& argn_varref; |
2974 | 375 |
376 // The symbol record for nargin in the local symbol table. | |
7336 | 377 octave_value& nargin_varref; |
2974 | 378 |
379 // The symbol record for nargout in the local symbol table. | |
7336 | 380 octave_value& nargout_varref; |
2974 | 381 |
3974 | 382 // The symbol record for varargin in the local symbol table. |
7336 | 383 octave_value& varargin_varref; |
384 #endif | |
3974 | 385 |
2974 | 386 void print_code_function_header (void); |
387 | |
388 void print_code_function_trailer (void); | |
389 | |
390 void bind_automatic_vars (const string_vector& arg_names, int nargin, | |
3974 | 391 int nargout, const octave_value_list& va_args); |
3219 | 392 |
4645 | 393 // No copying! |
394 | |
395 octave_user_function (const octave_user_function& fn); | |
396 | |
397 octave_user_function& operator = (const octave_user_function& fn); | |
398 | |
4612 | 399 DECLARE_OCTAVE_ALLOCATOR |
3219 | 400 |
4612 | 401 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2974 | 402 }; |
403 | |
404 #endif | |
405 | |
406 /* | |
407 ;;; Local Variables: *** | |
408 ;;; mode: C++ *** | |
409 ;;; End: *** | |
410 */ |