Browse Source

port.h: split common and posix defines

pull/2/head
mittorn 5 years ago
parent
commit
fe07c48431
  1. 27
      common/port.h

27
common/port.h

@ -20,14 +20,10 @@ GNU General Public License for more details. @@ -20,14 +20,10 @@ GNU General Public License for more details.
#include "build.h"
#if !XASH_WIN32
#include <dlfcn.h>
#include <unistd.h>
#define PATH_SPLITTER "/"
#if XASH_APPLE
#include <sys/syslimits.h>
#include "TargetConditionals.h"
#define OS_LIB_EXT "dylib"
#define OPEN_COMMAND "open"
#else
@ -54,20 +50,35 @@ GNU General Public License for more details. @@ -54,20 +50,35 @@ GNU General Public License for more details.
#define _inline static inline
#define FORCEINLINE inline __attribute__((always_inline))
#if XASH_POSIX
#define PATH_SPLITTER "/"
#include <unistd.h>
#include <dlfcn.h>
#define O_BINARY 0 // O_BINARY is Windows extension
#define O_TEXT 0 // O_TEXT is Windows extension
// Windows functions to Linux equivalent
// Windows functions to posix equivalent
#define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH )
#define LoadLibrary( x ) dlopen( x, RTLD_NOW )
#define GetProcAddress( x, y ) dlsym( x, y )
#define SetCurrentDirectory( x ) (!chdir( x ))
#define FreeLibrary( x ) dlclose( x )
#define tell( a ) lseek(a, 0, SEEK_CUR)
#define HAVE_DUP
#endif
#if XASH_DOS4GW
#define PATH_SPLITTER "\\"
#define LoadLibrary( x ) (0)
#define GetProcAddress( x, y ) (0)
#define FreeLibrary( x ) (0)
#define SetCurrentDirectory( x ) (!chdir( x ))
#endif
//#define MAKEWORD( a, b ) ((short int)(((unsigned char)(a))|(((short int)((unsigned char)(b)))<<8)))
#define max( a, b ) (((a) > (b)) ? (a) : (b))
#define min( a, b ) (((a) < (b)) ? (a) : (b))
#define tell( a ) lseek(a, 0, SEEK_CUR)
/// TODO: check if we may clean this defines, it should not appear in non-platform code!
typedef unsigned char BYTE;
typedef short int WORD;
typedef unsigned int DWORD;
@ -125,6 +136,8 @@ GNU General Public License for more details. @@ -125,6 +136,8 @@ GNU General Public License for more details.
// windows NameForFunction not implemented yet
#define XASH_ALLOW_SAVERESTORE_OFFSETS
#endif
#define HAVE_DUP
#endif //WIN32
#ifndef XASH_LOW_MEMORY
#define XASH_LOW_MEMORY 0

Loading…
Cancel
Save