GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
pt-bp.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2001-2013 Ben Sapp
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
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
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
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 #include "ov-usr-fcn.h"
28 #include "pager.h"
29 #include "pt-all.h"
30 
31 // TRUE means SIGINT should put us in the debugger at the next
32 // available breakpoint.
34 
35 void
37 {
38  if (cmd.line () >= line)
39  take_action (cmd);
40 
41  if (! found)
42  {
43  tree_statement_list *lst = cmd.body ();
44 
45  if (lst)
46  lst->accept (*this);
47  }
48 }
49 
50 void
52 {
53  if (! found)
54  {
55  tree_statement_list *lst = cmd.body ();
56 
57  if (lst)
58  lst->accept (*this);
59 
60  if (! found)
61  {
62  if (cmd.line () >= line)
63  take_action (cmd);
64  }
65  }
66 }
67 
68 void
70 {
72 }
73 
74 void
76 {
78 }
79 
80 void
82 {
83  if (cmd.line () >= line)
84  take_action (cmd);
85 }
86 
87 void
89 {
91 }
92 
93 void
95 {
96  if (cmd.line () >= line)
97  take_action (cmd);
98 }
99 
100 void
102 {
103  if (cmd.line () >= line)
104  take_action (cmd);
105 }
106 
107 void
109 {
110  do_decl_command (cmd);
111 }
112 
113 void
115 {
116  do_decl_command (cmd);
117 }
118 
119 void
121 {
122  panic_impossible ();
123 }
124 
125 void
127 {
128  panic_impossible ();
129 }
130 
131 void
133 {
134  if (cmd.line () >= line)
135  take_action (cmd);
136 
137  if (! found)
138  {
139  tree_statement_list *lst = cmd.body ();
140 
141  if (lst)
142  lst->accept (*this);
143  }
144 }
145 
146 void
148 {
149  if (cmd.line () >= line)
150  take_action (cmd);
151 
152  if (! found)
153  {
154  tree_statement_list *lst = cmd.body ();
155 
156  if (lst)
157  lst->accept (*this);
158  }
159 }
160 
161 void
163 {
164  tree_statement_list *cmd_list = fcn.body ();
165 
166  if (cmd_list)
167  cmd_list->accept (*this);
168 }
169 
170 void
172 {
173  tree_statement_list *cmd_list = fcn.body ();
174 
175  if (cmd_list)
176  cmd_list->accept (*this);
177 }
178 
179 void
181 {
182  panic_impossible ();
183 }
184 
185 void
187 {
188  panic_impossible ();
189 }
190 
191 void
193 {
194  octave_value fcn = fdef.function ();
195 
196  octave_function *f = fcn.function_value ();
197 
198  if (f)
199  f->accept (*this);
200 }
201 
202 void
204 {
205  panic_impossible ();
206 }
207 
208 void
210 {
211  panic_impossible ();
212 }
213 
214 void
216 {
217  tree_if_command_list *lst = cmd.cmd_list ();
218 
219  if (lst)
220  lst->accept (*this);
221 }
222 
223 void
225 {
226  for (tree_if_command_list::iterator p = lst.begin (); p != lst.end (); p++)
227  {
228  tree_if_clause *t = *p;
229 
230  if (t->line () >= line)
231  take_action (*t);
232 
233  if (! found)
234  {
235  tree_statement_list *stmt_lst = t->commands ();
236 
237  if (stmt_lst)
238  stmt_lst->accept (*this);
239  }
240 
241  if (found)
242  break;
243  }
244 }
245 
246 void
248 {
249  panic_impossible ();
250 }
251 
252 void
254 {
255  panic_impossible ();
256 }
257 
258 void
260 {
261  panic_impossible ();
262 }
263 
264 void
266 {
267  panic_impossible ();
268 }
269 
270 void
272 {
273  if (cmd.is_end_of_fcn_or_script () && cmd.line () >= line)
274  take_action (cmd);
275 }
276 
277 void
279 {
280  panic_impossible ();
281 }
282 
283 void
285 {
286  panic_impossible ();
287 }
288 
289 void
291 {
292  panic_impossible ();
293 }
294 
295 void
297 {
298  panic_impossible ();
299 }
300 
301 void
303 {
304  panic_impossible ();
305 }
306 
307 void
309 {
310  panic_impossible ();
311 }
312 
313 void
315 {
316  if (cmd.line () >= line)
317  take_action (cmd);
318 }
319 
320 void
322 {
323  panic_impossible ();
324 }
325 
326 void
328 {
329  panic_impossible ();
330 }
331 
332 void
334 {
335  if (stmt.is_command ())
336  {
337  tree_command *cmd = stmt.command ();
338 
339  cmd->accept (*this);
340  }
341  else
342  {
343  if (stmt.line () >= line)
344  take_action (stmt);
345  }
346 }
347 
348 void
350 {
351  for (tree_statement_list::iterator p = lst.begin (); p != lst.end (); p++)
352  {
353  tree_statement *elt = *p;
354 
355  if (elt)
356  {
357  elt->accept (*this);
358 
359  if (found)
360  break;
361  }
362  }
363 }
364 
365 void
367 {
368  panic_impossible ();
369 }
370 
371 void
373 {
374  for (tree_switch_case_list::iterator p = lst.begin (); p != lst.end (); p++)
375  {
376  tree_switch_case *t = *p;
377 
378  if (t->line () >= line)
379  take_action (*t);
380 
381  if (! found)
382  {
383  tree_statement_list *stmt_lst = t->commands ();
384 
385  if (stmt_lst)
386  stmt_lst->accept (*this);
387  }
388 
389  if (found)
390  break;
391  }
392 }
393 
394 void
396 {
397  if (cmd.line () >= line)
398  take_action (cmd);
399 
400  if (! found)
401  {
402  tree_switch_case_list *lst = cmd.case_list ();
403 
404  if (lst)
405  lst->accept (*this);
406  }
407 }
408 
409 void
411 {
412  tree_statement_list *try_code = cmd.body ();
413 
414  if (try_code)
415  try_code->accept (*this);
416 
417  if (! found)
418  {
419  tree_statement_list *catch_code = cmd.cleanup ();
420 
421  if (catch_code)
422  catch_code->accept (*this);
423  }
424 }
425 
426 void
428 {
429  tree_statement_list *body = cmd.body ();
430 
431  if (body)
432  body->accept (*this);
433 
434  if (! found)
435  {
436  tree_statement_list *cleanup = cmd.cleanup ();
437 
438  if (cleanup)
439  cleanup->accept (*this);
440  }
441 }
442 
443 void
445 {
446  if (act == set)
447  {
448  tr.set_breakpoint ();
449  line = tr.line ();
450  found = true;
451  }
452  else if (act == clear)
453  {
454  if (tr.is_breakpoint ())
455  {
456  tr.delete_breakpoint ();
457  found = true;
458  }
459  }
460  else if (act == list)
461  {
462  if (tr.is_breakpoint ())
463  bp_list.append (octave_value (tr.line ()));
464  }
465  else
466  panic_impossible ();
467 }
468 
469 void
471 {
472  int lineno = stmt.line ();
473 
474  if (act == set)
475  {
476  stmt.set_breakpoint ();
477  line = lineno;
478  found = true;
479  }
480  else if (act == clear)
481  {
482  if (stmt.is_breakpoint ())
483  {
484  stmt.delete_breakpoint ();
485  found = true;
486  }
487  }
488  else if (act == list)
489  {
490  if (stmt.is_breakpoint ())
491  bp_list.append (octave_value (lineno));
492  }
493  else
494  panic_impossible ();
495 }