Commit 96cebde9 authored by Jack Jansen's avatar Jack Jansen

Added PEP253 support to most Carbon modules. This isn't complete yet:

some of the more compilcated cases (CF, Res) haven't been done yet. Also,
various types should inherit from each other (anything with an as_Resource
method should be a Resource subtype, the CF types should become one family).
parent 99899b92
......@@ -869,6 +869,24 @@ static PyGetSetDef AEDesc_getsetlist[] = {
#define AEDesc_repr NULL
#define AEDesc_hash NULL
#define AEDesc_tp_init 0
#define AEDesc_tp_alloc PyType_GenericAlloc
static PyObject *AEDesc_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
AEDesc itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, AEDesc_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((AEDescObject *)self)->ob_itself = itself;
return self;
}
#define AEDesc_tp_free PyObject_Del
PyTypeObject AEDesc_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -891,19 +909,27 @@ PyTypeObject AEDesc_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
AEDesc_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
AEDesc_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
AEDesc_tp_init, /* tp_init */
AEDesc_tp_alloc, /* tp_alloc */
AEDesc_tp_new, /* tp_new */
AEDesc_tp_free, /* tp_free */
};
/* --------------------- End object type AEDesc --------------------- */
......@@ -1429,8 +1455,10 @@ void init_AE(void)
return;
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");
PyModule_AddObject(m, "AEDesc", (PyObject *)&AEDesc_Type);
/* Backward-compatible name */
Py_INCREF(&AEDesc_Type);
PyModule_AddObject(m, "AEDescType", (PyObject *)&AEDesc_Type);
}
/* ========================= End module _AE ========================= */
......
......@@ -174,7 +174,7 @@ initstuff = initstuff + """
module = MacModule('_AE', 'AE', includestuff, finalstuff, initstuff)
class AEDescDefinition(PEP252Mixin, GlobalObjectDefinition):
class AEDescDefinition(PEP253Mixin, GlobalObjectDefinition):
getsetlist = [(
'type',
'return PyMac_BuildOSType(self->ob_itself.descriptorType);',
......
......@@ -97,11 +97,30 @@ static PyMethodDef AliasObj_methods[] = {
#define AliasObj_getsetlist NULL
#define AliasObj_compare NULL
#define AliasObj_repr NULL
#define AliasObj_hash NULL
#define AliasObj_tp_init 0
#define AliasObj_tp_alloc PyType_GenericAlloc
static PyObject *AliasObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
AliasHandle itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, AliasObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((AliasObject *)self)->ob_itself = itself;
return self;
}
#define AliasObj_tp_free PyObject_Del
PyTypeObject Alias_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -124,19 +143,27 @@ PyTypeObject Alias_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
AliasObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
AliasObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
AliasObj_tp_init, /* tp_init */
AliasObj_tp_alloc, /* tp_alloc */
AliasObj_tp_new, /* tp_new */
AliasObj_tp_free, /* tp_free */
};
/* --------------------- End object type Alias ---------------------- */
......@@ -665,8 +692,10 @@ void init_Alias(void)
return;
Alias_Type.ob_type = &PyType_Type;
Py_INCREF(&Alias_Type);
if (PyDict_SetItemString(d, "AliasType", (PyObject *)&Alias_Type) != 0)
Py_FatalError("can't initialize AliasType");
PyModule_AddObject(m, "Alias", (PyObject *)&Alias_Type);
/* Backward-compatible name */
Py_INCREF(&Alias_Type);
PyModule_AddObject(m, "AliasType", (PyObject *)&Alias_Type);
}
/* ======================= End module _Alias ======================== */
......
......@@ -72,7 +72,8 @@ execfile(string.lower(MODPREFIX) + 'typetest.py')
# Create the generator groups and link them
module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
class AliasDefinition(PEP252Mixin, GlobalObjectDefinition):
class AliasDefinition(PEP253Mixin, GlobalObjectDefinition):
# XXXX Should inherit from resource?
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
......
......@@ -115,11 +115,30 @@ static PyMethodDef ThemeDrawingStateObj_methods[] = {
#define ThemeDrawingStateObj_getsetlist NULL
#define ThemeDrawingStateObj_compare NULL
#define ThemeDrawingStateObj_repr NULL
#define ThemeDrawingStateObj_hash NULL
#define ThemeDrawingStateObj_tp_init 0
#define ThemeDrawingStateObj_tp_alloc PyType_GenericAlloc
static PyObject *ThemeDrawingStateObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
ThemeDrawingState itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, ThemeDrawingStateObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((ThemeDrawingStateObject *)self)->ob_itself = itself;
return self;
}
#define ThemeDrawingStateObj_tp_free PyObject_Del
PyTypeObject ThemeDrawingState_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -142,19 +161,27 @@ PyTypeObject ThemeDrawingState_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
ThemeDrawingStateObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
ThemeDrawingStateObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
ThemeDrawingStateObj_tp_init, /* tp_init */
ThemeDrawingStateObj_tp_alloc, /* tp_alloc */
ThemeDrawingStateObj_tp_new, /* tp_new */
ThemeDrawingStateObj_tp_free, /* tp_free */
};
/* --------------- End object type ThemeDrawingState ---------------- */
......@@ -1822,8 +1849,10 @@ void init_App(void)
return;
ThemeDrawingState_Type.ob_type = &PyType_Type;
Py_INCREF(&ThemeDrawingState_Type);
if (PyDict_SetItemString(d, "ThemeDrawingStateType", (PyObject *)&ThemeDrawingState_Type) != 0)
Py_FatalError("can't initialize ThemeDrawingStateType");
PyModule_AddObject(m, "ThemeDrawingState", (PyObject *)&ThemeDrawingState_Type);
/* Backward-compatible name */
Py_INCREF(&ThemeDrawingState_Type);
PyModule_AddObject(m, "ThemeDrawingStateType", (PyObject *)&ThemeDrawingState_Type);
}
/* ======================== End module _App ========================= */
......
......@@ -94,7 +94,7 @@ int ThemeButtonDrawInfo_Convert(PyObject *v, ThemeButtonDrawInfo *p_itself)
"""
class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
pass
## def outputCheckNewArg(self):
## Output("if (itself == NULL) return PyMac_Error(resNotFound);")
......
......@@ -215,7 +215,7 @@ module = MacModule('_CarbonEvt', 'CarbonEvents', includestuff, finalstuff, inits
class EventHandlerRefObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class EventHandlerRefObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputStructMembers(self):
Output("%s ob_itself;", self.itselftype)
Output("PyObject *ob_callback;")
......@@ -228,7 +228,7 @@ class EventHandlerRefObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
Output("Py_DECREF(self->ob_callback);")
OutRbrace()
class MyGlobalObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MyGlobalObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
pass
for typ in RefObjectTypes:
......
This diff is collapsed.
......@@ -4325,44 +4325,64 @@ void init_CF(void)
return;
CFTypeRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFTypeRef_Type);
if (PyDict_SetItemString(d, "CFTypeRefType", (PyObject *)&CFTypeRef_Type) != 0)
Py_FatalError("can't initialize CFTypeRefType");
PyModule_AddObject(m, "CFTypeRef", (PyObject *)&CFTypeRef_Type);
/* Backward-compatible name */
Py_INCREF(&CFTypeRef_Type);
PyModule_AddObject(m, "CFTypeRefType", (PyObject *)&CFTypeRef_Type);
CFArrayRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFArrayRef_Type);
if (PyDict_SetItemString(d, "CFArrayRefType", (PyObject *)&CFArrayRef_Type) != 0)
Py_FatalError("can't initialize CFArrayRefType");
PyModule_AddObject(m, "CFArrayRef", (PyObject *)&CFArrayRef_Type);
/* Backward-compatible name */
Py_INCREF(&CFArrayRef_Type);
PyModule_AddObject(m, "CFArrayRefType", (PyObject *)&CFArrayRef_Type);
CFMutableArrayRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFMutableArrayRef_Type);
if (PyDict_SetItemString(d, "CFMutableArrayRefType", (PyObject *)&CFMutableArrayRef_Type) != 0)
Py_FatalError("can't initialize CFMutableArrayRefType");
PyModule_AddObject(m, "CFMutableArrayRef", (PyObject *)&CFMutableArrayRef_Type);
/* Backward-compatible name */
Py_INCREF(&CFMutableArrayRef_Type);
PyModule_AddObject(m, "CFMutableArrayRefType", (PyObject *)&CFMutableArrayRef_Type);
CFDictionaryRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFDictionaryRef_Type);
if (PyDict_SetItemString(d, "CFDictionaryRefType", (PyObject *)&CFDictionaryRef_Type) != 0)
Py_FatalError("can't initialize CFDictionaryRefType");
PyModule_AddObject(m, "CFDictionaryRef", (PyObject *)&CFDictionaryRef_Type);
/* Backward-compatible name */
Py_INCREF(&CFDictionaryRef_Type);
PyModule_AddObject(m, "CFDictionaryRefType", (PyObject *)&CFDictionaryRef_Type);
CFMutableDictionaryRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFMutableDictionaryRef_Type);
if (PyDict_SetItemString(d, "CFMutableDictionaryRefType", (PyObject *)&CFMutableDictionaryRef_Type) != 0)
Py_FatalError("can't initialize CFMutableDictionaryRefType");
PyModule_AddObject(m, "CFMutableDictionaryRef", (PyObject *)&CFMutableDictionaryRef_Type);
/* Backward-compatible name */
Py_INCREF(&CFMutableDictionaryRef_Type);
PyModule_AddObject(m, "CFMutableDictionaryRefType", (PyObject *)&CFMutableDictionaryRef_Type);
CFDataRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFDataRef_Type);
if (PyDict_SetItemString(d, "CFDataRefType", (PyObject *)&CFDataRef_Type) != 0)
Py_FatalError("can't initialize CFDataRefType");
PyModule_AddObject(m, "CFDataRef", (PyObject *)&CFDataRef_Type);
/* Backward-compatible name */
Py_INCREF(&CFDataRef_Type);
PyModule_AddObject(m, "CFDataRefType", (PyObject *)&CFDataRef_Type);
CFMutableDataRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFMutableDataRef_Type);
if (PyDict_SetItemString(d, "CFMutableDataRefType", (PyObject *)&CFMutableDataRef_Type) != 0)
Py_FatalError("can't initialize CFMutableDataRefType");
PyModule_AddObject(m, "CFMutableDataRef", (PyObject *)&CFMutableDataRef_Type);
/* Backward-compatible name */
Py_INCREF(&CFMutableDataRef_Type);
PyModule_AddObject(m, "CFMutableDataRefType", (PyObject *)&CFMutableDataRef_Type);
CFStringRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFStringRef_Type);
if (PyDict_SetItemString(d, "CFStringRefType", (PyObject *)&CFStringRef_Type) != 0)
Py_FatalError("can't initialize CFStringRefType");
PyModule_AddObject(m, "CFStringRef", (PyObject *)&CFStringRef_Type);
/* Backward-compatible name */
Py_INCREF(&CFStringRef_Type);
PyModule_AddObject(m, "CFStringRefType", (PyObject *)&CFStringRef_Type);
CFMutableStringRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFMutableStringRef_Type);
if (PyDict_SetItemString(d, "CFMutableStringRefType", (PyObject *)&CFMutableStringRef_Type) != 0)
Py_FatalError("can't initialize CFMutableStringRefType");
PyModule_AddObject(m, "CFMutableStringRef", (PyObject *)&CFMutableStringRef_Type);
/* Backward-compatible name */
Py_INCREF(&CFMutableStringRef_Type);
PyModule_AddObject(m, "CFMutableStringRefType", (PyObject *)&CFMutableStringRef_Type);
CFURLRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFURLRef_Type);
if (PyDict_SetItemString(d, "CFURLRefType", (PyObject *)&CFURLRef_Type) != 0)
Py_FatalError("can't initialize CFURLRefType");
PyModule_AddObject(m, "CFURLRef", (PyObject *)&CFURLRef_Type);
/* Backward-compatible name */
Py_INCREF(&CFURLRef_Type);
PyModule_AddObject(m, "CFURLRefType", (PyObject *)&CFURLRef_Type);
#define _STRINGCONST(name) PyModule_AddObject(m, #name, CFStringRefObj_New(name))
_STRINGCONST(kCFPreferencesAnyApplication);
......
......@@ -1268,11 +1268,30 @@ static PyMethodDef CGContextRefObj_methods[] = {
#define CGContextRefObj_getsetlist NULL
#define CGContextRefObj_compare NULL
#define CGContextRefObj_repr NULL
#define CGContextRefObj_hash NULL
#define CGContextRefObj_tp_init 0
#define CGContextRefObj_tp_alloc PyType_GenericAlloc
static PyObject *CGContextRefObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
CGContextRef itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, CGContextRefObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((CGContextRefObject *)self)->ob_itself = itself;
return self;
}
#define CGContextRefObj_tp_free PyObject_Del
PyTypeObject CGContextRef_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -1295,19 +1314,27 @@ PyTypeObject CGContextRef_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
CGContextRefObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
CGContextRefObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
CGContextRefObj_tp_init, /* tp_init */
CGContextRefObj_tp_alloc, /* tp_alloc */
CGContextRefObj_tp_new, /* tp_new */
CGContextRefObj_tp_free, /* tp_free */
};
/* ------------------ End object type CGContextRef ------------------ */
......@@ -1373,8 +1400,10 @@ void init_CG(void)
return;
CGContextRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CGContextRef_Type);
if (PyDict_SetItemString(d, "CGContextRefType", (PyObject *)&CGContextRef_Type) != 0)
Py_FatalError("can't initialize CGContextRefType");
PyModule_AddObject(m, "CGContextRef", (PyObject *)&CGContextRef_Type);
/* Backward-compatible name */
Py_INCREF(&CGContextRef_Type);
PyModule_AddObject(m, "CGContextRefType", (PyObject *)&CGContextRef_Type);
}
/* ========================= End module _CG ========================= */
......
......@@ -250,7 +250,7 @@ CGPathDrawingMode = int
CGContextRef = OpaqueByValueType("CGContextRef", "CGContextRefObj")
class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputStructMembers(self):
ObjectDefinition.outputStructMembers(self)
def outputCleanupStructMembers(self):
......
......@@ -307,11 +307,30 @@ static PyMethodDef CmpInstObj_methods[] = {
#define CmpInstObj_getsetlist NULL
#define CmpInstObj_compare NULL
#define CmpInstObj_repr NULL
#define CmpInstObj_hash NULL
#define CmpInstObj_tp_init 0
#define CmpInstObj_tp_alloc PyType_GenericAlloc
static PyObject *CmpInstObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
ComponentInstance itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, CmpInstObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((ComponentInstanceObject *)self)->ob_itself = itself;
return self;
}
#define CmpInstObj_tp_free PyObject_Del
PyTypeObject ComponentInstance_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -334,19 +353,27 @@ PyTypeObject ComponentInstance_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
CmpInstObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
CmpInstObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
CmpInstObj_tp_init, /* tp_init */
CmpInstObj_tp_alloc, /* tp_alloc */
CmpInstObj_tp_new, /* tp_new */
CmpInstObj_tp_free, /* tp_free */
};
/* --------------- End object type ComponentInstance ---------------- */
......@@ -713,11 +740,30 @@ static PyMethodDef CmpObj_methods[] = {
#define CmpObj_getsetlist NULL
#define CmpObj_compare NULL
#define CmpObj_repr NULL
#define CmpObj_hash NULL
#define CmpObj_tp_init 0
#define CmpObj_tp_alloc PyType_GenericAlloc
static PyObject *CmpObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
Component itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, CmpObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((ComponentObject *)self)->ob_itself = itself;
return self;
}
#define CmpObj_tp_free PyObject_Del
PyTypeObject Component_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -740,19 +786,27 @@ PyTypeObject Component_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
CmpObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
CmpObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
CmpObj_tp_init, /* tp_init */
CmpObj_tp_alloc, /* tp_alloc */
CmpObj_tp_new, /* tp_new */
CmpObj_tp_free, /* tp_free */
};
/* ------------------- End object type Component -------------------- */
......@@ -930,12 +984,16 @@ void init_Cm(void)
return;
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");
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;
Py_INCREF(&Component_Type);
if (PyDict_SetItemString(d, "ComponentType", (PyObject *)&Component_Type) != 0)
Py_FatalError("can't initialize ComponentType");
PyModule_AddObject(m, "Component", (PyObject *)&Component_Type);
/* Backward-compatible name */
Py_INCREF(&Component_Type);
PyModule_AddObject(m, "ComponentType", (PyObject *)&Component_Type);
}
/* ========================= End module _Cm ========================= */
......
......@@ -79,14 +79,14 @@ ComponentResult = Type("ComponentResult", "l")
ComponentResourceHandle = OpaqueByValueType("ComponentResourceHandle", "ResObj")
class MyCIObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MyCIObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Cm_Error,"NULL ComponentInstance");
return NULL;
}""")
class MyCObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MyCObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
/* XXXX Or should we return None? */
......
......@@ -4545,6 +4545,7 @@ static PyMethodDef CtlObj_methods[] = {
#define CtlObj_getsetlist NULL
static int CtlObj_compare(ControlObject *self, ControlObject *other)
{
unsigned long v, w;
......@@ -4570,6 +4571,24 @@ static long CtlObj_hash(ControlObject *self)
{
return (long)self->ob_itself;
}
#define CtlObj_tp_init 0
#define CtlObj_tp_alloc PyType_GenericAlloc
static PyObject *CtlObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
ControlHandle itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, CtlObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((ControlObject *)self)->ob_itself = itself;
return self;
}
#define CtlObj_tp_free PyObject_Del
PyTypeObject Control_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -4592,19 +4611,27 @@ PyTypeObject Control_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
CtlObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
CtlObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
CtlObj_tp_init, /* tp_init */
CtlObj_tp_alloc, /* tp_alloc */
CtlObj_tp_new, /* tp_new */
CtlObj_tp_free, /* tp_free */
};
/* -------------------- End object type Control --------------------- */
......@@ -6714,8 +6741,10 @@ void init_Ctl(void)
return;
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");
PyModule_AddObject(m, "Control", (PyObject *)&Control_Type);
/* Backward-compatible name */
Py_INCREF(&Control_Type);
PyModule_AddObject(m, "ControlType", (PyObject *)&Control_Type);
}
/* ======================== End module _Ctl ========================= */
......
......@@ -490,7 +490,7 @@ PyMac_INIT_TOOLBOX_OBJECT_NEW(ControlHandle, CtlObj_New);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ControlHandle, CtlObj_Convert);
"""
class MyObjectDefinition(PEP252Mixin, ObjectIdentityMixin, GlobalObjectDefinition):
class MyObjectDefinition(PEP253Mixin, ObjectIdentityMixin, GlobalObjectDefinition):
def outputStructMembers(self):
GlobalObjectDefinition.outputStructMembers(self)
Output("PyObject *ob_callbackdict;")
......
......@@ -966,6 +966,7 @@ static PyMethodDef DlgObj_methods[] = {
#define DlgObj_getsetlist NULL
static int DlgObj_compare(DialogObject *self, DialogObject *other)
{
if ( self->ob_itself > other->ob_itself ) return 1;
......@@ -979,6 +980,24 @@ static int DlgObj_hash(DialogObject *self)
{
return (int)self->ob_itself;
}
#define DlgObj_tp_init 0
#define DlgObj_tp_alloc PyType_GenericAlloc
static PyObject *DlgObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
DialogPtr itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, DlgObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((DialogObject *)self)->ob_itself = itself;
return self;
}
#define DlgObj_tp_free PyObject_Del
PyTypeObject Dialog_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -1001,19 +1020,27 @@ PyTypeObject Dialog_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
DlgObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
DlgObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
DlgObj_tp_init, /* tp_init */
DlgObj_tp_alloc, /* tp_alloc */
DlgObj_tp_new, /* tp_new */
DlgObj_tp_free, /* tp_free */
};
/* --------------------- End object type Dialog --------------------- */
......@@ -1589,8 +1616,10 @@ void init_Dlg(void)
return;
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");
PyModule_AddObject(m, "Dialog", (PyObject *)&Dialog_Type);
/* Backward-compatible name */
Py_INCREF(&Dialog_Type);
PyModule_AddObject(m, "DialogType", (PyObject *)&Dialog_Type);
}
/* ======================== End module _Dlg ========================= */
......
......@@ -201,7 +201,7 @@ initstuff = initstuff + """
# Define a class which specializes our object definition
class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def __init__(self, name, prefix = None, itselftype = None):
GlobalObjectDefinition.__init__(self, name, prefix, itselftype)
## This won't work in Carbon, so we disable it for all MacPythons:-(
......
......@@ -742,11 +742,30 @@ static PyMethodDef DragObj_methods[] = {
#define DragObj_getsetlist NULL
#define DragObj_compare NULL
#define DragObj_repr NULL
#define DragObj_hash NULL
#define DragObj_tp_init 0
#define DragObj_tp_alloc PyType_GenericAlloc
static PyObject *DragObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
DragRef itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, DragObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((DragObjObject *)self)->ob_itself = itself;
return self;
}
#define DragObj_tp_free PyObject_Del
PyTypeObject DragObj_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -769,19 +788,27 @@ PyTypeObject DragObj_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
DragObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
DragObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
DragObj_tp_init, /* tp_init */
DragObj_tp_alloc, /* tp_alloc */
DragObj_tp_new, /* tp_new */
DragObj_tp_free, /* tp_free */
};
/* -------------------- End object type DragObj --------------------- */
......@@ -1109,8 +1136,10 @@ void init_Drag(void)
return;
DragObj_Type.ob_type = &PyType_Type;
Py_INCREF(&DragObj_Type);
if (PyDict_SetItemString(d, "DragObjType", (PyObject *)&DragObj_Type) != 0)
Py_FatalError("can't initialize DragObjType");
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);
......
......@@ -183,7 +183,7 @@ dragglue_DrawingUPP = NewDragDrawingUPP(dragglue_Drawing);
#endif
"""
class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Drag_Error,"Cannot create null Drag");
......
......@@ -46,7 +46,7 @@ includestuff = includestuff + """
#endif
"""
class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
def outputCheckConvertArg(self):
......
......@@ -31,11 +31,11 @@ initstuff = """
module = MacModule('_IBCarbon', 'IBCarbon', includestuff, finalstuff, initstuff)
class CFReleaserObject(PEP252Mixin, GlobalObjectDefinition):
class CFReleaserObject(PEP253Mixin, GlobalObjectDefinition):
def outputFreeIt(self, name):
Output("CFRelease(%s);" % name)
class CFNibDesc(PEP252Mixin, GlobalObjectDefinition):
class CFNibDesc(PEP253Mixin, GlobalObjectDefinition):
def outputFreeIt(self, name):
Output("DisposeNibReference(%s);" % name)
......
......@@ -142,11 +142,30 @@ static PyMethodDef IBNibRefObj_methods[] = {
#define IBNibRefObj_getsetlist NULL
#define IBNibRefObj_compare NULL
#define IBNibRefObj_repr NULL
#define IBNibRefObj_hash NULL
#define IBNibRefObj_tp_init 0
#define IBNibRefObj_tp_alloc PyType_GenericAlloc
static PyObject *IBNibRefObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
IBNibRef itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, IBNibRefObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((IBNibRefObject *)self)->ob_itself = itself;
return self;
}
#define IBNibRefObj_tp_free PyObject_Del
PyTypeObject IBNibRef_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -169,19 +188,27 @@ PyTypeObject IBNibRef_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
IBNibRefObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
IBNibRefObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
IBNibRefObj_tp_init, /* tp_init */
IBNibRefObj_tp_alloc, /* tp_alloc */
IBNibRefObj_tp_new, /* tp_new */
IBNibRefObj_tp_free, /* tp_free */
};
/* -------------------- End object type IBNibRef -------------------- */
......@@ -230,8 +257,10 @@ void init_IBCarbon(void)
return;
IBNibRef_Type.ob_type = &PyType_Type;
Py_INCREF(&IBNibRef_Type);
if (PyDict_SetItemString(d, "IBNibRefType", (PyObject *)&IBNibRef_Type) != 0)
Py_FatalError("can't initialize IBNibRefType");
PyModule_AddObject(m, "IBNibRef", (PyObject *)&IBNibRef_Type);
/* Backward-compatible name */
Py_INCREF(&IBNibRef_Type);
PyModule_AddObject(m, "IBNibRefType", (PyObject *)&IBNibRef_Type);
}
/* ====================== End module _IBCarbon ====================== */
......
......@@ -54,7 +54,7 @@ includestuff = includestuff + """
"""
class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
def outputCheckConvertArg(self):
......
......@@ -806,6 +806,24 @@ static PyGetSetDef ListObj_getsetlist[] = {
#define ListObj_repr NULL
#define ListObj_hash NULL
#define ListObj_tp_init 0
#define ListObj_tp_alloc PyType_GenericAlloc
static PyObject *ListObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
ListHandle itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, ListObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((ListObject *)self)->ob_itself = itself;
return self;
}
#define ListObj_tp_free PyObject_Del
PyTypeObject List_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -828,19 +846,27 @@ PyTypeObject List_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
ListObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
ListObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
ListObj_tp_init, /* tp_init */
ListObj_tp_alloc, /* tp_alloc */
ListObj_tp_new, /* tp_new */
ListObj_tp_free, /* tp_free */
};
/* ---------------------- End object type List ---------------------- */
......@@ -1186,8 +1212,10 @@ void init_List(void)
return;
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");
PyModule_AddObject(m, "List", (PyObject *)&List_Type);
/* Backward-compatible name */
Py_INCREF(&List_Type);
PyModule_AddObject(m, "ListType", (PyObject *)&List_Type);
}
/* ======================== End module _List ======================== */
......
......@@ -137,7 +137,8 @@ class ListMethodGenerator(MethodGenerator):
FunctionGenerator.parseArgumentList(self, args)
self.argumentList.append(self.itself)
class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
# XXXX Should inherit from Resource
getsetlist = [(
'listFlags',
'return Py_BuildValue("l", (long)GetListFlags(self->ob_itself) & 0xff);',
......
......@@ -3002,11 +3002,30 @@ static PyMethodDef MenuObj_methods[] = {
#define MenuObj_getsetlist NULL
#define MenuObj_compare NULL
#define MenuObj_repr NULL
#define MenuObj_hash NULL
#define MenuObj_tp_init 0
#define MenuObj_tp_alloc PyType_GenericAlloc
static PyObject *MenuObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
MenuHandle itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, MenuObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((MenuObject *)self)->ob_itself = itself;
return self;
}
#define MenuObj_tp_free PyObject_Del
PyTypeObject Menu_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -3029,19 +3048,27 @@ PyTypeObject Menu_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
MenuObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
MenuObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
MenuObj_tp_init, /* tp_init */
MenuObj_tp_alloc, /* tp_alloc */
MenuObj_tp_new, /* tp_new */
MenuObj_tp_free, /* tp_free */
};
/* ---------------------- End object type Menu ---------------------- */
......@@ -4127,8 +4154,10 @@ void init_Menu(void)
return;
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");
PyModule_AddObject(m, "Menu", (PyObject *)&Menu_Type);
/* Backward-compatible name */
Py_INCREF(&Menu_Type);
PyModule_AddObject(m, "MenuType", (PyObject *)&Menu_Type);
}
/* ======================== End module _Menu ======================== */
......
......@@ -98,7 +98,7 @@ initstuff = initstuff + """
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle, MenuObj_Convert);
"""
class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
pass
# Create the generator groups and link them
......
......@@ -1297,11 +1297,30 @@ static PyMethodDef TXNObj_methods[] = {
#define TXNObj_getsetlist NULL
#define TXNObj_compare NULL
#define TXNObj_repr NULL
#define TXNObj_hash NULL
#define TXNObj_tp_init 0
#define TXNObj_tp_alloc PyType_GenericAlloc
static PyObject *TXNObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
TXNObject itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, TXNObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((TXNObjectObject *)self)->ob_itself = itself;
return self;
}
#define TXNObj_tp_free PyObject_Del
PyTypeObject TXNObject_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -1324,19 +1343,27 @@ PyTypeObject TXNObject_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
TXNObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
TXNObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
TXNObj_tp_init, /* tp_init */
TXNObj_tp_alloc, /* tp_alloc */
TXNObj_tp_new, /* tp_new */
TXNObj_tp_free, /* tp_free */
};
/* ------------------- End object type TXNObject -------------------- */
......@@ -1423,11 +1450,30 @@ static PyMethodDef TXNFontMenuObj_methods[] = {
#define TXNFontMenuObj_getsetlist NULL
#define TXNFontMenuObj_compare NULL
#define TXNFontMenuObj_repr NULL
#define TXNFontMenuObj_hash NULL
#define TXNFontMenuObj_tp_init 0
#define TXNFontMenuObj_tp_alloc PyType_GenericAlloc
static PyObject *TXNFontMenuObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
TXNFontMenuObject itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, TXNFontMenuObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((TXNFontMenuObjectObject *)self)->ob_itself = itself;
return self;
}
#define TXNFontMenuObj_tp_free PyObject_Del
PyTypeObject TXNFontMenuObject_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -1450,19 +1496,27 @@ PyTypeObject TXNFontMenuObject_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
TXNFontMenuObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
TXNFontMenuObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
TXNFontMenuObj_tp_init, /* tp_init */
TXNFontMenuObj_tp_alloc, /* tp_alloc */
TXNFontMenuObj_tp_new, /* tp_new */
TXNFontMenuObj_tp_free, /* tp_free */
};
/* --------------- End object type TXNFontMenuObject ---------------- */
......@@ -1676,12 +1730,16 @@ void init_Mlte(void)
return;
TXNObject_Type.ob_type = &PyType_Type;
Py_INCREF(&TXNObject_Type);
if (PyDict_SetItemString(d, "TXNObjectType", (PyObject *)&TXNObject_Type) != 0)
Py_FatalError("can't initialize TXNObjectType");
PyModule_AddObject(m, "TXNObject", (PyObject *)&TXNObject_Type);
/* Backward-compatible name */
Py_INCREF(&TXNObject_Type);
PyModule_AddObject(m, "TXNObjectType", (PyObject *)&TXNObject_Type);
TXNFontMenuObject_Type.ob_type = &PyType_Type;
Py_INCREF(&TXNFontMenuObject_Type);
if (PyDict_SetItemString(d, "TXNFontMenuObjectType", (PyObject *)&TXNFontMenuObject_Type) != 0)
Py_FatalError("can't initialize TXNFontMenuObjectType");
PyModule_AddObject(m, "TXNFontMenuObject", (PyObject *)&TXNFontMenuObject_Type);
/* Backward-compatible name */
Py_INCREF(&TXNFontMenuObject_Type);
PyModule_AddObject(m, "TXNFontMenuObjectType", (PyObject *)&TXNFontMenuObject_Type);
}
/* ======================== End module _Mlte ======================== */
......
......@@ -136,11 +136,11 @@ execfile("mltetypetest.py")
# Our (opaque) objects
class TXNObjDefinition(PEP252Mixin, GlobalObjectDefinition):
class TXNObjDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
class TXNFontMenuObjDefinition(PEP252Mixin, GlobalObjectDefinition):
class TXNFontMenuObjDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
......
......@@ -1115,6 +1115,24 @@ static PyGetSetDef GrafObj_getsetlist[] = {
#define GrafObj_repr NULL
#define GrafObj_hash NULL
#define GrafObj_tp_init 0
#define GrafObj_tp_alloc PyType_GenericAlloc
static PyObject *GrafObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
GrafPtr itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, GrafObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((GrafPortObject *)self)->ob_itself = itself;
return self;
}
#define GrafObj_tp_free PyObject_Del
PyTypeObject GrafPort_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -1137,19 +1155,27 @@ PyTypeObject GrafPort_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
GrafObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
GrafObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
GrafObj_tp_init, /* tp_init */
GrafObj_tp_alloc, /* tp_alloc */
GrafObj_tp_new, /* tp_new */
GrafObj_tp_free, /* tp_free */
};
/* -------------------- End object type GrafPort -------------------- */
......@@ -1287,6 +1313,24 @@ static PyGetSetDef BMObj_getsetlist[] = {
#define BMObj_repr NULL
#define BMObj_hash NULL
#define BMObj_tp_init 0
#define BMObj_tp_alloc PyType_GenericAlloc
static PyObject *BMObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
BitMapPtr itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, BMObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((BitMapObject *)self)->ob_itself = itself;
return self;
}
#define BMObj_tp_free PyObject_Del
PyTypeObject BitMap_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -1309,19 +1353,27 @@ PyTypeObject BitMap_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
BMObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
BMObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
BMObj_tp_init, /* tp_init */
BMObj_tp_alloc, /* tp_alloc */
BMObj_tp_new, /* tp_new */
BMObj_tp_free, /* tp_free */
};
/* --------------------- End object type BitMap --------------------- */
......@@ -6872,12 +6924,16 @@ void init_Qd(void)
return;
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");
PyModule_AddObject(m, "GrafPort", (PyObject *)&GrafPort_Type);
/* Backward-compatible name */
Py_INCREF(&GrafPort_Type);
PyModule_AddObject(m, "GrafPortType", (PyObject *)&GrafPort_Type);
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");
PyModule_AddObject(m, "BitMap", (PyObject *)&BitMap_Type);
/* Backward-compatible name */
Py_INCREF(&BitMap_Type);
PyModule_AddObject(m, "BitMapType", (PyObject *)&BitMap_Type);
}
/* ========================= End module _Qd ========================= */
......
......@@ -236,7 +236,7 @@ initstuff = initstuff + """
## def outputFreeIt(self, itselfname):
## Output("KillPoly(%s);", itselfname)
class MyGRObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MyGRObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
getsetlist = [
('visRgn',
"""RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
......@@ -277,7 +277,7 @@ class MyGRObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
OutRbrace()
Output("#endif")
class MyBMObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MyBMObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
getsetlist = [
(
'baseAddr',
......
......@@ -133,11 +133,30 @@ static PyMethodDef GWorldObj_methods[] = {
#define GWorldObj_getsetlist NULL
#define GWorldObj_compare NULL
#define GWorldObj_repr NULL
#define GWorldObj_hash NULL
#define GWorldObj_tp_init 0
#define GWorldObj_tp_alloc PyType_GenericAlloc
static PyObject *GWorldObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
GWorldPtr itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, GWorldObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((GWorldObject *)self)->ob_itself = itself;
return self;
}
#define GWorldObj_tp_free PyObject_Del
PyTypeObject GWorld_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -160,19 +179,27 @@ PyTypeObject GWorld_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
GWorldObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
GWorldObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
GWorldObj_tp_init, /* tp_init */
GWorldObj_tp_alloc, /* tp_alloc */
GWorldObj_tp_new, /* tp_new */
GWorldObj_tp_free, /* tp_free */
};
/* --------------------- End object type GWorld --------------------- */
......@@ -684,8 +711,10 @@ void init_Qdoffs(void)
return;
GWorld_Type.ob_type = &PyType_Type;
Py_INCREF(&GWorld_Type);
if (PyDict_SetItemString(d, "GWorldType", (PyObject *)&GWorld_Type) != 0)
Py_FatalError("can't initialize GWorldType");
PyModule_AddObject(m, "GWorld", (PyObject *)&GWorld_Type);
/* Backward-compatible name */
Py_INCREF(&GWorld_Type);
PyModule_AddObject(m, "GWorldType", (PyObject *)&GWorld_Type);
}
/* ======================= End module _Qdoffs ======================= */
......
......@@ -57,7 +57,8 @@ initstuff = initstuff + """
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GWorldPtr, GWorldObj_Convert);
"""
class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
# XXXX Should inherit from GrafPtr?
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
## def outputInitStructMembers(self):
......
This diff is collapsed.
......@@ -181,7 +181,7 @@ QTFloatSingle = Type("QTFloatSingle", "f")
dummyshortptr = FakeType('(short *)0')
dummyStringPtr = FakeType('(StringPtr)0')
class MovieObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MovieObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null Movie");
......@@ -190,7 +190,7 @@ class MovieObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputFreeIt(self, itselfname):
Output("DisposeMovie(%s);", itselfname)
class TrackObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class TrackObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null Track");
......@@ -199,7 +199,7 @@ class TrackObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputFreeIt(self, itselfname):
Output("DisposeMovieTrack(%s);", itselfname)
class MediaObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MediaObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null Media");
......@@ -208,7 +208,7 @@ class MediaObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputFreeIt(self, itselfname):
Output("DisposeTrackMedia(%s);", itselfname)
class UserDataObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class UserDataObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null UserData");
......@@ -217,7 +217,7 @@ class UserDataObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputFreeIt(self, itselfname):
Output("DisposeUserData(%s);", itselfname)
class TimeBaseObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class TimeBaseObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null TimeBase");
......@@ -226,7 +226,7 @@ class TimeBaseObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
## def outputFreeIt(self, itselfname):
## Output("DisposeTimeBase(%s);", itselfname)
class MovieCtlObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MovieCtlObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null MovieController");
......
......@@ -55,7 +55,7 @@ ScrapFlavorFlags = Type('ScrapFlavorFlags', 'l')
#ScrapFlavorInfo = OpaqueType('ScrapFlavorInfo', 'ScrapFlavorInfo')
putscrapbuffer = FixedInputBufferType('void *')
class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
pass
# Create the generator groups and link them
......
......@@ -330,19 +330,27 @@ static PyTypeObject SndChannel_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
SndCh_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
SndCh_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
0, /*tp_new*/
0, /*tp_free*/
};
/* ------------------- End object type SndChannel ------------------- */
......@@ -459,6 +467,7 @@ static PyGetSetDef SPBObj_getsetlist[] = {
{"milliseconds", (getter)SPBObj_get_milliseconds, (setter)SPBObj_set_milliseconds, NULL},
{"error", (getter)SPBObj_get_error, (setter)SPBObj_set_error, NULL},
{"completionRoutine", (getter)SPBObj_get_completionRoutine, (setter)SPBObj_set_completionRoutine, NULL},
{NULL, NULL, NULL, NULL},
};
......@@ -489,19 +498,27 @@ static PyTypeObject SPB_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
SPBObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
SPBObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
0, /*tp_new*/
0, /*tp_free*/
};
/* ---------------------- End object type SPB ----------------------- */
......@@ -1537,12 +1554,16 @@ void init_Snd(void)
return;
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");
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;
Py_INCREF(&SPB_Type);
if (PyDict_SetItemString(d, "SPBType", (PyObject *)&SPB_Type) != 0)
Py_FatalError("can't initialize SPBType");
PyModule_AddObject(m, "SPB", (PyObject *)&SPB_Type);
/* Backward-compatible name */
Py_INCREF(&SPB_Type);
PyModule_AddObject(m, "SPBType", (PyObject *)&SPB_Type);
}
/* ======================== End module _Snd ========================= */
......
......@@ -979,6 +979,7 @@ static PyGetSetDef TEObj_getsetlist[] = {
{"txMode", (getter)TEObj_get_txMode, (setter)TEObj_set_txMode, "Current text-drawing mode"},
{"txSize", (getter)TEObj_get_txSize, (setter)TEObj_set_txSize, "Current font size"},
{"nLines", (getter)TEObj_get_nLines, (setter)TEObj_set_nLines, "TBD"},
{NULL, NULL, NULL, NULL},
};
......@@ -987,6 +988,24 @@ static PyGetSetDef TEObj_getsetlist[] = {
#define TEObj_repr NULL
#define TEObj_hash NULL
#define TEObj_tp_init 0
#define TEObj_tp_alloc PyType_GenericAlloc
static PyObject *TEObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
TEHandle itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, TEObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((TEObject *)self)->ob_itself = itself;
return self;
}
#define TEObj_tp_free PyObject_Del
PyTypeObject TE_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -1009,19 +1028,27 @@ PyTypeObject TE_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
TEObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
TEObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
TEObj_tp_init, /* tp_init */
TEObj_tp_alloc, /* tp_alloc */
TEObj_tp_new, /* tp_new */
TEObj_tp_free, /* tp_free */
};
/* ----------------------- End object type TE ----------------------- */
......@@ -1313,8 +1340,10 @@ void init_TE(void)
return;
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");
PyModule_AddObject(m, "TE", (PyObject *)&TE_Type);
/* Backward-compatible name */
Py_INCREF(&TE_Type);
PyModule_AddObject(m, "TEType", (PyObject *)&TE_Type);
}
/* ========================= End module _TE ========================= */
......
......@@ -93,7 +93,8 @@ class TEMethodGenerator(OSErrWeakLinkMethodGenerator):
class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
# XXXX Could be subtype of Resource
# Attributes that can be set.
getsetlist = [
(
......
......@@ -386,11 +386,30 @@ static PyMethodDef WEOObj_methods[] = {
#define WEOObj_getsetlist NULL
#define WEOObj_compare NULL
#define WEOObj_repr NULL
#define WEOObj_hash NULL
#define WEOObj_tp_init 0
#define WEOObj_tp_alloc PyType_GenericAlloc
static PyObject *WEOObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
WEObjectReference itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, WEOObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((WEOObject *)self)->ob_itself = itself;
return self;
}
#define WEOObj_tp_free PyObject_Del
PyTypeObject WEO_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -413,19 +432,27 @@ PyTypeObject WEO_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
WEOObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
WEOObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
WEOObj_tp_init, /* tp_init */
WEOObj_tp_alloc, /* tp_alloc */
WEOObj_tp_new, /* tp_new */
WEOObj_tp_free, /* tp_free */
};
/* ---------------------- End object type WEO ----------------------- */
......@@ -2108,11 +2135,30 @@ static PyMethodDef wasteObj_methods[] = {
#define wasteObj_getsetlist NULL
#define wasteObj_compare NULL
#define wasteObj_repr NULL
#define wasteObj_hash NULL
#define wasteObj_tp_init 0
#define wasteObj_tp_alloc PyType_GenericAlloc
static PyObject *wasteObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
WEReference itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, wasteObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((wasteObject *)self)->ob_itself = itself;
return self;
}
#define wasteObj_tp_free PyObject_Del
PyTypeObject waste_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -2135,19 +2181,27 @@ PyTypeObject waste_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
wasteObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
wasteObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
wasteObj_tp_init, /* tp_init */
wasteObj_tp_alloc, /* tp_alloc */
wasteObj_tp_new, /* tp_new */
wasteObj_tp_free, /* tp_free */
};
/* --------------------- End object type waste ---------------------- */
......@@ -2506,12 +2560,16 @@ void initwaste(void)
return;
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");
PyModule_AddObject(m, "WEO", (PyObject *)&WEO_Type);
/* Backward-compatible name */
Py_INCREF(&WEO_Type);
PyModule_AddObject(m, "WEOType", (PyObject *)&WEO_Type);
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");
PyModule_AddObject(m, "waste", (PyObject *)&waste_Type);
/* Backward-compatible name */
Py_INCREF(&waste_Type);
PyModule_AddObject(m, "wasteType", (PyObject *)&waste_Type);
callbackdict = PyDict_New();
if (callbackdict == NULL || PyDict_SetItemString(d, "callbacks", callbackdict) != 0)
......
......@@ -277,7 +277,7 @@ class WEMethodGenerator(OSErrMethodGenerator):
class WEObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class WEObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(waste_Error,"Cannot create null WE");
......@@ -289,7 +289,7 @@ class WEObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputFreeIt(self, itselfname):
Output("WEDispose(%s);", itselfname)
class WEOObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class WEOObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
Py_INCREF(Py_None);
......
......@@ -77,6 +77,7 @@ PyObject *WinObj_New(WindowPtr itself)
{
WindowObject *it;
if (itself == NULL) return PyMac_Error(resNotFound);
/* XXXX Or should we use WhichWindow code here? */
it = PyObject_NEW(WindowObject, &Window_Type);
if (it == NULL) return NULL;
it->ob_itself = itself;
......@@ -2928,6 +2929,7 @@ static PyMethodDef WinObj_methods[] = {
#define WinObj_getsetlist NULL
static int WinObj_compare(WindowObject *self, WindowObject *other)
{
if ( self->ob_itself > other->ob_itself ) return 1;
......@@ -2946,6 +2948,24 @@ static int WinObj_hash(WindowObject *self)
{
return (int)self->ob_itself;
}
#define WinObj_tp_init 0
#define WinObj_tp_alloc PyType_GenericAlloc
static PyObject *WinObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
WindowPtr itself;
char *kw[] = {"itself", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, WinObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((WindowObject *)self)->ob_itself = itself;
return self;
}
#define WinObj_tp_free PyObject_Del
PyTypeObject Window_Type = {
PyObject_HEAD_INIT(NULL)
......@@ -2968,19 +2988,27 @@ PyTypeObject Window_Type = {
0, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
0, /*outputHook_tp_as_buffer*/
0, /*outputHook_tp_flags*/
0, /*outputHook_tp_doc*/
0, /*outputHook_tp_traverse*/
0, /*outputHook_tp_clear*/
0, /*outputHook_tp_richcompare*/
0, /*outputHook_tp_weaklistoffset*/
0, /*outputHook_tp_iter*/
0, /*outputHook_tp_iternext*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
WinObj_methods, /* tp_methods */
0, /*outputHook_tp_members*/
0, /*tp_members*/
WinObj_getsetlist, /*tp_getset*/
0, /*outputHook_tp_base*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
WinObj_tp_init, /* tp_init */
WinObj_tp_alloc, /* tp_alloc */
WinObj_tp_new, /* tp_new */
WinObj_tp_free, /* tp_free */
};
/* --------------------- End object type Window --------------------- */
......@@ -3828,8 +3856,10 @@ void init_Win(void)
return;
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");
PyModule_AddObject(m, "Window", (PyObject *)&Window_Type);
/* Backward-compatible name */
Py_INCREF(&Window_Type);
PyModule_AddObject(m, "WindowType", (PyObject *)&Window_Type);
}
/* ======================== End module _Win ========================= */
......
......@@ -128,9 +128,10 @@ initstuff = initstuff + """
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WindowPtr, WinObj_Convert);
"""
class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
Output("/* XXXX Or should we use WhichWindow code here? */")
def outputStructMembers(self):
GlobalObjectDefinition.outputStructMembers(self)
Output("void (*ob_freeit)(%s ptr);", self.itselftype)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment