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 OCTAVE_DEFAULT_COPY_MOVE_DELETE (exit_exception)
172 const char * what (
void)
const noexcept {
return "exit exception"; }
174 int exit_status (
void)
const {
return m_exit_status; }
176 bool safe_to_return (
void)
const {
return m_safe_to_return; }
182 bool m_safe_to_return;
185 class interrupt_exception :
public std::exception
189 interrupt_exception (
void) =
default;
191 interrupt_exception (
const interrupt_exception&) =
default;
193 interrupt_exception& operator = (
const interrupt_exception&) =
default;
195 ~interrupt_exception (
void) =
default;
197 const char * what (
void)
const noexcept {
return "interrupt exception"; }
200 OCTAVE_END_NAMESPACE(
octave)
225 #if defined (__cplusplus)
235 #if defined (__cplusplus)
237 inline void octave_quit (
void)
239 bool expected =
true;
245 #define OCTAVE_QUIT octave_quit ()
250 #define OCTAVE_QUIT octave_quit_c ()
261 #define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE \
265 #define END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE \
269 #if defined (__cplusplus)
275 #define BEGIN_INTERRUPT_WITH_EXCEPTIONS \
278 #define END_INTERRUPT_WITH_EXCEPTIONS \
283 #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,...)
std::atomic< sig_atomic_t > octave_interrupt_state
void(* octave_interrupt_hook)()
void(* octave_signal_hook)()
volatile std::atomic< bool > octave_signal_caught
void octave_handle_signal(void)