Mercurial > octave
annotate libinterp/corefcn/sighandlers.h @ 23615:be7b884ac589
use version number in OCTAVE_DEPRECATED macro
* mk-octave-config-h.sh, oct-conf-post.in.h (OCTAVE_DEPRECATED):
New argument, VER, to record and display version number in which the
object was marked as deprecated. Change all uses.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 16 Jun 2017 09:19:20 -0400 |
parents | 092078913d54 |
children | c5c11b07598a |
rev | line source |
---|---|
1 | 1 /* |
2 | |
23219
3ac9f9ecfae5
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
23083
diff
changeset
|
3 Copyright (C) 1993-2017 John W. Eaton |
1 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
9 the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
10 (at your option) any later version. |
1 | 11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
15 GNU General Public License for more details. |
1 | 16 |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
1 | 20 |
21 */ | |
22 | |
2939 | 23 /* |
24 | |
25 The signal blocking macros defined below were adapted from similar | |
26 functions from GNU Bash, the Bourne Again SHell, copyright (C) 1994 | |
27 Free Software Foundation, Inc. | |
28 | |
29 */ | |
30 | |
834 | 31 // This file should always be included after config.h! |
32 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
33 #if ! defined (octave_sighandlers_h) |
383 | 34 #define octave_sighandlers_h 1 |
1 | 35 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21186
diff
changeset
|
36 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21186
diff
changeset
|
37 |
22049
ccf50f029999
move octave_child_list to separate file and define inside namespace
John W. Eaton <jwe@octave.org>
parents:
21988
diff
changeset
|
38 #include "child-list.h" |
3566 | 39 |
22051
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
40 namespace octave |
2705 | 41 { |
22051
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
42 // This type must match the typedef in signal-wrappers.h. |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
43 typedef void sig_handler (int); |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
44 |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
45 struct |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
46 interrupt_handler |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
47 { |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
48 sig_handler *int_handler; |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
49 sig_handler *brk_handler; |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
50 }; |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
51 |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
52 // Nonzero means we have already printed a message for this series of |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
53 // SIGPIPES. We assume that the writer will eventually give up. |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
54 extern int pipe_handler_error_count; |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
55 |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
56 // TRUE means we can be interrupted. |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
57 extern OCTINTERP_API bool can_interrupt; |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
58 |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
59 extern OCTINTERP_API sig_handler * |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
60 set_signal_handler (int sig, sig_handler *h, |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
61 bool restart_syscalls = true); |
2554 | 62 |
22051
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
63 extern OCTINTERP_API sig_handler * |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
64 set_signal_handler (const char *signame, sig_handler *h, |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
65 bool restart_syscalls = true); |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
66 |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
67 extern OCTINTERP_API void install_signal_handlers (void); |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
68 |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
69 extern OCTINTERP_API void signal_handler (void); |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
70 |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
71 extern OCTINTERP_API interrupt_handler catch_interrupts (void); |
1 | 72 |
22051
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
73 extern OCTINTERP_API interrupt_handler ignore_interrupts (void); |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
74 |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
75 extern OCTINTERP_API interrupt_handler |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
76 set_interrupt_handler (const volatile interrupt_handler& h, |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
77 bool restart_syscalls = true); |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
78 |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
79 // TRUE means we should try to enter the debugger on SIGINT. |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
80 extern OCTINTERP_API bool Vdebug_on_interrupt; |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
81 } |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
82 |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
83 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS) |
1 | 84 |
23615
be7b884ac589
use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
85 OCTAVE_DEPRECATED (4.2, "use 'octave::interrupt_handler' instead") |
22051
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
86 typedef octave::interrupt_handler octave_interrupt_handler; |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
87 |
23615
be7b884ac589
use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
88 OCTAVE_DEPRECATED (4.2, "use 'octave::sig_handler' instead") |
22051
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
89 typedef octave::sig_handler octave_sig_handler; |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
90 |
23615
be7b884ac589
use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
91 OCTAVE_DEPRECATED (4.2, "use 'octave::pipe_handler_error_count' instead") |
22051
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
92 static auto& pipe_handler_error_count = octave::pipe_handler_error_count; |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
93 |
23615
be7b884ac589
use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
94 OCTAVE_DEPRECATED (4.2, "use 'octave::can_interrupt' instead") |
22051
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
95 static auto& can_interrupt = octave::can_interrupt; |
1443 | 96 |
23615
be7b884ac589
use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
97 OCTAVE_DEPRECATED (4.2, "use 'octave::set_signal_handler' instead") |
22051
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
98 inline octave::sig_handler * |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
99 octave_set_signal_handler (int sig, octave::sig_handler *handler, |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
100 bool restart_syscalls = true) |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
101 { |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
102 return octave::set_signal_handler (sig, handler, restart_syscalls); |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
103 } |
5142 | 104 |
23615
be7b884ac589
use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
105 OCTAVE_DEPRECATED (4.2, "use 'octave::set_signal_handler' instead") |
22051
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
106 inline octave::sig_handler * |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
107 octave_set_signal_handler (const char *signame, octave::sig_handler *handler, |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
108 bool restart_syscalls = true) |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
109 { |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
110 return octave::set_signal_handler (signame, handler, restart_syscalls); |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
111 } |
2554 | 112 |
23615
be7b884ac589
use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
113 OCTAVE_DEPRECATED (4.2, "use 'octave::set_signal_handler' instead") |
22051
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
114 const auto install_signal_handlers = octave::install_signal_handlers; |
2554 | 115 |
23615
be7b884ac589
use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
116 OCTAVE_DEPRECATED (4.2, "use 'octave::signal_handler' instead") |
22051
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
117 const auto octave_signal_handler = octave::signal_handler; |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
118 |
23615
be7b884ac589
use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
119 OCTAVE_DEPRECATED (4.2, "use 'octave::interrupt_handler' instead") |
22051
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
120 const auto octave_catch_interrupts = octave::catch_interrupts; |
1651 | 121 |
23615
be7b884ac589
use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
122 OCTAVE_DEPRECATED (4.2, "use 'octave::ignore_interrupts' instead") |
22051
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
123 const auto octave_ignore_interrupts = octave::ignore_interrupts; |
2214 | 124 |
23615
be7b884ac589
use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
125 OCTAVE_DEPRECATED (4.2, "use 'octave::set_interrupt_handler' instead") |
22051
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
126 const auto octave_set_interrupt_handler = octave::set_interrupt_handler; |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
127 |
23615
be7b884ac589
use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
128 OCTAVE_DEPRECATED (4.2, "use 'octave::Vdebug_on_interrupt' instead") |
22051
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
129 static auto& Vdebug_on_interrupt = octave::Vdebug_on_interrupt; |
15595
6e780fb15c14
Make Vdebug_on_interrupt not be static
Max Brister <max@2bass.com>
parents:
15195
diff
changeset
|
130 |
1 | 131 #endif |
22051
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
132 |
6db928d06b07
move signal functions into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22049
diff
changeset
|
133 #endif |