summaryrefslogtreecommitdiff
path: root/Build/source/texk/xdvik/xdvi-debug.h
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
committerKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
commit487ca4806cc046076293cf6cc5fbba0db282bac7 (patch)
tree847b412ab5158dd7bdd7ed7e5a4cc3fbca94be32 /Build/source/texk/xdvik/xdvi-debug.h
parenta3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff)
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/xdvik/xdvi-debug.h')
-rw-r--r--Build/source/texk/xdvik/xdvi-debug.h218
1 files changed, 218 insertions, 0 deletions
diff --git a/Build/source/texk/xdvik/xdvi-debug.h b/Build/source/texk/xdvik/xdvi-debug.h
new file mode 100644
index 00000000000..10eacefa87b
--- /dev/null
+++ b/Build/source/texk/xdvik/xdvi-debug.h
@@ -0,0 +1,218 @@
+#ifndef XDVI_DEBUG_H_
+#define XDVI_DEBUG_H_
+
+/*
+ * Copyright (c) 2002-2004 the xdvik development team
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+/* debugging flags and macros */
+
+#include "xdvi-config.h"
+#include "xdvi.h"
+#include "version.h"
+
+#if HAVE_STRINGIZE
+#ifdef NDEBUG
+/* for production code, a failed ASSERT(x) just prints out a warning;
+ else it aborts and dumps core.
+*/
+#define ASSERT(x, y) do { \
+ if(!(x)) { \
+ fprintf(stderr, \
+ "************************************************************\n" \
+ "XDvi %s: Failed assertion:\n%s:%d: \"%s\": %s\n" \
+ "Please report this as a bug to:\n" \
+ "http://sourceforge.net/tracker/?group_id=23164&atid=377580\n" \
+ "************************************************************\n", \
+ XDVI_VERSION_INFO, __FILE__, __LINE__, #x, y); \
+ } } while (0)
+#else /* NDEBUG */
+#define ASSERT(x, y) do { \
+ if(!(x)) { \
+ fprintf(stderr, \
+ "\n************************************************************\n" \
+ "XDvi %s: Failed assertion:\n%s:%d: \"%s\": %s\n" \
+ "Aborting now. Please report this as a bug to:\n" \
+ "http://sourceforge.net/tracker/?group_id=23164&atid=377580\n" \
+ "If a core dump has been produced, please invoke:\n" \
+ "gdb %s core\nThen type \"bt\", " \
+ "and include the resulting output in your bug report.\n" \
+ "************************************************************\n", \
+ XDVI_VERSION_INFO, __FILE__, __LINE__, #x, y, globals.program_name); \
+ do_abort(); \
+ } } while (0)
+#endif /* NDEBUG */
+#else /* HAVE_STRINGIZE */
+#define ASSERT(x, y) /* as nothing */
+#endif
+
+/* for temporary debugging statements */
+/* #define MYDEBUG 1 */
+#ifdef MYDEBUG
+# define MYTRACE(X) do { \
+ fprintf(stderr, "%s:%d: ", __FILE__, __LINE__); \
+ fprintf X; \
+ fprintf(stderr, "\n"); \
+} while(0)
+#else
+# define MYTRACE(X)
+#endif
+
+/* NOTE: keep these in sync with the debug_string_options array in util.c! */
+#define DBG_BITMAP 1
+#define DBG_DVI 2
+#define DBG_PK 4
+#define DBG_BATCH 8
+#define DBG_EVENT 16
+#define DBG_PS 32
+/* start of kpathsea debugging options */
+#define DBG_STAT 64
+#define DBG_HASH 128
+#define DBG_OPEN 256
+#define DBG_PATHS 512
+#define DBG_EXPAND 1024
+#define DBG_SEARCH 2048
+#define DBG_KPATHSEA 4032 /* handy abbrev */
+/* end of kpathsea debugging options */
+#define DBG_HTEX 4096
+#define DBG_SRC_SPECIALS 8192
+#define DBG_CLIENT 16384
+#define DBG_T1 32768
+#define DBG_T1_VERBOSE 65536
+#define DBG_GUI 131072
+#define DBG_FIND 262144
+#define DBG_FILES 524288
+#define DBG_ALL (~DBG_BATCH)
+
+/* a mapping of numerical options to descriptive strings, defined in util.c */
+struct debug_string_options {
+ int bitmap;
+ const char *description;
+ const char *help_formatting;
+};
+
+/*
+ */
+
+#if 0
+/* we don't want this defined for NDEBUG, since the tracing macros
+ are pretty useful also for users reporting bugs etc.; so we
+ enable them always.
+*/
+#define TRACE_HTEX(X)
+#define TRACE_SRC(X)
+#define TRACE_CLIENT(X)
+#define TRACE_T1(X)
+#define TRACE_T1_VERBOSE(X)
+#define TRACE_GUI(X)
+#define TRACE_EVENTS(X)
+#define TRACE_FIND(X)
+#define TRACE_FILES(X)
+
+#else /* 0 */
+
+/*
+ * Note that the argument to these macros is always ((stderr, "...")).
+ * We could also have
+ * TRACE_SRC(("..."));
+ * and invoke a function, but then gcc (3.1) won't be able to check
+ * inconsistencies between conversion specifiers and arguments any
+ * more, and that's a real killer IMHO.
+ */
+
+#define TRACE_HTEX(X) \
+ do { \
+ if (globals.debug & DBG_HTEX) { \
+ fprintf(stderr, "%s:%d: HTEX: ", __FILE__, __LINE__); \
+ fprintf X; \
+ fprintf(stderr, "\n"); \
+ } \
+ } while(0)
+#define TRACE_SRC(X) \
+ do { \
+ if (globals.debug & DBG_SRC_SPECIALS) { \
+ fprintf(stderr, "%s:%d: SRC: ", __FILE__, __LINE__); \
+ fprintf X; \
+ fprintf(stderr, "\n"); \
+ } \
+ } while(0)
+#define TRACE_CLIENT(X) \
+ do { \
+ if (globals.debug & DBG_CLIENT) { \
+ fprintf(stderr, "%s:%d: CLIENT: ", __FILE__, __LINE__); \
+ fprintf X; \
+ fprintf(stderr, "\n"); \
+ } \
+ } while(0)
+#define TRACE_T1(X) \
+ do { \
+ if (globals.debug & DBG_T1) { \
+ fprintf(stderr, "%s:%d: T1: ", __FILE__, __LINE__); \
+ fprintf X; \
+ fprintf(stderr, "\n"); \
+ } \
+ } while(0)
+#define TRACE_T1_VERBOSE(X) \
+ do { \
+ if (globals.debug & DBG_T1_VERBOSE) { \
+ fprintf(stderr, "%s:%d: T1_VERBOSE: ", __FILE__, __LINE__); \
+ fprintf X; \
+ fprintf(stderr, "\n"); \
+ } \
+ } while(0)
+#define TRACE_GUI(X) \
+ do { \
+ if (globals.debug & DBG_GUI) { \
+ fprintf(stderr, "%s:%d: GUI: ", __FILE__, __LINE__); \
+ fprintf X; \
+ fprintf(stderr, "\n"); \
+ } \
+ } while(0)
+#define TRACE_EVENTS(X) \
+ do { \
+ if (globals.debug & DBG_EVENT) { \
+ fprintf(stderr, "%s:%d: EVENT: ", __FILE__, __LINE__); \
+ fprintf X; \
+ fprintf(stderr, "\n"); \
+ } \
+ } while(0)
+#define TRACE_FIND(X) \
+ do { \
+ if (globals.debug & DBG_FIND) { \
+ fprintf(stderr, "%s:%d: FIND: ", __FILE__, __LINE__); \
+ fprintf X; \
+ fprintf(stderr, "\n"); \
+ } \
+ } while(0)
+
+#define TRACE_FILES(X) \
+ do { \
+ if (globals.debug & DBG_FILES) { \
+ fprintf(stderr, "%s:%d: FILES: ", __FILE__, __LINE__); \
+ fprintf X; \
+ fprintf(stderr, "\n"); \
+ } \
+ } while(0)
+
+#endif /* 0 */
+
+#endif /* XDVI_DEBUG_H_ */