Commits

Ronald Oussoren  committed 06ce27a

Merged revisions 75017 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
r75017 | ronald.oussoren | 2009-09-22 16:24:57 +0200 (Tue, 22 Sep 2009) | 4 lines

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.
........

  • Participants
  • Parent commits 78e00eb
  • Branches 2.6

Comments (0)

Files changed (1)

File Mac/Modules/Nav.c

 #include "pymactoolbox.h"
 #include <Carbon/Carbon.h>
 
+#ifndef __LP64__
+
 static PyObject *ErrorObject;
 
 static NavEventUPP my_eventProcUPP;
 		} 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;
 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");
 
 		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;
 		}
 		return rv;
 	}
-#endif /* !__LP64__ */
 	if( strcmp(name, "selection_fsr") == 0 ) {
 		SInt32 i;
 		long count;
 		}
 		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 )
 		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,
 		"savedFileName", PyMac_BuildStr255, &dialogOptions.savedFileName,
 		"message", PyMac_BuildStr255, &dialogOptions.message,
 		"preferenceKey", PyMac_BuildOSType, dialogOptions.preferenceKey
-#ifndef __LP64__
 		,"popupExtension", OptResObj_New, dialogOptions.popupExtension
-#endif /* __LP64__ */
 		);
 }
 
 "Pass None as eventProc to get movable-modal dialogs that process updates through the standard Python mechanism."
 ;
 
+
+#endif /* !__LP64__ */
+
+
 void
 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");
 	my_eventProcUPP = NewNavEventUPP(my_eventProc);
 	my_previewProcUPP = NewNavPreviewUPP(my_previewProc);
 	my_filterProcUPP = NewNavObjectFilterUPP(my_filterProc);
+#endif /* !__LP64__ */
 	
 }