45 #define MAJORVERSION 4
46 #define MINORVERSION 1
49 #define PRODUCTIONDATE 20131025
51 #define PRODUCTIONDATE "25-oct-2013"
60 #define SIZEOF_LONG_LONG 8
61 #define _FILE_OFFSET_BITS 64
64 #define WITHPOSIXCLOCK
73 #define WITHPOSIXCLOCK
79 #define SIZEOF_LONG_LONG 8
80 #define _FILE_OFFSET_BITS 64
93 #define SIZEOF_LONG_LONG 8
98 #define _CRT_SECURE_NO_WARNINGS
101 #elif defined(_WIN32)
103 #define SIZEOF_LONG_LONG 8
110 #if !defined(WITHPTHREADS) && defined(WITHPOSIXCLOCK)
111 #undef WITHPOSIXCLOCK
114 #if !defined(__cplusplus) && !defined(inline)
115 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
117 #elif defined(__GNUC__)
119 #define inline __inline__
120 #elif defined(_MSC_VER)
122 #define inline __inline
135 #define STATIC_ASSERT(condition) STATIC_ASSERT__1(condition,__LINE__)
136 #define STATIC_ASSERT__1(X,L) STATIC_ASSERT__2(X,L)
137 #define STATIC_ASSERT__2(X,L) STATIC_ASSERT__3(X,L)
138 #define STATIC_ASSERT__3(X,L) \
139 typedef char static_assertion_failed_##L[(!!(X))*2-1]
147 #elif defined(WINDOWS)
149 #define WIN32_LEAN_AND_MEAN
155 #define WORD WORD__Renamed
156 #define LONG LONG__Renamed
157 #define ULONG ULONG__Renamed
160 #define OpenFile OpenFile__Renamed
161 #define ReOpenFile ReOpenFile__Renamed
162 #define ReadFile ReadFile__Renamed
163 #define WriteFile WriteFile__Renamed
164 #define DeleteObject DeleteObject__Renamed
166 #error UNIX or WINDOWS must be defined!
182 typedef unsigned short UWORD;
183 typedef unsigned long ULONG;
184 #define BITSINWORD 16
185 #define BITSINLONG 32
191 #ifdef SIZEOF_LONG_LONG
192 #if SIZEOF_LONG_LONG == 8
193 #define INT64 long long
198 #error INT64 is not available!
204 typedef long long LONG;
205 typedef unsigned int UWORD;
206 typedef unsigned long long ULONG;
207 #define BITSINWORD 32
208 #define BITSINLONG 64
211 #define INT64 long long
218 typedef unsigned int UWORD;
219 typedef unsigned long ULONG;
220 #define BITSINWORD 32
221 #define BITSINLONG 64
228 #error ILP32 or LLP64 or LP64 must be defined!
231 STATIC_ASSERT(
sizeof(WORD) * 8 == BITSINWORD);
232 STATIC_ASSERT(
sizeof(LONG) * 8 == BITSINLONG);
233 STATIC_ASSERT(
sizeof(WORD) * 2 ==
sizeof(LONG));
234 STATIC_ASSERT(
sizeof(LONG) >=
sizeof(
int *));
235 STATIC_ASSERT(
sizeof(INT16) == 2);
236 STATIC_ASSERT(
sizeof(INT32) == 4);
237 STATIC_ASSERT(
sizeof(INT64) == 8);
239 STATIC_ASSERT(
sizeof(INT128) == 16);
248 typedef unsigned char UBYTE;
249 typedef unsigned int UINT;
253 #define TOPBITONLY ((ULONG)1 << (BITSINWORD - 1))
254 #define TOPLONGBITONLY ((ULONG)1 << (BITSINLONG - 1))
255 #define SPECMASK ((UWORD)1 << (BITSINWORD - 1))
256 #define WILDMASK ((UWORD)1 << (BITSINWORD - 2))
257 #define WORDMASK ((ULONG)FULLMAX - 1)
258 #define AWORDMASK (WORDMASK << BITSINWORD)
259 #define FULLMAX ((LONG)1 << BITSINWORD)
260 #define MAXPOSITIVE ((LONG)(TOPBITONLY - 1))
261 #define MAXLONG ((LONG)(TOPLONGBITONLY - 1))
262 #define MAXPOSITIVE2 (MAXPOSITIVE / 2)
268 #if !defined(alignof)
269 #if defined(__GNUC__)
271 #define alignof(type) __alignof__(type)
272 #elif defined(_MSC_VER)
274 #define alignof(type) __alignof(type)
275 #elif !defined(__cplusplus)
278 #define alignof(type) offsetof(struct { char c_; type x_; }, x_)
282 namespace alignof_impl_ {
283 template<
typename T>
struct calc {
284 struct X {
char c_; T x_; };
285 enum { value = offsetof(X, x_) };
288 #define alignof(type) alignof_impl_::calc<type>::value
323 #define PADDUMMY(type, size) \
324 UBYTE d_u_m_m_y[alignof(type) - ((size) & (alignof(type) - 1))]
325 #define PADPOSITION(ptr_,long_,int_,word_,byte_) \
327 + sizeof(int *) * (ptr_) \
328 + sizeof(LONG) * (long_) \
329 + sizeof(int) * (int_) \
330 + sizeof(WORD) * (word_) \
331 + sizeof(UBYTE) * (byte_) \
333 #define PADPOINTER(long_,int_,word_,byte_) \
335 + sizeof(LONG) * (long_) \
336 + sizeof(int) * (int_) \
337 + sizeof(WORD) * (word_) \
338 + sizeof(UBYTE) * (byte_) \
340 #define PADLONG(int_,word_,byte_) \
342 + sizeof(int) * (int_) \
343 + sizeof(WORD) * (word_) \
344 + sizeof(UBYTE) * (byte_) \
346 #define PADINT(word_,byte_) \
348 + sizeof(WORD) * (word_) \
349 + sizeof(UBYTE) * (byte_) \
351 #define PADWORD(byte_) \
353 + sizeof(UBYTE) * (byte_) \
377 #include <sys/file.h>
391 #if defined(WITHMPI) || defined(WITHPTHREADS)
408 typedef struct FiLeS {
411 extern FILES *Uopen(
char *,
char *);
412 extern int Uclose(FILES *);
413 extern size_t Uread(
char *,
size_t,
size_t,FILES *);
414 extern size_t Uwrite(
char *,
size_t,
size_t,FILES *);
415 extern int Useek(FILES *,off_t,
int);
416 extern off_t Utell(FILES *);
417 extern void Uflush(FILES *);
418 extern int Ugetpos(FILES *,fpos_t *);
419 extern int Usetpos(FILES *,fpos_t *);
420 extern void Usetbuf(FILES *,
char *);
421 #define Usync(f) fsync(f->descriptor)
422 #define Utruncate(f) ftruncate(f->descriptor,0);
423 extern FILES *Ustdout;
424 #define MAX_OPEN_FILES getdtablesize()
429 #define Uopen(x,y) fopen(x,y)
430 #define Uflush(x) fflush(x)
431 #define Uclose(x) fclose(x)
432 #define Uread(x,y,z,u) fread(x,y,z,u)
433 #define Uwrite(x,y,z,u) fwrite(x,y,z,u)
434 #define Usetbuf(x,y) setbuf(x,y)
435 #define Useek(x,y,z) fseek(x,y,z)
436 #define Utell(x) ftell(x)
437 #define Ugetpos(x,y) fgetpos(x,y)
438 #define Usetpos(x,y) fsetpos(x,y)
439 #define Usync(x) fflush(x)
440 #define Utruncate(x) _chsize(_fileno(x),0)
441 #define Ustdout stdout
442 #define MAX_OPEN_FILES FOPEN_MAX
443 #define bzero(b,len) (memset((b), 0, (len)), (void)0)