annotate liboctave/util/quit.cc @ 27520:7a871724d4b0

restore some exception handling functions and variables and deprecate them * quit.h, quit.cc (octave_exception_state, octave_bad_alloc_hook): Restore variables, mark as deprecated. (enum octave_exception): Restore enum values, mark as deprecated. (internal_exception_state): New static variable for internal use. (enum octave_internal_exception): New enum values. Use to replace octave_exception enum values internally. (octave_throw_interrupt_exception, octave_throw_execution_exception, octave_throw_bad_alloc, octave_rethrow_exception): Restore functions, mark as deprecated.
author John W. Eaton <jwe@octave.org>
date Thu, 17 Oct 2019 11:59:26 -0400
parents 63b417917f5e
children b442ec6dda5c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents:
diff changeset
1 /*
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents:
diff changeset
2
26376
00f796120a6d maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 25438
diff changeset
3 Copyright (C) 2002-2019 John W. Eaton
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents:
diff changeset
4
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents:
diff changeset
6
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24444
diff changeset
7 Octave is free software: you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
8 under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24444
diff changeset
9 the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
10 (at your option) any later version.
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents:
diff changeset
11
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
15 GNU General Public License for more details.
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents:
diff changeset
16
6b96ce9f5743 [project @ 2002-11-06 20:38:49 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: 5307
diff changeset
18 along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24444
diff changeset
19 <https://www.gnu.org/licenses/>.
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents:
diff changeset
20
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents:
diff changeset
21 */
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents:
diff changeset
22
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
23 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21202
diff changeset
24 # include "config.h"
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents:
diff changeset
25 #endif
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents:
diff changeset
26
4154
f10865750046 [project @ 2002-11-07 15:31:42 by jwe]
jwe
parents: 4153
diff changeset
27 #include <cstring>
f10865750046 [project @ 2002-11-07 15:31:42 by jwe]
jwe
parents: 4153
diff changeset
28
27471
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
29 #include <ostream>
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
30 #include <sstream>
4180
84fe3ca3a246 [project @ 2002-11-15 04:47:01 by jwe]
jwe
parents: 4154
diff changeset
31 #include <new>
84fe3ca3a246 [project @ 2002-11-15 04:47:01 by jwe]
jwe
parents: 4154
diff changeset
32
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents:
diff changeset
33 #include "quit.h"
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents:
diff changeset
34
27480
63b417917f5e remove some obsolete signal handling functions
John W. Eaton <jwe@octave.org>
parents: 27471
diff changeset
35 sig_atomic_t octave_interrupt_state = 0;
63b417917f5e remove some obsolete signal handling functions
John W. Eaton <jwe@octave.org>
parents: 27471
diff changeset
36
27520
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
37 // DEPRECATED in Octave 6.
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
38 // This variable should never have been public.
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
39 sig_atomic_t octave_exception_state = 0;
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
40 // Use this variable internally until the functions that use it can be
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
41 // removed.
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
42 static sig_atomic_t internal_exception_state;
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
43
27480
63b417917f5e remove some obsolete signal handling functions
John W. Eaton <jwe@octave.org>
parents: 27471
diff changeset
44 volatile sig_atomic_t octave_signal_caught = 0;
63b417917f5e remove some obsolete signal handling functions
John W. Eaton <jwe@octave.org>
parents: 27471
diff changeset
45
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23426
diff changeset
46 void (*octave_signal_hook) (void) = nullptr;
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23426
diff changeset
47 void (*octave_interrupt_hook) (void) = nullptr;
4429
c1f6200b5f0e [project @ 2003-06-17 04:36:08 by jwe]
jwe
parents: 4270
diff changeset
48
27520
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
49 // DEPRECATED in Octave 6.
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
50 void (*octave_bad_alloc_hook) (void) = nullptr;
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
51
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
52 // The octave_exception enum values were DEPRECATED in Octave 6.
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
53 // Use these values internally until the functions that use them can be
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
54 // removed.
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
55 enum octave_internal_exception
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
56 {
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
57 octave_internal_no_exception = 0,
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
58 octave_internal_exec_exception = 1,
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
59 octave_internal_alloc_exception = 3,
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
60 octave_internal_quit_exception = 4
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
61 };
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
62
27471
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
63 namespace octave
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
64 {
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
65 std::string execution_exception::stack_trace (void) const
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
66 {
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
67 size_t nframes = m_stack_info.size ();
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
68
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
69 if (nframes == 0)
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
70 return std::string ();
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
71
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
72 std::ostringstream buf;
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
73
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
74 buf << "error: called from\n";
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
75
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
76 for (const auto& frm : m_stack_info)
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
77 {
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
78 buf << " " << frm.fcn_name ();
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
79
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
80 int line = frm.line ();
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
81
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
82 if (line > 0)
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
83 {
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
84 buf << " at line " << line;
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
85
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
86 int column = frm.column ();
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
87
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
88 if (column > 0)
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
89 buf << " column " << column;
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
90 }
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
91
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
92 buf << "\n";
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
93 }
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
94
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
95 return buf.str ();
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
96 }
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
97
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
98 void execution_exception::display (std::ostream& os) const
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
99 {
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
100 if (! m_message.empty ())
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
101 {
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
102 os << m_err_type << ": " << m_message;
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
103
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
104 if (m_message.back () != '\n')
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
105 {
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
106 os << "\n";
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
107
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
108 std::string st = stack_trace ();
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
109
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
110 if (! st.empty ())
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
111 os << st;
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
112 }
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
113 }
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
114 }
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
115 }
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
116
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents:
diff changeset
117 void
5142
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 4571
diff changeset
118 octave_handle_signal (void)
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 4571
diff changeset
119 {
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 4571
diff changeset
120 if (octave_signal_hook)
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 4571
diff changeset
121 octave_signal_hook ();
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 4571
diff changeset
122
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 4571
diff changeset
123 if (octave_interrupt_state > 0)
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 4571
diff changeset
124 {
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 4571
diff changeset
125 octave_interrupt_state = -1;
27480
63b417917f5e remove some obsolete signal handling functions
John W. Eaton <jwe@octave.org>
parents: 27471
diff changeset
126
27520
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
127 throw octave::interrupt_exception ();
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
128 }
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
129 }
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
130
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
131 // DEPRECATED in Octave 6
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
132 void
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
133 octave_throw_interrupt_exception (void)
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
134 {
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
135 if (octave_interrupt_hook)
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
136 octave_interrupt_hook ();
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
137
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
138 throw octave::interrupt_exception ();
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
139 }
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
140
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
141 // DEPRECATED in Octave 6
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
142 void
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
143 octave_throw_execution_exception (void)
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
144 {
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
145 // FIXME: would a hook function be useful here?
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
146
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
147 internal_exception_state = octave_internal_exec_exception;
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
148
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
149 throw octave::execution_exception ();
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
150 }
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
151
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
152 // DEPRECATED in Octave 6
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
153 void
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
154 octave_throw_bad_alloc (void)
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
155 {
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
156 internal_exception_state = octave_internal_alloc_exception;
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
157
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
158 throw std::bad_alloc ();
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
159 }
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
160
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
161 // DEPRECATED in Octave 6
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
162 void
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
163 octave_rethrow_exception (void)
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
164 {
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
165 if (octave_interrupt_state)
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
166 {
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
167 octave_interrupt_state = -1;
27480
63b417917f5e remove some obsolete signal handling functions
John W. Eaton <jwe@octave.org>
parents: 27471
diff changeset
168
63b417917f5e remove some obsolete signal handling functions
John W. Eaton <jwe@octave.org>
parents: 27471
diff changeset
169 throw octave::interrupt_exception ();
5142
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 4571
diff changeset
170 }
27520
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
171 else
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
172 {
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
173 switch (internal_exception_state)
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
174 {
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
175 case octave_internal_exec_exception:
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
176 throw octave::execution_exception ();
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
177 break;
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
178
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
179 case octave_internal_alloc_exception:
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
180 throw std::bad_alloc ();
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
181 break;
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
182
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
183 default:
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
184 break;
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
185 }
7a871724d4b0 restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents: 27480
diff changeset
186 }
5142
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 4571
diff changeset
187 }