Mercurial > octave
annotate liboctave/cruft/misc/quit.h @ 21040:3e7cfee5f786
maint: Rename attributes GCC_ATTR_XXX to OCTAVE_XXX.
* oct-conf-post.in.h: Rename macros GCC_ATTR_XXX to OCTAVE_XXX. Add comments
describing purpose of macros. Add FIXME note about switching macros to C++
standard convention. Add FIXME note about using visibility attributes.
* error.cc, error.h, gripes.h, jit-typeinfo.cc, load-save.cc, oct-stream.cc,
pt-jit.cc, symtab.h, variables.h, ov-base-sparse.h, ov-base.cc, ov-base.h,
ov-class.cc, ov-classdef.cc, ov-classdef.h, ov.cc, ov.h, octave.cc, pt-mat.cc,
Array.h, DiagArray2.h, PermMatrix.h, Range.h, Sparse.h, dSparse.h, f77-fcn.h,
lo-error.c, lo-error.h, quit.h, SparseCmplxQR.cc, lo-array-gripes.h,
unwind-prot.h: Rename attributes GCC_ATTR_XXX to OCTAVE_XXX.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 05 Jan 2016 14:16:58 -0800 |
parents | e3b3bb522d62 |
children | f7121e111991 |
rev | line source |
---|---|
4153 | 1 /* |
2 | |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19082
diff
changeset
|
3 Copyright (C) 2002-2015 John W. Eaton |
4153 | 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 | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
4153 | 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 | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
4153 | 20 |
21 */ | |
22 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
20785
diff
changeset
|
23 #if ! defined (octave_quit_h) |
4153 | 24 #define octave_quit_h 1 |
25 | |
19082
96df707c7dad
Do not include system header files in extern "C" block (bug #43171)
Johannes Zarl <johannes.zarl@jku.at>
parents:
17744
diff
changeset
|
26 #include <stdio.h> |
96df707c7dad
Do not include system header files in extern "C" block (bug #43171)
Johannes Zarl <johannes.zarl@jku.at>
parents:
17744
diff
changeset
|
27 |
96df707c7dad
Do not include system header files in extern "C" block (bug #43171)
Johannes Zarl <johannes.zarl@jku.at>
parents:
17744
diff
changeset
|
28 #include <signal.h> |
96df707c7dad
Do not include system header files in extern "C" block (bug #43171)
Johannes Zarl <johannes.zarl@jku.at>
parents:
17744
diff
changeset
|
29 #include <setjmp.h> |
96df707c7dad
Do not include system header files in extern "C" block (bug #43171)
Johannes Zarl <johannes.zarl@jku.at>
parents:
17744
diff
changeset
|
30 |
4153 | 31 #ifdef __cplusplus |
4268 | 32 #include <new> |
20666
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
33 #include <string> |
4153 | 34 extern "C" { |
35 #endif | |
36 | |
5451 | 37 #if defined (__WIN32__) && ! defined (_POSIX_VERSION) |
38 | |
10346
65d5776379c3
Reduce the amount of stuff included by windows.h and avoid min/max being #define-d
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10142
diff
changeset
|
39 #define WIN32_LEAN_AND_MEAN |
5451 | 40 #include <windows.h> |
41 | |
6107 | 42 CRUFT_API extern void w32_sigint_init (void); /* setup */ |
43 CRUFT_API extern void w32_raise_final (void); /* tear down */ | |
44 CRUFT_API extern void w32_raise (int sig); /* raise signal in main thread */ | |
45 CRUFT_API extern int w32_in_main_thread (void); /* return true if in main thread */ | |
5451 | 46 |
47 #endif | |
48 | |
4180 | 49 #if defined (OCTAVE_HAVE_SIG_JUMP) |
50 | |
51 typedef sigjmp_buf octave_jmp_buf; | |
52 | |
53 #define octave_set_current_context sigsetjmp (current_context, 1) | |
54 | |
55 #else | |
56 | |
57 typedef jmp_buf octave_jmp_buf; | |
58 | |
59 #define octave_set_current_context setjmp (current_context) | |
60 | |
61 #endif | |
62 | |
6107 | 63 CRUFT_API extern octave_jmp_buf current_context; |
4153 | 64 |
6107 | 65 CRUFT_API extern void octave_save_current_context (void *); |
4153 | 66 |
6107 | 67 CRUFT_API extern void octave_restore_current_context (void *); |
4153 | 68 |
21040
3e7cfee5f786
maint: Rename attributes GCC_ATTR_XXX to OCTAVE_XXX.
Rik <rik@octave.org>
parents:
21029
diff
changeset
|
69 OCTAVE_NORETURN CRUFT_API extern void octave_jump_to_enclosing_context (void); |
4153 | 70 |
6107 | 71 CRUFT_API extern void octave_save_signal_mask (void); |
4153 | 72 |
6107 | 73 CRUFT_API extern void octave_restore_signal_mask (void); |
4153 | 74 |
75 #ifdef __cplusplus | |
76 class | |
7481
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
77 octave_execution_exception |
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
78 { |
20666
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
79 public: |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
80 |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
81 octave_execution_exception (void) : m_stack_trace () { } |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
82 |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
83 octave_execution_exception (const octave_execution_exception& x) |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
84 : m_stack_trace (x.m_stack_trace) { } |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
85 |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
86 octave_execution_exception& operator = (const octave_execution_exception& x) |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
87 { |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
88 if (&x != this) |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
89 m_stack_trace = x.m_stack_trace; |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
90 |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
91 return *this; |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
92 } |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
93 |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
94 ~octave_execution_exception (void) { } |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
95 |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
96 virtual void set_stack_trace (const std::string& st) |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
97 { |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
98 m_stack_trace = st; |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
99 } |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
100 |
20785
b6f2909e7f94
always throw exception after debugging with debug_on_error
John W. Eaton <jwe@octave.org>
parents:
20666
diff
changeset
|
101 virtual void set_stack_trace (void) |
b6f2909e7f94
always throw exception after debugging with debug_on_error
John W. Eaton <jwe@octave.org>
parents:
20666
diff
changeset
|
102 { |
b6f2909e7f94
always throw exception after debugging with debug_on_error
John W. Eaton <jwe@octave.org>
parents:
20666
diff
changeset
|
103 m_stack_trace = ""; |
b6f2909e7f94
always throw exception after debugging with debug_on_error
John W. Eaton <jwe@octave.org>
parents:
20666
diff
changeset
|
104 } |
b6f2909e7f94
always throw exception after debugging with debug_on_error
John W. Eaton <jwe@octave.org>
parents:
20666
diff
changeset
|
105 |
20666
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
106 virtual std::string info (void) const |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
107 { |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
108 return m_stack_trace; |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
109 } |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
110 |
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
111 private: |
20785
b6f2909e7f94
always throw exception after debugging with debug_on_error
John W. Eaton <jwe@octave.org>
parents:
20666
diff
changeset
|
112 |
20666
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
113 std::string m_stack_trace; |
7481
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
114 }; |
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
115 |
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
116 class |
4153 | 117 octave_interrupt_exception |
118 { | |
119 }; | |
120 #endif | |
121 | |
7481
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
122 enum octave_exception |
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
123 { |
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
124 octave_no_exception = 0, |
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
125 octave_exec_exception = 1, |
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
126 octave_alloc_exception = 2 |
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
127 }; |
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
128 |
6107 | 129 CRUFT_API extern sig_atomic_t octave_interrupt_immediately; |
4153 | 130 |
5133 | 131 /* |
132 > 0: interrupt pending | |
133 0: no interrupt pending | |
134 < 0: handling interrupt | |
135 */ | |
6107 | 136 CRUFT_API extern sig_atomic_t octave_interrupt_state; |
4180 | 137 |
7481
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
138 CRUFT_API extern sig_atomic_t octave_exception_state; |
4153 | 139 |
8837
c37081b9d5c9
add missing volatile declaration in quit.h
Jaroslav Hajek <highegg@gmail.com>
parents:
7481
diff
changeset
|
140 CRUFT_API extern volatile sig_atomic_t octave_signal_caught; |
5142 | 141 |
6107 | 142 CRUFT_API extern void octave_handle_signal (void); |
5142 | 143 |
21040
3e7cfee5f786
maint: Rename attributes GCC_ATTR_XXX to OCTAVE_XXX.
Rik <rik@octave.org>
parents:
21029
diff
changeset
|
144 OCTAVE_NORETURN CRUFT_API extern void octave_throw_interrupt_exception (void); |
4153 | 145 |
21040
3e7cfee5f786
maint: Rename attributes GCC_ATTR_XXX to OCTAVE_XXX.
Rik <rik@octave.org>
parents:
21029
diff
changeset
|
146 OCTAVE_NORETURN CRUFT_API extern void octave_throw_execution_exception (void); |
7481
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
147 |
21040
3e7cfee5f786
maint: Rename attributes GCC_ATTR_XXX to OCTAVE_XXX.
Rik <rik@octave.org>
parents:
21029
diff
changeset
|
148 OCTAVE_NORETURN CRUFT_API extern void octave_throw_bad_alloc (void); |
4180 | 149 |
8928
80f044c83de3
quit.h (octave_rethrow_exception): Don't tag with GCC_ATTR_NORETURN
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
150 CRUFT_API extern void octave_rethrow_exception (void); |
7481
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
151 |
10142
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
152 #ifdef __cplusplus |
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
153 inline void octave_quit (void) |
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
154 { |
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
155 if (octave_signal_caught) |
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
156 { |
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
157 octave_signal_caught = 0; |
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
158 octave_handle_signal (); |
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
159 } |
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
160 }; |
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
161 |
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
162 #define OCTAVE_QUIT octave_quit () |
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
163 |
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
164 #else |
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
165 |
4153 | 166 #define OCTAVE_QUIT \ |
167 do \ | |
168 { \ | |
5142 | 169 if (octave_signal_caught) \ |
4153 | 170 { \ |
5142 | 171 octave_signal_caught = 0; \ |
172 octave_handle_signal (); \ | |
4153 | 173 } \ |
174 } \ | |
175 while (0) | |
10142
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
176 #endif |
4153 | 177 |
4302 | 178 /* Normally, you just want to use |
179 | |
180 BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | |
181 ... some code that calls a "foreign" function ... | |
182 END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | |
183 | |
184 but sometimes it is useful to do something like | |
185 | |
186 BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_1; | |
187 ... custom code here, normally ending in a call to | |
7481
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
188 octave_rethrow_exception ... |
4302 | 189 BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_2; |
190 | |
191 so that you can perform extra clean up operations before throwing | |
192 the interrupt exception. */ | |
193 | |
4153 | 194 #define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE \ |
4302 | 195 BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_1; \ |
7481
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
196 octave_rethrow_exception (); \ |
4302 | 197 BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_2 |
198 | |
199 #define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_1 \ | |
4153 | 200 do \ |
201 { \ | |
4182 | 202 octave_jmp_buf saved_context; \ |
4153 | 203 \ |
5760 | 204 octave_save_current_context (saved_context); \ |
4153 | 205 \ |
206 if (octave_set_current_context) \ | |
9930
1ddc25c3623a
libcruft/misc: untabify sources
John W. Eaton <jwe@octave.org>
parents:
8928
diff
changeset
|
207 { \ |
1ddc25c3623a
libcruft/misc: untabify sources
John W. Eaton <jwe@octave.org>
parents:
8928
diff
changeset
|
208 octave_restore_current_context (saved_context) |
4302 | 209 |
210 #define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_2 \ | |
9930
1ddc25c3623a
libcruft/misc: untabify sources
John W. Eaton <jwe@octave.org>
parents:
8928
diff
changeset
|
211 } \ |
4153 | 212 else \ |
9930
1ddc25c3623a
libcruft/misc: untabify sources
John W. Eaton <jwe@octave.org>
parents:
8928
diff
changeset
|
213 { \ |
1ddc25c3623a
libcruft/misc: untabify sources
John W. Eaton <jwe@octave.org>
parents:
8928
diff
changeset
|
214 octave_interrupt_immediately++ |
4153 | 215 |
216 #define END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE \ | |
9930
1ddc25c3623a
libcruft/misc: untabify sources
John W. Eaton <jwe@octave.org>
parents:
8928
diff
changeset
|
217 octave_interrupt_immediately--; \ |
5760 | 218 octave_restore_current_context (saved_context); \ |
4153 | 219 } \ |
220 } \ | |
221 while (0) | |
222 | |
4196 | 223 #ifdef __cplusplus |
224 | |
4180 | 225 #define BEGIN_INTERRUPT_WITH_EXCEPTIONS \ |
4182 | 226 sig_atomic_t saved_octave_interrupt_immediately = octave_interrupt_immediately; \ |
4180 | 227 \ |
4182 | 228 try \ |
4180 | 229 { \ |
4182 | 230 octave_interrupt_immediately = 0; |
4180 | 231 |
232 #define END_INTERRUPT_WITH_EXCEPTIONS \ | |
233 } \ | |
20535
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
234 catch (const octave_interrupt_exception&) \ |
4180 | 235 { \ |
4182 | 236 octave_interrupt_immediately = saved_octave_interrupt_immediately; \ |
4180 | 237 octave_jump_to_enclosing_context (); \ |
238 } \ | |
20535
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
239 catch (const octave_execution_exception&) \ |
7481
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
240 { \ |
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
241 octave_interrupt_immediately = saved_octave_interrupt_immediately; \ |
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
242 octave_exception_state = octave_exec_exception; \ |
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
243 octave_jump_to_enclosing_context (); \ |
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
244 } \ |
20535
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
245 catch (const std::bad_alloc&) \ |
4180 | 246 { \ |
4182 | 247 octave_interrupt_immediately = saved_octave_interrupt_immediately; \ |
7481
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
248 octave_exception_state = octave_alloc_exception; \ |
4180 | 249 octave_jump_to_enclosing_context (); \ |
250 } \ | |
251 \ | |
4182 | 252 octave_interrupt_immediately = saved_octave_interrupt_immediately |
4196 | 253 #endif |
4153 | 254 |
255 #ifdef __cplusplus | |
256 } | |
4560 | 257 |
4572 | 258 /* These should only be declared for C++ code, and should also be |
259 outside of any extern "C" block. */ | |
4560 | 260 |
6107 | 261 extern CRUFT_API void (*octave_signal_hook) (void); |
262 extern CRUFT_API void (*octave_interrupt_hook) (void); | |
263 extern CRUFT_API void (*octave_bad_alloc_hook) (void); | |
4560 | 264 |
4153 | 265 #endif |
266 | |
267 #endif |