1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/***
* libccd
* ---------------------------------
* Copyright (c)2010 Daniel Fiser <danfis@danfis.cz>
*
*
* This file is part of libccd.
*
* Distributed under the OSI-approved BSD License (the "License");
* see accompanying file BDS-LICENSE for details or see
* <http://www.opensource.org/licenses/bsd-license.php>.
*
* This software is distributed WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the License for more information.
*/
#ifndef __CCD_DBG_H__
#define __CCD_DBG_H__
/**
* Some macros which can be used for printing debug info to stderr if macro
* NDEBUG not defined.
*
* DBG_PROLOGUE can be specified as string and this string will be
* prepended to output text
*/
#ifndef NDEBUG
#include <stdio.h>
#ifndef DBG_PROLOGUE
# define DBG_PROLOGUE
#endif
# define DBG(format, ...) do { \
fprintf(stderr, DBG_PROLOGUE "%s :: " format "\n", __func__, ## __VA_ARGS__); \
fflush(stderr); \
} while (0)
# define DBG2(str) do { \
fprintf(stderr, DBG_PROLOGUE "%s :: " str "\n", __func__); \
fflush(stderr); \
} while (0)
# define DBG_VEC3(vec, prefix) do {\
fprintf(stderr, DBG_PROLOGUE "%s :: %s[%lf %lf %lf]\n", \
__func__, prefix, ccdVec3X(vec), ccdVec3Y(vec), ccdVec3Z(vec)); \
fflush(stderr); \
} while (0)
/*
# define DBG_VEC3(vec, prefix) do {\
fprintf(stderr, DBG_PROLOGUE "%s :: %s[%.20lf %.20lf %.20lf]\n", \
__func__, prefix, ccdVec3X(vec), ccdVec3Y(vec), ccdVec3Z(vec)); \
fflush(stderr); \
} while (0)
*/
#else
# define DBG(format, ...)
# define DBG2(str)
# define DBG_VEC3(v, prefix)
#endif
#endif /* __CCD_DBG_H__ */
|