machine.h 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. /*
  2. This file was written by Brent Boyer (boyer@jumpjibe.stanford.edu),
  3. June 7th, 1995 for compiling Meschach under Think C 7.0.4.
  4. His development systems was a Quadra 650 running MacOS 7.5.1 using
  5. a 68x00 CPU with a 68881 FPU. Power Macs will probably require
  6. modification.
  7. For details on how to build the library, see the associated README file.
  8. */
  9. /* Begin stuff from the original Meschach file: */
  10. /* ======================================================================== */
  11. /* machine.h. Generated automatically by configure. */
  12. /* Any machine specific stuff goes here */
  13. /* Add details necessary for your own installation here! */
  14. /* RCS id: $Id: machine.h.in,v 1.2 1994/03/13 23:07:30 des Exp $ */
  15. /* This is for use with "configure" -- if you are not using configure
  16. then use machine.van for the "vanilla" version of machine.h */
  17. /* Note special macros: ANSI_C (ANSI C syntax)
  18. SEGMENTED (segmented memory machine e.g. MS-DOS)
  19. MALLOCDECL (declared if malloc() etc have
  20. been declared) */
  21. /* ======================================================================== */
  22. /* #undef const */
  23. /* leave this commented out -- THINK C has no keyword named "const" */
  24. /* #undef MALLOCDECL */
  25. /* leave this commented out -- THINK C doesn't supply <malloc.h> */
  26. #define NOT_SEGMENTED 1
  27. /* this must #defined -- Mac's don't have segmented memory */
  28. #undef HAVE_MEMORY_H
  29. /* make sure this is #undefined -- THINK C doesn't supply <memory.h> */
  30. #undef HAVE_COMPLEX_H
  31. /* make sure this is #undefined -- THINK C doesn't supply <complex.h> */
  32. #undef HAVE_MALLOC_H
  33. /* make sure this is #undefined -- THINK C doesn't supply <malloc.h> */
  34. #define STDC_HEADERS 1
  35. /* this must be #defined -- it will cause precisely two effects below:
  36. 1) the macros MEM_COPY(...) & MEM_ZERO(...) will be correctly
  37. defined using memmove(...) & memset(...)
  38. 2) the macro ANSI_C will be #defined */
  39. #undef HAVE_BCOPY
  40. /* make sure this is #undefined -- bcopy is for a BSD system? */
  41. #undef HAVE_BZERO
  42. /* make sure this is #undefined -- bzero is for a BSD system? */
  43. /* #undef CHAR0ISDBL0 1 */
  44. /* for safety, this should be commented out (Dave Stewart's advice) */
  45. /* #define WORDS_BIGENDIAN 1 */
  46. /* what's this for? it doesn't appear to ever be used;
  47. I will comment it out */
  48. #undef U_INT_DEF
  49. /* make sure this is #undefined (Dave Stewart's advice) */
  50. /* #define VARARGS 1 */
  51. /* Don't need routines with variable number of arguments */
  52. /* ======================================================================= */
  53. /* for prototypes */
  54. #define HAVE_PROTOTYPES 1
  55. /* this must be #defined (Dave Stewart's advice) */
  56. #define HAVE_PROTOTYPES_IN_STRUCT 1
  57. /* this must be #defined (Dave Stewart's advice) */
  58. /* for inclusion into C++ files */
  59. #ifdef __cplusplus
  60. /* (Note: I do not believe that THINK C ever #defines this) */
  61. #define ANSI_C 1
  62. #ifndef HAVE_PROTOTYPES
  63. #define HAVE_PROTOTYPES 1
  64. #endif
  65. #ifndef HAVE_PROTOTYPES_IN_STRUCT
  66. #define HAVE_PROTOTYPES_IN_STRUCT 1
  67. #endif
  68. #endif /* __cplusplus */
  69. /* example usage: VEC *PROTO(v_get,(int dim)); */
  70. #ifdef HAVE_PROTOTYPES
  71. #define PROTO(name,args) name args
  72. #else
  73. #define PROTO(name,args) name()
  74. #endif /* HAVE_PROTOTYPES */
  75. #ifdef HAVE_PROTOTYPES_IN_STRUCT
  76. /* PROTO_() is to be used instead of PROTO() in struct's and typedef's */
  77. #define PROTO_(name,args) name args
  78. #else
  79. #define PROTO_(name,args) name()
  80. #endif /* HAVE_PROTOTYPES_IN_STRUCT */
  81. /* ======================================================================== */
  82. /* for basic or larger versions */
  83. #define COMPLEX 1
  84. /* this must be #defined (I want all the complex routines) */
  85. #define SPARSE 1
  86. /* this must be #defined (I want all the sparse routines) */
  87. /* ======================================================================== */
  88. /* for loop unrolling */
  89. /* #undef VUNROLL */
  90. /* #undef MUNROLL */
  91. /* ======================================================================== */
  92. /* for segmented memory */
  93. #ifndef NOT_SEGMENTED
  94. #define SEGMENTED
  95. #endif
  96. /* ======================================================================== */
  97. /* if the system has malloc.h */
  98. #ifdef HAVE_MALLOC_H
  99. #define MALLOCDECL 1
  100. #include <malloc.h>
  101. #endif
  102. /* ======================================================================== */
  103. /* any compiler should have this header */
  104. /* if not, change it */
  105. #include <stdio.h>
  106. /* ======================================================================== */
  107. /* Check for ANSI C memmove and memset */
  108. #ifdef STDC_HEADERS
  109. /* standard copy & zero functions */
  110. #define MEM_COPY(from,to,size) memmove((to),(from),(size))
  111. #define MEM_ZERO(where,size) memset((where),'\0',(size))
  112. #ifndef ANSI_C
  113. #define ANSI_C 1
  114. #endif
  115. #endif
  116. /* ======================================================================== */
  117. /* standard headers */
  118. #ifdef ANSI_C
  119. #include <stdlib.h>
  120. #include <stddef.h>
  121. #include <string.h>
  122. #include <float.h>
  123. #include <math.h>
  124. /* #include <math.h> so that the macro HUGE_VAL will be available to us */
  125. #endif
  126. /* ======================================================================== */
  127. /* if have bcopy & bzero and no alternatives yet known, use them */
  128. #ifdef HAVE_BCOPY
  129. #ifndef MEM_COPY
  130. /* nonstandard copy function */
  131. #define MEM_COPY(from,to,size) bcopy((char *)(from),(char *)(to),(int)(size))
  132. #endif
  133. #endif
  134. #ifdef HAVE_BZERO
  135. #ifndef MEM_ZERO
  136. /* nonstandard zero function */
  137. #define MEM_ZERO(where,size) bzero((char *)(where),(int)(size))
  138. #endif
  139. #endif
  140. /* ======================================================================== */
  141. /* if the system has complex.h */
  142. #ifdef HAVE_COMPLEX_H
  143. #include <complex.h>
  144. #endif
  145. /* ======================================================================== */
  146. /* If prototypes are available & ANSI_C not yet defined, then define it,
  147. but don't include any header files as the proper ANSI C headers
  148. aren't here */
  149. #ifdef HAVE_PROTOTYPES
  150. #ifndef ANSI_C
  151. #define ANSI_C 1
  152. #endif
  153. #endif
  154. /* ======================================================================== */
  155. /* floating point precision */
  156. /* you can choose single, double or long double (if available) precision */
  157. #define FLOAT 1
  158. #define DOUBLE 2
  159. #define LONG_DOUBLE 3
  160. /* #undef REAL_FLT */
  161. /* #undef REAL_DBL */
  162. /* leave these both commented out, so that the dafault of double is used */
  163. /* choose double precision by default */
  164. #ifndef REAL_DBL
  165. #ifndef REAL_FLT
  166. #define REAL_DBL 1
  167. /* this is what we want: all reals to be of type double */
  168. #endif
  169. #endif
  170. /* single precision */
  171. #ifdef REAL_FLT
  172. #define Real float
  173. #define LongReal float
  174. #define REAL FLOAT
  175. #define LONGREAL FLOAT
  176. #endif
  177. /* double precision */
  178. #ifdef REAL_DBL
  179. #define Real double
  180. #define LongReal double
  181. #define REAL DOUBLE
  182. #define LONGREAL DOUBLE
  183. #endif
  184. /* Note: under THINK C, the type "double" gets mapped to the type
  185. "long double" as long as you DO NOT turn on the "8-byte doubles"
  186. option.
  187. Recall: this project was compiled with the "8-byte doubles"
  188. option turned OFF (so double == long double)
  189. Also Recall: this project was compiled with the "Generate 68881
  190. instructions" and "Native floating-point format" options turned ON;
  191. this means that double will be a 96 bit MC68881 floating point
  192. extended precision type; these options give the best speed.
  193. (See the THINK C 6.0 User's Guide, pp. 313-317)
  194. --Brent Boyer 6/7/95 */
  195. /* ======================================================================== */
  196. /* machine epsilon or unit roundoff error */
  197. /* This is correct on most IEEE Real precision systems */
  198. #ifdef DBL_EPSILON
  199. #if REAL == DOUBLE
  200. #define MACHEPS DBL_EPSILON
  201. #elif REAL == FLOAT
  202. #define MACHEPS FLT_EPSILON
  203. #elif REAL == LONGDOUBLE
  204. #define MACHEPS LDBL_EPSILON
  205. #endif
  206. #endif
  207. #define F_MACHEPS 1.19209e-07
  208. #define D_MACHEPS 2.22045e-16
  209. /* Note: the extended precision floating point type we are using actually has DBL_EPSILON = 1.08420E-19
  210. (THINK C 6.0 User's Guide, p. 317); out of caution, I will let the above value for D_MACHEPS
  211. stay the same.
  212. --Brent Boyer 6/7/95 */
  213. #ifndef MACHEPS
  214. #if REAL == DOUBLE
  215. #define MACHEPS D_MACHEPS
  216. #elif REAL == FLOAT
  217. #define MACHEPS F_MACHEPS
  218. #elif REAL == LONGDOUBLE
  219. #define MACHEPS D_MACHEPS
  220. #endif
  221. #endif
  222. /* #undef M_MACHEPS */
  223. /********************
  224. #ifdef DBL_EPSILON
  225. #define MACHEPS DBL_EPSILON
  226. #endif
  227. #ifdef M_MACHEPS
  228. #ifndef MACHEPS
  229. #define MACHEPS M_MACHEPS
  230. #endif
  231. #endif
  232. ********************/
  233. /* ======================================================================== */
  234. #define M_MAX_INT 2147483647
  235. /* this value only works if ints are 32 bits */
  236. /* Recall: this project was compiled with the "4-byte ints" option
  237. turned ON (so int == long int <==> 32 bits); if you do not turn
  238. this option on, then ints will be 16 bits so that you will need to
  239. do
  240. #define M_MAX_INT 32767
  241. instead
  242. --Brent Boyer 6/7/95 */
  243. #ifdef M_MAX_INT
  244. #ifndef MAX_RAND
  245. #define MAX_RAND ((double)(M_MAX_INT))
  246. #endif
  247. #endif
  248. /* ======================================================================== */
  249. /* for non-ANSI systems */
  250. /* we #included <math.h> above precisely so that HUGE_VAL will be
  251. #defined here */
  252. #ifndef HUGE_VAL
  253. #define HUGE_VAL HUGE
  254. #else
  255. #ifndef HUGE
  256. #define HUGE HUGE_VAL
  257. /* actually, since HUGE is used in several Meschach routines, you need */
  258. /* this line to be executed even on ANSI systems */
  259. #endif
  260. #endif
  261. /* ======================================================================== */
  262. #ifdef ANSI_C
  263. extern int isatty(int);
  264. #endif