7 * DIGITAL EQUIPMENT CORPORATION
8 * MAYNARD, MASSACHUSETTS
11 * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
12 * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
13 * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE
14 * FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED
17 * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT
18 * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN
19 * ADDITION TO THAT SET FORTH ABOVE.
21 * Permission to use, copy, modify, and distribute this software and its
22 * documentation for any purpose and without fee is hereby granted, provided
23 * that the above copyright notice appear in all copies and that both that
24 * copyright notice and this permission notice appear in supporting
25 * documentation, and that the name of Digital Equipment Corporation not be
26 * used in advertising or publicity pertaining to distribution of the
27 * software without specific, written prior permission.
30 /***====================================================================***/
38 #include <X11/Xfuncproto.h>
39 #include <X11/Xfuncs.h>
50 /***====================================================================***/
52 #ifndef OPAQUE_DEFINED
56 #define NullOpaque ((Opaque)NULL)
59 #ifndef BOOLEAN_DEFINED
64 #define True ((Boolean)1)
65 #define False ((Boolean)0)
66 #endif /* ndef True */
67 #define booleanText(b) ((b)?"True":"False")
69 #ifndef COMPARISON_DEFINED
70 typedef int Comparison;
72 #define Greater ((Comparison)1)
73 #define Equal ((Comparison)0)
74 #define Less ((Comparison)-1)
75 #define CannotCompare ((Comparison)-37)
76 #define comparisonText(c) ((c)?((c)<0?"Less":"Greater"):"Equal")
88 /***====================================================================***/
90 extern Boolean uSetErrorFile ( const char *name );
91 extern void uInformation ( const char *s, ...) _X_ATTRIBUTE_PRINTF(1,2);
92 extern void uAction ( const char *s, ... ) _X_ATTRIBUTE_PRINTF(1,2);
93 extern void uWarning ( const char *s, ... ) _X_ATTRIBUTE_PRINTF(1,2);
94 extern void uError ( const char *s, ... ) _X_ATTRIBUTE_PRINTF(1,2);
95 extern void uInternalError ( const char *s, ... ) _X_ATTRIBUTE_PRINTF(1,2);
97 /***====================================================================***/
99 #define NullString ((char *)NULL)
101 #define uStringText(s) ((s)==NullString?"<NullString>":(s))
102 #define uStringEqual(s1,s2) (uStringCompare(s1,s2)==Equal)
103 #define uStringPrefix(p,s) (strncmp(p,s,strlen(p))==0)
104 #define uStringCompare(s1,s2) (strcmp(s1,s2))
105 #define uStrCaseEqual(s1,s2) (uStrCaseCmp(s1,s2)==0)
106 #ifdef HAVE_STRCASECMP
107 #define uStrCaseCmp(s1,s2) (strcasecmp(s1,s2))
108 #define uStrCasePrefix(p,s) (strncasecmp(p,s,strlen(p))==0)
110 extern int uStrCaseCmp(
111 const char * /* s1 */,
112 const char * /* s2 */
114 extern int uStrCasePrefix(
115 const char * /* p */,
116 const char * /* str */
119 #define uStringDup(s1) (strdup(s1))
121 /***====================================================================***/
124 #define DEBUG_VAR debugFlags
128 unsigned int DEBUG_VAR;
130 extern void uDebug( const char *s, ... ) _X_ATTRIBUTE_PRINTF(1,2);
131 extern void uDebugNOI( const char *s, ... ) /* no indent */
132 _X_ATTRIBUTE_PRINTF(1,2);
133 extern Boolean uSetDebugFile(
136 extern FILE *uDebugFile;
137 extern int uDebugIndentLevel;
138 extern int uDebugIndentSize;
139 #define uDebugIndent(l) (uDebugIndentLevel+=(l))
140 #define uDebugOutdent(l) (uDebugIndentLevel-=(l))
142 #define uDEBUG(f,s) { if (DEBUG_VAR&(f)) uDebug(s);}
143 #define uDEBUG1(f,s,a) { if (DEBUG_VAR&(f)) uDebug(s,a);}
144 #define uDEBUG2(f,s,a,b) { if (DEBUG_VAR&(f)) uDebug(s,a,b);}
145 #define uDEBUG3(f,s,a,b,c) { if (DEBUG_VAR&(f)) uDebug(s,a,b,c);}
146 #define uDEBUG4(f,s,a,b,c,d) { if (DEBUG_VAR&(f)) uDebug(s,a,b,c,d);}
147 #define uDEBUG5(f,s,a,b,c,d,e) { if (DEBUG_VAR&(f)) uDebug(s,a,b,c,d,e);}
148 #define uDEBUG_NOI(f,s) { if (DEBUG_VAR&(f)) uDebug(s);}
149 #define uDEBUG_NOI1(f,s,a) { if (DEBUG_VAR&(f)) uDebugNOI(s,a);}
150 #define uDEBUG_NOI2(f,s,a,b) { if (DEBUG_VAR&(f)) uDebugNOI(s,a,b);}
151 #define uDEBUG_NOI3(f,s,a,b,c) { if (DEBUG_VAR&(f)) uDebugNOI(s,a,b,c);}
152 #define uDEBUG_NOI4(f,s,a,b,c,d) { if (DEBUG_VAR&(f)) uDebugNOI(s,a,b,c,d);}
153 #define uDEBUG_NOI5(f,s,a,b,c,d,e) { if (DEBUG_VAR&(f)) uDebugNOI(s,a,b,c,d,e);}
156 #define uDEBUG1(f,s,a)
157 #define uDEBUG2(f,s,a,b)
158 #define uDEBUG3(f,s,a,b,c)
159 #define uDEBUG4(f,s,a,b,c,d)
160 #define uDEBUG5(f,s,a,b,c,d,e)
161 #define uDEBUG_NOI(f,s)
162 #define uDEBUG_NOI1(f,s,a)
163 #define uDEBUG_NOI2(f,s,a,b)
164 #define uDEBUG_NOI3(f,s,a,b,c)
165 #define uDEBUG_NOI4(f,s,a,b,c,d)
166 #define uDEBUG_NOI5(f,s,a,b,c,d,e)
169 extern Boolean uSetEntryFile(
172 extern void uEntry(int l, const char *s, ... ) _X_ATTRIBUTE_PRINTF(2,3);
174 int l, const char *rtVal
176 #ifdef ENTRY_TRACKING_ON
177 #define ENTRY_BIT 0x10
178 #define LOW_ENTRY_BIT 0x1000
179 #define ENTER (DEBUG_VAR&ENTRY_BIT)
180 #define FLAG(fLag) (DEBUG_VAR&(fLag))
182 extern int uEntryLevel;
184 #define uENTRY(s) { if (ENTER) uEntry(1,s);}
185 #define uENTRY1(s,a) { if (ENTER) uEntry(1,s,a);}
186 #define uENTRY2(s,a,b) { if (ENTER) uEntry(1,s,a,b);}
187 #define uENTRY3(s,a,b,c) { if (ENTER) uEntry(1,s,a,b,c);}
188 #define uENTRY4(s,a,b,c,d) { if (ENTER) uEntry(1,s,a,b,c,d);}
189 #define uENTRY5(s,a,b,c,d,e) { if (ENTER) uEntry(1,s,a,b,c,d,e);}
190 #define uENTRY6(s,a,b,c,d,e,f) { if (ENTER) uEntry(1,s,a,b,c,d,e,f);}
191 #define uENTRY7(s,a,b,c,d,e,f,g) { if (ENTER) uEntry(1,s,a,b,c,d,e,f,g);}
192 #define uRETURN(v) { if (ENTER) uEntryLevel--; return(v); }
193 #define uVOIDRETURN { if (ENTER) uEntryLevel--; return; }
195 #define uFLAG_ENTRY(w,s) { if (FLAG(w)) uEntry(0,s);}
196 #define uFLAG_ENTRY1(w,s,a) { if (FLAG(w)) uEntry(0,s,a);}
197 #define uFLAG_ENTRY2(w,s,a,b) { if (FLAG(w)) uEntry(0,s,a,b);}
198 #define uFLAG_ENTRY3(w,s,a,b,c) { if (FLAG(w)) uEntry(0,s,a,b,c);}
199 #define uFLAG_ENTRY4(w,s,a,b,c,d) { if (FLAG(w)) uEntry(0,s,a,b,c,d);}
200 #define uFLAG_ENTRY5(w,s,a,b,c,d,e) { if (FLAG(w)) uEntry(0,s,a,b,c,d,e);}
201 #define uFLAG_ENTRY6(w,s,a,b,c,d,e,f) { if (FLAG(w)) uEntry(0,s,a,b,c,d,e,f);}
202 #define uFLAG_ENTRY7(w,s,a,b,c,d,e,f,g) { if(FLAG(w))uEntry(0,s,a,b,c,d,e,f,g);}
203 #define uFLAG_RETURN(v) { return(v);}
204 #define uFLAG_VOIDRETURN { return; }
208 #define uENTRY2(s,a1,a2)
209 #define uENTRY3(s,a1,a2,a3)
210 #define uENTRY4(s,a1,a2,a3,a4)
211 #define uENTRY5(s,a1,a2,a3,a4,a5)
212 #define uENTRY6(s,a1,a2,a3,a4,a5,a6)
213 #define uENTRY7(s,a1,a2,a3,a4,a5,a6,a7)
214 #define uRETURN(v) { return(v); }
215 #define uVOIDRETURN { return; }
217 #define uFLAG_ENTRY(f,s)
218 #define uFLAG_ENTRY1(f,s,a)
219 #define uFLAG_ENTRY2(f,s,a,b)
220 #define uFLAG_ENTRY3(f,s,a,b,c)
221 #define uFLAG_ENTRY4(f,s,a,b,c,d)
222 #define uFLAG_ENTRY5(f,s,a,b,c,d,e)
223 #define uFLAG_ENTRY6(f,s,a,b,c,d,e,g)
224 #define uFLAG_ENTRY7(f,s,a,b,c,d,e,g,h)
225 #define uFLAG_RETURN(v) { return(v);}
226 #define uFLAG_VOIDRETURN { return; }