Mercurial > octave
annotate libinterp/parse-tree/pt-eval.h @ 25372:97f1d513aaf6 stable
defer deletion of temporaries in argument lists (bug #53844)
* pt-eval.h, pt-eval.cc (tree_evaluator::deferred_delete_stack):
New class.
(tree_evaluator::m_deferred_delete_stack): New data member.
(tree_evaluator::tree_evaluator): Initialize it.
(tree_evaluator::reset): Clear it.
(tree_evaluator::defer_deletion): New function.
(tree_evaluator::visit_statement): Arrange to clear deferred deletion
stack at end of each statement evaluation.
* pt-arg-list.cc (tree_argument_list::convert_to_const_vector):
Defer deletion of temporary values in argument lists.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 14 May 2018 14:47:19 -0400 |
parents | 4a46c83bcb71 |
children | b75d55b3dbb7 61ba501d8f04 |
rev | line source |
---|---|
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 /* |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 |
25054
6652d3823428
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
24563
diff
changeset
|
3 Copyright (C) 2009-2018 John W. Eaton |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
5 This file is part of Octave. |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24362
diff
changeset
|
7 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24362
diff
changeset
|
9 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
10 (at your option) any later version. |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
15 GNU General Public License for more details. |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24362
diff
changeset
|
19 <https://www.gnu.org/licenses/>. |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 */ |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
20535
diff
changeset
|
23 #if ! defined (octave_pt_eval_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
24 #define octave_pt_eval_h 1 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
26 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
27 |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
28 #include <list> |
23723
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
29 #include <set> |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 #include <stack> |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 #include <string> |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23532
diff
changeset
|
33 #include "call-stack.h" |
24563
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
34 #include "ov.h" |
20940
48b2ad5ee801
maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents:
20824
diff
changeset
|
35 #include "ovl.h" |
23753
c3828bd031cd
move profiler inside evaluator and inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23750
diff
changeset
|
36 #include "profiler.h" |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
37 #include "pt-exp.h" |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 #include "pt-walk.h" |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
40 namespace octave |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
41 { |
24362
3fc24b792a24
avoid including symtab.h, symscope.h, or symrec.h unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24361
diff
changeset
|
42 class symbol_scope; |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
43 class tree_decl_elt; |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
44 class tree_expression; |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
45 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
46 class interpreter; |
23723
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
47 class unwind_protect; |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 |
24563
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
49 enum result_type |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
50 { |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
51 RT_UNDEFINED = 0, |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
52 RT_VALUE = 1, |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
53 RT_VALUE_LIST = 2 |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
54 }; |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
55 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
56 // How to evaluate the code that the parse trees represent. |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
57 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
58 class OCTINTERP_API tree_evaluator : public tree_walker |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
59 { |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
60 public: |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
61 |
23723
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
62 enum echo_state |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
63 { |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
64 ECHO_OFF = 0, |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
65 ECHO_SCRIPTS = 1, |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
66 ECHO_FUNCTIONS = 2, |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
67 ECHO_ALL = 4 |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
68 }; |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
69 |
25372
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
70 class deferred_delete_stack |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
71 { |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
72 public: |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
73 |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
74 deferred_delete_stack (void) = default; |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
75 |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
76 deferred_delete_stack (const deferred_delete_stack&) = default; |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
77 |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
78 deferred_delete_stack& operator = (const deferred_delete_stack&) = default; |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
79 |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
80 ~deferred_delete_stack (void) = default; |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
81 |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
82 // An undefined value on the stack marks the boundary of the |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
83 // current frame. |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
84 |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
85 void mark (void) { push (octave_value ()); } |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
86 |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
87 void push (const octave_value& val) { m_stack.push (val); } |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
88 |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
89 void pop_frame (void) |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
90 { |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
91 while (! m_stack.empty ()) |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
92 { |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
93 octave_value val = val_pop (); |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
94 |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
95 if (val.is_undefined ()) |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
96 break; |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
97 } |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
98 } |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
99 |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
100 void clear (void) |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
101 { |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
102 while (! m_stack.empty ()) |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
103 m_stack.pop (); |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
104 } |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
105 |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
106 private: |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
107 |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
108 std::stack<octave_value> m_stack; |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
109 |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
110 octave_value val_pop (void) |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
111 { |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
112 octave_value retval = m_stack.top (); |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
113 m_stack.pop (); |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
114 return retval; |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
115 } |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
116 }; |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
117 |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
118 template <typename T> |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
119 class value_stack |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
120 { |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
121 public: |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
122 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
123 value_stack (void) = default; |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
124 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
125 value_stack (const value_stack&) = default; |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
126 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
127 value_stack& operator = (const value_stack&) = default; |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
128 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
129 ~value_stack (void) = default; |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
130 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
131 void push (const T& val) { m_stack.push (val); } |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
132 |
23481
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
133 void pop (void) |
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
134 { |
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
135 m_stack.pop (); |
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
136 } |
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
137 |
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
138 T val_pop (void) |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
139 { |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
140 T retval = m_stack.top (); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
141 m_stack.pop (); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
142 return retval; |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
143 } |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
144 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
145 T top (void) const |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
146 { |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
147 return m_stack.top (); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
148 } |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
149 |
23481
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
150 size_t size (void) const |
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
151 { |
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
152 return m_stack.size (); |
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
153 } |
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
154 |
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
155 bool empty (void) const |
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
156 { |
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
157 return m_stack.empty (); |
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
158 } |
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
159 |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
160 void clear (void) |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
161 { |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
162 while (! m_stack.empty ()) |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
163 m_stack.pop (); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
164 } |
23458
0f4ed33886de
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
165 |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
166 private: |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
167 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
168 std::stack<T> m_stack; |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
169 }; |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
170 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
171 typedef void (*decl_elt_init_fcn) (tree_decl_elt&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
172 |
23532
084245f9bd03
pass reference to evaluator to octave_function call methods
John W. Eaton <jwe@octave.org>
parents:
23482
diff
changeset
|
173 tree_evaluator (interpreter& interp) |
24563
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
174 : m_interpreter (interp), m_result_type (RT_UNDEFINED), |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
175 m_expr_result_value (), m_expr_result_value_list (), |
25372
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
176 m_deferred_delete_stack (), m_lvalue_list_stack (), |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
177 m_nargout_stack (), m_call_stack (interp), m_profiler (), |
23706
6683451b75b2
move Vstring_fill_char to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23705
diff
changeset
|
178 m_max_recursion_depth (256), m_silent_functions (false), |
23723
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
179 m_string_fill_char (' '), m_PS4 ("+ "), m_echo (ECHO_OFF), |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
180 m_echo_state (false), m_echo_file_name (), m_echo_file_pos (1), |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
181 m_echo_files () |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
182 { } |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
183 |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
184 // No copying! |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
185 |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
186 tree_evaluator (const tree_evaluator&) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
187 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
188 tree_evaluator& operator = (const tree_evaluator&) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
189 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
190 ~tree_evaluator (void) = default; |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
191 |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
192 void reset (void); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
193 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
194 void visit_anon_fcn_handle (tree_anon_fcn_handle&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
195 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
196 void visit_argument_list (tree_argument_list&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
197 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
198 void visit_binary_expression (tree_binary_expression&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
199 |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
200 void visit_boolean_expression (tree_boolean_expression&); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
201 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
202 void visit_compound_binary_expression (tree_compound_binary_expression&); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
203 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
204 void visit_break_command (tree_break_command&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
205 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
206 void visit_colon_expression (tree_colon_expression&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
207 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
208 void visit_continue_command (tree_continue_command&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
209 |
23469
2699c5974844
handle global and persistent in tree_decl_command, not as separate classes
John W. Eaton <jwe@octave.org>
parents:
23458
diff
changeset
|
210 void visit_decl_command (tree_decl_command&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
211 |
23469
2699c5974844
handle global and persistent in tree_decl_command, not as separate classes
John W. Eaton <jwe@octave.org>
parents:
23458
diff
changeset
|
212 void visit_decl_init_list (tree_decl_init_list&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
213 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
214 void visit_decl_elt (tree_decl_elt&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
215 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
216 void visit_simple_for_command (tree_simple_for_command&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
217 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
218 void visit_complex_for_command (tree_complex_for_command&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
219 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
220 void visit_octave_user_script (octave_user_script&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
221 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
222 void visit_octave_user_function (octave_user_function&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
223 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
224 void visit_octave_user_function_header (octave_user_function&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
225 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
226 void visit_octave_user_function_trailer (octave_user_function&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
227 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
228 void visit_function_def (tree_function_def&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
229 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
230 void visit_identifier (tree_identifier&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
231 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
232 void visit_if_clause (tree_if_clause&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
233 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
234 void visit_if_command (tree_if_command&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
235 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
236 void visit_if_command_list (tree_if_command_list&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
237 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
238 void visit_index_expression (tree_index_expression&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
239 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
240 void visit_matrix (tree_matrix&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
241 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
242 void visit_cell (tree_cell&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
243 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
244 void visit_multi_assignment (tree_multi_assignment&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
245 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
246 void visit_no_op_command (tree_no_op_command&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
247 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
248 void visit_constant (tree_constant&); |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
249 |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
250 void visit_fcn_handle (tree_fcn_handle&); |
15035 | 251 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
252 void visit_funcall (tree_funcall&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
253 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
254 void visit_parameter_list (tree_parameter_list&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
255 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
256 void visit_postfix_expression (tree_postfix_expression&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
257 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
258 void visit_prefix_expression (tree_prefix_expression&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
259 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
260 void visit_return_command (tree_return_command&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
261 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
262 void visit_return_list (tree_return_list&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
263 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
264 void visit_simple_assignment (tree_simple_assignment&); |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
265 |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
266 void visit_statement (tree_statement&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
267 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
268 void visit_statement_list (tree_statement_list&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
269 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
270 void visit_switch_case (tree_switch_case&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
271 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
272 void visit_switch_case_list (tree_switch_case_list&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
273 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
274 void visit_switch_command (tree_switch_command&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
275 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
276 void visit_try_catch_command (tree_try_catch_command&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
277 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
278 void do_unwind_protect_cleanup_code (tree_statement_list *list); |
10066
2cd940306a06
make unwind_protect frames local
Jaroslav Hajek <highegg@gmail.com>
parents:
9484
diff
changeset
|
279 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
280 void visit_unwind_protect_command (tree_unwind_protect_command&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
281 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
282 void visit_while_command (tree_while_command&); |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
283 void visit_do_until_command (tree_do_until_command&); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
284 |
23702
d396b5fd9199
move bind_ans to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23696
diff
changeset
|
285 void bind_ans (const octave_value& val, bool print); |
d396b5fd9199
move bind_ans to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23696
diff
changeset
|
286 |
23705
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
287 bool statement_printing_enabled (void); |
10186
095a1e670e68
make dbstep work with keyboard function
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
288 |
23705
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
289 static void reset_debug_state (void); |
15606
fb9dffe5fbfb
The silent_functions flag no longer modifies the parse tree
Max Brister <max@2bass.com>
parents:
15195
diff
changeset
|
290 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
291 // If > 0, stop executing at the (N-1)th stopping point, counting |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
292 // from the the current execution point in the current frame. |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
293 // |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
294 // If < 0, stop executing at the next possible stopping point. |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
295 static int dbstep_flag; |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
296 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
297 // The number of the stack frame we are currently debugging. |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
298 static size_t current_frame; |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
299 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
300 static bool debug_mode; |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
301 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
302 static bool quiet_breakpoint_flag; |
19379
c1ce43276b86
avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents:
17822
diff
changeset
|
303 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
304 // Possible types of evaluation contexts. |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
305 enum stmt_list_type |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
306 { |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
307 function, // function body |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
308 script, // script file |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
309 other // command-line input or eval string |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
310 }; |
11304 | 311 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
312 // The context for the current evaluation. |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
313 static stmt_list_type statement_context; |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
314 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
315 // TRUE means we are evaluating some kind of looping construct. |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
316 static bool in_loop_command; |
8669
33783e94fb16
line number fixes and other evaluator tweaks
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
317 |
25372
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
318 void defer_deletion (const octave_value& val) |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
319 { |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
320 m_deferred_delete_stack.push (val); |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
321 } |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
322 |
23481
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
323 Matrix ignored_fcn_outputs (void) const; |
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
324 |
24349
4ced2bfd737e
deprecate defun_isargout functions
John W. Eaton <jwe@octave.org>
parents:
24270
diff
changeset
|
325 bool isargout (int nargout, int iout) const; |
4ced2bfd737e
deprecate defun_isargout functions
John W. Eaton <jwe@octave.org>
parents:
24270
diff
changeset
|
326 |
4ced2bfd737e
deprecate defun_isargout functions
John W. Eaton <jwe@octave.org>
parents:
24270
diff
changeset
|
327 void isargout (int nargout, int nout, bool *isargout) const; |
4ced2bfd737e
deprecate defun_isargout functions
John W. Eaton <jwe@octave.org>
parents:
24270
diff
changeset
|
328 |
4ced2bfd737e
deprecate defun_isargout functions
John W. Eaton <jwe@octave.org>
parents:
24270
diff
changeset
|
329 const std::list<octave_lvalue> * lvalue_list (void) const |
23481
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
330 { |
24349
4ced2bfd737e
deprecate defun_isargout functions
John W. Eaton <jwe@octave.org>
parents:
24270
diff
changeset
|
331 return (m_lvalue_list_stack.empty () |
4ced2bfd737e
deprecate defun_isargout functions
John W. Eaton <jwe@octave.org>
parents:
24270
diff
changeset
|
332 ? nullptr : m_lvalue_list_stack.top ()); |
23481
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
333 } |
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
334 |
24563
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
335 void push_result (const octave_value& val) |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
336 { |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
337 m_result_type = RT_VALUE; |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
338 m_expr_result_value = val; |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
339 } |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
340 |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
341 void push_result (const octave_value_list& vals) |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
342 { |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
343 m_result_type = RT_VALUE_LIST; |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
344 m_expr_result_value_list = vals; |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
345 } |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
346 |
23481
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
347 octave_value evaluate (tree_expression *expr, int nargout = 1) |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
348 { |
24563
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
349 octave_value retval; |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
350 |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
351 m_nargout_stack.push (nargout); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
352 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
353 expr->accept (*this); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
354 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
355 m_nargout_stack.pop (); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
356 |
24563
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
357 switch (m_result_type) |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
358 { |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
359 case RT_UNDEFINED: |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
360 panic_impossible (); |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
361 break; |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
362 |
24563
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
363 case RT_VALUE: |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
364 retval = m_expr_result_value; |
25317
4a46c83bcb71
don't hold reference to expression result after evaluation is done
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
365 m_expr_result_value = octave_value (); |
24563
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
366 break; |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
367 |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
368 case RT_VALUE_LIST: |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
369 retval = (m_expr_result_value_list.empty () |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
370 ? octave_value () : m_expr_result_value_list(0)); |
25317
4a46c83bcb71
don't hold reference to expression result after evaluation is done
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
371 m_expr_result_value_list = octave_value_list (); |
24563
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
372 break; |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
373 } |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
374 |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
375 return retval; |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
376 } |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
377 |
23481
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
378 octave_value_list evaluate_n (tree_expression *expr, int nargout = 1) |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
379 { |
24563
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
380 octave_value_list retval; |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
381 |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
382 m_nargout_stack.push (nargout); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
383 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
384 expr->accept (*this); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
385 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
386 m_nargout_stack.pop (); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
387 |
24563
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
388 switch (m_result_type) |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
389 { |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
390 case RT_UNDEFINED: |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
391 panic_impossible (); |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
392 break; |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
393 |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
394 case RT_VALUE: |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
395 retval = ovl (m_expr_result_value); |
25317
4a46c83bcb71
don't hold reference to expression result after evaluation is done
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
396 m_expr_result_value = octave_value (); |
24563
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
397 break; |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
398 |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
399 case RT_VALUE_LIST: |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
400 retval = m_expr_result_value_list; |
25317
4a46c83bcb71
don't hold reference to expression result after evaluation is done
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
401 m_expr_result_value_list = octave_value_list (); |
24563
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
402 break; |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
403 } |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
404 |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
405 return retval; |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
406 } |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
407 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
408 octave_value evaluate (tree_decl_elt *); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
409 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
410 void define_parameter_list_from_arg_vector |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
411 (tree_parameter_list *param_list, const octave_value_list& args); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
412 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
413 void undefine_parameter_list (tree_parameter_list *param_list); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
414 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
415 octave_value_list |
23916
85488effc0ff
refactor function value return code
John W. Eaton <jwe@octave.org>
parents:
23795
diff
changeset
|
416 convert_return_list_to_const_vector |
85488effc0ff
refactor function value return code
John W. Eaton <jwe@octave.org>
parents:
23795
diff
changeset
|
417 (tree_parameter_list *ret_list, int nargout, const Cell& varargout); |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
418 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
419 bool eval_decl_elt (tree_decl_elt *elt); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
420 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
421 bool switch_case_label_matches (tree_switch_case *expr, |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
422 const octave_value& val); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
423 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23532
diff
changeset
|
424 call_stack& get_call_stack (void) { return m_call_stack; } |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23532
diff
changeset
|
425 |
23753
c3828bd031cd
move profiler inside evaluator and inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23750
diff
changeset
|
426 profiler& get_profiler (void) { return m_profiler; } |
c3828bd031cd
move profiler inside evaluator and inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23750
diff
changeset
|
427 |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24349
diff
changeset
|
428 symbol_scope get_current_scope (void); |
24037
21915520ac7b
use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents:
23916
diff
changeset
|
429 |
23705
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
430 int max_recursion_depth (void) const { return m_max_recursion_depth; } |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
431 |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
432 int max_recursion_depth (int n) |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
433 { |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
434 int val = m_max_recursion_depth; |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
435 m_max_recursion_depth = n; |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
436 return val; |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
437 } |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
438 |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
439 octave_value |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
440 max_recursion_depth (const octave_value_list& args, int nargout); |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
441 |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
442 bool silent_functions (void) const { return m_silent_functions; } |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
443 |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
444 bool silent_functions (bool b) |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
445 { |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
446 int val = m_silent_functions; |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
447 m_silent_functions = b; |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
448 return val; |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
449 } |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
450 |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
451 octave_value |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
452 silent_functions (const octave_value_list& args, int nargout); |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
453 |
23706
6683451b75b2
move Vstring_fill_char to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23705
diff
changeset
|
454 char string_fill_char (void) const { return m_string_fill_char; } |
6683451b75b2
move Vstring_fill_char to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23705
diff
changeset
|
455 |
6683451b75b2
move Vstring_fill_char to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23705
diff
changeset
|
456 char string_fill_char (char c) |
6683451b75b2
move Vstring_fill_char to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23705
diff
changeset
|
457 { |
6683451b75b2
move Vstring_fill_char to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23705
diff
changeset
|
458 int val = m_string_fill_char; |
6683451b75b2
move Vstring_fill_char to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23705
diff
changeset
|
459 m_string_fill_char = c; |
6683451b75b2
move Vstring_fill_char to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23705
diff
changeset
|
460 return val; |
6683451b75b2
move Vstring_fill_char to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23705
diff
changeset
|
461 } |
6683451b75b2
move Vstring_fill_char to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23705
diff
changeset
|
462 |
23723
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
463 octave_value PS4 (const octave_value_list& args, int nargout); |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
464 |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
465 std::string PS4 (void) const { return m_PS4; } |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
466 |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
467 std::string PS4 (const std::string& s) |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
468 { |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
469 std::string val = m_PS4; |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
470 m_PS4 = s; |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
471 return val; |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
472 } |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
473 |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
474 octave_value echo (const octave_value_list& args, int nargout); |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
475 |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
476 int echo (void) const { return m_echo; } |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
477 |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
478 int echo (int val) |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
479 { |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
480 int old_val = m_echo; |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
481 m_echo = val; |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
482 return old_val; |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
483 } |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
484 |
23706
6683451b75b2
move Vstring_fill_char to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23705
diff
changeset
|
485 octave_value |
6683451b75b2
move Vstring_fill_char to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23705
diff
changeset
|
486 string_fill_char (const octave_value_list& args, int nargout); |
6683451b75b2
move Vstring_fill_char to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23705
diff
changeset
|
487 |
23729
06b3d1d54054
allow echo state to be modified from inside functions
John W. Eaton <jwe@octave.org>
parents:
23728
diff
changeset
|
488 void push_echo_state (unwind_protect& frame, int type, |
06b3d1d54054
allow echo state to be modified from inside functions
John W. Eaton <jwe@octave.org>
parents:
23728
diff
changeset
|
489 const std::string& file_name, size_t pos = 1); |
06b3d1d54054
allow echo state to be modified from inside functions
John W. Eaton <jwe@octave.org>
parents:
23728
diff
changeset
|
490 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
491 private: |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
492 |
23729
06b3d1d54054
allow echo state to be modified from inside functions
John W. Eaton <jwe@octave.org>
parents:
23728
diff
changeset
|
493 void set_echo_state (int type, const std::string& file_name, size_t pos); |
06b3d1d54054
allow echo state to be modified from inside functions
John W. Eaton <jwe@octave.org>
parents:
23728
diff
changeset
|
494 |
06b3d1d54054
allow echo state to be modified from inside functions
John W. Eaton <jwe@octave.org>
parents:
23728
diff
changeset
|
495 void maybe_set_echo_state (void); |
06b3d1d54054
allow echo state to be modified from inside functions
John W. Eaton <jwe@octave.org>
parents:
23728
diff
changeset
|
496 |
06b3d1d54054
allow echo state to be modified from inside functions
John W. Eaton <jwe@octave.org>
parents:
23728
diff
changeset
|
497 void push_echo_state_cleanup (unwind_protect& frame); |
06b3d1d54054
allow echo state to be modified from inside functions
John W. Eaton <jwe@octave.org>
parents:
23728
diff
changeset
|
498 |
06b3d1d54054
allow echo state to be modified from inside functions
John W. Eaton <jwe@octave.org>
parents:
23728
diff
changeset
|
499 bool maybe_push_echo_state_cleanup (void); |
06b3d1d54054
allow echo state to be modified from inside functions
John W. Eaton <jwe@octave.org>
parents:
23728
diff
changeset
|
500 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
501 void do_breakpoint (tree_statement& stmt) const; |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
502 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
503 void do_breakpoint (bool is_breakpoint, |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
504 bool is_end_of_fcn_or_script = false) const; |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
505 |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
506 virtual octave_value |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
507 do_keyboard (const octave_value_list& args = octave_value_list ()) const; |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
508 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
509 bool is_logically_true (tree_expression *expr, const char *warn_for); |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
510 |
23482
c9937e865768
make isargout work again for nested function calls
John W. Eaton <jwe@octave.org>
parents:
23481
diff
changeset
|
511 octave_value_list |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
512 make_value_list (tree_argument_list *args, |
23482
c9937e865768
make isargout work again for nested function calls
John W. Eaton <jwe@octave.org>
parents:
23481
diff
changeset
|
513 const string_vector& arg_nm, |
c9937e865768
make isargout work again for nested function calls
John W. Eaton <jwe@octave.org>
parents:
23481
diff
changeset
|
514 const octave_value *object, bool rvalue = true); |
c9937e865768
make isargout work again for nested function calls
John W. Eaton <jwe@octave.org>
parents:
23481
diff
changeset
|
515 |
23481
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
516 std::list<octave_lvalue> make_lvalue_list (tree_argument_list *); |
73558a835b64
eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents:
23469
diff
changeset
|
517 |
23723
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
518 // For unwind-protect. |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
519 void set_echo_state (bool val) { m_echo_state = val; } |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
520 |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
521 // For unwind-protect. |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
522 void set_echo_file_name (const std::string& file_name) |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
523 { |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
524 m_echo_file_name = file_name; |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
525 } |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
526 |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
527 // For unwind-protect. |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
528 void set_echo_file_pos (const size_t& file_pos) |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
529 { |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
530 m_echo_file_pos = file_pos; |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
531 } |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
532 |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
533 bool echo_this_file (const std::string& file, int type) const; |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
534 |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
535 void echo_code (size_t line); |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
536 |
23705
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
537 interpreter& m_interpreter; |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
538 |
24563
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
539 result_type m_result_type; |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
540 octave_value m_expr_result_value; |
8f2c479eb125
eliminate unnecessary value stack in evaluator
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
541 octave_value_list m_expr_result_value_list; |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
542 |
25372
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
543 deferred_delete_stack m_deferred_delete_stack; |
97f1d513aaf6
defer deletion of temporaries in argument lists (bug #53844)
John W. Eaton <jwe@octave.org>
parents:
25317
diff
changeset
|
544 |
23435
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
545 value_stack<const std::list<octave_lvalue>*> m_lvalue_list_stack; |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
546 |
c452180ab672
begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
547 value_stack<int> m_nargout_stack; |
10219
979fb2606c4f
new tree_evaluator::do_keyoard function
Ryan Rusaw <rrusaw@gmail.com>
parents:
10186
diff
changeset
|
548 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23532
diff
changeset
|
549 call_stack m_call_stack; |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23532
diff
changeset
|
550 |
23753
c3828bd031cd
move profiler inside evaluator and inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23750
diff
changeset
|
551 profiler m_profiler; |
c3828bd031cd
move profiler inside evaluator and inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23750
diff
changeset
|
552 |
23705
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
553 // Maximum nesting level for functions, scripts, or sourced files |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
554 // called recursively. |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
555 int m_max_recursion_depth; |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
556 |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
557 // If TRUE, turn off printing of results in functions (as if a |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
558 // semicolon has been appended to each statement). |
4c597585ff52
move Vmax_recursion_depth and Vsilent_functions to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23702
diff
changeset
|
559 bool m_silent_functions; |
23706
6683451b75b2
move Vstring_fill_char to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23705
diff
changeset
|
560 |
6683451b75b2
move Vstring_fill_char to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23705
diff
changeset
|
561 // The character to fill with when creating string arrays. |
6683451b75b2
move Vstring_fill_char to tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23705
diff
changeset
|
562 char m_string_fill_char; |
23723
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
563 |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
564 // String printed before echoed commands (enabled by --echo-commands). |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
565 std::string m_PS4; |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
566 |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
567 // Echo commands as they are executed? |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
568 // |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
569 // 1 ==> echo commands read from script files |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
570 // 2 ==> echo commands from functions |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
571 // |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
572 // more than one state can be active at once. |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
573 int m_echo; |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
574 |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
575 // Are we currently echoing commands? This state is set by the |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
576 // functions that execute fucntions and scripts. |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
577 bool m_echo_state; |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
578 |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
579 std::string m_echo_file_name; |
23728
b40b7243a782
new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
23723
diff
changeset
|
580 |
b40b7243a782
new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents:
23723
diff
changeset
|
581 // Next line to echo, counting from 1. |
23723
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
582 size_t m_echo_file_pos; |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
583 |
ab8831d346c1
revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents:
23706
diff
changeset
|
584 std::map<std::string, bool> m_echo_files; |
22196
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
585 }; |
dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
586 } |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
587 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
588 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
589 |
23615
be7b884ac589
use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents:
23553
diff
changeset
|
590 OCTAVE_DEPRECATED (4.4, "use 'octave::tree_evaluator' instead") |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
591 typedef octave::tree_evaluator tree_evaluator; |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
592 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
593 #endif |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
594 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
595 #endif |