Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

debug.cpp

Go to the documentation of this file.
00001 /*
00002  * This file is part of Jelie,
00003  * (c) 2002 Julien Pilet <julien.pilet@epfl.ch> and
00004  * Stephane Magnenat <stephane.magnenat@epfl.ch>
00005  *
00006  * Jelie is free software; you can redistribute it
00007  * and/or modify it under the terms of the GNU General Public License as
00008  * published by the Free Software Foundation; either version 2 of the License,
00009  * or (at your option) any later version.
00010  *
00011  * Jelie is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with Foobar; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00029 #include <stdio.h>
00030 #include <stdarg.h>
00031 #include <stdlib.h>
00032 #include "debug.h"
00033 
00034 #ifdef HAVE_CONFIG_H
00035 #include "config.h"
00036 #endif
00037 
00038 int debugLevel=0;
00039 
00040 void setDebugLevel(DebugLevel level) {
00041         debugLevel = level;
00042 }
00043 
00044 void addDebugLevel(DebugLevel l) {
00045         debugLevel |= l;
00046 }
00047 
00048 void removeDebugLevel(DebugLevel l) {
00049         debugLevel &= ~l;
00050 }
00051 
00052 void debugMessage(DebugLevel level, const char *szMessage, ...) {
00053         va_list arglist;
00054 
00055         if ((level & debugLevel) == 0) 
00056                 return;
00057         va_start(arglist, szMessage);
00058 #ifdef HAVE_VPRINTF
00059         vprintf( szMessage, arglist);
00060 #else
00061         printf("(vprintf not available) %s", szMessage);
00062 #endif
00063         va_end(arglist);
00064 
00065         //fprintf(stderr, " %s", str);
00066         //MessageBox(SYSW_GetHwnd(), str, "Warning", MB_ICONEXCLAMATION);
00067 }
00068 

Generated on Fri May 16 13:01:45 2003 for Jelie by doxygen1.2.15