1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#[cfg(any(not(objfw), feature = "unstable-exception"))]
use core::ffi::c_void;
#[cfg(apple_new)]
use std::os::raw::c_int;
#[cfg(feature = "unstable-exception")]
use std::os::raw::c_uchar;
#[cfg(apple_new)]
use crate::objc_class;
use crate::objc_object;
#[cfg(apple_new)]
pub type objc_exception_matcher =
unsafe extern "C" fn(catch_type: *mut objc_class, exception: *mut objc_object) -> c_int;
#[cfg(apple_new)]
pub type objc_exception_preprocessor =
unsafe extern "C" fn(exception: *mut objc_object) -> *mut objc_object;
#[cfg(apple_new)]
pub type objc_uncaught_exception_handler = unsafe extern "C" fn(exception: *mut objc_object);
#[cfg(objfw)]
pub type objc_uncaught_exception_handler =
Option<unsafe extern "C" fn(exception: *mut objc_object)>;
#[cfg(all(apple_new, target_os = "macos"))]
pub type objc_exception_handler =
unsafe extern "C" fn(unused: *mut objc_object, context: *mut c_void);
extern_c! {
#[cfg(any(gnustep, apple_new))]
pub fn objc_begin_catch(exc_buf: *mut c_void) -> *mut objc_object;
#[cfg(any(gnustep, apple_new))]
pub fn objc_end_catch();
pub fn objc_exception_throw(exception: *mut objc_object) -> !;
#[cfg(apple_new)]
pub fn objc_exception_rethrow() -> !;
#[cfg(apple_old)]
pub fn objc_exception_try_enter(exception_data: *const c_void);
#[cfg(apple_old)]
pub fn objc_exception_try_exit(exception_data: *const c_void);
#[cfg(gnustep)]
pub fn objc_exception_rethrow(exc_buf: *mut c_void) -> !;
#[cfg(apple_new)]
pub fn objc_setExceptionMatcher(f: objc_exception_matcher) -> objc_exception_matcher;
#[cfg(apple_new)]
pub fn objc_setExceptionPreprocessor(
f: objc_exception_preprocessor,
) -> objc_exception_preprocessor;
#[cfg(any(apple_new, objfw))]
pub fn objc_setUncaughtExceptionHandler(
f: objc_uncaught_exception_handler,
) -> objc_uncaught_exception_handler;
#[cfg(all(apple_new, target_os = "macos"))]
pub fn objc_addExceptionHandler(f: objc_exception_handler, context: *mut c_void) -> usize;
#[cfg(all(apple_new, target_os = "macos"))]
pub fn objc_removeExceptionHandler(token: usize);
#[cfg(feature = "unstable-exception")]
pub fn rust_objc_sys_0_2_try_catch_exception(
f: extern "C" fn(*mut c_void),
context: *mut c_void,
error: *mut *mut objc_object,
) -> c_uchar;
}