machine.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /* Note special macros: ANSI_C (ANSI C syntax)
  2. SEGMENTED (segmented memory machine e.g. MS-DOS)
  3. MALLOCDECL (declared if malloc() etc have
  4. been declared) */
  5. #define const
  6. /* #undef MALLOCDECL */
  7. #define NOT_SEGMENTED 1
  8. /* #undef HAVE_COMPLEX_H */
  9. #define HAVE_MALLOC_H 1
  10. /* #undef STDC_HEADERS */
  11. #define HAVE_BCOPY 1
  12. #define HAVE_BZERO 1
  13. #define CHAR0ISDBL0 1
  14. #define WORDS_BIGENDIAN 1
  15. /* #undef U_INT_DEF */
  16. #define VARARGS 1
  17. /* for basic or larger versions */
  18. #define COMPLEX 1
  19. #define SPARSE 1
  20. /* for loop unrolling */
  21. /* #undef VUNROLL */
  22. /* #undef MUNROLL */
  23. /* for segmented memory */
  24. #ifndef NOT_SEGMENTED
  25. #define SEGMENTED
  26. #endif
  27. /* if the system has malloc.h */
  28. #ifdef HAVE_MALLOC_H
  29. #define MALLOCDECL 1
  30. #include <malloc.h>
  31. #endif
  32. /* any compiler should have this header */
  33. /* if not, change it */
  34. #include <stdio.h>
  35. /* Check for ANSI C memmove and memset */
  36. #ifdef STDC_HEADERS
  37. /* standard copy & zero functions */
  38. #define MEM_COPY(from,to,size) memmove((to),(from),(size))
  39. #define MEM_ZERO(where,size) memset((where),'\0',(size))
  40. #ifndef ANSI_C
  41. #define ANSI_C 1
  42. #endif
  43. #endif
  44. /* standard headers */
  45. #ifdef ANSI_C
  46. #include <stdlib.h>
  47. #include <stddef.h>
  48. #include <string.h>
  49. #include <float.h>
  50. #endif
  51. /* if have bcopy & bzero and no alternatives yet known, use them */
  52. #ifdef HAVE_BCOPY
  53. #ifndef MEM_COPY
  54. /* nonstandard copy function */
  55. #define MEM_COPY(from,to,size) bcopy((char *)(from),(char *)(to),(int)(size))
  56. #endif
  57. #endif
  58. #ifdef HAVE_BZERO
  59. #ifndef MEM_ZERO
  60. /* nonstandard zero function */
  61. #define MEM_ZERO(where,size) bzero((char *)(where),(int)(size))
  62. #endif
  63. #endif
  64. /* if the system has complex.h */
  65. #ifdef HAVE_COMPLEX_H
  66. #include <complex.h>
  67. #endif
  68. /* If prototypes are available & ANSI_C not yet defined, then define it,
  69. but don't include any header files as the proper ANSI C headers
  70. aren't here */
  71. /* #undef HAVE_PROTOTYPES */
  72. #ifdef HAVE_PROTOTYPES
  73. #ifndef ANSI_C
  74. #define ANSI_C 1
  75. #endif
  76. #endif
  77. /* floating point precision */
  78. /* you can choose single, double or long double (if available) precision */
  79. #define FLOAT 1
  80. #define DOUBLE 2
  81. #define LONG_DOUBLE 3
  82. /* #undef REAL_FLT */
  83. #define REAL_DBL 1
  84. /* if nothing is defined, choose double precision */
  85. #ifndef REAL_DBL
  86. #ifndef REAL_FLT
  87. #define REAL_DBL 1
  88. #endif
  89. #endif
  90. /* single precision */
  91. #ifdef REAL_FLT
  92. #define Real float
  93. #define LongReal float
  94. #define REAL FLOAT
  95. #define LONGREAL FLOAT
  96. #endif
  97. /* double precision */
  98. #ifdef REAL_DBL
  99. #define Real double
  100. #define LongReal double
  101. #define REAL DOUBLE
  102. #define LONGREAL DOUBLE
  103. #endif
  104. /* machine epsilon or unit roundoff error */
  105. /* This is correct on most IEEE Real precision systems */
  106. #ifdef DBL_EPSILON
  107. #if REAL == DOUBLE
  108. #define MACHEPS DBL_EPSILON
  109. #elif REAL == FLOAT
  110. #define MACHEPS FLT_EPSILON
  111. #elif REAL == LONGDOUBLE
  112. #define MACHEPS LDBL_EPSILON
  113. #endif
  114. #endif
  115. #define F_MACHEPS 1.19209e-07
  116. #define D_MACHEPS 2.22045e-16
  117. #ifndef MACHEPS
  118. #if REAL == DOUBLE
  119. #define MACHEPS D_MACHEPS
  120. #elif REAL == FLOAT
  121. #define MACHEPS F_MACHEPS
  122. #elif REAL == LONGDOUBLE
  123. #define MACHEPS D_MACHEPS
  124. #endif
  125. #endif
  126. /* #undef M_MACHEPS */
  127. /********************
  128. #ifdef DBL_EPSILON
  129. #define MACHEPS DBL_EPSILON
  130. #endif
  131. #ifdef M_MACHEPS
  132. #ifndef MACHEPS
  133. #define MACHEPS M_MACHEPS
  134. #endif
  135. #endif
  136. ********************/
  137. #define M_MAX_INT 2147483647
  138. #ifdef M_MAX_INT
  139. #ifndef MAX_RAND
  140. #define MAX_RAND ((double)(M_MAX_INT))
  141. #endif
  142. #endif
  143. /* for non-ANSI systems */
  144. #ifndef HUGE_VAL
  145. #define HUGE_VAL HUGE
  146. #endif
  147. #ifdef ANSI_C
  148. extern int isatty(int);
  149. #endif