40 #ifndef CONFIG_H_INCLUDED 41 #define CONFIG_H_INCLUDED 47 #define MAJORVERSION 4 48 #define MINORVERSION 3 50 #define PRODUCTIONDATE "08-nov-2022" 58 #define SIZEOF_LONG_LONG 8 59 #define _FILE_OFFSET_BITS 64 62 #define WITHPOSIXCLOCK 71 #define WITHPOSIXCLOCK 77 #define SIZEOF_LONG_LONG 8 78 #define _FILE_OFFSET_BITS 64 87 #define WITHPOSIXCLOCK 88 #define HAVE_UNORDERED_MAP 89 #define HAVE_UNORDERED_SET 95 #define SIZEOF_LONG_LONG 8 100 #define _CRT_SECURE_NO_WARNINGS 103 #elif defined(_WIN32) 105 #define SIZEOF_LONG_LONG 8 112 #if !defined(WITHPTHREADS) && defined(WITHPOSIXCLOCK) 113 #undef WITHPOSIXCLOCK 116 #if !defined(__cplusplus) && !defined(inline) 117 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) 119 #elif defined(__GNUC__) 121 #define inline __inline__ 122 #elif defined(_MSC_VER) 124 #define inline __inline 134 #if defined(_MSC_VER) 142 #define _ALLOW_KEYWORD_MACROS 150 #define snprintf _snprintf 171 #define STATIC_ASSERT(condition) STATIC_ASSERT__1(condition,__LINE__) 172 #define STATIC_ASSERT__1(X,L) STATIC_ASSERT__2(X,L) 173 #define STATIC_ASSERT__2(X,L) STATIC_ASSERT__3(X,L) 174 #define STATIC_ASSERT__3(X,L) \ 175 typedef char static_assertion_failed_##L[(!!(X))*2-1] 183 #elif defined(WINDOWS) 185 #define WIN32_LEAN_AND_MEAN 191 #define WORD FORM_WORD 192 #define LONG FORM_LONG 193 #define ULONG FORM_ULONG 194 #define BOOL FORM_BOOL 197 #define OpenFile FORM_OpenFile 198 #define ReOpenFile FORM_ReOpenFile 199 #define ReadFile FORM_ReadFile 200 #define WriteFile FORM_WriteFile 201 #define DeleteObject FORM_DeleteObject 203 #error UNIX or WINDOWS must be defined! 219 typedef unsigned short UWORD;
220 typedef unsigned long ULONG;
221 #define BITSINWORD 16 222 #define BITSINLONG 32 228 #ifdef SIZEOF_LONG_LONG 229 #if SIZEOF_LONG_LONG == 8 230 #define INT64 long long 235 #error INT64 is not available! 238 #define WORD_MIN_VALUE SHRT_MIN 239 #define WORD_MAX_VALUE SHRT_MAX 240 #define LONG_MIN_VALUE LONG_MIN 241 #define LONG_MAX_VALUE LONG_MAX 246 typedef long long LONG;
247 typedef unsigned int UWORD;
248 typedef unsigned long long ULONG;
249 #define BITSINWORD 32 250 #define BITSINLONG 64 253 #define INT64 long long 256 #define WORD_MIN_VALUE INT_MIN 257 #define WORD_MAX_VALUE INT_MAX 258 #define LONG_MIN_VALUE LLONG_MIN 259 #define LONG_MAX_VALUE LLONG_MAX 265 typedef unsigned int UWORD;
266 typedef unsigned long ULONG;
267 #define BITSINWORD 32 268 #define BITSINLONG 64 274 #define WORD_MIN_VALUE INT_MIN 275 #define WORD_MAX_VALUE INT_MAX 276 #define LONG_MIN_VALUE LONG_MIN 277 #define LONG_MAX_VALUE LONG_MAX 280 #error ILP32 or LLP64 or LP64 must be defined! 283 STATIC_ASSERT(
sizeof(WORD) * 8 == BITSINWORD);
284 STATIC_ASSERT(
sizeof(LONG) * 8 == BITSINLONG);
285 STATIC_ASSERT(
sizeof(WORD) * 2 ==
sizeof(LONG));
286 STATIC_ASSERT(
sizeof(LONG) >=
sizeof(
int *));
287 STATIC_ASSERT(
sizeof(INT16) == 2);
288 STATIC_ASSERT(
sizeof(INT32) == 4);
289 STATIC_ASSERT(
sizeof(INT64) == 8);
291 STATIC_ASSERT(
sizeof(INT128) == 16);
299 typedef signed char SBYTE;
300 typedef unsigned char UBYTE;
301 typedef unsigned int UINT;
310 #define TOPBITONLY ((ULONG)1 << (BITSINWORD - 1)) 311 #define TOPLONGBITONLY ((ULONG)1 << (BITSINLONG - 1)) 312 #define SPECMASK ((UWORD)1 << (BITSINWORD - 1)) 313 #define WILDMASK ((UWORD)1 << (BITSINWORD - 2)) 314 #define WORDMASK ((ULONG)FULLMAX - 1) 315 #define AWORDMASK (WORDMASK << BITSINWORD) 316 #define FULLMAX ((LONG)1 << BITSINWORD) 317 #define MAXPOSITIVE ((LONG)(TOPBITONLY - 1)) 318 #define MAXLONG ((LONG)(TOPLONGBITONLY - 1)) 319 #define MAXPOSITIVE2 (MAXPOSITIVE / 2) 320 #define MAXPOSITIVE4 (MAXPOSITIVE / 4) 326 #if !defined(alignof) 327 #if defined(__GNUC__) 329 #define alignof(type) __alignof__(type) 330 #elif defined(_MSC_VER) 332 #define alignof(type) __alignof(type) 333 #elif !defined(__cplusplus) 336 #define alignof(type) offsetof(struct { char c_; type x_; }, x_) 340 namespace alignof_impl_ {
341 template<
typename T>
struct calc {
342 struct X {
char c_; T x_; };
343 enum { value = offsetof(X, x_) };
346 #define alignof(type) alignof_impl_::calc<type>::value 391 #define PADDUMMY(type, size) \ 392 UBYTE d_u_m_m_y[alignof(type) - ((size) & (alignof(type) - 1))] 393 #define PADPOSITION(ptr_,long_,int_,word_,byte_) \ 395 + sizeof(int *) * (ptr_) \ 396 + sizeof(LONG) * (long_) \ 397 + sizeof(int) * (int_) \ 398 + sizeof(WORD) * (word_) \ 399 + sizeof(UBYTE) * (byte_) \ 401 #define PADPOINTER(long_,int_,word_,byte_) \ 403 + sizeof(LONG) * (long_) \ 404 + sizeof(int) * (int_) \ 405 + sizeof(WORD) * (word_) \ 406 + sizeof(UBYTE) * (byte_) \ 408 #define PADLONG(int_,word_,byte_) \ 410 + sizeof(int) * (int_) \ 411 + sizeof(WORD) * (word_) \ 412 + sizeof(UBYTE) * (byte_) \ 414 #define PADINT(word_,byte_) \ 416 + sizeof(WORD) * (word_) \ 417 + sizeof(UBYTE) * (byte_) \ 419 #define PADWORD(byte_) \ 421 + sizeof(UBYTE) * (byte_) \ 447 #include <sys/file.h> 461 #if defined(WITHMPI) || defined(WITHPTHREADS) 478 typedef struct FiLeS {
481 extern FILES *Uopen(
char *,
char *);
482 extern int Uclose(FILES *);
483 extern size_t Uread(
char *,
size_t,
size_t,FILES *);
484 extern size_t Uwrite(
char *,
size_t,
size_t,FILES *);
485 extern int Useek(FILES *,off_t,
int);
486 extern off_t Utell(FILES *);
487 extern void Uflush(FILES *);
488 extern int Ugetpos(FILES *,fpos_t *);
489 extern int Usetpos(FILES *,fpos_t *);
490 extern void Usetbuf(FILES *,
char *);
491 #define Usync(f) fsync(f->descriptor) 492 #define Utruncate(f) { \ 493 if ( ftruncate(f->descriptor, 0) ) { \ 494 MLOCK(ErrorMessageLock); \ 495 MesPrint("Utruncate failed"); \ 496 MUNLOCK(ErrorMessageLock); \ 501 extern FILES *Ustdout;
502 #define MAX_OPEN_FILES getdtablesize() 503 #define GetPID() ((LONG)getpid()) 508 #define Uopen(x,y) fopen(x,y) 509 #define Uflush(x) fflush(x) 510 #define Uclose(x) fclose(x) 511 #define Uread(x,y,z,u) fread(x,y,z,u) 512 #define Uwrite(x,y,z,u) fwrite(x,y,z,u) 513 #define Usetbuf(x,y) setbuf(x,y) 514 #define Useek(x,y,z) fseek(x,y,z) 515 #define Utell(x) ftell(x) 516 #define Ugetpos(x,y) fgetpos(x,y) 517 #define Usetpos(x,y) fsetpos(x,y) 518 #define Usync(x) fflush(x) 519 #define Utruncate(x) _chsize(_fileno(x),0) 520 #define Ustdout stdout 521 #define MAX_OPEN_FILES FOPEN_MAX 522 #define bzero(b,len) (memset((b), 0, (len)), (void)0) 523 #define GetPID() ((LONG)GetCurrentProcessId())