blob: 8f5088c93251701d0aa17869b8f0da1f63df7cb9 (
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
|
/*********************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1991 **/
/** **/
/** Exceptions package for C for DOS/WIN/OS2 **/
/** **/
/*********************************************************/
#ifndef __RPCx86_H__
#define __RPCx86_H__
typedef struct _ExceptionBuff {
int registers[RPCXCWORD];
struct _ExceptionBuff __RPC_FAR *pExceptNext;
} ExceptionBuff, __RPC_FAR *pExceptionBuff;
int RPC_ENTRY RpcSetException(pExceptionBuff);
void RPC_ENTRY RpcLeaveException(void);
#define RpcTryExcept \
{ \
int _exception_code; \
ExceptionBuff exception; \
\
_exception_code = RpcSetException(&exception); \
\
if (!_exception_code) \
{
// trystmts
#define RpcExcept(expr) \
RpcLeaveException(); \
} \
else \
{ \
if (!(expr)) \
RpcRaiseException(_exception_code);
// exceptstmts
#define RpcEndExcept \
} \
}
#define RpcTryFinally \
{ \
int _abnormal_termination; \
ExceptionBuff exception; \
\
_abnormal_termination = RpcSetException(&exception); \
\
if (!_abnormal_termination) \
{
// trystmts
#define RpcFinally \
RpcLeaveException(); \
}
// finallystmts
#define RpcEndFinally \
if (_abnormal_termination) \
RpcRaiseException(_abnormal_termination); \
}
#define RpcExceptionCode() _exception_code
#define RpcAbnormalTermination() _abnormal_termination
#endif // __RPCx86_H__
|