예제 #1
0
void init_AE(void)
{
	PyObject *m;
	PyObject *d;



		upp_AEIdleProc = NewAEIdleUPP(AEIdleProc);
		upp_GenericEventHandler = NewAEEventHandlerUPP(GenericEventHandler);
		upp_GenericCoercionHandler = NewAECoerceDescUPP(GenericCoercionHandler);
		
		PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc *, AEDesc_New);
		PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc *, AEDesc_NewBorrowed);
		PyMac_INIT_TOOLBOX_OBJECT_CONVERT(AEDesc, AEDesc_Convert);


	m = Py_InitModule("_AE", AE_methods);
	d = PyModule_GetDict(m);
	AE_Error = PyMac_GetOSErrException();
	if (AE_Error == NULL ||
	    PyDict_SetItemString(d, "Error", AE_Error) != 0)
		return;
	AEDesc_Type.ob_type = &PyType_Type;
	if (PyType_Ready(&AEDesc_Type) < 0) return;
	Py_INCREF(&AEDesc_Type);
	PyModule_AddObject(m, "AEDesc", (PyObject *)&AEDesc_Type);
	/* Backward-compatible name */
	Py_INCREF(&AEDesc_Type);
	PyModule_AddObject(m, "AEDescType", (PyObject *)&AEDesc_Type);
}
예제 #2
0
void init_Cm(void)
{
	PyObject *m;
	PyObject *d;



		PyMac_INIT_TOOLBOX_OBJECT_NEW(Component, CmpObj_New);
		PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Component, CmpObj_Convert);
		PyMac_INIT_TOOLBOX_OBJECT_NEW(ComponentInstance, CmpInstObj_New);
		PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ComponentInstance, CmpInstObj_Convert);


	m = Py_InitModule("_Cm", Cm_methods);
	d = PyModule_GetDict(m);
	Cm_Error = PyMac_GetOSErrException();
	if (Cm_Error == NULL ||
	    PyDict_SetItemString(d, "Error", Cm_Error) != 0)
		return;
	ComponentInstance_Type.ob_type = &PyType_Type;
	if (PyType_Ready(&ComponentInstance_Type) < 0) return;
	Py_INCREF(&ComponentInstance_Type);
	PyModule_AddObject(m, "ComponentInstance", (PyObject *)&ComponentInstance_Type);
	/* Backward-compatible name */
	Py_INCREF(&ComponentInstance_Type);
	PyModule_AddObject(m, "ComponentInstanceType", (PyObject *)&ComponentInstance_Type);
	Component_Type.ob_type = &PyType_Type;
	if (PyType_Ready(&Component_Type) < 0) return;
	Py_INCREF(&Component_Type);
	PyModule_AddObject(m, "Component", (PyObject *)&Component_Type);
	/* Backward-compatible name */
	Py_INCREF(&Component_Type);
	PyModule_AddObject(m, "ComponentType", (PyObject *)&Component_Type);
}
예제 #3
0
void init_TE(void)
{
    PyObject *m;
#ifndef __LP64__
    PyObject *d;



        PyMac_INIT_TOOLBOX_OBJECT_NEW(TEHandle, TEObj_New);
        PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEHandle, TEObj_Convert);

#endif /* __LP64__ */

    m = Py_InitModule("_TE", TE_methods);
#ifndef __LP64__
    d = PyModule_GetDict(m);
    TE_Error = PyMac_GetOSErrException();
    if (TE_Error == NULL ||
        PyDict_SetItemString(d, "Error", TE_Error) != 0)
        return;
    TE_Type.ob_type = &PyType_Type;
    if (PyType_Ready(&TE_Type) < 0) return;
    Py_INCREF(&TE_Type);
    PyModule_AddObject(m, "TE", (PyObject *)&TE_Type);
    /* Backward-compatible name */
    Py_INCREF(&TE_Type);
    PyModule_AddObject(m, "TEType", (PyObject *)&TE_Type);
#endif /* __LP64__ */
}
예제 #4
0
void init_Drag(void)
{
	PyObject *m;
	PyObject *d;



		PyMac_INIT_TOOLBOX_OBJECT_NEW(DragRef, DragObj_New);
		PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DragRef, DragObj_Convert);


	m = Py_InitModule("_Drag", Drag_methods);
	d = PyModule_GetDict(m);
	Drag_Error = PyMac_GetOSErrException();
	if (Drag_Error == NULL ||
	    PyDict_SetItemString(d, "Error", Drag_Error) != 0)
		return;
	DragObj_Type.ob_type = &PyType_Type;
	if (PyType_Ready(&DragObj_Type) < 0) return;
	Py_INCREF(&DragObj_Type);
	PyModule_AddObject(m, "DragObj", (PyObject *)&DragObj_Type);
	/* Backward-compatible name */
	Py_INCREF(&DragObj_Type);
	PyModule_AddObject(m, "DragObjType", (PyObject *)&DragObj_Type);

	dragglue_TrackingHandlerUPP = NewDragTrackingHandlerUPP(dragglue_TrackingHandler);
	dragglue_ReceiveHandlerUPP = NewDragReceiveHandlerUPP(dragglue_ReceiveHandler);
	dragglue_SendDataUPP = NewDragSendDataUPP(dragglue_SendData);
#if 0
	dragglue_InputUPP = NewDragInputUPP(dragglue_Input);
	dragglue_DrawingUPP = NewDragDrawingUPP(dragglue_Drawing);
#endif


}
예제 #5
0
파일: _OSAmodule.c 프로젝트: RDWang/python
void init_OSA(void)
{
    PyObject *m;
    PyObject *d;



    /*
        PyMac_INIT_TOOLBOX_OBJECT_NEW(ComponentInstance, OSAObj_New);
        PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ComponentInstance, OSAObj_Convert);
    */


    m = Py_InitModule("_OSA", OSA_methods);
    d = PyModule_GetDict(m);
    OSA_Error = PyMac_GetOSErrException();
    if (OSA_Error == NULL ||
        PyDict_SetItemString(d, "Error", OSA_Error) != 0)
        return;
    OSAComponentInstance_Type.ob_type = &PyType_Type;
    if (PyType_Ready(&OSAComponentInstance_Type) < 0) return;
    Py_INCREF(&OSAComponentInstance_Type);
    PyModule_AddObject(m, "OSAComponentInstance", (PyObject *)&OSAComponentInstance_Type);
    /* Backward-compatible name */
    Py_INCREF(&OSAComponentInstance_Type);
    PyModule_AddObject(m, "OSAComponentInstanceType", (PyObject *)&OSAComponentInstance_Type);
}
예제 #6
0
void init_Res(void)
{
    PyObject *m;
    PyObject *d;



        PyMac_INIT_TOOLBOX_OBJECT_NEW(Handle, ResObj_New);
        PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Handle, ResObj_Convert);
        PyMac_INIT_TOOLBOX_OBJECT_NEW(Handle, OptResObj_New);
        PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Handle, OptResObj_Convert);


    m = Py_InitModule("_Res", Res_methods);
    d = PyModule_GetDict(m);
    Res_Error = PyMac_GetOSErrException();
    if (Res_Error == NULL ||
        PyDict_SetItemString(d, "Error", Res_Error) != 0)
        return;
    Resource_Type.ob_type = &PyType_Type;
    if (PyType_Ready(&Resource_Type) < 0) return;
    Py_INCREF(&Resource_Type);
    PyModule_AddObject(m, "Resource", (PyObject *)&Resource_Type);
    /* Backward-compatible name */
    Py_INCREF(&Resource_Type);
    PyModule_AddObject(m, "ResourceType", (PyObject *)&Resource_Type);
}
예제 #7
0
void init_Snd(void)
{
	PyObject *m;
	PyObject *d;





	m = Py_InitModule("_Snd", Snd_methods);
	d = PyModule_GetDict(m);
	Snd_Error = PyMac_GetOSErrException();
	if (Snd_Error == NULL ||
	    PyDict_SetItemString(d, "Error", Snd_Error) != 0)
		return;
	SndChannel_Type.ob_type = &PyType_Type;
	if (PyType_Ready(&SndChannel_Type) < 0) return;
	Py_INCREF(&SndChannel_Type);
	PyModule_AddObject(m, "SndChannel", (PyObject *)&SndChannel_Type);
	/* Backward-compatible name */
	Py_INCREF(&SndChannel_Type);
	PyModule_AddObject(m, "SndChannelType", (PyObject *)&SndChannel_Type);
	SPB_Type.ob_type = &PyType_Type;
	if (PyType_Ready(&SPB_Type) < 0) return;
	Py_INCREF(&SPB_Type);
	PyModule_AddObject(m, "SPB", (PyObject *)&SPB_Type);
	/* Backward-compatible name */
	Py_INCREF(&SPB_Type);
	PyModule_AddObject(m, "SPBType", (PyObject *)&SPB_Type);
}
예제 #8
0
void init_AE(void)
{
	PyObject *m;
	PyObject *d;



		upp_AEIdleProc = NewAEIdleUPP(AEIdleProc);
		upp_GenericEventHandler = NewAEEventHandlerUPP(GenericEventHandler);
		upp_GenericCoercionHandler = NewAECoerceDescUPP(GenericCoercionHandler);

	

	m = Py_InitModule("_AE", AE_methods);
	d = PyModule_GetDict(m);
	AE_Error = PyMac_GetOSErrException();
	if (AE_Error == NULL ||
	    PyDict_SetItemString(d, "Error", AE_Error) != 0)
		return;
	AEDesc_Type.ob_type = &PyType_Type;
	if (PyType_Ready(&AEDesc_Type) < 0) return;
	Py_INCREF(&AEDesc_Type);
	PyModule_AddObject(m, "AEDesc", (PyObject *)&AEDesc_Type);
	/* Backward-compatible name */
	Py_INCREF(&AEDesc_Type);
	PyModule_AddObject(m, "AEDescType", (PyObject *)&AEDesc_Type);

	PyObject *aeAPIObj = PyCObject_FromVoidPtr((void *)&aeAPI, NULL);
	PyModule_AddObject(m, "aeAPI", aeAPIObj);
}
예제 #9
0
void init_Launch(void)
{
    PyObject *m;
    PyObject *d;




    m = Py_InitModule("_Launch", Launch_methods);
    d = PyModule_GetDict(m);
    Launch_Error = PyMac_GetOSErrException();
    if (Launch_Error == NULL ||
        PyDict_SetItemString(d, "Error", Launch_Error) != 0)
        return;
}
예제 #10
0
void init_Folder(void)
{
	PyObject *m;
	PyObject *d;




	m = Py_InitModule("_Folder", Folder_methods);
	d = PyModule_GetDict(m);
	Folder_Error = PyMac_GetOSErrException();
	if (Folder_Error == NULL ||
	    PyDict_SetItemString(d, "Error", Folder_Error) != 0)
		return;
}
예제 #11
0
void init_Icn(void)
{
	PyObject *m;
	PyObject *d;




	m = Py_InitModule("_Icn", Icn_methods);
	d = PyModule_GetDict(m);
	Icn_Error = PyMac_GetOSErrException();
	if (Icn_Error == NULL ||
	    PyDict_SetItemString(d, "Error", Icn_Error) != 0)
		return;
}
void
initMacOS(void)
{
    PyObject *m, *d;

    if (PyErr_WarnPy3k("In 3.x, MacOS is removed.", 1))
        return;

    m = Py_InitModule("MacOS", MacOS_Methods);
    d = PyModule_GetDict(m);

    /* Initialize MacOS.Error exception */
    MacOS_Error = PyMac_GetOSErrException();
    if (MacOS_Error == NULL || PyDict_SetItemString(d, "Error", MacOS_Error) != 0)
        return;
    Rftype.ob_type = &PyType_Type;
    Py_INCREF(&Rftype);
    if (PyDict_SetItemString(d, "ResourceForkType", (PyObject *)&Rftype) != 0)
        return;
    /*
    ** This is a hack: the following constant added to the id() of a string
    ** object gives you the address of the data. Unfortunately, it is needed for
    ** some of the image and sound processing interfaces on the mac:-(
    */
    {
        PyStringObject *p = 0;
        long off = (long)&(p->ob_sval[0]);

        if( PyDict_SetItemString(d, "string_id_to_buffer", Py_BuildValue("i", off)) != 0)
            return;
    }
#define PY_RUNTIMEMODEL "macho"
    if (PyDict_SetItemString(d, "runtimemodel",
                            Py_BuildValue("s", PY_RUNTIMEMODEL)) != 0)
        return;
#if defined(WITH_NEXT_FRAMEWORK)
#define PY_LINKMODEL "framework"
#elif defined(Py_ENABLE_SHARED)
#define PY_LINKMODEL "shared"
#else
#define PY_LINKMODEL "static"
#endif
    if (PyDict_SetItemString(d, "linkmodel",
                            Py_BuildValue("s", PY_LINKMODEL)) != 0)
        return;

}
예제 #13
0
void init_Evt(void)
{
    PyObject *m;
#ifndef __LP64__
    PyObject *d;
#endif /* __LP64__ */




    m = Py_InitModule("_Evt", Evt_methods);
#ifndef __LP64__
    d = PyModule_GetDict(m);
    Evt_Error = PyMac_GetOSErrException();
    if (Evt_Error == NULL ||
        PyDict_SetItemString(d, "Error", Evt_Error) != 0)
        return;
#endif /* __LP64__ */
}
예제 #14
0
void
initicglue(void)
{
	PyObject *m, *d;

	/* Create the module and add the functions */
	m = Py_InitModule4("icglue", ic_methods,
		icglue_module_documentation,
		(PyObject*)NULL,PYTHON_API_VERSION);

	/* Add some symbolic constants to the module */
	d = PyModule_GetDict(m);
	ErrorObject = PyMac_GetOSErrException();
	if (ErrorObject == NULL ||
	    PyDict_SetItemString(d, "error", ErrorObject) != 0)
		return;

	/* XXXX Add constants here */
	
	/* Check for errors */
	if (PyErr_Occurred())
		Py_FatalError("can't initialize module icglue");
}
예제 #15
0
void init_Scrap(void)
{
	PyObject *m;
#ifndef __LP64__
	PyObject *d;
#endif /* __LP64__ */




	m = Py_InitModule("_Scrap", Scrap_methods);
#ifndef __LP64__
	d = PyModule_GetDict(m);
	Scrap_Error = PyMac_GetOSErrException();
	if (Scrap_Error == NULL ||
	    PyDict_SetItemString(d, "Error", Scrap_Error) != 0)
		return;
	Scrap_Type.ob_type = &PyType_Type;
	Py_INCREF(&Scrap_Type);
	if (PyDict_SetItemString(d, "ScrapType", (PyObject *)&Scrap_Type) != 0)
		Py_FatalError("can't initialize ScrapType");
#endif /* __LP64__ */
}
예제 #16
0
void init_IBCarbon(void)
{
	PyObject *m;
	PyObject *d;





	m = Py_InitModule("_IBCarbon", IBCarbon_methods);
	d = PyModule_GetDict(m);
	IBCarbon_Error = PyMac_GetOSErrException();
	if (IBCarbon_Error == NULL ||
	    PyDict_SetItemString(d, "Error", IBCarbon_Error) != 0)
		return;
	IBNibRef_Type.ob_type = &PyType_Type;
	if (PyType_Ready(&IBNibRef_Type) < 0) return;
	Py_INCREF(&IBNibRef_Type);
	PyModule_AddObject(m, "IBNibRef", (PyObject *)&IBNibRef_Type);
	/* Backward-compatible name */
	Py_INCREF(&IBNibRef_Type);
	PyModule_AddObject(m, "IBNibRefType", (PyObject *)&IBNibRef_Type);
}