23 #if !defined (octave_quit_h)
24 #define octave_quit_h 1
36 #if defined (__WIN32__) && ! defined (_POSIX_VERSION)
38 #define WIN32_LEAN_AND_MEAN
41 CRUFT_API
extern void w32_sigint_init (
void);
42 CRUFT_API
extern void w32_raise_final (
void);
43 CRUFT_API
extern void w32_raise (
int sig);
44 CRUFT_API
extern int w32_in_main_thread (
void);
48 #if defined (OCTAVE_HAVE_SIG_JUMP)
52 #define octave_set_current_context sigsetjmp (current_context, 1)
58 #define octave_set_current_context setjmp (current_context)
76 octave_execution_exception
81 octave_interrupt_exception
117 inline void octave_quit (
void)
119 if (octave_signal_caught)
121 octave_signal_caught = 0;
126 #define OCTAVE_QUIT octave_quit ()
130 #define OCTAVE_QUIT \
133 if (octave_signal_caught) \
135 octave_signal_caught = 0; \
136 octave_handle_signal (); \
158 #define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE \
159 BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_1; \
160 octave_rethrow_exception (); \
161 BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_2
163 #define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_1 \
166 octave_jmp_buf saved_context; \
168 octave_save_current_context (saved_context); \
170 if (octave_set_current_context) \
172 octave_restore_current_context (saved_context)
174 #define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_2 \
178 octave_interrupt_immediately++
180 #define END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE \
181 octave_interrupt_immediately--; \
182 octave_restore_current_context (saved_context); \
189 #define BEGIN_INTERRUPT_WITH_EXCEPTIONS \
190 sig_atomic_t saved_octave_interrupt_immediately = octave_interrupt_immediately; \
194 octave_interrupt_immediately = 0;
196 #define END_INTERRUPT_WITH_EXCEPTIONS \
198 catch (octave_interrupt_exception) \
200 octave_interrupt_immediately = saved_octave_interrupt_immediately; \
201 octave_jump_to_enclosing_context (); \
203 catch (octave_execution_exception) \
205 octave_interrupt_immediately = saved_octave_interrupt_immediately; \
206 octave_exception_state = octave_exec_exception; \
207 octave_jump_to_enclosing_context (); \
209 catch (std::bad_alloc) \
211 octave_interrupt_immediately = saved_octave_interrupt_immediately; \
212 octave_exception_state = octave_alloc_exception; \
213 octave_jump_to_enclosing_context (); \
216 octave_interrupt_immediately = saved_octave_interrupt_immediately
void(* octave_interrupt_hook)(void)=0
CRUFT_API sig_atomic_t octave_interrupt_immediately
CRUFT_API int long GCC_ATTR_NORETURN
CRUFT_API void octave_throw_execution_exception(void) GCC_ATTR_NORETURN
void(* octave_bad_alloc_hook)(void)=0
CRUFT_API volatile sig_atomic_t octave_signal_caught
CRUFT_API sig_atomic_t octave_exception_state
CRUFT_API sig_atomic_t octave_interrupt_state
CRUFT_API void octave_save_current_context(void *)
CRUFT_API void octave_restore_current_context(void *)
void(* octave_signal_hook)(void)=0
CRUFT_API void octave_restore_signal_mask(void)
CRUFT_API octave_jmp_buf current_context
CRUFT_API void octave_rethrow_exception(void)
CRUFT_API void octave_jump_to_enclosing_context(void) GCC_ATTR_NORETURN
CRUFT_API void octave_handle_signal(void)
CRUFT_API void octave_save_signal_mask(void)
CRUFT_API void octave_throw_interrupt_exception(void) GCC_ATTR_NORETURN
CRUFT_API void octave_throw_bad_alloc(void) GCC_ATTR_NORETURN