2 * $Id: debug.h,v 1.5 2006/01/30 23:07:57 mclark Exp $
4 * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
5 * Michael Clark <michael@metaparadigm.com>
6 * Copyright (c) 2009 Hewlett-Packard Development Company, L.P.
8 * This library is free software; you can redistribute it and/or modify
9 * it under the terms of the MIT license. See COPYING for details.
22 extern void mc_set_debug(int debug);
23 extern int mc_get_debug(void);
25 extern void mc_set_syslog(int syslog);
26 extern void mc_abort(const char *msg, ...);
27 extern void mc_debug(const char *msg, ...);
28 extern void mc_error(const char *msg, ...);
29 extern void mc_info(const char *msg, ...);
32 #define __STRING(x) #x
35 #ifndef PARSER_BROKEN_FIXED
37 #define JASSERT(cond) do {} while(0)
41 #define JASSERT(cond) do { \
43 mc_error("cjson assert failure %s:%d : cond \"" __STRING(cond) "failed\n", __FILE__, __LINE__); \
51 #define MC_ABORT(x, ...) mc_abort(x, ##__VA_ARGS__)
52 #define MC_ERROR(x, ...) mc_error(x, ##__VA_ARGS__)
54 #ifdef MC_MAINTAINER_MODE
55 #define MC_SET_DEBUG(x) mc_set_debug(x)
56 #define MC_GET_DEBUG() mc_get_debug()
57 #define MC_SET_SYSLOG(x) mc_set_syslog(x)
58 #define MC_DEBUG(x, ...) mc_debug(x, ##__VA_ARGS__)
59 #define MC_INFO(x, ...) mc_info(x, ##__VA_ARGS__)
61 #define MC_SET_DEBUG(x) if (0) mc_set_debug(x)
62 #define MC_GET_DEBUG() (0)
63 #define MC_SET_SYSLOG(x) if (0) mc_set_syslog(x)
64 #define MC_DEBUG(x, ...) if (0) mc_debug(x, ##__VA_ARGS__)
65 #define MC_INFO(x, ...) if (0) mc_info(x, ##__VA_ARGS__)