xsmdebug.h

Go to the documentation of this file.
00001 /* Gxsm - Gnome X Scanning Microscopy
00002  * universal STM/AFM/SARLS/SPALEED/... controlling and
00003  * data analysis software
00004  * 
00005  * Copyright (C) 1999,2000,2001,2002,2003 Percy Zahl
00006  *
00007  * Authors: Percy Zahl <zahl@users.sf.net>
00008  * additional features: Andreas Klust <klust@users.sf.net>
00009  * WWW Home: http://gxsm.sf.net
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00024  */
00025 
00026 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 8 c-style: "K&R" -*- */
00027 
00028 #ifndef __XSMDEBUG_H
00029 #define __XSMDEBUG_H
00030 
00031 #define DBG_NEVER 0   /* disable all debug output -- do not use this level in a dbg macro!! */
00032 #define DBG_EVER -1   /* print for sure! */
00033 #define DBG_L1    1   /* normal debug infos */
00034 #define DBG_L2    2   /* more verbose/detailed */
00035 #define DBG_L3    3   /* low level hardware dbg */
00036 #define DBG_L4    4   /* low low ... */
00037 #define DBG_L5    5   /* very verbose stuff */
00038 #define DBG_L6    6
00039 #define DBG_L7    7
00040 #define DBG_L8    8
00041 #define DBG_L9    9
00042 #define DBG_L99   99  
00043 
00044 /* please use only these functions for debugging outputs! */
00045 
00046 #ifdef XSM_DEBUG_OPTION
00047  extern int debug_level;
00048  extern int pi_debug_level;
00049 
00050 # define MSG_OUT std::cerr  /* normal messages -- found std::cout is not working proper from some point?!?!?*/
00051 # define ERR_OUT std::cerr  /* error messages */
00052 # define NEWLINE std::endl  /* new line/end line code, force buffer flush */
00053 
00054 /* GXSM core debugging messages */
00055  #define XSM_DEBUG(L, DBGTXT)         do { if(debug_level > L) MSG_OUT << "** (" << __FILE__ << ": " << __FUNCTION__ << ") Gxsm-DEBUG-MESSAGE **: " << NEWLINE << " - " << DBGTXT << NEWLINE; } while(0)
00056  #define XSM_DEBUG_PLAIN(L, DBGTXT)   do { if(debug_level > L) MSG_OUT << DBGTXT ; } while(0)
00057  #define XSM_DEBUG_WARNING(L, DBGTXT) do { if(debug_level > L) MSG_OUT << "** (" << __FILE__ << ": " << __FUNCTION__ << ") Gxsm-WARNING **: " << NEWLINE << " - " << DBGTXT << NEWLINE; } while(0)
00058  #define XSM_DEBUG_ERROR(L, DBGTXT)   do { if(debug_level > L) ERR_OUT << "** (" << __FILE__ << ": " << __FUNCTION__ << ") Gxsm-ERROR **:" << NEWLINE << " - " << DBGTXT << NEWLINE; } while(0)
00059 
00060 /* GXSM-PlugIn debugging messages */
00061  #define PI_DEBUG(L, DBGTXT)          do { if(pi_debug_level > L) MSG_OUT << "** (" << __FILE__ << ": " << __FUNCTION__ << ") Gxsm-PlugIn-DEBUG-MESSAGE **: " << NEWLINE << " - " << DBGTXT << NEWLINE; } while(0)
00062  #define PI_DEBUG_PLAIN(L, DBGTXT)    do { if(pi_debug_level > L) MSG_OUT << DBGTXT ; } while(0)
00063  #define PI_DEBUG_WARNING(L, DBGTXT)  do { if(pi_debug_level > L) MSG_OUT << "** (" << __FILE__ << ": " << __FUNCTION__ << ") Gxsm-PlugIn-WARNING **: " << NEWLINE << " - " << DBGTXT << NEWLINE; } while(0)
00064  #define PI_DEBUG_ERROR(L, DBGTXT)    do { if(pi_debug_level > L) ERR_OUT << "** (" << __FILE__ << ": " << __FUNCTION__ << ") Gxsm-PlugIn-ERROR **:" << NEWLINE << " - " << DBGTXT << NEWLINE; } while(0)
00065 
00066 #else
00067 
00068 /* Dummy Macros to fully disable any debugging code */
00069  #define XSM_DEBUG(L, DBGTXT) ;
00070  #define XSM_DEBUG_PLAIN(L, DBGTXT) ;
00071  #define XSM_DEBUG_WARNING(L, DBGTXT) ;
00072  #define XSM_DEBUG_ERROR(L, DBGTXT) ;
00073 
00074  #define PI_DEBUG(L, DBGTXT) ;
00075  #define PI_DEBUG_PLAIN(L, DBGTXT) ;
00076  #define PI_DEBUG_WARNING(L, DBGTXT) ;
00077  #define PI_DEBUG_ERROR(L, DBGTXT) ;
00078 
00079 #endif
00080 
00081 #endif
00082 
00083 /* END */
00084 
00085 
00086 
00087 

Generated on Sat Apr 1 09:04:08 2006 for GXSM by  doxygen 1.4.6