home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xibm.zip / AIX / OScompiler.h < prev    next >
C/C++ Source or Header  |  1992-02-11  |  4KB  |  135 lines

  1. /*
  2.  * $Id: OScompiler.h,v 5.1 1992/02/12 00:21:36 jfc Exp $
  3.  *
  4.  * Copyright IBM Corporation 1987,1988,1989
  5.  *
  6.  * All Rights Reserved
  7.  *
  8.  * Permission to use, copy, modify, and distribute this software and its
  9.  * documentation for any purpose and without fee is hereby granted,
  10.  * provided that the above copyright notice appear in all copies and that 
  11.  * both that copyright notice and this permission notice appear in
  12.  * supporting documentation, and that the name of IBM not be
  13.  * used in advertising or publicity pertaining to distribution of the
  14.  * software without specific, written prior permission.
  15.  *
  16.  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  17.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  18.  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  19.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  20.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  21.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  22.  * SOFTWARE.
  23.  *
  24. */
  25. /* "@(#)compiler.h    3.1 88/09/22 09:31:34" */
  26. #ifndef __COMPILER_DEPENDANCIES__
  27. #define __COMPILER_DEPENDANCIES__
  28.  
  29. /* This File Contains all compiler dependant macros for the various
  30.  * different IBM machines and their compilers:
  31.  * rt's & PS/2's
  32.  */
  33.  
  34. /* Are "volatile", "signed" or "const" Valid Declaration Modifiers ?? */
  35. #ifdef _ANSI_DECLS_
  36. #undef _ANSI_DECLS_
  37. #endif
  38.  
  39. #ifdef __GNUC__
  40. #define ANSICPP TRUE
  41. #define _ANSI_DECLS_
  42. #define alloca __builtin_alloca
  43. #endif /* __GNUC__ */
  44.  
  45. #if defined(UNIXCPP) && !defined(ANSICPP)
  46. #define APPEND_STRING(a,b) a/**/b
  47. #else
  48. #if defined(ANSICPP)
  49. #define APPEND_STRING(a,b) a##b
  50. #else
  51. #define APPEND_STRING(a,b) /**/a\
  52. b/**/
  53. #endif
  54. #endif
  55.  
  56. #ifdef __HIGHC__
  57. /* The following defines are for MetaWare HighC (hc) compiler on IBM hardware */
  58. pragma on(RECOGNIZE_LIBRARY) ;
  59. #if defined(OLDHC) /* i.e. hc 1.4 */
  60. #define MOVE( src, dst, length ) _move( src, dst, length )
  61. #else    /* i.e. hc 2.x */
  62. #define MOVE( src, dst, length ) memcpy( dst, src, length)
  63. #endif
  64. #define MAX(a,b) _max(a,b)
  65. #define MIN(a,b) _min(a,b)
  66. #define ABS(x) _abs(x)
  67. #define _ANSI_DECLS_ TRUE
  68.  
  69. #else /* Not metaware's hc */
  70.  
  71. #ifdef SYSV
  72. #define MOVE( src, dst, length ) memcpy( dst, src, length)
  73. #else
  74. #define MOVE( src, dst, length ) bcopy( src, dst, length )
  75. #endif
  76.  
  77. #define MAX(a,b) (((a)>(b))?(a):(b))
  78. #define MIN(a,b) (((a)<(b))?(a):(b))
  79. #define ABS(x) (((x)>0)?(x):-(x))
  80.  
  81. #endif /* Not metaware's hc */
  82.  
  83. /* fast inline move functions */
  84.  
  85. #if defined(__GNUC__) && defined(i386)
  86.  
  87. #define MOVEBYTE( src, dst, length ) \
  88. ({ void *__src = (src);                                       \
  89.    void *__dst = (dst);                                       \
  90.    unsigned long __length = (length);                         \
  91.    __asm volatile ("repe; smovb;"                             \
  92.                    : /* no output */                          \
  93.                    : "D" (__dst), "S" (__src), "c" (__length) \
  94.                    : "di", "si", "cx", "dx");                 \
  95.  })
  96. #define MOVEWORD( src, dst, length ) \
  97. ({ int *__src = (src);                                        \
  98.    int *__dst = (dst);                                        \
  99.    unsigned long __length = (length);                         \
  100.    __asm volatile ("repe; smovl"                              \
  101.                    : /* no output */                          \
  102.                    : "D" (__dst), "S" (__src), "c" (__length) \
  103.                    : "di", "si", "cx");                       \
  104.  })
  105.  
  106. #else  /* not (__GNUC__ && i386) */
  107.  
  108. #define MOVEBYTE( src, dst, length) MOVE( (src), (dst), (length) )
  109. #define MOVEWORD( src, dst, length) MOVE( (src), (dst), (length)*sizeof(int) )
  110.  
  111. #endif /* __GNUC_ && i386 */
  112.  
  113.  
  114. /* Are "volatile" & "const" Valid Declaration Modifiers ?? */
  115. #if !defined(_ANSI_DECLS_) || defined(lint)
  116. /* So that lint doesn't complain about constructs it doesn't understand */
  117. #ifdef volatile
  118. #undef volatile
  119. #endif
  120. #define volatile /**/
  121. #ifdef const
  122. #undef const
  123. #endif
  124. #define const    /**/
  125. #ifdef signed
  126. #undef signed
  127. #endif
  128. #define signed    /**/
  129. #ifdef _ANSI_DECLS_
  130. #undef _ANSI_DECLS_
  131. #endif
  132. #endif
  133.  
  134. #endif
  135.