summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/ae
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2000-06-02 21:35:07 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2000-06-02 21:35:07 (GMT)
commite79dc76f53dfa18fb08c35f71b049259642c0142 (patch)
tree2d9cc6228cc713336a01d9ff09571eacff3a2ba0 /Mac/Modules/ae
parent33d1ad28cba273b94c70ffc22deb6c53b0c1b068 (diff)
downloadcpython-e79dc76f53dfa18fb08c35f71b049259642c0142.zip
cpython-e79dc76f53dfa18fb08c35f71b049259642c0142.tar.gz
cpython-e79dc76f53dfa18fb08c35f71b049259642c0142.tar.bz2
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.
Diffstat (limited to 'Mac/Modules/ae')
-rw-r--r--Mac/Modules/ae/AEmodule.c16
-rw-r--r--Mac/Modules/ae/aesupport.py16
2 files changed, 30 insertions, 2 deletions
diff --git a/Mac/Modules/ae/AEmodule.c b/Mac/Modules/ae/AEmodule.c
index 5bb7f9c..d540197 100644
--- a/Mac/Modules/ae/AEmodule.c
+++ b/Mac/Modules/ae/AEmodule.c
@@ -795,6 +795,7 @@ static PyObject *AEDesc_getattr(self, name)
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);
@@ -803,6 +804,19 @@ static PyObject *AEDesc_getattr(self, name)
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)
@@ -1145,7 +1159,7 @@ static PyMethodDef AE_methods[] = {
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;
diff --git a/Mac/Modules/ae/aesupport.py b/Mac/Modules/ae/aesupport.py
index 3695037..953b490 100644
--- a/Mac/Modules/ae/aesupport.py
+++ b/Mac/Modules/ae/aesupport.py
@@ -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)