SourceMod SDK  1.7
sm_platform.h
Go to the documentation of this file.
1 
32 #ifndef _INCLUDE_SOURCEMOD_PLATFORM_H_
33 #define _INCLUDE_SOURCEMOD_PLATFORM_H_
34 
40 #if defined WIN32 || defined WIN64
41 #ifndef PLATFORM_WINDOWS
42 #define PLATFORM_WINDOWS 1
43 #endif
44 #if !defined WIN32_LEAN_AND_MEAN
45 #define WIN32_LEAN_AND_MEAN
46 #endif
47 #if !defined snprintf
48 #define snprintf _snprintf
49 #endif
50 #if !defined stat
51 #define stat _stat
52 #endif
53 #define strcasecmp strcmpi
54 #define strncasecmp strnicmp
55 #include <windows.h>
56 #include <direct.h>
57 #define PLATFORM_LIB_EXT "dll"
58 #define PLATFORM_MAX_PATH MAX_PATH
59 #define PLATFORM_SEP_CHAR '\\'
60 #define PLATFORM_SEP_ALTCHAR '/'
61 #define PLATFORM_EXTERN_C extern "C" __declspec(dllexport)
62 #if defined _MSC_VER && _MSC_VER >= 1400
63 #define SUBPLATFORM_SECURECRT
64 #endif
65 #elif defined __linux__ || defined __APPLE__
66 #if defined __linux__
67 # define PLATFORM_LINUX 1
68 # define PLATFORM_LIB_EXT "so"
69 #elif defined __APPLE__
70 # define PLATFORM_APPLE 1
71 # define PLATFORM_LIB_EXT "dylib"
72 #endif
73 #ifndef PLATFORM_POSIX
74 # define PLATFORM_POSIX 1
75 #endif
76 #include <errno.h>
77 #include <unistd.h>
78 #include <dirent.h>
79 #include <dlfcn.h>
80 #include <sys/stat.h>
81 #if defined PLATFORM_APPLE
82 #include <sys/syslimits.h>
83 #endif
84 #define PLATFORM_MAX_PATH PATH_MAX
85 #define PLATFORM_SEP_CHAR '/'
86 #define PLATFORM_SEP_ALTCHAR '\\'
87 #define PLATFORM_EXTERN_C extern "C" __attribute__((visibility("default")))
88 #endif
89 
90 #if !defined SOURCEMOD_BUILD
91 #define SOURCEMOD_BUILD
92 #endif
93 
94 #if !defined SM_ARRAYSIZE
95 #define SM_ARRAYSIZE(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
96 #endif
97 
98 #endif //_INCLUDE_SOURCEMOD_PLATFORM_H_
99