190792Sgshapiro/* 290792Sgshapiro * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers. 390792Sgshapiro * All rights reserved. 490792Sgshapiro * 590792Sgshapiro * By using this file, you agree to the terms and conditions set 690792Sgshapiro * forth in the LICENSE file which can be found at the top level of 790792Sgshapiro * the sendmail distribution. 890792Sgshapiro * 998121Sgshapiro * $Id: xtrap.h,v 1.7 2001/04/03 01:53:01 gshapiro Exp $ 1090792Sgshapiro */ 1190792Sgshapiro 1290792Sgshapiro/* 1390792Sgshapiro** scaffolding for testing exception handler code 1490792Sgshapiro*/ 1590792Sgshapiro 1690792Sgshapiro#ifndef SM_XTRAP_H 1790792Sgshapiro# define SM_XTRAP_H 1890792Sgshapiro 1990792Sgshapiro# include <sm/debug.h> 2090792Sgshapiro# include <sm/exc.h> 2190792Sgshapiro 2290792Sgshapiroextern SM_ATOMIC_UINT_T SmXtrapCount; 2390792Sgshapiroextern SM_DEBUG_T SmXtrapDebug; 2490792Sgshapiroextern SM_DEBUG_T SmXtrapReport; 2590792Sgshapiro 2690792Sgshapiro# if SM_DEBUG_CHECK 2790792Sgshapiro# define sm_xtrap_check() (++SmXtrapCount == sm_debug_level(&SmXtrapDebug)) 2890792Sgshapiro# else /* SM_DEBUG_CHECK */ 2990792Sgshapiro# define sm_xtrap_check() (0) 3090792Sgshapiro# endif /* SM_DEBUG_CHECK */ 3190792Sgshapiro 3290792Sgshapiro# define sm_xtrap_raise_x(exc) \ 3390792Sgshapiro if (sm_xtrap_check()) \ 3490792Sgshapiro { \ 3590792Sgshapiro sm_exc_raise_x(exc); \ 3690792Sgshapiro } else 3790792Sgshapiro 3890792Sgshapiro#endif /* ! SM_XTRAP_H */ 39