machine.h.in 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /* Any machine specific stuff goes here */
  2. /* Add details necessary for your own installation here! */
  3. /* RCS id: $Id: machine.h.in,v 1.3 1995/03/27 15:36:21 des Exp $ */
  4. /* This is for use with "configure" -- if you are not using configure
  5. then use machine.van for the "vanilla" version of machine.h */
  6. /* Note special macros: ANSI_C (ANSI C syntax)
  7. SEGMENTED (segmented memory machine e.g. MS-DOS)
  8. MALLOCDECL (declared if malloc() etc have
  9. been declared) */
  10. #ifndef _MACHINE_H
  11. #define _MACHINE_H 1
  12. #undef const
  13. #undef MALLOCDECL
  14. #undef NOT_SEGMENTED
  15. #undef HAVE_MEMORY_H
  16. #undef HAVE_COMPLEX_H
  17. #undef HAVE_MALLOC_H
  18. #undef STDC_HEADERS
  19. #undef HAVE_BCOPY
  20. #undef HAVE_BZERO
  21. #undef CHAR0ISDBL0
  22. #undef WORDS_BIGENDIAN
  23. #undef U_INT_DEF
  24. #undef VARARGS
  25. #undef HAVE_PROTOTYPES
  26. #undef HAVE_PROTOTYPES_IN_STRUCT
  27. /* for inclusion into C++ files */
  28. #ifdef __cplusplus
  29. #define ANSI_C 1
  30. #ifndef HAVE_PROTOTYPES
  31. #define HAVE_PROTOTYPES 1
  32. #endif
  33. #ifndef HAVE_PROTOTYPES_IN_STRUCT
  34. #define HAVE_PROTOTYPES_IN_STRUCT 1
  35. #endif
  36. #endif /* __cplusplus */
  37. /* example usage: VEC *PROTO(v_get,(int dim)); */
  38. #ifdef HAVE_PROTOTYPES
  39. #define PROTO(name,args) name args
  40. #else
  41. #define PROTO(name,args) name()
  42. #endif /* HAVE_PROTOTYPES */
  43. #ifdef HAVE_PROTOTYPES_IN_STRUCT
  44. /* PROTO_() is to be used instead of PROTO() in struct's and typedef's */
  45. #define PROTO_(name,args) name args
  46. #else
  47. #define PROTO_(name,args) name()
  48. #endif /* HAVE_PROTOTYPES_IN_STRUCT */
  49. /* for basic or larger versions */
  50. #undef COMPLEX
  51. #undef SPARSE
  52. /* for loop unrolling */
  53. #undef VUNROLL
  54. #undef MUNROLL
  55. /* for segmented memory */
  56. #ifndef NOT_SEGMENTED
  57. #define SEGMENTED
  58. #endif
  59. /* if the system has malloc.h */
  60. #ifdef HAVE_MALLOC_H
  61. #define MALLOCDECL 1
  62. #include <malloc.h>
  63. #endif
  64. /* any compiler should have this header */
  65. /* if not, change it */
  66. #include <stdio.h>
  67. /* Check for ANSI C memmove and memset */
  68. #ifdef STDC_HEADERS
  69. /* standard copy & zero functions */
  70. #define MEM_COPY(from,to,size) memmove((to),(from),(size))
  71. #define MEM_ZERO(where,size) memset((where),'\0',(size))
  72. #ifndef ANSI_C
  73. #define ANSI_C 1
  74. #endif
  75. #endif
  76. /* standard headers */
  77. #ifdef ANSI_C
  78. #include <stdlib.h>
  79. #include <stddef.h>
  80. #include <string.h>
  81. #include <float.h>
  82. #endif
  83. /* if have bcopy & bzero and no alternatives yet known, use them */
  84. #ifdef HAVE_BCOPY
  85. #ifndef MEM_COPY
  86. /* nonstandard copy function */
  87. #define MEM_COPY(from,to,size) bcopy((char *)(from),(char *)(to),(int)(size))
  88. #endif
  89. #endif
  90. #ifdef HAVE_BZERO
  91. #ifndef MEM_ZERO
  92. /* nonstandard zero function */
  93. #define MEM_ZERO(where,size) bzero((char *)(where),(int)(size))
  94. #endif
  95. #endif
  96. /* if the system has complex.h */
  97. #ifdef HAVE_COMPLEX_H
  98. #include <complex.h>
  99. #endif
  100. /* If prototypes are available & ANSI_C not yet defined, then define it,
  101. but don't include any header files as the proper ANSI C headers
  102. aren't here */
  103. #ifdef HAVE_PROTOTYPES
  104. #ifndef ANSI_C
  105. #define ANSI_C 1
  106. #endif
  107. #endif
  108. /* floating point precision */
  109. /* you can choose single, double or long double (if available) precision */
  110. #define FLOAT 1
  111. #define DOUBLE 2
  112. #define LONG_DOUBLE 3
  113. #undef REAL_FLT
  114. #undef REAL_DBL
  115. /* if nothing is defined, choose double precision */
  116. #ifndef REAL_DBL
  117. #ifndef REAL_FLT
  118. #define REAL_DBL 1
  119. #endif
  120. #endif
  121. /* single precision */
  122. #ifdef REAL_FLT
  123. #define Real float
  124. #define LongReal float
  125. #define REAL FLOAT
  126. #define LONGREAL FLOAT
  127. #endif
  128. /* double precision */
  129. #ifdef REAL_DBL
  130. #define Real double
  131. #define LongReal double
  132. #define REAL DOUBLE
  133. #define LONGREAL DOUBLE
  134. #endif
  135. /* machine epsilon or unit roundoff error */
  136. /* This is correct on most IEEE Real precision systems */
  137. #ifdef DBL_EPSILON
  138. #if REAL == DOUBLE
  139. #define MACHEPS DBL_EPSILON
  140. #elif REAL == FLOAT
  141. #define MACHEPS FLT_EPSILON
  142. #elif REAL == LONGDOUBLE
  143. #define MACHEPS LDBL_EPSILON
  144. #endif
  145. #endif
  146. #undef F_MACHEPS
  147. #undef D_MACHEPS
  148. #ifndef MACHEPS
  149. #if REAL == DOUBLE
  150. #define MACHEPS D_MACHEPS
  151. #elif REAL == FLOAT
  152. #define MACHEPS F_MACHEPS
  153. #elif REAL == LONGDOUBLE
  154. #define MACHEPS D_MACHEPS
  155. #endif
  156. #endif
  157. #undef M_MACHEPS
  158. /********************
  159. #ifdef DBL_EPSILON
  160. #define MACHEPS DBL_EPSILON
  161. #endif
  162. #ifdef M_MACHEPS
  163. #ifndef MACHEPS
  164. #define MACHEPS M_MACHEPS
  165. #endif
  166. #endif
  167. ********************/
  168. #undef M_MAX_INT
  169. #ifdef M_MAX_INT
  170. #ifndef MAX_RAND
  171. #define MAX_RAND ((double)(M_MAX_INT))
  172. #endif
  173. #endif
  174. /* for non-ANSI systems */
  175. #ifndef HUGE_VAL
  176. #define HUGE_VAL HUGE
  177. #else
  178. #ifndef HUGE
  179. #define HUGE HUGE_VAL
  180. #endif
  181. #endif
  182. #ifdef ANSI_C
  183. extern int isatty(int);
  184. #endif
  185. #endif