Mercurial > octave
annotate src/ov-usr-fcn.h @ 10313:f3b65e1ae355
untabify src header files
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 11 Feb 2010 12:16:43 -0500 |
parents | cd96d29c5efa |
children | 9cd5aa83fa62 |
rev | line source |
---|---|
2974 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
8920 | 4 2005, 2006, 2007, 2008, 2009 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, |
10313 | 62 const std::string& ds = std::string ()) |
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
|
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, |
10313 | 84 tree_statement_list *cmds, |
85 const std::string& ds = std::string ()); | |
5744 | 86 |
87 octave_user_script (const std::string& fnm, const std::string& nm, | |
10313 | 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, |
10313 | 120 const std::list<octave_value_list>& idx) |
7715
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, |
10313 | 127 const std::list<octave_value_list>& idx, |
128 int nargout); | |
7715
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 accept (tree_walker& tw); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
136 |
5744 | 137 private: |
138 | |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
139 // 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
|
140 tree_statement_list *cmd_list; |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
141 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
142 // The name of the file we parsed. |
5744 | 143 std::string file_name; |
144 | |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
145 // The time the file was parsed. |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
146 octave_time t_parsed; |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
147 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
148 // 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
|
149 // parsed again. |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
150 octave_time t_checked; |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
151 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
152 // Used to keep track of recursion depth. |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
153 int call_depth; |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
154 |
5744 | 155 // No copying! |
156 | |
157 octave_user_script (const octave_user_script& f); | |
158 | |
159 octave_user_script& operator = (const octave_user_script& f); | |
160 | |
161 DECLARE_OCTAVE_ALLOCATOR | |
162 | |
163 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |
164 }; | |
165 | |
166 // User-defined functions. | |
2974 | 167 |
168 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
|
169 octave_user_function : public octave_user_code |
2974 | 170 { |
171 public: | |
172 | |
7336 | 173 octave_user_function (symbol_table::scope_id sid = -1, |
10313 | 174 tree_parameter_list *pl = 0, |
175 tree_parameter_list *rl = 0, | |
176 tree_statement_list *cl = 0); | |
2974 | 177 |
178 ~octave_user_function (void); | |
179 | |
4654 | 180 octave_function *function_value (bool = false) { return this; } |
2974 | 181 |
4700 | 182 octave_user_function *user_function_value (bool = false) { return this; } |
183 | |
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
|
184 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
|
185 |
2974 | 186 octave_user_function *define_param_list (tree_parameter_list *t); |
187 | |
188 octave_user_function *define_ret_list (tree_parameter_list *t); | |
189 | |
4343 | 190 void stash_fcn_file_name (const std::string& nm); |
2974 | 191 |
6323 | 192 void stash_parent_fcn_name (const std::string& p) { parent_name = p; } |
193 | |
7968
0d607e8dbbfa
eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents:
7876
diff
changeset
|
194 void stash_parent_fcn_scope (symbol_table::scope_id ps) { parent_scope = ps; } |
0d607e8dbbfa
eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents:
7876
diff
changeset
|
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 | |
7968
0d607e8dbbfa
eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents:
7876
diff
changeset
|
212 symbol_table::scope_id parent_fcn_scope (void) const { return parent_scope; } |
0d607e8dbbfa
eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents:
7876
diff
changeset
|
213 |
7336 | 214 symbol_table::scope_id scope (void) { return local_scope; } |
215 | |
4346 | 216 octave_time time_parsed (void) const { return t_parsed; } |
2974 | 217 |
4346 | 218 octave_time time_checked (void) const { return t_checked; } |
3165 | 219 |
2974 | 220 void mark_as_system_fcn_file (void); |
221 | |
4346 | 222 bool is_system_fcn_file (void) const { return system_fcn_file; } |
2974 | 223 |
4748 | 224 bool is_user_function (void) const { return true; } |
225 | |
7876
8447a5024650
clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents:
7761
diff
changeset
|
226 void erase_subfunctions (void) |
8447a5024650
clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents:
7761
diff
changeset
|
227 { |
8447a5024650
clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents:
7761
diff
changeset
|
228 symbol_table::erase_subfunctions_in_scope (local_scope); |
8447a5024650
clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents:
7761
diff
changeset
|
229 } |
8447a5024650
clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents:
7761
diff
changeset
|
230 |
2974 | 231 bool takes_varargs (void) const; |
232 | |
5848 | 233 bool takes_var_return (void) const; |
2974 | 234 |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
235 void lock_subfunctions (void); |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
236 |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
237 void unlock_subfunctions (void); |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
238 |
9522
e79470be3ecb
implement subsasgn this-arg optimization
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
239 octave_value_list all_va_args (const octave_value_list& args); |
2974 | 240 |
4748 | 241 void stash_function_name (const std::string& s) { my_name = s; } |
2974 | 242 |
4238 | 243 void mark_as_nested_function (void) { nested_function = true; } |
244 | |
245 bool is_nested_function (void) const { return nested_function; } | |
246 | |
6149 | 247 void mark_as_inline_function (void) { inline_function = true; } |
248 | |
249 bool is_inline_function (void) const { return inline_function; } | |
250 | |
7336 | 251 void mark_as_class_constructor (void) { class_constructor = true; } |
252 | |
253 bool is_class_constructor (void) const { return class_constructor; } | |
254 | |
255 void mark_as_class_method (void) { class_method = true; } | |
256 | |
257 bool is_class_method (void) const { return class_method; } | |
258 | |
7651
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
259 octave_value subsref (const std::string& type, |
10313 | 260 const std::list<octave_value_list>& idx) |
4271 | 261 { |
7651
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
262 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
|
263 return tmp.length () > 0 ? tmp(0) : octave_value (); |
4271 | 264 } |
265 | |
4247 | 266 octave_value_list subsref (const std::string& type, |
10313 | 267 const std::list<octave_value_list>& idx, |
268 int nargout); | |
3933 | 269 |
3544 | 270 octave_value_list |
271 do_multi_index_op (int nargout, const octave_value_list& args); | |
2974 | 272 |
273 tree_parameter_list *parameter_list (void) { return param_list; } | |
274 | |
275 tree_parameter_list *return_list (void) { return ret_list; } | |
276 | |
277 tree_statement_list *body (void) { return cmd_list; } | |
278 | |
3665 | 279 octave_comment_list *leading_comment (void) { return lead_comm; } |
280 | |
281 octave_comment_list *trailing_comment (void) { return trail_comm; } | |
282 | |
9522
e79470be3ecb
implement subsasgn this-arg optimization
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
283 bool subsasgn_optimization_ok (void); |
e79470be3ecb
implement subsasgn this-arg optimization
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
284 |
2974 | 285 void accept (tree_walker& tw); |
286 | |
7336 | 287 #if 0 |
3933 | 288 void print_symtab_info (std::ostream& os) const; |
7336 | 289 #endif |
3933 | 290 |
2974 | 291 private: |
292 | |
293 // List of arguments for this function. These are local variables. | |
294 tree_parameter_list *param_list; | |
295 | |
296 // List of parameters we return. These are also local variables in | |
297 // this function. | |
298 tree_parameter_list *ret_list; | |
299 | |
300 // The list of commands that make up the body of this function. | |
301 tree_statement_list *cmd_list; | |
302 | |
3665 | 303 // The comments preceding the FUNCTION token. |
304 octave_comment_list *lead_comm; | |
305 | |
306 // The comments preceding the ENDFUNCTION token. | |
307 octave_comment_list *trail_comm; | |
308 | |
6323 | 309 // The name of the file we parsed. |
3523 | 310 std::string file_name; |
2974 | 311 |
6323 | 312 // The name of the parent function, if any. |
313 std::string parent_name; | |
314 | |
2974 | 315 // The time the file was parsed. |
3255 | 316 octave_time t_parsed; |
2974 | 317 |
3165 | 318 // The time the file was last checked to see if it needs to be |
319 // parsed again. | |
3255 | 320 octave_time t_checked; |
3165 | 321 |
2974 | 322 // True if this function came from a file that is considered to be a |
323 // system function. This affects whether we check the time stamp | |
324 // on the file to see if it has changed. | |
325 bool system_fcn_file; | |
326 | |
327 // Used to keep track of recursion depth. | |
328 int call_depth; | |
329 | |
330 // The number of arguments that have names. | |
331 int num_named_args; | |
332 | |
4238 | 333 // TRUE means this is a nested function. |
334 bool nested_function; | |
335 | |
6149 | 336 // TRUE means this is an inline function. |
337 bool inline_function; | |
338 | |
7336 | 339 // TRUE means this function is the constructor for class object. |
340 bool class_constructor; | |
341 | |
342 // TRUE means this function is a method for a class. | |
343 bool class_method; | |
344 | |
7968
0d607e8dbbfa
eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents:
7876
diff
changeset
|
345 // The scope of the parent function, if any. |
0d607e8dbbfa
eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents:
7876
diff
changeset
|
346 symbol_table::scope_id parent_scope; |
0d607e8dbbfa
eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents:
7876
diff
changeset
|
347 |
7336 | 348 symbol_table::scope_id local_scope; |
2974 | 349 |
7336 | 350 #if 0 |
2974 | 351 // The symbol record for argn in the local symbol table. |
7336 | 352 octave_value& argn_varref; |
2974 | 353 |
354 // The symbol record for nargin in the local symbol table. | |
7336 | 355 octave_value& nargin_varref; |
2974 | 356 |
357 // The symbol record for nargout in the local symbol table. | |
7336 | 358 octave_value& nargout_varref; |
2974 | 359 |
3974 | 360 // The symbol record for varargin in the local symbol table. |
7336 | 361 octave_value& varargin_varref; |
362 #endif | |
3974 | 363 |
2974 | 364 void print_code_function_header (void); |
365 | |
366 void print_code_function_trailer (void); | |
367 | |
368 void bind_automatic_vars (const string_vector& arg_names, int nargin, | |
10313 | 369 int nargout, const octave_value_list& va_args); |
3219 | 370 |
4645 | 371 // No copying! |
372 | |
373 octave_user_function (const octave_user_function& fn); | |
374 | |
375 octave_user_function& operator = (const octave_user_function& fn); | |
376 | |
4612 | 377 DECLARE_OCTAVE_ALLOCATOR |
3219 | 378 |
4612 | 379 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2974 | 380 }; |
381 | |
382 #endif |