55#include " numpy/arrayobject.h"
66#include " path_cleanup.h"
77
8+ /* Proper way to check for the OS X version we are compiling for, from
9+ http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development */
10+ #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
11+ #define COMPILING_FOR_10_5
12+ #endif
813
914static int nwin = 0 ; /* The number of open windows */
1015
1116/* Use Atsui for Mac OS X 10.4, CoreText for Mac OS X 10.5 */
12- #ifndef MAC_OS_X_VERSION_10_5
17+ #ifndef COMPILING_FOR_10_5
1318static int ngc = 0 ; /* The number of graphics contexts in use */
1419
1520
@@ -175,7 +180,7 @@ static int wait_for_stdin(void)
175180 return 1 ;
176181}
177182
178- #ifndef MAC_OS_X_VERSION_10_5
183+ #ifndef COMPILING_FOR_10_5
179184static int _init_atsui (void )
180185{
181186 OSStatus status;
@@ -451,7 +456,7 @@ static int _get_snap(GraphicsContext* self, enum e_quantize_mode* mode)
451456 self->cr = NULL ;
452457 self->level = 0 ;
453458
454- #ifndef MAC_OS_X_VERSION_10_5
459+ #ifndef COMPILING_FOR_10_5
455460 if (ngc==0 )
456461 {
457462 int ok = _init_atsui ();
@@ -466,7 +471,7 @@ static int _get_snap(GraphicsContext* self, enum e_quantize_mode* mode)
466471 return (PyObject*) self;
467472}
468473
469- #ifndef MAC_OS_X_VERSION_10_5
474+ #ifndef COMPILING_FOR_10_5
470475static void
471476GraphicsContext_dealloc (GraphicsContext *self)
472477{
@@ -1877,7 +1882,7 @@ static BOOL _clip(CGContextRef cr, PyObject* object)
18771882}
18781883
18791884
1880- #ifdef MAC_OS_X_VERSION_10_5
1885+ #ifdef COMPILING_FOR_10_5
18811886static CTFontRef
18821887#else
18831888static ATSFontRef
@@ -1891,7 +1896,7 @@ static BOOL _clip(CGContextRef cr, PyObject* object)
18911896 const char * temp;
18921897 const char * name = " Times-Roman" ;
18931898 CFStringRef string;
1894- #ifdef MAC_OS_X_VERSION_10_5
1899+ #ifdef COMPILING_FOR_10_5
18951900 CTFontRef font = 0 ;
18961901#else
18971902 ATSFontRef font = 0 ;
@@ -2091,7 +2096,7 @@ static BOOL _clip(CGContextRef cr, PyObject* object)
20912096 string = CFStringCreateWithCString (kCFAllocatorDefault ,
20922097 temp,
20932098 kCFStringEncodingMacRoman );
2094- #ifdef MAC_OS_X_VERSION_10_5
2099+ #ifdef COMPILING_FOR_10_5
20952100 font = CTFontCreateWithName (string, size, NULL );
20962101#else
20972102 font = ATSFontFindFromPostScriptName (string, kATSOptionFlagsDefault );
@@ -2109,20 +2114,20 @@ static BOOL _clip(CGContextRef cr, PyObject* object)
21092114 { string = CFStringCreateWithCString (kCFAllocatorDefault ,
21102115 name,
21112116 kCFStringEncodingMacRoman );
2112- #ifdef MAC_OS_X_VERSION_10_5
2117+ #ifdef COMPILING_FOR_10_5
21132118 font = CTFontCreateWithName (string, size, NULL );
21142119#else
21152120 font = ATSFontFindFromPostScriptName (string, kATSOptionFlagsDefault );
21162121#endif
21172122 CFRelease (string);
21182123 }
2119- #ifndef MAC_OS_X_VERSION_10_5
2124+ #ifndef COMPILING_FOR_10_5
21202125 CGContextSelectFont (cr, name, size, kCGEncodingMacRoman );
21212126#endif
21222127 return font;
21232128}
21242129
2125- #ifdef MAC_OS_X_VERSION_10_5
2130+ #ifdef COMPILING_FOR_10_5
21262131static PyObject*
21272132GraphicsContext_draw_text (GraphicsContext* self, PyObject* args)
21282133{
@@ -2821,7 +2826,7 @@ static void _data_provider_release(void* info, const void* data, size_t size)
28212826 " _macosx.GraphicsContext" , /* tp_name*/
28222827 sizeof (GraphicsContext), /* tp_basicsize*/
28232828 0 , /* tp_itemsize*/
2824- #ifdef MAC_OS_X_VERSION_10_5
2829+ #ifdef COMPILING_FOR_10_5
28252830 0 , /* tp_dealloc*/
28262831#else
28272832 (destructor)GraphicsContext_dealloc, /* tp_dealloc*/
0 commit comments