2 /* =========================== Module _AE =========================== */
8 #include "pymactoolbox.h"
10 #ifndef HAVE_OSX105_SDK
11 typedef SInt32 SRefCon
;
14 /* Macro to test whether a weak-loaded CFM function exists */
15 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
16 PyErr_SetString(PyExc_NotImplementedError, \
17 "Not available in this shared library/OS version"); \
22 #include <Carbon/Carbon.h>
24 #ifdef USE_TOOLBOX_OBJECT_GLUE
25 extern PyObject
*_AEDesc_New(AEDesc
*);
26 extern int _AEDesc_Convert(PyObject
*, AEDesc
*);
28 #define AEDesc_New _AEDesc_New
29 #define AEDesc_NewBorrowed _AEDesc_NewBorrowed
30 #define AEDesc_Convert _AEDesc_Convert
33 typedef long refcontype
;
35 static pascal OSErr
GenericEventHandler(const AppleEvent
*request
, AppleEvent
*reply
, refcontype refcon
); /* Forward */
37 AEEventHandlerUPP upp_GenericEventHandler
;
39 static pascal Boolean
AEIdleProc(EventRecord
*theEvent
, long *sleepTime
, RgnHandle
*mouseRgn
)
41 if ( PyOS_InterruptOccurred() )
46 AEIdleUPP upp_AEIdleProc
;
48 static PyObject
*AE_Error
;
50 /* ----------------------- Object type AEDesc ----------------------- */
52 PyTypeObject AEDesc_Type
;
54 #define AEDesc_Check(x) ((x)->ob_type == &AEDesc_Type || PyObject_TypeCheck((x), &AEDesc_Type))
56 typedef struct AEDescObject
{
62 PyObject
*AEDesc_New(AEDesc
*itself
)
65 it
= PyObject_NEW(AEDescObject
, &AEDesc_Type
);
66 if (it
== NULL
) return NULL
;
67 it
->ob_itself
= *itself
;
69 return (PyObject
*)it
;
72 int AEDesc_Convert(PyObject
*v
, AEDesc
*p_itself
)
76 PyErr_SetString(PyExc_TypeError
, "AEDesc required");
79 *p_itself
= ((AEDescObject
*)v
)->ob_itself
;
83 static void AEDesc_dealloc(AEDescObject
*self
)
85 if (self
->ob_owned
) AEDisposeDesc(&self
->ob_itself
);
86 self
->ob_type
->tp_free((PyObject
*)self
);
89 static PyObject
*AEDesc_AECoerceDesc(AEDescObject
*_self
, PyObject
*_args
)
91 PyObject
*_res
= NULL
;
96 PyMac_PRECHECK(AECoerceDesc
);
98 if (!PyArg_ParseTuple(_args
, "O&",
99 PyMac_GetOSType
, &toType
))
101 _err
= AECoerceDesc(&_self
->ob_itself
,
104 if (_err
!= noErr
) return PyMac_Error(_err
);
105 _res
= Py_BuildValue("O&",
106 AEDesc_New
, &result
);
110 static PyObject
*AEDesc_AEDuplicateDesc(AEDescObject
*_self
, PyObject
*_args
)
112 PyObject
*_res
= NULL
;
115 #ifndef AEDuplicateDesc
116 PyMac_PRECHECK(AEDuplicateDesc
);
118 if (!PyArg_ParseTuple(_args
, ""))
120 _err
= AEDuplicateDesc(&_self
->ob_itself
,
122 if (_err
!= noErr
) return PyMac_Error(_err
);
123 _res
= Py_BuildValue("O&",
124 AEDesc_New
, &result
);
128 static PyObject
*AEDesc_AECountItems(AEDescObject
*_self
, PyObject
*_args
)
130 PyObject
*_res
= NULL
;
134 PyMac_PRECHECK(AECountItems
);
136 if (!PyArg_ParseTuple(_args
, ""))
138 _err
= AECountItems(&_self
->ob_itself
,
140 if (_err
!= noErr
) return PyMac_Error(_err
);
141 _res
= Py_BuildValue("l",
146 static PyObject
*AEDesc_AEPutPtr(AEDescObject
*_self
, PyObject
*_args
)
148 PyObject
*_res
= NULL
;
154 int dataPtr__in_len__
;
156 PyMac_PRECHECK(AEPutPtr
);
158 if (!PyArg_ParseTuple(_args
, "lO&s#",
160 PyMac_GetOSType
, &typeCode
,
161 &dataPtr__in__
, &dataPtr__in_len__
))
163 dataPtr__len__
= dataPtr__in_len__
;
164 _err
= AEPutPtr(&_self
->ob_itself
,
167 dataPtr__in__
, dataPtr__len__
);
168 if (_err
!= noErr
) return PyMac_Error(_err
);
174 static PyObject
*AEDesc_AEPutDesc(AEDescObject
*_self
, PyObject
*_args
)
176 PyObject
*_res
= NULL
;
181 PyMac_PRECHECK(AEPutDesc
);
183 if (!PyArg_ParseTuple(_args
, "lO&",
185 AEDesc_Convert
, &theAEDesc
))
187 _err
= AEPutDesc(&_self
->ob_itself
,
190 if (_err
!= noErr
) return PyMac_Error(_err
);
196 static PyObject
*AEDesc_AEGetNthPtr(AEDescObject
*_self
, PyObject
*_args
)
198 PyObject
*_res
= NULL
;
201 DescType desiredType
;
202 AEKeyword theAEKeyword
;
204 char *dataPtr__out__
;
206 int dataPtr__in_len__
;
208 PyMac_PRECHECK(AEGetNthPtr
);
210 if (!PyArg_ParseTuple(_args
, "lO&i",
212 PyMac_GetOSType
, &desiredType
,
215 if ((dataPtr__out__
= malloc(dataPtr__in_len__
)) == NULL
)
218 goto dataPtr__error__
;
220 dataPtr__len__
= dataPtr__in_len__
;
221 _err
= AEGetNthPtr(&_self
->ob_itself
,
226 dataPtr__out__
, dataPtr__len__
, &dataPtr__len__
);
227 if (_err
!= noErr
) return PyMac_Error(_err
);
228 _res
= Py_BuildValue("O&O&s#",
229 PyMac_BuildOSType
, theAEKeyword
,
230 PyMac_BuildOSType
, typeCode
,
231 dataPtr__out__
, (int)dataPtr__len__
);
232 free(dataPtr__out__
);
237 static PyObject
*AEDesc_AEGetNthDesc(AEDescObject
*_self
, PyObject
*_args
)
239 PyObject
*_res
= NULL
;
242 DescType desiredType
;
243 AEKeyword theAEKeyword
;
246 PyMac_PRECHECK(AEGetNthDesc
);
248 if (!PyArg_ParseTuple(_args
, "lO&",
250 PyMac_GetOSType
, &desiredType
))
252 _err
= AEGetNthDesc(&_self
->ob_itself
,
257 if (_err
!= noErr
) return PyMac_Error(_err
);
258 _res
= Py_BuildValue("O&O&",
259 PyMac_BuildOSType
, theAEKeyword
,
260 AEDesc_New
, &result
);
264 static PyObject
*AEDesc_AESizeOfNthItem(AEDescObject
*_self
, PyObject
*_args
)
266 PyObject
*_res
= NULL
;
271 #ifndef AESizeOfNthItem
272 PyMac_PRECHECK(AESizeOfNthItem
);
274 if (!PyArg_ParseTuple(_args
, "l",
277 _err
= AESizeOfNthItem(&_self
->ob_itself
,
281 if (_err
!= noErr
) return PyMac_Error(_err
);
282 _res
= Py_BuildValue("O&l",
283 PyMac_BuildOSType
, typeCode
,
288 static PyObject
*AEDesc_AEDeleteItem(AEDescObject
*_self
, PyObject
*_args
)
290 PyObject
*_res
= NULL
;
294 PyMac_PRECHECK(AEDeleteItem
);
296 if (!PyArg_ParseTuple(_args
, "l",
299 _err
= AEDeleteItem(&_self
->ob_itself
,
301 if (_err
!= noErr
) return PyMac_Error(_err
);
307 static PyObject
*AEDesc_AEPutParamPtr(AEDescObject
*_self
, PyObject
*_args
)
309 PyObject
*_res
= NULL
;
311 AEKeyword theAEKeyword
;
315 int dataPtr__in_len__
;
316 #ifndef AEPutParamPtr
317 PyMac_PRECHECK(AEPutParamPtr
);
319 if (!PyArg_ParseTuple(_args
, "O&O&s#",
320 PyMac_GetOSType
, &theAEKeyword
,
321 PyMac_GetOSType
, &typeCode
,
322 &dataPtr__in__
, &dataPtr__in_len__
))
324 dataPtr__len__
= dataPtr__in_len__
;
325 _err
= AEPutParamPtr(&_self
->ob_itself
,
328 dataPtr__in__
, dataPtr__len__
);
329 if (_err
!= noErr
) return PyMac_Error(_err
);
335 static PyObject
*AEDesc_AEPutParamDesc(AEDescObject
*_self
, PyObject
*_args
)
337 PyObject
*_res
= NULL
;
339 AEKeyword theAEKeyword
;
341 #ifndef AEPutParamDesc
342 PyMac_PRECHECK(AEPutParamDesc
);
344 if (!PyArg_ParseTuple(_args
, "O&O&",
345 PyMac_GetOSType
, &theAEKeyword
,
346 AEDesc_Convert
, &theAEDesc
))
348 _err
= AEPutParamDesc(&_self
->ob_itself
,
351 if (_err
!= noErr
) return PyMac_Error(_err
);
357 static PyObject
*AEDesc_AEGetParamPtr(AEDescObject
*_self
, PyObject
*_args
)
359 PyObject
*_res
= NULL
;
361 AEKeyword theAEKeyword
;
362 DescType desiredType
;
364 char *dataPtr__out__
;
366 int dataPtr__in_len__
;
367 #ifndef AEGetParamPtr
368 PyMac_PRECHECK(AEGetParamPtr
);
370 if (!PyArg_ParseTuple(_args
, "O&O&i",
371 PyMac_GetOSType
, &theAEKeyword
,
372 PyMac_GetOSType
, &desiredType
,
375 if ((dataPtr__out__
= malloc(dataPtr__in_len__
)) == NULL
)
378 goto dataPtr__error__
;
380 dataPtr__len__
= dataPtr__in_len__
;
381 _err
= AEGetParamPtr(&_self
->ob_itself
,
385 dataPtr__out__
, dataPtr__len__
, &dataPtr__len__
);
386 if (_err
!= noErr
) return PyMac_Error(_err
);
387 _res
= Py_BuildValue("O&s#",
388 PyMac_BuildOSType
, typeCode
,
389 dataPtr__out__
, (int)dataPtr__len__
);
390 free(dataPtr__out__
);
395 static PyObject
*AEDesc_AEGetParamDesc(AEDescObject
*_self
, PyObject
*_args
)
397 PyObject
*_res
= NULL
;
399 AEKeyword theAEKeyword
;
400 DescType desiredType
;
402 #ifndef AEGetParamDesc
403 PyMac_PRECHECK(AEGetParamDesc
);
405 if (!PyArg_ParseTuple(_args
, "O&O&",
406 PyMac_GetOSType
, &theAEKeyword
,
407 PyMac_GetOSType
, &desiredType
))
409 _err
= AEGetParamDesc(&_self
->ob_itself
,
413 if (_err
!= noErr
) return PyMac_Error(_err
);
414 _res
= Py_BuildValue("O&",
415 AEDesc_New
, &result
);
419 static PyObject
*AEDesc_AESizeOfParam(AEDescObject
*_self
, PyObject
*_args
)
421 PyObject
*_res
= NULL
;
423 AEKeyword theAEKeyword
;
426 #ifndef AESizeOfParam
427 PyMac_PRECHECK(AESizeOfParam
);
429 if (!PyArg_ParseTuple(_args
, "O&",
430 PyMac_GetOSType
, &theAEKeyword
))
432 _err
= AESizeOfParam(&_self
->ob_itself
,
436 if (_err
!= noErr
) return PyMac_Error(_err
);
437 _res
= Py_BuildValue("O&l",
438 PyMac_BuildOSType
, typeCode
,
443 static PyObject
*AEDesc_AEDeleteParam(AEDescObject
*_self
, PyObject
*_args
)
445 PyObject
*_res
= NULL
;
447 AEKeyword theAEKeyword
;
448 #ifndef AEDeleteParam
449 PyMac_PRECHECK(AEDeleteParam
);
451 if (!PyArg_ParseTuple(_args
, "O&",
452 PyMac_GetOSType
, &theAEKeyword
))
454 _err
= AEDeleteParam(&_self
->ob_itself
,
456 if (_err
!= noErr
) return PyMac_Error(_err
);
462 static PyObject
*AEDesc_AEGetAttributePtr(AEDescObject
*_self
, PyObject
*_args
)
464 PyObject
*_res
= NULL
;
466 AEKeyword theAEKeyword
;
467 DescType desiredType
;
469 char *dataPtr__out__
;
471 int dataPtr__in_len__
;
472 #ifndef AEGetAttributePtr
473 PyMac_PRECHECK(AEGetAttributePtr
);
475 if (!PyArg_ParseTuple(_args
, "O&O&i",
476 PyMac_GetOSType
, &theAEKeyword
,
477 PyMac_GetOSType
, &desiredType
,
480 if ((dataPtr__out__
= malloc(dataPtr__in_len__
)) == NULL
)
483 goto dataPtr__error__
;
485 dataPtr__len__
= dataPtr__in_len__
;
486 _err
= AEGetAttributePtr(&_self
->ob_itself
,
490 dataPtr__out__
, dataPtr__len__
, &dataPtr__len__
);
491 if (_err
!= noErr
) return PyMac_Error(_err
);
492 _res
= Py_BuildValue("O&s#",
493 PyMac_BuildOSType
, typeCode
,
494 dataPtr__out__
, (int)dataPtr__len__
);
495 free(dataPtr__out__
);
500 static PyObject
*AEDesc_AEGetAttributeDesc(AEDescObject
*_self
, PyObject
*_args
)
502 PyObject
*_res
= NULL
;
504 AEKeyword theAEKeyword
;
505 DescType desiredType
;
507 #ifndef AEGetAttributeDesc
508 PyMac_PRECHECK(AEGetAttributeDesc
);
510 if (!PyArg_ParseTuple(_args
, "O&O&",
511 PyMac_GetOSType
, &theAEKeyword
,
512 PyMac_GetOSType
, &desiredType
))
514 _err
= AEGetAttributeDesc(&_self
->ob_itself
,
518 if (_err
!= noErr
) return PyMac_Error(_err
);
519 _res
= Py_BuildValue("O&",
520 AEDesc_New
, &result
);
524 static PyObject
*AEDesc_AESizeOfAttribute(AEDescObject
*_self
, PyObject
*_args
)
526 PyObject
*_res
= NULL
;
528 AEKeyword theAEKeyword
;
531 #ifndef AESizeOfAttribute
532 PyMac_PRECHECK(AESizeOfAttribute
);
534 if (!PyArg_ParseTuple(_args
, "O&",
535 PyMac_GetOSType
, &theAEKeyword
))
537 _err
= AESizeOfAttribute(&_self
->ob_itself
,
541 if (_err
!= noErr
) return PyMac_Error(_err
);
542 _res
= Py_BuildValue("O&l",
543 PyMac_BuildOSType
, typeCode
,
548 static PyObject
*AEDesc_AEPutAttributePtr(AEDescObject
*_self
, PyObject
*_args
)
550 PyObject
*_res
= NULL
;
552 AEKeyword theAEKeyword
;
556 int dataPtr__in_len__
;
557 #ifndef AEPutAttributePtr
558 PyMac_PRECHECK(AEPutAttributePtr
);
560 if (!PyArg_ParseTuple(_args
, "O&O&s#",
561 PyMac_GetOSType
, &theAEKeyword
,
562 PyMac_GetOSType
, &typeCode
,
563 &dataPtr__in__
, &dataPtr__in_len__
))
565 dataPtr__len__
= dataPtr__in_len__
;
566 _err
= AEPutAttributePtr(&_self
->ob_itself
,
569 dataPtr__in__
, dataPtr__len__
);
570 if (_err
!= noErr
) return PyMac_Error(_err
);
576 static PyObject
*AEDesc_AEPutAttributeDesc(AEDescObject
*_self
, PyObject
*_args
)
578 PyObject
*_res
= NULL
;
580 AEKeyword theAEKeyword
;
582 #ifndef AEPutAttributeDesc
583 PyMac_PRECHECK(AEPutAttributeDesc
);
585 if (!PyArg_ParseTuple(_args
, "O&O&",
586 PyMac_GetOSType
, &theAEKeyword
,
587 AEDesc_Convert
, &theAEDesc
))
589 _err
= AEPutAttributeDesc(&_self
->ob_itself
,
592 if (_err
!= noErr
) return PyMac_Error(_err
);
598 static PyObject
*AEDesc_AEGetDescDataSize(AEDescObject
*_self
, PyObject
*_args
)
600 PyObject
*_res
= NULL
;
602 #ifndef AEGetDescDataSize
603 PyMac_PRECHECK(AEGetDescDataSize
);
605 if (!PyArg_ParseTuple(_args
, ""))
607 _rv
= AEGetDescDataSize(&_self
->ob_itself
);
608 _res
= Py_BuildValue("l",
613 static PyObject
*AEDesc_AESend(AEDescObject
*_self
, PyObject
*_args
)
615 PyObject
*_res
= NULL
;
619 AESendPriority sendPriority
;
622 PyMac_PRECHECK(AESend
);
624 if (!PyArg_ParseTuple(_args
, "lhl",
629 _err
= AESend(&_self
->ob_itself
,
636 if (_err
!= noErr
) return PyMac_Error(_err
);
637 _res
= Py_BuildValue("O&",
642 static PyObject
*AEDesc_AEResetTimer(AEDescObject
*_self
, PyObject
*_args
)
644 PyObject
*_res
= NULL
;
647 PyMac_PRECHECK(AEResetTimer
);
649 if (!PyArg_ParseTuple(_args
, ""))
651 _err
= AEResetTimer(&_self
->ob_itself
);
652 if (_err
!= noErr
) return PyMac_Error(_err
);
658 static PyObject
*AEDesc_AESuspendTheCurrentEvent(AEDescObject
*_self
, PyObject
*_args
)
660 PyObject
*_res
= NULL
;
662 #ifndef AESuspendTheCurrentEvent
663 PyMac_PRECHECK(AESuspendTheCurrentEvent
);
665 if (!PyArg_ParseTuple(_args
, ""))
667 _err
= AESuspendTheCurrentEvent(&_self
->ob_itself
);
668 if (_err
!= noErr
) return PyMac_Error(_err
);
674 static PyObject
*AEDesc_AEResumeTheCurrentEvent(AEDescObject
*_self
, PyObject
*_args
)
676 PyObject
*_res
= NULL
;
679 AEEventHandlerUPP dispatcher__proc__
= upp_GenericEventHandler
;
680 PyObject
*dispatcher
;
681 #ifndef AEResumeTheCurrentEvent
682 PyMac_PRECHECK(AEResumeTheCurrentEvent
);
684 if (!PyArg_ParseTuple(_args
, "O&O",
685 AEDesc_Convert
, &reply
,
688 _err
= AEResumeTheCurrentEvent(&_self
->ob_itself
,
691 (SRefCon
)dispatcher
);
692 if (_err
!= noErr
) return PyMac_Error(_err
);
695 Py_INCREF(dispatcher
); /* XXX leak, but needed */
699 static PyObject
*AEDesc_AEGetTheCurrentEvent(AEDescObject
*_self
, PyObject
*_args
)
701 PyObject
*_res
= NULL
;
703 #ifndef AEGetTheCurrentEvent
704 PyMac_PRECHECK(AEGetTheCurrentEvent
);
706 if (!PyArg_ParseTuple(_args
, ""))
708 _err
= AEGetTheCurrentEvent(&_self
->ob_itself
);
709 if (_err
!= noErr
) return PyMac_Error(_err
);
715 static PyObject
*AEDesc_AESetTheCurrentEvent(AEDescObject
*_self
, PyObject
*_args
)
717 PyObject
*_res
= NULL
;
719 #ifndef AESetTheCurrentEvent
720 PyMac_PRECHECK(AESetTheCurrentEvent
);
722 if (!PyArg_ParseTuple(_args
, ""))
724 _err
= AESetTheCurrentEvent(&_self
->ob_itself
);
725 if (_err
!= noErr
) return PyMac_Error(_err
);
731 static PyObject
*AEDesc_AEResolve(AEDescObject
*_self
, PyObject
*_args
)
733 PyObject
*_res
= NULL
;
738 PyMac_PRECHECK(AEResolve
);
740 if (!PyArg_ParseTuple(_args
, "h",
743 _err
= AEResolve(&_self
->ob_itself
,
746 if (_err
!= noErr
) return PyMac_Error(_err
);
747 _res
= Py_BuildValue("O&",
748 AEDesc_New
, &theToken
);
752 static PyObject
*AEDesc_AutoDispose(AEDescObject
*_self
, PyObject
*_args
)
754 PyObject
*_res
= NULL
;
757 if (!PyArg_ParseTuple(_args
, "i", &onoff
))
759 old
= _self
->ob_owned
;
760 _self
->ob_owned
= onoff
;
761 _res
= Py_BuildValue("i", old
);
766 static PyMethodDef AEDesc_methods
[] = {
767 {"AECoerceDesc", (PyCFunction
)AEDesc_AECoerceDesc
, 1,
768 PyDoc_STR("(DescType toType) -> (AEDesc result)")},
769 {"AEDuplicateDesc", (PyCFunction
)AEDesc_AEDuplicateDesc
, 1,
770 PyDoc_STR("() -> (AEDesc result)")},
771 {"AECountItems", (PyCFunction
)AEDesc_AECountItems
, 1,
772 PyDoc_STR("() -> (long theCount)")},
773 {"AEPutPtr", (PyCFunction
)AEDesc_AEPutPtr
, 1,
774 PyDoc_STR("(long index, DescType typeCode, Buffer dataPtr) -> None")},
775 {"AEPutDesc", (PyCFunction
)AEDesc_AEPutDesc
, 1,
776 PyDoc_STR("(long index, AEDesc theAEDesc) -> None")},
777 {"AEGetNthPtr", (PyCFunction
)AEDesc_AEGetNthPtr
, 1,
778 PyDoc_STR("(long index, DescType desiredType, Buffer dataPtr) -> (AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr)")},
779 {"AEGetNthDesc", (PyCFunction
)AEDesc_AEGetNthDesc
, 1,
780 PyDoc_STR("(long index, DescType desiredType) -> (AEKeyword theAEKeyword, AEDesc result)")},
781 {"AESizeOfNthItem", (PyCFunction
)AEDesc_AESizeOfNthItem
, 1,
782 PyDoc_STR("(long index) -> (DescType typeCode, Size dataSize)")},
783 {"AEDeleteItem", (PyCFunction
)AEDesc_AEDeleteItem
, 1,
784 PyDoc_STR("(long index) -> None")},
785 {"AEPutParamPtr", (PyCFunction
)AEDesc_AEPutParamPtr
, 1,
786 PyDoc_STR("(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None")},
787 {"AEPutParamDesc", (PyCFunction
)AEDesc_AEPutParamDesc
, 1,
788 PyDoc_STR("(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None")},
789 {"AEGetParamPtr", (PyCFunction
)AEDesc_AEGetParamPtr
, 1,
790 PyDoc_STR("(AEKeyword theAEKeyword, DescType desiredType, Buffer dataPtr) -> (DescType typeCode, Buffer dataPtr)")},
791 {"AEGetParamDesc", (PyCFunction
)AEDesc_AEGetParamDesc
, 1,
792 PyDoc_STR("(AEKeyword theAEKeyword, DescType desiredType) -> (AEDesc result)")},
793 {"AESizeOfParam", (PyCFunction
)AEDesc_AESizeOfParam
, 1,
794 PyDoc_STR("(AEKeyword theAEKeyword) -> (DescType typeCode, Size dataSize)")},
795 {"AEDeleteParam", (PyCFunction
)AEDesc_AEDeleteParam
, 1,
796 PyDoc_STR("(AEKeyword theAEKeyword) -> None")},
797 {"AEGetAttributePtr", (PyCFunction
)AEDesc_AEGetAttributePtr
, 1,
798 PyDoc_STR("(AEKeyword theAEKeyword, DescType desiredType, Buffer dataPtr) -> (DescType typeCode, Buffer dataPtr)")},
799 {"AEGetAttributeDesc", (PyCFunction
)AEDesc_AEGetAttributeDesc
, 1,
800 PyDoc_STR("(AEKeyword theAEKeyword, DescType desiredType) -> (AEDesc result)")},
801 {"AESizeOfAttribute", (PyCFunction
)AEDesc_AESizeOfAttribute
, 1,
802 PyDoc_STR("(AEKeyword theAEKeyword) -> (DescType typeCode, Size dataSize)")},
803 {"AEPutAttributePtr", (PyCFunction
)AEDesc_AEPutAttributePtr
, 1,
804 PyDoc_STR("(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None")},
805 {"AEPutAttributeDesc", (PyCFunction
)AEDesc_AEPutAttributeDesc
, 1,
806 PyDoc_STR("(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None")},
807 {"AEGetDescDataSize", (PyCFunction
)AEDesc_AEGetDescDataSize
, 1,
808 PyDoc_STR("() -> (Size _rv)")},
809 {"AESend", (PyCFunction
)AEDesc_AESend
, 1,
810 PyDoc_STR("(AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks) -> (AppleEvent reply)")},
811 {"AEResetTimer", (PyCFunction
)AEDesc_AEResetTimer
, 1,
812 PyDoc_STR("() -> None")},
813 {"AESuspendTheCurrentEvent", (PyCFunction
)AEDesc_AESuspendTheCurrentEvent
, 1,
814 PyDoc_STR("() -> None")},
815 {"AEResumeTheCurrentEvent", (PyCFunction
)AEDesc_AEResumeTheCurrentEvent
, 1,
816 PyDoc_STR("(AppleEvent reply, EventHandler dispatcher) -> None")},
817 {"AEGetTheCurrentEvent", (PyCFunction
)AEDesc_AEGetTheCurrentEvent
, 1,
818 PyDoc_STR("() -> None")},
819 {"AESetTheCurrentEvent", (PyCFunction
)AEDesc_AESetTheCurrentEvent
, 1,
820 PyDoc_STR("() -> None")},
821 {"AEResolve", (PyCFunction
)AEDesc_AEResolve
, 1,
822 PyDoc_STR("(short callbackFlags) -> (AEDesc theToken)")},
823 {"AutoDispose", (PyCFunction
)AEDesc_AutoDispose
, 1,
824 PyDoc_STR("(int)->int. Automatically AEDisposeDesc the object on Python object cleanup")},
828 static PyObject
*AEDesc_get_type(AEDescObject
*self
, void *closure
)
830 return PyMac_BuildOSType(self
->ob_itself
.descriptorType
);
833 #define AEDesc_set_type NULL
835 static PyObject
*AEDesc_get_data(AEDescObject
*self
, void *closure
)
842 size
= AEGetDescDataSize(&self
->ob_itself
);
843 if ( (res
= PyString_FromStringAndSize(NULL
, size
)) == NULL
)
845 if ( (ptr
= PyString_AsString(res
)) == NULL
)
847 if ( (err
=AEGetDescData(&self
->ob_itself
, ptr
, size
)) < 0 )
848 return PyMac_Error(err
);
852 #define AEDesc_set_data NULL
854 static PyGetSetDef AEDesc_getsetlist
[] = {
855 {"type", (getter
)AEDesc_get_type
, (setter
)AEDesc_set_type
, "Type of this AEDesc"},
856 {"data", (getter
)AEDesc_get_data
, (setter
)AEDesc_set_data
, "The raw data in this AEDesc"},
857 {NULL
, NULL
, NULL
, NULL
},
861 #define AEDesc_compare NULL
863 #define AEDesc_repr NULL
865 #define AEDesc_hash NULL
866 #define AEDesc_tp_init 0
868 #define AEDesc_tp_alloc PyType_GenericAlloc
870 static PyObject
*AEDesc_tp_new(PyTypeObject
*type
, PyObject
*_args
, PyObject
*_kwds
)
874 char *kw
[] = {"itself", 0};
876 if (!PyArg_ParseTupleAndKeywords(_args
, _kwds
, "O&", kw
, AEDesc_Convert
, &itself
)) return NULL
;
877 if ((_self
= type
->tp_alloc(type
, 0)) == NULL
) return NULL
;
878 ((AEDescObject
*)_self
)->ob_itself
= itself
;
882 #define AEDesc_tp_free PyObject_Del
885 PyTypeObject AEDesc_Type
= {
886 PyObject_HEAD_INIT(NULL
)
888 "_AE.AEDesc", /*tp_name*/
889 sizeof(AEDescObject
), /*tp_basicsize*/
892 (destructor
) AEDesc_dealloc
, /*tp_dealloc*/
894 (getattrfunc
)0, /*tp_getattr*/
895 (setattrfunc
)0, /*tp_setattr*/
896 (cmpfunc
) AEDesc_compare
, /*tp_compare*/
897 (reprfunc
) AEDesc_repr
, /*tp_repr*/
898 (PyNumberMethods
*)0, /* tp_as_number */
899 (PySequenceMethods
*)0, /* tp_as_sequence */
900 (PyMappingMethods
*)0, /* tp_as_mapping */
901 (hashfunc
) AEDesc_hash
, /*tp_hash*/
904 PyObject_GenericGetAttr
, /*tp_getattro*/
905 PyObject_GenericSetAttr
, /*tp_setattro */
907 Py_TPFLAGS_DEFAULT
|Py_TPFLAGS_BASETYPE
, /* tp_flags */
911 0, /*tp_richcompare*/
912 0, /*tp_weaklistoffset*/
915 AEDesc_methods
, /* tp_methods */
917 AEDesc_getsetlist
, /*tp_getset*/
923 AEDesc_tp_init
, /* tp_init */
924 AEDesc_tp_alloc
, /* tp_alloc */
925 AEDesc_tp_new
, /* tp_new */
926 AEDesc_tp_free
, /* tp_free */
929 /* --------------------- End object type AEDesc --------------------- */
932 static PyObject
*AE_AECoercePtr(PyObject
*_self
, PyObject
*_args
)
934 PyObject
*_res
= NULL
;
939 int dataPtr__in_len__
;
943 PyMac_PRECHECK(AECoercePtr
);
945 if (!PyArg_ParseTuple(_args
, "O&s#O&",
946 PyMac_GetOSType
, &typeCode
,
947 &dataPtr__in__
, &dataPtr__in_len__
,
948 PyMac_GetOSType
, &toType
))
950 dataPtr__len__
= dataPtr__in_len__
;
951 _err
= AECoercePtr(typeCode
,
952 dataPtr__in__
, dataPtr__len__
,
955 if (_err
!= noErr
) return PyMac_Error(_err
);
956 _res
= Py_BuildValue("O&",
957 AEDesc_New
, &result
);
961 static PyObject
*AE_AECreateDesc(PyObject
*_self
, PyObject
*_args
)
963 PyObject
*_res
= NULL
;
968 int dataPtr__in_len__
;
971 PyMac_PRECHECK(AECreateDesc
);
973 if (!PyArg_ParseTuple(_args
, "O&s#",
974 PyMac_GetOSType
, &typeCode
,
975 &dataPtr__in__
, &dataPtr__in_len__
))
977 dataPtr__len__
= dataPtr__in_len__
;
978 _err
= AECreateDesc(typeCode
,
979 dataPtr__in__
, dataPtr__len__
,
981 if (_err
!= noErr
) return PyMac_Error(_err
);
982 _res
= Py_BuildValue("O&",
983 AEDesc_New
, &result
);
987 static PyObject
*AE_AECreateList(PyObject
*_self
, PyObject
*_args
)
989 PyObject
*_res
= NULL
;
991 char *factoringPtr__in__
;
992 long factoringPtr__len__
;
993 int factoringPtr__in_len__
;
995 AEDescList resultList
;
997 PyMac_PRECHECK(AECreateList
);
999 if (!PyArg_ParseTuple(_args
, "s#b",
1000 &factoringPtr__in__
, &factoringPtr__in_len__
,
1003 factoringPtr__len__
= factoringPtr__in_len__
;
1004 _err
= AECreateList(factoringPtr__in__
, factoringPtr__len__
,
1007 if (_err
!= noErr
) return PyMac_Error(_err
);
1008 _res
= Py_BuildValue("O&",
1009 AEDesc_New
, &resultList
);
1013 static PyObject
*AE_AECreateAppleEvent(PyObject
*_self
, PyObject
*_args
)
1015 PyObject
*_res
= NULL
;
1017 AEEventClass theAEEventClass
;
1018 AEEventID theAEEventID
;
1019 AEAddressDesc target
;
1020 AEReturnID returnID
;
1021 AETransactionID transactionID
;
1023 #ifndef AECreateAppleEvent
1024 PyMac_PRECHECK(AECreateAppleEvent
);
1026 if (!PyArg_ParseTuple(_args
, "O&O&O&hl",
1027 PyMac_GetOSType
, &theAEEventClass
,
1028 PyMac_GetOSType
, &theAEEventID
,
1029 AEDesc_Convert
, &target
,
1033 _err
= AECreateAppleEvent(theAEEventClass
,
1039 if (_err
!= noErr
) return PyMac_Error(_err
);
1040 _res
= Py_BuildValue("O&",
1041 AEDesc_New
, &result
);
1045 static PyObject
*AE_AEReplaceDescData(PyObject
*_self
, PyObject
*_args
)
1047 PyObject
*_res
= NULL
;
1050 char *dataPtr__in__
;
1051 long dataPtr__len__
;
1052 int dataPtr__in_len__
;
1054 #ifndef AEReplaceDescData
1055 PyMac_PRECHECK(AEReplaceDescData
);
1057 if (!PyArg_ParseTuple(_args
, "O&s#",
1058 PyMac_GetOSType
, &typeCode
,
1059 &dataPtr__in__
, &dataPtr__in_len__
))
1061 dataPtr__len__
= dataPtr__in_len__
;
1062 _err
= AEReplaceDescData(typeCode
,
1063 dataPtr__in__
, dataPtr__len__
,
1065 if (_err
!= noErr
) return PyMac_Error(_err
);
1066 _res
= Py_BuildValue("O&",
1067 AEDesc_New
, &theAEDesc
);
1071 static PyObject
*AE_AEProcessAppleEvent(PyObject
*_self
, PyObject
*_args
)
1073 PyObject
*_res
= NULL
;
1075 EventRecord theEventRecord
;
1076 #ifndef AEProcessAppleEvent
1077 PyMac_PRECHECK(AEProcessAppleEvent
);
1079 if (!PyArg_ParseTuple(_args
, "O&",
1080 PyMac_GetEventRecord
, &theEventRecord
))
1082 _err
= AEProcessAppleEvent(&theEventRecord
);
1083 if (_err
!= noErr
) return PyMac_Error(_err
);
1089 static PyObject
*AE_AEGetInteractionAllowed(PyObject
*_self
, PyObject
*_args
)
1091 PyObject
*_res
= NULL
;
1093 AEInteractAllowed level
;
1094 #ifndef AEGetInteractionAllowed
1095 PyMac_PRECHECK(AEGetInteractionAllowed
);
1097 if (!PyArg_ParseTuple(_args
, ""))
1099 _err
= AEGetInteractionAllowed(&level
);
1100 if (_err
!= noErr
) return PyMac_Error(_err
);
1101 _res
= Py_BuildValue("b",
1106 static PyObject
*AE_AESetInteractionAllowed(PyObject
*_self
, PyObject
*_args
)
1108 PyObject
*_res
= NULL
;
1110 AEInteractAllowed level
;
1111 #ifndef AESetInteractionAllowed
1112 PyMac_PRECHECK(AESetInteractionAllowed
);
1114 if (!PyArg_ParseTuple(_args
, "b",
1117 _err
= AESetInteractionAllowed(level
);
1118 if (_err
!= noErr
) return PyMac_Error(_err
);
1124 static PyObject
*AE_AEInteractWithUser(PyObject
*_self
, PyObject
*_args
)
1126 PyObject
*_res
= NULL
;
1128 long timeOutInTicks
;
1129 #ifndef AEInteractWithUser
1130 PyMac_PRECHECK(AEInteractWithUser
);
1132 if (!PyArg_ParseTuple(_args
, "l",
1135 _err
= AEInteractWithUser(timeOutInTicks
,
1138 if (_err
!= noErr
) return PyMac_Error(_err
);
1144 static PyObject
*AE_AEInstallEventHandler(PyObject
*_self
, PyObject
*_args
)
1146 PyObject
*_res
= NULL
;
1148 AEEventClass theAEEventClass
;
1149 AEEventID theAEEventID
;
1150 AEEventHandlerUPP handler__proc__
= upp_GenericEventHandler
;
1152 #ifndef AEInstallEventHandler
1153 PyMac_PRECHECK(AEInstallEventHandler
);
1155 if (!PyArg_ParseTuple(_args
, "O&O&O",
1156 PyMac_GetOSType
, &theAEEventClass
,
1157 PyMac_GetOSType
, &theAEEventID
,
1160 _err
= AEInstallEventHandler(theAEEventClass
,
1162 handler__proc__
, (SRefCon
)handler
,
1164 if (_err
!= noErr
) return PyMac_Error(_err
);
1167 Py_INCREF(handler
); /* XXX leak, but needed */
1171 static PyObject
*AE_AERemoveEventHandler(PyObject
*_self
, PyObject
*_args
)
1173 PyObject
*_res
= NULL
;
1175 AEEventClass theAEEventClass
;
1176 AEEventID theAEEventID
;
1177 #ifndef AERemoveEventHandler
1178 PyMac_PRECHECK(AERemoveEventHandler
);
1180 if (!PyArg_ParseTuple(_args
, "O&O&",
1181 PyMac_GetOSType
, &theAEEventClass
,
1182 PyMac_GetOSType
, &theAEEventID
))
1184 _err
= AERemoveEventHandler(theAEEventClass
,
1186 upp_GenericEventHandler
,
1188 if (_err
!= noErr
) return PyMac_Error(_err
);
1194 static PyObject
*AE_AEGetEventHandler(PyObject
*_self
, PyObject
*_args
)
1196 PyObject
*_res
= NULL
;
1198 AEEventClass theAEEventClass
;
1199 AEEventID theAEEventID
;
1200 AEEventHandlerUPP handler__proc__
= upp_GenericEventHandler
;
1202 #ifndef AEGetEventHandler
1203 PyMac_PRECHECK(AEGetEventHandler
);
1205 if (!PyArg_ParseTuple(_args
, "O&O&",
1206 PyMac_GetOSType
, &theAEEventClass
,
1207 PyMac_GetOSType
, &theAEEventID
))
1209 _err
= AEGetEventHandler(theAEEventClass
,
1211 &handler__proc__
, (SRefCon
*)&handler
,
1213 if (_err
!= noErr
) return PyMac_Error(_err
);
1214 _res
= Py_BuildValue("O",
1216 Py_INCREF(handler
); /* XXX leak, but needed */
1220 static PyObject
*AE_AEInstallSpecialHandler(PyObject
*_self
, PyObject
*_args
)
1222 PyObject
*_res
= NULL
;
1224 AEKeyword functionClass
;
1225 #ifndef AEInstallSpecialHandler
1226 PyMac_PRECHECK(AEInstallSpecialHandler
);
1228 if (!PyArg_ParseTuple(_args
, "O&",
1229 PyMac_GetOSType
, &functionClass
))
1231 _err
= AEInstallSpecialHandler(functionClass
,
1232 upp_GenericEventHandler
,
1234 if (_err
!= noErr
) return PyMac_Error(_err
);
1240 static PyObject
*AE_AERemoveSpecialHandler(PyObject
*_self
, PyObject
*_args
)
1242 PyObject
*_res
= NULL
;
1244 AEKeyword functionClass
;
1245 #ifndef AERemoveSpecialHandler
1246 PyMac_PRECHECK(AERemoveSpecialHandler
);
1248 if (!PyArg_ParseTuple(_args
, "O&",
1249 PyMac_GetOSType
, &functionClass
))
1251 _err
= AERemoveSpecialHandler(functionClass
,
1252 upp_GenericEventHandler
,
1254 if (_err
!= noErr
) return PyMac_Error(_err
);
1260 static PyObject
*AE_AEManagerInfo(PyObject
*_self
, PyObject
*_args
)
1262 PyObject
*_res
= NULL
;
1266 #ifndef AEManagerInfo
1267 PyMac_PRECHECK(AEManagerInfo
);
1269 if (!PyArg_ParseTuple(_args
, "O&",
1270 PyMac_GetOSType
, &keyWord
))
1272 _err
= AEManagerInfo(keyWord
,
1274 if (_err
!= noErr
) return PyMac_Error(_err
);
1275 _res
= Py_BuildValue("l",
1280 static PyObject
*AE_AEObjectInit(PyObject
*_self
, PyObject
*_args
)
1282 PyObject
*_res
= NULL
;
1284 #ifndef AEObjectInit
1285 PyMac_PRECHECK(AEObjectInit
);
1287 if (!PyArg_ParseTuple(_args
, ""))
1289 _err
= AEObjectInit();
1290 if (_err
!= noErr
) return PyMac_Error(_err
);
1296 static PyObject
*AE_AEDisposeToken(PyObject
*_self
, PyObject
*_args
)
1298 PyObject
*_res
= NULL
;
1301 #ifndef AEDisposeToken
1302 PyMac_PRECHECK(AEDisposeToken
);
1304 if (!PyArg_ParseTuple(_args
, ""))
1306 _err
= AEDisposeToken(&theToken
);
1307 if (_err
!= noErr
) return PyMac_Error(_err
);
1308 _res
= Py_BuildValue("O&",
1309 AEDesc_New
, &theToken
);
1313 static PyObject
*AE_AECallObjectAccessor(PyObject
*_self
, PyObject
*_args
)
1315 PyObject
*_res
= NULL
;
1317 DescType desiredClass
;
1318 AEDesc containerToken
;
1319 DescType containerClass
;
1323 #ifndef AECallObjectAccessor
1324 PyMac_PRECHECK(AECallObjectAccessor
);
1326 if (!PyArg_ParseTuple(_args
, "O&O&O&O&O&",
1327 PyMac_GetOSType
, &desiredClass
,
1328 AEDesc_Convert
, &containerToken
,
1329 PyMac_GetOSType
, &containerClass
,
1330 PyMac_GetOSType
, &keyForm
,
1331 AEDesc_Convert
, &keyData
))
1333 _err
= AECallObjectAccessor(desiredClass
,
1339 if (_err
!= noErr
) return PyMac_Error(_err
);
1340 _res
= Py_BuildValue("O&",
1341 AEDesc_New
, &token
);
1345 static PyMethodDef AE_methods
[] = {
1346 {"AECoercePtr", (PyCFunction
)AE_AECoercePtr
, 1,
1347 PyDoc_STR("(DescType typeCode, Buffer dataPtr, DescType toType) -> (AEDesc result)")},
1348 {"AECreateDesc", (PyCFunction
)AE_AECreateDesc
, 1,
1349 PyDoc_STR("(DescType typeCode, Buffer dataPtr) -> (AEDesc result)")},
1350 {"AECreateList", (PyCFunction
)AE_AECreateList
, 1,
1351 PyDoc_STR("(Buffer factoringPtr, Boolean isRecord) -> (AEDescList resultList)")},
1352 {"AECreateAppleEvent", (PyCFunction
)AE_AECreateAppleEvent
, 1,
1353 PyDoc_STR("(AEEventClass theAEEventClass, AEEventID theAEEventID, AEAddressDesc target, AEReturnID returnID, AETransactionID transactionID) -> (AppleEvent result)")},
1354 {"AEReplaceDescData", (PyCFunction
)AE_AEReplaceDescData
, 1,
1355 PyDoc_STR("(DescType typeCode, Buffer dataPtr) -> (AEDesc theAEDesc)")},
1356 {"AEProcessAppleEvent", (PyCFunction
)AE_AEProcessAppleEvent
, 1,
1357 PyDoc_STR("(EventRecord theEventRecord) -> None")},
1358 {"AEGetInteractionAllowed", (PyCFunction
)AE_AEGetInteractionAllowed
, 1,
1359 PyDoc_STR("() -> (AEInteractAllowed level)")},
1360 {"AESetInteractionAllowed", (PyCFunction
)AE_AESetInteractionAllowed
, 1,
1361 PyDoc_STR("(AEInteractAllowed level) -> None")},
1362 {"AEInteractWithUser", (PyCFunction
)AE_AEInteractWithUser
, 1,
1363 PyDoc_STR("(long timeOutInTicks) -> None")},
1364 {"AEInstallEventHandler", (PyCFunction
)AE_AEInstallEventHandler
, 1,
1365 PyDoc_STR("(AEEventClass theAEEventClass, AEEventID theAEEventID, EventHandler handler) -> None")},
1366 {"AERemoveEventHandler", (PyCFunction
)AE_AERemoveEventHandler
, 1,
1367 PyDoc_STR("(AEEventClass theAEEventClass, AEEventID theAEEventID) -> None")},
1368 {"AEGetEventHandler", (PyCFunction
)AE_AEGetEventHandler
, 1,
1369 PyDoc_STR("(AEEventClass theAEEventClass, AEEventID theAEEventID) -> (EventHandler handler)")},
1370 {"AEInstallSpecialHandler", (PyCFunction
)AE_AEInstallSpecialHandler
, 1,
1371 PyDoc_STR("(AEKeyword functionClass) -> None")},
1372 {"AERemoveSpecialHandler", (PyCFunction
)AE_AERemoveSpecialHandler
, 1,
1373 PyDoc_STR("(AEKeyword functionClass) -> None")},
1374 {"AEManagerInfo", (PyCFunction
)AE_AEManagerInfo
, 1,
1375 PyDoc_STR("(AEKeyword keyWord) -> (long result)")},
1376 {"AEObjectInit", (PyCFunction
)AE_AEObjectInit
, 1,
1377 PyDoc_STR("() -> None")},
1378 {"AEDisposeToken", (PyCFunction
)AE_AEDisposeToken
, 1,
1379 PyDoc_STR("() -> (AEDesc theToken)")},
1380 {"AECallObjectAccessor", (PyCFunction
)AE_AECallObjectAccessor
, 1,
1381 PyDoc_STR("(DescType desiredClass, AEDesc containerToken, DescType containerClass, DescType keyForm, AEDesc keyData) -> (AEDesc token)")},
1388 GenericEventHandler(const AppleEvent
*request
, AppleEvent
*reply
, refcontype refcon
)
1390 PyObject
*handler
= (PyObject
*)refcon
;
1391 AEDescObject
*requestObject
, *replyObject
;
1392 PyObject
*args
, *res
;
1393 if ((requestObject
= (AEDescObject
*)AEDesc_New((AppleEvent
*)request
)) == NULL
) {
1396 if ((replyObject
= (AEDescObject
*)AEDesc_New(reply
)) == NULL
) {
1397 Py_DECREF(requestObject
);
1400 if ((args
= Py_BuildValue("OO", requestObject
, replyObject
)) == NULL
) {
1401 Py_DECREF(requestObject
);
1402 Py_DECREF(replyObject
);
1405 res
= PyEval_CallObject(handler
, args
);
1406 requestObject
->ob_itself
.descriptorType
= 'null';
1407 requestObject
->ob_itself
.dataHandle
= NULL
;
1408 replyObject
->ob_itself
.descriptorType
= 'null';
1409 replyObject
->ob_itself
.dataHandle
= NULL
;
1412 PySys_WriteStderr("Exception in AE event handler function\n");
1420 PyObject
*AEDesc_NewBorrowed(AEDesc
*itself
)
1424 it
= AEDesc_New(itself
);
1426 ((AEDescObject
*)it
)->ob_owned
= 0;
1427 return (PyObject
*)it
;
1437 upp_AEIdleProc
= NewAEIdleUPP(AEIdleProc
);
1438 upp_GenericEventHandler
= NewAEEventHandlerUPP(GenericEventHandler
);
1439 PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc
*, AEDesc_New
);
1440 PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc
*, AEDesc_NewBorrowed
);
1441 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(AEDesc
, AEDesc_Convert
);
1443 m
= Py_InitModule("_AE", AE_methods
);
1444 d
= PyModule_GetDict(m
);
1445 AE_Error
= PyMac_GetOSErrException();
1446 if (AE_Error
== NULL
||
1447 PyDict_SetItemString(d
, "Error", AE_Error
) != 0)
1449 AEDesc_Type
.ob_type
= &PyType_Type
;
1450 if (PyType_Ready(&AEDesc_Type
) < 0) return;
1451 Py_INCREF(&AEDesc_Type
);
1452 PyModule_AddObject(m
, "AEDesc", (PyObject
*)&AEDesc_Type
);
1453 /* Backward-compatible name */
1454 Py_INCREF(&AEDesc_Type
);
1455 PyModule_AddObject(m
, "AEDescType", (PyObject
*)&AEDesc_Type
);
1458 /* ========================= End module _AE ========================= */