Remove code needed for supporting 10.2.8 since we don't any more.
This commit is contained in:
@@ -5,19 +5,7 @@
|
||||
extern "C" int SM_main( int argc, char *argv[] );
|
||||
#define main(x,y) SM_main(x,y)
|
||||
|
||||
typedef unsigned char UInt8;
|
||||
typedef signed char SInt8;
|
||||
typedef unsigned short UInt16;
|
||||
typedef signed short SInt16;
|
||||
typedef unsigned long UInt32;
|
||||
typedef signed long SInt32;
|
||||
typedef signed long long SInt64;
|
||||
typedef unsigned long long UInt64;
|
||||
|
||||
// We cannot include MacTypes.h here because it defines Style which conflicts with struct Style.
|
||||
#define __MACTYPES__
|
||||
#include <libkern/OSByteOrder.h>
|
||||
#undef __MACTYPES__
|
||||
|
||||
#define HAVE_VERSION_INFO
|
||||
#define HAVE_CXA_DEMANGLE
|
||||
@@ -55,174 +43,48 @@ typedef unsigned long long UInt64;
|
||||
# define __MACOSX__
|
||||
#endif
|
||||
|
||||
#define ArchSwap32(n) (__builtin_constant_p(n) ? OSSwapConstInt32(n) : OSSwapInt32(n))
|
||||
#define ArchSwap24(n) (ArchSwap32(n) >> 8)
|
||||
#define ArchSwap16(n) (__builtin_constant_p(n) ? OSSwapConstInt16(n) : OSSwapInt16(n))
|
||||
#define ArchSwap32(n) OSSwapInt32((n))
|
||||
#define ArchSwap24(n) (ArchSwap32((n)) >> 8)
|
||||
#define ArchSwap16(n) OSSwapInt16((n))
|
||||
#define HAVE_BYTE_SWAPS
|
||||
|
||||
#include <bits/c++config.h>
|
||||
// This is very annoying. The 10.2.8 SDK uses GLIBCPP but the 10.4u SDK uses GLIBCXX
|
||||
#define _GLIB_CHECK(x) (_GLIBCPP_ ## x || _GLIBCXX_ ## x)
|
||||
|
||||
#if ! _GLIB_CHECK(HAVE_POWF)
|
||||
#if ! _GLIBCXX_HAVE_POWF
|
||||
# define NEED_POWF
|
||||
#endif
|
||||
|
||||
#if ! _GLIB_CHECK(HAVE_SQRTF)
|
||||
#if ! _GLIBCXX_HAVE_SQRTF
|
||||
# define NEED_SQRTF
|
||||
#endif
|
||||
|
||||
#if ! _GLIB_CHECK(HAVE_SINF)
|
||||
#if ! _GLIBCXX_HAVE_SINF
|
||||
# define NEED_SINF
|
||||
#endif
|
||||
|
||||
#if ! _GLIB_CHECK(HAVE_TANF)
|
||||
#if ! _GLIBCXX_HAVE_TANF
|
||||
# define NEED_TANF
|
||||
#endif
|
||||
|
||||
#if ! _GLIB_CHECK(HAVE_COSF)
|
||||
#if ! _GLIBCXX_HAVE_COSF
|
||||
# define NEED_COSF
|
||||
#endif
|
||||
|
||||
#if ! _GLIB_CHECK(HAVE_ACOSF)
|
||||
#if ! _GLIBCXX_HAVE_ACOSF
|
||||
# define NEED_ACOSF
|
||||
#endif
|
||||
|
||||
#if ! _GLIB_CHECK(HAVE_STRTOF)
|
||||
#if ! _GLIBCXX_HAVE_STRTOF
|
||||
# define NEED_STRTOF
|
||||
#endif
|
||||
|
||||
// Define the work around if needed.
|
||||
#include <stdint.h>
|
||||
#if _GLIB_CHECK(USE_C99)
|
||||
#if _GLIBCXX_USE_C99
|
||||
# define NEED_CSTDLIB_WORKAROUND
|
||||
#else
|
||||
inline int64_t llabs( int64_t x ) { return x < 0LL ? -x : x; }
|
||||
|
||||
/* This is not correct. It's possible that _GLIBCPP_USE_C99 could be false
|
||||
* and yet have socklen_t defined. In the BSD world, this seems to come from
|
||||
* <machine/ansi.h>. However, all apple headers that include this have:
|
||||
* #ifndef __APPLE__
|
||||
* #include <machine/ansi.h>
|
||||
* #endif
|
||||
* Since it appears we shouldn't include that for OS X builds, let's just
|
||||
* make the assumption that if we can use c99 that socklen_t is defined and
|
||||
* if we cannot, then it isn't. For the only two builds (on OS X) we care about,
|
||||
* namely supporting 10.2.8 and the current OS, this _should_ hold true.
|
||||
*/
|
||||
typedef int socklen_t;
|
||||
|
||||
/* cmath #undefs all of the math.h macros but fails to replace some of them
|
||||
* with functions if _GLIBCPP_USE_C99 is not defined. As such, yank the
|
||||
* definitions out of math.h.
|
||||
*/
|
||||
#include <cmath>
|
||||
#define fpclassify( x ) ( ( sizeof ( x ) == sizeof(double) ) ? \
|
||||
__fpclassifyd ( x ) : \
|
||||
( sizeof ( x ) == sizeof( float) ) ? \
|
||||
__fpclassifyf ( x ) : \
|
||||
__fpclassify ( x ) )
|
||||
#define isnormal( x ) ( ( sizeof ( x ) == sizeof(double) ) ? \
|
||||
__isnormald ( x ) : \
|
||||
( sizeof ( x ) == sizeof( float) ) ? \
|
||||
__isnormalf ( x ) : \
|
||||
__isnormal ( x ) )
|
||||
#define isfinite( x ) ( ( sizeof ( x ) == sizeof(double) ) ? \
|
||||
__isfinited ( x ) : \
|
||||
( sizeof ( x ) == sizeof( float) ) ? \
|
||||
__isfinitef ( x ) : \
|
||||
__isfinite ( x ) )
|
||||
#define isinf( x ) ( ( sizeof ( x ) == sizeof(double) ) ? \
|
||||
__isinfd ( x ) : \
|
||||
( sizeof ( x ) == sizeof( float) ) ? \
|
||||
__isinff ( x ) : \
|
||||
__isinf ( x ) )
|
||||
#define isnan( x ) ( ( sizeof ( x ) == sizeof(double) ) ? \
|
||||
__isnand ( x ) : \
|
||||
( sizeof ( x ) == sizeof( float) ) ? \
|
||||
__isnanf ( x ) : \
|
||||
__isnan ( x ) )
|
||||
#define signbit( x ) ( ( sizeof ( x ) == sizeof(double) ) ? \
|
||||
__signbitd ( x ) : \
|
||||
( sizeof ( x ) == sizeof( float) ) ? \
|
||||
__signbitf ( x ) : \
|
||||
__signbitl ( x ) )
|
||||
#endif
|
||||
|
||||
#if ! _GLIB_CHECK(USE_WCHAR_T)
|
||||
#include <string>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
extern size_t wcslen( const wchar_t *ws );
|
||||
extern wchar_t *wmemchr( const wchar_t *ws, wchar_t wc, size_t n );
|
||||
extern int wmemcmp( const wchar_t *ws1, const wchar_t *ws2, size_t n );
|
||||
extern wchar_t *wmemcpy( wchar_t *ws1, const wchar_t *ws2, size_t n );
|
||||
extern wchar_t *wmemmove( wchar_t *ws1, const wchar_t *ws2, size_t n );
|
||||
extern wchar_t *wmemset( wchar_t *ws , wchar_t wc, size_t n );
|
||||
}
|
||||
// C++ defines the wchar_t type even if glibc++ doesn't have the functions
|
||||
namespace std
|
||||
{
|
||||
/* This is actually illegal but it should work. =)
|
||||
* In addition, it's not complete, but it's good enough for us.
|
||||
* http://www.unl.csi.cuny.edu/faqs/g++-faq/wp/sep96/lib-strings.html
|
||||
*/
|
||||
template<> struct char_traits<wchar_t>
|
||||
{
|
||||
typedef wchar_t char_type;
|
||||
typedef wchar_t int_type; // it's big enough
|
||||
/*
|
||||
* streampos and wstreampos are both required to be typedefs for
|
||||
* fpos<mbstate_t> as per clause 27.2--whatever that is.
|
||||
*/
|
||||
typedef streampos pos_type;
|
||||
typedef streamoff off_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
static void assign( char_type& c1, const char_type c2 )
|
||||
{
|
||||
c1 = c2;
|
||||
}
|
||||
|
||||
static void assign( char_type *s, size_t n, char_type c )
|
||||
{
|
||||
wmemset( s, c, n );
|
||||
}
|
||||
|
||||
static int compare( const char_type *s1, const char_type *s2, size_t n )
|
||||
{
|
||||
return wmemcmp( s1, s2, n );
|
||||
}
|
||||
|
||||
static char_type *copy( char_type *s1, const char_type *s2, size_t n )
|
||||
{
|
||||
return wmemcpy( s1, s2, n );
|
||||
}
|
||||
|
||||
static const char_type *find( const char_type *s, size_t n, const char_type& c )
|
||||
{
|
||||
return wmemchr( s, c, n );
|
||||
}
|
||||
|
||||
static size_t length( const char_type *s )
|
||||
{
|
||||
return wcslen( s );
|
||||
}
|
||||
|
||||
static char_type *move( char_type *s1, const char_type *s2, size_t n )
|
||||
{
|
||||
return wmemmove( s1, s2, n );
|
||||
}
|
||||
};
|
||||
|
||||
typedef basic_string<wchar_t> wstring;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Cleanup macro
|
||||
#undef _GLIB_CHECK
|
||||
|
||||
#include <sys/errno.h>
|
||||
#ifndef EILSEQ
|
||||
#define EILSEQ 92
|
||||
|
||||
Reference in New Issue
Block a user