cleaned up posix makefile

This commit is contained in:
jeefo 2016-09-13 22:40:06 +03:00
commit 8155d08769
7 changed files with 142 additions and 117 deletions

View file

@ -41,6 +41,31 @@ typedef unsigned long uint32;
template <typename T> inline T A_min (T a, T b) { return a < b ? a : b; }
template <typename T> inline T A_max (T a, T b) { return a > b ? a : b; }
// Fast stricmp got somewhere from chromium
static inline int A_stricmp (const char *str1, const char *str2, int length = -1)
{
int iter = 0;
if (length == -1)
length = strlen (str2);
for (; iter < length; iter++)
{
if ((str1[iter] | 32) != (str2[iter] | 32))
break;
}
if (iter != length)
return 1;
return 0;
}
// Cross platform strdup
static inline char *A_strdup (const char *str)
{
return strcpy (new char[strlen (str) + 1], str);
}
//
// Title: Utility Classes Header
//

View file

@ -225,17 +225,6 @@ static inline void STOP_SOUND (edict_t *entity, int channel, const char *sample)
EMIT_SOUND_DYN (entity, channel, sample, 0, 0, SND_STOP, PITCH_NORM);
}
/// ///
// Bot Additions //
/// ///
// removes linker warning when using msvcrt library
#if defined ( _MSC_VER )
#define stricmp _stricmp
#define unlink _unlink
#define mkdir _mkdir
#endif
// macro to handle memory allocation fails
#define TerminateOnMalloc() \
AddLogEntry (true, LL_FATAL, "Memory Allocation Fail!\nFile: %s (Line: %d)", __FILE__, __LINE__) \

View file

@ -56,11 +56,11 @@
#pragma comment (linker, "/SECTION:.data,RW")
#endif
typedef int (FAR *EntityAPI_t) (gamefuncs_t *, int);
typedef int (FAR *NewEntityAPI_t) (newgamefuncs_t *, int *);
typedef int (FAR *BlendAPI_t) (int, void **, void *, float (*)[3][4], float (*)[128][3][4]);
typedef void (__stdcall *FuncPointers_t) (enginefuncs_t *, globalvars_t *);
typedef void (FAR *EntityPtr_t) (entvars_t *);
typedef int (*GetEntityApi2_FN) (gamefuncs_t *, int);
typedef int (*GetNewEntityApi_FN) (newgamefuncs_t *, int *);
typedef int (*GetBlendingInterface_FN) (int, void **, void *, float (*)[3][4], float (*)[128][3][4]);
typedef void (*Entity_FN) (entvars_t *);
typedef void (__stdcall *GiveFnptrsToDll_FN) (enginefuncs_t *, globalvars_t *);
#elif defined (PLATFORM_LINUX) || defined (PLATFORM_OSX)
@ -82,15 +82,17 @@
#define DLL_GIVEFNPTRSTODLL extern "C" void __attribute__((visibility("default")))
#if defined (__ANDROID__)
#define PLATFORM_ANDROID 1
#define PLATFORM_ANDROID 1
#endif
typedef int (*EntityAPI_t) (gamefuncs_t *, int);
typedef int (*NewEntityAPI_t) (newgamefuncs_t *, int *);
typedef int (*BlendAPI_t) (int, void **, void *, float (*)[3][4], float (*)[128][3][4]);
typedef void (*FuncPointers_t) (enginefuncs_t *, globalvars_t *);
typedef void (*EntityPtr_t) (entvars_t *);
typedef int (*GetEntityApi2_FN) (gamefuncs_t *, int);
typedef int (*GetNewEntityApi_FN) (newgamefuncs_t *, int *);
typedef int (*GetBlendingInterface_FN) (int, void **, void *, float (*)[3][4], float (*)[128][3][4]);
typedef void (*Entity_FN) (entvars_t *);
typedef void (*GiveFnptrsToDll_FN) (enginefuncs_t *, globalvars_t *);
// posix compatibility
#define _unlink unlink
#else
#error "Platform unrecognized."
#endif