2 /* =========================== Module _AE =========================== */
9 #include "pywintoolbox.h"
12 #include "pymactoolbox.h"
15 /* Macro to test whether a weak-loaded CFM function exists */
16 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
17 PyErr_SetString(PyExc_NotImplementedError, \
18 "Not available in this shared library/OS version"); \
24 #define PyDoc_STR(x) (x)
26 #ifdef WITHOUT_FRAMEWORKS
27 #include <AppleEvents.h>
28 #include <AEObjects.h>
30 #include <Carbon/Carbon.h>
33 #ifdef USE_TOOLBOX_OBJECT_GLUE
34 extern PyObject
*_AEDesc_New(AEDesc
*);
35 extern int _AEDesc_Convert(PyObject
*, AEDesc
*);
37 #define AEDesc_New _AEDesc_New
38 #define AEDesc_NewBorrowed _AEDesc_NewBorrowed
39 #define AEDesc_Convert _AEDesc_Convert
42 typedef long refcontype
;
44 static pascal OSErr
GenericEventHandler(const AppleEvent
*request
, AppleEvent
*reply
, refcontype refcon
); /* Forward */
46 AEEventHandlerUPP upp_GenericEventHandler
;
48 static pascal Boolean
AEIdleProc(EventRecord
*theEvent
, long *sleepTime
, RgnHandle
*mouseRgn
)
50 if ( PyOS_InterruptOccurred() )
52 #if !TARGET_API_MAC_OSX
53 if ( PyMac_HandleEvent(theEvent
) < 0 ) {
54 PySys_WriteStderr("Exception in user event handler during AE processing\n");
61 AEIdleUPP upp_AEIdleProc
;
63 static PyObject
*AE_Error
;
65 /* ----------------------- Object type AEDesc ----------------------- */
67 PyTypeObject AEDesc_Type
;
69 #define AEDesc_Check(x) ((x)->ob_type == &AEDesc_Type || PyObject_TypeCheck((x), &AEDesc_Type))
71 typedef struct AEDescObject
{
77 PyObject
*AEDesc_New(AEDesc
*itself
)
80 it
= PyObject_NEW(AEDescObject
, &AEDesc_Type
);
81 if (it
== NULL
) return NULL
;
82 it
->ob_itself
= *itself
;
84 return (PyObject
*)it
;
86 int AEDesc_Convert(PyObject
*v
, AEDesc
*p_itself
)
90 PyErr_SetString(PyExc_TypeError
, "AEDesc required");
93 *p_itself
= ((AEDescObject
*)v
)->ob_itself
;
97 static void AEDesc_dealloc(AEDescObject
*self
)
99 if (self
->ob_owned
) AEDisposeDesc(&self
->ob_itself
);
100 self
->ob_type
->tp_free((PyObject
*)self
);
103 static PyObject
*AEDesc_AECoerceDesc(AEDescObject
*_self
, PyObject
*_args
)
105 PyObject
*_res
= NULL
;
110 PyMac_PRECHECK(AECoerceDesc
);
112 if (!PyArg_ParseTuple(_args
, "O&",
113 PyMac_GetOSType
, &toType
))
115 _err
= AECoerceDesc(&_self
->ob_itself
,
118 if (_err
!= noErr
) return PyMac_Error(_err
);
119 _res
= Py_BuildValue("O&",
120 AEDesc_New
, &result
);
124 static PyObject
*AEDesc_AEDuplicateDesc(AEDescObject
*_self
, PyObject
*_args
)
126 PyObject
*_res
= NULL
;
129 #ifndef AEDuplicateDesc
130 PyMac_PRECHECK(AEDuplicateDesc
);
132 if (!PyArg_ParseTuple(_args
, ""))
134 _err
= AEDuplicateDesc(&_self
->ob_itself
,
136 if (_err
!= noErr
) return PyMac_Error(_err
);
137 _res
= Py_BuildValue("O&",
138 AEDesc_New
, &result
);
142 static PyObject
*AEDesc_AECountItems(AEDescObject
*_self
, PyObject
*_args
)
144 PyObject
*_res
= NULL
;
148 PyMac_PRECHECK(AECountItems
);
150 if (!PyArg_ParseTuple(_args
, ""))
152 _err
= AECountItems(&_self
->ob_itself
,
154 if (_err
!= noErr
) return PyMac_Error(_err
);
155 _res
= Py_BuildValue("l",
160 static PyObject
*AEDesc_AEPutPtr(AEDescObject
*_self
, PyObject
*_args
)
162 PyObject
*_res
= NULL
;
168 int dataPtr__in_len__
;
170 PyMac_PRECHECK(AEPutPtr
);
172 if (!PyArg_ParseTuple(_args
, "lO&s#",
174 PyMac_GetOSType
, &typeCode
,
175 &dataPtr__in__
, &dataPtr__in_len__
))
177 dataPtr__len__
= dataPtr__in_len__
;
178 _err
= AEPutPtr(&_self
->ob_itself
,
181 dataPtr__in__
, dataPtr__len__
);
182 if (_err
!= noErr
) return PyMac_Error(_err
);
188 static PyObject
*AEDesc_AEPutDesc(AEDescObject
*_self
, PyObject
*_args
)
190 PyObject
*_res
= NULL
;
195 PyMac_PRECHECK(AEPutDesc
);
197 if (!PyArg_ParseTuple(_args
, "lO&",
199 AEDesc_Convert
, &theAEDesc
))
201 _err
= AEPutDesc(&_self
->ob_itself
,
204 if (_err
!= noErr
) return PyMac_Error(_err
);
210 static PyObject
*AEDesc_AEGetNthPtr(AEDescObject
*_self
, PyObject
*_args
)
212 PyObject
*_res
= NULL
;
215 DescType desiredType
;
216 AEKeyword theAEKeyword
;
218 char *dataPtr__out__
;
220 int dataPtr__in_len__
;
222 PyMac_PRECHECK(AEGetNthPtr
);
224 if (!PyArg_ParseTuple(_args
, "lO&i",
226 PyMac_GetOSType
, &desiredType
,
229 if ((dataPtr__out__
= malloc(dataPtr__in_len__
)) == NULL
)
232 goto dataPtr__error__
;
234 dataPtr__len__
= dataPtr__in_len__
;
235 _err
= AEGetNthPtr(&_self
->ob_itself
,
240 dataPtr__out__
, dataPtr__len__
, &dataPtr__len__
);
241 if (_err
!= noErr
) return PyMac_Error(_err
);
242 _res
= Py_BuildValue("O&O&s#",
243 PyMac_BuildOSType
, theAEKeyword
,
244 PyMac_BuildOSType
, typeCode
,
245 dataPtr__out__
, (int)dataPtr__len__
);
246 free(dataPtr__out__
);
251 static PyObject
*AEDesc_AEGetNthDesc(AEDescObject
*_self
, PyObject
*_args
)
253 PyObject
*_res
= NULL
;
256 DescType desiredType
;
257 AEKeyword theAEKeyword
;
260 PyMac_PRECHECK(AEGetNthDesc
);
262 if (!PyArg_ParseTuple(_args
, "lO&",
264 PyMac_GetOSType
, &desiredType
))
266 _err
= AEGetNthDesc(&_self
->ob_itself
,
271 if (_err
!= noErr
) return PyMac_Error(_err
);
272 _res
= Py_BuildValue("O&O&",
273 PyMac_BuildOSType
, theAEKeyword
,
274 AEDesc_New
, &result
);
278 static PyObject
*AEDesc_AESizeOfNthItem(AEDescObject
*_self
, PyObject
*_args
)
280 PyObject
*_res
= NULL
;
285 #ifndef AESizeOfNthItem
286 PyMac_PRECHECK(AESizeOfNthItem
);
288 if (!PyArg_ParseTuple(_args
, "l",
291 _err
= AESizeOfNthItem(&_self
->ob_itself
,
295 if (_err
!= noErr
) return PyMac_Error(_err
);
296 _res
= Py_BuildValue("O&l",
297 PyMac_BuildOSType
, typeCode
,
302 static PyObject
*AEDesc_AEDeleteItem(AEDescObject
*_self
, PyObject
*_args
)
304 PyObject
*_res
= NULL
;
308 PyMac_PRECHECK(AEDeleteItem
);
310 if (!PyArg_ParseTuple(_args
, "l",
313 _err
= AEDeleteItem(&_self
->ob_itself
,
315 if (_err
!= noErr
) return PyMac_Error(_err
);
321 static PyObject
*AEDesc_AEPutParamPtr(AEDescObject
*_self
, PyObject
*_args
)
323 PyObject
*_res
= NULL
;
325 AEKeyword theAEKeyword
;
329 int dataPtr__in_len__
;
330 #ifndef AEPutParamPtr
331 PyMac_PRECHECK(AEPutParamPtr
);
333 if (!PyArg_ParseTuple(_args
, "O&O&s#",
334 PyMac_GetOSType
, &theAEKeyword
,
335 PyMac_GetOSType
, &typeCode
,
336 &dataPtr__in__
, &dataPtr__in_len__
))
338 dataPtr__len__
= dataPtr__in_len__
;
339 _err
= AEPutParamPtr(&_self
->ob_itself
,
342 dataPtr__in__
, dataPtr__len__
);
343 if (_err
!= noErr
) return PyMac_Error(_err
);
349 static PyObject
*AEDesc_AEPutParamDesc(AEDescObject
*_self
, PyObject
*_args
)
351 PyObject
*_res
= NULL
;
353 AEKeyword theAEKeyword
;
355 #ifndef AEPutParamDesc
356 PyMac_PRECHECK(AEPutParamDesc
);
358 if (!PyArg_ParseTuple(_args
, "O&O&",
359 PyMac_GetOSType
, &theAEKeyword
,
360 AEDesc_Convert
, &theAEDesc
))
362 _err
= AEPutParamDesc(&_self
->ob_itself
,
365 if (_err
!= noErr
) return PyMac_Error(_err
);
371 static PyObject
*AEDesc_AEGetParamPtr(AEDescObject
*_self
, PyObject
*_args
)
373 PyObject
*_res
= NULL
;
375 AEKeyword theAEKeyword
;
376 DescType desiredType
;
378 char *dataPtr__out__
;
380 int dataPtr__in_len__
;
381 #ifndef AEGetParamPtr
382 PyMac_PRECHECK(AEGetParamPtr
);
384 if (!PyArg_ParseTuple(_args
, "O&O&i",
385 PyMac_GetOSType
, &theAEKeyword
,
386 PyMac_GetOSType
, &desiredType
,
389 if ((dataPtr__out__
= malloc(dataPtr__in_len__
)) == NULL
)
392 goto dataPtr__error__
;
394 dataPtr__len__
= dataPtr__in_len__
;
395 _err
= AEGetParamPtr(&_self
->ob_itself
,
399 dataPtr__out__
, dataPtr__len__
, &dataPtr__len__
);
400 if (_err
!= noErr
) return PyMac_Error(_err
);
401 _res
= Py_BuildValue("O&s#",
402 PyMac_BuildOSType
, typeCode
,
403 dataPtr__out__
, (int)dataPtr__len__
);
404 free(dataPtr__out__
);
409 static PyObject
*AEDesc_AEGetParamDesc(AEDescObject
*_self
, PyObject
*_args
)
411 PyObject
*_res
= NULL
;
413 AEKeyword theAEKeyword
;
414 DescType desiredType
;
416 #ifndef AEGetParamDesc
417 PyMac_PRECHECK(AEGetParamDesc
);
419 if (!PyArg_ParseTuple(_args
, "O&O&",
420 PyMac_GetOSType
, &theAEKeyword
,
421 PyMac_GetOSType
, &desiredType
))
423 _err
= AEGetParamDesc(&_self
->ob_itself
,
427 if (_err
!= noErr
) return PyMac_Error(_err
);
428 _res
= Py_BuildValue("O&",
429 AEDesc_New
, &result
);
433 static PyObject
*AEDesc_AESizeOfParam(AEDescObject
*_self
, PyObject
*_args
)
435 PyObject
*_res
= NULL
;
437 AEKeyword theAEKeyword
;
440 #ifndef AESizeOfParam
441 PyMac_PRECHECK(AESizeOfParam
);
443 if (!PyArg_ParseTuple(_args
, "O&",
444 PyMac_GetOSType
, &theAEKeyword
))
446 _err
= AESizeOfParam(&_self
->ob_itself
,
450 if (_err
!= noErr
) return PyMac_Error(_err
);
451 _res
= Py_BuildValue("O&l",
452 PyMac_BuildOSType
, typeCode
,
457 static PyObject
*AEDesc_AEDeleteParam(AEDescObject
*_self
, PyObject
*_args
)
459 PyObject
*_res
= NULL
;
461 AEKeyword theAEKeyword
;
462 #ifndef AEDeleteParam
463 PyMac_PRECHECK(AEDeleteParam
);
465 if (!PyArg_ParseTuple(_args
, "O&",
466 PyMac_GetOSType
, &theAEKeyword
))
468 _err
= AEDeleteParam(&_self
->ob_itself
,
470 if (_err
!= noErr
) return PyMac_Error(_err
);
476 static PyObject
*AEDesc_AEGetAttributePtr(AEDescObject
*_self
, PyObject
*_args
)
478 PyObject
*_res
= NULL
;
480 AEKeyword theAEKeyword
;
481 DescType desiredType
;
483 char *dataPtr__out__
;
485 int dataPtr__in_len__
;
486 #ifndef AEGetAttributePtr
487 PyMac_PRECHECK(AEGetAttributePtr
);
489 if (!PyArg_ParseTuple(_args
, "O&O&i",
490 PyMac_GetOSType
, &theAEKeyword
,
491 PyMac_GetOSType
, &desiredType
,
494 if ((dataPtr__out__
= malloc(dataPtr__in_len__
)) == NULL
)
497 goto dataPtr__error__
;
499 dataPtr__len__
= dataPtr__in_len__
;
500 _err
= AEGetAttributePtr(&_self
->ob_itself
,
504 dataPtr__out__
, dataPtr__len__
, &dataPtr__len__
);
505 if (_err
!= noErr
) return PyMac_Error(_err
);
506 _res
= Py_BuildValue("O&s#",
507 PyMac_BuildOSType
, typeCode
,
508 dataPtr__out__
, (int)dataPtr__len__
);
509 free(dataPtr__out__
);
514 static PyObject
*AEDesc_AEGetAttributeDesc(AEDescObject
*_self
, PyObject
*_args
)
516 PyObject
*_res
= NULL
;
518 AEKeyword theAEKeyword
;
519 DescType desiredType
;
521 #ifndef AEGetAttributeDesc
522 PyMac_PRECHECK(AEGetAttributeDesc
);
524 if (!PyArg_ParseTuple(_args
, "O&O&",
525 PyMac_GetOSType
, &theAEKeyword
,
526 PyMac_GetOSType
, &desiredType
))
528 _err
= AEGetAttributeDesc(&_self
->ob_itself
,
532 if (_err
!= noErr
) return PyMac_Error(_err
);
533 _res
= Py_BuildValue("O&",
534 AEDesc_New
, &result
);
538 static PyObject
*AEDesc_AESizeOfAttribute(AEDescObject
*_self
, PyObject
*_args
)
540 PyObject
*_res
= NULL
;
542 AEKeyword theAEKeyword
;
545 #ifndef AESizeOfAttribute
546 PyMac_PRECHECK(AESizeOfAttribute
);
548 if (!PyArg_ParseTuple(_args
, "O&",
549 PyMac_GetOSType
, &theAEKeyword
))
551 _err
= AESizeOfAttribute(&_self
->ob_itself
,
555 if (_err
!= noErr
) return PyMac_Error(_err
);
556 _res
= Py_BuildValue("O&l",
557 PyMac_BuildOSType
, typeCode
,
562 static PyObject
*AEDesc_AEPutAttributePtr(AEDescObject
*_self
, PyObject
*_args
)
564 PyObject
*_res
= NULL
;
566 AEKeyword theAEKeyword
;
570 int dataPtr__in_len__
;
571 #ifndef AEPutAttributePtr
572 PyMac_PRECHECK(AEPutAttributePtr
);
574 if (!PyArg_ParseTuple(_args
, "O&O&s#",
575 PyMac_GetOSType
, &theAEKeyword
,
576 PyMac_GetOSType
, &typeCode
,
577 &dataPtr__in__
, &dataPtr__in_len__
))
579 dataPtr__len__
= dataPtr__in_len__
;
580 _err
= AEPutAttributePtr(&_self
->ob_itself
,
583 dataPtr__in__
, dataPtr__len__
);
584 if (_err
!= noErr
) return PyMac_Error(_err
);
590 static PyObject
*AEDesc_AEPutAttributeDesc(AEDescObject
*_self
, PyObject
*_args
)
592 PyObject
*_res
= NULL
;
594 AEKeyword theAEKeyword
;
596 #ifndef AEPutAttributeDesc
597 PyMac_PRECHECK(AEPutAttributeDesc
);
599 if (!PyArg_ParseTuple(_args
, "O&O&",
600 PyMac_GetOSType
, &theAEKeyword
,
601 AEDesc_Convert
, &theAEDesc
))
603 _err
= AEPutAttributeDesc(&_self
->ob_itself
,
606 if (_err
!= noErr
) return PyMac_Error(_err
);
612 static PyObject
*AEDesc_AEGetDescDataSize(AEDescObject
*_self
, PyObject
*_args
)
614 PyObject
*_res
= NULL
;
616 #ifndef AEGetDescDataSize
617 PyMac_PRECHECK(AEGetDescDataSize
);
619 if (!PyArg_ParseTuple(_args
, ""))
621 _rv
= AEGetDescDataSize(&_self
->ob_itself
);
622 _res
= Py_BuildValue("l",
627 static PyObject
*AEDesc_AESend(AEDescObject
*_self
, PyObject
*_args
)
629 PyObject
*_res
= NULL
;
633 AESendPriority sendPriority
;
636 PyMac_PRECHECK(AESend
);
638 if (!PyArg_ParseTuple(_args
, "lhl",
643 _err
= AESend(&_self
->ob_itself
,
650 if (_err
!= noErr
) return PyMac_Error(_err
);
651 _res
= Py_BuildValue("O&",
656 static PyObject
*AEDesc_AEResetTimer(AEDescObject
*_self
, PyObject
*_args
)
658 PyObject
*_res
= NULL
;
661 PyMac_PRECHECK(AEResetTimer
);
663 if (!PyArg_ParseTuple(_args
, ""))
665 _err
= AEResetTimer(&_self
->ob_itself
);
666 if (_err
!= noErr
) return PyMac_Error(_err
);
672 static PyObject
*AEDesc_AESuspendTheCurrentEvent(AEDescObject
*_self
, PyObject
*_args
)
674 PyObject
*_res
= NULL
;
676 #ifndef AESuspendTheCurrentEvent
677 PyMac_PRECHECK(AESuspendTheCurrentEvent
);
679 if (!PyArg_ParseTuple(_args
, ""))
681 _err
= AESuspendTheCurrentEvent(&_self
->ob_itself
);
682 if (_err
!= noErr
) return PyMac_Error(_err
);
688 static PyObject
*AEDesc_AEResumeTheCurrentEvent(AEDescObject
*_self
, PyObject
*_args
)
690 PyObject
*_res
= NULL
;
693 AEEventHandlerUPP dispatcher__proc__
= upp_GenericEventHandler
;
694 PyObject
*dispatcher
;
695 #ifndef AEResumeTheCurrentEvent
696 PyMac_PRECHECK(AEResumeTheCurrentEvent
);
698 if (!PyArg_ParseTuple(_args
, "O&O",
699 AEDesc_Convert
, &reply
,
702 _err
= AEResumeTheCurrentEvent(&_self
->ob_itself
,
704 dispatcher__proc__
, (long)dispatcher
);
705 if (_err
!= noErr
) return PyMac_Error(_err
);
708 Py_INCREF(dispatcher
); /* XXX leak, but needed */
712 static PyObject
*AEDesc_AEGetTheCurrentEvent(AEDescObject
*_self
, PyObject
*_args
)
714 PyObject
*_res
= NULL
;
716 #ifndef AEGetTheCurrentEvent
717 PyMac_PRECHECK(AEGetTheCurrentEvent
);
719 if (!PyArg_ParseTuple(_args
, ""))
721 _err
= AEGetTheCurrentEvent(&_self
->ob_itself
);
722 if (_err
!= noErr
) return PyMac_Error(_err
);
728 static PyObject
*AEDesc_AESetTheCurrentEvent(AEDescObject
*_self
, PyObject
*_args
)
730 PyObject
*_res
= NULL
;
732 #ifndef AESetTheCurrentEvent
733 PyMac_PRECHECK(AESetTheCurrentEvent
);
735 if (!PyArg_ParseTuple(_args
, ""))
737 _err
= AESetTheCurrentEvent(&_self
->ob_itself
);
738 if (_err
!= noErr
) return PyMac_Error(_err
);
744 static PyObject
*AEDesc_AEResolve(AEDescObject
*_self
, PyObject
*_args
)
746 PyObject
*_res
= NULL
;
751 PyMac_PRECHECK(AEResolve
);
753 if (!PyArg_ParseTuple(_args
, "h",
756 _err
= AEResolve(&_self
->ob_itself
,
759 if (_err
!= noErr
) return PyMac_Error(_err
);
760 _res
= Py_BuildValue("O&",
761 AEDesc_New
, &theToken
);
765 static PyObject
*AEDesc_AutoDispose(AEDescObject
*_self
, PyObject
*_args
)
767 PyObject
*_res
= NULL
;
770 if (!PyArg_ParseTuple(_args
, "i", &onoff
))
772 old
= _self
->ob_owned
;
773 _self
->ob_owned
= onoff
;
774 _res
= Py_BuildValue("i", old
);
779 static PyMethodDef AEDesc_methods
[] = {
780 {"AECoerceDesc", (PyCFunction
)AEDesc_AECoerceDesc
, 1,
781 PyDoc_STR("(DescType toType) -> (AEDesc result)")},
782 {"AEDuplicateDesc", (PyCFunction
)AEDesc_AEDuplicateDesc
, 1,
783 PyDoc_STR("() -> (AEDesc result)")},
784 {"AECountItems", (PyCFunction
)AEDesc_AECountItems
, 1,
785 PyDoc_STR("() -> (long theCount)")},
786 {"AEPutPtr", (PyCFunction
)AEDesc_AEPutPtr
, 1,
787 PyDoc_STR("(long index, DescType typeCode, Buffer dataPtr) -> None")},
788 {"AEPutDesc", (PyCFunction
)AEDesc_AEPutDesc
, 1,
789 PyDoc_STR("(long index, AEDesc theAEDesc) -> None")},
790 {"AEGetNthPtr", (PyCFunction
)AEDesc_AEGetNthPtr
, 1,
791 PyDoc_STR("(long index, DescType desiredType, Buffer dataPtr) -> (AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr)")},
792 {"AEGetNthDesc", (PyCFunction
)AEDesc_AEGetNthDesc
, 1,
793 PyDoc_STR("(long index, DescType desiredType) -> (AEKeyword theAEKeyword, AEDesc result)")},
794 {"AESizeOfNthItem", (PyCFunction
)AEDesc_AESizeOfNthItem
, 1,
795 PyDoc_STR("(long index) -> (DescType typeCode, Size dataSize)")},
796 {"AEDeleteItem", (PyCFunction
)AEDesc_AEDeleteItem
, 1,
797 PyDoc_STR("(long index) -> None")},
798 {"AEPutParamPtr", (PyCFunction
)AEDesc_AEPutParamPtr
, 1,
799 PyDoc_STR("(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None")},
800 {"AEPutParamDesc", (PyCFunction
)AEDesc_AEPutParamDesc
, 1,
801 PyDoc_STR("(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None")},
802 {"AEGetParamPtr", (PyCFunction
)AEDesc_AEGetParamPtr
, 1,
803 PyDoc_STR("(AEKeyword theAEKeyword, DescType desiredType, Buffer dataPtr) -> (DescType typeCode, Buffer dataPtr)")},
804 {"AEGetParamDesc", (PyCFunction
)AEDesc_AEGetParamDesc
, 1,
805 PyDoc_STR("(AEKeyword theAEKeyword, DescType desiredType) -> (AEDesc result)")},
806 {"AESizeOfParam", (PyCFunction
)AEDesc_AESizeOfParam
, 1,
807 PyDoc_STR("(AEKeyword theAEKeyword) -> (DescType typeCode, Size dataSize)")},
808 {"AEDeleteParam", (PyCFunction
)AEDesc_AEDeleteParam
, 1,
809 PyDoc_STR("(AEKeyword theAEKeyword) -> None")},
810 {"AEGetAttributePtr", (PyCFunction
)AEDesc_AEGetAttributePtr
, 1,
811 PyDoc_STR("(AEKeyword theAEKeyword, DescType desiredType, Buffer dataPtr) -> (DescType typeCode, Buffer dataPtr)")},
812 {"AEGetAttributeDesc", (PyCFunction
)AEDesc_AEGetAttributeDesc
, 1,
813 PyDoc_STR("(AEKeyword theAEKeyword, DescType desiredType) -> (AEDesc result)")},
814 {"AESizeOfAttribute", (PyCFunction
)AEDesc_AESizeOfAttribute
, 1,
815 PyDoc_STR("(AEKeyword theAEKeyword) -> (DescType typeCode, Size dataSize)")},
816 {"AEPutAttributePtr", (PyCFunction
)AEDesc_AEPutAttributePtr
, 1,
817 PyDoc_STR("(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None")},
818 {"AEPutAttributeDesc", (PyCFunction
)AEDesc_AEPutAttributeDesc
, 1,
819 PyDoc_STR("(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None")},
820 {"AEGetDescDataSize", (PyCFunction
)AEDesc_AEGetDescDataSize
, 1,
821 PyDoc_STR("() -> (Size _rv)")},
822 {"AESend", (PyCFunction
)AEDesc_AESend
, 1,
823 PyDoc_STR("(AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks) -> (AppleEvent reply)")},
824 {"AEResetTimer", (PyCFunction
)AEDesc_AEResetTimer
, 1,
825 PyDoc_STR("() -> None")},
826 {"AESuspendTheCurrentEvent", (PyCFunction
)AEDesc_AESuspendTheCurrentEvent
, 1,
827 PyDoc_STR("() -> None")},
828 {"AEResumeTheCurrentEvent", (PyCFunction
)AEDesc_AEResumeTheCurrentEvent
, 1,
829 PyDoc_STR("(AppleEvent reply, EventHandler dispatcher) -> None")},
830 {"AEGetTheCurrentEvent", (PyCFunction
)AEDesc_AEGetTheCurrentEvent
, 1,
831 PyDoc_STR("() -> None")},
832 {"AESetTheCurrentEvent", (PyCFunction
)AEDesc_AESetTheCurrentEvent
, 1,
833 PyDoc_STR("() -> None")},
834 {"AEResolve", (PyCFunction
)AEDesc_AEResolve
, 1,
835 PyDoc_STR("(short callbackFlags) -> (AEDesc theToken)")},
836 {"AutoDispose", (PyCFunction
)AEDesc_AutoDispose
, 1,
837 PyDoc_STR("(int)->int. Automatically AEDisposeDesc the object on Python object cleanup")},
841 static PyObject
*AEDesc_get_type(AEDescObject
*self
, void *closure
)
843 return PyMac_BuildOSType(self
->ob_itself
.descriptorType
);
846 #define AEDesc_set_type NULL
848 static PyObject
*AEDesc_get_data(AEDescObject
*self
, void *closure
)
856 size
= AEGetDescDataSize(&self
->ob_itself
);
857 if ( (res
= PyString_FromStringAndSize(NULL
, size
)) == NULL
)
859 if ( (ptr
= PyString_AsString(res
)) == NULL
)
861 if ( (err
=AEGetDescData(&self
->ob_itself
, ptr
, size
)) < 0 )
862 return PyMac_Error(err
);
867 #define AEDesc_set_data NULL
869 static PyGetSetDef AEDesc_getsetlist
[] = {
870 {"type", (getter
)AEDesc_get_type
, (setter
)AEDesc_set_type
, "Type of this AEDesc"},
871 {"data", (getter
)AEDesc_get_data
, (setter
)AEDesc_set_data
, "The raw data in this AEDesc"},
872 {NULL
, NULL
, NULL
, NULL
},
876 #define AEDesc_compare NULL
878 #define AEDesc_repr NULL
880 #define AEDesc_hash NULL
881 #define AEDesc_tp_init 0
883 #define AEDesc_tp_alloc PyType_GenericAlloc
885 static PyObject
*AEDesc_tp_new(PyTypeObject
*type
, PyObject
*args
, PyObject
*kwds
)
889 char *kw
[] = {"itself", 0};
891 if (!PyArg_ParseTupleAndKeywords(args
, kwds
, "O&", kw
, AEDesc_Convert
, &itself
)) return NULL
;
892 if ((self
= type
->tp_alloc(type
, 0)) == NULL
) return NULL
;
893 ((AEDescObject
*)self
)->ob_itself
= itself
;
897 #define AEDesc_tp_free PyObject_Del
900 PyTypeObject AEDesc_Type
= {
901 PyObject_HEAD_INIT(NULL
)
903 "_AE.AEDesc", /*tp_name*/
904 sizeof(AEDescObject
), /*tp_basicsize*/
907 (destructor
) AEDesc_dealloc
, /*tp_dealloc*/
909 (getattrfunc
)0, /*tp_getattr*/
910 (setattrfunc
)0, /*tp_setattr*/
911 (cmpfunc
) AEDesc_compare
, /*tp_compare*/
912 (reprfunc
) AEDesc_repr
, /*tp_repr*/
913 (PyNumberMethods
*)0, /* tp_as_number */
914 (PySequenceMethods
*)0, /* tp_as_sequence */
915 (PyMappingMethods
*)0, /* tp_as_mapping */
916 (hashfunc
) AEDesc_hash
, /*tp_hash*/
919 PyObject_GenericGetAttr
, /*tp_getattro*/
920 PyObject_GenericSetAttr
, /*tp_setattro */
922 Py_TPFLAGS_DEFAULT
|Py_TPFLAGS_BASETYPE
, /* tp_flags */
926 0, /*tp_richcompare*/
927 0, /*tp_weaklistoffset*/
930 AEDesc_methods
, /* tp_methods */
932 AEDesc_getsetlist
, /*tp_getset*/
938 AEDesc_tp_init
, /* tp_init */
939 AEDesc_tp_alloc
, /* tp_alloc */
940 AEDesc_tp_new
, /* tp_new */
941 AEDesc_tp_free
, /* tp_free */
944 /* --------------------- End object type AEDesc --------------------- */
947 static PyObject
*AE_AECoercePtr(PyObject
*_self
, PyObject
*_args
)
949 PyObject
*_res
= NULL
;
954 int dataPtr__in_len__
;
958 PyMac_PRECHECK(AECoercePtr
);
960 if (!PyArg_ParseTuple(_args
, "O&s#O&",
961 PyMac_GetOSType
, &typeCode
,
962 &dataPtr__in__
, &dataPtr__in_len__
,
963 PyMac_GetOSType
, &toType
))
965 dataPtr__len__
= dataPtr__in_len__
;
966 _err
= AECoercePtr(typeCode
,
967 dataPtr__in__
, dataPtr__len__
,
970 if (_err
!= noErr
) return PyMac_Error(_err
);
971 _res
= Py_BuildValue("O&",
972 AEDesc_New
, &result
);
976 static PyObject
*AE_AECreateDesc(PyObject
*_self
, PyObject
*_args
)
978 PyObject
*_res
= NULL
;
983 int dataPtr__in_len__
;
986 PyMac_PRECHECK(AECreateDesc
);
988 if (!PyArg_ParseTuple(_args
, "O&s#",
989 PyMac_GetOSType
, &typeCode
,
990 &dataPtr__in__
, &dataPtr__in_len__
))
992 dataPtr__len__
= dataPtr__in_len__
;
993 _err
= AECreateDesc(typeCode
,
994 dataPtr__in__
, dataPtr__len__
,
996 if (_err
!= noErr
) return PyMac_Error(_err
);
997 _res
= Py_BuildValue("O&",
998 AEDesc_New
, &result
);
1002 static PyObject
*AE_AECreateList(PyObject
*_self
, PyObject
*_args
)
1004 PyObject
*_res
= NULL
;
1006 char *factoringPtr__in__
;
1007 long factoringPtr__len__
;
1008 int factoringPtr__in_len__
;
1010 AEDescList resultList
;
1011 #ifndef AECreateList
1012 PyMac_PRECHECK(AECreateList
);
1014 if (!PyArg_ParseTuple(_args
, "s#b",
1015 &factoringPtr__in__
, &factoringPtr__in_len__
,
1018 factoringPtr__len__
= factoringPtr__in_len__
;
1019 _err
= AECreateList(factoringPtr__in__
, factoringPtr__len__
,
1022 if (_err
!= noErr
) return PyMac_Error(_err
);
1023 _res
= Py_BuildValue("O&",
1024 AEDesc_New
, &resultList
);
1028 static PyObject
*AE_AECreateAppleEvent(PyObject
*_self
, PyObject
*_args
)
1030 PyObject
*_res
= NULL
;
1032 AEEventClass theAEEventClass
;
1033 AEEventID theAEEventID
;
1034 AEAddressDesc target
;
1035 AEReturnID returnID
;
1036 AETransactionID transactionID
;
1038 #ifndef AECreateAppleEvent
1039 PyMac_PRECHECK(AECreateAppleEvent
);
1041 if (!PyArg_ParseTuple(_args
, "O&O&O&hl",
1042 PyMac_GetOSType
, &theAEEventClass
,
1043 PyMac_GetOSType
, &theAEEventID
,
1044 AEDesc_Convert
, &target
,
1048 _err
= AECreateAppleEvent(theAEEventClass
,
1054 if (_err
!= noErr
) return PyMac_Error(_err
);
1055 _res
= Py_BuildValue("O&",
1056 AEDesc_New
, &result
);
1060 static PyObject
*AE_AEReplaceDescData(PyObject
*_self
, PyObject
*_args
)
1062 PyObject
*_res
= NULL
;
1065 char *dataPtr__in__
;
1066 long dataPtr__len__
;
1067 int dataPtr__in_len__
;
1069 #ifndef AEReplaceDescData
1070 PyMac_PRECHECK(AEReplaceDescData
);
1072 if (!PyArg_ParseTuple(_args
, "O&s#",
1073 PyMac_GetOSType
, &typeCode
,
1074 &dataPtr__in__
, &dataPtr__in_len__
))
1076 dataPtr__len__
= dataPtr__in_len__
;
1077 _err
= AEReplaceDescData(typeCode
,
1078 dataPtr__in__
, dataPtr__len__
,
1080 if (_err
!= noErr
) return PyMac_Error(_err
);
1081 _res
= Py_BuildValue("O&",
1082 AEDesc_New
, &theAEDesc
);
1086 static PyObject
*AE_AEProcessAppleEvent(PyObject
*_self
, PyObject
*_args
)
1088 PyObject
*_res
= NULL
;
1090 EventRecord theEventRecord
;
1091 #ifndef AEProcessAppleEvent
1092 PyMac_PRECHECK(AEProcessAppleEvent
);
1094 if (!PyArg_ParseTuple(_args
, "O&",
1095 PyMac_GetEventRecord
, &theEventRecord
))
1097 _err
= AEProcessAppleEvent(&theEventRecord
);
1098 if (_err
!= noErr
) return PyMac_Error(_err
);
1104 static PyObject
*AE_AEGetInteractionAllowed(PyObject
*_self
, PyObject
*_args
)
1106 PyObject
*_res
= NULL
;
1108 AEInteractAllowed level
;
1109 #ifndef AEGetInteractionAllowed
1110 PyMac_PRECHECK(AEGetInteractionAllowed
);
1112 if (!PyArg_ParseTuple(_args
, ""))
1114 _err
= AEGetInteractionAllowed(&level
);
1115 if (_err
!= noErr
) return PyMac_Error(_err
);
1116 _res
= Py_BuildValue("b",
1121 static PyObject
*AE_AESetInteractionAllowed(PyObject
*_self
, PyObject
*_args
)
1123 PyObject
*_res
= NULL
;
1125 AEInteractAllowed level
;
1126 #ifndef AESetInteractionAllowed
1127 PyMac_PRECHECK(AESetInteractionAllowed
);
1129 if (!PyArg_ParseTuple(_args
, "b",
1132 _err
= AESetInteractionAllowed(level
);
1133 if (_err
!= noErr
) return PyMac_Error(_err
);
1139 static PyObject
*AE_AEInteractWithUser(PyObject
*_self
, PyObject
*_args
)
1141 PyObject
*_res
= NULL
;
1143 long timeOutInTicks
;
1144 #ifndef AEInteractWithUser
1145 PyMac_PRECHECK(AEInteractWithUser
);
1147 if (!PyArg_ParseTuple(_args
, "l",
1150 _err
= AEInteractWithUser(timeOutInTicks
,
1153 if (_err
!= noErr
) return PyMac_Error(_err
);
1159 static PyObject
*AE_AEInstallEventHandler(PyObject
*_self
, PyObject
*_args
)
1161 PyObject
*_res
= NULL
;
1163 AEEventClass theAEEventClass
;
1164 AEEventID theAEEventID
;
1165 AEEventHandlerUPP handler__proc__
= upp_GenericEventHandler
;
1167 #ifndef AEInstallEventHandler
1168 PyMac_PRECHECK(AEInstallEventHandler
);
1170 if (!PyArg_ParseTuple(_args
, "O&O&O",
1171 PyMac_GetOSType
, &theAEEventClass
,
1172 PyMac_GetOSType
, &theAEEventID
,
1175 _err
= AEInstallEventHandler(theAEEventClass
,
1177 handler__proc__
, (long)handler
,
1179 if (_err
!= noErr
) return PyMac_Error(_err
);
1182 Py_INCREF(handler
); /* XXX leak, but needed */
1186 static PyObject
*AE_AERemoveEventHandler(PyObject
*_self
, PyObject
*_args
)
1188 PyObject
*_res
= NULL
;
1190 AEEventClass theAEEventClass
;
1191 AEEventID theAEEventID
;
1192 #ifndef AERemoveEventHandler
1193 PyMac_PRECHECK(AERemoveEventHandler
);
1195 if (!PyArg_ParseTuple(_args
, "O&O&",
1196 PyMac_GetOSType
, &theAEEventClass
,
1197 PyMac_GetOSType
, &theAEEventID
))
1199 _err
= AERemoveEventHandler(theAEEventClass
,
1201 upp_GenericEventHandler
,
1203 if (_err
!= noErr
) return PyMac_Error(_err
);
1209 static PyObject
*AE_AEGetEventHandler(PyObject
*_self
, PyObject
*_args
)
1211 PyObject
*_res
= NULL
;
1213 AEEventClass theAEEventClass
;
1214 AEEventID theAEEventID
;
1215 AEEventHandlerUPP handler__proc__
= upp_GenericEventHandler
;
1217 #ifndef AEGetEventHandler
1218 PyMac_PRECHECK(AEGetEventHandler
);
1220 if (!PyArg_ParseTuple(_args
, "O&O&",
1221 PyMac_GetOSType
, &theAEEventClass
,
1222 PyMac_GetOSType
, &theAEEventID
))
1224 _err
= AEGetEventHandler(theAEEventClass
,
1226 &handler__proc__
, (long *)&handler
,
1228 if (_err
!= noErr
) return PyMac_Error(_err
);
1229 _res
= Py_BuildValue("O",
1231 Py_INCREF(handler
); /* XXX leak, but needed */
1235 static PyObject
*AE_AEInstallSpecialHandler(PyObject
*_self
, PyObject
*_args
)
1237 PyObject
*_res
= NULL
;
1239 AEKeyword functionClass
;
1240 #ifndef AEInstallSpecialHandler
1241 PyMac_PRECHECK(AEInstallSpecialHandler
);
1243 if (!PyArg_ParseTuple(_args
, "O&",
1244 PyMac_GetOSType
, &functionClass
))
1246 _err
= AEInstallSpecialHandler(functionClass
,
1247 upp_GenericEventHandler
,
1249 if (_err
!= noErr
) return PyMac_Error(_err
);
1255 static PyObject
*AE_AERemoveSpecialHandler(PyObject
*_self
, PyObject
*_args
)
1257 PyObject
*_res
= NULL
;
1259 AEKeyword functionClass
;
1260 #ifndef AERemoveSpecialHandler
1261 PyMac_PRECHECK(AERemoveSpecialHandler
);
1263 if (!PyArg_ParseTuple(_args
, "O&",
1264 PyMac_GetOSType
, &functionClass
))
1266 _err
= AERemoveSpecialHandler(functionClass
,
1267 upp_GenericEventHandler
,
1269 if (_err
!= noErr
) return PyMac_Error(_err
);
1275 static PyObject
*AE_AEManagerInfo(PyObject
*_self
, PyObject
*_args
)
1277 PyObject
*_res
= NULL
;
1281 #ifndef AEManagerInfo
1282 PyMac_PRECHECK(AEManagerInfo
);
1284 if (!PyArg_ParseTuple(_args
, "O&",
1285 PyMac_GetOSType
, &keyWord
))
1287 _err
= AEManagerInfo(keyWord
,
1289 if (_err
!= noErr
) return PyMac_Error(_err
);
1290 _res
= Py_BuildValue("l",
1295 static PyObject
*AE_AEObjectInit(PyObject
*_self
, PyObject
*_args
)
1297 PyObject
*_res
= NULL
;
1299 #ifndef AEObjectInit
1300 PyMac_PRECHECK(AEObjectInit
);
1302 if (!PyArg_ParseTuple(_args
, ""))
1304 _err
= AEObjectInit();
1305 if (_err
!= noErr
) return PyMac_Error(_err
);
1311 static PyObject
*AE_AEDisposeToken(PyObject
*_self
, PyObject
*_args
)
1313 PyObject
*_res
= NULL
;
1316 #ifndef AEDisposeToken
1317 PyMac_PRECHECK(AEDisposeToken
);
1319 if (!PyArg_ParseTuple(_args
, ""))
1321 _err
= AEDisposeToken(&theToken
);
1322 if (_err
!= noErr
) return PyMac_Error(_err
);
1323 _res
= Py_BuildValue("O&",
1324 AEDesc_New
, &theToken
);
1328 static PyObject
*AE_AECallObjectAccessor(PyObject
*_self
, PyObject
*_args
)
1330 PyObject
*_res
= NULL
;
1332 DescType desiredClass
;
1333 AEDesc containerToken
;
1334 DescType containerClass
;
1338 #ifndef AECallObjectAccessor
1339 PyMac_PRECHECK(AECallObjectAccessor
);
1341 if (!PyArg_ParseTuple(_args
, "O&O&O&O&O&",
1342 PyMac_GetOSType
, &desiredClass
,
1343 AEDesc_Convert
, &containerToken
,
1344 PyMac_GetOSType
, &containerClass
,
1345 PyMac_GetOSType
, &keyForm
,
1346 AEDesc_Convert
, &keyData
))
1348 _err
= AECallObjectAccessor(desiredClass
,
1354 if (_err
!= noErr
) return PyMac_Error(_err
);
1355 _res
= Py_BuildValue("O&",
1356 AEDesc_New
, &token
);
1360 static PyMethodDef AE_methods
[] = {
1361 {"AECoercePtr", (PyCFunction
)AE_AECoercePtr
, 1,
1362 PyDoc_STR("(DescType typeCode, Buffer dataPtr, DescType toType) -> (AEDesc result)")},
1363 {"AECreateDesc", (PyCFunction
)AE_AECreateDesc
, 1,
1364 PyDoc_STR("(DescType typeCode, Buffer dataPtr) -> (AEDesc result)")},
1365 {"AECreateList", (PyCFunction
)AE_AECreateList
, 1,
1366 PyDoc_STR("(Buffer factoringPtr, Boolean isRecord) -> (AEDescList resultList)")},
1367 {"AECreateAppleEvent", (PyCFunction
)AE_AECreateAppleEvent
, 1,
1368 PyDoc_STR("(AEEventClass theAEEventClass, AEEventID theAEEventID, AEAddressDesc target, AEReturnID returnID, AETransactionID transactionID) -> (AppleEvent result)")},
1369 {"AEReplaceDescData", (PyCFunction
)AE_AEReplaceDescData
, 1,
1370 PyDoc_STR("(DescType typeCode, Buffer dataPtr) -> (AEDesc theAEDesc)")},
1371 {"AEProcessAppleEvent", (PyCFunction
)AE_AEProcessAppleEvent
, 1,
1372 PyDoc_STR("(EventRecord theEventRecord) -> None")},
1373 {"AEGetInteractionAllowed", (PyCFunction
)AE_AEGetInteractionAllowed
, 1,
1374 PyDoc_STR("() -> (AEInteractAllowed level)")},
1375 {"AESetInteractionAllowed", (PyCFunction
)AE_AESetInteractionAllowed
, 1,
1376 PyDoc_STR("(AEInteractAllowed level) -> None")},
1377 {"AEInteractWithUser", (PyCFunction
)AE_AEInteractWithUser
, 1,
1378 PyDoc_STR("(long timeOutInTicks) -> None")},
1379 {"AEInstallEventHandler", (PyCFunction
)AE_AEInstallEventHandler
, 1,
1380 PyDoc_STR("(AEEventClass theAEEventClass, AEEventID theAEEventID, EventHandler handler) -> None")},
1381 {"AERemoveEventHandler", (PyCFunction
)AE_AERemoveEventHandler
, 1,
1382 PyDoc_STR("(AEEventClass theAEEventClass, AEEventID theAEEventID) -> None")},
1383 {"AEGetEventHandler", (PyCFunction
)AE_AEGetEventHandler
, 1,
1384 PyDoc_STR("(AEEventClass theAEEventClass, AEEventID theAEEventID) -> (EventHandler handler)")},
1385 {"AEInstallSpecialHandler", (PyCFunction
)AE_AEInstallSpecialHandler
, 1,
1386 PyDoc_STR("(AEKeyword functionClass) -> None")},
1387 {"AERemoveSpecialHandler", (PyCFunction
)AE_AERemoveSpecialHandler
, 1,
1388 PyDoc_STR("(AEKeyword functionClass) -> None")},
1389 {"AEManagerInfo", (PyCFunction
)AE_AEManagerInfo
, 1,
1390 PyDoc_STR("(AEKeyword keyWord) -> (long result)")},
1391 {"AEObjectInit", (PyCFunction
)AE_AEObjectInit
, 1,
1392 PyDoc_STR("() -> None")},
1393 {"AEDisposeToken", (PyCFunction
)AE_AEDisposeToken
, 1,
1394 PyDoc_STR("() -> (AEDesc theToken)")},
1395 {"AECallObjectAccessor", (PyCFunction
)AE_AECallObjectAccessor
, 1,
1396 PyDoc_STR("(DescType desiredClass, AEDesc containerToken, DescType containerClass, DescType keyForm, AEDesc keyData) -> (AEDesc token)")},
1403 GenericEventHandler(const AppleEvent
*request
, AppleEvent
*reply
, refcontype refcon
)
1405 PyObject
*handler
= (PyObject
*)refcon
;
1406 AEDescObject
*requestObject
, *replyObject
;
1407 PyObject
*args
, *res
;
1408 if ((requestObject
= (AEDescObject
*)AEDesc_New((AppleEvent
*)request
)) == NULL
) {
1411 if ((replyObject
= (AEDescObject
*)AEDesc_New(reply
)) == NULL
) {
1412 Py_DECREF(requestObject
);
1415 if ((args
= Py_BuildValue("OO", requestObject
, replyObject
)) == NULL
) {
1416 Py_DECREF(requestObject
);
1417 Py_DECREF(replyObject
);
1420 res
= PyEval_CallObject(handler
, args
);
1421 requestObject
->ob_itself
.descriptorType
= 'null';
1422 requestObject
->ob_itself
.dataHandle
= NULL
;
1423 replyObject
->ob_itself
.descriptorType
= 'null';
1424 replyObject
->ob_itself
.dataHandle
= NULL
;
1427 PySys_WriteStderr("Exception in AE event handler function\n");
1435 PyObject
*AEDesc_NewBorrowed(AEDesc
*itself
)
1439 it
= AEDesc_New(itself
);
1441 ((AEDescObject
*)it
)->ob_owned
= 0;
1442 return (PyObject
*)it
;
1454 upp_AEIdleProc
= NewAEIdleUPP(AEIdleProc
);
1455 upp_GenericEventHandler
= NewAEEventHandlerUPP(GenericEventHandler
);
1456 PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc
*, AEDesc_New
);
1457 PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc
*, AEDesc_NewBorrowed
);
1458 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(AEDesc
, AEDesc_Convert
);
1461 m
= Py_InitModule("_AE", AE_methods
);
1462 d
= PyModule_GetDict(m
);
1463 AE_Error
= PyMac_GetOSErrException();
1464 if (AE_Error
== NULL
||
1465 PyDict_SetItemString(d
, "Error", AE_Error
) != 0)
1467 AEDesc_Type
.ob_type
= &PyType_Type
;
1468 if (PyType_Ready(&AEDesc_Type
) < 0) return;
1469 Py_INCREF(&AEDesc_Type
);
1470 PyModule_AddObject(m
, "AEDesc", (PyObject
*)&AEDesc_Type
);
1471 /* Backward-compatible name */
1472 Py_INCREF(&AEDesc_Type
);
1473 PyModule_AddObject(m
, "AEDescType", (PyObject
*)&AEDesc_Type
);
1476 /* ========================= End module _AE ========================= */