26#if ! defined (octave_quit_h)
27#define octave_quit_h 1
29#include "octave-config.h"
31#if defined (__cplusplus)
44 frame_info () =
default;
46 frame_info (
const std::string& file_name,
const std::string& fcn_name,
48 : m_file_name (file_name), m_fcn_name (fcn_name), m_line (line),
52 frame_info (
const frame_info&) =
default;
54 frame_info& operator = (
const frame_info&) =
default;
56 ~frame_info () =
default;
58 std::string file_name ()
const {
return m_file_name; }
60 std::string fcn_name ()
const {
return m_fcn_name; }
62 int line ()
const {
return m_line; }
64 int column ()
const {
return m_column; }
68 std::string m_file_name;
70 std::string m_fcn_name;
77inline bool operator == (
const frame_info& a,
const frame_info& b)
79 return (a.file_name () == b.file_name ()
80 && a.fcn_name () == b.fcn_name ()
81 && a.line () == b.line ()
82 && a.column () == b.column ());
89 typedef std::list<frame_info> stack_info_type;
92 const std::string&
id =
"",
93 const std::string&
message =
"unspecified error",
94 const stack_info_type& stack_info = stack_info_type ())
95 : runtime_error (
message), m_err_type (err_type), m_id (id),
96 m_message (
message), m_stack_info (stack_info)
105 void set_err_type (
const std::string& et)
110 std::string err_type ()
const {
return m_err_type; }
112 virtual std::string stack_trace ()
const;
114 void set_identifier (
const std::string&
id)
119 virtual std::string identifier ()
const {
return m_id; }
121 void set_message (
const std::string& msg)
126 std::string
message ()
const {
return m_message; }
129 const char * what () const noexcept {
return m_message.c_str (); }
131 virtual stack_info_type stack_info ()
const
136 void set_stack_info (
const stack_info_type& stack_info)
138 m_stack_info = stack_info;
141 virtual void display (std::ostream& os)
const;
145 std::string m_err_type;
149 std::string m_message;
151 stack_info_type m_stack_info;
154class OCTAVE_EXCEPTION_API exit_exception :
public std::exception
158 exit_exception (
int exit_status = 0,
bool safe_to_return =
false)
159 : std::exception (), m_exit_status (exit_status),
160 m_safe_to_return (safe_to_return)
163 OCTAVE_DEFAULT_COPY_MOVE_DELETE (exit_exception)
165 const char * what () const noexcept {
return "exit exception"; }
167 int exit_status ()
const {
return m_exit_status; }
169 bool safe_to_return ()
const {
return m_safe_to_return; }
175 bool m_safe_to_return;
178class OCTAVE_EXCEPTION_API interrupt_exception :
public std::exception
182 interrupt_exception () =
default;
184 interrupt_exception (
const interrupt_exception&) =
default;
186 interrupt_exception& operator = (
const interrupt_exception&) =
default;
188 ~interrupt_exception () =
default;
190 const char * what () const noexcept {
return "interrupt exception"; }
193OCTAVE_END_NAMESPACE(octave)
218#if defined (__cplusplus)
228#if defined (__cplusplus)
230 inline void octave_quit ()
232 bool expected =
true;
238#define OCTAVE_QUIT octave_quit ()
243#define OCTAVE_QUIT octave_quit_c ()
254#define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE \
258#define END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE \
262#if defined (__cplusplus)
268#define BEGIN_INTERRUPT_WITH_EXCEPTIONS \
271#define END_INTERRUPT_WITH_EXCEPTIONS \
276#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< bool > octave_signal_caught
void(* octave_interrupt_hook)()
void(* octave_signal_hook)()
std::atomic< int > octave_interrupt_state
void octave_handle_signal(void)