1444c061aSmrg/***********************************************************
2444c061aSmrg
3444c061aSmrgCopyright 1987, 1988, 1994, 1998  The Open Group
4444c061aSmrg
5444c061aSmrgPermission to use, copy, modify, distribute, and sell this software and its
6444c061aSmrgdocumentation for any purpose is hereby granted without fee, provided that
7444c061aSmrgthe above copyright notice appear in all copies and that both that
8444c061aSmrgcopyright notice and this permission notice appear in supporting
9444c061aSmrgdocumentation.
10444c061aSmrg
11444c061aSmrgThe above copyright notice and this permission notice shall be included in
12444c061aSmrgall copies or substantial portions of the Software.
13444c061aSmrg
14444c061aSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15444c061aSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16444c061aSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17444c061aSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18444c061aSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19444c061aSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20444c061aSmrg
21444c061aSmrgExcept as contained in this notice, the name of The Open Group shall not be
22444c061aSmrgused in advertising or otherwise to promote the sale, use or other dealings
23444c061aSmrgin this Software without prior written authorization from The Open Group.
24444c061aSmrg
25444c061aSmrg
26444c061aSmrgCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
27444c061aSmrg
28444c061aSmrg                        All Rights Reserved
29444c061aSmrg
30444c061aSmrgPermission to use, copy, modify, and distribute this software and its
31444c061aSmrgdocumentation for any purpose and without fee is hereby granted,
32444c061aSmrgprovided that the above copyright notice appear in all copies and that
33444c061aSmrgboth that copyright notice and this permission notice appear in
34444c061aSmrgsupporting documentation, and that the name of Digital not be
35444c061aSmrgused in advertising or publicity pertaining to distribution of the
36444c061aSmrgsoftware without specific, written prior permission.
37444c061aSmrg
38444c061aSmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39444c061aSmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40444c061aSmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41444c061aSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42444c061aSmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43444c061aSmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44444c061aSmrgSOFTWARE.
45444c061aSmrg
46444c061aSmrg******************************************************************/
47444c061aSmrg
48444c061aSmrg#ifndef _XtintrinsicI_h
49444c061aSmrg#define _XtintrinsicI_h
50444c061aSmrg
51444c061aSmrg#include "Xtos.h"
52444c061aSmrg#include "IntrinsicP.h"
53444c061aSmrg#ifdef WIN32
54444c061aSmrg#define _WILLWINSOCK_
55444c061aSmrg#endif
56444c061aSmrg#include <X11/Xos.h>
57444c061aSmrg
58444c061aSmrg#include "Object.h"
59444c061aSmrg#include "RectObj.h"
60444c061aSmrg#include "ObjectP.h"
61444c061aSmrg#include "RectObjP.h"
62444c061aSmrg
63444c061aSmrg#include "ConvertI.h"
64444c061aSmrg#include "TranslateI.h"
65444c061aSmrg
66444c061aSmrg#define RectObjClassFlag	0x02
67444c061aSmrg#define WidgetClassFlag		0x04
68444c061aSmrg#define CompositeClassFlag	0x08
69444c061aSmrg#define ConstraintClassFlag	0x10
70444c061aSmrg#define ShellClassFlag		0x20
71444c061aSmrg#define WMShellClassFlag	0x40
72444c061aSmrg#define TopLevelClassFlag	0x80
73444c061aSmrg
74444c061aSmrg/*
75444c061aSmrg * The following macros, though very handy, are not suitable for
76444c061aSmrg * IntrinsicP.h as they violate the rule that arguments are to
77444c061aSmrg * be evaluated exactly once.
78444c061aSmrg */
79444c061aSmrg
80444c061aSmrg#define XtDisplayOfObject(object) \
81444c061aSmrg    (XtIsWidget(object) ? (object)->core.screen->display : \
82444c061aSmrg    _XtIsHookObject(object) ? ((HookObject)(object))->hooks.screen->display : \
83444c061aSmrg    _XtWindowedAncestor(object)->core.screen->display)
84444c061aSmrg
85444c061aSmrg#define XtScreenOfObject(object) \
86444c061aSmrg    (XtIsWidget(object) ? (object)->core.screen : \
87444c061aSmrg    _XtIsHookObject(object) ? ((HookObject)(object))->hooks.screen : \
88444c061aSmrg    _XtWindowedAncestor(object)->core.screen)
89444c061aSmrg
90444c061aSmrg#define XtWindowOfObject(object) \
91444c061aSmrg    ((XtIsWidget(object) ? (object) : _XtWindowedAncestor(object)) \
92444c061aSmrg     ->core.window)
93444c061aSmrg
94444c061aSmrg#define XtIsManaged(object) \
95444c061aSmrg    (XtIsRectObj(object) ? (object)->core.managed : False)
96444c061aSmrg
97444c061aSmrg#define XtIsSensitive(object) \
98444c061aSmrg    (XtIsRectObj(object) ? ((object)->core.sensitive && \
99444c061aSmrg			    (object)->core.ancestor_sensitive) : False)
100444c061aSmrg
101444c061aSmrg
1020568f49bSmrg/****************************************************************
1030568f49bSmrg *
1040568f49bSmrg * Bit utilities
1050568f49bSmrg *
1060568f49bSmrg ****************************************************************/
1070568f49bSmrg#define XtSetBits(dst,src,len)  dst = (((1U << (len)) - 1) & (unsigned)(src))
1080568f49bSmrg#define XtSetBit(dst,src)  XtSetBits(dst,src,1)
1090568f49bSmrg
110444c061aSmrg/****************************************************************
111444c061aSmrg *
112444c061aSmrg * Byte utilities
113444c061aSmrg *
114444c061aSmrg ****************************************************************/
115444c061aSmrg
116444c061aSmrg#define _XBCOPYFUNC _XtBcopy
117444c061aSmrg#include <X11/Xfuncs.h>
118444c061aSmrg
119444c061aSmrg#define XtMemmove(dst, src, size)	\
1200568f49bSmrg    if ((const void *)(dst) != (const void *)(src)) {		    \
1210568f49bSmrg	(void) memcpy((void *) (dst), (const void *) (src), (size_t) (size)); \
122444c061aSmrg    }
123444c061aSmrg
124444c061aSmrg#define XtBZero(dst, size) 	\
1250568f49bSmrg	memset((void *) (dst), 0, (size_t) (size))
126444c061aSmrg
127444c061aSmrg#define XtMemcmp(b1, b2, size) 		\
1280568f49bSmrg	memcmp((const void *) (b1), (const void *) (b2), (size_t) (size))
129444c061aSmrg
130444c061aSmrg
131444c061aSmrg/****************************************************************
132444c061aSmrg *
133444c061aSmrg * Stack cache allocation/free
134444c061aSmrg *
135444c061aSmrg ****************************************************************/
136444c061aSmrg
137444c061aSmrg#define XtStackAlloc(size, stack_cache_array)     \
138444c061aSmrg    ((size) <= sizeof(stack_cache_array)	  \
139444c061aSmrg    ?  (XtPointer)(stack_cache_array)		  \
1400568f49bSmrg    :  XtMalloc((Cardinal)(size)))
141444c061aSmrg
142444c061aSmrg#define XtStackFree(pointer, stack_cache_array) \
143444c061aSmrg    { if ((pointer) != ((XtPointer)(stack_cache_array))) XtFree(pointer); }
144444c061aSmrg
145444c061aSmrg/***************************************************************
146444c061aSmrg *
147444c061aSmrg * Filename defines
148444c061aSmrg *
149444c061aSmrg **************************************************************/
150444c061aSmrg
151444c061aSmrg/* used by XtResolvePathname */
152444c061aSmrg#ifndef XFILESEARCHPATHDEFAULT
153444c061aSmrg#define XFILESEARCHPATHDEFAULT "/usr/lib/X11/%L/%T/%N%S:/usr/lib/X11/%l/%T/%N%S:/usr/lib/X11/%T/%N%S"
154444c061aSmrg#endif
155444c061aSmrg
156444c061aSmrg/* the following two were both "X Toolkit " prior to R4 */
157444c061aSmrg#ifndef XTERROR_PREFIX
158444c061aSmrg#define XTERROR_PREFIX ""
159444c061aSmrg#endif
160444c061aSmrg
161444c061aSmrg#ifndef XTWARNING_PREFIX
162444c061aSmrg#define XTWARNING_PREFIX ""
163444c061aSmrg#endif
164444c061aSmrg
165444c061aSmrg#ifndef ERRORDB
166444c061aSmrg#define ERRORDB "/usr/lib/X11/XtErrorDB"
167444c061aSmrg#endif
168444c061aSmrg
1692265a131Smrg_XFUNCPROTOBEGIN
1702265a131Smrg
171444c061aSmrgextern String XtCXtToolkitError;
172444c061aSmrg
173444c061aSmrgextern void _XtAllocError(
174444c061aSmrg    String	/* alloc_type */
1750568f49bSmrg) _X_NORETURN;
176444c061aSmrg
177444c061aSmrgextern void _XtCompileResourceList(
178444c061aSmrg    XtResourceList 	/* resources */,
179444c061aSmrg    Cardinal 		/* num_resources */
180444c061aSmrg);
181444c061aSmrg
182444c061aSmrgextern XtGeometryResult _XtMakeGeometryRequest(
183444c061aSmrg    Widget 		/* widget */,
184444c061aSmrg    XtWidgetGeometry*	/* request */,
185444c061aSmrg    XtWidgetGeometry*	/* reply_return */,
186444c061aSmrg    Boolean*		/* clear_rect_obj */
187444c061aSmrg);
188444c061aSmrg
189444c061aSmrgextern Boolean _XtIsHookObject(
190444c061aSmrg    Widget      /* widget */
191444c061aSmrg);
192444c061aSmrg
193444c061aSmrgextern void _XtAddShellToHookObj(
194444c061aSmrg    Widget      /* widget */
195444c061aSmrg);
196444c061aSmrg
197444c061aSmrg/* GCManager.c */
198444c061aSmrgextern void _XtGClistFree(Display *dpy, XtPerDisplay pd);
199444c061aSmrg
200444c061aSmrg/** GeoTattler stuff */
201444c061aSmrg
202444c061aSmrg#ifdef XT_GEO_TATTLER
203444c061aSmrg
204444c061aSmrgextern void _XtGeoTab (int);
205444c061aSmrgextern void _XtGeoTrace (
206444c061aSmrg			    Widget widget,
2070568f49bSmrg			    const char *,
208444c061aSmrg			    ...
209444c061aSmrg) _X_ATTRIBUTE_PRINTF(2,3);
210444c061aSmrg
211444c061aSmrg#define CALLGEOTAT(f) f
212444c061aSmrg
213444c061aSmrg#else /* XT_GEO_TATTLER */
214444c061aSmrg
215444c061aSmrg#define CALLGEOTAT(f)
216444c061aSmrg
217444c061aSmrg#endif /* XT_GEO_TATTLER */
218444c061aSmrg
219444c061aSmrg#ifndef XTTRACEMEMORY
220444c061aSmrg
221444c061aSmrgextern char* __XtMalloc (
222444c061aSmrg    unsigned	/* size */
223444c061aSmrg);
224444c061aSmrgextern char* __XtCalloc (
225444c061aSmrg    unsigned	/* num */,
226444c061aSmrg    unsigned	/* size */
227444c061aSmrg);
228444c061aSmrg
229444c061aSmrg#else
230444c061aSmrg
231444c061aSmrg#define __XtMalloc XtMalloc
232444c061aSmrg#define __XtCalloc XtCalloc
233444c061aSmrg#endif
234444c061aSmrg
2352265a131Smrg_XFUNCPROTOEND
2362265a131Smrg
237444c061aSmrg#endif /* _XtintrinsicI_h */
238444c061aSmrg/* DON'T ADD STUFF AFTER THIS #endif */
239