1 | /* C K U S I G . H */ |
---|
2 | |
---|
3 | /* Definitions and prototypes for signal handling */ |
---|
4 | |
---|
5 | /* |
---|
6 | Author: Jeffrey Altman (jaltman@columbia.edu), |
---|
7 | Columbia University Academic Information Systems, New York City. |
---|
8 | |
---|
9 | Copyright (C) 1985, 2002, |
---|
10 | Trustees of Columbia University in the City of New York. |
---|
11 | All rights reserved. See the C-Kermit COPYING.TXT file or the |
---|
12 | copyright text in the ckcmai.c module for disclaimer and permissions. |
---|
13 | */ |
---|
14 | |
---|
15 | #ifdef CK_ANSIC |
---|
16 | typedef void (*ck_sigfunc)(void *); |
---|
17 | typedef void (*ck_sighand)(int); |
---|
18 | #else |
---|
19 | typedef VOID (*ck_sigfunc)(); |
---|
20 | typedef VOID (*ck_sighand)(); |
---|
21 | #endif /* CK_ANSIC */ |
---|
22 | |
---|
23 | /* Macros for POSIX vs old-style signal handling. */ |
---|
24 | |
---|
25 | #ifdef CK_POSIX_SIG |
---|
26 | typedef sigjmp_buf ckjmpbuf; |
---|
27 | #else |
---|
28 | typedef jmp_buf ckjmpbuf; |
---|
29 | #endif /* CK_POSIX_SIG */ |
---|
30 | /* |
---|
31 | Suppose you want to pass the address of a jmp_buf bar to a function foo. |
---|
32 | Since jmp_buf is normally defined (typedef'd) as an array, you would do |
---|
33 | it like this: foo(bar), where foo = foo(jmp_buf bar). But suppose a |
---|
34 | jmp_buf is (say) a struct rather than an array. Then you must do |
---|
35 | foo(&bar) where foo is foo(jmp_buf * bar). This is controlled here in |
---|
36 | the traditional fashion, by ifdefs. By default, we assume that jmp_buf |
---|
37 | is an array. Define the symbol JBNOTARRAY if jmp_buf is not an array. |
---|
38 | */ |
---|
39 | #ifndef JBNOTARRAY |
---|
40 | #ifdef NT |
---|
41 | #define JBNOTARRAY |
---|
42 | #endif /* NT */ |
---|
43 | #endif /* JBNOTARRAY */ |
---|
44 | |
---|
45 | #ifdef JBNOTARRAY |
---|
46 | typedef ckjmpbuf * ckjptr; |
---|
47 | #define ckjaddr(x) & x |
---|
48 | #define ckjdref(x) * x |
---|
49 | #ifdef CK_POSIX_SIG |
---|
50 | #define cksetjmp(x) sigsetjmp(x,1) |
---|
51 | #else |
---|
52 | #define cksetjmp(x) setjmp(x,1) |
---|
53 | #endif /* CK_POSIX_SIG */ |
---|
54 | #else /* jmp_buf is an array */ |
---|
55 | typedef ckjmpbuf ckjptr; |
---|
56 | #define ckjaddr(x) x |
---|
57 | #define ckjdref(x) x |
---|
58 | #ifdef CK_POSIX_SIG |
---|
59 | #define cksetjmp sigsetjmp |
---|
60 | #else |
---|
61 | #define cksetjmp setjmp |
---|
62 | #endif /* CK_POSIX_SIG */ |
---|
63 | #endif /* JBNOTARRAY */ |
---|
64 | |
---|
65 | _PROTOTYP( int cc_execute, (ckjptr, ck_sigfunc, ck_sigfunc) ); |
---|
66 | _PROTOTYP( int alrm_execute, |
---|
67 | (ckjptr, |
---|
68 | int timo, |
---|
69 | ck_sighand handler, |
---|
70 | ck_sigfunc, ck_sigfunc) ); |
---|
71 | _PROTOTYP( int cc_alrm_execute, |
---|
72 | (ckjptr, |
---|
73 | int timo, |
---|
74 | ck_sighand handler, |
---|
75 | ck_sigfunc, |
---|
76 | ck_sigfunc) ); |
---|
77 | |
---|
78 | /* End of ckusig.h */ |
---|
79 | |
---|