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