[Python-checkins] CVS: python/dist/src/Mac/Python macglue.c,1.91,1.92

Jack Jansen jackjansen@users.sourceforge.net
2001年5月12日 15:46:37 -0700


Update of /cvsroot/python/python/dist/src/Mac/Python
In directory usw-pr-cvs1:/tmp/cvs-serv24671/python
Modified Files:
	macglue.c 
Log Message:
Got the first MacPython module working under MacOSX/MachO (gestalt). Main changes
are including Carbon/Carbon.h in stead of the old headers (unless WITHOUT_FRAMEWORKS
is defined, as it will be for classic MacPython) and selectively disabling all the
stuff that is unneeded in a unix-Python (event handling, etc).
Index: macglue.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Python/macglue.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -C2 -r1.91 -r1.92
*** macglue.c	2001年05月12日 21:31:25	1.91
--- macglue.c	2001年05月12日 22:46:35	1.92
***************
*** 23,44 ****
 ******************************************************************/
 
- #ifdef __CFM68K__
- /* cfm68k InterfaceLib exports GetEventQueue, but Events.h doesn't know this
- ** and defines it as GetEvQHdr (which is correct for PPC). This fix is for
- ** CW9, check that the workaround is still needed for the next release.
- */
- #define GetEvQHdr GetEventQueue
- #endif /* __CFM68K__ */
- 
- #include <Events.h>
- 
- #if !TARGET_API_MAC_OS8
- /* Unfortunately this call is probably slower... */
- #define LMGetTicks() TickCount()
- #endif
- 
- #ifdef __CFM68K__
- #undef GetEventQueue
- #endif /* __CFM68K__ */
 
 #include "Python.h"
--- 23,26 ----
***************
*** 51,54 ****
--- 33,37 ----
 #include "pythonresources.h"
 
+ #ifdef WITHOUT_FRAMEWORKS
 #include <OSUtils.h> /* for Set(Current)A5 */
 #include <Files.h>
***************
*** 62,65 ****
--- 45,71 ----
 #include <Menus.h>
 #include <TextUtils.h>
+ #include <LowMem.h>
+ #ifdef __CFM68K__
+ /* cfm68k InterfaceLib exports GetEventQueue, but Events.h doesn't know this
+ ** and defines it as GetEvQHdr (which is correct for PPC). This fix is for
+ ** CW9, check that the workaround is still needed for the next release.
+ */
+ #define GetEvQHdr GetEventQueue
+ #endif /* __CFM68K__ */
+ 
+ #include <Events.h>
+ 
+ #ifdef __CFM68K__
+ #undef GetEventQueue
+ #endif /* __CFM68K__ */
+ #else
+ #include <Carbon/Carbon.h>
+ #endif
+ 
+ #if !TARGET_API_MAC_OS8
+ /* Unfortunately this call is probably slower... */
+ #define LMGetTicks() TickCount()
+ #endif
+ 
 #ifdef __MWERKS__
 #include <SIOUX.h>
***************
*** 81,85 ****
 #include <GUSI.h>
 #endif
- #include <LowMem.h>
 
 /* The ID of the Sioux apple menu */
--- 87,90 ----
***************
*** 133,137 ****
--- 138,144 ----
 static RETSIGTYPE intcatcher(int);
 
+ #if !TARGET_API_MAC_OSX
 static int PyMac_Yield(void);
+ #endif
 
 /*
***************
*** 467,470 ****
--- 474,478 ----
 #endif /* USE_STACKCHECK */
 
+ #if !TARGET_API_MAC_OSX
 /* The catcher routine (which may not be used for all compilers) */
 static RETSIGTYPE
***************
*** 540,562 ****
 }
 
- #if 0
- /*
- ** This routine is called if we know that an external library yielded
- ** to background tasks, so we shouldn't count that time in our computation
- ** of how much CPU we used.
- ** This happens with SIOUX, and the routine is called from our modified
- ** GUSISIOUX.
- */
- void
- PyMac_LibraryDidYield(int howlong)
- {
- 	unsigned long maxnextcheck = (unsigned long)LMGetTicks() + schedparams.check_interval;
- 	
- 	schedparams.next_check = schedparams.next_check + howlong;
- 	if (schedparams.next_check > maxnextcheck )
- 		schedparams.next_check = maxnextcheck;
- }
- #endif
- 
 int
 PyOS_InterruptOccurred()
--- 548,551 ----
***************
*** 565,568 ****
--- 554,558 ----
 	return interrupted;
 }
+ 
 /* Check whether we are in the foreground */
 static int
***************
*** 583,588 ****
 		eq = 1;
 	return (int)eq;
- 
 }
 
 int
--- 573,578 ----
 		eq = 1;
 	return (int)eq;
 }
+ #endif
 
 int
***************
*** 656,659 ****
--- 646,650 ----
 }
 
+ #if !TARGET_API_MAC_OSX
 /*
 ** Yield the CPU to other tasks without processing events.
***************
*** 846,861 ****
 }
 
! #if 0
! int
! PyMac_FileExists(char *name)
! {
! 	FSSpec fss;
! 	
! 	if ( FSMakeFSSpec(0, 0, Pstring(name), &fss) == noErr )
! 		return 1;
! 	return 0;
! }
! #endif
 
 /*
 ** Helper routine for GetDirectory
--- 837,843 ----
 }
 
! #endif /* !TARGET_API_MAC_OSX */
 
+ #if TARGET_API_MAC_OS8
 /*
 ** Helper routine for GetDirectory
***************
*** 879,883 ****
 	return item;
 }	
! #if TARGET_API_MAC_OS8
 /*
 ** Ask the user for a directory. I still can't understand
--- 861,865 ----
 	return item;
 }	
! 
 /*
 ** Ask the user for a directory. I still can't understand
***************
*** 1017,1020 ****
--- 999,1004 ----
 	FSSpec *fs2;
 
+ #if !TARGET_API_MAC_OSX
+ 	/* XXX This #if is temporary */
 	/* first check whether it already is an FSSpec */
 	fs2 = mfs_GetFSSpecFSSpec(v);
***************
*** 1023,1026 ****
--- 1007,1011 ----
 		return 1;
 	}
+ #endif
 	if ( PyString_Check(v) ) {
 		/* It's a pathname */
***************
*** 1046,1050 ****
--- 1031,1040 ----
 PyObject *PyMac_BuildFSSpec(FSSpec *v)
 {
+ #if TARGET_API_MAC_OSX
+ 	PyErr_SetString(PyExc_NotImplementedError, "FSSpec not yet done for OSX");
+ 	return NULL;
+ #else
 	return newmfssobject(v);
+ #endif
 }
 

AltStyle によって変換されたページ (->オリジナル) /