Mercurial > octave
annotate libinterp/corefcn/call-stack.cc @ 32632:2e484f9f1f18 stable
maint: update Octave Project Developers copyright for the new year
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 22 Dec 2023 12:08:17 -0500 |
parents | 05b4479c29d8 |
children | e4e83855224f 0b5f3219b650 |
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" |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
44 #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
|
45 #include "syminfo.h" |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
46 #include "symrec.h" |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
47 #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
|
48 #include "variables.h" |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30888
diff
changeset
|
50 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
|
51 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
52 // 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
|
53 // 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
|
54 static const char *bt_fieldnames[] = |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
55 { "file", "name", "line", "column", nullptr }; |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27071
diff
changeset
|
56 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
57 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
|
58 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
59 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
|
60 : 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
|
61 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
|
62 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
63 push (symbol_scope ("top scope")); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
64 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
65 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
66 octave_function * |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
67 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
|
68 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
69 if (m_cs.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
70 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
|
71 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
72 octave_function *fcn = nullptr; |
27873
020d0e8f7ac6
reafactor mlock, munlock, and mislocked functions
John W. Eaton <jwe@octave.org>
parents:
27844
diff
changeset
|
73 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
74 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
|
75 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
76 if (idx > 0 && skip_first) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
77 --idx; |
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 while (true) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
80 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
81 fcn = m_cs[idx]->function (); |
27873
020d0e8f7ac6
reafactor mlock, munlock, and mislocked functions
John W. Eaton <jwe@octave.org>
parents:
27844
diff
changeset
|
82 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
83 if (fcn || idx == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
84 break; |
28775
2893db10b8d2
search for current function at current frame, not top of stack
John W. Eaton <jwe@octave.org>
parents:
28430
diff
changeset
|
85 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
86 --idx; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
87 } |
27873
020d0e8f7ac6
reafactor mlock, munlock, and mislocked functions
John W. Eaton <jwe@octave.org>
parents:
27844
diff
changeset
|
88 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
89 return fcn; |
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 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
92 int |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
93 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
|
94 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
95 int retval = -1; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
96 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
97 if (! m_cs.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
98 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
99 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
|
100 retval = elt->line (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
101 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
102 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
103 return retval; |
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 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
106 int |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
107 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
|
108 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
109 int retval = -1; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
110 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
111 if (! m_cs.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
112 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
113 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
|
114 retval = elt->column (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
115 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
116 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
117 return retval; |
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 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
120 octave_user_code * |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
121 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
|
122 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
123 // Start at current frame. |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
124 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
125 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
|
126 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
127 if (xframe > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
128 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
129 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
|
130 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
131 octave_function *f = elt->function (); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
132 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
133 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
|
134 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
|
135 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
136 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
137 return nullptr; |
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 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
140 int |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
141 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
|
142 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
143 // Start at current frame. |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
144 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
145 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
|
146 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
147 if (xframe > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
148 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
149 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
|
150 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
151 octave_function *f = elt->function (); |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
152 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
153 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
|
154 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
155 int line = elt->line (); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
156 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
157 if (line > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
158 return line; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
159 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
160 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
161 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
162 return -1; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
163 } |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
164 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
165 int |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
166 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
|
167 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
168 // Start at current frame. |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
169 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
170 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
|
171 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
172 if (xframe > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
173 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
174 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
|
175 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
176 octave_function *f = elt->function (); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
177 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
178 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
|
179 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
180 int column = elt->column (); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
181 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
182 if (column > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
183 return column; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
184 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
185 } |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
186 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
187 return -1; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
188 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
189 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
190 unwind_protect * |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
191 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
|
192 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
193 // 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
|
194 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
195 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
|
196 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
197 if (xframe > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
198 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
199 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
|
200 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
201 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
|
202 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
203 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
|
204 return elt->unwind_protect_frame (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
205 } |
25399
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25343
diff
changeset
|
206 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
207 return nullptr; |
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 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
210 octave_user_code * |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
211 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
|
212 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
213 octave_user_code *retval = nullptr; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
214 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
215 // This should never happen... |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
216 if (m_curr_frame == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
217 return retval; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
218 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
219 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
|
220 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
221 while (i != 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
222 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
223 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
|
224 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
225 octave_function *f = elt->function (); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
226 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
227 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
|
228 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
229 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
|
230 break; |
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 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
233 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
234 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
235 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
236 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
237 int |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
238 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
|
239 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
240 int retval = -1; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
241 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
242 // This should never happen... |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
243 if (m_curr_frame == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
244 return retval; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
245 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
246 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
|
247 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
248 while (i != 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
249 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
250 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
|
251 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
252 octave_function *f = elt->function (); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
253 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
254 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
|
255 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
256 if (elt->line ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
257 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
258 retval = elt->line (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
259 break; |
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 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
262 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
263 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
264 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
265 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
266 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
267 int |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
268 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
|
269 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
270 int retval = -1; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
271 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
272 // This should never happen... |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
273 if (m_curr_frame == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
274 return retval; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
275 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
276 // 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
|
277 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
|
278 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
279 while (i != 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
280 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
281 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
|
282 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
283 octave_function *f = elt->function (); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
284 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
285 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
|
286 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
287 if (elt->column ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
288 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
289 retval = elt->column (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
290 break; |
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 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
293 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
294 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
295 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
296 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
297 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
298 std::string |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
299 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
|
300 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
301 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
|
302 } |
26965
be5c2a1bad93
allow dispatch class to be stored in stack frame (bug #45351)
John W. Eaton <jwe@octave.org>
parents:
26825
diff
changeset
|
303 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
304 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
305 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
|
306 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
307 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
|
308 } |
26965
be5c2a1bad93
allow dispatch class to be stored in stack frame (bug #45351)
John W. Eaton <jwe@octave.org>
parents:
26825
diff
changeset
|
309 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
310 bool |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
311 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
|
312 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
313 dispatch_class = ""; |
26795
80f9bc7cdf74
new functions for checking whether constructor or method is executing
John W. Eaton <jwe@octave.org>
parents:
26698
diff
changeset
|
314 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
315 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
|
316 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
317 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
|
318 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
319 if (retval) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
320 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
|
321 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
322 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
323 } |
26795
80f9bc7cdf74
new functions for checking whether constructor or method is executing
John W. Eaton <jwe@octave.org>
parents:
26698
diff
changeset
|
324 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
325 bool |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
326 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
|
327 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
328 dispatch_class = ""; |
26795
80f9bc7cdf74
new functions for checking whether constructor or method is executing
John W. Eaton <jwe@octave.org>
parents:
26698
diff
changeset
|
329 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
330 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
|
331 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
332 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
|
333 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
334 if (retval) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
335 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
|
336 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
337 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
338 } |
26795
80f9bc7cdf74
new functions for checking whether constructor or method is executing
John W. Eaton <jwe@octave.org>
parents:
26698
diff
changeset
|
339 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
340 bool |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
341 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
|
342 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
343 bool retval = true; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
344 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
345 auto p = m_cs.cend (); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
346 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
347 while (p != m_cs.cbegin ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
348 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
349 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
|
350 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
351 octave_function *f = elt->function (); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
352 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
353 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
|
354 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
355 retval = false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
356 break; |
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 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
359 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
360 return retval; |
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 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
|
364 (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
|
365 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
|
366 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
367 // 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
|
368 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
369 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
|
370 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
371 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
|
372 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
373 // 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
|
374 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
|
375 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
|
376 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
377 // 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
|
378 // 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
|
379 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
380 if (new_frame_idx == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
381 return; |
28796
7e0712b3388f
avoid out-of-bounds element access in call stack (bug #59189)
John W. Eaton <jwe@octave.org>
parents:
28793
diff
changeset
|
382 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
383 parent_link = m_cs[prev_frame_idx]; |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
384 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
385 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
|
386 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
387 static_link = (t_fcn |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
388 ? (t_fcn->is_user_code () |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
389 ? 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
|
390 : parent_link); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
391 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
392 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
393 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
394 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
|
395 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
396 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
|
397 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
|
398 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
|
399 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
400 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
|
401 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
402 std::shared_ptr<stack_frame> |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
403 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
|
404 parent_link, static_link)); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
405 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
406 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
|
407 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
408 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
|
409 } |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
410 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
411 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
412 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
|
413 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
|
414 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
415 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
|
416 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
|
417 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
|
418 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
419 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
|
420 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
421 std::shared_ptr<stack_frame> |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
422 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
|
423 parent_link, static_link, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
424 closure_frames)); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
425 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
426 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
|
427 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
428 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
|
429 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
430 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
431 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
432 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
|
433 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
|
434 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
|
435 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
436 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
|
437 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
|
438 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
|
439 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
440 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
|
441 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
442 std::shared_ptr<stack_frame> |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
443 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
|
444 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
|
445 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
|
446 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
447 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
|
448 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
449 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
|
450 } |
28430
5bfa8e018704
store local init vars for anonymous functions in handle, not function object
John W. Eaton <jwe@octave.org>
parents:
28429
diff
changeset
|
451 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
452 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
453 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
|
454 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
455 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
|
456 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
|
457 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
|
458 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
459 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
|
460 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
461 std::shared_ptr<stack_frame> |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
462 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
|
463 parent_link, static_link)); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
464 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
465 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
|
466 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
467 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
|
468 } |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
469 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
470 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
471 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
|
472 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
473 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
|
474 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
|
475 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
|
476 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
477 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
|
478 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
479 std::shared_ptr<stack_frame> |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
480 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
|
481 parent_link, static_link)); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
482 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
483 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
|
484 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
485 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
|
486 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
487 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
488 bool |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
489 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
|
490 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
491 bool retval = false; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
492 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
493 if (n < m_cs.size ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
494 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
495 retval = true; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
496 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
497 m_curr_frame = n; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
498 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
499 if (verbose) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
500 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
501 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
|
502 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
503 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
|
504 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
505 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
506 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
507 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
508 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
509 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
510 std::size_t |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
511 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
|
512 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
513 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
|
514 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
515 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
|
516 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
517 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
|
518 || frm->is_scope_frame ())) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
519 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
520 frm = frm->static_link (); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
521 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
522 user_frame = frm->index (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
523 } |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
524 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
525 return user_frame; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
526 } |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
527 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
528 std::shared_ptr<stack_frame> |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
529 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
|
530 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
531 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
|
532 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
533 return m_cs[frame]; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
534 } |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
535 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
536 // 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
|
537 // 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
|
538 // 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
|
539 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
540 std::size_t |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
541 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
|
542 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
543 if (start >= m_cs.size ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
544 error ("invalid stack frame"); |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
545 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
546 // 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
|
547 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
548 if (start == 0 && n < 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
549 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
550 if (verbose) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
551 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
|
552 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
553 return start; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
554 } |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
555 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
556 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
|
557 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
558 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
|
559 || 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
|
560 || frm->is_scope_frame ()))) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
561 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
|
562 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
563 // 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
|
564 // 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
|
565 // 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
|
566 // 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
|
567 // for an example or two. |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
568 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
569 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
|
570 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
571 if (n == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
572 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
573 if (verbose) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
574 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
|
575 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
576 return xframe; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
577 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
578 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
579 int incr = 0; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
580 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
581 if (n < 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
582 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
583 incr = -1; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
584 n = -n; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
585 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
586 else if (n > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
587 incr = 1; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
588 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
589 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
|
590 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
591 while (true) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
592 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
593 frm = m_cs[xframe]; |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
594 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
595 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
|
596 || frm->is_scope_frame ()) |
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 last_good_frame = xframe; |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
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 == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
601 break; |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
602 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
603 n--; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
604 } |
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 xframe += incr; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
607 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
608 if (xframe == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
609 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
610 last_good_frame = 0; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
611 break; |
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 if (xframe == m_cs.size ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
615 break; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
616 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
617 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
618 if (verbose) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
619 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
|
620 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
621 return last_good_frame; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
622 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
623 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
624 // 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
|
625 // 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
|
626 // 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
|
627 // 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
|
628 // 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
|
629 // implementation. |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
630 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
631 std::size_t |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
632 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
|
633 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
634 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
|
635 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
636 return dbupdown (start, n, verbose); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
637 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
638 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
639 // 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
|
640 // 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
|
641 // 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
|
642 // 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
|
643 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
644 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
645 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
|
646 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
647 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
|
648 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
649 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
|
650 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
651 // 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
|
652 // top-level prompt. |
29349
6f6b5f2e5d4d
fix lookup of "caller" stack frame (bug #59847)
John W. Eaton <jwe@octave.org>
parents:
29064
diff
changeset
|
653 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
654 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
|
655 } |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
656 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
657 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
658 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
|
659 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
660 if (m_curr_frame > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
661 m_curr_frame = 0; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
662 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
663 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
664 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
|
665 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
|
666 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
667 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
|
668 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
669 // 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
|
670 // 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
|
671 // 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
|
672 // 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
|
673 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
674 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
|
675 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
676 // 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
|
677 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
678 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
|
679 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
680 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
|
681 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
682 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
|
683 || frm->is_scope_frame ()) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
684 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
685 if (frm->index () == curr_frame) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
686 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
|
687 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
688 frames.push_back (frm); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
689 } |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
690 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
691 if (n == 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
692 break; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
693 } |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
694 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
695 return frames; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
696 } |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
697 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
698 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
|
699 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
|
700 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
701 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
|
702 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
703 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
|
704 } |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27005
diff
changeset
|
705 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
706 std::list<frame_info> |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
707 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
|
708 bool print_subfn) const |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
709 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
710 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
|
711 = backtrace_frames (curr_user_frame); |
27471 | 712 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
713 std::list<frame_info> retval; |
27471 | 714 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
715 for (const auto& frm : frames) |
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 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
|
718 || frm->is_scope_frame ()) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
719 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
720 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
|
721 frm->fcn_name (print_subfn), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
722 frm->line (), frm->column ())); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
723 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
724 } |
27471 | 725 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
726 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
727 } |
27471 | 728 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
729 std::list<frame_info> |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
730 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
|
731 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
732 octave_idx_type curr_user_frame = -1; |
27471 | 733 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
734 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
|
735 } |
27471 | 736 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
737 octave_map |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
738 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
|
739 bool print_subfn) const |
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::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
|
742 = backtrace_frames (curr_user_frame); |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
743 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
744 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
|
745 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
746 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
|
747 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
748 Cell& file = retval.contents (0); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
749 Cell& name = retval.contents (1); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
750 Cell& line = retval.contents (2); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
751 Cell& column = retval.contents (3); |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
752 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
753 octave_idx_type k = 0; |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
754 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
755 for (const auto& frm : frames) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
756 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
757 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
|
758 || frm->is_scope_frame ()) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
759 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
760 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
|
761 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
|
762 line(k) = frm->line (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
763 column(k) = frm->column (); |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
764 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
765 k++; |
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 } |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
768 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
769 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
770 } |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
771 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
772 octave_map |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
773 call_stack::backtrace () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
774 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
775 octave_idx_type curr_user_frame = -1; |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
776 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
777 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
|
778 } |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
779 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
780 octave_map |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
781 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
|
782 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
783 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
|
784 } |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
785 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
786 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
787 call_stack::pop () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
788 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
789 // Never pop top scope. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
790 // 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
|
791 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
792 if (m_cs.size () > 1) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
793 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
794 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
|
795 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
796 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
|
797 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
798 m_curr_frame = caller->index (); |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
799 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
800 if (elt->is_closure_context ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
801 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
|
802 |
32310
cad9584e7bad
Nested functions handles make stack frames leak (bug #64620)
Petter T.
parents:
32309
diff
changeset
|
803 elt->clear_parent_static_link (); |
cad9584e7bad
Nested functions handles make stack frames leak (bug #64620)
Petter T.
parents:
32309
diff
changeset
|
804 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
805 m_cs.pop_back (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
806 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
807 } |
24855
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
808 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
809 std::shared_ptr<stack_frame> |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
810 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
|
811 { |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
812 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
|
813 { |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
814 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
|
815 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
|
816 |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
817 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
|
818 |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
819 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
|
820 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
|
821 |
32310
cad9584e7bad
Nested functions handles make stack frames leak (bug #64620)
Petter T.
parents:
32309
diff
changeset
|
822 elt->clear_parent_static_link (); |
cad9584e7bad
Nested functions handles make stack frames leak (bug #64620)
Petter T.
parents:
32309
diff
changeset
|
823 |
32146
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
824 return elt; |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
825 } |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
826 |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
827 return nullptr; |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
828 } |
18c6b6997055
new function to pop and return top of call stack
Petter T. <petter.vilhelm@gmail.com>
parents:
32125
diff
changeset
|
829 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
830 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
831 call_stack::clear () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
832 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
833 while (! m_cs.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
834 pop (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
835 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
836 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
837 symbol_info_list |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
838 call_stack::all_variables () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
839 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
840 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
|
841 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
842 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
843 std::list<std::string> |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
844 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
|
845 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
846 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
|
847 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
848 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
|
849 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
850 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
|
851 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
|
852 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
853 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
854 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
|
855 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
856 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
857 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
858 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
859 std::list<std::string> |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
860 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
|
861 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
862 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
|
863 } |
27594
e091e09d26f0
restore some symbol table functions for backward compatibility
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
864 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
865 std::list<std::string> |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
866 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
|
867 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
868 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
|
869 } |
27594
e091e09d26f0
restore some symbol table functions for backward compatibility
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
870 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
871 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
872 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
|
873 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
874 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
|
875 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
876 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
|
877 p->second = octave_value (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
878 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
879 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
880 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
881 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
|
882 { |
32572
e424a55bc9fb
Use own function for symbol name matching on Windows (bug #64975).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32546
diff
changeset
|
883 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
|
884 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
885 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
|
886 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
887 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
|
888 nm_ov.second = octave_value (); |
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 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
891 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
892 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
893 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
|
894 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
895 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
|
896 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
897 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
|
898 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
899 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
|
900 nm_ov.second = octave_value (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
901 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
902 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
903 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
904 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
905 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
|
906 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
907 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
|
908 nm_ov.second = octave_value (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
909 } |
26092
661dfb062485
use symbol_info_list to gather data for save function
John W. Eaton <jwe@octave.org>
parents:
26089
diff
changeset
|
910 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
911 symbol_info_list |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
912 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
|
913 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
914 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
|
915 } |
26093
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
916 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
917 symbol_info_list |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
918 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
|
919 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
920 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
|
921 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
922 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
923 symbol_info_list |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
924 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
|
925 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
926 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
|
927 } |
26093
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
928 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
929 symbol_info_list |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
930 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
|
931 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
932 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
|
933 } |
26093
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
934 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
935 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
936 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
|
937 int nargout) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
938 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
939 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
|
940 "max_stack_depth", 0); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
941 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
942 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
943 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
944 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
|
945 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
946 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
|
947 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
948 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
949 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
950 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
|
951 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
952 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
|
953 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
954 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
955 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
956 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
|
957 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
958 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
|
959 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
960 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
|
961 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
962 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
963 octave_value& |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
964 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
|
965 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
966 return m_global_values[name]; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
967 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
968 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
969 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
970 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
|
971 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
972 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
|
973 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
974 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
975 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
976 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
|
977 const octave_value& value) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
978 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
979 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
|
980 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
981 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
982 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
983 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
|
984 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
|
985 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
986 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
|
987 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
988 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
|
989 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
990 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
|
991 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
992 bool from_file = false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
993 bool global_only = false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
994 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
|
995 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
996 int i = 1; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
997 while (i < argc) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
998 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
999 if (argv[i] == "-file") |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1000 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1001 if (from_file) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1002 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
|
1003 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
|
1004 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1005 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
|
1006 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1007 if (i == argc - 1) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1008 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
|
1009 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
|
1010 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1011 file_name = argv[++i]; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1012 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1013 else if (argv[i] == "-regexp") |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1014 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1015 have_regexp = true; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1016 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1017 else if (argv[i] == "global") |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1018 global_only = true; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1019 else if (argv[i][0] == '-') |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1020 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
|
1021 argv[i].c_str ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1022 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1023 break; |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1024 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1025 i++; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1026 } |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1027 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1028 int npatterns = argc - i; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1029 string_vector patterns; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1030 if (npatterns > 0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1031 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1032 patterns.resize (npatterns); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1033 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
|
1034 patterns[j] = argv[i+j]; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1035 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1036 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1037 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1038 patterns.resize (1); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1039 patterns[0] = "*"; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1040 } |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1041 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1042 if (from_file) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1043 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1044 // 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
|
1045 // 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
|
1046 // 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
|
1047 // 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
|
1048 // 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
|
1049 // 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
|
1050 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1051 // 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
|
1052 |
31782 | 1053 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
|
1054 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1055 push (tmp_scope); |
28825
473ee93cf1ea
Replace unwind_protect with more efficient constructs (bug #59192).
Rik <rik@octave.org>
parents:
28796
diff
changeset
|
1056 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31730
diff
changeset
|
1057 unwind_action restore_scope ([=] () { pop (); }); |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1058 |
31730
610a85b0ff62
use interpreter::feval instead of global feval function
John W. Eaton <jwe@octave.org>
parents:
31706
diff
changeset
|
1059 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
|
1060 |
31813
73fdf7f8381b
maint: Use consistent coding style when calling Ffunction().
Rik <rik@octave.org>
parents:
31782
diff
changeset
|
1061 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
|
1062 |
31782 | 1063 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
|
1064 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1065 if (global_only) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1066 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
|
1067 verbose, newmsg); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1068 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1069 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
|
1070 newmsg); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1071 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1072 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1073 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1074 if (global_only) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1075 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
|
1076 verbose); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1077 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1078 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
|
1079 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1080 } |
27005
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1081 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1082 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1083 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
|
1084 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
|
1085 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
|
1086 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1087 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
|
1088 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
|
1089 msg); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1090 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1091 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1092 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1093 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
|
1094 bool have_regexp, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1095 bool return_list, bool verbose, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1096 const std::string& msg) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1097 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1098 symbol_info_list symbol_stats; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1099 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
|
1100 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1101 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
|
1102 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1103 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
|
1104 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1105 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
|
1106 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1107 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
|
1108 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1109 if (have_regexp) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1110 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1111 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
|
1112 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1113 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
|
1114 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1115 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
|
1116 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
|
1117 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1118 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1119 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1120 { |
32572
e424a55bc9fb
Use own function for symbol name matching on Windows (bug #64975).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32546
diff
changeset
|
1121 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
|
1122 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1123 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
|
1124 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1125 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
|
1126 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
|
1127 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1128 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1129 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1130 for (const auto& nm : tmp) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1131 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1132 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
|
1133 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1134 if (value.is_defined ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1135 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1136 if (verbose) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1137 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1138 bool is_formal = false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1139 bool is_global = true; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1140 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
|
1141 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1142 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
|
1143 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
|
1144 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1145 symbol_stats.append (syminf); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1146 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1147 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1148 symbol_names.push_back (nm); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1149 } |
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 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1152 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1153 if (return_list) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1154 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1155 if (verbose) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1156 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1157 std::string caller_fcn_name; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1158 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
|
1159 if (caller_fcn) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1160 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
|
1161 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1162 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
|
1163 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1164 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1165 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
|
1166 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1167 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
|
1168 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1169 if (msg.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1170 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
|
1171 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1172 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
|
1173 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1174 if (verbose) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1175 symbol_stats.display (octave_stdout, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1176 m_evaluator.whos_line_format ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1177 else |
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 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
|
1180 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1181 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
|
1182 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1183 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1184 octave_stdout << "\n"; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1185 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1186 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1187 return octave_value (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1188 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1189 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1190 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1191 call_stack::display () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1192 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1193 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
|
1194 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1195 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
|
1196 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1197 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
|
1198 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1199 m_cs[i]->display (false); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1200 if (i < nframes - 1) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1201 os << std::endl; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1202 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1203 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1204 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1205 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1206 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
|
1207 const octave_value& val) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1208 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1209 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
|
1210 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26659
diff
changeset
|
1211 |
32151
72dcb1cef2c9
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
32148
diff
changeset
|
1212 void |
32125
fc5a9a9e5cea
new set_nargin and set_nargout functions for evaluator
Petter T. <petter.vilhelm@gmail.com>
parents:
31813
diff
changeset
|
1213 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
|
1214 { |
fc5a9a9e5cea
new set_nargin and set_nargout functions for evaluator
Petter T. <petter.vilhelm@gmail.com>
parents:
31813
diff
changeset
|
1215 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
|
1216 } |
fc5a9a9e5cea
new set_nargin and set_nargout functions for evaluator
Petter T. <petter.vilhelm@gmail.com>
parents:
31813
diff
changeset
|
1217 |
32151
72dcb1cef2c9
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
32148
diff
changeset
|
1218 void |
32125
fc5a9a9e5cea
new set_nargin and set_nargout functions for evaluator
Petter T. <petter.vilhelm@gmail.com>
parents:
31813
diff
changeset
|
1219 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
|
1220 { |
fc5a9a9e5cea
new set_nargin and set_nargout functions for evaluator
Petter T. <petter.vilhelm@gmail.com>
parents:
31813
diff
changeset
|
1221 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
|
1222 } |
fc5a9a9e5cea
new set_nargin and set_nargout functions for evaluator
Petter T. <petter.vilhelm@gmail.com>
parents:
31813
diff
changeset
|
1223 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1224 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
1225 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
|
1226 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1227 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
|
1228 } |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
1229 |
24855
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1230 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
|
1231 doc: /* -*- texinfo -*- |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1232 @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
|
1233 @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
|
1234 @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
|
1235 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
|
1236 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
|
1237 |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1238 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
|
1239 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
|
1240 |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1241 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
|
1242 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
|
1243 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
|
1244 |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1245 @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
|
1246 @end deftypefn */) |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1247 { |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
1248 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
|
1249 |
27211
8c27802a76c4
store reference to evaluator instead of call stack in stack frame
John W. Eaton <jwe@octave.org>
parents:
27102
diff
changeset
|
1250 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
|
1251 } |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1252 |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1253 /* |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1254 %!test |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1255 %! 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
|
1256 %! 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
|
1257 %! 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
|
1258 %! 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
|
1259 %! 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
|
1260 %! 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
|
1261 |
28930
2883b3d08b7e
maint: Remove unnecessary parentheses bracketing %!error BIST tests.
Rik <rik@octave.org>
parents:
28857
diff
changeset
|
1262 %!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
|
1263 */ |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24706
diff
changeset
|
1264 |
26089
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1265 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
|
1266 doc: /* -*- texinfo -*- |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1267 @deftypefn {} {} who |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1268 @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
|
1269 @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
|
1270 @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
|
1271 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
|
1272 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1273 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
|
1274 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
|
1275 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1276 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
|
1277 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1278 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
|
1279 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1280 @table @code |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1281 @item global |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1282 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
|
1283 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1284 @item -regexp |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1285 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
|
1286 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
|
1287 function is used. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1288 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1289 @item -file |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1290 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
|
1291 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
|
1292 from a file. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1293 @end table |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1294 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1295 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
|
1296 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
|
1297 @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
|
1298 @end deftypefn */) |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1299 { |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1300 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
|
1301 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1302 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
|
1303 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
1304 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
|
1305 |
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1306 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
|
1307 } |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1308 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1309 /* |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1310 %!test |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1311 %! avar = magic (4); |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1312 %! 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
|
1313 %! 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
|
1314 %! unwind_protect |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1315 %! save (ftmp, "avar"); |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1316 %! 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
|
1317 %! 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
|
1318 %! assert (isstruct (vars)); |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1319 %! 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
|
1320 %! 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
|
1321 %! 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
|
1322 %! 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
|
1323 %! unwind_protect_cleanup |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1324 %! unlink (ftmp); |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1325 %! end_unwind_protect |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1326 */ |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1327 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1328 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
|
1329 doc: /* -*- texinfo -*- |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1330 @deftypefn {} {} whos |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1331 @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
|
1332 @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
|
1333 @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
|
1334 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
|
1335 given patterns. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1336 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1337 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
|
1338 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1339 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
|
1340 following default entries. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1341 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1342 @table @asis |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1343 @item Attr |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1344 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
|
1345 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1346 @table @asis |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1347 @item blank |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1348 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
|
1349 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1350 @item @code{c} |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1351 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
|
1352 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1353 @item @code{f} |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1354 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
|
1355 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1356 @item @code{g} |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1357 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
|
1358 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1359 @item @code{p} |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1360 Persistent variable. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1361 @end table |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1362 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1363 @item Name |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1364 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
|
1365 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1366 @item Size |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1367 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
|
1368 @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
|
1369 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1370 @item Bytes |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1371 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
|
1372 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1373 @item Class |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1374 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
|
1375 cell, and struct. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1376 @end table |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1377 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1378 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
|
1379 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
|
1380 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1381 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
|
1382 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
|
1383 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
|
1384 complex, nesting, persistent. |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1385 @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
|
1386 @end deftypefn */) |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1387 { |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1388 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
|
1389 |
e71893aa322c
move Fwho, Fwhos, and supporting functions to call-stack.cc
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
1390 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
|
1391 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
1392 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
|
1393 |
a1ea0e7aecde
move do_who inside call_stack, make accessible from evaluator
John W. Eaton <jwe@octave.org>
parents:
26965
diff
changeset
|
1394 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
|
1395 } |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
1396 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30888
diff
changeset
|
1397 OCTAVE_END_NAMESPACE(octave) |