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