File: debug.h

package info (click to toggle)
libphidgets 0.3.8-1.2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,996 kB
  • ctags: 257
  • sloc: sh: 8,803; ansic: 1,753; makefile: 276
file content (34 lines) | stat: -rw-r--r-- 1,535 bytes parent folder | download | duplicates (3)
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
#ifndef __INCLUDED_DEBUG_H__
#define __INCLUDED_DEBUG_H__

#ifndef PHIDGETS_INTERNAL
#  error "this file is only supposed to be used from within libphidgets."
#endif /* PHIDGETS_INTERNAL */

#include <phidgets/phidgets.h>

extern PhidgetDebugLevel phidgets_debug_level;
extern FILE* phidgets_debug_stream;

#define DEBUGPRINTF(t, s, a...) if (phidgets_debug_stream) { \
                                  fprintf(phidgets_debug_stream, "%s: %s(): ", t, __FUNCTION__); \
                                  fprintf(phidgets_debug_stream, s "\n", ##a); \
                                }
#define TRACE(s, a...) if (phidgets_debug_level & HID_DEBUG_TRACES) { DEBUGPRINTF("  TRACE", s, ##a) }
#define NOTICE(s, a...) if (phidgets_debug_level & HID_DEBUG_NOTICES) { DEBUGPRINTF(" NOTICE", s, ##a) }
#define WARNING(s, a...) if (phidgets_debug_level & HID_DEBUG_WARNINGS) { DEBUGPRINTF("WARNING", s, ##a) }
#define ERROR(s, a...) if (phidgets_debug_level & HID_DEBUG_ERRORS) { DEBUGPRINTF("  ERROR", s, ##a) }

#endif /* __INCLUDED_DEBUG_H__ */

/* COPYRIGHT --
 *
 * This file is part of libphidgets, a user-space library for phidgets.
 * libphidgets is (c) 2003-2005 Martin F. Krafft <krafft@ailab.ch>
 * and distributed under the terms of the Artistic Licence.
 * See the ./COPYING file in the source tree root for more information.
 *
 * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES
 * OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */