2007-03-13 08:26:18 +00:00
|
|
|
/*
|
2007-03-13 08:26:25 +00:00
|
|
|
* $Id: debug.h,v 1.5 2006/01/30 23:07:57 mclark Exp $
|
2007-03-13 08:26:18 +00:00
|
|
|
*
|
2007-03-13 08:26:23 +00:00
|
|
|
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
2007-03-13 08:26:18 +00:00
|
|
|
* Michael Clark <michael@metaparadigm.com>
|
2012-04-12 11:40:44 -07:00
|
|
|
* Copyright (c) 2009 Hewlett-Packard Development Company, L.P.
|
2007-03-13 08:26:18 +00:00
|
|
|
*
|
2007-03-13 08:26:23 +00:00
|
|
|
* This library is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the MIT license. See COPYING for details.
|
2007-03-13 08:26:18 +00:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2017-12-06 00:20:59 -05:00
|
|
|
/**
|
|
|
|
|
* @file
|
|
|
|
|
* @brief Do not use, json-c internal, may be changed or removed at any time.
|
|
|
|
|
*/
|
2007-03-13 08:26:18 +00:00
|
|
|
#ifndef _DEBUG_H_
|
|
|
|
|
#define _DEBUG_H_
|
|
|
|
|
|
2012-04-12 11:40:44 -07:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
2009-02-25 02:31:32 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-11-23 20:31:14 -05:00
|
|
|
#ifndef JSON_EXPORT
|
2020-03-28 10:25:00 +08:00
|
|
|
#if defined(_MSC_VER)
|
2019-11-23 20:31:14 -05:00
|
|
|
#define JSON_EXPORT __declspec(dllexport)
|
|
|
|
|
#else
|
|
|
|
|
#define JSON_EXPORT extern
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
JSON_EXPORT void mc_set_debug(int debug);
|
|
|
|
|
JSON_EXPORT int mc_get_debug(void);
|
2007-03-13 08:26:18 +00:00
|
|
|
|
2019-11-23 20:31:14 -05:00
|
|
|
JSON_EXPORT void mc_set_syslog(int syslog);
|
2013-06-29 15:31:18 -05:00
|
|
|
|
2019-11-23 20:31:14 -05:00
|
|
|
JSON_EXPORT void mc_debug(const char *msg, ...);
|
|
|
|
|
JSON_EXPORT void mc_error(const char *msg, ...);
|
|
|
|
|
JSON_EXPORT void mc_info(const char *msg, ...);
|
2007-03-13 08:26:18 +00:00
|
|
|
|
2012-04-12 11:40:44 -07:00
|
|
|
#ifndef __STRING
|
|
|
|
|
#define __STRING(x) #x
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef PARSER_BROKEN_FIXED
|
|
|
|
|
|
2020-03-28 10:25:00 +08:00
|
|
|
#define JASSERT(cond) \
|
|
|
|
|
do \
|
|
|
|
|
{ \
|
|
|
|
|
} while (0)
|
2012-04-12 11:40:44 -07:00
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
2020-03-28 10:25:00 +08:00
|
|
|
#define JASSERT(cond) \
|
|
|
|
|
do \
|
|
|
|
|
{ \
|
|
|
|
|
if (!(cond)) \
|
|
|
|
|
{ \
|
|
|
|
|
mc_error("cjson assert failure %s:%d : cond \"" __STRING(cond) "failed\n", \
|
|
|
|
|
__FILE__, __LINE__); \
|
|
|
|
|
*(int *)0 = 1; \
|
|
|
|
|
abort(); \
|
|
|
|
|
} \
|
|
|
|
|
} while (0)
|
2012-04-12 11:40:44 -07:00
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define MC_ERROR(x, ...) mc_error(x, ##__VA_ARGS__)
|
|
|
|
|
|
2007-10-25 02:26:00 +00:00
|
|
|
#ifdef MC_MAINTAINER_MODE
|
|
|
|
|
#define MC_SET_DEBUG(x) mc_set_debug(x)
|
|
|
|
|
#define MC_GET_DEBUG() mc_get_debug()
|
|
|
|
|
#define MC_SET_SYSLOG(x) mc_set_syslog(x)
|
|
|
|
|
#define MC_DEBUG(x, ...) mc_debug(x, ##__VA_ARGS__)
|
|
|
|
|
#define MC_INFO(x, ...) mc_info(x, ##__VA_ARGS__)
|
|
|
|
|
#else
|
2020-03-28 10:25:00 +08:00
|
|
|
#define MC_SET_DEBUG(x) \
|
|
|
|
|
if (0) \
|
|
|
|
|
mc_set_debug(x)
|
2007-10-25 02:26:00 +00:00
|
|
|
#define MC_GET_DEBUG() (0)
|
2020-03-28 10:25:00 +08:00
|
|
|
#define MC_SET_SYSLOG(x) \
|
|
|
|
|
if (0) \
|
|
|
|
|
mc_set_syslog(x)
|
|
|
|
|
#define MC_DEBUG(x, ...) \
|
|
|
|
|
if (0) \
|
|
|
|
|
mc_debug(x, ##__VA_ARGS__)
|
|
|
|
|
#define MC_INFO(x, ...) \
|
|
|
|
|
if (0) \
|
|
|
|
|
mc_info(x, ##__VA_ARGS__)
|
2007-10-25 02:26:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
2009-02-25 02:31:32 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-03-13 08:26:18 +00:00
|
|
|
#endif
|