annotate src/pt-except.h @ 16088:b29b10fbb744 stable release-3-6-4

Version 3.6.4 released. * configure.ac (AC_INIT): Version is now 3.6.4. (OCTAVE_RELEASE_DATE): Now 2013-02-21.
author John W. Eaton <jwe@octave.org>
date Thu, 21 Feb 2013 15:17:54 -0500
parents 72c96de7a403
children 955a9f63a35e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
1 /*
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
2
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3 Copyright (C) 1996-2012 John W. Eaton
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
4
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
6
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
10 option) any later version.
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
11
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
15 for more details.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
16
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
19 <http://www.gnu.org/licenses/>.
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
20
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
21 */
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
22
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
23 #if !defined (octave_tree_except_h)
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
24 #define octave_tree_except_h 1
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
25
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
26 class tree_statement_list;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
27
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
28 class tree_walker;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
29
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
30 #include "comment-list.h"
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
31 #include "pt-cmd.h"
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
32 #include "symtab.h"
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
33
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
34 // Simple exception handling.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
35
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
36 class
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
37 tree_try_catch_command : public tree_command
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
38 {
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
39 public:
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
40
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
41 tree_try_catch_command (int l = -1, int c = -1)
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
42 : tree_command (l, c), try_code (0), catch_code (0), lead_comm (0),
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
43 mid_comm (0), trail_comm (0) { }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
44
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
45 tree_try_catch_command (tree_statement_list *tc, tree_statement_list *cc,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
46 octave_comment_list *cl = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
47 octave_comment_list *cm = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
48 octave_comment_list *ct = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
49 int l = -1, int c = -1)
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
50 : tree_command (l, c), try_code (tc), catch_code (cc),
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
51 lead_comm (cl), mid_comm (cm), trail_comm (ct) { }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
52
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
53 ~tree_try_catch_command (void);
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
54
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
55 tree_statement_list *body (void) { return try_code; }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
56
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
57 tree_statement_list *cleanup (void) { return catch_code; }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
58
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
59 octave_comment_list *leading_comment (void) { return lead_comm; }
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
60
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
61 octave_comment_list *middle_comment (void) { return mid_comm; }
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
62
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
63 octave_comment_list *trailing_comment (void) { return trail_comm; }
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
64
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
65 tree_command *dup (symbol_table::scope_id scope,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
66 symbol_table::context_id context) const;
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5307
diff changeset
67
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
68 void accept (tree_walker& tw);
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
69
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
70 private:
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
71
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
72 // The first block of code to attempt to execute.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
73 tree_statement_list *try_code;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
74
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
75 // The code to execute if an error occurs in the first block.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
76 tree_statement_list *catch_code;
2988
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
77
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
78 // Comment preceding TRY token.
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
79 octave_comment_list *lead_comm;
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
80
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
81 // Comment preceding CATCH token.
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
82 octave_comment_list *mid_comm;
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
83
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
84 // Comment preceding END_TRY_CATCH token.
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
85 octave_comment_list *trail_comm;
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
86
2988
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
87 // No copying!
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
88
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
89 tree_try_catch_command (const tree_try_catch_command&);
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
90
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
91 tree_try_catch_command& operator = (const tree_try_catch_command&);
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
92 };
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
93
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
94 // Simple exception handling.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
95
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
96 class
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
97 tree_unwind_protect_command : public tree_command
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
98 {
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
99 public:
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
100
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
101 tree_unwind_protect_command (int l = -1, int c = -1)
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
102 : tree_command (l, c), unwind_protect_code (0), cleanup_code (0),
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
103 lead_comm (0), mid_comm (0), trail_comm (0) { }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
104
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
105 tree_unwind_protect_command (tree_statement_list *tc,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
106 tree_statement_list *cc,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
107 octave_comment_list *cl = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
108 octave_comment_list *cm = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
109 octave_comment_list *ct = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
110 int l = -1, int c = -1)
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
111 : tree_command (l, c), unwind_protect_code (tc), cleanup_code (cc),
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
112 lead_comm (cl), mid_comm (cm), trail_comm (ct) { }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
113
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
114 ~tree_unwind_protect_command (void);
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
115
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
116 tree_statement_list *body (void) { return unwind_protect_code; }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
117
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
118 tree_statement_list *cleanup (void) { return cleanup_code; }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
119
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
120 octave_comment_list *leading_comment (void) { return lead_comm; }
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
121
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
122 octave_comment_list *middle_comment (void) { return mid_comm; }
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
123
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
124 octave_comment_list *trailing_comment (void) { return trail_comm; }
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
125
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
126 tree_command *dup (symbol_table::scope_id scope,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
127 symbol_table::context_id context) const;
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5307
diff changeset
128
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
129 void accept (tree_walker& tw);
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
130
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
131 private:
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
132
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
133 // The first body of code to attempt to execute.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
134 tree_statement_list *unwind_protect_code;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
135
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
136 // The body of code to execute no matter what happens in the first
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
137 // body of code.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
138 tree_statement_list *cleanup_code;
2988
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
139
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
140 // Comment preceding TRY token.
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
141 octave_comment_list *lead_comm;
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
142
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
143 // Comment preceding CATCH token.
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
144 octave_comment_list *mid_comm;
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
145
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
146 // Comment preceding END_TRY_CATCH token.
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
147 octave_comment_list *trail_comm;
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
148
2988
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
149 // No copying!
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
150
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
151 tree_unwind_protect_command (const tree_unwind_protect_command&);
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
152
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
153 tree_unwind_protect_command& operator = (const tree_unwind_protect_command&);
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
154 };
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
155
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
156 #endif