annotate src/pt-except.h @ 2982:20f5cec4f11c

[project @ 1997-05-16 03:29:26 by jwe]
author jwe
date Fri, 16 May 1997 03:30:14 +0000
parents
children daa1ed1f5462
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
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
3 Copyright (C) 1996, 1997 John W. Eaton
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
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
10 later version.
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
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, write to the Free
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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 #if defined (__GNUG__)
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
27 #pragma interface
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
28 #endif
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
29
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
30 class tree_statement_list;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
31
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
32 class tree_walker;
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 #include "pt-cmd.h"
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 // Simple exception handling.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
37
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
38 class
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
39 tree_try_catch_command : public tree_command
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 public:
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
42
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
43 tree_try_catch_command (int l = -1, int c = -1)
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
44 : tree_command (l, c), try_code (0), catch_code (0) { }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
45
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
46 tree_try_catch_command (tree_statement_list *tc, tree_statement_list *cc,
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
47 int l = -1, int c = -1)
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
48 : tree_command (l, c), try_code (tc), catch_code (cc) { }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
49
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
50 ~tree_try_catch_command (void);
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
51
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
52 void eval (void);
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
53
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
54 tree_statement_list *body (void) { return try_code; }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
55
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
56 tree_statement_list *cleanup (void) { return catch_code; }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
57
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
58 void accept (tree_walker& tw);
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
59
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
60 private:
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
61
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
62 // The first block of code to attempt to execute.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
63 tree_statement_list *try_code;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
64
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
65 // 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
66 tree_statement_list *catch_code;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
67 };
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
68
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
69 // Simple exception handling.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
70
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
71 class
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
72 tree_unwind_protect_command : public tree_command
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
73 {
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
74 public:
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
75
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
76 tree_unwind_protect_command (int l = -1, int c = -1)
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
77 : tree_command (l, c), unwind_protect_code (0), cleanup_code (0) { }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
78
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
79 tree_unwind_protect_command (tree_statement_list *tc,
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
80 tree_statement_list *cc,
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
81 int l = -1, int c = -1)
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
82 : tree_command (l, c), unwind_protect_code (tc), cleanup_code (cc) { }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
83
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
84 ~tree_unwind_protect_command (void);
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
85
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
86 void eval (void);
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
87
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
88 tree_statement_list *body (void) { return unwind_protect_code; }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
89
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
90 tree_statement_list *cleanup (void) { return cleanup_code; }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
91
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
92 void accept (tree_walker& tw);
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 private:
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 // The first body of code to attempt to execute.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
97 tree_statement_list *unwind_protect_code;
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 // 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
100 // body of code.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
101 tree_statement_list *cleanup_code;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
102 };
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
103
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
104 #endif
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
105
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
106 /*
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
107 ;;; Local Variables: ***
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
108 ;;; mode: C++ ***
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
109 ;;; End: ***
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
110 */