26 #if ! defined (octave_quit_h)
27 #define octave_quit_h 1
29 #include "octave-config.h"
32 #if defined (__cplusplus)
43 #if defined (__cplusplus)
51 frame_info (
void) =
default;
53 frame_info (
const std::string& file_name,
const std::string& fcn_name,
55 : m_file_name (file_name), m_fcn_name (fcn_name), m_line (line),
59 frame_info (
const frame_info&) =
default;
61 frame_info& operator = (
const frame_info&) =
default;
63 ~frame_info (
void) =
default;
65 std::string file_name (
void)
const {
return m_file_name; }
67 std::string fcn_name (
void)
const {
return m_fcn_name; }
69 int line (
void)
const {
return m_line; }
71 int column (
void)
const {
return m_column; }
75 std::string m_file_name;
77 std::string m_fcn_name;
84 inline bool operator == (
const frame_info& a,
const frame_info& b)
86 return (a.file_name () == b.file_name ()
87 && a.fcn_name () == b.fcn_name ()
88 && a.line () == b.line ()
89 && a.column () == b.column ());
96 typedef std::list<frame_info> stack_info_type;
99 const std::string&
id =
"",
100 const std::string&
message =
"unspecified error",
101 const stack_info_type& stack_info = stack_info_type ())
102 : runtime_error (
message), m_err_type (err_type), m_id (id),
103 m_message (
message), m_stack_info (stack_info)
112 void set_err_type (
const std::string& et)
117 std::string err_type (
void)
const {
return m_err_type; }
119 virtual std::string stack_trace (
void)
const;
121 void set_identifier (
const std::string&
id)
126 virtual std::string identifier (
void)
const {
return m_id; }
128 void set_message (
const std::string& msg)
133 std::string
message (
void)
const {
return m_message; }
136 const char * what (
void)
const noexcept {
return m_message.c_str (); }
138 virtual stack_info_type stack_info (
void)
const
143 void set_stack_info (
const stack_info_type& stack_info)
145 m_stack_info = stack_info;
148 virtual void display (std::ostream& os)
const;
152 std::string m_err_type;
156 std::string m_message;
158 stack_info_type m_stack_info;
161 class OCTAVE_EXCEPTION_API exit_exception :
public std::exception
165 exit_exception (
int exit_status = 0,
bool safe_to_return =
false)
166 : std::exception (), m_exit_status (exit_status),
167 m_safe_to_return (safe_to_return)
170 exit_exception (
const exit_exception&) =
default;
172 exit_exception& operator = (exit_exception&) =
default;
174 ~exit_exception (
void) =
default;
176 const char * what (
void)
const noexcept {
return "exit exception"; }
178 int exit_status (
void)
const {
return m_exit_status; }
180 bool safe_to_return (
void)
const {
return m_safe_to_return; }
186 bool m_safe_to_return;
189 class interrupt_exception :
public std::exception
193 interrupt_exception (
void) =
default;
195 interrupt_exception (
const interrupt_exception&) =
default;
197 interrupt_exception& operator = (
const interrupt_exception&) =
default;
199 ~interrupt_exception (
void) =
default;
201 const char * what (
void)
const noexcept {
return "interrupt exception"; }
232 #if defined (__cplusplus)
234 inline void octave_quit (
void)
243 #define OCTAVE_QUIT octave_quit ()
247 #define OCTAVE_QUIT \
250 if (octave_signal_caught) \
252 octave_signal_caught = 0; \
253 octave_handle_signal (); \
266 #define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE \
270 #define END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE \
274 #if defined (__cplusplus)
280 #define BEGIN_INTERRUPT_WITH_EXCEPTIONS \
283 #define END_INTERRUPT_WITH_EXCEPTIONS \
288 #if defined (__cplusplus)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
bool operator==(const dim_vector &a, const dim_vector &b)
void message(const char *name, const char *fmt,...)
void(* octave_interrupt_hook)(void)
void(* octave_signal_hook)(void)
OCTAVE_API sig_atomic_t octave_interrupt_state
OCTAVE_API void octave_handle_signal(void)
OCTAVE_API volatile sig_atomic_t octave_signal_caught