Made the core toolbox modules carbon-compatible using the new greylist feature of bgen: non-carbon methods are still included in non-carbon MacPython. The issue of backward compatibility of Python code is still open.

Macmodule and macosmodule have also been carbonified. Some functionality is still missing there.
This commit is contained in:
Jack Jansen 2000-06-02 21:35:07 +00:00
parent 33d1ad28cb
commit e79dc76f53
35 changed files with 667 additions and 129 deletions

View file

@ -126,7 +126,7 @@ AEIdleUPP upp_AEIdleProc;
finalstuff = finalstuff + """
static pascal OSErr
GenericEventHandler(AppleEvent *request, AppleEvent *reply, long refcon)
GenericEventHandler(const AppleEvent *request, AppleEvent *reply, unsigned long refcon)
{
PyObject *handler = (PyObject *)refcon;
AEDescObject *requestObject, *replyObject;
@ -178,6 +178,7 @@ if (strcmp(name, "type") == 0)
return PyMac_BuildOSType(self->ob_itself.descriptorType);
if (strcmp(name, "data") == 0) {
PyObject *res;
#ifndef TARGET_API_MAC_CARBON
char state;
state = HGetState(self->ob_itself.dataHandle);
HLock(self->ob_itself.dataHandle);
@ -186,6 +187,19 @@ if (strcmp(name, "data") == 0) {
GetHandleSize(self->ob_itself.dataHandle));
HUnlock(self->ob_itself.dataHandle);
HSetState(self->ob_itself.dataHandle, state);
#else
Size size;
char *ptr;
OSErr err;
size = AEGetDescDataSize(&self->ob_itself);
if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL )
return NULL;
if ( (ptr = PyString_AsString(res)) == NULL )
return NULL;
if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 )
return PyMac_Error(err);
#endif
return res;
}
if (strcmp(name, "__members__") == 0)