4153
|
1 /* |
|
2 |
|
3 Copyright (C) 2002 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 |
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 |
|
23 #ifdef HAVE_CONFIG_H |
|
24 #include <config.h> |
|
25 #endif |
|
26 |
4154
|
27 #include <cstring> |
|
28 |
5142
|
29 #include <iostream> |
4180
|
30 #include <new> |
|
31 |
4153
|
32 #include "quit.h" |
|
33 |
5142
|
34 void (*octave_signal_hook) (void) = 0; |
4429
|
35 void (*octave_interrupt_hook) (void) = 0; |
|
36 void (*octave_bad_alloc_hook) (void) = 0; |
|
37 |
4153
|
38 void |
5142
|
39 octave_handle_signal (void) |
|
40 { |
|
41 if (octave_signal_hook) |
|
42 octave_signal_hook (); |
|
43 |
|
44 if (octave_interrupt_state > 0) |
|
45 { |
|
46 octave_interrupt_state = -1; |
|
47 octave_throw_interrupt_exception (); |
|
48 } |
|
49 } |
|
50 |
|
51 void |
4153
|
52 octave_throw_interrupt_exception (void) |
|
53 { |
4429
|
54 if (octave_interrupt_hook) |
|
55 octave_interrupt_hook (); |
|
56 |
4153
|
57 throw octave_interrupt_exception (); |
|
58 } |
|
59 |
4180
|
60 void |
|
61 octave_throw_bad_alloc (void) |
|
62 { |
4429
|
63 if (octave_bad_alloc_hook) |
|
64 octave_bad_alloc_hook (); |
|
65 |
4181
|
66 throw std::bad_alloc (); |
4180
|
67 } |
|
68 |
4153
|
69 /* |
|
70 ;;; Local Variables: *** |
|
71 ;;; mode: C++ *** |
|
72 ;;; End: *** |
|
73 */ |