Mercurial > hg > octave-jordi
annotate libinterp/parse-tree/pt-stmt.cc @ 21016:93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
* Backend.cc, comment-list.h, debug.cc, defaults.in.h, dynamic-ld.h, error.cc,
graphics.cc, graphics.in.h, help.cc, hook-fcn.h, load-path.cc, load-path.h,
ls-ascii-helper.cc, ls-mat-ascii.cc, ls-mat5.cc, ls-mat5.h, ls-oct-text.cc,
oct-iostrm.h, oct-lvalue.h, oct-stream.cc, oct-stream.h, oct-strstrm.h,
regexp.cc, schur.cc, sqrtm.cc, strfns.cc, symtab.cc, symtab.h, sysdep.cc,
toplev.cc, urlwrite.cc, variables.cc, variables.h, ov-builtin.h, ov-cell.cc,
ov-class.cc, ov-classdef.cc, ov-classdef.h, ov-dld-fcn.h, ov-fcn-handle.cc,
ov-fcn-inline.cc, ov-fcn-inline.h, ov-fcn.h, ov-lazy-idx.cc, ov-mex-fcn.h,
ov-struct.cc, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.h,
ovl.h, octave.cc, lex.h, parse.h, pt-classdef.h, pt-exp.cc, pt-pr-code.h,
token.h, version.cc, version.in.h, oct-rand.h, dir-ops.h, file-ops.cc,
file-ops.h, file-stat.h, oct-env.cc, oct-group.cc, oct-passwd.cc,
oct-syscalls.cc, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, kpse.cc,
lo-array-gripes.h, pathsearch.cc, pathsearch.h, str-vec.h, url-transfer.h:
Replace emtpy 'std::string ()' calls with "".
author | Rik <rik@octave.org> |
---|---|
date | Wed, 30 Dec 2015 12:33:33 -0800 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
2982 | 1 /* |
2 | |
19696
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
3 Copyright (C) 1996-2015 John W. Eaton |
2982 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
2982 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2982 | 20 |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
24 #include <config.h> | |
25 #endif | |
26 | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
27 #include <typeinfo> |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
28 |
4153 | 29 #include "quit.h" |
30 | |
2982 | 31 #include "defun.h" |
32 #include "error.h" | |
8011
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7890
diff
changeset
|
33 #include "gripes.h" |
2982 | 34 #include "ov.h" |
16530
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
35 #include "octave-link.h" |
2982 | 36 #include "oct-lvalue.h" |
37 #include "input.h" | |
38 #include "pager.h" | |
3770 | 39 #include "pt-bp.h" |
2982 | 40 #include "pt-cmd.h" |
41 #include "pt-id.h" | |
42 #include "pt-idx.h" | |
2985 | 43 #include "pt-jump.h" |
2982 | 44 #include "pt-pr-code.h" |
45 #include "pt-stmt.h" | |
46 #include "pt-walk.h" | |
3707 | 47 #include "unwind-prot.h" |
2982 | 48 #include "utils.h" |
49 #include "variables.h" | |
50 | |
51 // A list of commands to be executed. | |
52 | |
53 tree_statement::~tree_statement (void) | |
54 { | |
55 delete cmd; | |
56 delete expr; | |
3665 | 57 delete comm; |
2982 | 58 } |
59 | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
60 void |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
61 tree_statement::set_print_flag (bool print_flag) |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
62 { |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
63 if (expr) |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
64 expr->set_print_flag (print_flag); |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
65 } |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
66 |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
67 bool |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
68 tree_statement::print_result (void) |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
69 { |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
70 return expr && expr->print_result (); |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
71 } |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
72 |
8843
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
73 void |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
74 tree_statement::set_breakpoint (void) |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
75 { |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
76 if (cmd) |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
77 cmd->set_breakpoint (); |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
78 else if (expr) |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
79 expr->set_breakpoint (); |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
80 } |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
81 |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
82 void |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
83 tree_statement::delete_breakpoint (void) |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
84 { |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
85 if (cmd) |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
86 cmd->delete_breakpoint (); |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
87 else if (expr) |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
88 expr->delete_breakpoint (); |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
89 } |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
90 |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
91 bool |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
92 tree_statement::is_breakpoint (void) const |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
93 { |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
94 return cmd ? cmd->is_breakpoint () : (expr ? expr->is_breakpoint () : false); |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
95 } |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
96 |
2982 | 97 int |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
98 tree_statement::line (void) const |
2982 | 99 { |
100 return cmd ? cmd->line () : (expr ? expr->line () : -1); | |
101 } | |
102 | |
103 int | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
104 tree_statement::column (void) const |
2982 | 105 { |
106 return cmd ? cmd->column () : (expr ? expr->column () : -1); | |
107 } | |
108 | |
109 void | |
16627
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
110 tree_statement::set_location (int l, int c) |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
111 { |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
112 if (cmd) |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
113 cmd->set_location (l, c); |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
114 else if (expr) |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
115 expr->set_location (l, c); |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
116 } |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
117 |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
118 void |
8669
33783e94fb16
line number fixes and other evaluator tweaks
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
119 tree_statement::echo_code (void) |
2982 | 120 { |
8669
33783e94fb16
line number fixes and other evaluator tweaks
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
121 tree_print_code tpc (octave_stdout, VPS4); |
2982 | 122 |
8669
33783e94fb16
line number fixes and other evaluator tweaks
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
123 accept (tpc); |
2982 | 124 } |
125 | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
126 bool |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
127 tree_statement::is_end_of_fcn_or_script (void) const |
2982 | 128 { |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
129 bool retval = false; |
2982 | 130 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
131 if (cmd) |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
132 { |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
133 tree_no_op_command *no_op_cmd |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
134 = dynamic_cast<tree_no_op_command *> (cmd); |
2982 | 135 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
136 if (no_op_cmd) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
137 retval = no_op_cmd->is_end_of_fcn_or_script (); |
2982 | 138 } |
139 | |
140 return retval; | |
141 } | |
142 | |
16627
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
143 bool |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
144 tree_statement::is_end_of_file (void) const |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
145 { |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
146 bool retval = false; |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
147 |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
148 if (cmd) |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
149 { |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
150 tree_no_op_command *no_op_cmd |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
151 = dynamic_cast<tree_no_op_command *> (cmd); |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
152 |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
153 if (no_op_cmd) |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
154 retval = no_op_cmd->is_end_of_file (); |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
155 } |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
156 |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
157 return retval; |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
158 } |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16531
diff
changeset
|
159 |
5861 | 160 tree_statement * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
161 tree_statement::dup (symbol_table::scope_id scope, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
162 symbol_table::context_id context) const |
5861 | 163 { |
164 tree_statement *new_stmt = new tree_statement (); | |
165 | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
166 new_stmt->cmd = cmd ? cmd->dup (scope, context) : 0; |
5861 | 167 |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
168 new_stmt->expr = expr ? expr->dup (scope, context) : 0; |
5861 | 169 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8637
diff
changeset
|
170 new_stmt->comm = comm ? comm->dup () : 0; |
5861 | 171 |
172 return new_stmt; | |
173 } | |
174 | |
2982 | 175 void |
176 tree_statement::accept (tree_walker& tw) | |
177 { | |
178 tw.visit_statement (*this); | |
179 } | |
180 | |
3770 | 181 int |
182 tree_statement_list::set_breakpoint (int line) | |
183 { | |
184 tree_breakpoint tbp (line, tree_breakpoint::set); | |
185 accept (tbp); | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
186 |
3770 | 187 return tbp.get_line (); |
188 } | |
189 | |
190 void | |
191 tree_statement_list::delete_breakpoint (int line) | |
192 { | |
3895 | 193 if (line < 0) |
194 { | |
4212 | 195 octave_value_list bp_lst = list_breakpoints (); |
3895 | 196 |
4212 | 197 int len = bp_lst.length (); |
3895 | 198 |
4587 | 199 for (int i = 0; i < len; i++) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
200 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
201 tree_breakpoint tbp (i, tree_breakpoint::clear); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
202 accept (tbp); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
203 } |
3895 | 204 } |
205 else | |
206 { | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
207 tree_breakpoint tbp (line, tree_breakpoint::clear); |
3895 | 208 accept (tbp); |
209 } | |
3770 | 210 } |
211 | |
212 octave_value_list | |
213 tree_statement_list::list_breakpoints (void) | |
214 { | |
215 tree_breakpoint tbp (0, tree_breakpoint::list); | |
216 accept (tbp); | |
217 | |
218 return tbp.get_list (); | |
219 } | |
220 | |
16530
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
221 bp_table::intmap |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
222 tree_statement_list::add_breakpoint (const std::string& file, |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
223 const bp_table::intmap& line) |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
224 { |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
225 bp_table::intmap retval; |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
226 |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
227 octave_idx_type len = line.size (); |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
228 |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
229 for (int i = 0; i < len; i++) |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
230 { |
16531
f3a63fdbd725
finish botched changeset 7ca7e7d5eb91
John W. Eaton <jwe@octave.org>
parents:
16530
diff
changeset
|
231 bp_table::const_intmap_iterator p = line.find (i); |
16530
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
232 |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
233 if (p != line.end ()) |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
234 { |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
235 int lineno = p->second; |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
236 |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
237 retval[i] = set_breakpoint (lineno); |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
238 |
16531
f3a63fdbd725
finish botched changeset 7ca7e7d5eb91
John W. Eaton <jwe@octave.org>
parents:
16530
diff
changeset
|
239 if (retval[i] != 0 && ! file.empty ()) |
f3a63fdbd725
finish botched changeset 7ca7e7d5eb91
John W. Eaton <jwe@octave.org>
parents:
16530
diff
changeset
|
240 octave_link::update_breakpoint (true, file, retval[i]); |
16530
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
241 } |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
242 } |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
243 |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
244 return retval; |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
245 } |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
246 |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
247 bp_table::intmap |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
248 tree_statement_list::remove_all_breakpoints (const std::string& file) |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
249 { |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
250 bp_table::intmap retval; |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
251 |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
252 octave_value_list bkpts = list_breakpoints (); |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
253 |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
254 for (int i = 0; i < bkpts.length (); i++) |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
255 { |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
256 int lineno = static_cast<int> (bkpts(i).int_value ()); |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
257 |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
258 delete_breakpoint (lineno); |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
259 |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
260 retval[i] = lineno; |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
261 |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
262 if (! file.empty ()) |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
263 octave_link::update_breakpoint (false, file, lineno); |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
264 } |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
265 |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
266 return retval; |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
267 } |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
268 |
7ca7e7d5eb91
remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
269 |
5861 | 270 tree_statement_list * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
271 tree_statement_list::dup (symbol_table::scope_id scope, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
272 symbol_table::context_id context) const |
5861 | 273 { |
274 tree_statement_list *new_list = new tree_statement_list (); | |
275 | |
276 new_list->function_body = function_body; | |
277 | |
8913
35cd375d4bb3
make tree::dup functions const
John W. Eaton <jwe@octave.org>
parents:
8844
diff
changeset
|
278 for (const_iterator p = begin (); p != end (); p++) |
5861 | 279 { |
8913
35cd375d4bb3
make tree::dup functions const
John W. Eaton <jwe@octave.org>
parents:
8844
diff
changeset
|
280 const tree_statement *elt = *p; |
5861 | 281 |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
282 new_list->append (elt ? elt->dup (scope, context) : 0); |
5861 | 283 } |
284 | |
285 return new_list; | |
286 } | |
287 | |
2982 | 288 void |
289 tree_statement_list::accept (tree_walker& tw) | |
290 { | |
291 tw.visit_statement_list (*this); | |
292 } |