From a755e68df647bd3dc27749998d19cc47649a8b4f Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Sat, 20 Sep 1997 17:40:22 +0000 Subject: Export type objects to Python --- Mac/Modules/ae/AEmodule.c | 4 ++++ Mac/Modules/cm/Cmmodule.c | 8 ++++++++ Mac/Modules/ctbmodule.c | 5 ++++- Mac/Modules/ctl/Ctlmodule.c | 4 ++++ Mac/Modules/ctl/ctledit.py | 2 +- Mac/Modules/dlg/Dlgmodule.c | 4 ++++ Mac/Modules/help/Helpmodule.c | 2 +- Mac/Modules/help/helpsupport.py | 2 +- Mac/Modules/list/Listmodule.c | 4 ++++ Mac/Modules/macfsmodule.c | 11 ++++++++++- Mac/Modules/macosmodule.c | 6 +++++- Mac/Modules/menu/Menumodule.c | 4 ++++ Mac/Modules/qd/Qdmodule.c | 12 ++++++++++++ Mac/Modules/qt/Qtmodule.c | 24 ++++++++++++++++++++++++ Mac/Modules/res/Resmodule.c | 4 ++++ Mac/Modules/snd/Sndmodule.c | 4 ++++ Mac/Modules/te/TEmodule.c | 4 ++++ Mac/Modules/waste/wastemodule.c | 10 +++++++++- Mac/Modules/win/Winmodule.c | 4 ++++ 19 files changed, 111 insertions(+), 7 deletions(-) diff --git a/Mac/Modules/ae/AEmodule.c b/Mac/Modules/ae/AEmodule.c index a2a8b14..ed20b40 100644 --- a/Mac/Modules/ae/AEmodule.c +++ b/Mac/Modules/ae/AEmodule.c @@ -1180,6 +1180,10 @@ void initAE() if (AE_Error == NULL || PyDict_SetItemString(d, "Error", AE_Error) != 0) Py_FatalError("can't initialize AE.Error"); + AEDesc_Type.ob_type = &PyType_Type; + Py_INCREF(&AEDesc_Type); + if (PyDict_SetItemString(d, "AEDescType", (PyObject *)&AEDesc_Type) != 0) + Py_FatalError("can't initialize AEDescType"); } /* ========================= End module AE ========================== */ diff --git a/Mac/Modules/cm/Cmmodule.c b/Mac/Modules/cm/Cmmodule.c index 93aab45..fe35685 100644 --- a/Mac/Modules/cm/Cmmodule.c +++ b/Mac/Modules/cm/Cmmodule.c @@ -761,6 +761,14 @@ void initCm() if (Cm_Error == NULL || PyDict_SetItemString(d, "Error", Cm_Error) != 0) Py_FatalError("can't initialize Cm.Error"); + ComponentInstance_Type.ob_type = &PyType_Type; + Py_INCREF(&ComponentInstance_Type); + if (PyDict_SetItemString(d, "ComponentInstanceType", (PyObject *)&ComponentInstance_Type) != 0) + Py_FatalError("can't initialize ComponentInstanceType"); + Component_Type.ob_type = &PyType_Type; + Py_INCREF(&Component_Type); + if (PyDict_SetItemString(d, "ComponentType", (PyObject *)&Component_Type) != 0) + Py_FatalError("can't initialize ComponentType"); } /* ========================= End module Cm ========================== */ diff --git a/Mac/Modules/ctbmodule.c b/Mac/Modules/ctbmodule.c index 907b7bb..6eabca9 100644 --- a/Mac/Modules/ctbmodule.c +++ b/Mac/Modules/ctbmodule.c @@ -478,7 +478,7 @@ ctbcm_setattr(self, name, v) statichere PyTypeObject ctbcmtype = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ - "ctbcm", /*tp_name*/ + "CTBConnectionMgr", /*tp_name*/ sizeof(ctbcmobject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ @@ -608,6 +608,9 @@ initctb() ErrorObject = PyString_FromString("ctb.error"); PyDict_SetItemString(d, "error", ErrorObject); + ctbcmtype.ob_type = &PyType_Type; + Py_INCREF(&ctbcmtype); + PyDict_SetItemString(d, "CTBConnectionMgrType", (PyObject *)&ctbcmtype); /* Check for errors */ if (PyErr_Occurred()) diff --git a/Mac/Modules/ctl/Ctlmodule.c b/Mac/Modules/ctl/Ctlmodule.c index 654f671..573f581 100644 --- a/Mac/Modules/ctl/Ctlmodule.c +++ b/Mac/Modules/ctl/Ctlmodule.c @@ -733,6 +733,10 @@ void initCtl() if (Ctl_Error == NULL || PyDict_SetItemString(d, "Error", Ctl_Error) != 0) Py_FatalError("can't initialize Ctl.Error"); + Control_Type.ob_type = &PyType_Type; + Py_INCREF(&Control_Type); + if (PyDict_SetItemString(d, "ControlType", (PyObject *)&Control_Type) != 0) + Py_FatalError("can't initialize ControlType"); } /* ========================= End module Ctl ========================= */ diff --git a/Mac/Modules/ctl/ctledit.py b/Mac/Modules/ctl/ctledit.py index 9240851..a23eef8 100644 --- a/Mac/Modules/ctl/ctledit.py +++ b/Mac/Modules/ctl/ctledit.py @@ -11,7 +11,7 @@ DisposeControl_body = """ if (!PyArg_ParseTuple(_args, "")) return NULL; if ( _self->ob_itself ) { - SetCRefCon(_self->ob_itself, (long)0); /* Make it forget about us */ + SetControlReference(_self->ob_itself, (long)0); /* Make it forget about us */ DisposeControl(_self->ob_itself); _self->ob_itself = NULL; } diff --git a/Mac/Modules/dlg/Dlgmodule.c b/Mac/Modules/dlg/Dlgmodule.c index 5949ea1..7ca2a59 100644 --- a/Mac/Modules/dlg/Dlgmodule.c +++ b/Mac/Modules/dlg/Dlgmodule.c @@ -1008,6 +1008,10 @@ void initDlg() if (Dlg_Error == NULL || PyDict_SetItemString(d, "Error", Dlg_Error) != 0) Py_FatalError("can't initialize Dlg.Error"); + Dialog_Type.ob_type = &PyType_Type; + Py_INCREF(&Dialog_Type); + if (PyDict_SetItemString(d, "DialogType", (PyObject *)&Dialog_Type) != 0) + Py_FatalError("can't initialize DialogType"); } /* ========================= End module Dlg ========================= */ diff --git a/Mac/Modules/help/Helpmodule.c b/Mac/Modules/help/Helpmodule.c index aac22ad..e6cb0a2 100644 --- a/Mac/Modules/help/Helpmodule.c +++ b/Mac/Modules/help/Helpmodule.c @@ -60,7 +60,7 @@ static PyObject *Help_HMGetHelpMenuHandle(_self, _args) _err = HMGetHelpMenuHandle(&mh); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", - ResObj_New, mh); + MenuObj_New, mh); return _res; } diff --git a/Mac/Modules/help/helpsupport.py b/Mac/Modules/help/helpsupport.py index 570ac32..1e7ac84 100644 --- a/Mac/Modules/help/helpsupport.py +++ b/Mac/Modules/help/helpsupport.py @@ -21,7 +21,7 @@ OUTPUTFILE = MODNAME + "module.c" # The file generated by this program from macsupport import * # Create the type objects -MenuRef = OpaqueByValueType("MenuRef", "ResObj") +MenuRef = OpaqueByValueType("MenuRef", "MenuObj") #WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX) diff --git a/Mac/Modules/list/Listmodule.c b/Mac/Modules/list/Listmodule.c index b0ce515..e0eace9 100644 --- a/Mac/Modules/list/Listmodule.c +++ b/Mac/Modules/list/Listmodule.c @@ -673,6 +673,10 @@ void initList() if (List_Error == NULL || PyDict_SetItemString(d, "Error", List_Error) != 0) Py_FatalError("can't initialize List.Error"); + List_Type.ob_type = &PyType_Type; + Py_INCREF(&List_Type); + if (PyDict_SetItemString(d, "ListType", (PyObject *)&List_Type) != 0) + Py_FatalError("can't initialize ListType"); } /* ======================== End module List ========================= */ diff --git a/Mac/Modules/macfsmodule.c b/Mac/Modules/macfsmodule.c index 4bea8ce..2c5af1e 100644 --- a/Mac/Modules/macfsmodule.c +++ b/Mac/Modules/macfsmodule.c @@ -313,7 +313,7 @@ mfsi_setattr(self, name, v) static PyTypeObject Mfsitype = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ - "FInfo object", /*tp_name*/ + "FInfo", /*tp_name*/ sizeof(mfsiobject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ @@ -982,6 +982,15 @@ initmacfs() ErrorObject = PyString_FromString("macfs.error"); PyDict_SetItemString(d, "error", ErrorObject); + Mfsatype.ob_type = &PyType_Type; + Py_INCREF(&Mfsatype); + PyDict_SetItemString(d, "AliasType", (PyObject *)&Mfsatype); + Mfsstype.ob_type = &PyType_Type; + Py_INCREF(&Mfsstype); + PyDict_SetItemString(d, "FSSpecType", (PyObject *)&Mfsstype); + Mfsitype.ob_type = &PyType_Type; + Py_INCREF(&Mfsitype); + PyDict_SetItemString(d, "FInfoType", (PyObject *)&Mfsitype); /* XXXX Add constants here */ /* Check for errors */ diff --git a/Mac/Modules/macosmodule.c b/Mac/Modules/macosmodule.c index 1717d39..6fc3cf4 100644 --- a/Mac/Modules/macosmodule.c +++ b/Mac/Modules/macosmodule.c @@ -278,7 +278,7 @@ static char Rftype__doc__[] = static PyTypeObject Rftype = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ - "Resource fork", /*tp_name*/ + "ResourceFork", /*tp_name*/ sizeof(rfobject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ @@ -716,6 +716,10 @@ MacOS_Init() MacOS_Error = PyMac_GetOSErrException(); if (MacOS_Error == NULL || PyDict_SetItemString(d, "Error", MacOS_Error) != 0) Py_FatalError("can't define MacOS.Error"); + Rftype.ob_type = &PyType_Type; + Py_INCREF(&Rftype); + if (PyDict_SetItemString(d, "ResourceForkType", (PyObject *)&Rftype) != 0) + Py_FatalError("can't define MacOS.ResourceForkType"); /* ** 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 diff --git a/Mac/Modules/menu/Menumodule.c b/Mac/Modules/menu/Menumodule.c index ac52e39..b09d47d 100644 --- a/Mac/Modules/menu/Menumodule.c +++ b/Mac/Modules/menu/Menumodule.c @@ -1038,6 +1038,10 @@ void initMenu() if (Menu_Error == NULL || PyDict_SetItemString(d, "Error", Menu_Error) != 0) Py_FatalError("can't initialize Menu.Error"); + Menu_Type.ob_type = &PyType_Type; + Py_INCREF(&Menu_Type); + if (PyDict_SetItemString(d, "MenuType", (PyObject *)&Menu_Type) != 0) + Py_FatalError("can't initialize MenuType"); } /* ======================== End module Menu ========================= */ diff --git a/Mac/Modules/qd/Qdmodule.c b/Mac/Modules/qd/Qdmodule.c index ee69274..f294d31 100644 --- a/Mac/Modules/qd/Qdmodule.c +++ b/Mac/Modules/qd/Qdmodule.c @@ -4265,6 +4265,18 @@ void initQd() if (Qd_Error == NULL || PyDict_SetItemString(d, "Error", Qd_Error) != 0) Py_FatalError("can't initialize Qd.Error"); + GrafPort_Type.ob_type = &PyType_Type; + Py_INCREF(&GrafPort_Type); + if (PyDict_SetItemString(d, "GrafPortType", (PyObject *)&GrafPort_Type) != 0) + Py_FatalError("can't initialize GrafPortType"); + BitMap_Type.ob_type = &PyType_Type; + Py_INCREF(&BitMap_Type); + if (PyDict_SetItemString(d, "BitMapType", (PyObject *)&BitMap_Type) != 0) + Py_FatalError("can't initialize BitMapType"); + QDGlobalsAccess_Type.ob_type = &PyType_Type; + Py_INCREF(&QDGlobalsAccess_Type); + if (PyDict_SetItemString(d, "QDGlobalsAccessType", (PyObject *)&QDGlobalsAccess_Type) != 0) + Py_FatalError("can't initialize QDGlobalsAccessType"); { PyObject *o; diff --git a/Mac/Modules/qt/Qtmodule.c b/Mac/Modules/qt/Qtmodule.c index 9b2a854..a0a03e2 100644 --- a/Mac/Modules/qt/Qtmodule.c +++ b/Mac/Modules/qt/Qtmodule.c @@ -6047,6 +6047,30 @@ void initQt() if (Qt_Error == NULL || PyDict_SetItemString(d, "Error", Qt_Error) != 0) Py_FatalError("can't initialize Qt.Error"); + MovieController_Type.ob_type = &PyType_Type; + Py_INCREF(&MovieController_Type); + if (PyDict_SetItemString(d, "MovieControllerType", (PyObject *)&MovieController_Type) != 0) + Py_FatalError("can't initialize MovieControllerType"); + TimeBase_Type.ob_type = &PyType_Type; + Py_INCREF(&TimeBase_Type); + if (PyDict_SetItemString(d, "TimeBaseType", (PyObject *)&TimeBase_Type) != 0) + Py_FatalError("can't initialize TimeBaseType"); + UserData_Type.ob_type = &PyType_Type; + Py_INCREF(&UserData_Type); + if (PyDict_SetItemString(d, "UserDataType", (PyObject *)&UserData_Type) != 0) + Py_FatalError("can't initialize UserDataType"); + Media_Type.ob_type = &PyType_Type; + Py_INCREF(&Media_Type); + if (PyDict_SetItemString(d, "MediaType", (PyObject *)&Media_Type) != 0) + Py_FatalError("can't initialize MediaType"); + Track_Type.ob_type = &PyType_Type; + Py_INCREF(&Track_Type); + if (PyDict_SetItemString(d, "TrackType", (PyObject *)&Track_Type) != 0) + Py_FatalError("can't initialize TrackType"); + Movie_Type.ob_type = &PyType_Type; + Py_INCREF(&Movie_Type); + if (PyDict_SetItemString(d, "MovieType", (PyObject *)&Movie_Type) != 0) + Py_FatalError("can't initialize MovieType"); } /* ========================= End module Qt ========================== */ diff --git a/Mac/Modules/res/Resmodule.c b/Mac/Modules/res/Resmodule.c index e903158..f4ed648 100644 --- a/Mac/Modules/res/Resmodule.c +++ b/Mac/Modules/res/Resmodule.c @@ -1387,6 +1387,10 @@ void initRes() if (Res_Error == NULL || PyDict_SetItemString(d, "Error", Res_Error) != 0) Py_FatalError("can't initialize Res.Error"); + Resource_Type.ob_type = &PyType_Type; + Py_INCREF(&Resource_Type); + if (PyDict_SetItemString(d, "ResourceType", (PyObject *)&Resource_Type) != 0) + Py_FatalError("can't initialize ResourceType"); } /* ========================= End module Res ========================= */ diff --git a/Mac/Modules/snd/Sndmodule.c b/Mac/Modules/snd/Sndmodule.c index 74951ce..36d9fd2 100644 --- a/Mac/Modules/snd/Sndmodule.c +++ b/Mac/Modules/snd/Sndmodule.c @@ -797,6 +797,10 @@ void initSnd() if (Snd_Error == NULL || PyDict_SetItemString(d, "Error", Snd_Error) != 0) Py_FatalError("can't initialize Snd.Error"); + SndChannel_Type.ob_type = &PyType_Type; + Py_INCREF(&SndChannel_Type); + if (PyDict_SetItemString(d, "SndChannelType", (PyObject *)&SndChannel_Type) != 0) + Py_FatalError("can't initialize SndChannelType"); } /* ========================= End module Snd ========================= */ diff --git a/Mac/Modules/te/TEmodule.c b/Mac/Modules/te/TEmodule.c index 3a5a062..611c262 100644 --- a/Mac/Modules/te/TEmodule.c +++ b/Mac/Modules/te/TEmodule.c @@ -1034,6 +1034,10 @@ void initTE() if (TE_Error == NULL || PyDict_SetItemString(d, "Error", TE_Error) != 0) Py_FatalError("can't initialize TE.Error"); + TE_Type.ob_type = &PyType_Type; + Py_INCREF(&TE_Type); + if (PyDict_SetItemString(d, "TEType", (PyObject *)&TE_Type) != 0) + Py_FatalError("can't initialize TEType"); } /* ========================= End module TE ========================== */ diff --git a/Mac/Modules/waste/wastemodule.c b/Mac/Modules/waste/wastemodule.c index a832957..32bb7e7 100644 --- a/Mac/Modules/waste/wastemodule.c +++ b/Mac/Modules/waste/wastemodule.c @@ -43,8 +43,8 @@ extern int BMObj_Convert(PyObject *, BitMapPtr *); extern PyObject *WinObj_WhichWindow(WindowPtr); #include -#include #include +#include /* Exported by Qdmodule.c: */ extern PyObject *QdRGB_New(RGBColor *); @@ -1986,6 +1986,14 @@ void initwaste() if (waste_Error == NULL || PyDict_SetItemString(d, "Error", waste_Error) != 0) Py_FatalError("can't initialize waste.Error"); + WEO_Type.ob_type = &PyType_Type; + Py_INCREF(&WEO_Type); + if (PyDict_SetItemString(d, "WEOType", (PyObject *)&WEO_Type) != 0) + Py_FatalError("can't initialize WEOType"); + waste_Type.ob_type = &PyType_Type; + Py_INCREF(&waste_Type); + if (PyDict_SetItemString(d, "wasteType", (PyObject *)&waste_Type) != 0) + Py_FatalError("can't initialize wasteType"); callbackdict = PyDict_New(); if (callbackdict == NULL || PyDict_SetItemString(d, "callbacks", callbackdict) != 0) diff --git a/Mac/Modules/win/Winmodule.c b/Mac/Modules/win/Winmodule.c index 7077b12..eb5b046 100644 --- a/Mac/Modules/win/Winmodule.c +++ b/Mac/Modules/win/Winmodule.c @@ -1402,6 +1402,10 @@ void initWin() if (Win_Error == NULL || PyDict_SetItemString(d, "Error", Win_Error) != 0) Py_FatalError("can't initialize Win.Error"); + Window_Type.ob_type = &PyType_Type; + Py_INCREF(&Window_Type); + if (PyDict_SetItemString(d, "WindowType", (PyObject *)&Window_Type) != 0) + Py_FatalError("can't initialize WindowType"); } /* ========================= End module Win ========================= */ -- cgit v0.12