File: [Platon] / libco / libco / co_debug.h (download)
Revision 1.2, Sun Mar 30 10:26:47 2003 UTC (21 years ago) by yenar
Changes since 1.1: +4 -2
lines
fix documentation header [co_util.h, co_debug.h]
|
/***{{{*******************************************************************
* This file is part of libco - object library for C *
* Copyright (c) 2002 *
* Peter Rockai (yenar) <yenar@host.sk> *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, *
* Boston, MA 02111-1307 USA *
*******************************************************************}}}***/
/* {{{ file description */
/**
* @file co_debug.h
* @brief Debug output macros.
**/
/* }}} */
#ifndef __CO_DEBUG_H__
#define __CO_DEBUG_H__
/* {{{ includes */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* }}} */
/* {{{ DEBUGLVL #define */
#ifndef DEBUGLVL
//#warning DEBUGLVL fallback!
/// Failsafe DEBUGLVL #define (normally #define'd by autoconf)
#define DEBUGLVL 0
#endif
/* }}} */
/* {{{ CO_DEBUG macro */
// use prescan feature to get string constant from __LINE__
#ifndef __GNUC__
/// Helper macro for CO_DEBUG. Internal.
#define __FUNCTION__ "(unknown)"
#endif
#if DEBUGLVL>0
/// Output \a args (printf-style) if \a lvl < current debuglevel
#define CO_DEBUG2(lvl,...) ((DEBUGLVL>=lvl) ? __co_debug_print2 \
(__VA_ARGS__) : 0)
#define CO_DEBUG(lvl, ...) ((DEBUGLVL>=lvl) ? __co_debug_print \
(__FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) : 0)
#else
/// Output \a args (printf-style) if \a lvl < current debuglevel
#define CO_DEBUG2(...) ((void)0)
#define CO_DEBUG(...) ((void)0)
#endif /* DEBUGLVL>0 */
/* }}} */
void __co_debug_print (const char *file, int line, const char *fnc,
const char *fmt, ...);
void __co_debug_print2 (const char *fmt, ...);
extern int __co_debug_msg_level;
#endif /* __CO_DEBUG_H__ */
Platon Group <platon@platon.org> http://platon.org/
|