blob: b5d59d39bb4e7d6ec350cd7c879dbb1a25249785 (
plain) (
blame)
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
113
114
115
116
117
118
119
120
121
|
/*++
Copyright (c) 1994 Microsoft Corporation
Module Name:
RpcMac.h
Abstract:
Macintosh RPC specific exception handler macros.
Author:
Mario Goertzel [mariogo] 02-Nov-1994
--*/
#ifndef __RPCMAC_H__
#define __RPCMAC_H__
typedef struct _ExceptionBuff {
#if _MSC_VER >= 1000
jmp_buf registers;
#else
int registers[RPCXCWORD];
#endif
struct _ExceptionBuff __RPC_FAR *pExceptNext;
} ExceptionBuff, __RPC_FAR *pExceptionBuff;
void RPC_ENTRY RpcSetException(pExceptionBuff);
void RPC_ENTRY RpcLeaveException(void);
#ifdef _MPPC_
int __cdecl RpcSetJmp(jmp_buf);
#else
#define BLD_RT
#endif
#ifdef BLD_RT
#define RpcTryExcept \
{ \
int _exception_code; \
ExceptionBuff exception; \
RpcSetException(&exception); \
\
_exception_code = (setjmp(exception.registers)); \
\
if (!_exception_code) \
{
#else
#define RpcTryExcept \
{ \
int _exception_code; \
ExceptionBuff exception; \
RpcSetException(&exception); \
\
_exception_code = (RpcSetJmp(exception.registers)); \
\
if (!_exception_code) \
{
#endif
// trystmts
#define RpcExcept(expr) \
RpcLeaveException(); \
} \
else \
{ \
if (!(expr)) \
RpcRaiseException(_exception_code);
// exceptstmts
#define RpcEndExcept \
} \
}
#ifdef BLD_RT
#define RpcTryFinally \
{ \
int _abnormal_termination; \
ExceptionBuff exception; \
RpcSetException(&exception); \
\
_abnormal_termination = (setjmp(exception.registers)); \
\
if (!_abnormal_termination) \
{
#else
#define RpcTryFinally \
{ \
int _abnormal_termination; \
ExceptionBuff exception; \
RpcSetException(&exception); \
\
_abnormal_termination = (RpcSetJmp(exception.registers)); \
\
if (!_abnormal_termination) \
{
#endif
// trystmts
#define RpcFinally \
RpcLeaveException(); \
}
// finallystmts
#define RpcEndFinally \
if (_abnormal_termination) \
RpcRaiseException(_abnormal_termination); \
}
#define RpcExceptionCode() _exception_code
#define RpcAbnormalTermination() _abnormal_termination
#endif // __RPCMAC_H__
|