1#ifndef UTILS_H
2#define	UTILS_H 1
3
4  /*\
5   *
6   *                          COPYRIGHT 1990
7   *                    DIGITAL EQUIPMENT CORPORATION
8   *                       MAYNARD, MASSACHUSETTS
9   *                        ALL RIGHTS RESERVED.
10   *
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
15   * WARRANTY.
16   *
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.
20   *
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.
28  \*/
29
30/***====================================================================***/
31
32#ifdef HAVE_CONFIG_H
33#include "config.h"
34#endif
35
36#include 	<stdio.h>
37#include	<X11/Xos.h>
38#include	<X11/Xfuncproto.h>
39#include	<X11/Xfuncs.h>
40#include 	<stdarg.h>
41#include	<stddef.h>
42#if !defined(_MSC_VER)
43#include	<strings.h>
44#endif
45
46_XFUNCPROTOBEGIN
47
48#ifndef NUL
49#define	NUL	'\0'
50#endif
51
52/***====================================================================***/
53
54#ifndef OPAQUE_DEFINED
55typedef void *Opaque;
56#endif
57#ifndef NullOpaque
58#define	NullOpaque	((Opaque)NULL)
59#endif
60
61#ifndef BOOLEAN_DEFINED
62typedef char Boolean;
63#endif
64
65#ifndef True
66#define	True	((Boolean)1)
67#define	False	((Boolean)0)
68#endif                          /* ndef True */
69#define	booleanText(b)	((b)?"True":"False")
70
71#ifndef COMPARISON_DEFINED
72typedef int Comparison;
73
74#define	Greater		((Comparison)1)
75#define	Equal		((Comparison)0)
76#define	Less		((Comparison)-1)
77#define	CannotCompare	((Comparison)-37)
78#define	comparisonText(c)	((c)?((c)<0?"Less":"Greater"):"Equal")
79#endif
80
81/***====================================================================***/
82
83extern Boolean uSetErrorFile(const char *name);
84
85extern void uInformation(const char *s, ...)_X_ATTRIBUTE_PRINTF(1, 2);
86extern void uAction(const char *s, ...) _X_ATTRIBUTE_PRINTF(1, 2);
87extern void uWarning(const char *s, ...) _X_ATTRIBUTE_PRINTF(1, 2);
88extern void uError(const char *s, ...) _X_ATTRIBUTE_PRINTF(1, 2);
89extern void uInternalError(const char *s, ...) _X_ATTRIBUTE_PRINTF(1, 2);
90
91/***====================================================================***/
92
93#if defined(_MSC_VER)
94#define strcasecmp _stricmp
95#endif
96
97#define	NullString	((char *)NULL)
98
99#define	uStringText(s)		((s)==NullString?"<NullString>":(s))
100#define	uStringEqual(s1,s2)	(uStringCompare(s1,s2)==Equal)
101#define	uStringPrefix(p,s)	(strncmp(p,s,strlen(p))==0)
102#define	uStringCompare(s1,s2)	(strcmp(s1,s2))
103#define	uStrCaseEqual(s1,s2)	(uStrCaseCmp(s1,s2)==0)
104#define	uStrCaseCmp(s1,s2)	(strcasecmp(s1,s2))
105#define	uStringDup(s1)		(strdup(s1))
106
107/***====================================================================***/
108
109_XFUNCPROTOEND
110
111#endif                          /* UTILS_H */
112