]>
git.saurik.com Git - apple/xnu.git/blob - bsd/dev/random/YarrowCoreLib/src/assertverify.h
2 * Copyright (c) 1999, 2000-2001 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 #ifndef ASSERT_VERIFY_H
27 #define ASSERT_VERIFY_H
29 /******************************************************************************
30 Written by: Jeffrey Richter
31 Notices: Copyright (c) 1995-1997 Jeffrey Richter
32 Purpose: Common header file containing handy macros and definitions used
33 throughout all the applications in the book.
34 ******************************************************************************/
36 /* These header functions were copied from the cmnhdr.h file that accompanies
37 Advanced Windows 3rd Edition by Jeffrey Richter */
39 //////////////////////////// Assert/Verify Macros /////////////////////////////
41 #if defined(macintosh) || defined(__APPLE__)
44 #define chASSERTFAIL(file,line,expr)
46 #define chFAIL(szMSG) { \
47 MessageBox(GetActiveWindow(), szMSG, \
48 __TEXT("Assertion Failed"), MB_OK | MB_ICONERROR); \
52 /* Put up an assertion failure message box. */
53 #define chASSERTFAIL(file,line,expr) { \
55 wsprintf(sz, __TEXT("File %hs, line %d : %hs"), file, line, expr); \
59 #endif /* macintosh */
61 /* Put up a message box if an assertion fails in a debug build. */
63 #define chASSERT(x) if (!(x)) chASSERTFAIL(__FILE__, __LINE__, #x)
68 /* Assert in debug builds, but don't remove the code in retail builds. */
70 #define chVERIFY(x) chASSERT(x)
72 #define chVERIFY(x) (x)
75 #endif /* ASSERT_VERIFY_H */