2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
// Globals.h
|
|
|
|
|
|
|
|
// This file is used for precompiled header generation in MSVC
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// OS-dependent stuff:
|
|
|
|
#ifdef _WIN32
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
2015-12-22 14:50:42 -05:00
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
#define _WIN32_WINNT 0x501 // We want to target WinXP and higher
|
2015-12-22 14:50:42 -05:00
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
#include <Windows.h>
|
|
|
|
#include <winsock2.h>
|
|
|
|
#include <Ws2tcpip.h> // IPv6 stuff
|
2015-12-22 14:50:42 -05:00
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
// Windows SDK defines min and max macros, messing up with our std::min and std::max usage
|
|
|
|
#undef min
|
|
|
|
#undef max
|
2015-12-22 14:50:42 -05:00
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
// Windows SDK defines GetFreeSpace as a constant, probably a Win16 API remnant
|
|
|
|
#ifdef GetFreeSpace
|
|
|
|
#undef GetFreeSpace
|
|
|
|
#endif // GetFreeSpace
|
|
|
|
#else
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h> // for mkdir
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#include <netdb.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
#include <cstring>
|
|
|
|
#include <pthread.h>
|
|
|
|
#include <semaphore.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CRT stuff:
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// STL stuff:
|
|
|
|
#include <vector>
|
|
|
|
#include <list>
|
|
|
|
#include <deque>
|
|
|
|
#include <string>
|
|
|
|
#include <map>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <memory>
|
|
|
|
#include <set>
|
|
|
|
#include <queue>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Common headers (part 1, without macros):
|
2020-05-10 12:16:38 -04:00
|
|
|
#include "../../src/StringUtils.h"
|
2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Common definitions:
|
|
|
|
|
2017-12-23 07:49:08 -05:00
|
|
|
/** Evaluates to the number of elements in an array (compile-time!) */
|
2013-07-29 07:13:03 -04:00
|
|
|
#define ARRAYCOUNT(X) (sizeof(X) / sizeof(*(X)))
|
|
|
|
|
2017-12-23 07:49:08 -05:00
|
|
|
/** Allows arithmetic expressions like "32 KiB" (but consider using parenthesis around it, "(32 KiB)") */
|
2013-07-29 07:13:03 -04:00
|
|
|
#define KiB * 1024
|
|
|
|
#define MiB * 1024 * 1024
|
|
|
|
|
|
|
|
#define ASSERT assert
|