xref: /titanic_51/usr/src/cmd/sendmail/include/sm/xtrap.h (revision 1e49577a7fcde812700ded04431b49d67cc57d6d)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
13 
14 /*
15 **  scaffolding for testing exception handler code
16 */
17 
18 #ifndef SM_XTRAP_H
19 # define SM_XTRAP_H
20 
21 # include <sm/debug.h>
22 # include <sm/exc.h>
23 
24 extern SM_ATOMIC_UINT_T SmXtrapCount;
25 extern SM_DEBUG_T SmXtrapDebug;
26 extern SM_DEBUG_T SmXtrapReport;
27 
28 # if SM_DEBUG_CHECK
29 #  define sm_xtrap_check() (++SmXtrapCount == sm_debug_level(&SmXtrapDebug))
30 # else /* SM_DEBUG_CHECK */
31 #  define sm_xtrap_check() (0)
32 # endif /* SM_DEBUG_CHECK */
33 
34 # define sm_xtrap_raise_x(exc) \
35 		if (sm_xtrap_check()) \
36 		{ \
37 			sm_exc_raise_x(exc); \
38 		} else
39 
40 #endif /* ! SM_XTRAP_H */
41