NEURON
machine.h
Go to the documentation of this file.
1 /*
2  * This file has been hacked from the machine.h files supplied from the
3  * original meschach distribution. It's now a generic file that works on
4  * all machines.
5  *
6  * This file used to define a bunch of HAVE_xyz macros. This is all handled
7  * now in config.h.
8  */
9 /* machine.h. Generated automatically by configure. */
10 /* Any machine specific stuff goes here */
11 /* Add details necessary for your own installation here! */
12 
13 /* RCS id: machine.h,v 1.3 1998/08/31 19:47:38 hines Exp */
14 
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 
18 /* Note special macros: ANSI_C (ANSI C syntax)
19  SEGMENTED (segmented memory machine e.g. MS-DOS)
20  MALLOCDECL (declared if malloc() etc have
21  been declared) */
22 
23 #ifndef _MACHINE_H
24 #define _MACHINE_H 1
25 
26 #include <math.h>
27 
28 #include <../../nrnconf.h>
29 
30 #if defined(HAVE_STDINT_H)
31 #include <stdint.h>
32 #endif
33 
34 #if !defined(HUGE) && defined(HUGE_VAL)
35 #define HUGE HUGE_VAL
36 #endif
37 
38 typedef uint32_t u_int;
39 
40 /* #undef const */
41 
42 /* #undef MALLOCDECL */
43 #define NOT_SEGMENTED 1
44 #define CHAR0ISDBL0 1
45 #undef HAVE_PROTOTYPES
46 #define HAVE_PROTOTYPES 1
47 /* #undef HAVE_PROTOTYPES_IN_STRUCT */
48 
49 /* for inclusion into C++ files */
50 #ifdef __cplusplus
51 #define ANSI_C 1
52 #ifndef HAVE_PROTOTYPES
53 #define HAVE_PROTOTYPES 1
54 #endif
55 #ifndef HAVE_PROTOTYPES_IN_STRUCT
56 #define HAVE_PROTOTYPES_IN_STRUCT 1
57 #endif
58 #endif /* __cplusplus */
59 
60 /* example usage: VEC *PROTO(v_get,(int dim)); */
61 #ifdef HAVE_PROTOTYPES
62 #define PROTO(name,args) name args
63 #else
64 #define PROTO(name,args) name()
65 #endif /* HAVE_PROTOTYPES */
66 #ifdef HAVE_PROTOTYPES_IN_STRUCT
67 /* PROTO_() is to be used instead of PROTO() in struct's and typedef's */
68 #define PROTO_(name,args) name args
69 #else
70 #define PROTO_(name,args) name()
71 #endif /* HAVE_PROTOTYPES_IN_STRUCT */
72 
73 /* for basic or larger versions */
74 #define COMPLEX 1
75 #define SPARSE 1
76 
77 /* for loop unrolling */
78 /* #undef VUNROLL */
79 /* #undef MUNROLL */
80 
81 /* for segmented memory */
82 #ifndef NOT_SEGMENTED
83 #define SEGMENTED
84 #endif
85 
86 /* An AIX machine had incompatible prototypes between
87 malloc.h and stdlib.h so prefer stdlib.h if it exists
88 */
89 #ifdef HAVE_STDLIB_H
90 #include <stdlib.h>
91 #else
92 /* if the system has malloc.h */
93 #ifdef HAVE_MALLOC_H
94 #define MALLOCDECL 1
95 #include <malloc.h>
96 #endif
97 #endif
98 
99 /* any compiler should have this header */
100 /* if not, change it */
101 #include <stdio.h>
102 
103 
104 /* Check for ANSI C memmove and memset */
105 #if defined(STDC_HEADERS) || defined(WIN32)
106 /* standard copy & zero functions */
107 #define MEM_COPY(from,to,size) memmove((to),(from),(size))
108 #define MEM_ZERO(where,size) memset((where),'\0',(size))
109 
110 #ifndef ANSI_C
111 #define ANSI_C 1
112 #endif
113 
114 #endif
115 
116 /* standard headers */
117 #ifdef ANSI_C
118 #include <stdlib.h>
119 #include <stddef.h>
120 #include <string.h>
121 #include <float.h>
122 #endif
123 
124 
125 /* if have bcopy & bzero and no alternatives yet known, use them */
126 #ifdef HAVE_BCOPY
127 #ifndef MEM_COPY
128 /* nonstandard copy function */
129 #define MEM_COPY(from,to,size) bcopy((char *)(from),(char *)(to),(int)(size))
130 #endif
131 #endif
132 
133 #ifdef HAVE_BZERO
134 #ifndef MEM_ZERO
135 /* nonstandard zero function */
136 #define MEM_ZERO(where,size) bzero((char *)(where),(int)(size))
137 #endif
138 #endif
139 
140 /* if the system has complex.h */
141 #if 0
142 #ifdef HAVE_COMPLEX_H
143 #include <complex.h>
144 #endif
145 /*
146  I've commented this out because it causes problems when run through a
147  C++ compiler. complex.h is part of the C++ standard library but does
148  something completely different.
149 */
150 #endif
151 
152 /* If prototypes are available & ANSI_C not yet defined, then define it,
153  but don't include any header files as the proper ANSI C headers
154  aren't here */
155 #ifdef HAVE_PROTOTYPES
156 #ifndef ANSI_C
157 #define ANSI_C 1
158 #endif
159 #endif
160 
161 /* floating point precision */
162 
163 /* you can choose single, double or long double (if available) precision */
164 
165 #define FLOAT 1
166 #define DOUBLE 2
167 #define LONG_DOUBLE 3
168 
169 /* #undef REAL_FLT */
170 /* #undef REAL_DBL */
171 
172 /* if nothing is defined, choose double precision */
173 #ifndef REAL_DBL
174 #ifndef REAL_FLT
175 #define REAL_DBL 1
176 #endif
177 #endif
178 
179 /* single precision */
180 #ifdef REAL_FLT
181 #define Real float
182 #define LongReal float
183 #define REAL FLOAT
184 #define LONGREAL FLOAT
185 #endif
186 
187 /* double precision */
188 #ifdef REAL_DBL
189 #define Real double
190 #define LongReal double
191 #define REAL DOUBLE
192 #define LONGREAL DOUBLE
193 #endif
194 
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 
208 #define F_MACHEPS 1.19209e-07
209 #define D_MACHEPS 2.22045e-16
210 
211 #ifndef MACHEPS
212 #if REAL == DOUBLE
213 #define MACHEPS D_MACHEPS
214 #elif REAL == FLOAT
215 #define MACHEPS F_MACHEPS
216 #elif REAL == LONGDOUBLE
217 #define MACHEPS D_MACHEPS
218 #endif
219 #endif
220 
221 /* #undef M_MACHEPS */
222 
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 #ifdef M_MAX_INT
236 #ifndef MAX_RAND
237 #define MAX_RAND ((double)(M_MAX_INT))
238 /* This isn't true on a lot of older unix systems. */
239 #endif
240 #endif
241 
242 /* for non-ANSI systems */
243 #ifndef HUGE_VAL
244 #define HUGE_VAL HUGE
245 #else
246 #ifndef HUGE
247 #define HUGE HUGE_VAL
248 #endif
249 #endif
250 
251 
252 #if HAVE_UNISTD_H
253 #include <unistd.h>
254 #endif
255 
256 #endif
uint32_t u_int
Definition: machine.h:38
uint uint32_t