IntrinsicI.h revision 2265a131
1/* $Xorg: IntrinsicI.h,v 1.4 2001/02/09 02:03:55 xorgcvs Exp $ */ 2 3/*********************************************************** 4 5Copyright 1987, 1988, 1994, 1998 The Open Group 6 7Permission to use, copy, modify, distribute, and sell this software and its 8documentation for any purpose is hereby granted without fee, provided that 9the above copyright notice appear in all copies and that both that 10copyright notice and this permission notice appear in supporting 11documentation. 12 13The above copyright notice and this permission notice shall be included in 14all copies or substantial portions of the Software. 15 16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 20AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 23Except as contained in this notice, the name of The Open Group shall not be 24used in advertising or otherwise to promote the sale, use or other dealings 25in this Software without prior written authorization from The Open Group. 26 27 28Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. 29 30 All Rights Reserved 31 32Permission to use, copy, modify, and distribute this software and its 33documentation for any purpose and without fee is hereby granted, 34provided that the above copyright notice appear in all copies and that 35both that copyright notice and this permission notice appear in 36supporting documentation, and that the name of Digital not be 37used in advertising or publicity pertaining to distribution of the 38software without specific, written prior permission. 39 40DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 41ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 42DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 43ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 44WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 45ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 46SOFTWARE. 47 48******************************************************************/ 49/* $XFree86: xc/lib/Xt/IntrinsicI.h,v 3.8 2001/12/14 19:56:25 dawes Exp $ */ 50 51#ifndef _XtintrinsicI_h 52#define _XtintrinsicI_h 53 54#include "Xtos.h" 55#include "IntrinsicP.h" 56#ifdef WIN32 57#define _WILLWINSOCK_ 58#endif 59#include <X11/Xos.h> 60 61#include "Object.h" 62#include "RectObj.h" 63#include "ObjectP.h" 64#include "RectObjP.h" 65 66#include "ConvertI.h" 67#include "TranslateI.h" 68 69#define RectObjClassFlag 0x02 70#define WidgetClassFlag 0x04 71#define CompositeClassFlag 0x08 72#define ConstraintClassFlag 0x10 73#define ShellClassFlag 0x20 74#define WMShellClassFlag 0x40 75#define TopLevelClassFlag 0x80 76 77/* 78 * The following macros, though very handy, are not suitable for 79 * IntrinsicP.h as they violate the rule that arguments are to 80 * be evaluated exactly once. 81 */ 82 83#define XtDisplayOfObject(object) \ 84 (XtIsWidget(object) ? (object)->core.screen->display : \ 85 _XtIsHookObject(object) ? ((HookObject)(object))->hooks.screen->display : \ 86 _XtWindowedAncestor(object)->core.screen->display) 87 88#define XtScreenOfObject(object) \ 89 (XtIsWidget(object) ? (object)->core.screen : \ 90 _XtIsHookObject(object) ? ((HookObject)(object))->hooks.screen : \ 91 _XtWindowedAncestor(object)->core.screen) 92 93#define XtWindowOfObject(object) \ 94 ((XtIsWidget(object) ? (object) : _XtWindowedAncestor(object)) \ 95 ->core.window) 96 97#define XtIsManaged(object) \ 98 (XtIsRectObj(object) ? (object)->core.managed : False) 99 100#define XtIsSensitive(object) \ 101 (XtIsRectObj(object) ? ((object)->core.sensitive && \ 102 (object)->core.ancestor_sensitive) : False) 103 104 105/**************************************************************** 106 * 107 * Byte utilities 108 * 109 ****************************************************************/ 110 111#define _XBCOPYFUNC _XtBcopy 112#include <X11/Xfuncs.h> 113 114/* If the alignment characteristics of your machine are right, these may be 115 faster */ 116 117#ifdef UNALIGNED 118 119#define XtMemmove(dst, src, size) \ 120 if ((char *)(dst) != (char *)(src)) { \ 121 if (size == sizeof(int)) \ 122 *((int *) (dst)) = *((int *) (src)); \ 123 else if (size == sizeof(char)) \ 124 *((char *) (dst)) = *((char *) (src)); \ 125 else if (size == sizeof(short)) \ 126 *((short *) (dst)) = *((short *) (src)); \ 127 else \ 128 (void) memcpy((char *) (dst), (char *) (src), (int) (size)); \ 129 } 130 131#define XtBZero(dst, size) \ 132 if (size == sizeof(int)) \ 133 *((int *) (dst)) = 0; \ 134 else \ 135 bzero((char *) (dst), (int) (size)) 136 137#define XtMemcmp(b1, b2, size) \ 138 (size == sizeof(int) ? \ 139 *((int *) (b1)) != *((int *) (b2)) \ 140 : memcmp((char *) (b1), (char *) (b2), (int) (size)) \ 141 ) 142 143#else 144 145#define XtMemmove(dst, src, size) \ 146 if ((char *)(dst) != (char *)(src)) { \ 147 (void) memcpy((char *) (dst), (char *) (src), (int) (size)); \ 148 } 149 150#define XtBZero(dst, size) \ 151 bzero((char *) (dst), (int) (size)) 152 153#define XtMemcmp(b1, b2, size) \ 154 memcmp((char *) (b1), (char *) (b2), (int) (size)) 155 156#endif 157 158 159/**************************************************************** 160 * 161 * Stack cache allocation/free 162 * 163 ****************************************************************/ 164 165#define XtStackAlloc(size, stack_cache_array) \ 166 ((size) <= sizeof(stack_cache_array) \ 167 ? (XtPointer)(stack_cache_array) \ 168 : XtMalloc((unsigned)(size))) 169 170#define XtStackFree(pointer, stack_cache_array) \ 171 { if ((pointer) != ((XtPointer)(stack_cache_array))) XtFree(pointer); } 172 173/*************************************************************** 174 * 175 * Filename defines 176 * 177 **************************************************************/ 178 179/* used by XtResolvePathname */ 180#ifndef XFILESEARCHPATHDEFAULT 181#define XFILESEARCHPATHDEFAULT "/usr/lib/X11/%L/%T/%N%S:/usr/lib/X11/%l/%T/%N%S:/usr/lib/X11/%T/%N%S" 182#endif 183 184/* the following two were both "X Toolkit " prior to R4 */ 185#ifndef XTERROR_PREFIX 186#define XTERROR_PREFIX "" 187#endif 188 189#ifndef XTWARNING_PREFIX 190#define XTWARNING_PREFIX "" 191#endif 192 193#ifndef ERRORDB 194#define ERRORDB "/usr/lib/X11/XtErrorDB" 195#endif 196 197_XFUNCPROTOBEGIN 198 199extern String XtCXtToolkitError; 200 201extern void _XtAllocError( 202 String /* alloc_type */ 203); 204 205extern void _XtCompileResourceList( 206 XtResourceList /* resources */, 207 Cardinal /* num_resources */ 208); 209 210extern XtGeometryResult _XtMakeGeometryRequest( 211 Widget /* widget */, 212 XtWidgetGeometry* /* request */, 213 XtWidgetGeometry* /* reply_return */, 214 Boolean* /* clear_rect_obj */ 215); 216 217extern Boolean _XtIsHookObject( 218 Widget /* widget */ 219); 220 221extern void _XtAddShellToHookObj( 222 Widget /* widget */ 223); 224 225/* GCManager.c */ 226extern void _XtGClistFree(Display *dpy, XtPerDisplay pd); 227 228/** GeoTattler stuff */ 229 230#ifdef XT_GEO_TATTLER 231 232extern void _XtGeoTab (int); 233extern void _XtGeoTrace ( 234 Widget widget, 235 ... 236) _X_ATTRIBUTE_PRINTF(2,3); 237 238#define CALLGEOTAT(f) f 239 240#else /* XT_GEO_TATTLER */ 241 242#define CALLGEOTAT(f) 243 244#endif /* XT_GEO_TATTLER */ 245 246#ifndef XTTRACEMEMORY 247 248extern char* __XtMalloc ( 249 unsigned /* size */ 250); 251extern char* __XtCalloc ( 252 unsigned /* num */, 253 unsigned /* size */ 254); 255 256#else 257 258#define __XtMalloc XtMalloc 259#define __XtCalloc XtCalloc 260#endif 261 262_XFUNCPROTOEND 263 264#endif /* _XtintrinsicI_h */ 265/* DON'T ADD STUFF AFTER THIS #endif */ 266