evtranalyze: share debugging declarations
authorAggelos Economopoulos <aoiko@cc.ece.ntua.gr>
Thu, 18 Feb 2010 08:40:14 +0000 (10:40 +0200)
committerAggelos Economopoulos <aoiko@cc.ece.ntua.gr>
Thu, 18 Feb 2010 09:52:35 +0000 (11:52 +0200)
usr.bin/evtranalyze/evtranalyze.c
usr.bin/evtranalyze/svg.c
usr.bin/evtranalyze/trivial.h [new file with mode: 0644]

index 85af0fd..ecfda48 100644 (file)
@@ -43,6 +43,7 @@
 #include <evtr.h>
 #include "xml.h"
 #include "svg.h"
+#include "trivial.h"
 
 enum {
        NR_TOP_THREADS = 5,
@@ -83,23 +84,7 @@ struct command {
 
 evtr_t evtr;
 char *opt_infile;
-static unsigned evtranalyze_debug;
-
-#define DEFINE_DEBUG_FLAG(nam, chr)\
-       nam = chr - 'a'
-
-enum debug_flags {
-       DEFINE_DEBUG_FLAG(INTV, 'i'),
-       DEFINE_DEBUG_FLAG(SVG, 's'),
-       DEFINE_DEBUG_FLAG(MISC, 'm'),
-};
-
-#define printd(subsys, ...)                            \
-       do {                                            \
-               if (evtranalyze_debug & (subsys)) {     \
-                       fprintf(stderr, __VA_ARGS__);   \
-               }                                       \
-       } while (0)
+unsigned evtranalyze_debug;
 
 static
 void
index e3d8bfb..5c153b2 100644 (file)
@@ -36,6 +36,7 @@
 
 #include "xml.h"
 #include "svg.h"
+#include "trivial.h"
 
 enum {
        MAX_VALSTR_LEN = 30,
diff --git a/usr.bin/evtranalyze/trivial.h b/usr.bin/evtranalyze/trivial.h
new file mode 100644 (file)
index 0000000..b1cb254
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef TRIVIAL_H
+#define TRIVIAL_H
+
+#define DEFINE_DEBUG_FLAG(nam, chr)\
+       nam = chr - 'a'
+
+enum debug_flags {
+       DEFINE_DEBUG_FLAG(INTV, 'i'),
+       DEFINE_DEBUG_FLAG(SVG, 's'),
+       DEFINE_DEBUG_FLAG(MISC, 'm'),
+};
+
+#define printd(subsys, ...)                            \
+       do {                                            \
+               if (evtranalyze_debug & (subsys)) {     \
+                       fprintf(stderr, __VA_ARGS__);   \
+               }                                       \
+       } while (0)
+
+extern unsigned evtranalyze_debug;
+
+#endif /* TRIVIAL_H */