2 /* : : generated by proto : : */
3 /***********************************************************************
5 * This software is part of the ast package *
6 * Copyright (c) 1985-2010 AT&T Intellectual Property *
7 * and is licensed under the *
8 * Common Public License, Version 1.0 *
9 * by AT&T Intellectual Property *
11 * A copy of the License is available at *
12 * http://www.opensource.org/licenses/cpl1.0.txt *
13 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
15 * Information and Software Systems Research *
19 * Glenn Fowler <gsf@research.att.com> *
20 * David Korn <dgk@research.att.com> *
21 * Phong Vo <kpv@research.att.com> *
23 ***********************************************************************/
26 * common ast debug definitions
27 * include after the ast headers
31 #if !defined(__PROTO__)
32 #include <prototyped.h>
34 #if !defined(__LINKAGE__)
35 #define __LINKAGE__ /* 2004-08-11 transition */
43 #if !defined(DEBUG) && _BLD_DEBUG
44 #define DEBUG _BLD_DEBUG
47 #if DEBUG || _BLD_DEBUG
50 #define message(x) do if (error_info.trace < 0) { error x; } while (0)
51 #define messagef(x) do if (error_info.trace < 0) { errorf x; } while (0)
53 #define DEBUG_BEGTIME() debug_elapsed(1)
54 #define DEBUG_GETTIME() debug_elapsed(0)
55 #define DEBUG_ASSERT(p) ((p) ? 0 : (debug_fatal(__FILE__, __LINE__),0))
56 #define DEBUG_COUNT(n) ((n) += 1)
57 #define DEBUG_TALLY(c,n,v) ((c) ? ((n) += (v)) : (n))
58 #define DEBUG_INCREASE(n) ((n) += 1)
59 #define DEBUG_DECREASE(n) ((n) -= 1)
60 #define DEBUG_DECLARE(t,v) t v
61 #define DEBUG_SET(n,v) ((n) = (v))
62 #define DEBUG_PRINT(fd,s,v) do {char _b[1024];write(fd,_b,sfsprintf(_b,sizeof(_b),s,v));} while(0)
63 #define DEBUG_WRITE(fd,d,n) write((fd),(d),(n))
64 #define DEBUG_TEMP(temp) (temp) /* debugging stuff that should be removed */
65 #define DEBUG_BREAK break
66 #define DEBUG_CONTINUE continue
67 #define DEBUG_GOTO(label) do { debug_fatal(__FILE__, __LINE__); goto label; } while(0)
68 #define DEBUG_RETURN(x) do { debug_fatal(__FILE__, __LINE__); return(x); } while(0)
76 #define DEBUG_BEGTIME()
77 #define DEBUG_GETTIME()
78 #define DEBUG_ASSERT(p)
79 #define DEBUG_COUNT(n)
80 #define DEBUG_TALLY(c,n,v)
81 #define DEBUG_INCREASE(n)
82 #define DEBUG_DECREASE(n)
83 #define DEBUG_DECLARE(t,v)
84 #define DEBUG_SET(n,v)
85 #define DEBUG_PRINT(fd,s,v)
86 #define DEBUG_WRITE(fd,d,n)
88 #define DEBUG_BREAK break
89 #define DEBUG_CONTINUE continue
90 #define DEBUG_GOTO(label) goto label
91 #define DEBUG_RETURN(x) return(x)
96 #define BREAK DEBUG_BREAK
99 #define CONTINUE DEBUG_CONTINUE
102 #define GOTO(label) DEBUG_GOTO(label)
105 #define RETURN(x) DEBUG_RETURN(x)
108 #if _BLD_ast && defined(__EXPORT__)
110 #define __MANGLE__ __LINKAGE__ __EXPORT__
113 extern __MANGLE__
double debug_elapsed
__PROTO__((int));
114 extern __MANGLE__
void debug_fatal
__PROTO__((const char*, int));
115 extern __MANGLE__
void systrace
__PROTO__((const char*));
118 #define __MANGLE__ __LINKAGE__