machine.h 3.4 KB

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