00001 /* 00002 Copyright 2008 Larry Gritz and the other authors and contributors. 00003 All Rights Reserved. 00004 00005 Redistribution and use in source and binary forms, with or without 00006 modification, are permitted provided that the following conditions are 00007 met: 00008 * Redistributions of source code must retain the above copyright 00009 notice, this list of conditions and the following disclaimer. 00010 * Redistributions in binary form must reproduce the above copyright 00011 notice, this list of conditions and the following disclaimer in the 00012 documentation and/or other materials provided with the distribution. 00013 * Neither the name of the software's owners nor the names of its 00014 contributors may be used to endorse or promote products derived from 00015 this software without specific prior written permission. 00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00017 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00018 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00019 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00020 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00021 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00022 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00023 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00024 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00025 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00026 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 00028 (This is the Modified BSD License) 00029 */ 00030 00031 00032 #ifndef OPENIMAGEIO_DASSERT_H 00033 #define OPENIMAGEIO_DASSERT_H 00034 00035 #include <cstdlib> 00036 00037 00060 00061 00064 #ifndef ABORT 00065 # define ABORT(msg) fprintf(stderr,"%s",msg), abort() 00066 #endif 00067 00068 00072 #ifndef ASSERT 00073 # define ASSERT(x) \ 00074 ((x) ? ((void)0) \ 00075 : (fprintf (stderr, "%s:%u: Failed assertion '%s'\n", \ 00076 __FILE__, __LINE__, #x), abort())) 00077 #endif 00078 00079 00083 #ifdef DEBUG 00084 # define DASSERT(x) ASSERT(x) 00085 #else 00086 # define DASSERT(x) ((void)0) /* DASSERT does nothing when not debugging */ 00087 #endif 00088 00089 00090 #endif // OPENIMAGEIO_DASSERT_H