Mercurial > octave
annotate liboctave/util/quit.h @ 33636:3ec6fcce7715 default tip @
gui: Avoid using HAVE_QSCINTILLA in more header files.
* gui-settings.h, settings-dialog.h: Don't include QScintilla header.
Forward-declare QSciLexer class instead if necessary. Declare all member
functions unconditionally.
* gui-settings.cc (gui_settings::get_valid_lexer_styles,
gui_settings::read_lexer_settings),
settings-dialog.cc (settings_dialog::update_lexer,
settings_dialog::get_lexer_settings, settings_dialog::write_lexer_settings):
Define functions unconditionally.
* gui-preferences-ed.h: Don't include QScintilla header. Remove definition of
local variable os_eol_mode from header.
* gui-preferences-ed.cc (os_eol_mode): Move definition of local variable here.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Tue, 28 May 2024 14:54:58 +0200 |
parents | d9ff240f1339 |
children |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31904
diff
changeset
|
3 // Copyright (C) 2002-2024 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
4153 | 25 |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
20785
diff
changeset
|
26 #if ! defined (octave_quit_h) |
4153 | 27 #define octave_quit_h 1 |
28 | |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21227
diff
changeset
|
29 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21227
diff
changeset
|
30 |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21849
diff
changeset
|
31 /* The signal header is just needed for the sig_atomic_t type. */ |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
32 #if defined (__cplusplus) |
31846
5f0b8101234e
Remove several race conditions with signal handler (bug #61370).
Reinhard Resch <r_resch@a1.net>
parents:
31706
diff
changeset
|
33 # include <atomic> |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21849
diff
changeset
|
34 # include <csignal> |
27471 | 35 # include <iosfwd> |
36 # include <list> | |
27997
e90e3155cd01
derive execution_exception from std::exception
John W. Eaton <jwe@octave.org>
parents:
27933
diff
changeset
|
37 # include <stdexcept> |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
38 # include <string> |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21849
diff
changeset
|
39 #else |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21849
diff
changeset
|
40 # include <signal.h> |
4153 | 41 #endif |
42 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
43 #if defined (__cplusplus) |
22094
9203833cab7d
move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
44 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31489
diff
changeset
|
45 OCTAVE_BEGIN_NAMESPACE(octave) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31489
diff
changeset
|
46 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
47 class frame_info |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
48 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
49 public: |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
50 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
51 frame_info () = default; |
27471 | 52 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
53 frame_info (const std::string& file_name, const std::string& fcn_name, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
54 int line, int column) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
55 : m_file_name (file_name), m_fcn_name (fcn_name), m_line (line), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
56 m_column (column) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
57 { } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
58 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
59 frame_info (const frame_info&) = default; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
60 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
61 frame_info& operator = (const frame_info&) = default; |
27471 | 62 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
63 ~frame_info () = default; |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
64 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
65 std::string file_name () const { return m_file_name; } |
27471 | 66 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
67 std::string fcn_name () const { return m_fcn_name; } |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
68 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
69 int line () const { return m_line; } |
27471 | 70 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
71 int column () const { return m_column; } |
27471 | 72 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
73 private: |
27471 | 74 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
75 std::string m_file_name; |
27471 | 76 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
77 std::string m_fcn_name; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
78 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
79 int m_line; |
27471 | 80 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
81 int m_column; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
82 }; |
27471 | 83 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
84 inline bool operator == (const frame_info& a, const frame_info& b) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
85 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
86 return (a.file_name () == b.file_name () |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
87 && a.fcn_name () == b.fcn_name () |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
88 && a.line () == b.line () |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
89 && a.column () == b.column ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
90 } |
27471 | 91 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
92 class OCTAVE_EXCEPTION_API execution_exception : public std::runtime_error |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
93 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
94 public: |
27471 | 95 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
96 typedef std::list<frame_info> stack_info_type; |
27471 | 97 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
98 execution_exception (const std::string& err_type = "error", |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
99 const std::string& id = "", |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
100 const std::string& message = "unspecified error", |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
101 const stack_info_type& stack_info = stack_info_type ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
102 : runtime_error (message), m_err_type (err_type), m_id (id), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
103 m_message (message), m_stack_info (stack_info) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
104 { } |
27471 | 105 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
106 execution_exception (const execution_exception&) = default; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
107 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
108 execution_exception& operator = (const execution_exception&) = default; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
109 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
110 ~execution_exception () = default; |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
111 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
112 void set_err_type (const std::string& et) |
27471 | 113 { |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
114 m_err_type = et; |
27471 | 115 } |
116 | |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
117 std::string err_type () const { return m_err_type; } |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
118 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
119 virtual std::string stack_trace () const; |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
120 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
121 void set_identifier (const std::string& id) |
22327
d0562b3159c7
move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
122 { |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
123 m_id = id; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
124 } |
27471 | 125 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
126 virtual std::string identifier () const { return m_id; } |
20666
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
127 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
128 void set_message (const std::string& msg) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
129 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
130 m_message = msg; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
131 } |
20666
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
132 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
133 std::string message () const { return m_message; } |
27471 | 134 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
135 // Provided for std::exception interface. |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
136 const char * what () const noexcept { return m_message.c_str (); } |
20666
e0e2c2ce7e94
defer stack trace until back at top level
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
137 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
138 virtual stack_info_type stack_info () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
139 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
140 return m_stack_info; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
141 } |
20785
b6f2909e7f94
always throw exception after debugging with debug_on_error
John W. Eaton <jwe@octave.org>
parents:
20666
diff
changeset
|
142 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
143 void set_stack_info (const stack_info_type& stack_info) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
144 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
145 m_stack_info = stack_info; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
146 } |
27471 | 147 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
148 virtual void display (std::ostream& os) const; |
27997
e90e3155cd01
derive execution_exception from std::exception
John W. Eaton <jwe@octave.org>
parents:
27933
diff
changeset
|
149 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
150 private: |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
151 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
152 std::string m_err_type; |
22327
d0562b3159c7
move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
153 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
154 std::string m_id; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
155 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
156 std::string m_message; |
27471 | 157 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
158 stack_info_type m_stack_info; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
159 }; |
27471 | 160 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
161 class OCTAVE_EXCEPTION_API exit_exception : public std::exception |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
162 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
163 public: |
20785
b6f2909e7f94
always throw exception after debugging with debug_on_error
John W. Eaton <jwe@octave.org>
parents:
20666
diff
changeset
|
164 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
165 exit_exception (int exit_status = 0, bool safe_to_return = false) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
166 : std::exception (), m_exit_status (exit_status), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
167 m_safe_to_return (safe_to_return) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
168 { } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
169 |
31855
1daf8bfceac3
default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents:
31846
diff
changeset
|
170 OCTAVE_DEFAULT_COPY_MOVE_DELETE (exit_exception) |
22094
9203833cab7d
move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
171 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
172 const char * what () const noexcept { return "exit exception"; } |
22094
9203833cab7d
move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
173 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
174 int exit_status () const { return m_exit_status; } |
22327
d0562b3159c7
move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
175 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
176 bool safe_to_return () const { return m_safe_to_return; } |
28000
768b54395b31
also derive exit_exception and interrupt_exception from std::exception
John W. Eaton <jwe@octave.org>
parents:
27997
diff
changeset
|
177 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
178 private: |
22327
d0562b3159c7
move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
179 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
180 int m_exit_status; |
22094
9203833cab7d
move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
181 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
182 bool m_safe_to_return; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
183 }; |
22094
9203833cab7d
move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
184 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
185 class interrupt_exception : public std::exception |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
186 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
187 public: |
28000
768b54395b31
also derive exit_exception and interrupt_exception from std::exception
John W. Eaton <jwe@octave.org>
parents:
27997
diff
changeset
|
188 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
189 interrupt_exception () = default; |
27997
e90e3155cd01
derive execution_exception from std::exception
John W. Eaton <jwe@octave.org>
parents:
27933
diff
changeset
|
190 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
191 interrupt_exception (const interrupt_exception&) = default; |
28000
768b54395b31
also derive exit_exception and interrupt_exception from std::exception
John W. Eaton <jwe@octave.org>
parents:
27997
diff
changeset
|
192 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
193 interrupt_exception& operator = (const interrupt_exception&) = default; |
28000
768b54395b31
also derive exit_exception and interrupt_exception from std::exception
John W. Eaton <jwe@octave.org>
parents:
27997
diff
changeset
|
194 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
195 ~interrupt_exception () = default; |
28000
768b54395b31
also derive exit_exception and interrupt_exception from std::exception
John W. Eaton <jwe@octave.org>
parents:
27997
diff
changeset
|
196 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
197 const char * what () const noexcept { return "interrupt exception"; } |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
198 }; |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31489
diff
changeset
|
199 |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31489
diff
changeset
|
200 OCTAVE_END_NAMESPACE(octave) |
22094
9203833cab7d
move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
201 |
31904
123c5d78fc9d
quit.h: Do not declare functions in namespaces inside extern "C" block.
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
202 extern "C" { |
123c5d78fc9d
quit.h: Do not declare functions in namespaces inside extern "C" block.
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
203 |
4153 | 204 #endif |
205 | |
27933
863ae57eee69
maint: Use Octave coding conventions in liboctave/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
206 // The following enum values are deprecated and will eventually be |
863ae57eee69
maint: Use Octave coding conventions in liboctave/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
207 // removed from Octave, but there seems to be no universally good way |
863ae57eee69
maint: Use Octave coding conventions in liboctave/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
208 // to tag them with an attribute that will generate a warning. |
27536
d389416f0e50
remove OCTAVE_DEPRECTED tags from enum values (bug #57092)
John W. Eaton <jwe@octave.org>
parents:
27520
diff
changeset
|
209 |
27520
7a871724d4b0
restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents:
27480
diff
changeset
|
210 enum |
7a871724d4b0
restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents:
27480
diff
changeset
|
211 octave_exception |
7a871724d4b0
restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents:
27480
diff
changeset
|
212 { |
27536
d389416f0e50
remove OCTAVE_DEPRECTED tags from enum values (bug #57092)
John W. Eaton <jwe@octave.org>
parents:
27520
diff
changeset
|
213 octave_no_exception = 0, |
d389416f0e50
remove OCTAVE_DEPRECTED tags from enum values (bug #57092)
John W. Eaton <jwe@octave.org>
parents:
27520
diff
changeset
|
214 octave_exec_exception = 1, |
d389416f0e50
remove OCTAVE_DEPRECTED tags from enum values (bug #57092)
John W. Eaton <jwe@octave.org>
parents:
27520
diff
changeset
|
215 octave_alloc_exception = 3, |
d389416f0e50
remove OCTAVE_DEPRECTED tags from enum values (bug #57092)
John W. Eaton <jwe@octave.org>
parents:
27520
diff
changeset
|
216 octave_quit_exception = 4 |
27520
7a871724d4b0
restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents:
27480
diff
changeset
|
217 }; |
7a871724d4b0
restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents:
27480
diff
changeset
|
218 |
5133 | 219 /* |
220 > 0: interrupt pending | |
221 0: no interrupt pending | |
222 < 0: handling interrupt | |
223 */ | |
31846
5f0b8101234e
Remove several race conditions with signal handler (bug #61370).
Reinhard Resch <r_resch@a1.net>
parents:
31706
diff
changeset
|
224 |
5f0b8101234e
Remove several race conditions with signal handler (bug #61370).
Reinhard Resch <r_resch@a1.net>
parents:
31706
diff
changeset
|
225 #if defined (__cplusplus) |
4180 | 226 |
31846
5f0b8101234e
Remove several race conditions with signal handler (bug #61370).
Reinhard Resch <r_resch@a1.net>
parents:
31706
diff
changeset
|
227 extern OCTAVE_API std::atomic<int> octave_interrupt_state; |
5f0b8101234e
Remove several race conditions with signal handler (bug #61370).
Reinhard Resch <r_resch@a1.net>
parents:
31706
diff
changeset
|
228 |
33063
d9ff240f1339
Eliminate final uses of volatile in codebase (bug #65321)
Rik <rik@octave.org>
parents:
32832
diff
changeset
|
229 extern OCTAVE_API std::atomic<bool> octave_signal_caught; |
31846
5f0b8101234e
Remove several race conditions with signal handler (bug #61370).
Reinhard Resch <r_resch@a1.net>
parents:
31706
diff
changeset
|
230 |
5f0b8101234e
Remove several race conditions with signal handler (bug #61370).
Reinhard Resch <r_resch@a1.net>
parents:
31706
diff
changeset
|
231 #endif |
5142 | 232 |
29230
6b3faa844395
Set API tags in files in liboctave/util (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29135
diff
changeset
|
233 extern OCTAVE_API void octave_handle_signal (void); |
5142 | 234 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
235 #if defined (__cplusplus) |
22094
9203833cab7d
move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
236 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
237 inline void octave_quit () |
10142
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
238 { |
31846
5f0b8101234e
Remove several race conditions with signal handler (bug #61370).
Reinhard Resch <r_resch@a1.net>
parents:
31706
diff
changeset
|
239 bool expected = true; |
5f0b8101234e
Remove several race conditions with signal handler (bug #61370).
Reinhard Resch <r_resch@a1.net>
parents:
31706
diff
changeset
|
240 |
5f0b8101234e
Remove several race conditions with signal handler (bug #61370).
Reinhard Resch <r_resch@a1.net>
parents:
31706
diff
changeset
|
241 if (octave_signal_caught.compare_exchange_strong (expected, false)) |
5f0b8101234e
Remove several race conditions with signal handler (bug #61370).
Reinhard Resch <r_resch@a1.net>
parents:
31706
diff
changeset
|
242 octave_handle_signal (); |
29571
76deb8194590
* quit.h: Remove stray ; after function definition.
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
243 } |
10142
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
244 |
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
245 #define OCTAVE_QUIT octave_quit () |
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
246 |
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
247 #else |
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
248 |
31846
5f0b8101234e
Remove several race conditions with signal handler (bug #61370).
Reinhard Resch <r_resch@a1.net>
parents:
31706
diff
changeset
|
249 extern OCTAVE_API void octave_quit_c (void); |
5f0b8101234e
Remove several race conditions with signal handler (bug #61370).
Reinhard Resch <r_resch@a1.net>
parents:
31706
diff
changeset
|
250 #define OCTAVE_QUIT octave_quit_c () |
5f0b8101234e
Remove several race conditions with signal handler (bug #61370).
Reinhard Resch <r_resch@a1.net>
parents:
31706
diff
changeset
|
251 |
10142
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
9933
diff
changeset
|
252 #endif |
4153 | 253 |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
254 /* The following macros are obsolete. Interrupting immediately by |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
255 calling siglongjmp or similar from a signal handler is asking for |
27480
63b417917f5e
remove some obsolete signal handling functions
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
256 trouble. Rather than remove them, however, please leave them in |
63b417917f5e
remove some obsolete signal handling functions
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
257 place so that old code that uses them will continue to compile. They |
63b417917f5e
remove some obsolete signal handling functions
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
258 are defined to create a dummy do-while block to match the previous |
63b417917f5e
remove some obsolete signal handling functions
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
259 definitions. */ |
4302 | 260 |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
261 #define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE \ |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
262 do \ |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
263 { |
4302 | 264 |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
265 #define END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE \ |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
266 } \ |
4153 | 267 while (0) |
268 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
269 #if defined (__cplusplus) |
4196 | 270 |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
271 /* Likewise, these are obsolete. They are defined to create a |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
272 dummy scope to match the previous versions that created a try-catch |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
273 block. */ |
4180 | 274 |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
275 #define BEGIN_INTERRUPT_WITH_EXCEPTIONS \ |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
276 { |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
277 |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
278 #define END_INTERRUPT_WITH_EXCEPTIONS \ |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
279 } |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
280 |
4196 | 281 #endif |
4153 | 282 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
283 #if defined (__cplusplus) |
4153 | 284 } |
4560 | 285 |
4572 | 286 /* These should only be declared for C++ code, and should also be |
287 outside of any extern "C" block. */ | |
4560 | 288 |
32832
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
289 extern OCTAVE_API void (*octave_signal_hook) (); |
f3c1a77bcc6b
maint: Replace (void) in function declarations with () where possible
Arun Giridhar <arungiridhar@gmail.com>
parents:
32632
diff
changeset
|
290 extern OCTAVE_API void (*octave_interrupt_hook) (); |
4560 | 291 |
29954
4c88a452519c
rename OCTAVE_USE_DEPRECATED_FUNCTIONS macro and attempt to make it work
John W. Eaton <jwe@octave.org>
parents:
29571
diff
changeset
|
292 #endif |
27520
7a871724d4b0
restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents:
27480
diff
changeset
|
293 |
4153 | 294 #endif |