summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2009-09-22 14:24:57 (GMT)
committerRonald Oussoren <ronaldoussoren@mac.com>2009-09-22 14:24:57 (GMT)
commite50a9fdd2a823296b54111b2e2080a7e4f46e9dc (patch)
treee78f7161c76046e3b0b8f13fa5b741669277a170 /Mac
parentac87077b377a3c0f2ca584000da659f16085ea54 (diff)
downloadcpython-e50a9fdd2a823296b54111b2e2080a7e4f46e9dc.zip
cpython-e50a9fdd2a823296b54111b2e2080a7e4f46e9dc.tar.gz
cpython-e50a9fdd2a823296b54111b2e2080a7e4f46e9dc.tar.bz2
The 'Navigation Toolbox' is not available at all for 64-bit
code, make this explicit in the C code to avoid confusing error messages during the build.
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Modules/Nav.c35
1 files changed, 13 insertions, 22 deletions
diff --git a/Mac/Modules/Nav.c b/Mac/Modules/Nav.c
index e03a06e..1c17776 100644
--- a/Mac/Modules/Nav.c
+++ b/Mac/Modules/Nav.c
@@ -33,6 +33,8 @@ PERFORMANCE OF THIS SOFTWARE.
#include "pymactoolbox.h"
#include <Carbon/Carbon.h>
+#ifndef __LP64__
+
static PyObject *ErrorObject;
static NavEventUPP my_eventProcUPP;
@@ -184,22 +186,18 @@ filldialogoptions(PyObject *d,
} else if( strcmp(keystr, "preferenceKey") == 0 ) {
if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, &opt->preferenceKey) )
return 0;
-#ifndef __LP64__
} else if( strcmp(keystr, "popupExtension") == 0 ) {
if ( !PyArg_Parse(value, "O&", ResObj_Convert, &opt->popupExtension) )
return 0;
-#endif /* !__LP64__ */
} else if( eventProcP && strcmp(keystr, "eventProc") == 0 ) {
*eventProcP = my_eventProcUPP;
} else if( previewProcP && strcmp(keystr, "previewProc") == 0 ) {
*previewProcP = my_previewProcUPP;
} else if( filterProcP && strcmp(keystr, "filterProc") == 0 ) {
*filterProcP = my_filterProcUPP;
-#ifndef __LP64__
} else if( typeListP && strcmp(keystr, "typeList") == 0 ) {
if ( !PyArg_Parse(value, "O&", ResObj_Convert, typeListP) )
return 0;
-#endif /* !__LP64__ */
} else if( fileTypeP && strcmp(keystr, "fileType") == 0 ) {
if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, fileTypeP) )
return 0;
@@ -306,22 +304,14 @@ static PyObject *
navrr_getattr(navrrobject *self, char *name)
{
FSRef fsr;
-#ifndef __LP64__
FSSpec fss;
-#endif /* !__LP64__ */
if( strcmp(name, "__members__") == 0 )
return Py_BuildValue(
-#ifndef __LP64__
- "ssssssssss",
-#else /* __LP64__ */
"ssssssssss",
-#endif /* __LP64__ */
"version", "validRecord", "replacing",
"isStationery", "translationNeeded",
-#ifndef __LP64__
"selection",
-#endif /* !__LP64__ */
"selection_fsr",
"fileTranslation", "keyScript", "saveFileName");
@@ -335,7 +325,6 @@ navrr_getattr(navrrobject *self, char *name)
return Py_BuildValue("l", (long)self->itself.isStationery);
if( strcmp(name, "translationNeeded") == 0 )
return Py_BuildValue("l", (long)self->itself.translationNeeded);
-#ifndef __LP64__
if( strcmp(name, "selection") == 0 ) {
SInt32 i;
long count;
@@ -367,7 +356,6 @@ navrr_getattr(navrrobject *self, char *name)
}
return rv;
}
-#endif /* !__LP64__ */
if( strcmp(name, "selection_fsr") == 0 ) {
SInt32 i;
long count;
@@ -399,10 +387,8 @@ navrr_getattr(navrrobject *self, char *name)
}
return rv;
}
-#ifndef __LP64__
if( strcmp(name, "fileTranslation") == 0 )
return ResObj_New((Handle)self->itself.fileTranslation);
-#endif
if( strcmp(name, "keyScript") == 0 )
return Py_BuildValue("h", (short)self->itself.keyScript);
if( strcmp(name, "saveFileName") == 0 )
@@ -885,11 +871,7 @@ nav_NavGetDefaultDialogOptions(PyObject *self, PyObject *args)
return NULL;
}
return Py_BuildValue(
-#ifndef __LP64__
"{s:h,s:l,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&}",
-#else /* __LP64__ */
- "{s:h,s:l,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&}",
-#endif /* __LP64__ */
"version", dialogOptions.version,
"dialogOptionFlags", dialogOptions.dialogOptionFlags,
"location", PyMac_BuildPoint, dialogOptions.location,
@@ -900,9 +882,7 @@ nav_NavGetDefaultDialogOptions(PyObject *self, PyObject *args)
"savedFileName", PyMac_BuildStr255, &dialogOptions.savedFileName,
"message", PyMac_BuildStr255, &dialogOptions.message,
"preferenceKey", PyMac_BuildOSType, dialogOptions.preferenceKey
-#ifndef __LP64__
,"popupExtension", OptResObj_New, dialogOptions.popupExtension
-#endif /* __LP64__ */
);
}
@@ -943,6 +923,10 @@ static char Nav_module_documentation[] =
"Pass None as eventProc to get movable-modal dialogs that process updates through the standard Python mechanism."
;
+
+#endif /* !__LP64__ */
+
+
void
initNav(void)
{
@@ -951,6 +935,12 @@ initNav(void)
if (PyErr_WarnPy3k("In 3.x, Nav is removed.", 1))
return;
+#ifdef __LP64__
+ PyErr_SetString(PyExc_ImportError, "Navigation Services not available in 64-bit mode");
+ return;
+
+#else /* !__LP64__ */
+
/* Test that we have NavServices */
if ( !NavServicesAvailable() ) {
PyErr_SetString(PyExc_ImportError, "Navigation Services not available");
@@ -972,6 +962,7 @@ initNav(void)
my_eventProcUPP = NewNavEventUPP(my_eventProc);
my_previewProcUPP = NewNavPreviewUPP(my_previewProc);
my_filterProcUPP = NewNavObjectFilterUPP(my_filterProc);
+#endif /* !__LP64__ */
}