Back to index

extremetuxracer  0.5beta
debug.h
Go to the documentation of this file.
00001 /* 
00002  * PPRacer 
00003  * Copyright (C) 2004-2005 Volker Stroebel <volker@planetpenguin.de>
00004  *
00005  * Copyright (C) 1999-2001 Jasmin F. Patry
00006  * 
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  * 
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020  */
00021 
00022 #ifndef _DEBUG_H_
00023 #define _DEBUG_H_
00024 
00025 #include "etracer.h"
00026 
00027 typedef enum {
00028     DEBUG_ODE,
00029     DEBUG_QUADTREE,
00030     DEBUG_CONTROL,
00031     DEBUG_SOUND,
00032     DEBUG_TEXTURE,
00033     DEBUG_VIEW,
00034     DEBUG_GL_EXT,
00035     DEBUG_FONT,
00036     DEBUG_UI,
00037     DEBUG_GAME_LOGIC,
00038     DEBUG_SAVE,
00039     DEBUG_JOYSTICK,
00040     DEBUG_GL_INFO,
00041     NUM_DEBUG_MODES
00042 } debug_mode_t;
00043 
00044 void init_debug();
00045 bool debug_mode_is_active( debug_mode_t mode );
00046 void debug_mode_set_active( debug_mode_t mode, bool active );
00047 void print_debug( debug_mode_t mode, char *fmt, ... );
00048 void setup_diagnostic_log();
00049 
00050 /* Define assertion macros (these do nothing if TUXRACER_NO_ASSERT
00051    is defined) */
00052 #ifdef TUXRACER_NO_ASSERT
00053 
00054 #define check_assertion( condition, desc )  /* noop */
00055 
00056 #else
00057 
00058 #define check_assertion( condition, desc ) \
00059     if ( condition ) {} else { \
00060         fprintf( stderr, "!!! " PROG_NAME " unexpected error [%s:%d]: %s\n", \
00061                __FILE__, __LINE__, desc ); \
00062         abort(); \
00063     }
00064 
00065 
00066 #endif /* TUXRACER_NO_ASSERT */
00067 
00068 #define code_not_reached() \
00069     check_assertion( 0, "supposedly unreachable code reached!" )
00070 
00071 #endif /* _DEBUG_H_ */