~ubuntu-branches/debian/jessie/libccd/jessie

« back to all changes in this revision

Viewing changes to src/dbg.h

  • Committer: Package Import Robot
  • Author(s): Jose Luis Rivero
  • Date: 2014-03-24 16:51:48 UTC
  • Revision ID: package-import@ubuntu.com-20140324165148-mfno979f58rv322z
Tags: upstream-2.0
ImportĀ upstreamĀ versionĀ 2.0

Show diffs side-by-side

added added

removed removed

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