home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / lib / Xt / Xtos.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-21  |  2.9 KB  |  93 lines

  1. /*
  2. * $XConsortium: Xtos.h,v 1.11 91/11/08 17:55:15 gildea Exp $
  3. */
  4.  
  5. /***********************************************************
  6. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
  7. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  8.  
  9.                         All Rights Reserved
  10.  
  11. Permission to use, copy, modify, and distribute this software and its 
  12. documentation for any purpose and without fee is hereby granted, 
  13. provided that the above copyright notice appear in all copies and that
  14. both that copyright notice and this permission notice appear in 
  15. supporting documentation, and that the names of Digital or MIT not be
  16. used in advertising or publicity pertaining to distribution of the
  17. software without specific, written prior permission.  
  18.  
  19. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  20. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  21. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  22. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  23. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  24. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  25. SOFTWARE.
  26.  
  27. ******************************************************************/
  28.  
  29. #ifndef _Xtos_h
  30. #define _Xtos_h
  31.  
  32. #ifdef INCLUDE_ALLOCA_H
  33. #include <alloca.h>
  34. #endif
  35.  
  36. #ifdef CRAY
  37. #define WORD64
  38. #endif
  39.  
  40. /* stolen from server/include/os.h */
  41. #ifndef NO_ALLOCA
  42. /*
  43.  * os-dependent definition of local allocation and deallocation
  44.  * If you want something other than XtMalloc/XtFree for ALLOCATE/DEALLOCATE
  45.  * LOCAL then you add that in here.
  46.  */
  47. #if defined(__HIGHC__)
  48.  
  49. extern char *alloca();
  50.  
  51. #if HCVERSION < 21003
  52. #define ALLOCATE_LOCAL(size)    alloca((int)(size))
  53. pragma on(alloca);
  54. #else /* HCVERSION >= 21003 */
  55. #define    ALLOCATE_LOCAL(size)    _Alloca((int)(size))
  56. #endif /* HCVERSION < 21003 */
  57.  
  58. #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
  59.  
  60. #endif /* defined(__HIGHC__) */
  61.  
  62.  
  63. #ifdef __GNUC__
  64. #define alloca __builtin_alloca
  65. #define ALLOCATE_LOCAL(size) alloca((int)(size))
  66. #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
  67. #else /* ! __GNUC__ */
  68. /*
  69.  * warning: mips alloca is unsuitable, do not use.
  70.  */
  71. #if defined(vax) || defined(sun) || defined(apollo) || defined(stellar)
  72. /*
  73.  * Some System V boxes extract alloca.o from /lib/libPW.a; if you
  74.  * decide that you don't want to use alloca, you might want to fix it here.
  75.  */
  76. /* alloca might be a macro taking one arg (hi, Sun!), so give it one. */
  77. #define __Xnullarg        /* as nothing */
  78. char *alloca(__Xnullarg);
  79. #define ALLOCATE_LOCAL(size) alloca((int)(size))
  80. #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
  81. #endif /* who does alloca */
  82. #endif /* __GNUC__ */
  83.  
  84. #endif /* NO_ALLOCA */
  85.  
  86. #ifndef ALLOCATE_LOCAL
  87. #define ALLOCATE_LOCAL(size) XtMalloc((unsigned long)(size))
  88. #define DEALLOCATE_LOCAL(ptr) XtFree((XtPointer)(ptr))
  89. #endif /* ALLOCATE_LOCAL */
  90.  
  91. #endif /* _Xtos_h */
  92. /* DON'T ADD STUFF AFTER THIS #endif */
  93.