40#ifndef CONFIG_H_INCLUDED
41#define CONFIG_H_INCLUDED
52#define PRODUCTIONDATE __DATE__
54#define PRODUCTIONDATE "27-jan-2026"
63#define _FILE_OFFSET_BITS 64
80#define _FILE_OFFSET_BITS 64
90#define HAVE_UNORDERED_MAP
91#define HAVE_UNORDERED_SET
100#define _CRT_SECURE_NO_WARNINGS
106#if !defined(WITHPTHREADS) && defined(WITHPOSIXCLOCK)
110#if !defined(__cplusplus) && !defined(inline)
111#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
113#elif defined(__GNUC__)
115#define inline __inline__
116#elif defined(_MSC_VER)
118#define inline __inline
135#define snprintf _snprintf
159#define STATIC_ASSERT(condition) STATIC_ASSERT__1(condition,__LINE__)
160#define STATIC_ASSERT__1(X,L) STATIC_ASSERT__2(X,L)
161#define STATIC_ASSERT__2(X,L) STATIC_ASSERT__3(X,L)
162#define STATIC_ASSERT__3(X,L) \
163 typedef char static_assertion_failed_##L[(!!(X))*2-1]
171#elif defined(WINDOWS)
173#define WIN32_LEAN_AND_MEAN
179#define WORD FORM_WORD
180#define LONG FORM_LONG
181#define ULONG FORM_ULONG
182#define BOOL FORM_BOOL
185#define OpenFile FORM_OpenFile
186#define ReOpenFile FORM_ReOpenFile
187#define ReadFile FORM_ReadFile
188#define WriteFile FORM_WriteFile
189#define DeleteObject FORM_DeleteObject
191#error UNIX or WINDOWS must be defined!
196#if UINTPTR_MAX == UINT64_MAX
197 typedef int32_t WORD;
198 typedef int64_t LONG;
199 typedef uint32_t UWORD;
200 typedef uint64_t ULONG;
201 #define BITSINWORD 32
202 #define BITSINLONG 64
203 #define WORD_MIN_VALUE INT32_MIN
204 #define WORD_MAX_VALUE INT32_MAX
205 #define LONG_MIN_VALUE INT64_MIN
206 #define LONG_MAX_VALUE INT64_MAX
207#elif UINTPTR_MAX == UINT32_MAX
208 typedef int16_t WORD;
209 typedef int32_t LONG;
210 typedef uint16_t UWORD;
211 typedef uint32_t ULONG;
212 #define BITSINWORD 16
213 #define BITSINLONG 32
214 #define WORD_MIN_VALUE INT16_MIN
215 #define WORD_MAX_VALUE INT16_MAX
216 #define LONG_MIN_VALUE INT32_MIN
217 #define LONG_MAX_VALUE INT32_MAX
219 #error Can not detect if this is a 32-bit or 64-bit platform.
222STATIC_ASSERT(
sizeof(WORD) * 8 == BITSINWORD);
223STATIC_ASSERT(
sizeof(LONG) * 8 == BITSINLONG);
224STATIC_ASSERT(
sizeof(WORD) * 2 ==
sizeof(LONG));
225STATIC_ASSERT(
sizeof(LONG) >=
sizeof(
int *));
226STATIC_ASSERT(
sizeof(LONG) >=
sizeof(
int *));
227STATIC_ASSERT(
sizeof(
int *) >=
sizeof(
int));
228STATIC_ASSERT(
sizeof(
int) >=
sizeof(WORD));
229STATIC_ASSERT(
sizeof(WORD) >=
sizeof(
char));
230STATIC_ASSERT(
sizeof(
char) == 1);
232typedef signed char SBYTE;
233typedef unsigned char UBYTE;
234typedef unsigned int UINT;
236typedef int64_t MLONG;
243#define TOPBITONLY ((ULONG)1 << (BITSINWORD - 1))
244#define TOPLONGBITONLY ((ULONG)1 << (BITSINLONG - 1))
245#define SPECMASK ((UWORD)1 << (BITSINWORD - 1))
246#define WILDMASK ((UWORD)1 << (BITSINWORD - 2))
247#define WORDMASK ((ULONG)FULLMAX - 1)
248#define AWORDMASK (WORDMASK << BITSINWORD)
249#define FULLMAX ((LONG)1 << BITSINWORD)
250#define MAXPOSITIVE ((LONG)(TOPBITONLY - 1))
251#define MAXLONG ((LONG)(TOPLONGBITONLY - 1))
252#define MAXPOSITIVE2 (MAXPOSITIVE / 2)
253#define MAXPOSITIVE4 (MAXPOSITIVE / 4)
259#if !defined(form_alignof)
262#define form_alignof(type) __alignof__(type)
263#elif defined(_MSC_VER)
265#define form_alignof(type) __alignof(type)
266#elif !defined(__cplusplus)
269#define form_alignof(type) offsetof(struct { char c_; type x_; }, x_)
273namespace alignof_impl_ {
274template<
typename T>
struct calc {
275 struct X {
char c_; T x_; };
276 enum { value = offsetof(X, x_) };
279#define form_alignof(type) alignof_impl_::calc<type>::value
309#include <zstd_zlibwrapper.h>
322#if defined(WITHMPI) || defined(WITHPTHREADS)
333STATIC_ASSERT(
sizeof(off_t) >=
sizeof(LONG));
341typedef struct FiLeS {
344extern FILES *Uopen(
char *,
char *);
345extern int Uclose(FILES *);
346extern size_t Uread(
char *,
size_t,
size_t,FILES *);
347extern size_t Uwrite(
char *,
size_t,
size_t,FILES *);
348extern int Useek(FILES *,off_t,
int);
349extern off_t Utell(FILES *);
350extern void Uflush(FILES *);
351extern int Ugetpos(FILES *,fpos_t *);
352extern int Usetpos(FILES *,fpos_t *);
353extern void Usetbuf(FILES *,
char *);
354#define Usync(f) fsync(f->descriptor)
355#define Utruncate(f) { \
356 if ( ftruncate(f->descriptor, 0) ) { \
357 MLOCK(ErrorMessageLock); \
358 MesPrint("Utruncate failed"); \
359 MUNLOCK(ErrorMessageLock); \
364extern FILES *Ustdout;
365#define MAX_OPEN_FILES getdtablesize()
366#define GetPID() ((LONG)getpid())
371#define Uopen(x,y) fopen(x,y)
372#define Uflush(x) fflush(x)
373#define Uclose(x) fclose(x)
374#define Uread(x,y,z,u) fread(x,y,z,u)
375#define Uwrite(x,y,z,u) fwrite(x,y,z,u)
376#define Usetbuf(x,y) setbuf(x,y)
377#define Useek(x,y,z) fseek(x,y,z)
378#define Utell(x) ftell(x)
379#define Ugetpos(x,y) fgetpos(x,y)
380#define Usetpos(x,y) fsetpos(x,y)
381#define Usync(x) fflush(x)
382#define Utruncate(x) _chsize(_fileno(x),0)
383#define Ustdout stdout
384#define MAX_OPEN_FILES FOPEN_MAX
385#define bzero(b,len) (memset((b), 0, (len)), (void)0)
386#define GetPID() ((LONG)GetCurrentProcessId())