]>
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 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 #ifndef ASSERT_VERIFY_H
24 #define ASSERT_VERIFY_H
26 /******************************************************************************
27 Written by: Jeffrey Richter
28 Notices: Copyright (c) 1995-1997 Jeffrey Richter
29 Purpose: Common header file containing handy macros and definitions used
30 throughout all the applications in the book.
31 ******************************************************************************/
33 /* These header functions were copied from the cmnhdr.h file that accompanies
34 Advanced Windows 3rd Edition by Jeffrey Richter */
36 //////////////////////////// Assert/Verify Macros /////////////////////////////
38 #if defined(macintosh) || defined(__APPLE__)
41 #define chASSERTFAIL(file,line,expr)
43 #define chFAIL(szMSG) { \
44 MessageBox(GetActiveWindow(), szMSG, \
45 __TEXT("Assertion Failed"), MB_OK | MB_ICONERROR); \
49 /* Put up an assertion failure message box. */
50 #define chASSERTFAIL(file,line,expr) { \
52 wsprintf(sz, __TEXT("File %hs, line %d : %hs"), file, line, expr); \
56 #endif /* macintosh */
58 /* Put up a message box if an assertion fails in a debug build. */
60 #define chASSERT(x) if (!(x)) chASSERTFAIL(__FILE__, __LINE__, #x)
65 /* Assert in debug builds, but don't remove the code in retail builds. */
67 #define chVERIFY(x) chASSERT(x)
69 #define chVERIFY(x) (x)
72 #endif /* ASSERT_VERIFY_H */