~ubuntu-branches/ubuntu/jaunty/texlive-bin/jaunty

« back to all changes in this revision

Viewing changes to build/TeX/texk/xdvik/xdvi-debug.h

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Preining
  • Date: 2008-06-26 23:14:59 UTC
  • mfrom: (2.1.30 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080626231459-y02rjsrgtafu83yr
Tags: 2007.dfsg.2-3
add missing source roadmap.fig of roadmap.eps in fontinst documentation
(Closes: #482915) (urgency medium due to RC bug)
(new patch add-missing-fontinst-source)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef XDVI_DEBUG_H_
2
 
#define XDVI_DEBUG_H_
3
 
 
4
 
/*
5
 
 * Copyright (c) 2002-2004 the xdvik development team
6
 
 *
7
 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
8
 
 * of this software and associated documentation files (the "Software"), to
9
 
 * deal in the Software without restriction, including without limitation the
10
 
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
11
 
 * sell copies of the Software, and to permit persons to whom the Software is
12
 
 * furnished to do so, subject to the following conditions:
13
 
 *
14
 
 * The above copyright notice and this permission notice shall be included in
15
 
 * all copies or substantial portions of the Software.
16
 
 *
17
 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
 
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
 
 * PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM,
21
 
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
 
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
 
 * OTHER DEALINGS IN THE SOFTWARE.
24
 
 *
25
 
 */
26
 
 
27
 
/* debugging flags and macros */
28
 
 
29
 
#include "xdvi-config.h"
30
 
#include "xdvi.h"
31
 
#include "version.h"
32
 
 
33
 
#if HAVE_STRINGIZE
34
 
#ifdef NDEBUG
35
 
/* for production code, a failed ASSERT(x) just prints out a warning;
36
 
   else it aborts and dumps core.
37
 
*/
38
 
#define ASSERT(x, y) do {                                                               \
39
 
    if(!(x)) {                                                                          \
40
 
        fprintf(stderr,                                                                 \
41
 
                "************************************************************\n"        \
42
 
                "XDvi %s: Failed assertion:\n%s:%d: \"%s\": %s\n"                       \
43
 
                "Please report this as a bug to:\n"                                     \
44
 
                "http://sourceforge.net/tracker/?group_id=23164&atid=377580\n"          \
45
 
                "************************************************************\n",       \
46
 
                XDVI_VERSION_INFO, __FILE__, __LINE__, #x, y);                          \
47
 
    } } while (0)
48
 
#else /* NDEBUG */
49
 
#define ASSERT(x, y) do {                                                               \
50
 
    if(!(x)) {                                                                          \
51
 
        fprintf(stderr,                                                                 \
52
 
                "\n************************************************************\n"      \
53
 
                "XDvi %s: Failed assertion:\n%s:%d: \"%s\": %s\n"                       \
54
 
                "Aborting now. Please report this as a bug to:\n"                       \
55
 
                "http://sourceforge.net/tracker/?group_id=23164&atid=377580\n"          \
56
 
                "If a core dump has been produced, please invoke:\n"                    \
57
 
                "gdb %s core\nThen type \"bt\", "                                       \
58
 
                "and include the resulting output in your bug report.\n"                \
59
 
                "************************************************************\n",       \
60
 
                XDVI_VERSION_INFO, __FILE__, __LINE__, #x, y, globals.program_name);    \
61
 
        do_abort();                                                                     \
62
 
    } } while (0)
63
 
#endif /* NDEBUG */
64
 
#else /* HAVE_STRINGIZE */
65
 
#define ASSERT(x, y) /* as nothing */
66
 
#endif
67
 
 
68
 
/* for temporary debugging statements */
69
 
/* #define MYDEBUG 1 */
70
 
#ifdef MYDEBUG
71
 
# define MYTRACE(X)   do {                          \
72
 
    fprintf(stderr, "%s:%d: ", __FILE__, __LINE__); \
73
 
    fprintf X;                                      \
74
 
    fprintf(stderr, "\n");                          \
75
 
} while(0)
76
 
#else
77
 
# define MYTRACE(X)
78
 
#endif
79
 
 
80
 
/* NOTE: keep these in sync with the debug_string_options array in util.c! */
81
 
#define DBG_BITMAP              1
82
 
#define DBG_DVI                 2
83
 
#define DBG_PK                  4
84
 
#define DBG_BATCH               8
85
 
#define DBG_EVENT               16
86
 
#define DBG_PS                  32
87
 
/* start of kpathsea debugging options */
88
 
#define DBG_STAT                64
89
 
#define DBG_HASH                128
90
 
#define DBG_OPEN                256
91
 
#define DBG_PATHS               512
92
 
#define DBG_EXPAND              1024
93
 
#define DBG_SEARCH              2048
94
 
#define DBG_KPATHSEA            4032    /* handy abbrev */
95
 
/* end of kpathsea debugging options */
96
 
#define DBG_HTEX                4096
97
 
#define DBG_SRC_SPECIALS        8192
98
 
#define DBG_CLIENT              16384
99
 
#define DBG_T1                  32768
100
 
#define DBG_T1_VERBOSE          65536
101
 
#define DBG_GUI                 131072
102
 
#define DBG_FIND                262144
103
 
#define DBG_FILES               524288
104
 
#define DBG_ALL                 (~DBG_BATCH)
105
 
 
106
 
/* a mapping of numerical options to descriptive strings, defined in util.c */
107
 
struct debug_string_options {
108
 
    int bitmap;
109
 
    const char *description;
110
 
    const char *help_formatting;
111
 
};
112
 
 
113
 
/*
114
 
 */
115
 
 
116
 
#if 0
117
 
/* we don't want this defined for NDEBUG, since the tracing macros
118
 
   are pretty useful also for users reporting bugs etc.; so we 
119
 
   enable them always.
120
 
*/
121
 
#define TRACE_HTEX(X)
122
 
#define TRACE_SRC(X)
123
 
#define TRACE_CLIENT(X)
124
 
#define TRACE_T1(X)
125
 
#define TRACE_T1_VERBOSE(X)
126
 
#define TRACE_GUI(X)
127
 
#define TRACE_EVENTS(X)
128
 
#define TRACE_FIND(X)
129
 
#define TRACE_FILES(X)
130
 
 
131
 
#else /* 0 */
132
 
 
133
 
/*
134
 
 * Note that the argument to these macros is always ((stderr, "...")).
135
 
 * We could also have
136
 
 *    TRACE_SRC(("..."));
137
 
 * and invoke a function, but then gcc (3.1) won't be able to check
138
 
 * inconsistencies between conversion specifiers and arguments any
139
 
 * more, and that's a real killer IMHO.
140
 
 */
141
 
 
142
 
#define TRACE_HTEX(X)                                               \
143
 
    do {                                                            \
144
 
        if (globals.debug & DBG_HTEX) {                                     \
145
 
            fprintf(stderr, "%s:%d: HTEX: ", __FILE__, __LINE__);   \
146
 
            fprintf X;                                              \
147
 
            fprintf(stderr, "\n");                                  \
148
 
        }                                                           \
149
 
    } while(0)
150
 
#define TRACE_SRC(X)                                                \
151
 
    do {                                                            \
152
 
        if (globals.debug & DBG_SRC_SPECIALS) {                             \
153
 
            fprintf(stderr, "%s:%d: SRC: ", __FILE__, __LINE__);    \
154
 
            fprintf X;                                              \
155
 
            fprintf(stderr, "\n");                                  \
156
 
        }                                                           \
157
 
    } while(0)
158
 
#define TRACE_CLIENT(X)                                             \
159
 
    do {                                                            \
160
 
        if (globals.debug & DBG_CLIENT) {                                   \
161
 
            fprintf(stderr, "%s:%d: CLIENT: ", __FILE__, __LINE__); \
162
 
            fprintf X;                                              \
163
 
            fprintf(stderr, "\n");                                  \
164
 
        }                                                           \
165
 
    } while(0)
166
 
#define TRACE_T1(X)                                                 \
167
 
    do {                                                            \
168
 
        if (globals.debug & DBG_T1) {                                       \
169
 
            fprintf(stderr, "%s:%d: T1: ", __FILE__, __LINE__);     \
170
 
            fprintf X;                                              \
171
 
            fprintf(stderr, "\n");                                  \
172
 
        }                                                           \
173
 
    } while(0)
174
 
#define TRACE_T1_VERBOSE(X)                                         \
175
 
    do {                                                            \
176
 
        if (globals.debug & DBG_T1_VERBOSE) {                               \
177
 
            fprintf(stderr, "%s:%d: T1_VERBOSE: ", __FILE__, __LINE__);     \
178
 
            fprintf X;                                              \
179
 
            fprintf(stderr, "\n");                                  \
180
 
        }                                                           \
181
 
    } while(0)
182
 
#define TRACE_GUI(X)                                                \
183
 
    do {                                                            \
184
 
        if (globals.debug & DBG_GUI) {                                      \
185
 
            fprintf(stderr, "%s:%d: GUI: ", __FILE__, __LINE__);    \
186
 
            fprintf X;                                              \
187
 
            fprintf(stderr, "\n");                                  \
188
 
        }                                                           \
189
 
    } while(0)
190
 
#define TRACE_EVENTS(X)                                             \
191
 
    do {                                                            \
192
 
        if (globals.debug & DBG_EVENT) {                                    \
193
 
            fprintf(stderr, "%s:%d: EVENT: ", __FILE__, __LINE__);  \
194
 
            fprintf X;                                              \
195
 
            fprintf(stderr, "\n");                                  \
196
 
        }                                                           \
197
 
    } while(0)
198
 
#define TRACE_FIND(X)                                               \
199
 
    do {                                                            \
200
 
        if (globals.debug & DBG_FIND) {                                     \
201
 
            fprintf(stderr, "%s:%d: FIND: ", __FILE__, __LINE__);   \
202
 
            fprintf X;                                              \
203
 
            fprintf(stderr, "\n");                                  \
204
 
        }                                                           \
205
 
    } while(0)
206
 
 
207
 
#define TRACE_FILES(X)                                              \
208
 
    do {                                                            \
209
 
        if (globals.debug & DBG_FILES) {                                    \
210
 
            fprintf(stderr, "%s:%d: FILES: ", __FILE__, __LINE__);  \
211
 
            fprintf X;                                              \
212
 
            fprintf(stderr, "\n");                                  \
213
 
        }                                                           \
214
 
    } while(0)
215
 
 
216
 
#endif /* 0 */
217
 
 
218
 
#endif /* XDVI_DEBUG_H_ */