annotate src/debug.h @ 585:4875d67823b4

Revert wrong patch rev 676.
author zas_
date Mon, 05 May 2008 09:21:01 +0000
parents b78a91d0779e
children fbebf5cf4a55
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
1 /*
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
2 * Geeqie
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
3 * Copyright (C) 2008 The Geeqie Team
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
4 *
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
5 * Authors: Vladimir Nadvornik, Laurent Monin
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
6 *
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
7 * This software is released under the GNU General Public License (GNU GPL).
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
8 * Please read the included file COPYING for more information.
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
9 * This software comes with no warranty of any kind, use at your own risk!
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
10 */
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
11
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
12 #ifndef DEBUG_H
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
13 #define DEBUG_H
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
14
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
15 #if 1 /* set to 0 to disable compilation of debugging code and related options */
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
16 # ifndef DEBUG
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
17 # define DEBUG 1
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
18 # endif
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
19 #endif
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
20
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
21 #ifdef DEBUG
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
22
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
23 #define DEBUG_LEVEL_MIN 0
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
24 #define DEBUG_LEVEL_MAX 4
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
25
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
26 gint get_debug_level(void);
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
27 void set_debug_level(gint new_level);
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
28 void debug_level_add(gint delta);
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
29 gint required_debug_level(gint level);
509
b78a91d0779e Move get_exec_time() to debug.{c,h}.
zas_
parents: 507
diff changeset
30 const gchar *get_exec_time(void);
b78a91d0779e Move get_exec_time() to debug.{c,h}.
zas_
parents: 507
diff changeset
31 void init_exec_time(void);
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
32
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
33 #define DEBUG_N(n, ...) do \
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
34 { \
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
35 gint debug_level = get_debug_level(); \
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
36 if (debug_level >= (n)) \
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
37 { \
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
38 if (debug_level != 1) printf("%s:%d: ", __FILE__, __LINE__); \
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
39 printf(__VA_ARGS__); \
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
40 putchar('\n'); \
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
41 } \
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
42 } while (0)
509
b78a91d0779e Move get_exec_time() to debug.{c,h}.
zas_
parents: 507
diff changeset
43
b78a91d0779e Move get_exec_time() to debug.{c,h}.
zas_
parents: 507
diff changeset
44 #else /* DEBUG */
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
45
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
46 #define get_debug_level() (0)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
47 #define set_debug_level(new_level) do { } while(0)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
48 #define debug_level_add(delta) do { } while(0)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
49 #define required_debug_level(level) (0)
509
b78a91d0779e Move get_exec_time() to debug.{c,h}.
zas_
parents: 507
diff changeset
50 #define get_exec_time() ""
b78a91d0779e Move get_exec_time() to debug.{c,h}.
zas_
parents: 507
diff changeset
51 #define init_exec_time() do { } while(0)
b78a91d0779e Move get_exec_time() to debug.{c,h}.
zas_
parents: 507
diff changeset
52
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
53 #define DEBUG_N(n, ...) do { } while(0)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
54
509
b78a91d0779e Move get_exec_time() to debug.{c,h}.
zas_
parents: 507
diff changeset
55 #endif /* DEBUG */
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
56
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
57 #define DEBUG_0(...) DEBUG_N(0, __VA_ARGS__)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
58 #define DEBUG_1(...) DEBUG_N(1, __VA_ARGS__)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
59 #define DEBUG_2(...) DEBUG_N(2, __VA_ARGS__)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
60 #define DEBUG_3(...) DEBUG_N(3, __VA_ARGS__)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
61 #define DEBUG_4(...) DEBUG_N(4, __VA_ARGS__)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
62
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
63
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
64 #endif /* DEBUG_H */