177 lines
3.5 KiB
C++
177 lines
3.5 KiB
C++
#ifndef __INC_LIBTHECORE_STDAFX_H__
|
|
#define __INC_LIBTHECORE_STDAFX_H__
|
|
|
|
#if !defined(CXX11_ENABLED) && __cplusplus >= 201103L
|
|
#define CXX11_ENABLED
|
|
#endif
|
|
|
|
#if !defined(_HAS_CXX11) && __cplusplus >= 201103L
|
|
#define _HAS_CXX11
|
|
#endif
|
|
|
|
#if !defined(_HAS_CXX14) && __cplusplus >= 201402L
|
|
#define _HAS_CXX14
|
|
#endif
|
|
|
|
#if !defined(_HAS_CXX17) && __cplusplus > 201402L
|
|
#define _HAS_CXX17
|
|
#endif
|
|
|
|
#if !defined(_HAS_CXX20) && __cplusplus > 201703L
|
|
#define _HAS_CXX20
|
|
#endif
|
|
|
|
#if defined(__clang__) || defined(_HAS_CXX11)
|
|
# ifndef __STDC_LIMIT_MACROS
|
|
# define __STDC_LIMIT_MACROS
|
|
# endif
|
|
# include <cinttypes>
|
|
# include <cstdint>
|
|
#else
|
|
# include <inttypes.h>
|
|
# include <stdint.h>
|
|
# ifndef INT64_MAX
|
|
# define INT64_MAX 0x7fFFffFFffFFffFFLL
|
|
# endif
|
|
#endif
|
|
|
|
#if defined(__GNUC__)
|
|
#define INLINE __inline__
|
|
#elif defined(_MSC_VER)
|
|
#define INLINE inline
|
|
#endif
|
|
|
|
#ifdef __WIN32__
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#include <windows.h>
|
|
#include <winsock2.h>
|
|
#include <tchar.h>
|
|
#include <errno.h>
|
|
#include <time.h>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <assert.h>
|
|
#include <conio.h>
|
|
#include <process.h>
|
|
#include <limits.h>
|
|
#include <math.h>
|
|
#include <locale.h>
|
|
#include <io.h>
|
|
#include <direct.h>
|
|
#include <fcntl.h>
|
|
|
|
#include "xdirent.h"
|
|
#include "xgetopt.h"
|
|
|
|
#define S_ISDIR(m) (m & _S_IFDIR)
|
|
|
|
#ifndef WIN32
|
|
struct timespec
|
|
{
|
|
time_t tv_sec; /* seconds */
|
|
long tv_nsec; /* and nanoseconds */
|
|
};
|
|
#define strtof(str, endptr) (float)strtod(str, endptr)
|
|
#endif
|
|
|
|
#define __USE_SELECT__
|
|
|
|
#define PATH_MAX _MAX_PATH
|
|
|
|
// C runtime library adjustments
|
|
#define strlcat(dst, src, size) strcat_s(dst, size, src)
|
|
#define strlcpy(dst, src, size) strncpy_s(dst, size, src, _TRUNCATE)
|
|
#define strtoull(str, endptr, base) _strtoui64(str, endptr, base)
|
|
#define strcasecmp(s1, s2) stricmp(s1, s2)
|
|
#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
|
|
#define atoll(str) _atoi64(str)
|
|
#define localtime_r(timet, result) localtime_s(result, timet)
|
|
#define strtok_r(s, delim, ptrptr) strtok_s(s, delim, ptrptr)
|
|
|
|
#include <boost/typeof/typeof.hpp>
|
|
#define typeof(t) BOOST_TYPEOF(t)
|
|
|
|
// dummy declaration of non-supported signals
|
|
#define SIGUSR1 30 /* user defined signal 1 */
|
|
#define SIGUSR2 31 /* user defined signal 2 */
|
|
|
|
inline void usleep(unsigned long usec) {
|
|
::Sleep(usec / 1000);
|
|
}
|
|
inline unsigned sleep(unsigned sec) {
|
|
::Sleep(sec * 1000);
|
|
return 0;
|
|
}
|
|
inline double rint(double x)
|
|
{
|
|
return ::floor(x+.5);
|
|
}
|
|
|
|
#else
|
|
|
|
#ifndef __FreeBSD__
|
|
#define __USE_SELECT__
|
|
#ifdef __CYGWIN__
|
|
#define _POSIX_SOURCE 1
|
|
#endif
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdarg.h>
|
|
#include <errno.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
#include <assert.h>
|
|
#include <ctype.h>
|
|
#include <limits.h>
|
|
#include <dirent.h>
|
|
|
|
#include <sys/time.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/types.h>
|
|
|
|
#include <netinet/in.h>
|
|
#include <arpa/inet.h>
|
|
#include <netdb.h>
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/signal.h>
|
|
#include <sys/wait.h>
|
|
|
|
#include <pthread.h>
|
|
#include <semaphore.h>
|
|
|
|
#ifdef __FreeBSD__
|
|
#include <sys/event.h>
|
|
#endif
|
|
|
|
#define typeof(x) __typeof__(x)
|
|
#endif
|
|
|
|
#ifndef FALSE
|
|
#define FALSE false
|
|
#define TRUE true
|
|
#endif
|
|
|
|
#include "typedef.h"
|
|
#include "heart.h"
|
|
#include "fdwatch.h"
|
|
#include "socket.h"
|
|
#include "kstbl.h"
|
|
#include "hangul.h"
|
|
#include "buffer.h"
|
|
#include "signal.h"
|
|
#include "log.h"
|
|
#include "main.h"
|
|
#include "utils.h"
|
|
#include "crypt.h"
|
|
#include "memcpy.h"
|
|
|
|
#endif // __INC_LIBTHECORE_STDAFX_H__
|
|
//martysama0134's 623a0779c74cb7565145d45548376308
|