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 /***====================================================================***/
34 #include <X11/Xfuncproto.h>
35 #include <X11/Xfuncs.h>
44 /***====================================================================***/
46 #ifndef BOOLEAN_DEFINED
51 #define True ((Boolean)1)
52 #define False ((Boolean)0)
53 #endif /* ndef True */
54 #define booleanText(b) ((b)?"True":"False")
56 #ifndef COMPARISON_DEFINED
57 typedef int Comparison;
59 #define Greater ((Comparison)1)
60 #define Equal ((Comparison)0)
61 #define Less ((Comparison)-1)
62 #define CannotCompare ((Comparison)-37)
63 #define comparisonText(c) ((c)?((c)<0?"Less":"Greater"):"Equal")
66 /***====================================================================***/
69 recalloc(void * old, unsigned nOld, unsigned nNew, unsigned newSize);
71 #define uTypedAlloc(t) ((t *)malloc((unsigned)sizeof(t)))
72 #define uTypedCalloc(n,t) ((t *)calloc((unsigned)n,(unsigned)sizeof(t)))
73 #define uTypedRealloc(pO,n,t) ((t *)realloc((void *)pO,((unsigned)n)*sizeof(t)))
74 #define uTypedRecalloc(pO,o,n,t) ((t *)recalloc((void *)pO,((unsigned)o),((unsigned)n),sizeof(t)))
75 #if (defined mdHasAlloca) && (mdHasAlloca)
76 #define uTmpAlloc(n) ((void *)alloca((unsigned)n))
79 #define uTmpAlloc(n) malloc(n)
80 #define uTmpFree(p) free(p)
83 /***====================================================================***/
86 uSetErrorFile(char *name);
88 #if defined(__GNUC__) && \
89 ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
90 #define __ATTR_PRINTF(i, f) __attribute__ ((format(printf, (i), (f))))
92 #define __ATTR_PRINTF(i, f)
95 #define INFO uInformation
97 extern __ATTR_PRINTF(1, 2) void
98 uInformation(const char *s, ...);
100 #define ACTION uAction
102 extern __ATTR_PRINTF(1, 2) void
103 uAction(const char *s, ...);
105 #define WARN uWarning
107 extern __ATTR_PRINTF(1, 2) void
108 uWarning(const char *s, ...);
112 extern __ATTR_PRINTF(1, 2) void
113 uError(const char *s, ...);
115 #define FATAL uFatalError
117 extern __ATTR_PRINTF(1, 2) void
118 uFatalError(const char *s, ...);
120 /* WSGO stands for "Weird Stuff Going On" (wtf???) */
121 #define WSGO uInternalError
123 extern __ATTR_PRINTF(1, 2) void
124 uInternalError(const char *s, ...);
126 /***====================================================================***/
128 #define NullString ((char *)NULL)
130 #define uStringText(s) ((s)==NullString?"<NullString>":(s))
131 #define uStringEqual(s1,s2) (uStringCompare(s1,s2)==Equal)
132 #define uStringPrefix(p,s) (strncmp(p,s,strlen(p))==0)
133 #define uStringCompare(s1,s2) (((s1)==NullString||(s2)==NullString)?\
134 (s1)!=(s2):strcmp(s1,s2))
135 #define uStrCaseEqual(s1,s2) (uStrCaseCmp(s1,s2)==0)
136 #ifdef HAVE_STRCASECMP
137 #define uStrCaseCmp(s1,s2) (strcasecmp(s1,s2))
138 #define uStrCasePrefix(p,s) (strncasecmp(p,s,strlen(p))==0)
141 uStrCaseCmp(const char *s1, const char *s2);
143 uStrCasePrefix(const char *p, char *str);
146 /***====================================================================***/
149 #define uASSERT(where,why) \
150 {if (!(why)) uFatalError("assertion botched in %s ( why )\n",where);}
152 #define uASSERT(where,why)
155 /***====================================================================***/
158 #define DEBUG_VAR debugFlags
161 extern unsigned int DEBUG_VAR;