debug.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Copyright (C) 1999-2005 Eliot
00003  * Authors: Antoine Fraboulet <antoine.fraboulet@free.fr>
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  *****************************************************************************/
00019 
00020 #ifndef _CONST_H_
00021 #define _CONST_H_
00022 
00023 /**********
00024  * General
00025  **********/
00026 
00027 #ifdef DEBUG
00028 #   include <iostream>
00029 // Assertion macro: if the condition is not verified, print a message on stderr
00030 // and stops execution, otherwise do nothing.
00031 #   define ASSERT(cond, msg) \
00032     { \
00033         if (!(cond)) \
00034         { \
00035             cerr << "ASSERTION FAILED: " << (msg) << " (at " \
00036                  << __FILE__ << "#" << __LINE__ << ")\n"; \
00037             abort(); \
00038         } \
00039     }
00040 #else
00041 #   define ASSERT(cond, msg)
00042 #endif
00043 
00044 #ifdef DEBUG
00045 #  define debug(x...) { fprintf(stderr,x); }
00046 #else
00047 #  define debug(x...)
00048 #endif
00049 
00050 #endif
00051 
00052 /// Local Variables:
00053 /// mode: c++
00054 /// mode: hs-minor
00055 /// c-basic-offset: 4
00056 /// indent-tabs-mode: nil
00057 /// End:

Generated on Thu Dec 29 02:01:14 2005 for Eliot by  doxygen 1.4.5