Mercurial > octave
annotate libinterp/corefcn/call-stack.cc @ 33617:ec2635a02328 bytecode-interpreter tip
maint: Merge default to bytecode-interpreter.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Tue, 21 May 2024 18:29:03 +0200 |
parents | a71bde898ef9 |
children |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
32589
diff
changeset
|
3 // Copyright (C) 1995-2024 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 # include "config.h" |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 #endif |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 |
26089
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
30 #include "lo-regexp.h" |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
31 #include "str-vec.h" |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
32 |
31781
3cd5c988b3f7
maint: Replace feval invocations with direct calls to Ffunction_name.
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
33 #include "builtin-defun-decls.h" |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 #include "call-stack.h" |
24855
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
35 #include "defun.h" |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
36 #include "interpreter.h" |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
37 #include "interpreter-private.h" |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 #include "oct-map.h" |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 #include "ov.h" |
31781
3cd5c988b3f7
maint: Replace feval invocations with direct calls to Ffunction_name.
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
40 #include "ov-fcn-handle.h" |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 #include "ov-fcn.h" |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 #include "ov-usr-fcn.h" |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
43 #include "pager.h" |
32574
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
44 #if defined (OCTAVE_ENABLE_BYTECODE_EVALUATOR) |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
45 # include "pt-bytecode-vm.h" |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
46 #endif |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
47 #include "stack-frame.h" |
26089
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
48 #include "syminfo.h" |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
49 #include "symrec.h" |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
50 #include "symscope.h" |
24855
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
51 #include "variables.h" |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30888
diff
changeset
|
53 OCTAVE_BEGIN_NAMESPACE(octave) |
29960
939bef0b66e0
merge "namespace octave" and OCTAVE_NAMESPACE_BEGIN/END blocks
John W. Eaton <jwe@octave.org>
parents:
29958
diff
changeset
|
54 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
55 // Use static fields for the best efficiency. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
56 // NOTE: C++0x will allow these two to be merged into one. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
57 static const char *bt_fieldnames[] = |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
58 { "file", "name", "line", "column", nullptr }; |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27071
diff
changeset
|
59 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
60 static const octave_fields bt_fields (bt_fieldnames); |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27071
diff
changeset
|
61 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
62 call_stack::call_stack (tree_evaluator& evaluator) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
63 : m_evaluator (evaluator), m_cs (), m_curr_frame (0), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
64 m_max_stack_depth (1024), m_global_values () |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
65 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
66 push (symbol_scope ("top scope")); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
67 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
68 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
69 octave_function * |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
70 call_stack::current_function (bool skip_first) const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
71 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
72 if (m_cs.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
73 error ("current_function: call stack is empty"); |
27873
020d0e8f7ac6
reafactor mlock, munlock, and mislocked functions
John W. Eaton <jwe@octave.org>
parents:
27844
diff
changeset
|
74 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
75 octave_function *fcn = nullptr; |
27873
020d0e8f7ac6
reafactor mlock, munlock, and mislocked functions
John W. Eaton <jwe@octave.org>
parents:
27844
diff
changeset
|
76 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
77 std::size_t idx = m_curr_frame; |
27873
020d0e8f7ac6
reafactor mlock, munlock, and mislocked functions
John W. Eaton <jwe@octave.org>
parents:
27844
diff
changeset
|
78 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
79 if (idx > 0 && skip_first) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
80 --idx; |
27873
020d0e8f7ac6
reafactor mlock, munlock, and mislocked functions
John W. Eaton <jwe@octave.org>
parents:
27844
diff
changeset
|
81 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
82 while (true) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
83 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
84 fcn = m_cs[idx]->function (); |
27873
020d0e8f7ac6
reafactor mlock, munlock, and mislocked functions
John W. Eaton <jwe@octave.org>
parents:
27844
diff
changeset
|
85 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
86 if (fcn || idx == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
87 break; |
28775
2893db10b8d2
search for current function at current frame, not top of stack
John W. Eaton <jwe@octave.org>
parents:
28430
diff
changeset
|
88 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
89 --idx; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
90 } |
27873
020d0e8f7ac6
reafactor mlock, munlock, and mislocked functions
John W. Eaton <jwe@octave.org>
parents:
27844
diff
changeset
|
91 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
92 return fcn; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
93 } |
27873
020d0e8f7ac6
reafactor mlock, munlock, and mislocked functions
John W. Eaton <jwe@octave.org>
parents:
27844
diff
changeset
|
94 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
95 int |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
96 call_stack::current_line () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
97 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
98 int retval = -1; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
99 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
100 if (! m_cs.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
101 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
102 const std::shared_ptr<stack_frame> elt = m_cs[m_curr_frame]; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
103 retval = elt->line (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
104 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
105 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
106 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
107 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
108 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
109 int |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
110 call_stack::current_column () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
111 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
112 int retval = -1; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
113 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
114 if (! m_cs.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
115 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
116 const std::shared_ptr<stack_frame> elt = m_cs[m_curr_frame]; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
117 retval = elt->column (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
118 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
119 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
120 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
121 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
122 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
123 octave_user_code * |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
124 call_stack::current_user_code () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
125 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
126 // Start at current frame. |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
127 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
128 std::size_t xframe = find_current_user_frame (); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
129 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
130 if (xframe > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
131 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
132 const std::shared_ptr<stack_frame> elt = m_cs[xframe]; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
133 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
134 octave_function *f = elt->function (); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
135 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
136 if (f && f->is_user_code ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
137 return dynamic_cast<octave_user_code *> (f); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
138 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
139 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
140 return nullptr; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
141 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
142 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
143 int |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
144 call_stack::current_user_code_line () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
145 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
146 // Start at current frame. |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
147 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
148 std::size_t xframe = find_current_user_frame (); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
149 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
150 if (xframe > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
151 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
152 const std::shared_ptr<stack_frame> elt = m_cs[xframe]; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
153 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
154 octave_function *f = elt->function (); |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
155 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
156 if (f && f->is_user_code ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
157 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
158 int line = elt->line (); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
159 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
160 if (line > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
161 return line; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
162 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
163 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
164 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
165 return -1; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
166 } |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
167 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
168 int |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
169 call_stack::current_user_code_column () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
170 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
171 // Start at current frame. |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
172 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
173 std::size_t xframe = find_current_user_frame (); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
174 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
175 if (xframe > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
176 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
177 const std::shared_ptr<stack_frame> elt = m_cs[xframe]; |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
178 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
179 octave_function *f = elt->function (); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
180 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
181 if (f && f->is_user_code ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
182 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
183 int column = elt->column (); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
184 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
185 if (column > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
186 return column; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
187 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
188 } |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
189 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
190 return -1; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
191 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
192 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
193 unwind_protect * |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
194 call_stack::curr_fcn_unwind_protect_frame () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
195 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
196 // Start at current frame. |
25399
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25343
diff
changeset
|
197 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
198 std::size_t xframe = find_current_user_frame (); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
199 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
200 if (xframe > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
201 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
202 const std::shared_ptr<stack_frame> elt = m_cs[xframe]; |
25399
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25343
diff
changeset
|
203 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
204 octave_function *f = elt->function (); |
25399
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25343
diff
changeset
|
205 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
206 if (f && f->is_user_code ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
207 return elt->unwind_protect_frame (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
208 } |
25399
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25343
diff
changeset
|
209 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
210 return nullptr; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
211 } |
25399
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25343
diff
changeset
|
212 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
213 octave_user_code * |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
214 call_stack::debug_user_code () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
215 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
216 octave_user_code *retval = nullptr; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
217 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
218 // This should never happen... |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
219 if (m_curr_frame == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
220 return retval; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
221 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
222 std::size_t i = m_curr_frame; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
223 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
224 while (i != 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
225 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
226 const std::shared_ptr<stack_frame> elt = m_cs[i--]; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
227 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
228 octave_function *f = elt->function (); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
229 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
230 if (f && f->is_user_code ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
231 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
232 retval = dynamic_cast<octave_user_code *> (f); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
233 break; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
234 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
235 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
236 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
237 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
238 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
239 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
240 int |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
241 call_stack::debug_user_code_line () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
242 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
243 int retval = -1; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
244 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
245 // This should never happen... |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
246 if (m_curr_frame == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
247 return retval; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
248 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
249 std::size_t i = m_curr_frame; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
250 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
251 while (i != 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
252 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
253 const std::shared_ptr<stack_frame> elt = m_cs[i--]; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
254 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
255 octave_function *f = elt->function (); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
256 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
257 if (f && f->is_user_code ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
258 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
259 if (elt->line ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
260 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
261 retval = elt->line (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
262 break; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
263 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
264 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
265 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
266 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
267 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
268 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
269 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
270 int |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
271 call_stack::debug_user_code_column () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
272 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
273 int retval = -1; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
274 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
275 // This should never happen... |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
276 if (m_curr_frame == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
277 return retval; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
278 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
279 // Start looking with the caller of the calling debug function. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
280 std::size_t i = m_curr_frame; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
281 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
282 while (i != 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
283 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
284 const std::shared_ptr<stack_frame> elt = m_cs[i--]; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
285 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
286 octave_function *f = elt->function (); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
287 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
288 if (f && f->is_user_code ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
289 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
290 if (elt->column ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
291 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
292 retval = elt->column (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
293 break; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
294 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
295 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
296 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
297 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
298 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
299 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
300 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
301 std::string |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
302 call_stack::get_dispatch_class () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
303 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
304 return m_cs[m_curr_frame]->get_dispatch_class (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
305 } |
26965
be5c2a1bad93
allow dispatch class to be stored in stack frame (bug #45351)
John W. Eaton <jwe@octave.org>
parents:
26825
diff
changeset
|
306 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
307 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
308 call_stack::set_dispatch_class (const std::string& class_name) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
309 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
310 m_cs[m_curr_frame]->set_dispatch_class (class_name); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
311 } |
26965
be5c2a1bad93
allow dispatch class to be stored in stack frame (bug #45351)
John W. Eaton <jwe@octave.org>
parents:
26825
diff
changeset
|
312 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
313 bool |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
314 call_stack::is_class_method_executing (std::string& dispatch_class) const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
315 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
316 dispatch_class = ""; |
26795
80f9bc7cdf74
new functions for checking whether constructor or method is executing
John W. Eaton <jwe@octave.org>
parents:
26698
diff
changeset
|
317 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
318 octave_function *f = current_function (); |
26795
80f9bc7cdf74
new functions for checking whether constructor or method is executing
John W. Eaton <jwe@octave.org>
parents:
26698
diff
changeset
|
319 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
320 bool retval = (f && f->is_class_method ()); |
26795
80f9bc7cdf74
new functions for checking whether constructor or method is executing
John W. Eaton <jwe@octave.org>
parents:
26698
diff
changeset
|
321 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
322 if (retval) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
323 dispatch_class = f->dispatch_class (); |
26795
80f9bc7cdf74
new functions for checking whether constructor or method is executing
John W. Eaton <jwe@octave.org>
parents:
26698
diff
changeset
|
324 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
325 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
326 } |
26795
80f9bc7cdf74
new functions for checking whether constructor or method is executing
John W. Eaton <jwe@octave.org>
parents:
26698
diff
changeset
|
327 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
328 bool |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
329 call_stack::is_class_constructor_executing (std::string& dispatch_class) const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
330 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
331 dispatch_class = ""; |
26795
80f9bc7cdf74
new functions for checking whether constructor or method is executing
John W. Eaton <jwe@octave.org>
parents:
26698
diff
changeset
|
332 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
333 octave_function *f = current_function (); |
26795
80f9bc7cdf74
new functions for checking whether constructor or method is executing
John W. Eaton <jwe@octave.org>
parents:
26698
diff
changeset
|
334 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
335 bool retval = (f && f->is_class_constructor ()); |
26795
80f9bc7cdf74
new functions for checking whether constructor or method is executing
John W. Eaton <jwe@octave.org>
parents:
26698
diff
changeset
|
336 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
337 if (retval) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
338 dispatch_class = f->dispatch_class (); |
26795
80f9bc7cdf74
new functions for checking whether constructor or method is executing
John W. Eaton <jwe@octave.org>
parents:
26698
diff
changeset
|
339 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
340 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
341 } |
26795
80f9bc7cdf74
new functions for checking whether constructor or method is executing
John W. Eaton <jwe@octave.org>
parents:
26698
diff
changeset
|
342 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
343 bool |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
344 call_stack::all_scripts () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
345 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
346 bool retval = true; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
347 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
348 auto p = m_cs.cend (); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
349 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
350 while (p != m_cs.cbegin ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
351 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
352 const std::shared_ptr<stack_frame> elt = *(--p); |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
353 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
354 octave_function *f = elt->function (); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
355 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
356 if (f && ! f->is_user_script ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
357 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
358 retval = false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
359 break; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
360 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
361 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
362 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
363 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
364 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
365 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
366 void call_stack::get_new_frame_index_and_links |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
367 (std::size_t& new_frame_idx, std::shared_ptr<stack_frame>& parent_link, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
368 std::shared_ptr<stack_frame>& static_link) const |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
369 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
370 // FIXME: is there a better way? |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
371 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
372 std::size_t prev_frame_idx = m_curr_frame; |
28796
7e0712b3388f
avoid out-of-bounds element access in call stack (bug #59189)
John W. Eaton <jwe@octave.org>
parents:
28793
diff
changeset
|
373 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
374 new_frame_idx = m_cs.size (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
375 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
376 // m_max_stack_depth should never be less than zero. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
377 if (new_frame_idx > static_cast<std::size_t> (m_max_stack_depth)) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
378 error ("max_stack_depth exceeded"); |
28796
7e0712b3388f
avoid out-of-bounds element access in call stack (bug #59189)
John W. Eaton <jwe@octave.org>
parents:
28793
diff
changeset
|
379 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
380 // There can't be any links to previous frames if this is the first |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
381 // frame on the stack. |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
382 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
383 if (new_frame_idx == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
384 return; |
28796
7e0712b3388f
avoid out-of-bounds element access in call stack (bug #59189)
John W. Eaton <jwe@octave.org>
parents:
28793
diff
changeset
|
385 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
386 parent_link = m_cs[prev_frame_idx]; |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
387 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
388 octave_function *t_fcn = parent_link->function (); |
28796
7e0712b3388f
avoid out-of-bounds element access in call stack (bug #59189)
John W. Eaton <jwe@octave.org>
parents:
28793
diff
changeset
|
389 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
390 static_link = (t_fcn |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
391 ? (t_fcn->is_user_code () |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
392 ? parent_link : parent_link->static_link ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
393 : parent_link); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
394 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
395 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
396 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
397 call_stack::push (const symbol_scope& scope) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
398 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
399 std::size_t new_frame_idx; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
400 std::shared_ptr<stack_frame> parent_link; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
401 std::shared_ptr<stack_frame> static_link; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
402 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
403 get_new_frame_index_and_links (new_frame_idx, parent_link, static_link); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
404 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
405 std::shared_ptr<stack_frame> |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
406 new_frame (stack_frame::create (m_evaluator, scope, new_frame_idx, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
407 parent_link, static_link)); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
408 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
409 m_cs.push_back (new_frame); |
28796
7e0712b3388f
avoid out-of-bounds element access in call stack (bug #59189)
John W. Eaton <jwe@octave.org>
parents:
28793
diff
changeset
|
410 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
411 m_curr_frame = new_frame_idx; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
412 } |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
413 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
414 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
415 call_stack::push (octave_user_function *fcn, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
416 const std::shared_ptr<stack_frame>& closure_frames) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
417 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
418 std::size_t new_frame_idx; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
419 std::shared_ptr<stack_frame> parent_link; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
420 std::shared_ptr<stack_frame> static_link; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
421 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
422 get_new_frame_index_and_links (new_frame_idx, parent_link, static_link); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
423 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
424 std::shared_ptr<stack_frame> |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
425 new_frame (stack_frame::create (m_evaluator, fcn, new_frame_idx, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
426 parent_link, static_link, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
427 closure_frames)); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
428 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
429 m_cs.push_back (new_frame); |
28796
7e0712b3388f
avoid out-of-bounds element access in call stack (bug #59189)
John W. Eaton <jwe@octave.org>
parents:
28793
diff
changeset
|
430 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
431 m_curr_frame = new_frame_idx; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
432 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
433 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
434 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
435 call_stack::push (octave_user_function *fcn, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
436 const stack_frame::local_vars_map& local_vars, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
437 const std::shared_ptr<stack_frame>& closure_frames) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
438 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
439 std::size_t new_frame_idx; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
440 std::shared_ptr<stack_frame> parent_link; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
441 std::shared_ptr<stack_frame> static_link; |
28430
5bfa8e018704
store local init vars for anonymous functions in handle, not function object
John W. Eaton <jwe@octave.org>
parents:
28429
diff
changeset
|
442 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
443 get_new_frame_index_and_links (new_frame_idx, parent_link, static_link); |
28430
5bfa8e018704
store local init vars for anonymous functions in handle, not function object
John W. Eaton <jwe@octave.org>
parents:
28429
diff
changeset
|
444 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
445 std::shared_ptr<stack_frame> |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
446 new_frame (stack_frame::create (m_evaluator, fcn, new_frame_idx, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
447 parent_link, static_link, local_vars, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
448 closure_frames)); |
28430
5bfa8e018704
store local init vars for anonymous functions in handle, not function object
John W. Eaton <jwe@octave.org>
parents:
28429
diff
changeset
|
449 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
450 m_cs.push_back (new_frame); |
28796
7e0712b3388f
avoid out-of-bounds element access in call stack (bug #59189)
John W. Eaton <jwe@octave.org>
parents:
28793
diff
changeset
|
451 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
452 m_curr_frame = new_frame_idx; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
453 } |
28430
5bfa8e018704
store local init vars for anonymous functions in handle, not function object
John W. Eaton <jwe@octave.org>
parents:
28429
diff
changeset
|
454 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
455 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
456 call_stack::push (octave_user_script *script) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
457 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
458 std::size_t new_frame_idx; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
459 std::shared_ptr<stack_frame> parent_link; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
460 std::shared_ptr<stack_frame> static_link; |
24855
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
461 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
462 get_new_frame_index_and_links (new_frame_idx, parent_link, static_link); |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
463 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
464 std::shared_ptr<stack_frame> |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
465 new_frame (stack_frame::create (m_evaluator, script, new_frame_idx, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
466 parent_link, static_link)); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
467 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
468 m_cs.push_back (new_frame); |
28796
7e0712b3388f
avoid out-of-bounds element access in call stack (bug #59189)
John W. Eaton <jwe@octave.org>
parents:
28793
diff
changeset
|
469 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
470 m_curr_frame = new_frame_idx; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
471 } |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
472 |
32574
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
473 #if defined (OCTAVE_ENABLE_BYTECODE_EVALUATOR) |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
474 |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
475 void call_stack::push (vm &vm, octave_user_script *fcn, int nargout, int nargin) |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
476 { |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
477 std::size_t new_frame_idx; |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
478 std::shared_ptr<stack_frame> parent_link; |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
479 std::shared_ptr<stack_frame> static_link; |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
480 |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
481 get_new_frame_index_and_links (new_frame_idx, parent_link, static_link); |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
482 |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
483 std::shared_ptr<stack_frame> new_frame = |
32814
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
484 stack_frame::create_bytecode_script ( |
32574
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
485 m_evaluator, |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
486 fcn, |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
487 vm, |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
488 new_frame_idx, // ??? index |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
489 parent_link, |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
490 static_link, |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
491 nargout, |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
492 nargin); |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
493 |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
494 m_cs.push_back (new_frame); |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
495 |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
496 m_curr_frame = new_frame_idx; |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
497 } |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
498 |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
499 void call_stack::push (vm &vm, octave_user_function *fcn, int nargout, int nargin, |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
500 const std::shared_ptr<stack_frame>& closure_frames) |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
501 { |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
502 std::size_t new_frame_idx; |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
503 std::shared_ptr<stack_frame> parent_link; |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
504 std::shared_ptr<stack_frame> static_link; |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
505 |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
506 get_new_frame_index_and_links (new_frame_idx, parent_link, static_link); |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
507 |
32814
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
508 std::shared_ptr<stack_frame> new_frame; |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
509 |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
510 if (fcn->is_nested_function ()) |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
511 new_frame = stack_frame::create_bytecode_nested (m_evaluator, fcn, vm, |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
512 new_frame_idx, |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
513 parent_link, static_link, closure_frames, |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
514 nargout, nargin); |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
515 else |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
516 { |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
517 CHECK_PANIC (fcn->is_anonymous_function ()); |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
518 new_frame = stack_frame::create_bytecode_anon (m_evaluator, fcn, vm, |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
519 new_frame_idx, |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
520 parent_link, static_link, closure_frames, |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
521 nargout, nargin); |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
522 } |
32574
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
523 |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
524 m_cs.push_back (new_frame); |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
525 |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
526 m_curr_frame = new_frame_idx; |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
527 } |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
528 |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
529 void call_stack::push (vm &vm, octave_user_function *fcn, int nargout, int nargin) |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
530 { |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
531 std::size_t new_frame_idx; |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
532 std::shared_ptr<stack_frame> parent_link; |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
533 std::shared_ptr<stack_frame> static_link; |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
534 |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
535 get_new_frame_index_and_links (new_frame_idx, parent_link, static_link); |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
536 |
32814
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
537 if (fcn->is_nested_function()) |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
538 { |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
539 std::shared_ptr<stack_frame> new_frame |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
540 = stack_frame::create_bytecode_nested (m_evaluator, fcn, vm, |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
541 new_frame_idx, // ??? index |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
542 parent_link, static_link, nullptr, |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
543 nargout, nargin); |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
544 |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
545 m_cs.push_back (new_frame); |
32574
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
546 |
32814
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
547 m_curr_frame = new_frame_idx; |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
548 } |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
549 else if (fcn->is_anonymous_function()) |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
550 { |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
551 std::shared_ptr<stack_frame> new_frame |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
552 = stack_frame::create_bytecode (m_evaluator, fcn, vm, |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
553 new_frame_idx, // ??? index |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
554 parent_link, static_link, |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
555 nargout, nargin); |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
556 |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
557 m_cs.push_back (new_frame); |
32574
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
558 |
32814
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
559 m_curr_frame = new_frame_idx; |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
560 } |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
561 else |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
562 { |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
563 std::shared_ptr<stack_frame> new_frame |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
564 = stack_frame::create_bytecode (m_evaluator, fcn, vm, |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
565 new_frame_idx, // ??? index |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
566 parent_link, static_link, |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
567 nargout, nargin); |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
568 |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
569 m_cs.push_back (new_frame); |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
570 |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
571 m_curr_frame = new_frame_idx; |
2eabd2567846
Refactor dynamic stack frame for bytecode interpreter (bug #65191)
Petter T. <petter.vilhelm@gmail.com>
parents:
32635
diff
changeset
|
572 } |
32574
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
573 } |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
574 |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
575 #endif |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
576 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
577 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
578 call_stack::push (octave_function *fcn) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
579 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
580 std::size_t new_frame_idx; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
581 std::shared_ptr<stack_frame> parent_link; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
582 std::shared_ptr<stack_frame> static_link; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
583 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
584 get_new_frame_index_and_links (new_frame_idx, parent_link, static_link); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
585 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
586 std::shared_ptr<stack_frame> |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
587 new_frame (stack_frame::create (m_evaluator, fcn, new_frame_idx, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
588 parent_link, static_link)); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
589 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
590 m_cs.push_back (new_frame); |
28796
7e0712b3388f
avoid out-of-bounds element access in call stack (bug #59189)
John W. Eaton <jwe@octave.org>
parents:
28793
diff
changeset
|
591 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
592 m_curr_frame = new_frame_idx; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
593 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
594 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
595 bool |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
596 call_stack::goto_frame (std::size_t n, bool verbose) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
597 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
598 bool retval = false; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
599 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
600 if (n < m_cs.size ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
601 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
602 retval = true; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
603 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
604 m_curr_frame = n; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
605 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
606 if (verbose) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
607 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
608 const std::shared_ptr<stack_frame> elt = m_cs[n]; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
609 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
610 elt->display_stopped_in_message (octave_stdout); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
611 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
612 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
613 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
614 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
615 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
616 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
617 std::size_t |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
618 call_stack::find_current_user_frame () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
619 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
620 std::size_t user_frame = m_curr_frame; |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
621 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
622 std::shared_ptr<stack_frame> frm = m_cs[user_frame]; |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
623 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
624 if (! (frm->is_user_fcn_frame () || frm->is_user_script_frame () |
32546
f561b6a31e02
remove experimental bytecode interpreter from stable branch for release
John W. Eaton <jwe@octave.org>
parents:
32545
diff
changeset
|
625 || frm->is_scope_frame ())) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
626 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
627 frm = frm->static_link (); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
628 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
629 user_frame = frm->index (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
630 } |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
631 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
632 return user_frame; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
633 } |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
634 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
635 std::shared_ptr<stack_frame> |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
636 call_stack::current_user_frame () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
637 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
638 std::size_t frame = find_current_user_frame (); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
639 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
640 return m_cs[frame]; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
641 } |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
642 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
643 // Go to the Nth frame (up if N is negative or down if positive) in |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
644 // the call stack that corresponds to a script, function, or scope |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
645 // beginning with the frame indexed by START. |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
646 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
647 std::size_t |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
648 call_stack::dbupdown (std::size_t start, int n, bool verbose) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
649 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
650 if (start >= m_cs.size ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
651 error ("invalid stack frame"); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
652 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
653 // Can't go up from here. |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
654 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
655 if (start == 0 && n < 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
656 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
657 if (verbose) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
658 m_cs[start]->display_stopped_in_message (octave_stdout); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
659 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
660 return start; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
661 } |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
662 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
663 std::shared_ptr<stack_frame> frm = m_cs[start]; |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
664 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
665 if (! (frm && (frm->is_user_fcn_frame () |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
666 || frm->is_user_script_frame () |
32546
f561b6a31e02
remove experimental bytecode interpreter from stable branch for release
John W. Eaton <jwe@octave.org>
parents:
32545
diff
changeset
|
667 || frm->is_scope_frame ()))) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
668 error ("call_stack::dbupdown: invalid initial frame in call stack!"); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
669 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
670 // Use index into the call stack to begin the search. At this point |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
671 // we iterate up or down using indexing instead of static links |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
672 // because ... FIXME: it's a bit complicated, but deserves |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
673 // explanation. May be easiest with some pictures of the call stack |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
674 // for an example or two. |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
675 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
676 std::size_t xframe = frm->index (); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
677 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
678 if (n == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
679 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
680 if (verbose) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
681 frm->display_stopped_in_message (octave_stdout); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
682 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
683 return xframe; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
684 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
685 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
686 int incr = 0; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
687 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
688 if (n < 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
689 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
690 incr = -1; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
691 n = -n; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
692 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
693 else if (n > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
694 incr = 1; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
695 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
696 std::size_t last_good_frame = 0; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
697 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
698 while (true) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
699 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
700 frm = m_cs[xframe]; |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
701 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
702 if (frm->is_user_fcn_frame () || frm->is_user_script_frame () |
32546
f561b6a31e02
remove experimental bytecode interpreter from stable branch for release
John W. Eaton <jwe@octave.org>
parents:
32545
diff
changeset
|
703 || frm->is_scope_frame ()) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
704 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
705 last_good_frame = xframe; |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
706 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
707 if (n == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
708 break; |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
709 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
710 n--; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
711 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
712 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
713 xframe += incr; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
714 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
715 if (xframe == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
716 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
717 last_good_frame = 0; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
718 break; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
719 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
720 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
721 if (xframe == m_cs.size ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
722 break; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
723 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
724 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
725 if (verbose) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
726 m_cs[last_good_frame]->display_stopped_in_message (octave_stdout); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
727 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
728 return last_good_frame; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
729 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
730 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
731 // Like dbupdown above but find the starting frame automatically from |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
732 // the current frame. If the current frame is already a user |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
733 // function, script, or scope frame, use that. Otherwise, follow |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
734 // the static link for the current frame. If that is not a user |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
735 // function, script or scope frame then there is an error in the |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
736 // implementation. |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
737 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
738 std::size_t |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
739 call_stack::dbupdown (int n, bool verbose) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
740 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
741 std::size_t start = find_current_user_frame (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
742 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
743 return dbupdown (start, n, verbose); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
744 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
745 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
746 // May be used to temporarily change the value ov m_curr_frame inside |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
747 // a function like evalin. If used in a function like dbup, the new |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
748 // value of m_curr_frame would be wiped out when dbup returns and the |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
749 // stack frame for dbup is popped. |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
750 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
751 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
752 call_stack::goto_caller_frame () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
753 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
754 std::size_t start = find_current_user_frame (); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
755 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
756 std::shared_ptr<stack_frame> caller_frame = m_cs[start]->static_link (); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
757 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
758 // Allow evalin ('caller', ...) to work when called from the |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
759 // top-level prompt. |
29349
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
29064
diff
changeset
|
760 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
761 m_curr_frame = caller_frame ? caller_frame->index () : 0; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
762 } |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
763 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
764 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
765 call_stack::goto_base_frame () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
766 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
767 if (m_curr_frame > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
768 m_curr_frame = 0; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
769 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
770 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
771 std::list<std::shared_ptr<stack_frame>> |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
772 call_stack::backtrace_frames (octave_idx_type& curr_user_frame) const |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
773 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
774 std::list<std::shared_ptr<stack_frame>> frames; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
775 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
776 // curr_frame is the index to the current frame in the overall call |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
777 // stack, which includes any compiled function frames and scope |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
778 // frames. The curr_user_frame value we set is the index into the |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
779 // subset of frames returned in the octave_map object. |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
780 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
781 std::size_t curr_frame = find_current_user_frame (); |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
782 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
783 // Don't include top-level stack frame in the list. |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
784 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
785 for (std::size_t n = m_cs.size () - 1; n > 0; n--) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
786 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
787 std::shared_ptr<stack_frame> frm = m_cs[n]; |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
788 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
789 if (frm->is_user_script_frame () || frm->is_user_fcn_frame () |
32546
f561b6a31e02
remove experimental bytecode interpreter from stable branch for release
John W. Eaton <jwe@octave.org>
parents:
32545
diff
changeset
|
790 || frm->is_scope_frame ()) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
791 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
792 if (frm->index () == curr_frame) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
793 curr_user_frame = frames.size (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
794 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
795 frames.push_back (frm); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
796 } |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
797 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
798 if (n == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
799 break; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
800 } |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
801 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
802 return frames; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
803 } |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
804 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
805 std::list<std::shared_ptr<stack_frame>> |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31730
diff
changeset
|
806 call_stack::backtrace_frames () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
807 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
808 octave_idx_type curr_user_frame = -1; |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
809 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
810 return backtrace_frames (curr_user_frame); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
811 } |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
812 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
813 std::list<frame_info> |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
814 call_stack::backtrace_info (octave_idx_type& curr_user_frame, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
815 bool print_subfn) const |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
816 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
817 std::list<std::shared_ptr<stack_frame>> frames |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
818 = backtrace_frames (curr_user_frame); |
27471 | 819 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
820 std::list<frame_info> retval; |
27471 | 821 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
822 for (const auto& frm : frames) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
823 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
824 if (frm->is_user_script_frame () || frm->is_user_fcn_frame () |
32546
f561b6a31e02
remove experimental bytecode interpreter from stable branch for release
John W. Eaton <jwe@octave.org>
parents:
32545
diff
changeset
|
825 || frm->is_scope_frame ()) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
826 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
827 retval.push_back (frame_info (frm->fcn_file_name (), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
828 frm->fcn_name (print_subfn), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
829 frm->line (), frm->column ())); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
830 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
831 } |
27471 | 832 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
833 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
834 } |
27471 | 835 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
836 std::list<frame_info> |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
837 call_stack::backtrace_info () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
838 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
839 octave_idx_type curr_user_frame = -1; |
27471 | 840 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
841 return backtrace_info (curr_user_frame, true); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
842 } |
27471 | 843 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
844 octave_map |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
845 call_stack::backtrace (octave_idx_type& curr_user_frame, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
846 bool print_subfn) const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
847 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
848 std::list<std::shared_ptr<stack_frame>> frames |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
849 = backtrace_frames (curr_user_frame); |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
850 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
851 std::size_t nframes = frames.size (); |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
852 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
853 octave_map retval (dim_vector (nframes, 1), bt_fields); |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
854 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
855 Cell& file = retval.contents (0); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
856 Cell& name = retval.contents (1); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
857 Cell& line = retval.contents (2); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
858 Cell& column = retval.contents (3); |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
859 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
860 octave_idx_type k = 0; |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
861 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
862 for (const auto& frm : frames) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
863 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
864 if (frm->is_user_script_frame () || frm->is_user_fcn_frame () |
32546
f561b6a31e02
remove experimental bytecode interpreter from stable branch for release
John W. Eaton <jwe@octave.org>
parents:
32545
diff
changeset
|
865 || frm->is_scope_frame ()) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
866 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
867 file(k) = frm->fcn_file_name (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
868 name(k) = frm->fcn_name (print_subfn); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
869 line(k) = frm->line (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
870 column(k) = frm->column (); |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
871 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
872 k++; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
873 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
874 } |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
875 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
876 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
877 } |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
878 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
879 octave_map |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
880 call_stack::backtrace () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
881 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
882 octave_idx_type curr_user_frame = -1; |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
883 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
884 return backtrace (curr_user_frame, true); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
885 } |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
886 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
887 octave_map |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
888 call_stack::empty_backtrace () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
889 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
890 return octave_map (dim_vector (0, 1), bt_fields); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
891 } |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
892 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
893 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
894 call_stack::pop () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
895 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
896 // Never pop top scope. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
897 // FIXME: is it possible for this case to happen? |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
898 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
899 if (m_cs.size () > 1) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
900 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
901 std::shared_ptr<stack_frame> elt = m_cs.back (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
902 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
903 std::shared_ptr<stack_frame> caller = elt->parent_link (); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
904 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
905 m_curr_frame = caller->index (); |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
906 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
907 if (elt->is_closure_context ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
908 elt->break_closure_cycles (elt); |
29476
c74ff452e2bb
avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
909 |
32310
cad9584e7bad
Nested functions handles make stack frames leak (bug #64620)
Petter T.
parents:
32309
diff
changeset
|
910 elt->clear_parent_static_link (); |
cad9584e7bad
Nested functions handles make stack frames leak (bug #64620)
Petter T.
parents:
32309
diff
changeset
|
911 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
912 m_cs.pop_back (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
913 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
914 } |
24855
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
915 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
916 std::shared_ptr<stack_frame> |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
917 call_stack::pop_return () |
32146
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
918 { |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
919 if (!m_cs.empty ()) |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
920 { |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
921 std::shared_ptr<stack_frame> elt = std::move (m_cs.back ()); |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
922 m_cs.pop_back (); |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
923 |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
924 m_curr_frame = elt->parent_frame_index (); |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
925 |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
926 if (elt->is_closure_context ()) |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
927 elt->break_closure_cycles (elt); |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
928 |
32310
cad9584e7bad
Nested functions handles make stack frames leak (bug #64620)
Petter T.
parents:
32309
diff
changeset
|
929 elt->clear_parent_static_link (); |
cad9584e7bad
Nested functions handles make stack frames leak (bug #64620)
Petter T.
parents:
32309
diff
changeset
|
930 |
32146
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
931 return elt; |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
932 } |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
933 |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
934 return nullptr; |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
935 } |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
936 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
937 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
938 call_stack::clear () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
939 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
940 while (! m_cs.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
941 pop (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
942 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
943 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
944 symbol_info_list |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
945 call_stack::all_variables () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
946 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
947 return m_cs[m_curr_frame]->all_variables (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
948 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
949 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
950 std::list<std::string> |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
951 call_stack::global_variable_names () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
952 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
953 std::list<std::string> retval; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
954 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
955 for (const auto& nm_ov : m_global_values) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
956 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
957 if (nm_ov.second.is_defined ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
958 retval.push_back (nm_ov.first); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
959 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
960 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
961 retval.sort (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
962 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
963 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
964 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
965 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
966 std::list<std::string> |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
967 call_stack::top_level_variable_names () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
968 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
969 return m_cs[0]->variable_names (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
970 } |
27594
e091e09d26f0
restore some symbol table functions for backward compatibility
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
971 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
972 std::list<std::string> |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
973 call_stack::variable_names () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
974 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
975 return m_cs[m_curr_frame]->variable_names (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
976 } |
27594
e091e09d26f0
restore some symbol table functions for backward compatibility
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
977 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
978 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
979 call_stack::clear_global_variable (const std::string& name) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
980 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
981 auto p = m_global_values.find (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
982 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
983 if (p != m_global_values.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
984 p->second = octave_value (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
985 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
986 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
987 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
988 call_stack::clear_global_variable_pattern (const std::string& pattern) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
989 { |
32572
e424a55bc9fb
Use own function for symbol name matching on Windows (bug #64975).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32546
diff
changeset
|
990 symbol_match pat (pattern); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
991 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
992 for (auto& nm_ov : m_global_values) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
993 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
994 if (pat.match (nm_ov.first)) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
995 nm_ov.second = octave_value (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
996 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
997 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
998 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
999 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1000 call_stack::clear_global_variable_regexp (const std::string& pattern) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1001 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1002 regexp pat (pattern); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1003 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1004 for (auto& nm_ov : m_global_values) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1005 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1006 if (pat.is_match (nm_ov.first)) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1007 nm_ov.second = octave_value (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1008 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1009 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1010 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1011 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1012 call_stack::clear_global_variables () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1013 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1014 for (auto& nm_ov : m_global_values) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1015 nm_ov.second = octave_value (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1016 } |
26092
661dfb062485
use symbol_info_list to gather data for save function
John W. Eaton <jwe@octave.org>
parents:
26089
diff
changeset
|
1017 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1018 symbol_info_list |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1019 call_stack::glob_symbol_info (const std::string& pattern) const |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1020 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1021 return m_cs[m_curr_frame]->glob_symbol_info (pattern); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1022 } |
26093
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
1023 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1024 symbol_info_list |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1025 call_stack::regexp_symbol_info (const std::string& pattern) const |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1026 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1027 return m_cs[m_curr_frame]->regexp_symbol_info (pattern); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1028 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1029 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1030 symbol_info_list |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1031 call_stack::get_symbol_info () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1032 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1033 return m_cs[m_curr_frame]->get_symbol_info (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1034 } |
26093
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
1035 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1036 symbol_info_list |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1037 call_stack::top_scope_symbol_info () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1038 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1039 return m_cs[0]->get_symbol_info (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1040 } |
26093
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
1041 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1042 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1043 call_stack::max_stack_depth (const octave_value_list& args, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1044 int nargout) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1045 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1046 return set_internal_variable (m_max_stack_depth, args, nargout, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1047 "max_stack_depth", 0); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1048 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1049 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1050 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1051 call_stack::make_persistent (const symbol_record& sym) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1052 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1053 m_cs[m_curr_frame]->make_persistent (sym); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1054 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1055 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1056 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1057 call_stack::make_global (const symbol_record& sym) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1058 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1059 m_cs[m_curr_frame]->make_global (sym); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1060 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1061 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1062 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1063 call_stack::global_varval (const std::string& name) const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1064 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1065 auto p = m_global_values.find (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1066 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1067 return p == m_global_values.end () ? octave_value () : p->second; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1068 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1069 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1070 octave_value& |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1071 call_stack::global_varref (const std::string& name) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1072 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1073 return m_global_values[name]; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1074 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1075 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1076 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1077 call_stack::get_top_level_value (const std::string& name) const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1078 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1079 return m_cs[0]->varval (name); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1080 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1081 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1082 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1083 call_stack::set_top_level_value (const std::string& name, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1084 const octave_value& value) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1085 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1086 m_cs[0]->assign (name, value); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1087 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1088 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1089 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1090 call_stack::do_who (int argc, const string_vector& argv, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1091 bool return_list, bool verbose) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1092 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1093 octave_value retval; |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1094 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1095 std::string my_name = argv[0]; |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1096 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1097 std::string file_name; |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1098 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1099 bool from_file = false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1100 bool global_only = false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1101 bool have_regexp = false; |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1102 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1103 int i = 1; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1104 while (i < argc) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1105 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1106 if (argv[i] == "-file") |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1107 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1108 if (from_file) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1109 error ("%s: -file option may only be specified once", |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1110 my_name.c_str ()); |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1111 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1112 from_file = true; |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1113 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1114 if (i == argc - 1) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1115 error ("%s: -file argument must be followed by a filename", |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1116 my_name.c_str ()); |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1117 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1118 file_name = argv[++i]; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1119 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1120 else if (argv[i] == "-regexp") |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1121 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1122 have_regexp = true; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1123 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1124 else if (argv[i] == "global") |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1125 global_only = true; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1126 else if (argv[i][0] == '-') |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1127 warning ("%s: unrecognized option '%s'", my_name.c_str (), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1128 argv[i].c_str ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1129 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1130 break; |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1131 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1132 i++; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1133 } |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1134 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1135 int npatterns = argc - i; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1136 string_vector patterns; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1137 if (npatterns > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1138 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1139 patterns.resize (npatterns); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1140 for (int j = 0; j < npatterns; j++) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1141 patterns[j] = argv[i+j]; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1142 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1143 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1144 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1145 patterns.resize (1); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1146 patterns[0] = "*"; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1147 } |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1148 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1149 if (from_file) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1150 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1151 // FIXME: This is an inefficient manner to implement this as the |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1152 // variables are loaded in to a temporary context and then treated. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1153 // It would be better to refactor symbol_info_list to not store the |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1154 // symbol records and then use it in load-save.cc (do_load) to |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1155 // implement this option there so that the variables are never |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1156 // stored at all. |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1157 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1158 // Set up temporary scope. |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1159 |
31782 | 1160 symbol_scope tmp_scope (file_name); |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1161 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1162 push (tmp_scope); |
28825
473ee93cf1ea
Replace unwind_protect with more efficient constructs (bug #59192).
Rik <rik@octave.org>
parents:
28796
diff
changeset
|
1163 |
33034
49128bdb9eb2
use explicit lambda-expression captures (bug #65318)
John W. Eaton <jwe@octave.org>
parents:
33033
diff
changeset
|
1164 unwind_action restore_scope ([this] () { pop (); }); |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1165 |
31730
610a85b0ff62
use interpreter::feval instead of global feval function
John W. Eaton <jwe@octave.org>
parents:
31706
diff
changeset
|
1166 interpreter& interp = m_evaluator.get_interpreter (); |
610a85b0ff62
use interpreter::feval instead of global feval function
John W. Eaton <jwe@octave.org>
parents:
31706
diff
changeset
|
1167 |
31813
73fdf7f8381b
maint: Use consistent coding style when calling Ffunction().
Rik <rik@octave.org>
parents:
31782
diff
changeset
|
1168 Fload (interp, ovl (file_name)); |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1169 |
31782 | 1170 std::string newmsg = "Variables in the file " + file_name + ":\n"; |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1171 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1172 if (global_only) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1173 return do_global_who_two (patterns, have_regexp, return_list, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1174 verbose, newmsg); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1175 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1176 return do_who_two (patterns, have_regexp, return_list, verbose, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1177 newmsg); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1178 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1179 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1180 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1181 if (global_only) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1182 return do_global_who_two (patterns, have_regexp, return_list, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1183 verbose); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1184 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1185 return do_who_two (patterns, have_regexp, return_list, verbose); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1186 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1187 } |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1188 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1189 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1190 call_stack::do_who_two (const string_vector& patterns, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1191 bool have_regexp, bool return_list, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1192 bool verbose, const std::string& msg) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1193 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1194 return m_cs[m_curr_frame]->who (patterns, have_regexp, return_list, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1195 verbose, m_evaluator.whos_line_format (), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1196 msg); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1197 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1198 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1199 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1200 call_stack::do_global_who_two (const string_vector& patterns, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1201 bool have_regexp, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1202 bool return_list, bool verbose, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1203 const std::string& msg) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1204 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1205 symbol_info_list symbol_stats; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1206 std::list<std::string> symbol_names; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1207 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1208 octave_idx_type npatterns = patterns.numel (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1209 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1210 for (octave_idx_type j = 0; j < npatterns; j++) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1211 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1212 std::string pattern = patterns[j]; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1213 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1214 std::list<std::string> tmp; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1215 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1216 if (have_regexp) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1217 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1218 regexp pat (pattern); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1219 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1220 for (auto& nm_ov : m_global_values) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1221 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1222 if (pat.is_match (nm_ov.first)) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1223 tmp.push_back (nm_ov.first); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1224 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1225 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1226 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1227 { |
32572
e424a55bc9fb
Use own function for symbol name matching on Windows (bug #64975).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32546
diff
changeset
|
1228 symbol_match pat (pattern); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1229 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1230 for (auto& nm_ov : m_global_values) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1231 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1232 if (pat.match (nm_ov.first)) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1233 tmp.push_back (nm_ov.first); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1234 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1235 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1236 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1237 for (const auto& nm : tmp) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1238 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1239 octave_value value = m_global_values[nm]; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1240 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1241 if (value.is_defined ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1242 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1243 if (verbose) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1244 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1245 bool is_formal = false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1246 bool is_global = true; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1247 bool is_persistent = false; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1248 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1249 symbol_info syminf (nm, value, is_formal, is_global, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1250 is_persistent); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1251 |
32936
0b5f3219b650
eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
1252 symbol_stats.push_back (syminf); |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1253 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1254 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1255 symbol_names.push_back (nm); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1256 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1257 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1258 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1259 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1260 if (return_list) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1261 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1262 if (verbose) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1263 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1264 std::string caller_fcn_name; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1265 octave_function *caller_fcn = caller_function (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1266 if (caller_fcn) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1267 caller_fcn_name = caller_fcn->name (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1268 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1269 return symbol_stats.map_value (caller_fcn_name, 1); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1270 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1271 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1272 return Cell (string_vector (symbol_names)); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1273 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1274 else if (! (symbol_stats.empty () && symbol_names.empty ())) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1275 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1276 if (msg.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1277 octave_stdout << "Global variables:\n\n"; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1278 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1279 octave_stdout << msg; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1280 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1281 if (verbose) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1282 symbol_stats.display (octave_stdout, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1283 m_evaluator.whos_line_format ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1284 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1285 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1286 string_vector names (symbol_names); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1287 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1288 names.list_in_columns (octave_stdout); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1289 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1290 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1291 octave_stdout << "\n"; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1292 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1293 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1294 return octave_value (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1295 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1296 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1297 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1298 call_stack::display () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1299 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1300 std::ostream& os = octave_stdout; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1301 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1302 std::size_t nframes = size (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1303 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1304 for (std::size_t i = 0; i < nframes; i++) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1305 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1306 m_cs[i]->display (false); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1307 if (i < nframes - 1) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1308 os << std::endl; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1309 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1310 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1311 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1312 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1313 call_stack::set_auto_fcn_var (stack_frame::auto_var_type avt, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1314 const octave_value& val) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1315 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1316 m_cs[m_curr_frame]->set_auto_fcn_var (avt, val); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1317 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1318 |
32151
72dcb1cef2c9
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
32148
diff
changeset
|
1319 void |
32125
fc5a9a9e5cea
new set_nargin and set_nargout functions for evaluator
Petter T. <petter.vilhelm@gmail.com>
parents:
31813
diff
changeset
|
1320 call_stack::set_nargin (int nargin) |
fc5a9a9e5cea
new set_nargin and set_nargout functions for evaluator
Petter T. <petter.vilhelm@gmail.com>
parents:
31813
diff
changeset
|
1321 { |
fc5a9a9e5cea
new set_nargin and set_nargout functions for evaluator
Petter T. <petter.vilhelm@gmail.com>
parents:
31813
diff
changeset
|
1322 m_cs[m_curr_frame]->set_nargin (nargin); |
fc5a9a9e5cea
new set_nargin and set_nargout functions for evaluator
Petter T. <petter.vilhelm@gmail.com>
parents:
31813
diff
changeset
|
1323 } |
fc5a9a9e5cea
new set_nargin and set_nargout functions for evaluator
Petter T. <petter.vilhelm@gmail.com>
parents:
31813
diff
changeset
|
1324 |
32151
72dcb1cef2c9
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
32148
diff
changeset
|
1325 void |
32125
fc5a9a9e5cea
new set_nargin and set_nargout functions for evaluator
Petter T. <petter.vilhelm@gmail.com>
parents:
31813
diff
changeset
|
1326 call_stack::set_nargout (int nargout) |
fc5a9a9e5cea
new set_nargin and set_nargout functions for evaluator
Petter T. <petter.vilhelm@gmail.com>
parents:
31813
diff
changeset
|
1327 { |
fc5a9a9e5cea
new set_nargin and set_nargout functions for evaluator
Petter T. <petter.vilhelm@gmail.com>
parents:
31813
diff
changeset
|
1328 m_cs[m_curr_frame]->set_nargout (nargout); |
fc5a9a9e5cea
new set_nargin and set_nargout functions for evaluator
Petter T. <petter.vilhelm@gmail.com>
parents:
31813
diff
changeset
|
1329 } |
fc5a9a9e5cea
new set_nargin and set_nargout functions for evaluator
Petter T. <petter.vilhelm@gmail.com>
parents:
31813
diff
changeset
|
1330 |
32574
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
1331 void |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
1332 call_stack::set_active_bytecode_ip (int ip) |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
1333 { |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
1334 m_cs[m_curr_frame]->set_active_bytecode_ip (ip); |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
1335 } |
2cd67bae425f
maint: Merge default to bytecode-interpreter.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32572
diff
changeset
|
1336 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1337 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1338 call_stack::get_auto_fcn_var (stack_frame::auto_var_type avt) const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1339 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1340 return m_cs[m_curr_frame]->get_auto_fcn_var (avt); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1341 } |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
1342 |
24855
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1343 DEFMETHOD (max_stack_depth, interp, args, nargout, |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1344 doc: /* -*- texinfo -*- |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1345 @deftypefn {} {@var{val} =} max_stack_depth () |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1346 @deftypefnx {} {@var{old_val} =} max_stack_depth (@var{new_val}) |
30588
ed17822e7662
doc: Always have a return value for functions which set internal variables (bug #61681)
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
1347 @deftypefnx {} {@var{old_val} =} max_stack_depth (@var{new_val}, "local") |
24855
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1348 Query or set the internal limit on the number of times a function may |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1349 be called recursively. |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1350 |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1351 If the limit is exceeded, an error message is printed and control returns to |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1352 the top level. |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1353 |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1354 When called from inside a function with the @qcode{"local"} option, the |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1355 variable is changed locally for the function and any subroutines it calls. |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1356 The original variable value is restored when exiting the function. |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1357 |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1358 @seealso{max_recursion_depth} |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1359 @end deftypefn */) |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1360 { |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
1361 tree_evaluator& tw = interp.get_evaluator (); |
24855
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1362 |
27211
8c27802a76c4
store reference to evaluator instead of call stack in stack frame
John W. Eaton <jwe@octave.org>
parents:
27102
diff
changeset
|
1363 return tw.max_stack_depth (args, nargout); |
24855
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1364 } |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1365 |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1366 /* |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1367 %!test |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1368 %! orig_val = max_stack_depth (); |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1369 %! old_val = max_stack_depth (2*orig_val); |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1370 %! assert (orig_val, old_val); |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1371 %! assert (max_stack_depth (), 2*orig_val); |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1372 %! max_stack_depth (orig_val); |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1373 %! assert (max_stack_depth (), orig_val); |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1374 |
28930
2883b3d08b7e
maint: Remove unnecessary parentheses bracketing %!error BIST tests.
Rik <rik@octave.org>
parents:
28857
diff
changeset
|
1375 %!error max_stack_depth (1, 2) |
24855
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1376 */ |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1377 |
26089
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1378 DEFMETHOD (who, interp, args, nargout, |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1379 doc: /* -*- texinfo -*- |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1380 @deftypefn {} {} who |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1381 @deftypefnx {} {} who pattern @dots{} |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1382 @deftypefnx {} {} who option pattern @dots{} |
30888
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30588
diff
changeset
|
1383 @deftypefnx {} {C =} who (@dots{}) |
26089
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1384 List currently defined variables matching the given patterns. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1385 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1386 Valid pattern syntax is the same as described for the @code{clear} command. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1387 If no patterns are supplied, all variables are listed. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1388 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1389 By default, only variables visible in the local scope are displayed. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1390 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1391 The following are valid options, but may not be combined. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1392 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1393 @table @code |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1394 @item global |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1395 List variables in the global scope rather than the current scope. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1396 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1397 @item -regexp |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1398 The patterns are considered to be regular expressions when matching the |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1399 variables to display. The same pattern syntax accepted by the @code{regexp} |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1400 function is used. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1401 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1402 @item -file |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1403 The next argument is treated as a filename. All variables found within the |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1404 specified file are listed. No patterns are accepted when reading variables |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1405 from a file. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1406 @end table |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1407 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1408 If called as a function, return a cell array of defined variable names |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1409 matching the given patterns. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1410 @seealso{whos, isglobal, isvarname, exist, regexp} |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1411 @end deftypefn */) |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1412 { |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1413 int argc = args.length () + 1; |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1414 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1415 string_vector argv = args.make_argv ("who"); |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1416 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
1417 tree_evaluator& tw = interp.get_evaluator (); |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1418 |
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1419 return tw.do_who (argc, argv, nargout == 1); |
26089
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1420 } |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1421 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1422 /* |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1423 %!test |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1424 %! avar = magic (4); |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1425 %! ftmp = [tempname() ".mat"]; |
26698
63b5a17ba30f
Use save_default_options() to make BIST test suite robust against user configurations.
Rik <rik@octave.org>
parents:
26661
diff
changeset
|
1426 %! save_default_options ("-binary", "local"); |
26089
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1427 %! unwind_protect |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1428 %! save (ftmp, "avar"); |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1429 %! vars = whos ("-file", ftmp); |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1430 %! assert (numel (vars), 1); |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1431 %! assert (isstruct (vars)); |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1432 %! assert (vars.name, "avar"); |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1433 %! assert (vars.size, [4, 4]); |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1434 %! assert (vars.class, "double"); |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1435 %! assert (vars.bytes, 128); |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1436 %! unwind_protect_cleanup |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1437 %! unlink (ftmp); |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1438 %! end_unwind_protect |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1439 */ |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1440 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1441 DEFMETHOD (whos, interp, args, nargout, |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1442 doc: /* -*- texinfo -*- |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1443 @deftypefn {} {} whos |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1444 @deftypefnx {} {} whos pattern @dots{} |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1445 @deftypefnx {} {} whos option pattern @dots{} |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1446 @deftypefnx {} {S =} whos ("pattern", @dots{}) |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1447 Provide detailed information on currently defined variables matching the |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1448 given patterns. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1449 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1450 Options and pattern syntax are the same as for the @code{who} command. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1451 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1452 Extended information about each variable is summarized in a table with the |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1453 following default entries. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1454 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1455 @table @asis |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1456 @item Attr |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1457 Attributes of the listed variable. Possible attributes are: |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1458 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1459 @table @asis |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1460 @item blank |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1461 Variable in local scope |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1462 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1463 @item @code{c} |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1464 Variable of complex type. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1465 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1466 @item @code{f} |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1467 Formal parameter (function argument). |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1468 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1469 @item @code{g} |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1470 Variable with global scope. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1471 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1472 @item @code{p} |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1473 Persistent variable. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1474 @end table |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1475 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1476 @item Name |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1477 The name of the variable. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1478 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1479 @item Size |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1480 The logical size of the variable. A scalar is 1x1, a vector is |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1481 @nospell{1xN} or @nospell{Nx1}, a 2-D matrix is @nospell{MxN}. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1482 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1483 @item Bytes |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1484 The amount of memory currently used to store the variable. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1485 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1486 @item Class |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1487 The class of the variable. Examples include double, single, char, uint16, |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1488 cell, and struct. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1489 @end table |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1490 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1491 The table can be customized to display more or less information through |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1492 the function @code{whos_line_format}. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1493 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1494 If @code{whos} is called as a function, return a struct array of defined |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1495 variable names matching the given patterns. Fields in the structure |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1496 describing each variable are: name, size, bytes, class, global, sparse, |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1497 complex, nesting, persistent. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1498 @seealso{who, whos_line_format} |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1499 @end deftypefn */) |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1500 { |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1501 int argc = args.length () + 1; |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1502 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1503 string_vector argv = args.make_argv ("whos"); |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1504 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
1505 tree_evaluator& tw = interp.get_evaluator (); |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1506 |
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1507 return tw.do_who (argc, argv, nargout == 1, true); |
26089
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1508 } |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
1509 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30888
diff
changeset
|
1510 OCTAVE_END_NAMESPACE(octave) |