GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
pt-bp.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2001-2018 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
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License 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 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_pt_bp_h)
24 #define octave_pt_bp_h 1
25 
26 #include "octave-config.h"
27 
28 #include "input.h"
29 #include "ov-usr-fcn.h"
30 #include "pt-walk.h"
31 #include "pt-pr-code.h"
32 #include "interpreter.h"
33 
34 namespace octave
35 {
36  class tree;
37  class tree_decl_command;
38 
40  {
41  public:
42 
43  enum action { set = 1, clear = 2, list = 3 };
44 
45  tree_breakpoint (int l, action a, const std::string& c = "")
46  : m_line (l), m_action (a), m_condition (c), m_found (false),
48  { }
49 
50  // No copying!
51 
52  tree_breakpoint (const tree_breakpoint&) = delete;
53 
55 
56  ~tree_breakpoint (void) = default;
57 
58  bool success (void) const { return m_found; }
59 
61 
63 
65 
67 
69 
71 
73 
75 
77 
79 
81 
83 
85 
87 
89 
91 
93 
95 
97 
99 
101 
103 
104  void visit_matrix (tree_matrix&);
105 
106  void visit_cell (tree_cell&);
107 
109 
111 
113 
115 
117 
118  void visit_funcall (tree_funcall&);
119 
121 
123 
125 
127 
129 
131 
133 
135 
137 
139 
141 
143 
145 
147 
149 
150  int get_line (void) { return m_found ? m_line : 0; }
151 
152  private:
153 
154  void take_action (tree& tr);
155 
156  void take_action (tree_statement& stmt);
157 
158  // Statement line number we are looking for.
159  int m_line;
160 
161  // What to do.
163 
164  // Expression which must be true to break
166 
167  // Have we already found the line?
168  bool m_found;
169 
170  // List of breakpoint line numbers.
172 
173  // List of breakpoint conditions.
175  };
176 
177  // TRUE means SIGINT should put us in the debugger at the next
178  // available breakpoint.
180 }
181 
182 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
183 
184 OCTAVE_DEPRECATED (4.4, "use 'octave::tree_breakpoint' instead")
185 typedef octave::tree_breakpoint tree_breakpoint;
186 
187 #endif
188 
189 #endif
void visit_if_clause(tree_if_clause &)
Definition: pt-bp.cc:199
void visit_postfix_expression(tree_postfix_expression &)
Definition: pt-bp.cc:296
void visit_decl_elt(tree_decl_elt &)
Definition: pt-bp.cc:116
void visit_identifier(tree_identifier &)
Definition: pt-bp.cc:193
tree_breakpoint & operator=(const tree_breakpoint &)=delete
void visit_octave_user_script(octave_user_script &)
Definition: pt-bp.cc:152
void visit_statement(tree_statement &)
Definition: pt-bp.cc:327
void visit_decl_command(tree_decl_command &)
Definition: pt-bp.cc:103
octave_value_list m_bp_cond_list
Definition: pt-bp.h:174
void visit_function_def(tree_function_def &)
Definition: pt-bp.cc:182
void visit_prefix_expression(tree_prefix_expression &)
Definition: pt-bp.cc:302
void visit_switch_case(tree_switch_case &)
Definition: pt-bp.cc:361
void visit_return_command(tree_return_command &)
Definition: pt-bp.cc:308
void visit_octave_user_function_trailer(octave_user_function &)
Definition: pt-bp.cc:176
void visit_octave_user_function_header(octave_user_function &)
Definition: pt-bp.cc:170
void visit_multi_assignment(tree_multi_assignment &)
Definition: pt-bp.cc:253
void visit_do_until_command(tree_do_until_command &)
Definition: pt-bp.cc:53
void visit_decl_init_list(tree_decl_init_list &)
Definition: pt-bp.cc:110
void visit_index_expression(tree_index_expression &)
Definition: pt-bp.cc:235
void visit_matrix(tree_matrix &)
Definition: pt-bp.cc:241
void visit_unwind_protect_command(tree_unwind_protect_command &)
Definition: pt-bp.cc:420
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
Definition: file-io.cc:587
void visit_break_command(tree_break_command &)
Definition: pt-bp.cc:83
void visit_octave_user_function(octave_user_function &)
Definition: pt-bp.cc:161
void visit_while_command(tree_while_command &)
Definition: pt-bp.cc:38
void visit_statement_list(tree_statement_list &)
Definition: pt-bp.cc:346
~tree_breakpoint(void)=default
void take_action(tree &tr)
Definition: pt-bp.cc:437
void visit_switch_case_list(tree_switch_case_list &)
Definition: pt-bp.cc:367
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:400
void visit_funcall(tree_funcall &)
Definition: pt-bp.cc:284
void visit_try_catch_command(tree_try_catch_command &)
Definition: pt-bp.cc:403
void visit_argument_list(tree_argument_list &)
Definition: pt-bp.cc:71
void visit_no_op_command(tree_no_op_command &)
Definition: pt-bp.cc:259
void visit_fcn_handle(tree_fcn_handle &)
Definition: pt-bp.cc:278
void visit_if_command_list(tree_if_command_list &)
Definition: pt-bp.cc:214
void visit_if_command(tree_if_command &)
Definition: pt-bp.cc:205
is false
Definition: cellfun.cc:400
void visit_simple_assignment(tree_simple_assignment &)
Definition: pt-bp.cc:321
void visit_cell(tree_cell &)
Definition: pt-bp.cc:247
octave_value_list get_list(void)
Definition: pt-bp.h:146
octave_value_list m_bp_list
Definition: pt-bp.h:171
bool octave_debug_on_interrupt_state
Definition: pt-bp.cc:35
std::string m_condition
Definition: pt-bp.h:165
void visit_anon_fcn_handle(tree_anon_fcn_handle &)
Definition: pt-bp.cc:266
void visit_simple_for_command(tree_simple_for_command &)
Definition: pt-bp.cc:122
void visit_colon_expression(tree_colon_expression &)
Definition: pt-bp.cc:90
void visit_parameter_list(tree_parameter_list &)
Definition: pt-bp.cc:290
void visit_constant(tree_constant &)
Definition: pt-bp.cc:272
tree_breakpoint(int l, action a, const std::string &c="")
Definition: pt-bp.h:45
octave_value_list get_cond_list(void)
Definition: pt-bp.h:148
void visit_switch_command(tree_switch_command &)
Definition: pt-bp.cc:388
void visit_complex_for_command(tree_complex_for_command &)
Definition: pt-bp.cc:137
void visit_return_list(tree_return_list &)
Definition: pt-bp.cc:315
int get_line(void)
Definition: pt-bp.h:150
bool success(void) const
Definition: pt-bp.h:58
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:888
void visit_binary_expression(tree_binary_expression &)
Definition: pt-bp.cc:77
void visit_continue_command(tree_continue_command &)
Definition: pt-bp.cc:96