Mercurial > hg > octave-lyh
annotate src/ov-usr-fcn.cc @ 9396:17af7cce7d1b
yet more unwind_protect improvements
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 25 Jun 2009 13:57:38 +0200 |
parents | 610bf90fce2a |
children | e79470be3ecb |
rev | line source |
---|---|
2974 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, |
8920 | 4 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 #ifdef HAVE_CONFIG_H | |
25 #include <config.h> | |
26 #endif | |
27 | |
28 #include "str-vec.h" | |
29 | |
30 #include <defaults.h> | |
3974 | 31 #include "Cell.h" |
2974 | 32 #include "defun.h" |
33 #include "error.h" | |
34 #include "input.h" | |
35 #include "oct-obj.h" | |
36 #include "ov-usr-fcn.h" | |
37 #include "ov.h" | |
38 #include "pager.h" | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
39 #include "pt-eval.h" |
2985 | 40 #include "pt-jump.h" |
2974 | 41 #include "pt-misc.h" |
42 #include "pt-pr-code.h" | |
2982 | 43 #include "pt-stmt.h" |
2974 | 44 #include "pt-walk.h" |
45 #include "symtab.h" | |
46 #include "toplev.h" | |
47 #include "unwind-prot.h" | |
48 #include "utils.h" | |
3489 | 49 #include "parse.h" |
2974 | 50 #include "variables.h" |
51 | |
3131 | 52 // Maximum nesting level for functions called recursively. |
5794 | 53 static int Vmax_recursion_depth = 256; |
3131 | 54 |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
55 // User defined scripts. |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
56 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
57 DEFINE_OCTAVE_ALLOCATOR (octave_user_script); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
58 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
59 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_user_script, |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
60 "user-defined script", |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
61 "user-defined script"); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
62 |
7731
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
63 octave_user_script::octave_user_script (void) |
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
64 : octave_user_code (), cmd_list (0), file_name (), |
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
65 t_parsed (static_cast<time_t> (0)), |
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
66 t_checked (static_cast<time_t> (0)), |
7752
40c428ea3408
initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents:
7736
diff
changeset
|
67 call_depth (-1) |
7731
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
68 { } |
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
69 |
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
70 octave_user_script::octave_user_script (const std::string& fnm, |
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
71 const std::string& nm, |
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
72 tree_statement_list *cmds, |
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
73 const std::string& ds) |
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
74 : octave_user_code (nm, ds), cmd_list (cmds), file_name (fnm), |
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
75 t_parsed (static_cast<time_t> (0)), |
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
76 t_checked (static_cast<time_t> (0)), |
7752
40c428ea3408
initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents:
7736
diff
changeset
|
77 call_depth (-1) |
7736 | 78 { |
79 if (cmd_list) | |
80 cmd_list->mark_as_script_body (); | |
81 } | |
7731
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
82 |
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
83 octave_user_script::octave_user_script (const std::string& fnm, |
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
84 const std::string& nm, |
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) |
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
86 : octave_user_code (nm, ds), cmd_list (0), file_name (fnm), |
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
87 t_parsed (static_cast<time_t> (0)), |
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
88 t_checked (static_cast<time_t> (0)), |
7752
40c428ea3408
initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents:
7736
diff
changeset
|
89 call_depth (-1) |
7731
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
90 { } |
2d2a969c731c
fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents:
7719
diff
changeset
|
91 |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
92 octave_user_script::~octave_user_script (void) |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
93 { |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
94 delete cmd_list; |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
95 } |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
96 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
97 octave_value_list |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
98 octave_user_script::subsref (const std::string&, |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
99 const std::list<octave_value_list>&, int) |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
100 { |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
101 octave_value_list retval; |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
102 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
103 ::error ("invalid use of script in index expression"); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
104 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
105 return retval; |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
106 } |
7336 | 107 |
108 octave_value_list | |
109 octave_user_script::do_multi_index_op (int nargout, | |
110 const octave_value_list& args) | |
111 { | |
112 octave_value_list retval; | |
113 | |
9377
610bf90fce2a
update unwind_protect usage everywhere
Jaroslav Hajek <highegg@gmail.com>
parents:
9144
diff
changeset
|
114 unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); |
8011
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7968
diff
changeset
|
115 |
7336 | 116 if (! error_state) |
117 { | |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
118 if (args.length () == 0 && nargout == 0) |
7336 | 119 { |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
120 if (cmd_list) |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
121 { |
9377
610bf90fce2a
update unwind_protect usage everywhere
Jaroslav Hajek <highegg@gmail.com>
parents:
9144
diff
changeset
|
122 unwind_protect::protect_var (call_depth); |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
123 call_depth++; |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
124 |
7752
40c428ea3408
initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents:
7736
diff
changeset
|
125 if (call_depth < Vmax_recursion_depth) |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
126 { |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
127 octave_call_stack::push (this); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
128 |
9396
17af7cce7d1b
yet more unwind_protect improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
9377
diff
changeset
|
129 unwind_protect::add_fcn (octave_call_stack::pop); |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
130 |
9377
610bf90fce2a
update unwind_protect usage everywhere
Jaroslav Hajek <highegg@gmail.com>
parents:
9144
diff
changeset
|
131 unwind_protect::protect_var (tree_evaluator::in_fcn_or_script_body); |
8669
33783e94fb16
line number fixes and other evaluator tweaks
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
132 tree_evaluator::in_fcn_or_script_body = true; |
33783e94fb16
line number fixes and other evaluator tweaks
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
133 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
134 cmd_list->accept (*current_evaluator); |
7336 | 135 |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
136 if (tree_return_command::returning) |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
137 tree_return_command::returning = 0; |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
138 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
139 if (tree_break_command::breaking) |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
140 tree_break_command::breaking--; |
8013
b3e667f1ab4c
call backtrace_error_message in eval functions, not when popping stack
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
141 |
b3e667f1ab4c
call backtrace_error_message in eval functions, not when popping stack
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
142 if (error_state) |
b3e667f1ab4c
call backtrace_error_message in eval functions, not when popping stack
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
143 octave_call_stack::backtrace_error_message (); |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
144 } |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
145 else |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
146 ::error ("max_recursion_limit exceeded"); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
147 } |
7336 | 148 } |
149 else | |
150 error ("invalid call to script"); | |
151 } | |
152 | |
9377
610bf90fce2a
update unwind_protect usage everywhere
Jaroslav Hajek <highegg@gmail.com>
parents:
9144
diff
changeset
|
153 unwind_protect::run_frame (uwp_frame); |
8011
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7968
diff
changeset
|
154 |
7336 | 155 return retval; |
156 } | |
157 | |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
158 void |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
159 octave_user_script::accept (tree_walker& tw) |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
160 { |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
161 tw.visit_octave_user_script (*this); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
162 } |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7589
diff
changeset
|
163 |
2974 | 164 // User defined functions. |
165 | |
3219 | 166 DEFINE_OCTAVE_ALLOCATOR (octave_user_function); |
2974 | 167 |
3219 | 168 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_user_function, |
4612 | 169 "user-defined function", |
3219 | 170 "user-defined function"); |
2974 | 171 |
172 // Ugh. This really needs to be simplified (code/data? | |
173 // extrinsic/intrinsic state?). | |
174 | |
175 octave_user_function::octave_user_function | |
7336 | 176 (symbol_table::scope_id sid, tree_parameter_list *pl, |
177 tree_parameter_list *rl, tree_statement_list *cl) | |
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
|
178 : octave_user_code (std::string (), std::string ()), |
2974 | 179 param_list (pl), ret_list (rl), cmd_list (cl), |
7336 | 180 lead_comm (), trail_comm (), file_name (), |
6323 | 181 parent_name (), t_parsed (static_cast<time_t> (0)), |
3255 | 182 t_checked (static_cast<time_t> (0)), |
7752
40c428ea3408
initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents:
7736
diff
changeset
|
183 system_fcn_file (false), call_depth (-1), |
7589
90fb25a5a3fa
minor cleanup in octave_user_function constructor
John W. Eaton <jwe@octave.org>
parents:
7552
diff
changeset
|
184 num_named_args (param_list ? param_list->length () : 0), |
7336 | 185 nested_function (false), inline_function (false), |
8785
70f5a0375afd
oct-map.h: fix think-o in previous change
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
186 class_constructor (false), class_method (false), args_passed (), |
70f5a0375afd
oct-map.h: fix think-o in previous change
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
187 num_args_passed (0), parent_scope (-1), local_scope (sid) |
7736 | 188 { |
189 if (cmd_list) | |
190 cmd_list->mark_as_function_body (); | |
191 } | |
2974 | 192 |
193 octave_user_function::~octave_user_function (void) | |
194 { | |
195 delete param_list; | |
196 delete ret_list; | |
197 delete cmd_list; | |
3665 | 198 delete lead_comm; |
199 delete trail_comm; | |
7336 | 200 |
201 symbol_table::erase_scope (local_scope); | |
2974 | 202 } |
203 | |
204 octave_user_function * | |
205 octave_user_function::define_ret_list (tree_parameter_list *t) | |
206 { | |
207 ret_list = t; | |
208 | |
209 return this; | |
210 } | |
211 | |
212 void | |
4343 | 213 octave_user_function::stash_fcn_file_name (const std::string& nm) |
2974 | 214 { |
4343 | 215 file_name = nm; |
2974 | 216 } |
217 | |
218 void | |
219 octave_user_function::mark_as_system_fcn_file (void) | |
220 { | |
221 if (! file_name.empty ()) | |
222 { | |
223 // We really should stash the whole path to the file we found, | |
224 // when we looked it up, to avoid possible race conditions... | |
5775 | 225 // FIXME |
2974 | 226 // |
227 // We probably also don't need to get the library directory | |
228 // every time, but since this function is only called when the | |
229 // function file is parsed, it probably doesn't matter that | |
230 // much. | |
231 | |
3523 | 232 std::string ff_name = fcn_file_in_path (file_name); |
2974 | 233 |
3565 | 234 if (Vfcn_file_dir == ff_name.substr (0, Vfcn_file_dir.length ())) |
2974 | 235 system_fcn_file = 1; |
236 } | |
237 else | |
238 system_fcn_file = 0; | |
239 } | |
240 | |
241 bool | |
242 octave_user_function::takes_varargs (void) const | |
243 { | |
244 return (param_list && param_list->takes_varargs ()); | |
245 } | |
246 | |
5848 | 247 bool |
248 octave_user_function::takes_var_return (void) const | |
2974 | 249 { |
5848 | 250 return (ret_list && ret_list->takes_varargs ()); |
2974 | 251 } |
252 | |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
253 void |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
254 octave_user_function::lock_subfunctions (void) |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
255 { |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
256 symbol_table::lock_subfunctions (local_scope); |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
257 } |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
258 |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
259 void |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
260 octave_user_function::unlock_subfunctions (void) |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
261 { |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
262 symbol_table::unlock_subfunctions (local_scope); |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
263 } |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
264 |
2974 | 265 octave_value_list |
266 octave_user_function::octave_all_va_args (void) | |
267 { | |
268 octave_value_list retval; | |
269 | |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8142
diff
changeset
|
270 octave_idx_type n = num_args_passed - num_named_args; |
2974 | 271 |
3178 | 272 if (n > 0) |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8142
diff
changeset
|
273 retval = args_passed.slice (num_named_args, n); |
2974 | 274 |
275 return retval; | |
276 } | |
277 | |
278 octave_value_list | |
4247 | 279 octave_user_function::subsref (const std::string& type, |
4219 | 280 const std::list<octave_value_list>& idx, |
3933 | 281 int nargout) |
282 { | |
283 octave_value_list retval; | |
284 | |
285 switch (type[0]) | |
286 { | |
287 case '(': | |
5154 | 288 { |
5155 | 289 int tmp_nargout = (type.length () > 1 && nargout == 0) ? 1 : nargout; |
5154 | 290 |
291 retval = do_multi_index_op (tmp_nargout, idx.front ()); | |
292 } | |
3933 | 293 break; |
294 | |
295 case '{': | |
296 case '.': | |
297 { | |
298 std::string nm = type_name (); | |
299 error ("%s cannot be indexed with %c", nm.c_str (), type[0]); | |
300 } | |
301 break; | |
302 | |
303 default: | |
304 panic_impossible (); | |
305 } | |
306 | |
5775 | 307 // FIXME -- perhaps there should be an |
4059 | 308 // octave_value_list::next_subsref member function? See also |
309 // octave_builtin::subsref. | |
3933 | 310 |
4219 | 311 if (idx.size () > 1) |
4994 | 312 retval = retval(0).next_subsref (nargout, type, idx); |
4059 | 313 |
314 return retval; | |
3933 | 315 } |
316 | |
317 octave_value_list | |
3544 | 318 octave_user_function::do_multi_index_op (int nargout, |
319 const octave_value_list& args) | |
2974 | 320 { |
321 octave_value_list retval; | |
322 | |
323 if (error_state) | |
324 return retval; | |
325 | |
326 if (! cmd_list) | |
327 return retval; | |
328 | |
329 int nargin = args.length (); | |
330 | |
9377
610bf90fce2a
update unwind_protect usage everywhere
Jaroslav Hajek <highegg@gmail.com>
parents:
9144
diff
changeset
|
331 unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame (); |
2974 | 332 |
9377
610bf90fce2a
update unwind_protect usage everywhere
Jaroslav Hajek <highegg@gmail.com>
parents:
9144
diff
changeset
|
333 unwind_protect::protect_var (call_depth); |
2974 | 334 call_depth++; |
335 | |
7752
40c428ea3408
initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents:
7736
diff
changeset
|
336 if (call_depth >= Vmax_recursion_depth) |
3131 | 337 { |
338 ::error ("max_recursion_limit exceeded"); | |
9377
610bf90fce2a
update unwind_protect usage everywhere
Jaroslav Hajek <highegg@gmail.com>
parents:
9144
diff
changeset
|
339 unwind_protect::run_frame (uwp_frame); |
3131 | 340 return retval; |
341 } | |
342 | |
7336 | 343 // Save old and set current symbol table context, for |
344 // eval_undefined_error(). | |
345 | |
7901 | 346 octave_call_stack::push (this, local_scope, call_depth); |
9396
17af7cce7d1b
yet more unwind_protect improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
9377
diff
changeset
|
347 unwind_protect::add_fcn (octave_call_stack::pop); |
7901 | 348 |
7752
40c428ea3408
initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents:
7736
diff
changeset
|
349 if (call_depth > 0) |
2974 | 350 { |
7336 | 351 symbol_table::push_context (); |
2974 | 352 |
9396
17af7cce7d1b
yet more unwind_protect improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
9377
diff
changeset
|
353 unwind_protect::add_fcn (symbol_table::pop_context); |
7336 | 354 } |
2974 | 355 |
3875 | 356 // Save and restore args passed for recursive calls. |
2974 | 357 |
3875 | 358 save_args_passed (args); |
3239 | 359 |
9396
17af7cce7d1b
yet more unwind_protect improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
9377
diff
changeset
|
360 unwind_protect::add_method (this, &octave_user_function::restore_args_passed); |
3239 | 361 |
2974 | 362 string_vector arg_names = args.name_tags (); |
363 | |
9377
610bf90fce2a
update unwind_protect usage everywhere
Jaroslav Hajek <highegg@gmail.com>
parents:
9144
diff
changeset
|
364 unwind_protect::protect_var (num_args_passed); |
2974 | 365 num_args_passed = nargin; |
366 | |
367 if (param_list && ! param_list->varargs_only ()) | |
368 { | |
369 param_list->define_from_arg_vector (args); | |
370 if (error_state) | |
371 goto abort; | |
372 } | |
373 | |
3239 | 374 // Force parameter list to be undefined when this function exits. |
375 // Doing so decrements the reference counts on the values of local | |
376 // variables that are also named function parameters. | |
377 | |
9396
17af7cce7d1b
yet more unwind_protect improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
9377
diff
changeset
|
378 if (param_list) |
17af7cce7d1b
yet more unwind_protect improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
9377
diff
changeset
|
379 unwind_protect::add_method (param_list, |
17af7cce7d1b
yet more unwind_protect improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
9377
diff
changeset
|
380 &tree_parameter_list::undefine); |
3239 | 381 |
382 // Force return list to be undefined when this function exits. | |
383 // Doing so decrements the reference counts on the values of local | |
384 // variables that are also named values returned by this function. | |
385 | |
9396
17af7cce7d1b
yet more unwind_protect improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
9377
diff
changeset
|
386 if (ret_list) |
17af7cce7d1b
yet more unwind_protect improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
9377
diff
changeset
|
387 unwind_protect::add_method (ret_list, |
17af7cce7d1b
yet more unwind_protect improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
9377
diff
changeset
|
388 &tree_parameter_list::undefine); |
3239 | 389 |
8142
54b41376e381
ov-usr-fcn.cc (octave_user_function::do_multi_index_op): add symbol_table::clear_variables cleanup function to the unwind_protect stack after the parameter list cleanup functions
John W. Eaton <jwe@octave.org>
parents:
8013
diff
changeset
|
390 if (call_depth == 0) |
54b41376e381
ov-usr-fcn.cc (octave_user_function::do_multi_index_op): add symbol_table::clear_variables cleanup function to the unwind_protect stack after the parameter list cleanup functions
John W. Eaton <jwe@octave.org>
parents:
8013
diff
changeset
|
391 { |
54b41376e381
ov-usr-fcn.cc (octave_user_function::do_multi_index_op): add symbol_table::clear_variables cleanup function to the unwind_protect stack after the parameter list cleanup functions
John W. Eaton <jwe@octave.org>
parents:
8013
diff
changeset
|
392 // Force symbols to be undefined again when this function |
54b41376e381
ov-usr-fcn.cc (octave_user_function::do_multi_index_op): add symbol_table::clear_variables cleanup function to the unwind_protect stack after the parameter list cleanup functions
John W. Eaton <jwe@octave.org>
parents:
8013
diff
changeset
|
393 // exits. |
54b41376e381
ov-usr-fcn.cc (octave_user_function::do_multi_index_op): add symbol_table::clear_variables cleanup function to the unwind_protect stack after the parameter list cleanup functions
John W. Eaton <jwe@octave.org>
parents:
8013
diff
changeset
|
394 // |
54b41376e381
ov-usr-fcn.cc (octave_user_function::do_multi_index_op): add symbol_table::clear_variables cleanup function to the unwind_protect stack after the parameter list cleanup functions
John W. Eaton <jwe@octave.org>
parents:
8013
diff
changeset
|
395 // This cleanup function is added to the unwind_protect stack |
54b41376e381
ov-usr-fcn.cc (octave_user_function::do_multi_index_op): add symbol_table::clear_variables cleanup function to the unwind_protect stack after the parameter list cleanup functions
John W. Eaton <jwe@octave.org>
parents:
8013
diff
changeset
|
396 // after the calls to clear the parameter lists so that local |
54b41376e381
ov-usr-fcn.cc (octave_user_function::do_multi_index_op): add symbol_table::clear_variables cleanup function to the unwind_protect stack after the parameter list cleanup functions
John W. Eaton <jwe@octave.org>
parents:
8013
diff
changeset
|
397 // variables will be cleared before the parameter lists are |
54b41376e381
ov-usr-fcn.cc (octave_user_function::do_multi_index_op): add symbol_table::clear_variables cleanup function to the unwind_protect stack after the parameter list cleanup functions
John W. Eaton <jwe@octave.org>
parents:
8013
diff
changeset
|
398 // cleared. That way, any function parameters that have been |
54b41376e381
ov-usr-fcn.cc (octave_user_function::do_multi_index_op): add symbol_table::clear_variables cleanup function to the unwind_protect stack after the parameter list cleanup functions
John W. Eaton <jwe@octave.org>
parents:
8013
diff
changeset
|
399 // declared global will be unmarked as global before they are |
54b41376e381
ov-usr-fcn.cc (octave_user_function::do_multi_index_op): add symbol_table::clear_variables cleanup function to the unwind_protect stack after the parameter list cleanup functions
John W. Eaton <jwe@octave.org>
parents:
8013
diff
changeset
|
400 // undefined by the clear_param_list cleanup function. |
54b41376e381
ov-usr-fcn.cc (octave_user_function::do_multi_index_op): add symbol_table::clear_variables cleanup function to the unwind_protect stack after the parameter list cleanup functions
John W. Eaton <jwe@octave.org>
parents:
8013
diff
changeset
|
401 |
9396
17af7cce7d1b
yet more unwind_protect improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
9377
diff
changeset
|
402 unwind_protect::add_fcn (symbol_table::clear_variables); |
8142
54b41376e381
ov-usr-fcn.cc (octave_user_function::do_multi_index_op): add symbol_table::clear_variables cleanup function to the unwind_protect stack after the parameter list cleanup functions
John W. Eaton <jwe@octave.org>
parents:
8013
diff
changeset
|
403 } |
54b41376e381
ov-usr-fcn.cc (octave_user_function::do_multi_index_op): add symbol_table::clear_variables cleanup function to the unwind_protect stack after the parameter list cleanup functions
John W. Eaton <jwe@octave.org>
parents:
8013
diff
changeset
|
404 |
2974 | 405 // The following code is in a separate scope to avoid warnings from |
406 // G++ about `goto abort' crossing the initialization of some | |
407 // variables. | |
408 | |
409 { | |
3974 | 410 bind_automatic_vars (arg_names, nargin, nargout, octave_all_va_args ()); |
2974 | 411 |
412 bool echo_commands = (Vecho_executing_commands & ECHO_FUNCTIONS); | |
413 | |
414 if (echo_commands) | |
415 print_code_function_header (); | |
416 | |
417 // Evaluate the commands that make up the function. | |
418 | |
9377
610bf90fce2a
update unwind_protect usage everywhere
Jaroslav Hajek <highegg@gmail.com>
parents:
9144
diff
changeset
|
419 unwind_protect::protect_var (tree_evaluator::in_fcn_or_script_body); |
8669
33783e94fb16
line number fixes and other evaluator tweaks
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
420 tree_evaluator::in_fcn_or_script_body = true; |
3489 | 421 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
422 bool special_expr = (is_inline_function () |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
423 || cmd_list->is_anon_function_body ()); |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
424 |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
425 if (special_expr) |
6657 | 426 { |
427 assert (cmd_list->length () == 1); | |
428 | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
429 tree_statement *stmt = 0; |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
430 |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
431 if ((stmt = cmd_list->front ()) |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
432 && stmt->is_expression ()) |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
433 { |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
434 tree_expression *expr = stmt->expression (); |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
435 |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
436 retval = expr->rvalue (nargout); |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
437 } |
6657 | 438 } |
439 else | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
440 cmd_list->accept (*current_evaluator); |
2974 | 441 |
442 if (echo_commands) | |
443 print_code_function_trailer (); | |
444 | |
4207 | 445 if (tree_return_command::returning) |
446 tree_return_command::returning = 0; | |
2974 | 447 |
4207 | 448 if (tree_break_command::breaking) |
449 tree_break_command::breaking--; | |
2974 | 450 |
451 if (error_state) | |
8013
b3e667f1ab4c
call backtrace_error_message in eval functions, not when popping stack
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
452 { |
b3e667f1ab4c
call backtrace_error_message in eval functions, not when popping stack
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
453 octave_call_stack::backtrace_error_message (); |
b3e667f1ab4c
call backtrace_error_message in eval functions, not when popping stack
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
454 goto abort; |
b3e667f1ab4c
call backtrace_error_message in eval functions, not when popping stack
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
455 } |
2974 | 456 |
457 // Copy return values out. | |
458 | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
459 if (ret_list && ! special_expr) |
3871 | 460 { |
4748 | 461 ret_list->initialize_undefined_elements (my_name, nargout, Matrix ()); |
3871 | 462 |
5848 | 463 Cell varargout; |
464 | |
6591 | 465 if (ret_list->takes_varargs ()) |
5848 | 466 { |
7336 | 467 octave_value varargout_varval = symbol_table::varval ("varargout"); |
6591 | 468 |
7336 | 469 if (varargout_varval.is_defined ()) |
6591 | 470 { |
7336 | 471 varargout = varargout_varval.cell_value (); |
5848 | 472 |
6591 | 473 if (error_state) |
474 error ("expecting varargout to be a cell array object"); | |
475 } | |
5848 | 476 } |
477 | |
478 if (! error_state) | |
479 retval = ret_list->convert_to_const_vector (varargout); | |
3871 | 480 } |
2974 | 481 } |
482 | |
483 abort: | |
9377
610bf90fce2a
update unwind_protect usage everywhere
Jaroslav Hajek <highegg@gmail.com>
parents:
9144
diff
changeset
|
484 unwind_protect::run_frame (uwp_frame); |
2974 | 485 |
486 return retval; | |
487 } | |
488 | |
489 void | |
490 octave_user_function::accept (tree_walker& tw) | |
491 { | |
492 tw.visit_octave_user_function (*this); | |
493 } | |
494 | |
7336 | 495 #if 0 |
2974 | 496 void |
3933 | 497 octave_user_function::print_symtab_info (std::ostream& os) const |
498 { | |
7336 | 499 symbol_table::print_info (os, local_scope); |
3933 | 500 } |
7336 | 501 #endif |
3933 | 502 |
503 void | |
2974 | 504 octave_user_function::print_code_function_header (void) |
505 { | |
5794 | 506 tree_print_code tpc (octave_stdout, VPS4); |
2974 | 507 |
508 tpc.visit_octave_user_function_header (*this); | |
509 } | |
510 | |
511 void | |
512 octave_user_function::print_code_function_trailer (void) | |
513 { | |
5794 | 514 tree_print_code tpc (octave_stdout, VPS4); |
2974 | 515 |
516 tpc.visit_octave_user_function_trailer (*this); | |
517 } | |
518 | |
519 void | |
520 octave_user_function::bind_automatic_vars | |
3974 | 521 (const string_vector& arg_names, int nargin, int nargout, |
522 const octave_value_list& va_args) | |
2974 | 523 { |
524 if (! arg_names.empty ()) | |
7336 | 525 symbol_table::varref ("argn") = arg_names; |
2974 | 526 |
7336 | 527 symbol_table::varref (".nargin.") = nargin; |
528 symbol_table::varref (".nargout.") = nargout; | |
529 | |
530 symbol_table::mark_hidden (".nargin."); | |
531 symbol_table::mark_hidden (".nargout."); | |
3974 | 532 |
533 if (takes_varargs ()) | |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8142
diff
changeset
|
534 symbol_table::varref ("varargin") = va_args.cell_value (); |
2974 | 535 } |
536 | |
4700 | 537 DEFUN (nargin, args, , |
538 "-*- texinfo -*-\n\ | |
539 @deftypefn {Built-in Function} {} nargin ()\n\ | |
540 @deftypefnx {Built-in Function} {} nargin (@var{fcn_name})\n\ | |
541 Within a function, return the number of arguments passed to the function.\n\ | |
542 At the top level, return the number of command line arguments passed to\n\ | |
543 Octave. If called with the optional argument @var{fcn_name}, return the\n\ | |
544 maximum number of arguments the named function can accept, or -1 if the\n\ | |
545 function accepts a variable number of arguments.\n\ | |
5642 | 546 @seealso{nargout, varargin, varargout}\n\ |
4700 | 547 @end deftypefn") |
548 { | |
549 octave_value retval; | |
550 | |
551 int nargin = args.length (); | |
552 | |
553 if (nargin == 1) | |
554 { | |
555 std::string fname = args(0).string_value (); | |
556 | |
557 if (! error_state) | |
558 { | |
7336 | 559 octave_value fcn_val = symbol_table::find_user_function (fname); |
4930 | 560 |
561 octave_user_function *fcn = fcn_val.user_function_value (true); | |
4700 | 562 |
563 if (fcn) | |
564 { | |
565 if (fcn->takes_varargs ()) | |
566 retval = -1; | |
567 else | |
568 { | |
569 tree_parameter_list *param_list = fcn->parameter_list (); | |
570 | |
571 retval = param_list ? param_list->length () : 0; | |
572 } | |
573 } | |
574 else | |
575 error ("nargin: invalid function"); | |
576 } | |
577 else | |
578 error ("nargin: expecting string as first argument"); | |
579 } | |
580 else if (nargin == 0) | |
581 { | |
7336 | 582 retval = symbol_table::varval (".nargin."); |
4700 | 583 |
7336 | 584 if (retval.is_undefined ()) |
585 retval = 0; | |
4700 | 586 } |
587 else | |
5823 | 588 print_usage (); |
4700 | 589 |
590 return retval; | |
591 } | |
592 | |
593 DEFUN (nargout, args, , | |
594 "-*- texinfo -*-\n\ | |
595 @deftypefn {Built-in Function} {} nargout ()\n\ | |
596 @deftypefnx {Built-in Function} {} nargout (@var{fcn_name})\n\ | |
597 Within a function, return the number of values the caller expects to\n\ | |
598 receive. If called with the optional argument @var{fcn_name}, return the\n\ | |
599 maximum number of values the named function can produce, or -1 if the\n\ | |
600 function can produce a variable number of values.\n\ | |
601 \n\ | |
602 For example,\n\ | |
603 \n\ | |
604 @example\n\ | |
605 f ()\n\ | |
606 @end example\n\ | |
607 \n\ | |
608 @noindent\n\ | |
4704 | 609 will cause @code{nargout} to return 0 inside the function @code{f} and\n\ |
4700 | 610 \n\ |
611 @example\n\ | |
612 [s, t] = f ()\n\ | |
613 @end example\n\ | |
614 \n\ | |
615 @noindent\n\ | |
616 will cause @code{nargout} to return 2 inside the function\n\ | |
617 @code{f}.\n\ | |
618 \n\ | |
619 At the top level, @code{nargout} is undefined.\n\ | |
5642 | 620 @seealso{nargin, varargin, varargout}\n\ |
4700 | 621 @end deftypefn") |
622 { | |
623 octave_value retval; | |
624 | |
625 int nargin = args.length (); | |
626 | |
627 if (nargin == 1) | |
628 { | |
629 std::string fname = args(0).string_value (); | |
630 | |
631 if (! error_state) | |
632 { | |
7336 | 633 octave_value fcn_val = symbol_table::find_user_function (fname); |
4930 | 634 |
635 octave_user_function *fcn = fcn_val.user_function_value (true); | |
4700 | 636 |
637 if (fcn) | |
638 { | |
639 if (fcn->takes_var_return ()) | |
640 retval = -1; | |
641 else | |
642 { | |
643 tree_parameter_list *ret_list = fcn->return_list (); | |
644 | |
645 retval = ret_list ? ret_list->length () : 0; | |
646 } | |
647 } | |
648 else | |
649 error ("nargout: invalid function"); | |
650 } | |
651 else | |
652 error ("nargout: expecting string as first argument"); | |
653 } | |
654 else if (nargin == 0) | |
655 { | |
7336 | 656 if (! symbol_table::at_top_level ()) |
4700 | 657 { |
7336 | 658 retval = symbol_table::varval (".nargout."); |
4700 | 659 |
7336 | 660 if (retval.is_undefined ()) |
661 retval = 0; | |
4700 | 662 } |
663 else | |
664 error ("nargout: invalid call at top level"); | |
665 } | |
666 else | |
5823 | 667 print_usage (); |
4700 | 668 |
669 return retval; | |
670 } | |
671 | |
5794 | 672 DEFUN (max_recursion_depth, args, nargout, |
673 "-*- texinfo -*-\n\ | |
674 @deftypefn {Built-in Function} {@var{val} =} max_recursion_depth ()\n\ | |
675 @deftypefnx {Built-in Function} {@var{old_val} =} max_recursion_depth (@var{new_val})\n\ | |
676 Query or set the internal limit on the number of times a function may\n\ | |
677 be called recursively. If the limit is exceeded, an error message is\n\ | |
678 printed and control returns to the top level.\n\ | |
679 @end deftypefn") | |
3131 | 680 { |
5794 | 681 return SET_INTERNAL_VARIABLE (max_recursion_depth); |
2974 | 682 } |
683 | |
684 /* | |
685 ;;; Local Variables: *** | |
686 ;;; mode: C++ *** | |
687 ;;; End: *** | |
688 */ |