source: trunk/classes/mm-progs/videoplayer/except_2.h

Last change on this file was 2, checked in by stevenhl, 8 years ago

Import sources from cwmm-full.zip dated 2005-03-21

File size: 3.3 KB
Line 
1
2#ifndef EXCEPT_H_INCLUDED
3#define EXCEPT_H_INCLUDED
4
5#include <setjmp.h>
6#include "excptLogName.h"
7
8typedef struct REGREC2_STRUCT {
9 PVOID pNext;
10 PFN pfnHandler;
11 jmp_buf jmpThread;
12} REGREC2, *PREGREC2;
13
14typedef struct _LOCALEXCEPTSTRUCT {
15 EXCEPTIONREGISTRATIONRECORD excptRegRecord;
16 ULONG ulExcpt;
17 APIRET arc;
18 jmp_buf jmpThread;
19} LOCALEXCEPTSTRUCT, *PLOCALEXCEPTSTRUCT;
20
21 /********************************************************************
22 * *
23 * Macros *
24 * *
25 ********************************************************************/
26
27 /* See except.c for explanations how to use these. */
28
29#define TRY_LOUD(localExceptStruct) \
30{ \
31 LOCALEXCEPTSTRUCT localExceptStruct; \
32 localExceptStruct.excptRegRecord.ExceptionHandler = (ERR)excHandler; \
33 localExceptStruct.arc = DosSetExceptionHandler( \
34 (PEXCEPTIONREGISTRATIONRECORD)&(localExceptStruct.excptRegRecord)); \
35 if (localExceptStruct.arc) \
36 DosBeep(100, 1000); \
37 localExceptStruct.ulExcpt = setjmp(localExceptStruct.jmpThread); \
38 if (localExceptStruct.ulExcpt == 0) \
39 { /* no exception occured: */
40
41 #define CATCH(localExceptStruct) \
42 DosUnsetExceptionHandler( \
43 (PEXCEPTIONREGISTRATIONRECORD)&(localExceptStruct.excptRegRecord)); \
44 } /* end if (try_ulExcpt == 0) */ \
45 else { /* exception occured: */ \
46 DosUnsetExceptionHandler( \
47 (PEXCEPTIONREGISTRATIONRECORD)&(localExceptStruct.excptRegRecord));
48 #define END_CATCH \
49 } /* end else (excptstruct.ulExcpt == 0) */ \
50 } /* end variable scope block */
51
52
53 /*
54 * CRASH:
55 * this macro is helpful for testing
56 * the exception handlers.
57 * This is not for general use. ;-)
58 */
59
60 #define CRASH {PSZ p = NULL; *p = 'a'; }
61
62 /********************************************************************
63 * *
64 * Prototypes *
65 * *
66 ********************************************************************/
67
68ULONG _System excHandler(PEXCEPTIONREPORTRECORD pERepRec,
69 PLOCALEXCEPTSTRUCT pRegRec2,
70 // PREGREC2 pRegRec2,
71 PCONTEXTRECORD pCtxRec,
72 PVOID pv);
73
74
75
76#endif
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
Note: See TracBrowser for help on using the repository browser.