mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2024-12-23 01:59:43 +08:00
More portions of L4D2 SDK compile and link on Mac OS X (bug 4646, r=dvander).
This commit is contained in:
parent
1d2bcd2337
commit
f12130c3a9
@ -1,5 +1,6 @@
|
||||
# Binaries
|
||||
\.dll$
|
||||
\.dylib$
|
||||
\.exe$
|
||||
\.so$
|
||||
vcpm$
|
||||
@ -14,3 +15,10 @@ vcpm$
|
||||
/Debug.*
|
||||
/Release.*
|
||||
/obj.*
|
||||
|
||||
# Files generated by Mac OS X Finder
|
||||
(^|/)\.DS_Store$
|
||||
|
||||
# Files generated by Windows Explorer
|
||||
(^|/)[dD]esktop\.ini$
|
||||
(^|/)[tT]humbs\.db$
|
||||
|
@ -84,7 +84,7 @@ typedef enum
|
||||
//} xverbose_e;
|
||||
|
||||
typedef unsigned short WORD;
|
||||
#ifndef _LINUX
|
||||
#if !defined _LINUX && !defined __APPLE__
|
||||
typedef unsigned long DWORD;
|
||||
typedef void* HANDLE;
|
||||
#endif
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "eiface.h"
|
||||
#endif
|
||||
|
||||
#ifdef _LINUX
|
||||
#if defined _LINUX || defined __APPLE__
|
||||
#define random random_valve// stdlib.h defined random()..., and so does vstdlib/random.h
|
||||
#endif
|
||||
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
// Template specializations for type Vector, so we can implement Get, Set, and Init differently.
|
||||
//
|
||||
template<>
|
||||
class CEntityOutputTemplate<class Vector, FIELD_VECTOR> : public CBaseEntityOutput
|
||||
class CEntityOutputTemplate<Vector, FIELD_VECTOR> : public CBaseEntityOutput
|
||||
{
|
||||
public:
|
||||
void Init( const Vector &value )
|
||||
@ -150,7 +150,7 @@ public:
|
||||
|
||||
|
||||
template<>
|
||||
class CEntityOutputTemplate<class Vector, FIELD_POSITION_VECTOR> : public CBaseEntityOutput
|
||||
class CEntityOutputTemplate<Vector, FIELD_POSITION_VECTOR> : public CBaseEntityOutput
|
||||
{
|
||||
public:
|
||||
void Init( const Vector &value )
|
||||
|
BIN
lib/mac/libtier0.dylib
Normal file
BIN
lib/mac/libtier0.dylib
Normal file
Binary file not shown.
BIN
lib/mac/libvstdlib.dylib
Normal file
BIN
lib/mac/libvstdlib.dylib
Normal file
Binary file not shown.
BIN
lib/mac/mathlib_i486.a
Normal file
BIN
lib/mac/mathlib_i486.a
Normal file
Binary file not shown.
BIN
lib/mac/tier1_i486.a
Normal file
BIN
lib/mac/tier1_i486.a
Normal file
Binary file not shown.
@ -39,7 +39,7 @@ float _3DNow_Sqrt(float x)
|
||||
movd root, mm0
|
||||
femms
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
__asm __volatile__( "femms" );
|
||||
__asm __volatile__
|
||||
(
|
||||
@ -98,7 +98,7 @@ float FASTCALL _3DNow_VectorNormalize (Vector& vec)
|
||||
movd radius, mm1
|
||||
femms
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
long long a,c;
|
||||
int b,d;
|
||||
memcpy(&a,&vec[0],sizeof(a));
|
||||
@ -164,7 +164,7 @@ float _3DNow_InvRSquared(const float* v)
|
||||
movd [r2], mm0
|
||||
femms
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
long long a,c;
|
||||
int b;
|
||||
memcpy(&a,&v[0],sizeof(a));
|
||||
|
@ -35,7 +35,7 @@ static const uint32 _sincos_inv_masks[] = { (uint32)~0x0, (uint32)0x0 };
|
||||
|
||||
#define _PS_CONST(Name, Val) \
|
||||
static const __declspec(align(16)) float _ps_##Name[4] = { Val, Val, Val, Val }
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
#define _PS_EXTERN_CONST(Name, Val) \
|
||||
const __attribute__((aligned(16))) float _ps_##Name[4] = { Val, Val, Val, Val }
|
||||
|
||||
@ -90,7 +90,7 @@ float _SSE_Sqrt(float x)
|
||||
sqrtss xmm0, x
|
||||
movss root, xmm0
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
__asm__ __volatile__(
|
||||
"movss %1,%%xmm2\n"
|
||||
"sqrtss %%xmm2,%%xmm1\n"
|
||||
@ -143,7 +143,7 @@ float _SSE_RSqrtAccurate(float a)
|
||||
|
||||
movss x, xmm1;
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
__asm__ __volatile__(
|
||||
"movss %1, %%xmm3 \n\t"
|
||||
"movss %2, %%xmm1 \n\t"
|
||||
@ -179,7 +179,7 @@ float _SSE_RSqrtFast(float x)
|
||||
rsqrtss xmm0, x
|
||||
movss rroot, xmm0
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
__asm__ __volatile__(
|
||||
"rsqrtss %1, %%xmm0 \n\t"
|
||||
"movss %%xmm0, %0 \n\t"
|
||||
@ -202,7 +202,7 @@ float FASTCALL _SSE_VectorNormalize (Vector& vec)
|
||||
// sice vec only has 3 floats, we can't "movaps" directly into it.
|
||||
#ifdef _WIN32
|
||||
__declspec(align(16)) float result[4];
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
__attribute__((aligned(16))) float result[4];
|
||||
#endif
|
||||
|
||||
@ -239,7 +239,7 @@ float FASTCALL _SSE_VectorNormalize (Vector& vec)
|
||||
mulps xmm4, xmm1 // r4 = vx * 1/radius, vy * 1/radius, vz * 1/radius, X
|
||||
movaps [edx], xmm4 // v = vx * 1/radius, vy * 1/radius, vz * 1/radius, X
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
__asm__ __volatile__(
|
||||
#ifdef ALIGNED_VECTOR
|
||||
"movaps %2, %%xmm4 \n\t"
|
||||
@ -307,7 +307,7 @@ float _SSE_InvRSquared(const float* v)
|
||||
rcpss xmm0, xmm1 // x0 = 1 / max( 1.0, x1 )
|
||||
movss inv_r2, xmm0 // inv_r2 = x0
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
__asm__ __volatile__(
|
||||
#ifdef ALIGNED_VECTOR
|
||||
"movaps %1, %%xmm4 \n\t"
|
||||
@ -421,7 +421,7 @@ void _SSE_SinCos(float x, float* s, float* c)
|
||||
movss [eax], xmm0
|
||||
movss [edx], xmm4
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
// #warning "_SSE_sincos NOT implemented!"
|
||||
#else
|
||||
#error "Not Implemented"
|
||||
@ -479,7 +479,7 @@ float _SSE_cos( float x )
|
||||
movss x, xmm0
|
||||
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
// #warning "_SSE_cos NOT implemented!"
|
||||
#else
|
||||
#error "Not Implemented"
|
||||
@ -569,7 +569,7 @@ void _SSE2_SinCos(float x, float* s, float* c) // any x
|
||||
movss [eax], xmm0
|
||||
movss [edx], xmm6
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
// #warning "_SSE2_SinCos NOT implemented!"
|
||||
#else
|
||||
#error "Not Implemented"
|
||||
@ -624,7 +624,7 @@ float _SSE2_cos(float x)
|
||||
mulss xmm0, xmm1
|
||||
movss x, xmm0
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
// #warning "_SSE2_cos NOT implemented!"
|
||||
#else
|
||||
#error "Not Implemented"
|
||||
@ -681,7 +681,7 @@ void VectorTransformSSE(const float *in1, const matrix3x4_t& in2, float *out1)
|
||||
addss xmm0, [ecx+12]
|
||||
movss [edx+8], xmm0;
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
// #warning "VectorTransformSSE C implementation only"
|
||||
out1[0] = DotProduct(in1, in2[0]) + in2[0][3];
|
||||
out1[1] = DotProduct(in1, in2[1]) + in2[1][3];
|
||||
@ -735,7 +735,7 @@ void VectorRotateSSE( const float *in1, const matrix3x4_t& in2, float *out1 )
|
||||
addss xmm0, xmm2;
|
||||
movss [edx+8], xmm0;
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
// #warning "VectorRotateSSE C implementation only"
|
||||
out1[0] = DotProduct( in1, in2[0] );
|
||||
out1[1] = DotProduct( in1, in2[1] );
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <direct.h>
|
||||
#include <io.h>
|
||||
#include <process.h>
|
||||
#elif defined( _LINUX )
|
||||
#elif defined( _LINUX ) || defined ( __APPLE__ )
|
||||
#include <unistd.h>
|
||||
#define _putenv putenv
|
||||
#define _chdir chdir
|
||||
|
@ -327,7 +327,7 @@ void inline SinCos( float radians, float *sine, float *cosine )
|
||||
fstp DWORD PTR [edx]
|
||||
fstp DWORD PTR [eax]
|
||||
}
|
||||
#elif defined( _LINUX )
|
||||
#elif defined ( _LINUX ) || defined ( __APPLE__ )
|
||||
register double __cosr, __sinr;
|
||||
__asm __volatile__
|
||||
("fsincos"
|
||||
@ -1091,7 +1091,7 @@ FORCEINLINE int RoundFloatToInt(float f)
|
||||
fld f
|
||||
fistp nResult
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
__asm __volatile__ (
|
||||
"fistpl %0;": "=m" (nResult): "t" (f) : "st"
|
||||
);
|
||||
@ -1128,7 +1128,7 @@ FORCEINLINE unsigned char RoundFloatToByte(float f)
|
||||
fld f
|
||||
fistp nResult
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
__asm __volatile__ (
|
||||
"fistpl %0;": "=m" (nResult): "t" (f) : "st"
|
||||
);
|
||||
@ -1167,7 +1167,7 @@ FORCEINLINE unsigned long RoundFloatToUnsignedLong(float f)
|
||||
fld f
|
||||
fistp qword ptr nResult
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
__asm __volatile__ (
|
||||
"fistpl %0;": "=m" (nResult): "t" (f) : "st"
|
||||
);
|
||||
@ -1212,7 +1212,7 @@ FORCEINLINE int Float2Int( float a )
|
||||
fistp RetVal // Store and converted (to int) result
|
||||
fldcw CtrlwdHolder // Restore control word
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
RetVal = static_cast<int>( a );
|
||||
#endif
|
||||
|
||||
@ -1242,7 +1242,7 @@ inline int Floor2Int( float a )
|
||||
fistp RetVal // Store floored and converted (to int) result
|
||||
fldcw CtrlwdHolder // Restore control word
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
RetVal = static_cast<int>( floor(a) );
|
||||
#endif
|
||||
|
||||
@ -1300,7 +1300,7 @@ inline int Ceil2Int( float a )
|
||||
fistp RetVal // Store floored and converted (to int) result
|
||||
fldcw CtrlwdHolder // Restore control word
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
RetVal = static_cast<int>( ceil(a) );
|
||||
#endif
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <mathlib/vector.h>
|
||||
#include <mathlib/mathlib.h>
|
||||
|
||||
#if defined(_LINUX)
|
||||
#if defined(_LINUX) || defined(__APPLE__)
|
||||
#define USE_STDC_FOR_SIMD 0
|
||||
#else
|
||||
#define USE_STDC_FOR_SIMD 0
|
||||
@ -1813,7 +1813,7 @@ FORCEINLINE fltx4 ReplicateX4( float flValue )
|
||||
FORCEINLINE float SubFloat( const fltx4 & a, int idx )
|
||||
{
|
||||
// NOTE: if the output goes into a register, this causes a Load-Hit-Store stall (don't mix fpu/vpu math!)
|
||||
#ifndef _LINUX
|
||||
#if !defined _LINUX && !defined __APPLE__
|
||||
return a.m128_f32[ idx ];
|
||||
#else
|
||||
return (reinterpret_cast<float const *>(&a))[idx];
|
||||
@ -1822,7 +1822,7 @@ FORCEINLINE float SubFloat( const fltx4 & a, int idx )
|
||||
|
||||
FORCEINLINE float & SubFloat( fltx4 & a, int idx )
|
||||
{
|
||||
#ifndef _LINUX
|
||||
#if !defined _LINUX && !defined __APPLE__
|
||||
return a.m128_f32[ idx ];
|
||||
#else
|
||||
return (reinterpret_cast<float *>(&a))[idx];
|
||||
@ -1836,7 +1836,7 @@ FORCEINLINE uint32 SubFloatConvertToInt( const fltx4 & a, int idx )
|
||||
|
||||
FORCEINLINE uint32 SubInt( const fltx4 & a, int idx )
|
||||
{
|
||||
#ifndef _LINUX
|
||||
#if !defined _LINUX && !defined __APPLE__
|
||||
return a.m128_u32[idx];
|
||||
#else
|
||||
return (reinterpret_cast<uint32 const *>(&a))[idx];
|
||||
@ -1845,7 +1845,7 @@ FORCEINLINE uint32 SubInt( const fltx4 & a, int idx )
|
||||
|
||||
FORCEINLINE uint32 & SubInt( fltx4 & a, int idx )
|
||||
{
|
||||
#ifndef _LINUX
|
||||
#if !defined _LINUX && !defined __APPLE__
|
||||
return a.m128_u32[idx];
|
||||
#else
|
||||
return (reinterpret_cast<uint32 *>(&a))[idx];
|
||||
|
@ -134,7 +134,7 @@ const Vector4D vec4_invalid( FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX );
|
||||
|
||||
#ifdef _WIN32
|
||||
class __declspec(align(16)) Vector4DAligned : public Vector4D
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
class __attribute__((aligned(16))) Vector4DAligned : public Vector4D
|
||||
#endif
|
||||
{
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef _LINUX
|
||||
#if defined _LINUX || defined __APPLE__
|
||||
#define __cdecl
|
||||
#endif
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
// feature enables
|
||||
#define NEW_SOFTWARE_LIGHTING
|
||||
|
||||
#ifdef _LINUX
|
||||
#if defined(_LINUX) || defined(__APPLE__)
|
||||
// need this for _alloca
|
||||
#include <alloca.h>
|
||||
#endif // _LINUX
|
||||
@ -93,7 +93,7 @@
|
||||
#define IsX360() true
|
||||
#define IsPS3() false
|
||||
#endif
|
||||
#elif defined(_LINUX)
|
||||
#elif defined(_LINUX) || defined(__APPLE__)
|
||||
#define IsPC() true
|
||||
#define IsConsole() false
|
||||
#define IsX360() false
|
||||
@ -242,7 +242,7 @@ FIXME: Enable this when we no longer fear change =)
|
||||
#define __i386__ 1
|
||||
#endif
|
||||
|
||||
#elif _LINUX
|
||||
#elif defined(_LINUX) || defined(__APPLE__)
|
||||
typedef unsigned int DWORD;
|
||||
typedef unsigned short WORD;
|
||||
typedef void * HINSTANCE;
|
||||
@ -286,7 +286,7 @@ typedef void * HINSTANCE;
|
||||
#ifdef _WIN32
|
||||
#define DECL_ALIGN(x) __declspec(align(x))
|
||||
|
||||
#elif _LINUX
|
||||
#elif defined(_LINUX) || defined(__APPLE__)
|
||||
#define DECL_ALIGN(x) __attribute__((aligned(x)))
|
||||
#else
|
||||
#define DECL_ALIGN(x) /* */
|
||||
@ -300,7 +300,7 @@ typedef void * HINSTANCE;
|
||||
|
||||
// Linux had a few areas where it didn't construct objects in the same order that Windows does.
|
||||
// So when CVProfile::CVProfile() would access g_pMemAlloc, it would crash because the allocator wasn't initalized yet.
|
||||
#ifdef _LINUX
|
||||
#if defined(_LINUX) || defined(__APPLE__)
|
||||
#define CONSTRUCT_EARLY __attribute__((init_priority(101)))
|
||||
#else
|
||||
#define CONSTRUCT_EARLY
|
||||
@ -308,7 +308,7 @@ typedef void * HINSTANCE;
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SELECTANY __declspec(selectany)
|
||||
#elif _LINUX
|
||||
#elif defined(_LINUX) || defined(__APPLE__)
|
||||
#define SELECTANY __attribute__((weak))
|
||||
#else
|
||||
#define SELECTANY static
|
||||
@ -328,7 +328,7 @@ typedef void * HINSTANCE;
|
||||
#define DLL_GLOBAL_EXPORT extern __declspec( dllexport )
|
||||
#define DLL_GLOBAL_IMPORT extern __declspec( dllimport )
|
||||
|
||||
#elif defined _LINUX
|
||||
#elif defined(_LINUX) || defined(__APPLE__)
|
||||
// Used for dll exporting and importing
|
||||
#define DLL_EXPORT extern "C" __attribute__ ((visibility("default")))
|
||||
#define DLL_IMPORT extern "C"
|
||||
@ -403,7 +403,7 @@ typedef void * HINSTANCE;
|
||||
// Alloca defined for this platform
|
||||
#define stackalloc( _size ) _alloca( ALIGN_VALUE( _size, 16 ) )
|
||||
#define stackfree( _p )
|
||||
#elif _LINUX
|
||||
#elif defined(_LINUX) || defined(__APPLE__)
|
||||
// Alloca defined for this platform
|
||||
#define stackalloc( _size ) _alloca( ALIGN_VALUE( _size, 16 ) )
|
||||
#define stackfree( _p )
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "tier0/dbg.h"
|
||||
#include "tier0/vcrmode.h"
|
||||
|
||||
#ifdef _LINUX
|
||||
#if defined _LINUX || defined __APPLE__
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
#endif
|
||||
@ -69,7 +69,7 @@ const unsigned TT_INFINITE = 0xffffffff;
|
||||
#ifndef THREAD_LOCAL
|
||||
#ifdef _WIN32
|
||||
#define THREAD_LOCAL __declspec(thread)
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
#define THREAD_LOCAL __thread
|
||||
#endif
|
||||
#endif
|
||||
@ -117,7 +117,7 @@ inline void ThreadPause()
|
||||
{
|
||||
#if defined( _WIN32 ) && !defined( _X360 )
|
||||
__asm pause;
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
__asm __volatile("pause");
|
||||
#elif defined( _X360 )
|
||||
#else
|
||||
@ -154,7 +154,7 @@ inline int ThreadWaitForObject( HANDLE handle, bool bWaitAll = true, unsigned ti
|
||||
|
||||
#ifdef _WIN32
|
||||
#define NOINLINE
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
#define NOINLINE __attribute__ ((noinline))
|
||||
#endif
|
||||
|
||||
@ -270,7 +270,7 @@ public:
|
||||
private:
|
||||
#ifdef _WIN32
|
||||
uint32 m_index;
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
pthread_key_t m_index;
|
||||
#endif
|
||||
};
|
||||
@ -518,7 +518,7 @@ private:
|
||||
#endif // !_XBOX
|
||||
#endif // _WIN64
|
||||
byte m_CriticalSection[TT_SIZEOF_CRITICALSECTION];
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
pthread_mutex_t m_Mutex;
|
||||
pthread_mutexattr_t m_Attr;
|
||||
#else
|
||||
@ -812,7 +812,7 @@ protected:
|
||||
|
||||
#ifdef _WIN32
|
||||
HANDLE m_hSyncObject;
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
pthread_mutex_t m_Mutex;
|
||||
pthread_cond_t m_Condition;
|
||||
bool m_bInitalized;
|
||||
@ -914,7 +914,7 @@ public:
|
||||
private:
|
||||
CThreadEvent( const CThreadEvent & );
|
||||
CThreadEvent &operator=( const CThreadEvent & );
|
||||
#ifdef _LINUX
|
||||
#if defined _LINUX || defined __APPLE__
|
||||
CInterlockedInt m_cSet;
|
||||
#endif
|
||||
};
|
||||
@ -931,7 +931,7 @@ public:
|
||||
|
||||
inline int ThreadWaitForEvents( int nEvents, const CThreadEvent *pEvents, bool bWaitAll = true, unsigned timeout = TT_INFINITE )
|
||||
{
|
||||
#ifdef _LINUX
|
||||
#if defined _LINUX || defined __APPLE__
|
||||
Assert(0);
|
||||
return 0;
|
||||
#else
|
||||
@ -1150,7 +1150,7 @@ private:
|
||||
#ifdef _WIN32
|
||||
HANDLE m_hThread;
|
||||
ThreadId_t m_threadId;
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
pthread_t m_threadId;
|
||||
#endif
|
||||
int m_result;
|
||||
@ -1404,7 +1404,7 @@ inline void CThreadMutex::SetTrace( bool bTrace )
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
|
||||
inline CThreadMutex::CThreadMutex()
|
||||
{
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "tier0/vcr_shared.h"
|
||||
#include "tier0/dbg.h"
|
||||
|
||||
#ifdef _LINUX
|
||||
#if defined _LINUX || defined __APPLE__
|
||||
DBG_INTERFACE void BuildCmdLine( int argc, tchar **argv );
|
||||
tchar *GetCommandLine();
|
||||
#endif
|
||||
|
@ -23,7 +23,7 @@
|
||||
#if defined _WIN32 && !defined _WCHAR_T_DEFINED
|
||||
typedef unsigned short wchar_t;
|
||||
#define _WCHAR_T_DEFINED
|
||||
#elif defined _LINUX && !defined __WCHAR_TYPE__
|
||||
#elif (defined _LINUX || defined __APPLE__) && !defined __WCHAR_TYPE__
|
||||
typedef unsigned short wchar_t;
|
||||
#define __WCHAR_TYPE__
|
||||
#endif
|
||||
|
@ -1486,7 +1486,7 @@ public:
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _LINUX
|
||||
#if defined _LINUX || defined __APPLE__
|
||||
WRAP_READ( old_bf_read );
|
||||
#else
|
||||
WRAP_READ( CBitRead );
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#define FORCEINLINE_CVAR FORCEINLINE
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
#define FORCEINLINE_CVAR inline
|
||||
#else
|
||||
#error "implement me"
|
||||
|
@ -36,7 +36,7 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifdef _LINUX
|
||||
#if defined _LINUX || defined __APPLE__
|
||||
#include <dlfcn.h> // dlopen,dlclose, et al
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#elif _LINUX
|
||||
#elif defined(_LINUX) || defined(__APPLE__)
|
||||
#include <ctype.h>
|
||||
#include <wchar.h>
|
||||
#include <math.h>
|
||||
@ -25,7 +25,7 @@
|
||||
template< class T, class I > class CUtlMemory;
|
||||
template< class T, class A > class CUtlVector;
|
||||
|
||||
#ifdef _LINUX
|
||||
#if defined(_LINUX) || defined(__APPLE__)
|
||||
inline char *strupr( char *start )
|
||||
{
|
||||
char *str = start;
|
||||
@ -167,14 +167,14 @@ typedef char * va_list;
|
||||
|
||||
#endif // _VA_LIST_DEFINED
|
||||
|
||||
#elif _LINUX
|
||||
#elif defined(_LINUX) || defined(__APPLE__)
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define CORRECT_PATH_SEPARATOR '\\'
|
||||
#define INCORRECT_PATH_SEPARATOR '/'
|
||||
#elif _LINUX
|
||||
#elif defined(_LINUX) || defined(__APPLE__)
|
||||
#define CORRECT_PATH_SEPARATOR '/'
|
||||
#define INCORRECT_PATH_SEPARATOR '\\'
|
||||
#endif
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
|
||||
inline int GetErrorCount(void);
|
||||
|
||||
#ifndef _LINUX
|
||||
#if !defined _LINUX && !defined __APPLE__
|
||||
inline TokenReader(TokenReader const &)
|
||||
{
|
||||
// prevent vc7 warning. compiler can't generate a copy constructor since descended from
|
||||
|
@ -80,7 +80,7 @@ void SetDefLessFunc( RBTREE_T &RBTree )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
RBTree.SetLessFunc( DefLessFunc( RBTREE_T::KeyType_t ) );
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
RBTree.SetLessFunc( DefLessFunc( typename RBTREE_T::KeyType_t ) );
|
||||
#endif
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#if defined( _WIN32 ) && !defined( _X360 )
|
||||
#include <windows.h> // for WideCharToMultiByte and MultiByteToWideChar
|
||||
#elif defined(_LINUX)
|
||||
#elif defined( _LINUX ) || defined( __APPLE__ )
|
||||
#include <wchar.h> // wcslen()
|
||||
#define _alloca alloca
|
||||
#endif
|
||||
|
@ -51,8 +51,8 @@ void CByteswap::SwapFieldToTargetEndian( void* pOutputBuffer, void *pData, typed
|
||||
typedescription_t *pEmbed = pField->td->dataDesc;
|
||||
for ( int i = 0; i < pField->fieldSize; ++i )
|
||||
{
|
||||
SwapFieldsToTargetEndian( (byte*)pOutputBuffer + pEmbed->fieldOffset[ TD_OFFSET_NORMAL ],
|
||||
(byte*)pData + pEmbed->fieldOffset[ TD_OFFSET_NORMAL ],
|
||||
SwapFieldsToTargetEndian( (byte*)pOutputBuffer + pEmbed->fieldOffset,
|
||||
(byte*)pData + pEmbed->fieldOffset,
|
||||
pField->td );
|
||||
|
||||
pOutputBuffer = (byte*)pOutputBuffer + pField->fieldSizeInBytes;
|
||||
@ -82,8 +82,8 @@ void CByteswap::SwapFieldsToTargetEndian( void *pOutputBuffer, void *pBaseData,
|
||||
for ( int i = 0; i < fieldCount; ++i )
|
||||
{
|
||||
typedescription_t *pField = &pFields[i];
|
||||
SwapFieldToTargetEndian( (BYTE*)pOutputBuffer + pField->fieldOffset[ TD_OFFSET_NORMAL ],
|
||||
(BYTE*)pBaseData + pField->fieldOffset[ TD_OFFSET_NORMAL ],
|
||||
SwapFieldToTargetEndian( (BYTE*)pOutputBuffer + pField->fieldOffset,
|
||||
(BYTE*)pBaseData + pField->fieldOffset,
|
||||
pField );
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "tier0/threadtools.h"
|
||||
#ifdef _WIN32
|
||||
#include <direct.h> // getcwd
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
#define _getcwd getcwd
|
||||
#endif
|
||||
#if defined( _X360 )
|
||||
@ -79,7 +79,7 @@ void* CreateInterface( const char *pName, int *pReturnCode )
|
||||
}
|
||||
|
||||
|
||||
#ifdef _LINUX
|
||||
#if defined _LINUX || defined __APPLE__
|
||||
// Linux doesn't have this function so this emulates its functionality
|
||||
void *GetModuleHandle(const char *name)
|
||||
{
|
||||
@ -169,7 +169,10 @@ HMODULE Sys_LoadLibrary( const char *pLibraryName )
|
||||
const char *pModuleAddition = pModuleExtension;
|
||||
#elif defined( _LINUX )
|
||||
const char *pModuleExtension = ".so";
|
||||
const char *pModuleAddition = "_i486.so"; // if an extension is on the filename assume the i486 binary set
|
||||
const char *pModuleAddition = ".so";
|
||||
#elif defined( __APPLE__ )
|
||||
const char *pModuleExtension = ".dylib";
|
||||
const char *pModuleAddition = ".dylib";
|
||||
#endif
|
||||
Q_strncpy( str, pLibraryName, sizeof(str) );
|
||||
if ( !Q_stristr( str, pModuleExtension ) )
|
||||
@ -206,7 +209,7 @@ HMODULE Sys_LoadLibrary( const char *pLibraryName )
|
||||
ReleaseThreadHandle( h );
|
||||
return context.m_hLibrary;
|
||||
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
HMODULE ret = dlopen( str, RTLD_NOW );
|
||||
if ( ! ret )
|
||||
{
|
||||
@ -327,7 +330,7 @@ void Sys_UnloadModule( CSysModule *pModule )
|
||||
|
||||
#ifdef _WIN32
|
||||
FreeLibrary( hDLL );
|
||||
#elif defined(_LINUX)
|
||||
#elif defined(_LINUX) || defined(__APPLE__)
|
||||
dlclose((void *)hDLL);
|
||||
#endif
|
||||
}
|
||||
@ -346,7 +349,7 @@ CreateInterfaceFn Sys_GetFactory( CSysModule *pModule )
|
||||
HMODULE hDLL = reinterpret_cast<HMODULE>(pModule);
|
||||
#ifdef _WIN32
|
||||
return reinterpret_cast<CreateInterfaceFn>(GetProcAddress( hDLL, CREATEINTERFACE_PROCNAME ));
|
||||
#elif defined(_LINUX)
|
||||
#elif defined(_LINUX) || defined(__APPLE__)
|
||||
// Linux gives this error:
|
||||
//../public/interface.cpp: In function `IBaseInterface *(*Sys_GetFactory
|
||||
//(CSysModule *)) (const char *, int *)':
|
||||
@ -376,7 +379,7 @@ CreateInterfaceFn Sys_GetFactory( const char *pModuleName )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return static_cast<CreateInterfaceFn>( Sys_GetProcAddress( pModuleName, CREATEINTERFACE_PROCNAME ) );
|
||||
#elif defined(_LINUX)
|
||||
#elif defined(_LINUX) || defined(__APPLE__)
|
||||
// see Sys_GetFactory( CSysModule *pModule ) for an explanation
|
||||
return (CreateInterfaceFn)( Sys_GetProcAddress( pModuleName, CREATEINTERFACE_PROCNAME ) );
|
||||
#endif
|
||||
|
@ -6,7 +6,11 @@
|
||||
|
||||
#include "mempool.h"
|
||||
#include <stdio.h>
|
||||
#ifdef __APPLE__
|
||||
#include <sys/malloc.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <memory.h>
|
||||
#include "tier0/dbg.h"
|
||||
#include <ctype.h>
|
||||
@ -222,7 +226,7 @@ void* CMemoryPool::AllocZero()
|
||||
// Purpose: Allocs a single block of memory from the pool.
|
||||
// Input : amount -
|
||||
//-----------------------------------------------------------------------------
|
||||
void *CMemoryPool::Alloc( unsigned int amount )
|
||||
void *CMemoryPool::Alloc( size_t amount )
|
||||
{
|
||||
void *returnBlock;
|
||||
|
||||
@ -263,7 +267,7 @@ void *CMemoryPool::Alloc( unsigned int amount )
|
||||
// Purpose: Allocs a single block of memory from the pool, zeroes the memory before returning
|
||||
// Input : amount -
|
||||
//-----------------------------------------------------------------------------
|
||||
void *CMemoryPool::AllocZero( unsigned int amount )
|
||||
void *CMemoryPool::AllocZero( size_t amount )
|
||||
{
|
||||
void *mem = Alloc( amount );
|
||||
if ( mem )
|
||||
|
@ -36,7 +36,7 @@ CMemoryStack::CMemoryStack()
|
||||
m_pAllocLimit( NULL ),
|
||||
m_pBase( NULL ),
|
||||
m_maxSize( 0 ),
|
||||
#if defined (_LINUX)
|
||||
#if defined (_LINUX) || defined (__APPLE__)
|
||||
m_alignment( 16 )
|
||||
#elif defined(_WIN32)
|
||||
m_alignment( 16 ),
|
||||
|
@ -6,7 +6,7 @@
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifdef _LINUX
|
||||
#if defined _LINUX || defined __APPLE__
|
||||
|
||||
#include "processor_detect_linux.cpp"
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef _LINUX
|
||||
#if defined _LINUX || defined __APPLE__
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
@ -650,7 +650,7 @@ int V_snwprintf( wchar_t *pDest, int maxLen, const wchar_t *pFormat, ... )
|
||||
va_start( marker, pFormat );
|
||||
#ifdef _WIN32
|
||||
int len = _snwprintf( pDest, maxLen, pFormat, marker );
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
int len = swprintf( pDest, maxLen, pFormat, marker );
|
||||
#else
|
||||
#error "define vsnwprintf type."
|
||||
@ -679,7 +679,7 @@ int V_snprintf( char *pDest, int maxLen, char const *pFormat, ... )
|
||||
va_start( marker, pFormat );
|
||||
#ifdef _WIN32
|
||||
int len = _vsnprintf( pDest, maxLen, pFormat, marker );
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
int len = vsnprintf( pDest, maxLen, pFormat, marker );
|
||||
#else
|
||||
#error "define vsnprintf type."
|
||||
@ -947,7 +947,7 @@ int V_UTF8ToUnicode( const char *pUTF8, wchar_t *pwchDest, int cubDestSizeInByte
|
||||
pwchDest[0] = 0;
|
||||
#ifdef _WIN32
|
||||
int cchResult = MultiByteToWideChar( CP_UTF8, 0, pUTF8, -1, pwchDest, cubDestSizeInBytes / sizeof(wchar_t) );
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
int cchResult = mbstowcs( pwchDest, pUTF8, cubDestSizeInBytes / sizeof(wchar_t) );
|
||||
#endif
|
||||
pwchDest[(cubDestSizeInBytes / sizeof(wchar_t)) - 1] = 0;
|
||||
@ -965,7 +965,7 @@ int V_UnicodeToUTF8( const wchar_t *pUnicode, char *pUTF8, int cubDestSizeInByte
|
||||
pUTF8[0] = 0;
|
||||
#ifdef _WIN32
|
||||
int cchResult = WideCharToMultiByte( CP_UTF8, 0, pUnicode, -1, pUTF8, cubDestSizeInBytes, NULL, NULL );
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
int cchResult = wcstombs( pUTF8, pUnicode, cubDestSizeInBytes );
|
||||
#endif
|
||||
pUTF8[cubDestSizeInBytes - 1] = 0;
|
||||
@ -1249,7 +1249,7 @@ void V_StripFilename (char *path)
|
||||
#ifdef _WIN32
|
||||
#define CORRECT_PATH_SEPARATOR '\\'
|
||||
#define INCORRECT_PATH_SEPARATOR '/'
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
#define CORRECT_PATH_SEPARATOR '/'
|
||||
#define INCORRECT_PATH_SEPARATOR '\\'
|
||||
#endif
|
||||
@ -1839,7 +1839,7 @@ void V_SplitString( const char *pString, const char *pSeparator, CUtlVector<char
|
||||
|
||||
bool V_GetCurrentDirectory( char *pOut, int maxLen )
|
||||
{
|
||||
#ifdef LINUX
|
||||
#if defined _LINUX || defined __APPLE__
|
||||
return getcwd( pOut, maxLen ) == pOut;
|
||||
#else
|
||||
return _getcwd( pOut, maxLen ) == pOut;
|
||||
@ -1849,7 +1849,7 @@ bool V_GetCurrentDirectory( char *pOut, int maxLen )
|
||||
|
||||
bool V_SetCurrentDirectory( const char *pDirName )
|
||||
{
|
||||
#ifdef LINUX
|
||||
#if defined _LINUX || defined __APPLE__
|
||||
return chdir( pDirName ) == 0;
|
||||
#else
|
||||
return _chdir( pDirName ) == 0;
|
||||
@ -1945,7 +1945,7 @@ void V_strtowcs( const char *pString, int nInSize, wchar_t *pWString, int nOutSi
|
||||
{
|
||||
*pWString = L'\0';
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
if ( mbstowcs( pWString, pString, nOutSize / sizeof(wchar_t) ) <= 0 )
|
||||
{
|
||||
*pWString = 0;
|
||||
@ -1960,7 +1960,7 @@ void V_wcstostr( const wchar_t *pWString, int nInSize, char *pString, int nOutSi
|
||||
{
|
||||
*pString = '\0';
|
||||
}
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
if ( wcstombs( pString, pWString, nOutSize ) <= 0 )
|
||||
{
|
||||
*pString = '\0';
|
||||
|
@ -296,7 +296,7 @@ int CUtlString::Format( const char *pFormat, ... )
|
||||
va_start( marker, pFormat );
|
||||
#ifdef _WIN32
|
||||
int len = _vsnprintf( tmpBuf, sizeof( tmpBuf ) - 1, pFormat, marker );
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
int len = vsnprintf( tmpBuf, sizeof( tmpBuf ) - 1, pFormat, marker );
|
||||
#else
|
||||
#error "define vsnprintf type."
|
||||
|
Loading…
Reference in New Issue
Block a user