xref: /freebsd/contrib/sendmail/include/sm/xtrap.h (revision f0adf7f5cdd241db2f2c817683191a6ef64a4e95)
1 /*
2  * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
3  *	All rights reserved.
4  *
5  * By using this file, you agree to the terms and conditions set
6  * forth in the LICENSE file which can be found at the top level of
7  * the sendmail distribution.
8  *
9  *	$Id: xtrap.h,v 1.7 2001/04/03 01:53:01 gshapiro Exp $
10  */
11 
12 /*
13 **  scaffolding for testing exception handler code
14 */
15 
16 #ifndef SM_XTRAP_H
17 # define SM_XTRAP_H
18 
19 # include <sm/debug.h>
20 # include <sm/exc.h>
21 
22 extern SM_ATOMIC_UINT_T SmXtrapCount;
23 extern SM_DEBUG_T SmXtrapDebug;
24 extern SM_DEBUG_T SmXtrapReport;
25 
26 # if SM_DEBUG_CHECK
27 #  define sm_xtrap_check() (++SmXtrapCount == sm_debug_level(&SmXtrapDebug))
28 # else /* SM_DEBUG_CHECK */
29 #  define sm_xtrap_check() (0)
30 # endif /* SM_DEBUG_CHECK */
31 
32 # define sm_xtrap_raise_x(exc) \
33 		if (sm_xtrap_check()) \
34 		{ \
35 			sm_exc_raise_x(exc); \
36 		} else
37 
38 #endif /* ! SM_XTRAP_H */
39