diff options
author | deva <deva> | 2010-07-05 09:01:54 +0000 |
---|---|---|
committer | deva <deva> | 2010-07-05 09:01:54 +0000 |
commit | fbba835d7efaa4ee1d28bf5c7e2232e53d84af5e (patch) | |
tree | 5b71566f174143fea11e21e0c034bd6a1026c03d /server/src/debug.h | |
parent | 71318f4e56dd1467b071404c61f686745cf3dfc4 (diff) |
Remove PRACRO_ prefix from debug macros.
Diffstat (limited to 'server/src/debug.h')
-rw-r--r-- | server/src/debug.h | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/server/src/debug.h b/server/src/debug.h index 17dad10..a5f199d 100644 --- a/server/src/debug.h +++ b/server/src/debug.h @@ -16,19 +16,20 @@ * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * Pracro is distributed in the hope that it will be useful, + * Pentominos 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 Pracro; if not, write to the Free Software + * along with Pentominos; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifndef __PRACRO_DEBUG_H__ -#define __PRACRO_DEBUG_H__ +#ifndef __PENTOMINOS_DEBUG_H__ +#define __PENTOMINOS_DEBUG_H__ #include <stdarg.h> +#include <stdio.h> #ifdef HAVE_CONFIG_H // For USE_EFENCE @@ -51,83 +52,82 @@ #endif/*USE_EFENCE*/ #endif/*HAVE_CONFIG*/ -void pracro_debug_init(void); -void pracro_debug_parse(const char *fmt); +void debug_init(FILE *fp); +void debug_parse(const char *fmt); -enum __pracro_debug_class +enum __debug_class { - __pracro_class_fixme, - __pracro_class_info, - __pracro_class_warn, - __pracro_class_err, - __pracro_class_debug + __class_fixme = 0, + __class_err = 1, + __class_warn = 2, + __class_info = 3, + __class_debug = 4 }; -#ifndef __GNUC__ -#error "Need gcc for special debug macro expansions. Please define for other compilers." -#endif - #ifdef WITH_DEBUG -int __pracro_debug(const char *func, const int line, enum __pracro_debug_class cl, const char *ch, const char *fmt, ...) __attribute__((format (printf,5,6))); -int __pracro_debug_va(const char *func, const int line, enum __pracro_debug_class cl, const char *ch, const char *fmt, va_list va); - -/* gcc preprocessor magic ahead */ -#define __PRACRO_DEBUG_PRINT(cl, ch, fmt...) \ - do { __pracro_debug(__func__, __LINE__, cl, ch, fmt); } while(0) -#define __PRACRO_DEBUG_PRINT_VA(cl, ch, fmt, a) \ - do { __pracro_debug_va(__func__, __LINE__, cl, ch, fmt, a); } while(0) -#define __PRACRO_DEBUG(cl, ch, fmt...) __PRACRO_DEBUG_PRINT(__pracro_class##cl, #ch, fmt) -#define __PRACRO_DEBUG_VA(cl, ch, fmt, a) __PRACRO_DEBUG_PRINT_VA(__pracro_class##cl, #ch, fmt, a) - -#define PRACRO_FIXME(ch, fmt...) __PRACRO_DEBUG(_fixme, ch, fmt) -#define PRACRO_INFO(ch, fmt...) __PRACRO_DEBUG(_info, ch, fmt) -#define PRACRO_WARN(ch, fmt...) __PRACRO_DEBUG(_warn, ch, fmt) -#define PRACRO_ERR(ch, fmt...) __PRACRO_DEBUG(_err, ch, fmt) -#define PRACRO_DEBUG(ch, fmt...) __PRACRO_DEBUG(_debug, ch, fmt) -#define PRACRO_FIXME_VA(ch, fmt, a) __PRACRO_DEBUG_VA(_fixme, ch, fmt, a) -#define PRACRO_INFO_VA(ch, fmt, a) __PRACRO_DEBUG_VA(_info, ch, fmt, a) -#define PRACRO_WARN_VA(ch, fmt, a) __PRACRO_DEBUG_VA(_warn, ch, fmt, a) -#define PRACRO_ERR_VA(ch, fmt, a) __PRACRO_DEBUG_VA(_err, ch, fmt, a) -#define PRACRO_DEBUG_VA(ch, fmt, a) __PRACRO_DEBUG_VA(_debug, ch, fmt, a) - -#define PRACRO_INFO_LOG(ch, fmt...) PRACRO_INFO(ch, fmt) -#define PRACRO_WARN_LOG(ch, fmt...) PRACRO_WARN(ch, fmt) -#define PRACRO_ERR_LOG(ch, fmt...) PRACRO_ERR(ch, fmt) -#define PRACRO_INFO_LOG_VA(ch, fmt, a) PRACRO_INFO_VA(ch, fmt, a) -#define PRACRO_WARN_LOG_VA(ch, fmt, a) PRACRO_WARN_VA(ch, fmt, a) -#define PRACRO_ERR_LOG_VA(ch, fmt, a) PRACRO_ERR_VA(ch, fmt, a) +int __debug(const char *func, const int line, enum __debug_class cl, + const char *ch, const char *fmt, ...) + __attribute__((format (printf,5,6))); + +int __debug_va(const char *func, const int line, enum __debug_class cl, + const char *ch, const char *fmt, va_list va); + +#define __DEBUG_PRINT(cl, ch, fmt...) \ + do { __debug(__func__, __LINE__, cl, ch, fmt); } while(0) +#define __DEBUG_PRINT_VA(cl, ch, fmt, a) \ + do { __debug_va(__func__, __LINE__, cl, ch, fmt, a); } while(0) +#define __DEBUG(cl, ch, fmt...) \ + __DEBUG_PRINT(__class##cl, #ch, fmt) +#define __DEBUG_VA(cl, ch, fmt, a) \ + __DEBUG_PRINT_VA(__class##cl, #ch, fmt, a) + +#define FIXME(ch, fmt...) __DEBUG(_fixme, ch, fmt) +#define ERR(ch, fmt...) __DEBUG(_err, ch, fmt) +#define WARN(ch, fmt...) __DEBUG(_warn, ch, fmt) +#define INFO(ch, fmt...) __DEBUG(_info, ch, fmt) +#define DEBUG(ch, fmt...) __DEBUG(_debug, ch, fmt) + +#define FIXME_VA(ch, fmt, a) __DEBUG_VA(_fixme, ch, fmt, a) +#define ERR_VA(ch, fmt, a) __DEBUG_VA(_err, ch, fmt, a) +#define WARN_VA(ch, fmt, a) __DEBUG_VA(_warn, ch, fmt, a) +#define INFO_VA(ch, fmt, a) __DEBUG_VA(_info, ch, fmt, a) +#define DEBUG_VA(ch, fmt, a) __DEBUG_VA(_debug, ch, fmt, a) #else -/* If we compile without debug support, we want them all to go away */ -#define PRACRO_FIXME(ch, fmt...) -#define PRACRO_INFO(ch, fmt...) -#define PRACRO_WARN(ch, fmt...) -#define PRACRO_ERR(ch, fmt...) -#define PRACRO_DEBUG(ch, fmt...) -#define PRACRO_FIXME_VA(ch, fmt...) -#define PRACRO_INFO_VA(ch, fmt...) -#define PRACRO_WARN_VA(ch, fmt...) -#define PRACRO_ERR_VA(ch, fmt...) -#define PRACRO_DEBUG_VA(ch, fmt...) - -int __pracro_log(const char *func, const int line, enum __pracro_debug_class cl, const char *ch, const char *fmt, ...) __attribute__((format (printf,5,6))); -int __pracro_log_va(const char *func, const int line, enum __pracro_debug_class cl, const char *ch, const char *fmt, va_list va); - -#define __PRACRO_LOG_PRINT(cl, ch, fmt...) \ - do { __pracro_log(__func__, __LINE__, cl, ch, fmt); } while(0) -#define __PRACRO_LOG_PRINT_VA(cl, ch, fmt, a) \ - do { __pracro_log_va(__func__, __LINE__, cl, ch, fmt, a); } while(0) -#define __PRACRO_LOG(cl, ch, fmt...) __PRACRO_LOG_PRINT(__pracro_class##cl, #ch, fmt) -#define __PRACRO_LOG_VA(cl, ch, fmt, a) __PRACRO_LOG_PRINT_VA(__pracro_class##cl, #ch, fmt, a) - -#define PRACRO_INFO_LOG(ch, fmt...) __PRACRO_LOG(_info, ch, fmt) -#define PRACRO_WARN_LOG(ch, fmt...) __PRACRO_LOG(_warn, ch, fmt) -#define PRACRO_ERR_LOG(ch, fmt...) __PRACRO_LOG(_err, ch, fmt) -#define PRACRO_INFO_LOG_VA(ch, fmt, a) __PRACRO_LOG_VA(_info, ch, fmt, a) -#define PRACRO_WARN_LOG_VA(ch, fmt, a) __PRACRO_LOG_VA(_warn, ch, fmt, a) -#define PRACRO_ERR_LOG_VA(ch, fmt, a) __PRACRO_LOG_VA(_err, ch, fmt, a) +// If we compile without debug support, we want them all to go away +#define FIXME(ch, fmt...) +#define INFO(ch, fmt...) +#define WARN(ch, fmt...) +#define ERR(ch, fmt...) +#define DEBUG(ch, fmt...) +#define FIXME_VA(ch, fmt...) +#define INFO_VA(ch, fmt...) +#define WARN_VA(ch, fmt...) +#define ERR_VA(ch, fmt...) +#define DEBUG_VA(ch, fmt...) #endif/*WITH_DEBUG*/ -#endif/*__PRACRO_DEBUG_H__*/ +int __log(const char *func, const int line, + enum __debug_class cl, const char *ch, const char *fmt, ...) + __attribute__((format (printf,5,6))); + +int __log_va(const char *func, const int line, enum __debug_class cl, + const char *ch, const char *fmt, va_list va); + +#define __LOG_PRINT(cl, ch, fmt...) \ + do { __log(__func__, __LINE__, cl, ch, fmt); } while(0) +#define __LOG_PRINT_VA(cl, ch, fmt, a) \ + do { __log_va(__func__, __LINE__, cl, ch, fmt, a); } while(0) +#define __LOG(cl, ch, fmt...) __LOG_PRINT(__class##cl, #ch, fmt) +#define __LOG_VA(cl, ch, fmt, a) __LOG_PRINT_VA(__class##cl, #ch, fmt, a) + +#define INFO_LOG(ch, fmt...) __LOG(_info, ch, fmt) +#define WARN_LOG(ch, fmt...) __LOG(_warn, ch, fmt) +#define ERR_LOG(ch, fmt...) __LOG(_err, ch, fmt) +#define INFO_LOG_VA(ch, fmt, a) __LOG_VA(_info, ch, fmt, a) +#define WARN_LOG_VA(ch, fmt, a) __LOG_VA(_warn, ch, fmt, a) +#define ERR_LOG_VA(ch, fmt, a) __LOG_VA(_err, ch, fmt, a) + +#endif/*__PENTOMINOS_DEBUG_H__*/ |