Export type objects to Python

This commit is contained in:
Jack Jansen 1997-09-20 17:40:22 +00:00
parent 6dd4868681
commit a755e68df6
19 changed files with 111 additions and 7 deletions

View file

@ -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 ========================== */

View file

@ -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 ========================== */

View file

@ -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())

View file

@ -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 ========================= */

View file

@ -11,7 +11,7 @@
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;
}

View file

@ -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 ========================= */

View file

@ -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;
}

View file

@ -21,7 +21,7 @@
from macsupport import *
# Create the type objects
MenuRef = OpaqueByValueType("MenuRef", "ResObj")
MenuRef = OpaqueByValueType("MenuRef", "MenuObj")
#WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX)

View file

@ -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 ========================= */

View file

@ -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 */

View file

@ -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

View file

@ -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 ========================= */

View file

@ -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;

View file

@ -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 ========================== */

View file

@ -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 ========================= */

View file

@ -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 ========================= */

View file

@ -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 ========================== */

View file

@ -43,8 +43,8 @@ extern int BMObj_Convert(PyObject *, BitMapPtr *);
extern PyObject *WinObj_WhichWindow(WindowPtr);
#include <WASTE.h>
#include <WETabs.h>
#include <WEObjectHandlers.h>
#include <WETabs.h>
/* 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)

View file

@ -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 ========================= */