/* * Gnome Set game - debug.h * Copyright 2007 Kirill Gorelov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef DEBUG_H #define DEBUG_H #define DEBUG #define LOG(fmt, args...) printf(fmt , ##args) /* Various debug flags */ #define CFG_DEBUG 0x00000001 #define UI_DEBUG 0x00000002 #define BGRND_DEBUG 0x00000004 #define CARDS_DEBUG 0x00000008 #define GAME_DEBUG 0x00000010 #define EVENT_DBG 0x00000020 #define IMG_DEBUG 0x00000040 #define RENDER_DEBUG 0x00000080 #define INFODEBUG 0x80000000 #define FULLDEBUG 0xffffffff /* All debug messages on */ #define DEBUGLEV 0x00000000 //#define DEBUGLEV (FULLDEBUG) //#define DEBUGLEV UI_DEBUG /* #define DEBUGLEV (CFG_DEBUG | CARDS_DEBUG | UI_DEBUG | \ GAME_DEBUG | EVENT_DBG | INFODEBUG) */ #if defined(DEBUG) #define RED printf("\033[031m") #define GREEN printf("\033[032") #define DEFCL printf("\033[0;39m") #define DBG(lev, fmt, args...) {if (DEBUGLEV & lev) printf("%s::"fmt , __func__, ##args);} #else #define RED #define GREEN #define DEFCL #define DBG(lev, fmt, args...) {} #endif /* Colorful debug macros */ #define REDDBG(lev, fmt, args...) RED; DBG(lev, fmt , ##args); DEFCL; #define GREENDBG(lev, fmt, args...) GREEN; DBG(lev, fmt , ##args); DEFCL; #define INFO(fmt, args...) DBG(INFODEBUG, fmt , ##args) #endif