comparison 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
comparison
equal deleted inserted replaced
2981:38365813950d 2982:20f5cec4f11c
1 /*
2
3 Copyright (C) 1996, 1997 John W. Eaton
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 2, or (at your option) any
10 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, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21 */
22
23 #if !defined (octave_tree_except_h)
24 #define octave_tree_except_h 1
25
26 #if defined (__GNUG__)
27 #pragma interface
28 #endif
29
30 class tree_statement_list;
31
32 class tree_walker;
33
34 #include "pt-cmd.h"
35
36 // Simple exception handling.
37
38 class
39 tree_try_catch_command : public tree_command
40 {
41 public:
42
43 tree_try_catch_command (int l = -1, int c = -1)
44 : tree_command (l, c), try_code (0), catch_code (0) { }
45
46 tree_try_catch_command (tree_statement_list *tc, tree_statement_list *cc,
47 int l = -1, int c = -1)
48 : tree_command (l, c), try_code (tc), catch_code (cc) { }
49
50 ~tree_try_catch_command (void);
51
52 void eval (void);
53
54 tree_statement_list *body (void) { return try_code; }
55
56 tree_statement_list *cleanup (void) { return catch_code; }
57
58 void accept (tree_walker& tw);
59
60 private:
61
62 // The first block of code to attempt to execute.
63 tree_statement_list *try_code;
64
65 // The code to execute if an error occurs in the first block.
66 tree_statement_list *catch_code;
67 };
68
69 // Simple exception handling.
70
71 class
72 tree_unwind_protect_command : public tree_command
73 {
74 public:
75
76 tree_unwind_protect_command (int l = -1, int c = -1)
77 : tree_command (l, c), unwind_protect_code (0), cleanup_code (0) { }
78
79 tree_unwind_protect_command (tree_statement_list *tc,
80 tree_statement_list *cc,
81 int l = -1, int c = -1)
82 : tree_command (l, c), unwind_protect_code (tc), cleanup_code (cc) { }
83
84 ~tree_unwind_protect_command (void);
85
86 void eval (void);
87
88 tree_statement_list *body (void) { return unwind_protect_code; }
89
90 tree_statement_list *cleanup (void) { return cleanup_code; }
91
92 void accept (tree_walker& tw);
93
94 private:
95
96 // The first body of code to attempt to execute.
97 tree_statement_list *unwind_protect_code;
98
99 // The body of code to execute no matter what happens in the first
100 // body of code.
101 tree_statement_list *cleanup_code;
102 };
103
104 #endif
105
106 /*
107 ;;; Local Variables: ***
108 ;;; mode: C++ ***
109 ;;; End: ***
110 */