Mercurial > octave
annotate liboctave/util/quit.cc @ 31225:3eab70385569
sparse-xpow.cc: Use faster multiplication technique, this time for complex
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Sun, 11 Sep 2022 13:53:38 -0400 |
parents | 83f9f8bda883 |
children | e88a07dec498 |
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 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29572
diff
changeset
|
3 // Copyright (C) 2002-2022 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 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21202
diff
changeset
|
27 # include "config.h" |
4153 | 28 #endif |
29 | |
4154 | 30 #include <cstring> |
31 | |
27471 | 32 #include <ostream> |
33 #include <sstream> | |
4180 | 34 #include <new> |
35 | |
4153 | 36 #include "quit.h" |
37 | |
27480
63b417917f5e
remove some obsolete signal handling functions
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
38 sig_atomic_t octave_interrupt_state = 0; |
63b417917f5e
remove some obsolete signal handling functions
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
39 |
63b417917f5e
remove some obsolete signal handling functions
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
40 volatile sig_atomic_t octave_signal_caught = 0; |
63b417917f5e
remove some obsolete signal handling functions
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
41 |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23426
diff
changeset
|
42 void (*octave_signal_hook) (void) = nullptr; |
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23426
diff
changeset
|
43 void (*octave_interrupt_hook) (void) = nullptr; |
4429 | 44 |
27471 | 45 namespace octave |
46 { | |
47 std::string execution_exception::stack_trace (void) const | |
48 { | |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
49 std::size_t nframes = m_stack_info.size (); |
27471 | 50 |
51 if (nframes == 0) | |
52 return std::string (); | |
53 | |
54 std::ostringstream buf; | |
55 | |
56 buf << "error: called from\n"; | |
57 | |
58 for (const auto& frm : m_stack_info) | |
59 { | |
60 buf << " " << frm.fcn_name (); | |
61 | |
62 int line = frm.line (); | |
63 | |
64 if (line > 0) | |
65 { | |
66 buf << " at line " << line; | |
67 | |
68 int column = frm.column (); | |
69 | |
70 if (column > 0) | |
71 buf << " column " << column; | |
72 } | |
73 | |
74 buf << "\n"; | |
75 } | |
76 | |
77 return buf.str (); | |
78 } | |
79 | |
80 void execution_exception::display (std::ostream& os) const | |
81 { | |
82 if (! m_message.empty ()) | |
83 { | |
84 os << m_err_type << ": " << m_message; | |
85 | |
86 if (m_message.back () != '\n') | |
87 { | |
88 os << "\n"; | |
89 | |
90 std::string st = stack_trace (); | |
91 | |
92 if (! st.empty ()) | |
93 os << st; | |
94 } | |
95 } | |
96 } | |
97 } | |
98 | |
4153 | 99 void |
5142 | 100 octave_handle_signal (void) |
101 { | |
102 if (octave_signal_hook) | |
103 octave_signal_hook (); | |
104 | |
105 if (octave_interrupt_state > 0) | |
106 { | |
107 octave_interrupt_state = -1; | |
27480
63b417917f5e
remove some obsolete signal handling functions
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
108 |
27520
7a871724d4b0
restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents:
27480
diff
changeset
|
109 throw octave::interrupt_exception (); |
7a871724d4b0
restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents:
27480
diff
changeset
|
110 } |
7a871724d4b0
restore some exception handling functions and variables and deprecate them
John W. Eaton <jwe@octave.org>
parents:
27480
diff
changeset
|
111 } |