23 #if ! defined (octave_quit_h)
24 #define octave_quit_h 1
26 #include "octave-config.h"
31 #if defined (__cplusplus)
39 #if defined (OCTAVE_HAVE_SIG_JUMP)
43 #define octave_set_current_context sigsetjmp (current_context, 1)
49 #define octave_set_current_context setjmp (current_context)
61 #if defined (__cplusplus)
73 : m_stack_trace (x.m_stack_trace) { }
78 m_stack_trace = x.m_stack_trace;
85 virtual void set_stack_trace (
const std::string& st)
90 virtual void set_stack_trace (
void)
110 exit_exception (
int exit_status = 0,
bool safe_to_return =
false)
111 : m_exit_status (exit_status), m_safe_to_return (safe_to_return)
114 exit_exception (
const exit_exception& ex)
115 : m_exit_status (ex.m_exit_status), m_safe_to_return (ex.m_safe_to_return)
118 exit_exception& operator = (exit_exception& ex)
122 m_exit_status = ex.m_exit_status;
123 m_safe_to_return = ex.m_safe_to_return;
129 ~exit_exception (
void) { }
131 int exit_status (
void)
const {
return m_exit_status; }
133 bool safe_to_return (
void)
const {
return m_safe_to_return; }
139 bool m_safe_to_return;
148 OCTAVE_DEPRECATED (
"use 'octave::execution_exception' instead")
149 typedef
octave::exit_exception octave_execution_exception;
151 OCTAVE_DEPRECATED ("use '
octave::exit_exception' instead")
152 typedef
octave::exit_exception octave_exit_exception;
154 OCTAVE_DEPRECATED ("use '
octave::interrupt_exception' instead")
155 typedef
octave::interrupt_exception octave_interrupt_exception;
194 #if defined (__cplusplus)
196 extern OCTAVE_API
void
199 inline void octave_quit (
void)
201 if (octave_signal_caught)
203 octave_signal_caught = 0;
208 #define OCTAVE_QUIT octave_quit ()
212 #define OCTAVE_QUIT \
215 if (octave_signal_caught) \
217 octave_signal_caught = 0; \
218 octave_handle_signal (); \
240 #define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE \
241 BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_1; \
242 octave_rethrow_exception (); \
243 BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_2
245 #define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_1 \
248 octave_jmp_buf saved_context; \
250 octave_save_current_context (saved_context); \
252 if (octave_set_current_context) \
254 octave_restore_current_context (saved_context)
256 #define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_2 \
260 octave_interrupt_immediately++
262 #define END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE \
263 octave_interrupt_immediately--; \
264 octave_restore_current_context (saved_context); \
269 #if defined (__cplusplus)
271 #define BEGIN_INTERRUPT_WITH_EXCEPTIONS \
272 sig_atomic_t saved_octave_interrupt_immediately = octave_interrupt_immediately; \
276 octave_interrupt_immediately = 0;
278 #define END_INTERRUPT_WITH_EXCEPTIONS \
280 catch (const octave::interrupt_exception&) \
282 octave_interrupt_immediately = saved_octave_interrupt_immediately; \
283 octave_jump_to_enclosing_context (); \
285 catch (const octave::execution_exception&) \
287 octave_interrupt_immediately = saved_octave_interrupt_immediately; \
288 octave_exception_state = octave_exec_exception; \
289 octave_jump_to_enclosing_context (); \
291 catch (const std::bad_alloc&) \
293 octave_interrupt_immediately = saved_octave_interrupt_immediately; \
294 octave_exception_state = octave_alloc_exception; \
295 octave_jump_to_enclosing_context (); \
297 catch (const octave::exit_exception& ex) \
299 octave_interrupt_immediately = saved_octave_interrupt_immediately; \
300 octave_exception_state = octave_quit_exception; \
301 octave_exit_exception_status = ex.exit_status (); \
302 octave_exit_exception_safe_to_return = ex.safe_to_return (); \
303 octave_jump_to_enclosing_context (); \
306 octave_interrupt_immediately = saved_octave_interrupt_immediately
309 #if defined (__cplusplus)
Octave interface to the compression and uncompression libraries.
void(* octave_interrupt_hook)(void)=0
OCTAVE_API void octave_save_current_context(void *)
OCTAVE_API sig_atomic_t octave_interrupt_state
void(* octave_bad_alloc_hook)(void)=0
OCTAVE_API sig_atomic_t octave_interrupt_immediately
OCTAVE_NORETURN OCTAVE_API void octave_throw_execution_exception(void)
OCTAVE_API void octave_handle_signal(void)
OCTAVE_API void clean_up_and_exit(int exit_status, bool safe_to_return)
OCTAVE_NORETURN OCTAVE_API void octave_throw_bad_alloc(void)
OCTAVE_NORETURN OCTAVE_API void octave_jump_to_enclosing_context(void)
OCTAVE_API void octave_rethrow_exception(void)
OCTAVE_API sig_atomic_t octave_exception_state
void(* octave_signal_hook)(void)=0
OCTAVE_NORETURN OCTAVE_API void octave_throw_interrupt_exception(void)
OCTAVE_API void octave_restore_current_context(void *)
OCTAVE_API sig_atomic_t octave_exit_exception_status
OCTAVE_API sig_atomic_t octave_exit_exception_safe_to_return
OCTAVE_API octave_jmp_buf current_context
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
OCTAVE_API volatile sig_atomic_t octave_signal_caught
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE * x