home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / lib / Xt / IntrinsicI.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-27  |  5.4 KB  |  193 lines

  1. /* $XConsortium: IntrinsicI.h,v 1.48 91/06/27 13:24:18 converse Exp $ */
  2.  
  3. /***********************************************************
  4. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
  5. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  6.  
  7.                         All Rights Reserved
  8.  
  9. Permission to use, copy, modify, and distribute this software and its 
  10. documentation for any purpose and without fee is hereby granted, 
  11. provided that the above copyright notice appear in all copies and that
  12. both that copyright notice and this permission notice appear in 
  13. supporting documentation, and that the names of Digital or MIT not be
  14. used in advertising or publicity pertaining to distribution of the
  15. software without specific, written prior permission.  
  16.  
  17. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  18. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  19. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  20. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  22. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  23. SOFTWARE.
  24.  
  25. ******************************************************************/
  26.  
  27. #ifndef _XtintrinsicI_h
  28. #define _XtintrinsicI_h
  29.  
  30. #include "Xtos.h"
  31. #include "IntrinsicP.h"
  32. #include <X11/Xos.h>
  33.  
  34. #include "Object.h"
  35. #include "RectObj.h"
  36. #include "ObjectP.h"
  37. #include "RectObjP.h"
  38.  
  39. #include "TranslateI.h"
  40. #include "CallbackI.h"
  41. #include "ConvertI.h"
  42. #include "EventI.h"
  43. #include "PassivGraI.h"
  44. #include "InitialI.h"
  45. #include "ResourceI.h"
  46.  
  47. #define RectObjClassFlag    0x02
  48. #define WidgetClassFlag        0x04
  49. #define CompositeClassFlag    0x08
  50. #define ConstraintClassFlag    0x10
  51. #define ShellClassFlag        0x20
  52. #define WMShellClassFlag    0x40
  53. #define TopLevelClassFlag    0x80
  54.  
  55. /*
  56.  * The following macros, though very handy, are not suitable for
  57.  * IntrinsicP.h as they violate the rule that arguments are to
  58.  * be evaluated exactly once.
  59.  */
  60.  
  61. #define XtDisplayOfObject(object) \
  62.     ((XtIsWidget(object) ? (object) : _XtWindowedAncestor(object)) \
  63.      ->core.screen->display)
  64.  
  65. #define XtScreenOfObject(object) \
  66.     ((XtIsWidget(object) ? (object) : _XtWindowedAncestor(object)) \
  67.      ->core.screen)
  68.  
  69. #define XtWindowOfObject(object) \
  70.     ((XtIsWidget(object) ? (object) : _XtWindowedAncestor(object)) \
  71.      ->core.window)
  72.  
  73. #define XtIsManaged(object) \
  74.     (XtIsRectObj(object) ? (object)->core.managed : False)
  75.  
  76. #define XtIsSensitive(object) \
  77.     (XtIsRectObj(object) ? ((object)->core.sensitive && \
  78.                 (object)->core.ancestor_sensitive) : False)
  79.  
  80.  
  81. /****************************************************************
  82.  *
  83.  * Byte utilities
  84.  *
  85.  ****************************************************************/
  86.  
  87. #define _XBCOPYFUNC _XtBCopy
  88. #include <X11/Xfuncs.h>
  89.  
  90. /* If the alignment characteristics of your machine are right, these may be
  91.    faster */
  92.  
  93. #ifdef UNALIGNED
  94.  
  95. #define XtBCopy(src, dst, size)                    \
  96.     if (size == sizeof(int))                    \
  97.     *((int *) (dst)) = *((int *) (src));            \
  98.     else if (size == sizeof(char))                \
  99.     *((char *) (dst)) = *((char *) (src));            \
  100.     else if (size == sizeof(short))                \
  101.     *((short *) (dst)) = *((short *) (src));        \
  102.     else                            \
  103.     bcopy((char *) (src), (char *) (dst), (int) (size));
  104.  
  105. #define XtBZero(dst, size)                    \
  106.     if (size == sizeof(int))                    \
  107.     *((int *) (dst)) = 0;                    \
  108.     else                            \
  109.     bzero((char *) (dst), (int) (size));
  110.  
  111. #define XtBCmp(b1, b2, size)                    \
  112.     (size == sizeof(int) ?                    \
  113.     *((int *) (b1)) != *((int *) (b2))            \
  114.     :   bcmp((char *) (b1), (char *) (b2), (int) (size))    \
  115.     )
  116.  
  117. #else
  118.  
  119. #define XtBCopy(src, dst, size)        \
  120.     bcopy((char *) (src), (char *) (dst), (int) (size));
  121.  
  122. #define XtBZero(dst, size) bzero((char *) (dst), (int) (size));
  123.  
  124. #define XtBCmp(b1, b2, size) bcmp((char *) (b1), (char *) (b2), (int) (size))
  125.  
  126. #endif
  127.  
  128.  
  129. /****************************************************************
  130.  *
  131.  * Stack cache allocation/free
  132.  *
  133.  ****************************************************************/
  134.  
  135. #define XtStackAlloc(size, stack_cache_array)     \
  136.     ((size) <= sizeof(stack_cache_array)      \
  137.     ?  (XtPointer)(stack_cache_array)          \
  138.     :  XtMalloc((unsigned)(size)))
  139.  
  140. #define XtStackFree(pointer, stack_cache_array) \
  141.     if ((pointer) != ((XtPointer)(stack_cache_array))) XtFree(pointer); else
  142.  
  143. /***************************************************************
  144.  *
  145.  * Filename defines
  146.  *
  147.  **************************************************************/
  148.  
  149. /* used by XtResolvePathname */
  150. #ifndef XFILESEARCHPATHDEFAULT
  151. #define XFILESEARCHPATHDEFAULT "/usr/lib/X11/%L/%T/%N%S:/usr/lib/X11/%l/%T/%N%S:/usr/lib/X11/%T/%N%S"
  152. #endif
  153.  
  154. /* the following two were both "X Toolkit " prior to R4 */
  155. #ifndef XTERROR_PREFIX
  156. #define XTERROR_PREFIX ""
  157. #endif
  158.  
  159. #ifndef XTWARNING_PREFIX
  160. #define XTWARNING_PREFIX ""
  161. #endif
  162.  
  163. #ifndef ERRORDB
  164. #define ERRORDB "/usr/lib/X11/XtErrorDB"
  165. #endif
  166.  
  167. extern String XtCXtToolkitError;
  168.  
  169. extern void _XtAllocError(
  170. #if NeedFunctionPrototypes
  171.     String    /* alloc_type */
  172. #endif
  173. );
  174.  
  175. extern void _XtCompileResourceList(
  176. #if NeedFunctionPrototypes
  177.     XtResourceList     /* resources */,
  178.     Cardinal         /* num_resources */
  179. #endif
  180. );
  181.  
  182. extern XtGeometryResult _XtMakeGeometryRequest(
  183. #if NeedFunctionPrototypes
  184.     Widget         /* widget */,
  185.     XtWidgetGeometry*    /* request */,
  186.     XtWidgetGeometry*    /* reply_return */,
  187.     Boolean*        /* clear_rect_obj */
  188. #endif
  189. );
  190.  
  191. #endif /* _XtintrinsicI_h */
  192. /* DON'T ADD STUFF AFTER THIS #endif */
  193.