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