summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorgraehl@gmail.com <graehl@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-15 08:50:14 +0000
committergraehl@gmail.com <graehl@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-15 08:50:14 +0000
commitc7f1a4e30a42ad0c03ac6c439e04e6aa7efafefe (patch)
treeb98b35e5c5a0fb3039a307efb9f5b91911824b20 /utils
parent6d3cf2f3aeaa5d008f5031f70da8d728181486bc (diff)
files required for test
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@556 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'utils')
-rwxr-xr-xutils/show.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/utils/show.h b/utils/show.h
new file mode 100755
index 00000000..e8adff99
--- /dev/null
+++ b/utils/show.h
@@ -0,0 +1,41 @@
+#ifndef UTILS__SHOW_H
+#define UTILS__SHOW_H
+
+#ifndef SHOWS
+#include <iostream>
+#endif
+/* usage:
+#if DEBUG
+# define IFD(x) x
+#else
+# define IFD(x)
+#endif
+
+SHOWS(IFD,x) SHOWS(IFD,y) SHOW(IFD,nl_after)
+
+will print x=X y=Y nl_after=NL_AFTER\n if DEBUG.
+
+SHOW3(IFD,x,y,nl_after) is short for the same
+
+SHOWP("a") will just print "a"
+
+careful: none of this is wrapped in a block. so you can't use one of these macros as a single-line block.
+
+ */
+
+#ifndef SHOWS
+#define SHOWS std::cerr
+#endif
+
+#define SHOWP(IF,x) IF(SHOWS<<x;)
+#define SHOWNL(IF) SHOWP("\n")
+#define SHOWC(IF,x,s) SHOWP(IF,#x<<"="<<x<<s)
+#define SHOW(IF,x) SHOWC(IF,x,"\n")
+#define SHOW1(IF,x) SHOWC(IF,x," ")
+#define SHOW2(IF,x,y) SHOW1(IF,x) SHOW(IF,y)
+#define SHOW3(IF,x,y0,y1) SHOW1(IF,x) SHOW2(IF,y0,y1)
+#define SHOW4(IF,x,y0,y1,y2) SHOW1(IF,x) SHOW3(IF,y0,y1,y2)
+#define SHOW5(IF,x,y0,y1,y2,y3) SHOW1(IF,x) SHOW4(IF,y0,y1,y2,y3)
+#define SHOW6(IF,x,y0,y1,y2,y3,y4) SHOW1(IF,x) SHOW5(IF,y0,y1,y2,y3,y4)
+
+#endif