summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2002-11-29 23:40:48 +0000
committerJack Jansen <jack.jansen@cwi.nl>2002-11-29 23:40:48 +0000
commitdbd5701d736a151d29fee4658228e16876626f47 (patch)
tree164a5bf1d9a00788bd229820df9bfa81d75933eb
parent818855939ac016492cb59d1fc2fea94cc0764855 (diff)
downloadcpython-git-dbd5701d736a151d29fee4658228e16876626f47.tar.gz
Converted the Carbon modules to use PEP252-style objects, with
descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support.
-rw-r--r--Mac/Modules/ae/_AEmodule.c102
-rw-r--r--Mac/Modules/ae/aesupport.py79
-rw-r--r--Mac/Modules/alias/_Aliasmodule.c30
-rw-r--r--Mac/Modules/alias/aliassupport.py2
-rw-r--r--Mac/Modules/app/_Appmodule.c30
-rw-r--r--Mac/Modules/app/appsupport.py2
-rw-r--r--Mac/Modules/carbonevt/CarbonEvtsupport.py7
-rwxr-xr-xMac/Modules/carbonevt/_CarbonEvtmodule.c240
-rwxr-xr-xMac/Modules/cg/_CGmodule.c30
-rwxr-xr-xMac/Modules/cg/cgsupport.py2
-rw-r--r--Mac/Modules/cm/_Cmmodule.c60
-rw-r--r--Mac/Modules/cm/cmsupport.py4
-rw-r--r--Mac/Modules/ctl/_Ctlmodule.c30
-rw-r--r--Mac/Modules/ctl/ctlsupport.py2
-rw-r--r--Mac/Modules/dlg/_Dlgmodule.c30
-rw-r--r--Mac/Modules/dlg/dlgsupport.py2
-rw-r--r--Mac/Modules/drag/_Dragmodule.c30
-rw-r--r--Mac/Modules/drag/dragsupport.py2
-rw-r--r--Mac/Modules/evt/evtsupport.py17
-rw-r--r--Mac/Modules/help/helpsupport.py2
-rw-r--r--Mac/Modules/ibcarbon/IBCarbonsupport.py4
-rw-r--r--Mac/Modules/ibcarbon/_IBCarbon.c30
-rw-r--r--Mac/Modules/icn/icnsupport.py2
-rw-r--r--Mac/Modules/list/_Listmodule.c414
-rw-r--r--Mac/Modules/list/listscan.py2
-rw-r--r--Mac/Modules/list/listsupport.py58
-rw-r--r--Mac/Modules/menu/_Menumodule.c30
-rw-r--r--Mac/Modules/menu/menusupport.py2
-rw-r--r--Mac/Modules/mlte/_Mltemodule.c60
-rw-r--r--Mac/Modules/mlte/mltesupport.py4
-rw-r--r--Mac/Modules/qd/_Qdmodule.c2254
-rw-r--r--Mac/Modules/qd/qdscan.py6
-rw-r--r--Mac/Modules/qd/qdsupport.py314
-rw-r--r--Mac/Modules/qdoffs/_Qdoffsmodule.c30
-rw-r--r--Mac/Modules/qdoffs/qdoffssupport.py2
-rw-r--r--Mac/Modules/qt/_Qtmodule.c180
-rw-r--r--Mac/Modules/qt/qtsupport.py12
-rw-r--r--Mac/Modules/res/_Resmodule.c114
-rw-r--r--Mac/Modules/res/ressupport.py92
-rw-r--r--Mac/Modules/scrap/scrapsupport.py2
-rw-r--r--Mac/Modules/snd/_Sndmodule.c138
-rw-r--r--Mac/Modules/snd/sndsupport.py82
-rw-r--r--Mac/Modules/te/_TEmodule.c198
-rw-r--r--Mac/Modules/te/tesupport.py125
-rw-r--r--Mac/Modules/waste/wastemodule.c60
-rw-r--r--Mac/Modules/waste/wastesupport.py4
-rw-r--r--Mac/Modules/win/_Winmodule.c30
-rw-r--r--Mac/Modules/win/winsupport.py2
48 files changed, 2447 insertions, 2507 deletions
diff --git a/Mac/Modules/ae/_AEmodule.c b/Mac/Modules/ae/_AEmodule.c
index 0d8b802186..db8239c1ce 100644
--- a/Mac/Modules/ae/_AEmodule.c
+++ b/Mac/Modules/ae/_AEmodule.c
@@ -20,6 +20,9 @@
}} while(0)
+#ifndef PyDoc_STR
+#define PyDoc_STR(x) (x)
+#endif
#ifdef WITHOUT_FRAMEWORKS
#include <AppleEvents.h>
#include <AEObjects.h>
@@ -35,7 +38,13 @@ extern int _AEDesc_Convert(PyObject *, AEDesc *);
#define AEDesc_Convert _AEDesc_Convert
#endif
-static pascal OSErr GenericEventHandler(); /* Forward */
+#if UNIVERSAL_INTERFACES_VERSION >= 0x0340
+typedef long refcontype;
+#else
+typedef unsigned long refcontype;
+#endif
+
+static pascal OSErr GenericEventHandler(const AppleEvent *request, AppleEvent *reply, refcontype refcon); /* Forward */
AEEventHandlerUPP upp_GenericEventHandler;
@@ -820,46 +829,40 @@ static PyMethodDef AEDesc_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain AEDesc_chain = { AEDesc_methods, NULL };
-
-static PyObject *AEDesc_getattr(AEDescObject *self, char *name)
+static PyObject *AEDesc_get_type(AEDescObject *self, void *closure)
{
+ return PyMac_BuildOSType(self->ob_itself.descriptorType);
+}
- if (strcmp(name, "type") == 0)
- return PyMac_BuildOSType(self->ob_itself.descriptorType);
- if (strcmp(name, "data") == 0) {
- PyObject *res;
-#if !TARGET_API_MAC_CARBON
- char state;
- state = HGetState(self->ob_itself.dataHandle);
- HLock(self->ob_itself.dataHandle);
- res = PyString_FromStringAndSize(
- *self->ob_itself.dataHandle,
- GetHandleSize(self->ob_itself.dataHandle));
- HUnlock(self->ob_itself.dataHandle);
- HSetState(self->ob_itself.dataHandle, state);
-#else
- Size size;
- char *ptr;
- OSErr err;
-
- size = AEGetDescDataSize(&self->ob_itself);
- if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL )
- return NULL;
- if ( (ptr = PyString_AsString(res)) == NULL )
- return NULL;
- if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 )
- return PyMac_Error(err);
-#endif
- return res;
- }
- if (strcmp(name, "__members__") == 0)
- return Py_BuildValue("[ss]", "data", "type");
+#define AEDesc_set_type NULL
- return Py_FindMethodInChain(&AEDesc_chain, (PyObject *)self, name);
+static PyObject *AEDesc_get_data(AEDescObject *self, void *closure)
+{
+
+ PyObject *res;
+ Size size;
+ char *ptr;
+ OSErr err;
+
+ size = AEGetDescDataSize(&self->ob_itself);
+ if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL )
+ return NULL;
+ if ( (ptr = PyString_AsString(res)) == NULL )
+ return NULL;
+ if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 )
+ return PyMac_Error(err);
+ return res;
+
}
-#define AEDesc_setattr NULL
+#define AEDesc_set_data NULL
+
+static PyGetSetDef AEDesc_getsetlist[] = {
+ {"type", (getter)AEDesc_get_type, (setter)AEDesc_set_type, "Type of this AEDesc"},
+ {"data", (getter)AEDesc_get_data, (setter)AEDesc_set_data, "The raw data in this AEDesc"},
+ {NULL, NULL, NULL, NULL},
+};
+
#define AEDesc_compare NULL
@@ -876,14 +879,31 @@ PyTypeObject AEDesc_Type = {
/* methods */
(destructor) AEDesc_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) AEDesc_getattr, /*tp_getattr*/
- (setattrfunc) AEDesc_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) AEDesc_compare, /*tp_compare*/
(reprfunc) AEDesc_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) AEDesc_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ AEDesc_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ AEDesc_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* --------------------- End object type AEDesc --------------------- */
@@ -1350,12 +1370,6 @@ static PyMethodDef AE_methods[] = {
-#if UNIVERSAL_INTERFACES_VERSION >= 0x0340
-typedef long refcontype;
-#else
-typedef unsigned long refcontype;
-#endif
-
static pascal OSErr
GenericEventHandler(const AppleEvent *request, AppleEvent *reply, refcontype refcon)
{
diff --git a/Mac/Modules/ae/aesupport.py b/Mac/Modules/ae/aesupport.py
index 8ecaeda3cb..e6c4efee75 100644
--- a/Mac/Modules/ae/aesupport.py
+++ b/Mac/Modules/ae/aesupport.py
@@ -82,6 +82,9 @@ AEMethod = OSErrWeakLinkMethodGenerator
includestuff = includestuff + """
+#ifndef PyDoc_STR
+#define PyDoc_STR(x) (x)
+#endif
#ifdef WITHOUT_FRAMEWORKS
#include <AppleEvents.h>
#include <AEObjects.h>
@@ -97,7 +100,13 @@ extern int _AEDesc_Convert(PyObject *, AEDesc *);
#define AEDesc_Convert _AEDesc_Convert
#endif
-static pascal OSErr GenericEventHandler(); /* Forward */
+#if UNIVERSAL_INTERFACES_VERSION >= 0x0340
+typedef long refcontype;
+#else
+typedef unsigned long refcontype;
+#endif
+
+static pascal OSErr GenericEventHandler(const AppleEvent *request, AppleEvent *reply, refcontype refcon); /* Forward */
AEEventHandlerUPP upp_GenericEventHandler;
@@ -118,12 +127,6 @@ AEIdleUPP upp_AEIdleProc;
"""
finalstuff = finalstuff + """
-#if UNIVERSAL_INTERFACES_VERSION >= 0x0340
-typedef long refcontype;
-#else
-typedef unsigned long refcontype;
-#endif
-
static pascal OSErr
GenericEventHandler(const AppleEvent *request, AppleEvent *reply, refcontype refcon)
{
@@ -171,7 +174,32 @@ initstuff = initstuff + """
module = MacModule('_AE', 'AE', includestuff, finalstuff, initstuff)
-class AEDescDefinition(GlobalObjectDefinition):
+class AEDescDefinition(PEP252Mixin, GlobalObjectDefinition):
+ getsetlist = [(
+ 'type',
+ 'return PyMac_BuildOSType(self->ob_itself.descriptorType);',
+ None,
+ 'Type of this AEDesc'
+ ), (
+ 'data',
+ """
+ PyObject *res;
+ Size size;
+ char *ptr;
+ OSErr err;
+
+ size = AEGetDescDataSize(&self->ob_itself);
+ if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL )
+ return NULL;
+ if ( (ptr = PyString_AsString(res)) == NULL )
+ return NULL;
+ if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 )
+ return PyMac_Error(err);
+ return res;
+ """,
+ None,
+ 'The raw data in this AEDesc'
+ )]
def __init__(self, name, prefix = None, itselftype = None):
GlobalObjectDefinition.__init__(self, name, prefix or name, itselftype or name)
@@ -180,41 +208,6 @@ class AEDescDefinition(GlobalObjectDefinition):
def outputFreeIt(self, name):
Output("AEDisposeDesc(&%s);", name)
- def outputGetattrHook(self):
- Output("""
-if (strcmp(name, "type") == 0)
- return PyMac_BuildOSType(self->ob_itself.descriptorType);
-if (strcmp(name, "data") == 0) {
- PyObject *res;
-#if !TARGET_API_MAC_CARBON
- char state;
- state = HGetState(self->ob_itself.dataHandle);
- HLock(self->ob_itself.dataHandle);
- res = PyString_FromStringAndSize(
- *self->ob_itself.dataHandle,
- GetHandleSize(self->ob_itself.dataHandle));
- HUnlock(self->ob_itself.dataHandle);
- HSetState(self->ob_itself.dataHandle, state);
-#else
- Size size;
- char *ptr;
- OSErr err;
-
- size = AEGetDescDataSize(&self->ob_itself);
- if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL )
- return NULL;
- if ( (ptr = PyString_AsString(res)) == NULL )
- return NULL;
- if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 )
- return PyMac_Error(err);
-#endif
- return res;
-}
-if (strcmp(name, "__members__") == 0)
- return Py_BuildValue("[ss]", "data", "type");
-""")
-
-
aedescobject = AEDescDefinition('AEDesc')
module.addobject(aedescobject)
diff --git a/Mac/Modules/alias/_Aliasmodule.c b/Mac/Modules/alias/_Aliasmodule.c
index 7b30d0586d..91e0f282b6 100644
--- a/Mac/Modules/alias/_Aliasmodule.c
+++ b/Mac/Modules/alias/_Aliasmodule.c
@@ -95,14 +95,7 @@ static PyMethodDef AliasObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain AliasObj_chain = { AliasObj_methods, NULL };
-
-static PyObject *AliasObj_getattr(AliasObject *self, char *name)
-{
- return Py_FindMethodInChain(&AliasObj_chain, (PyObject *)self, name);
-}
-
-#define AliasObj_setattr NULL
+#define AliasObj_getsetlist NULL
#define AliasObj_compare NULL
@@ -119,14 +112,31 @@ PyTypeObject Alias_Type = {
/* methods */
(destructor) AliasObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) AliasObj_getattr, /*tp_getattr*/
- (setattrfunc) AliasObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) AliasObj_compare, /*tp_compare*/
(reprfunc) AliasObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) AliasObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ AliasObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ AliasObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* --------------------- End object type Alias ---------------------- */
diff --git a/Mac/Modules/alias/aliassupport.py b/Mac/Modules/alias/aliassupport.py
index 932eed79d4..7fd6f84e40 100644
--- a/Mac/Modules/alias/aliassupport.py
+++ b/Mac/Modules/alias/aliassupport.py
@@ -72,7 +72,7 @@ execfile(string.lower(MODPREFIX) + 'typetest.py')
# Create the generator groups and link them
module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
-class AliasDefinition(GlobalObjectDefinition):
+class AliasDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
diff --git a/Mac/Modules/app/_Appmodule.c b/Mac/Modules/app/_Appmodule.c
index e5362c9b9f..da6c33924d 100644
--- a/Mac/Modules/app/_Appmodule.c
+++ b/Mac/Modules/app/_Appmodule.c
@@ -113,14 +113,7 @@ static PyMethodDef ThemeDrawingStateObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain ThemeDrawingStateObj_chain = { ThemeDrawingStateObj_methods, NULL };
-
-static PyObject *ThemeDrawingStateObj_getattr(ThemeDrawingStateObject *self, char *name)
-{
- return Py_FindMethodInChain(&ThemeDrawingStateObj_chain, (PyObject *)self, name);
-}
-
-#define ThemeDrawingStateObj_setattr NULL
+#define ThemeDrawingStateObj_getsetlist NULL
#define ThemeDrawingStateObj_compare NULL
@@ -137,14 +130,31 @@ PyTypeObject ThemeDrawingState_Type = {
/* methods */
(destructor) ThemeDrawingStateObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) ThemeDrawingStateObj_getattr, /*tp_getattr*/
- (setattrfunc) ThemeDrawingStateObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) ThemeDrawingStateObj_compare, /*tp_compare*/
(reprfunc) ThemeDrawingStateObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) ThemeDrawingStateObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ ThemeDrawingStateObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ ThemeDrawingStateObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* --------------- End object type ThemeDrawingState ---------------- */
diff --git a/Mac/Modules/app/appsupport.py b/Mac/Modules/app/appsupport.py
index a9cdf76f3d..b6545efccb 100644
--- a/Mac/Modules/app/appsupport.py
+++ b/Mac/Modules/app/appsupport.py
@@ -94,7 +94,7 @@ int ThemeButtonDrawInfo_Convert(PyObject *v, ThemeButtonDrawInfo *p_itself)
"""
-class MyObjectDefinition(GlobalObjectDefinition):
+class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
pass
## def outputCheckNewArg(self):
## Output("if (itself == NULL) return PyMac_Error(resNotFound);")
diff --git a/Mac/Modules/carbonevt/CarbonEvtsupport.py b/Mac/Modules/carbonevt/CarbonEvtsupport.py
index cbaca2a461..e3ac5f5d11 100644
--- a/Mac/Modules/carbonevt/CarbonEvtsupport.py
+++ b/Mac/Modules/carbonevt/CarbonEvtsupport.py
@@ -215,7 +215,7 @@ module = MacModule('_CarbonEvt', 'CarbonEvents', includestuff, finalstuff, inits
-class EventHandlerRefObjectDefinition(GlobalObjectDefinition):
+class EventHandlerRefObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputStructMembers(self):
Output("%s ob_itself;", self.itselftype)
Output("PyObject *ob_callback;")
@@ -227,12 +227,15 @@ class EventHandlerRefObjectDefinition(GlobalObjectDefinition):
Output("RemoveEventHandler(self->ob_itself);")
Output("Py_DECREF(self->ob_callback);")
OutRbrace()
+
+class MyGlobalObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+ pass
for typ in RefObjectTypes:
if typ == 'EventHandlerRef':
EventHandlerRefobject = EventHandlerRefObjectDefinition('EventHandlerRef')
else:
- execstr = typ + 'object = GlobalObjectDefinition(typ)'
+ execstr = typ + 'object = MyGlobalObjectDefinition(typ)'
exec execstr
module.addobject(eval(typ + 'object'))
diff --git a/Mac/Modules/carbonevt/_CarbonEvtmodule.c b/Mac/Modules/carbonevt/_CarbonEvtmodule.c
index 9ef572cfc2..05ad7fb6e3 100755
--- a/Mac/Modules/carbonevt/_CarbonEvtmodule.c
+++ b/Mac/Modules/carbonevt/_CarbonEvtmodule.c
@@ -408,14 +408,7 @@ static PyMethodDef EventRef_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain EventRef_chain = { EventRef_methods, NULL };
-
-static PyObject *EventRef_getattr(EventRefObject *self, char *name)
-{
- return Py_FindMethodInChain(&EventRef_chain, (PyObject *)self, name);
-}
-
-#define EventRef_setattr NULL
+#define EventRef_getsetlist NULL
#define EventRef_compare NULL
@@ -432,14 +425,31 @@ PyTypeObject EventRef_Type = {
/* methods */
(destructor) EventRef_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) EventRef_getattr, /*tp_getattr*/
- (setattrfunc) EventRef_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) EventRef_compare, /*tp_compare*/
(reprfunc) EventRef_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) EventRef_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ EventRef_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ EventRef_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* -------------------- End object type EventRef -------------------- */
@@ -591,14 +601,7 @@ static PyMethodDef EventQueueRef_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain EventQueueRef_chain = { EventQueueRef_methods, NULL };
-
-static PyObject *EventQueueRef_getattr(EventQueueRefObject *self, char *name)
-{
- return Py_FindMethodInChain(&EventQueueRef_chain, (PyObject *)self, name);
-}
-
-#define EventQueueRef_setattr NULL
+#define EventQueueRef_getsetlist NULL
#define EventQueueRef_compare NULL
@@ -615,14 +618,31 @@ PyTypeObject EventQueueRef_Type = {
/* methods */
(destructor) EventQueueRef_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) EventQueueRef_getattr, /*tp_getattr*/
- (setattrfunc) EventQueueRef_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) EventQueueRef_compare, /*tp_compare*/
(reprfunc) EventQueueRef_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) EventQueueRef_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ EventQueueRef_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ EventQueueRef_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* ----------------- End object type EventQueueRef ------------------ */
@@ -683,14 +703,7 @@ static PyMethodDef EventLoopRef_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain EventLoopRef_chain = { EventLoopRef_methods, NULL };
-
-static PyObject *EventLoopRef_getattr(EventLoopRefObject *self, char *name)
-{
- return Py_FindMethodInChain(&EventLoopRef_chain, (PyObject *)self, name);
-}
-
-#define EventLoopRef_setattr NULL
+#define EventLoopRef_getsetlist NULL
#define EventLoopRef_compare NULL
@@ -707,14 +720,31 @@ PyTypeObject EventLoopRef_Type = {
/* methods */
(destructor) EventLoopRef_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) EventLoopRef_getattr, /*tp_getattr*/
- (setattrfunc) EventLoopRef_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) EventLoopRef_compare, /*tp_compare*/
(reprfunc) EventLoopRef_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) EventLoopRef_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ EventLoopRef_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ EventLoopRef_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* ------------------ End object type EventLoopRef ------------------ */
@@ -793,14 +823,7 @@ static PyMethodDef EventLoopTimerRef_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain EventLoopTimerRef_chain = { EventLoopTimerRef_methods, NULL };
-
-static PyObject *EventLoopTimerRef_getattr(EventLoopTimerRefObject *self, char *name)
-{
- return Py_FindMethodInChain(&EventLoopTimerRef_chain, (PyObject *)self, name);
-}
-
-#define EventLoopTimerRef_setattr NULL
+#define EventLoopTimerRef_getsetlist NULL
#define EventLoopTimerRef_compare NULL
@@ -817,14 +840,31 @@ PyTypeObject EventLoopTimerRef_Type = {
/* methods */
(destructor) EventLoopTimerRef_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) EventLoopTimerRef_getattr, /*tp_getattr*/
- (setattrfunc) EventLoopTimerRef_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) EventLoopTimerRef_compare, /*tp_compare*/
(reprfunc) EventLoopTimerRef_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) EventLoopTimerRef_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ EventLoopTimerRef_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ EventLoopTimerRef_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* --------------- End object type EventLoopTimerRef ---------------- */
@@ -948,14 +988,7 @@ static PyMethodDef EventHandlerRef_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain EventHandlerRef_chain = { EventHandlerRef_methods, NULL };
-
-static PyObject *EventHandlerRef_getattr(EventHandlerRefObject *self, char *name)
-{
- return Py_FindMethodInChain(&EventHandlerRef_chain, (PyObject *)self, name);
-}
-
-#define EventHandlerRef_setattr NULL
+#define EventHandlerRef_getsetlist NULL
#define EventHandlerRef_compare NULL
@@ -972,14 +1005,31 @@ PyTypeObject EventHandlerRef_Type = {
/* methods */
(destructor) EventHandlerRef_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) EventHandlerRef_getattr, /*tp_getattr*/
- (setattrfunc) EventHandlerRef_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) EventHandlerRef_compare, /*tp_compare*/
(reprfunc) EventHandlerRef_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) EventHandlerRef_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ EventHandlerRef_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ EventHandlerRef_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* ---------------- End object type EventHandlerRef ----------------- */
@@ -1043,14 +1093,7 @@ static PyMethodDef EventHandlerCallRef_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain EventHandlerCallRef_chain = { EventHandlerCallRef_methods, NULL };
-
-static PyObject *EventHandlerCallRef_getattr(EventHandlerCallRefObject *self, char *name)
-{
- return Py_FindMethodInChain(&EventHandlerCallRef_chain, (PyObject *)self, name);
-}
-
-#define EventHandlerCallRef_setattr NULL
+#define EventHandlerCallRef_getsetlist NULL
#define EventHandlerCallRef_compare NULL
@@ -1067,14 +1110,31 @@ PyTypeObject EventHandlerCallRef_Type = {
/* methods */
(destructor) EventHandlerCallRef_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) EventHandlerCallRef_getattr, /*tp_getattr*/
- (setattrfunc) EventHandlerCallRef_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) EventHandlerCallRef_compare, /*tp_compare*/
(reprfunc) EventHandlerCallRef_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) EventHandlerCallRef_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ EventHandlerCallRef_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ EventHandlerCallRef_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* -------------- End object type EventHandlerCallRef --------------- */
@@ -1160,14 +1220,7 @@ static PyMethodDef EventTargetRef_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain EventTargetRef_chain = { EventTargetRef_methods, NULL };
-
-static PyObject *EventTargetRef_getattr(EventTargetRefObject *self, char *name)
-{
- return Py_FindMethodInChain(&EventTargetRef_chain, (PyObject *)self, name);
-}
-
-#define EventTargetRef_setattr NULL
+#define EventTargetRef_getsetlist NULL
#define EventTargetRef_compare NULL
@@ -1184,14 +1237,31 @@ PyTypeObject EventTargetRef_Type = {
/* methods */
(destructor) EventTargetRef_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) EventTargetRef_getattr, /*tp_getattr*/
- (setattrfunc) EventTargetRef_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) EventTargetRef_compare, /*tp_compare*/
(reprfunc) EventTargetRef_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) EventTargetRef_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ EventTargetRef_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ EventTargetRef_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* ----------------- End object type EventTargetRef ----------------- */
@@ -1252,14 +1322,7 @@ static PyMethodDef EventHotKeyRef_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain EventHotKeyRef_chain = { EventHotKeyRef_methods, NULL };
-
-static PyObject *EventHotKeyRef_getattr(EventHotKeyRefObject *self, char *name)
-{
- return Py_FindMethodInChain(&EventHotKeyRef_chain, (PyObject *)self, name);
-}
-
-#define EventHotKeyRef_setattr NULL
+#define EventHotKeyRef_getsetlist NULL
#define EventHotKeyRef_compare NULL
@@ -1276,14 +1339,31 @@ PyTypeObject EventHotKeyRef_Type = {
/* methods */
(destructor) EventHotKeyRef_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) EventHotKeyRef_getattr, /*tp_getattr*/
- (setattrfunc) EventHotKeyRef_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) EventHotKeyRef_compare, /*tp_compare*/
(reprfunc) EventHotKeyRef_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) EventHotKeyRef_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ EventHotKeyRef_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ EventHotKeyRef_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* ----------------- End object type EventHotKeyRef ----------------- */
diff --git a/Mac/Modules/cg/_CGmodule.c b/Mac/Modules/cg/_CGmodule.c
index 069889aa68..b475d681fa 100755
--- a/Mac/Modules/cg/_CGmodule.c
+++ b/Mac/Modules/cg/_CGmodule.c
@@ -1266,14 +1266,7 @@ static PyMethodDef CGContextRefObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain CGContextRefObj_chain = { CGContextRefObj_methods, NULL };
-
-static PyObject *CGContextRefObj_getattr(CGContextRefObject *self, char *name)
-{
- return Py_FindMethodInChain(&CGContextRefObj_chain, (PyObject *)self, name);
-}
-
-#define CGContextRefObj_setattr NULL
+#define CGContextRefObj_getsetlist NULL
#define CGContextRefObj_compare NULL
@@ -1290,14 +1283,31 @@ PyTypeObject CGContextRef_Type = {
/* methods */
(destructor) CGContextRefObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) CGContextRefObj_getattr, /*tp_getattr*/
- (setattrfunc) CGContextRefObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) CGContextRefObj_compare, /*tp_compare*/
(reprfunc) CGContextRefObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) CGContextRefObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ CGContextRefObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ CGContextRefObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* ------------------ End object type CGContextRef ------------------ */
diff --git a/Mac/Modules/cg/cgsupport.py b/Mac/Modules/cg/cgsupport.py
index d090685534..ca347f764b 100755
--- a/Mac/Modules/cg/cgsupport.py
+++ b/Mac/Modules/cg/cgsupport.py
@@ -250,7 +250,7 @@ CGPathDrawingMode = int
CGContextRef = OpaqueByValueType("CGContextRef", "CGContextRefObj")
-class MyObjectDefinition(GlobalObjectDefinition):
+class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputStructMembers(self):
ObjectDefinition.outputStructMembers(self)
def outputCleanupStructMembers(self):
diff --git a/Mac/Modules/cm/_Cmmodule.c b/Mac/Modules/cm/_Cmmodule.c
index 8ea72f043e..5aaa79fe71 100644
--- a/Mac/Modules/cm/_Cmmodule.c
+++ b/Mac/Modules/cm/_Cmmodule.c
@@ -305,14 +305,7 @@ static PyMethodDef CmpInstObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain CmpInstObj_chain = { CmpInstObj_methods, NULL };
-
-static PyObject *CmpInstObj_getattr(ComponentInstanceObject *self, char *name)
-{
- return Py_FindMethodInChain(&CmpInstObj_chain, (PyObject *)self, name);
-}
-
-#define CmpInstObj_setattr NULL
+#define CmpInstObj_getsetlist NULL
#define CmpInstObj_compare NULL
@@ -329,14 +322,31 @@ PyTypeObject ComponentInstance_Type = {
/* methods */
(destructor) CmpInstObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) CmpInstObj_getattr, /*tp_getattr*/
- (setattrfunc) CmpInstObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) CmpInstObj_compare, /*tp_compare*/
(reprfunc) CmpInstObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) CmpInstObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ CmpInstObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ CmpInstObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* --------------- End object type ComponentInstance ---------------- */
@@ -701,14 +711,7 @@ static PyMethodDef CmpObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain CmpObj_chain = { CmpObj_methods, NULL };
-
-static PyObject *CmpObj_getattr(ComponentObject *self, char *name)
-{
- return Py_FindMethodInChain(&CmpObj_chain, (PyObject *)self, name);
-}
-
-#define CmpObj_setattr NULL
+#define CmpObj_getsetlist NULL
#define CmpObj_compare NULL
@@ -725,14 +728,31 @@ PyTypeObject Component_Type = {
/* methods */
(destructor) CmpObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) CmpObj_getattr, /*tp_getattr*/
- (setattrfunc) CmpObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) CmpObj_compare, /*tp_compare*/
(reprfunc) CmpObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) CmpObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ CmpObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ CmpObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* ------------------- End object type Component -------------------- */
diff --git a/Mac/Modules/cm/cmsupport.py b/Mac/Modules/cm/cmsupport.py
index 0cf7fa118a..ee6c3426bc 100644
--- a/Mac/Modules/cm/cmsupport.py
+++ b/Mac/Modules/cm/cmsupport.py
@@ -79,14 +79,14 @@ ComponentResult = Type("ComponentResult", "l")
ComponentResourceHandle = OpaqueByValueType("ComponentResourceHandle", "ResObj")
-class MyCIObjectDefinition(GlobalObjectDefinition):
+class MyCIObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Cm_Error,"NULL ComponentInstance");
return NULL;
}""")
-class MyCObjectDefinition(GlobalObjectDefinition):
+class MyCObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
/* XXXX Or should we return None? */
diff --git a/Mac/Modules/ctl/_Ctlmodule.c b/Mac/Modules/ctl/_Ctlmodule.c
index 0f88370236..aa0af9e0fb 100644
--- a/Mac/Modules/ctl/_Ctlmodule.c
+++ b/Mac/Modules/ctl/_Ctlmodule.c
@@ -4543,14 +4543,7 @@ static PyMethodDef CtlObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain CtlObj_chain = { CtlObj_methods, NULL };
-
-static PyObject *CtlObj_getattr(ControlObject *self, char *name)
-{
- return Py_FindMethodInChain(&CtlObj_chain, (PyObject *)self, name);
-}
-
-#define CtlObj_setattr NULL
+#define CtlObj_getsetlist NULL
static int CtlObj_compare(ControlObject *self, ControlObject *other)
{
@@ -4587,14 +4580,31 @@ PyTypeObject Control_Type = {
/* methods */
(destructor) CtlObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) CtlObj_getattr, /*tp_getattr*/
- (setattrfunc) CtlObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) CtlObj_compare, /*tp_compare*/
(reprfunc) CtlObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) CtlObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ CtlObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ CtlObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* -------------------- End object type Control --------------------- */
diff --git a/Mac/Modules/ctl/ctlsupport.py b/Mac/Modules/ctl/ctlsupport.py
index bf3c91d8ba..6053f9316c 100644
--- a/Mac/Modules/ctl/ctlsupport.py
+++ b/Mac/Modules/ctl/ctlsupport.py
@@ -490,7 +490,7 @@ PyMac_INIT_TOOLBOX_OBJECT_NEW(ControlHandle, CtlObj_New);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ControlHandle, CtlObj_Convert);
"""
-class MyObjectDefinition(ObjectIdentityMixin, GlobalObjectDefinition):
+class MyObjectDefinition(PEP252Mixin, ObjectIdentityMixin, GlobalObjectDefinition):
def outputStructMembers(self):
GlobalObjectDefinition.outputStructMembers(self)
Output("PyObject *ob_callbackdict;")
diff --git a/Mac/Modules/dlg/_Dlgmodule.c b/Mac/Modules/dlg/_Dlgmodule.c
index 6651622688..c35d7a649c 100644
--- a/Mac/Modules/dlg/_Dlgmodule.c
+++ b/Mac/Modules/dlg/_Dlgmodule.c
@@ -964,14 +964,7 @@ static PyMethodDef DlgObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain DlgObj_chain = { DlgObj_methods, NULL };
-
-static PyObject *DlgObj_getattr(DialogObject *self, char *name)
-{
- return Py_FindMethodInChain(&DlgObj_chain, (PyObject *)self, name);
-}
-
-#define DlgObj_setattr NULL
+#define DlgObj_getsetlist NULL
static int DlgObj_compare(DialogObject *self, DialogObject *other)
{
@@ -996,14 +989,31 @@ PyTypeObject Dialog_Type = {
/* methods */
(destructor) DlgObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) DlgObj_getattr, /*tp_getattr*/
- (setattrfunc) DlgObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) DlgObj_compare, /*tp_compare*/
(reprfunc) DlgObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) DlgObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ DlgObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ DlgObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* --------------------- End object type Dialog --------------------- */
diff --git a/Mac/Modules/dlg/dlgsupport.py b/Mac/Modules/dlg/dlgsupport.py
index 2146906027..bf40a2c708 100644
--- a/Mac/Modules/dlg/dlgsupport.py
+++ b/Mac/Modules/dlg/dlgsupport.py
@@ -201,7 +201,7 @@ initstuff = initstuff + """
# Define a class which specializes our object definition
-class MyObjectDefinition(GlobalObjectDefinition):
+class MyObjectDefinition(PEP252Mixin, 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:-(
diff --git a/Mac/Modules/drag/_Dragmodule.c b/Mac/Modules/drag/_Dragmodule.c
index 1e1dc8bb3a..b6354f4366 100644
--- a/Mac/Modules/drag/_Dragmodule.c
+++ b/Mac/Modules/drag/_Dragmodule.c
@@ -740,14 +740,7 @@ static PyMethodDef DragObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain DragObj_chain = { DragObj_methods, NULL };
-
-static PyObject *DragObj_getattr(DragObjObject *self, char *name)
-{
- return Py_FindMethodInChain(&DragObj_chain, (PyObject *)self, name);
-}
-
-#define DragObj_setattr NULL
+#define DragObj_getsetlist NULL
#define DragObj_compare NULL
@@ -764,14 +757,31 @@ PyTypeObject DragObj_Type = {
/* methods */
(destructor) DragObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) DragObj_getattr, /*tp_getattr*/
- (setattrfunc) DragObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) DragObj_compare, /*tp_compare*/
(reprfunc) DragObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) DragObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ DragObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ DragObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* -------------------- End object type DragObj --------------------- */
diff --git a/Mac/Modules/drag/dragsupport.py b/Mac/Modules/drag/dragsupport.py
index 1eaa28e0a2..3d2e76fee0 100644
--- a/Mac/Modules/drag/dragsupport.py
+++ b/Mac/Modules/drag/dragsupport.py
@@ -183,7 +183,7 @@ dragglue_DrawingUPP = NewDragDrawingUPP(dragglue_Drawing);
#endif
"""
-class MyObjectDefinition(GlobalObjectDefinition):
+class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Drag_Error,"Cannot create null Drag");
diff --git a/Mac/Modules/evt/evtsupport.py b/Mac/Modules/evt/evtsupport.py
index c05a3ed200..7dd7258a8f 100644
--- a/Mac/Modules/evt/evtsupport.py
+++ b/Mac/Modules/evt/evtsupport.py
@@ -43,25 +43,10 @@ includestuff = includestuff + """
"""
-class MyObjectDefinition(GlobalObjectDefinition):
- def outputCheckNewArg(self):
- Output("if (itself == NULL) return PyMac_Error(resNotFound);")
- def outputCheckConvertArg(self):
- OutLbrace("if (DlgObj_Check(v))")
- Output("*p_itself = ((WindowObject *)v)->ob_itself;")
- Output("return 1;")
- OutRbrace()
- Out("""
- if (v == Py_None) { *p_itself = NULL; return 1; }
- if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
- """)
-
# From here on it's basically all boiler plate...
# Create the generator groups and link them
module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
-##object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
-##module.addobject(object)
# Create the generator classes used to populate the lists
Function = OSErrWeakLinkFunctionGenerator
@@ -69,7 +54,6 @@ Function = OSErrWeakLinkFunctionGenerator
# Create and populate the lists
functions = []
-##methods = []
execfile(INPUTFILE)
# Move TickCount here, for convenience
@@ -80,7 +64,6 @@ functions.append(f)
# add the populated lists to the generator groups
# (in a different wordl the scan program would generate this)
for f in functions: module.add(f)
-##for f in methods: object.add(f)
WaitNextEvent_body = """
Boolean _rv;
diff --git a/Mac/Modules/help/helpsupport.py b/Mac/Modules/help/helpsupport.py
index 34b687198a..b59fe225cd 100644
--- a/Mac/Modules/help/helpsupport.py
+++ b/Mac/Modules/help/helpsupport.py
@@ -46,7 +46,7 @@ includestuff = includestuff + """
#endif
"""
-class MyObjectDefinition(GlobalObjectDefinition):
+class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
def outputCheckConvertArg(self):
diff --git a/Mac/Modules/ibcarbon/IBCarbonsupport.py b/Mac/Modules/ibcarbon/IBCarbonsupport.py
index a7bd3e910e..f948c53dd9 100644
--- a/Mac/Modules/ibcarbon/IBCarbonsupport.py
+++ b/Mac/Modules/ibcarbon/IBCarbonsupport.py
@@ -31,11 +31,11 @@ initstuff = """
module = MacModule('_IBCarbon', 'IBCarbon', includestuff, finalstuff, initstuff)
-class CFReleaserObject(GlobalObjectDefinition):
+class CFReleaserObject(PEP252Mixin, GlobalObjectDefinition):
def outputFreeIt(self, name):
Output("CFRelease(%s);" % name)
-class CFNibDesc(GlobalObjectDefinition):
+class CFNibDesc(PEP252Mixin, GlobalObjectDefinition):
def outputFreeIt(self, name):
Output("DisposeNibReference(%s);" % name)
diff --git a/Mac/Modules/ibcarbon/_IBCarbon.c b/Mac/Modules/ibcarbon/_IBCarbon.c
index fdddd849fb..eb9b4c9e7b 100644
--- a/Mac/Modules/ibcarbon/_IBCarbon.c
+++ b/Mac/Modules/ibcarbon/_IBCarbon.c
@@ -140,14 +140,7 @@ static PyMethodDef IBNibRefObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain IBNibRefObj_chain = { IBNibRefObj_methods, NULL };
-
-static PyObject *IBNibRefObj_getattr(IBNibRefObject *self, char *name)
-{
- return Py_FindMethodInChain(&IBNibRefObj_chain, (PyObject *)self, name);
-}
-
-#define IBNibRefObj_setattr NULL
+#define IBNibRefObj_getsetlist NULL
#define IBNibRefObj_compare NULL
@@ -164,14 +157,31 @@ PyTypeObject IBNibRef_Type = {
/* methods */
(destructor) IBNibRefObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) IBNibRefObj_getattr, /*tp_getattr*/
- (setattrfunc) IBNibRefObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) IBNibRefObj_compare, /*tp_compare*/
(reprfunc) IBNibRefObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) IBNibRefObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ IBNibRefObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ IBNibRefObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* -------------------- End object type IBNibRef -------------------- */
diff --git a/Mac/Modules/icn/icnsupport.py b/Mac/Modules/icn/icnsupport.py
index 242428e581..5d71bab30f 100644
--- a/Mac/Modules/icn/icnsupport.py
+++ b/Mac/Modules/icn/icnsupport.py
@@ -54,7 +54,7 @@ includestuff = includestuff + """
"""
-class MyObjectDefinition(GlobalObjectDefinition):
+class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
def outputCheckConvertArg(self):
diff --git a/Mac/Modules/list/_Listmodule.c b/Mac/Modules/list/_Listmodule.c
index 99805b6b6b..559f543610 100644
--- a/Mac/Modules/list/_Listmodule.c
+++ b/Mac/Modules/list/_Listmodule.c
@@ -542,6 +542,138 @@ static PyObject *ListObj_LGetCellDataLocation(ListObject *_self, PyObject *_args
return _res;
}
+static PyObject *ListObj_GetListPort(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListPort(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListVerticalScrollBar(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListVerticalScrollBar(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListHorizontalScrollBar(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListHorizontalScrollBar(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListActive(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListActive(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListClickTime(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListClickTime(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListRefCon(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListRefCon(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListDefinition(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListDefinition(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListUserHandle(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListUserHandle(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListDataHandle(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DataHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListDataHandle(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListFlags(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OptionBits _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListFlags(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListSelectionFlags(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OptionBits _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListSelectionFlags(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
static PyObject *ListObj_as_Resource(ListObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -601,48 +733,73 @@ static PyMethodDef ListObj_methods[] = {
PyDoc_STR("(Point theCell) -> None")},
{"LGetCellDataLocation", (PyCFunction)ListObj_LGetCellDataLocation, 1,
PyDoc_STR("(Point theCell) -> (short offset, short len)")},
+ {"GetListPort", (PyCFunction)ListObj_GetListPort, 1,
+ PyDoc_STR("() -> (CGrafPtr _rv)")},
+ {"GetListVerticalScrollBar", (PyCFunction)ListObj_GetListVerticalScrollBar, 1,
+ PyDoc_STR("() -> (ControlHandle _rv)")},
+ {"GetListHorizontalScrollBar", (PyCFunction)ListObj_GetListHorizontalScrollBar, 1,
+ PyDoc_STR("() -> (ControlHandle _rv)")},
+ {"GetListActive", (PyCFunction)ListObj_GetListActive, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"GetListClickTime", (PyCFunction)ListObj_GetListClickTime, 1,
+ PyDoc_STR("() -> (SInt32 _rv)")},
+ {"GetListRefCon", (PyCFunction)ListObj_GetListRefCon, 1,
+ PyDoc_STR("() -> (SInt32 _rv)")},
+ {"GetListDefinition", (PyCFunction)ListObj_GetListDefinition, 1,
+ PyDoc_STR("() -> (Handle _rv)")},
+ {"GetListUserHandle", (PyCFunction)ListObj_GetListUserHandle, 1,
+ PyDoc_STR("() -> (Handle _rv)")},
+ {"GetListDataHandle", (PyCFunction)ListObj_GetListDataHandle, 1,
+ PyDoc_STR("() -> (DataHandle _rv)")},
+ {"GetListFlags", (PyCFunction)ListObj_GetListFlags, 1,
+ PyDoc_STR("() -> (OptionBits _rv)")},
+ {"GetListSelectionFlags", (PyCFunction)ListObj_GetListSelectionFlags, 1,
+ PyDoc_STR("() -> (OptionBits _rv)")},
{"as_Resource", (PyCFunction)ListObj_as_Resource, 1,
PyDoc_STR("() -> (Handle _rv)")},
{NULL, NULL, 0}
};
-PyMethodChain ListObj_chain = { ListObj_methods, NULL };
+static PyObject *ListObj_get_listFlags(ListObject *self, void *closure)
+{
+ return Py_BuildValue("l", (long)GetListFlags(self->ob_itself) & 0xff);
+}
-static PyObject *ListObj_getattr(ListObject *self, char *name)
+static int ListObj_set_listFlags(ListObject *self, PyObject *v, void *closure)
{
- {
- if ( strcmp(name, "listFlags") == 0 )
- return Py_BuildValue("l", (long)GetListFlags(self->ob_itself) & 0xff);
- if ( strcmp(name, "selFlags") == 0 )
- return Py_BuildValue("l", (long)GetListSelectionFlags(self->ob_itself) & 0xff);
- if ( strcmp(name, "cellSize") == 0 )
- return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->cellSize);
- }
- return Py_FindMethodInChain(&ListObj_chain, (PyObject *)self, name);
+ if (!PyArg_Parse(v, "B", &(*self->ob_itself)->listFlags)) return -1;
+ return 0;
}
-static int
-ListObj_setattr(ListObject *self, char *name, PyObject *value)
+static PyObject *ListObj_get_selFlags(ListObject *self, void *closure)
{
- long intval;
- int err = 0;
-
- if ( value == NULL ) {
- PyErr_SetString(PyExc_AttributeError, "Cannot delete attribute");
- return -1;
- }
- if (strcmp(name, "listFlags") == 0 )
- err = PyArg_Parse(value, "B", &(*self->ob_itself)->listFlags);
- else if (strcmp(name, "selFlags") == 0 )
- err = PyArg_Parse(value, "B", &(*self->ob_itself)->selFlags);
- else if (strcmp(name, "cellSize") == 0 )
- err = PyArg_Parse(value, "O&", PyMac_GetPoint, &(*self->ob_itself)->cellSize);
- else
- PyErr_SetString(PyExc_AttributeError, "No such attribute");
- if (err) return 0;
- else return -1;
+ return Py_BuildValue("l", (long)GetListSelectionFlags(self->ob_itself) & 0xff);
+}
+
+static int ListObj_set_selFlags(ListObject *self, PyObject *v, void *closure)
+{
+ if (!PyArg_Parse(v, "B", &(*self->ob_itself)->selFlags)) return -1;
+ return 0;
+}
+
+static PyObject *ListObj_get_cellSize(ListObject *self, void *closure)
+{
+ return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->cellSize);
+}
+
+static int ListObj_set_cellSize(ListObject *self, PyObject *v, void *closure)
+{
+ if (!PyArg_Parse(v, "O&", PyMac_GetPoint, &(*self->ob_itself)->cellSize)) return -1;
+ return 0;
}
+static PyGetSetDef ListObj_getsetlist[] = {
+ {"listFlags", (getter)ListObj_get_listFlags, (setter)ListObj_set_listFlags, NULL},
+ {"selFlags", (getter)ListObj_get_selFlags, (setter)ListObj_set_selFlags, NULL},
+ {"cellSize", (getter)ListObj_get_cellSize, (setter)ListObj_set_cellSize, NULL},
+ {NULL, NULL, NULL, NULL},
+};
+
#define ListObj_compare NULL
@@ -659,14 +816,31 @@ PyTypeObject List_Type = {
/* methods */
(destructor) ListObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) ListObj_getattr, /*tp_getattr*/
- (setattrfunc) ListObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) ListObj_compare, /*tp_compare*/
(reprfunc) ListObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) ListObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ ListObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ ListObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* ---------------------- End object type List ---------------------- */
@@ -783,160 +957,6 @@ static PyObject *List_LNew(PyObject *_self, PyObject *_args)
return _res;
}
-static PyObject *List_GetListPort(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr _rv;
- ListHandle list;
- if (!PyArg_ParseTuple(_args, "O&",
- ListObj_Convert, &list))
- return NULL;
- _rv = GetListPort(list);
- _res = Py_BuildValue("O&",
- GrafObj_New, _rv);
- return _res;
-}
-
-static PyObject *List_GetListVerticalScrollBar(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- ControlHandle _rv;
- ListHandle list;
- if (!PyArg_ParseTuple(_args, "O&",
- ListObj_Convert, &list))
- return NULL;
- _rv = GetListVerticalScrollBar(list);
- _res = Py_BuildValue("O&",
- CtlObj_New, _rv);
- return _res;
-}
-
-static PyObject *List_GetListHorizontalScrollBar(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- ControlHandle _rv;
- ListHandle list;
- if (!PyArg_ParseTuple(_args, "O&",
- ListObj_Convert, &list))
- return NULL;
- _rv = GetListHorizontalScrollBar(list);
- _res = Py_BuildValue("O&",
- CtlObj_New, _rv);
- return _res;
-}
-
-static PyObject *List_GetListActive(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- ListHandle list;
- if (!PyArg_ParseTuple(_args, "O&",
- ListObj_Convert, &list))
- return NULL;
- _rv = GetListActive(list);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-
-static PyObject *List_GetListClickTime(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 _rv;
- ListHandle list;
- if (!PyArg_ParseTuple(_args, "O&",
- ListObj_Convert, &list))
- return NULL;
- _rv = GetListClickTime(list);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
-}
-
-static PyObject *List_GetListRefCon(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 _rv;
- ListHandle list;
- if (!PyArg_ParseTuple(_args, "O&",
- ListObj_Convert, &list))
- return NULL;
- _rv = GetListRefCon(list);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
-}
-
-static PyObject *List_GetListDefinition(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Handle _rv;
- ListHandle list;
- if (!PyArg_ParseTuple(_args, "O&",
- ListObj_Convert, &list))
- return NULL;
- _rv = GetListDefinition(list);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
- return _res;
-}
-
-static PyObject *List_GetListUserHandle(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Handle _rv;
- ListHandle list;
- if (!PyArg_ParseTuple(_args, "O&",
- ListObj_Convert, &list))
- return NULL;
- _rv = GetListUserHandle(list);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
- return _res;
-}
-
-static PyObject *List_GetListDataHandle(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- DataHandle _rv;
- ListHandle list;
- if (!PyArg_ParseTuple(_args, "O&",
- ListObj_Convert, &list))
- return NULL;
- _rv = GetListDataHandle(list);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
- return _res;
-}
-
-static PyObject *List_GetListFlags(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OptionBits _rv;
- ListHandle list;
- if (!PyArg_ParseTuple(_args, "O&",
- ListObj_Convert, &list))
- return NULL;
- _rv = GetListFlags(list);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
-}
-
-static PyObject *List_GetListSelectionFlags(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OptionBits _rv;
- ListHandle list;
- if (!PyArg_ParseTuple(_args, "O&",
- ListObj_Convert, &list))
- return NULL;
- _rv = GetListSelectionFlags(list);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
-}
-
static PyObject *List_SetListViewBounds(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1085,28 +1105,6 @@ static PyMethodDef List_methods[] = {
PyDoc_STR("(Rect rView, Rect dataBounds, Point cellSize, ListDefSpec theSpec, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle outList)")},
{"LNew", (PyCFunction)List_LNew, 1,
PyDoc_STR("(Rect rView, Rect dataBounds, Point cSize, short theProc, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle _rv)")},
- {"GetListPort", (PyCFunction)List_GetListPort, 1,
- PyDoc_STR("(ListHandle list) -> (CGrafPtr _rv)")},
- {"GetListVerticalScrollBar", (PyCFunction)List_GetListVerticalScrollBar, 1,
- PyDoc_STR("(ListHandle list) -> (ControlHandle _rv)")},
- {"GetListHorizontalScrollBar", (PyCFunction)List_GetListHorizontalScrollBar, 1,
- PyDoc_STR("(ListHandle list) -> (ControlHandle _rv)")},
- {"GetListActive", (PyCFunction)List_GetListActive, 1,
- PyDoc_STR("(ListHandle list) -> (Boolean _rv)")},
- {"GetListClickTime", (PyCFunction)List_GetListClickTime, 1,
- PyDoc_STR("(ListHandle list) -> (SInt32 _rv)")},
- {"GetListRefCon", (PyCFunction)List_GetListRefCon, 1,
- PyDoc_STR("(ListHandle list) -> (SInt32 _rv)")},
- {"GetListDefinition", (PyCFunction)List_GetListDefinition, 1,
- PyDoc_STR("(ListHandle list) -> (Handle _rv)")},
- {"GetListUserHandle", (PyCFunction)List_GetListUserHandle, 1,
- PyDoc_STR("(ListHandle list) -> (Handle _rv)")},
- {"GetListDataHandle", (PyCFunction)List_GetListDataHandle, 1,
- PyDoc_STR("(ListHandle list) -> (DataHandle _rv)")},
- {"GetListFlags", (PyCFunction)List_GetListFlags, 1,
- PyDoc_STR("(ListHandle list) -> (OptionBits _rv)")},
- {"GetListSelectionFlags", (PyCFunction)List_GetListSelectionFlags, 1,
- PyDoc_STR("(ListHandle list) -> (OptionBits _rv)")},
{"SetListViewBounds", (PyCFunction)List_SetListViewBounds, 1,
PyDoc_STR("(ListHandle list, Rect view) -> None")},
{"SetListPort", (PyCFunction)List_SetListPort, 1,
diff --git a/Mac/Modules/list/listscan.py b/Mac/Modules/list/listscan.py
index d835a688be..66cb2adf5d 100644
--- a/Mac/Modules/list/listscan.py
+++ b/Mac/Modules/list/listscan.py
@@ -31,7 +31,7 @@ class MyScanner(Scanner):
if arglist:
t, n, m = arglist[-1]
# This is non-functional today
- if t == OBJECT and m == "InMode":
+ if t in ('ListHandle', 'ListRef') and m == "InMode":
classname = "Method"
listname = "methods"
return classname, listname
diff --git a/Mac/Modules/list/listsupport.py b/Mac/Modules/list/listsupport.py
index 23a2a840b1..87ed702e50 100644
--- a/Mac/Modules/list/listsupport.py
+++ b/Mac/Modules/list/listsupport.py
@@ -137,41 +137,23 @@ class ListMethodGenerator(MethodGenerator):
FunctionGenerator.parseArgumentList(self, args)
self.argumentList.append(self.itself)
-getattrHookCode = """{
- if ( strcmp(name, "listFlags") == 0 )
- return Py_BuildValue("l", (long)GetListFlags(self->ob_itself) & 0xff);
- if ( strcmp(name, "selFlags") == 0 )
- return Py_BuildValue("l", (long)GetListSelectionFlags(self->ob_itself) & 0xff);
- if ( strcmp(name, "cellSize") == 0 )
- return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->cellSize);
-}"""
-
-setattrCode = """
-static int
-ListObj_setattr(ListObject *self, char *name, PyObject *value)
-{
- long intval;
- int err = 0;
-
- if ( value == NULL ) {
- PyErr_SetString(PyExc_AttributeError, "Cannot delete attribute");
- return -1;
- }
- if (strcmp(name, "listFlags") == 0 )
- err = PyArg_Parse(value, "B", &(*self->ob_itself)->listFlags);
- else if (strcmp(name, "selFlags") == 0 )
- err = PyArg_Parse(value, "B", &(*self->ob_itself)->selFlags);
- else if (strcmp(name, "cellSize") == 0 )
- err = PyArg_Parse(value, "O&", PyMac_GetPoint, &(*self->ob_itself)->cellSize);
- else
- PyErr_SetString(PyExc_AttributeError, "No such attribute");
- if (err) return 0;
- else return -1;
-}
-"""
-
-
-class MyObjectDefinition(GlobalObjectDefinition):
+class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+ getsetlist = [(
+ 'listFlags',
+ 'return Py_BuildValue("l", (long)GetListFlags(self->ob_itself) & 0xff);',
+ 'if (!PyArg_Parse(v, "B", &(*self->ob_itself)->listFlags)) return -1;',
+ None,
+ ), (
+ 'selFlags',
+ 'return Py_BuildValue("l", (long)GetListSelectionFlags(self->ob_itself) & 0xff);',
+ 'if (!PyArg_Parse(v, "B", &(*self->ob_itself)->selFlags)) return -1;',
+ None,
+ ), (
+ 'cellSize',
+ 'return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->cellSize);',
+ 'if (!PyArg_Parse(v, "O&", PyMac_GetPoint, &(*self->ob_itself)->cellSize)) return -1;',
+ None
+ )]
def outputStructMembers(self):
ObjectDefinition.outputStructMembers(self)
@@ -201,12 +183,6 @@ class MyObjectDefinition(GlobalObjectDefinition):
Output("SetListRefCon(self->ob_itself, (long)0);")
Output("if (self->ob_must_be_disposed && %s) LDispose(%s);", itselfname, itselfname)
- def outputGetattrHook(self):
- Output(getattrHookCode)
-
- def outputSetattr(self):
- Output(setattrCode)
-
# From here on it's basically all boiler plate...
finalstuff = finalstuff + """
diff --git a/Mac/Modules/menu/_Menumodule.c b/Mac/Modules/menu/_Menumodule.c
index bf860fe483..517e08a658 100644
--- a/Mac/Modules/menu/_Menumodule.c
+++ b/Mac/Modules/menu/_Menumodule.c
@@ -3000,14 +3000,7 @@ static PyMethodDef MenuObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain MenuObj_chain = { MenuObj_methods, NULL };
-
-static PyObject *MenuObj_getattr(MenuObject *self, char *name)
-{
- return Py_FindMethodInChain(&MenuObj_chain, (PyObject *)self, name);
-}
-
-#define MenuObj_setattr NULL
+#define MenuObj_getsetlist NULL
#define MenuObj_compare NULL
@@ -3024,14 +3017,31 @@ PyTypeObject Menu_Type = {
/* methods */
(destructor) MenuObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) MenuObj_getattr, /*tp_getattr*/
- (setattrfunc) MenuObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) MenuObj_compare, /*tp_compare*/
(reprfunc) MenuObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) MenuObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ MenuObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ MenuObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* ---------------------- End object type Menu ---------------------- */
diff --git a/Mac/Modules/menu/menusupport.py b/Mac/Modules/menu/menusupport.py
index b96bc21f2f..1f218265cd 100644
--- a/Mac/Modules/menu/menusupport.py
+++ b/Mac/Modules/menu/menusupport.py
@@ -98,7 +98,7 @@ initstuff = initstuff + """
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle, MenuObj_Convert);
"""
-class MyObjectDefinition(GlobalObjectDefinition):
+class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
pass
# Create the generator groups and link them
diff --git a/Mac/Modules/mlte/_Mltemodule.c b/Mac/Modules/mlte/_Mltemodule.c
index 38cb4f210a..84b61303c2 100644
--- a/Mac/Modules/mlte/_Mltemodule.c
+++ b/Mac/Modules/mlte/_Mltemodule.c
@@ -1295,14 +1295,7 @@ static PyMethodDef TXNObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain TXNObj_chain = { TXNObj_methods, NULL };
-
-static PyObject *TXNObj_getattr(TXNObjectObject *self, char *name)
-{
- return Py_FindMethodInChain(&TXNObj_chain, (PyObject *)self, name);
-}
-
-#define TXNObj_setattr NULL
+#define TXNObj_getsetlist NULL
#define TXNObj_compare NULL
@@ -1319,14 +1312,31 @@ PyTypeObject TXNObject_Type = {
/* methods */
(destructor) TXNObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) TXNObj_getattr, /*tp_getattr*/
- (setattrfunc) TXNObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) TXNObj_compare, /*tp_compare*/
(reprfunc) TXNObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) TXNObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ TXNObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ TXNObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* ------------------- End object type TXNObject -------------------- */
@@ -1411,14 +1421,7 @@ static PyMethodDef TXNFontMenuObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain TXNFontMenuObj_chain = { TXNFontMenuObj_methods, NULL };
-
-static PyObject *TXNFontMenuObj_getattr(TXNFontMenuObjectObject *self, char *name)
-{
- return Py_FindMethodInChain(&TXNFontMenuObj_chain, (PyObject *)self, name);
-}
-
-#define TXNFontMenuObj_setattr NULL
+#define TXNFontMenuObj_getsetlist NULL
#define TXNFontMenuObj_compare NULL
@@ -1435,14 +1438,31 @@ PyTypeObject TXNFontMenuObject_Type = {
/* methods */
(destructor) TXNFontMenuObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) TXNFontMenuObj_getattr, /*tp_getattr*/
- (setattrfunc) TXNFontMenuObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) TXNFontMenuObj_compare, /*tp_compare*/
(reprfunc) TXNFontMenuObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) TXNFontMenuObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ TXNFontMenuObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ TXNFontMenuObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* --------------- End object type TXNFontMenuObject ---------------- */
diff --git a/Mac/Modules/mlte/mltesupport.py b/Mac/Modules/mlte/mltesupport.py
index a238145ec2..e9df43fbbe 100644
--- a/Mac/Modules/mlte/mltesupport.py
+++ b/Mac/Modules/mlte/mltesupport.py
@@ -136,11 +136,11 @@ execfile("mltetypetest.py")
# Our (opaque) objects
-class TXNObjDefinition(GlobalObjectDefinition):
+class TXNObjDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
-class TXNFontMenuObjDefinition(GlobalObjectDefinition):
+class TXNFontMenuObjDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
diff --git a/Mac/Modules/qd/_Qdmodule.c b/Mac/Modules/qd/_Qdmodule.c
index 1084031d57..7ee2e981e6 100644
--- a/Mac/Modules/qd/_Qdmodule.c
+++ b/Mac/Modules/qd/_Qdmodule.c
@@ -205,166 +205,910 @@ static void GrafObj_dealloc(GrafPortObject *self)
PyObject_Del(self);
}
+static PyObject *GrafObj_MacSetPort(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef MacSetPort
+ PyMac_PRECHECK(MacSetPort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ MacSetPort(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *GrafObj_IsValidPort(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsValidPort
+ PyMac_PRECHECK(IsValidPort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsValidPort(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *GrafObj_GetPortPixMap(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle _rv;
+#ifndef GetPortPixMap
+ PyMac_PRECHECK(GetPortPixMap);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortPixMap(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortBitMapForCopyBits(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ const BitMap * _rv;
+#ifndef GetPortBitMapForCopyBits
+ PyMac_PRECHECK(GetPortBitMapForCopyBits);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortBitMapForCopyBits(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ BMObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortBounds(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect rect;
+#ifndef GetPortBounds
+ PyMac_PRECHECK(GetPortBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPortBounds(_self->ob_itself,
+ &rect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &rect);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortForeColor(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor foreColor;
+#ifndef GetPortForeColor
+ PyMac_PRECHECK(GetPortForeColor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPortForeColor(_self->ob_itself,
+ &foreColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &foreColor);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortBackColor(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor backColor;
+#ifndef GetPortBackColor
+ PyMac_PRECHECK(GetPortBackColor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPortBackColor(_self->ob_itself,
+ &backColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &backColor);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortOpColor(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor opColor;
+#ifndef GetPortOpColor
+ PyMac_PRECHECK(GetPortOpColor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPortOpColor(_self->ob_itself,
+ &opColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &opColor);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortHiliteColor(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor hiliteColor;
+#ifndef GetPortHiliteColor
+ PyMac_PRECHECK(GetPortHiliteColor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPortHiliteColor(_self->ob_itself,
+ &hiliteColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &hiliteColor);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortTextFont(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetPortTextFont
+ PyMac_PRECHECK(GetPortTextFont);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortTextFont(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortTextFace(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Style _rv;
+#ifndef GetPortTextFace
+ PyMac_PRECHECK(GetPortTextFace);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortTextFace(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortTextMode(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetPortTextMode
+ PyMac_PRECHECK(GetPortTextMode);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortTextMode(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortTextSize(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetPortTextSize
+ PyMac_PRECHECK(GetPortTextSize);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortTextSize(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortChExtra(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetPortChExtra
+ PyMac_PRECHECK(GetPortChExtra);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortChExtra(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortFracHPenLocation(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetPortFracHPenLocation
+ PyMac_PRECHECK(GetPortFracHPenLocation);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortFracHPenLocation(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortSpExtra(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+#ifndef GetPortSpExtra
+ PyMac_PRECHECK(GetPortSpExtra);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortSpExtra(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortPenVisibility(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetPortPenVisibility
+ PyMac_PRECHECK(GetPortPenVisibility);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortPenVisibility(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortVisibleRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ RgnHandle visRgn;
+#ifndef GetPortVisibleRegion
+ PyMac_PRECHECK(GetPortVisibleRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &visRgn))
+ return NULL;
+ _rv = GetPortVisibleRegion(_self->ob_itself,
+ visRgn);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortClipRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ RgnHandle clipRgn;
+#ifndef GetPortClipRegion
+ PyMac_PRECHECK(GetPortClipRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &clipRgn))
+ return NULL;
+ _rv = GetPortClipRegion(_self->ob_itself,
+ clipRgn);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortBackPixPat(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle _rv;
+ PixPatHandle backPattern;
+#ifndef GetPortBackPixPat
+ PyMac_PRECHECK(GetPortBackPixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &backPattern))
+ return NULL;
+ _rv = GetPortBackPixPat(_self->ob_itself,
+ backPattern);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortPenPixPat(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle _rv;
+ PixPatHandle penPattern;
+#ifndef GetPortPenPixPat
+ PyMac_PRECHECK(GetPortPenPixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &penPattern))
+ return NULL;
+ _rv = GetPortPenPixPat(_self->ob_itself,
+ penPattern);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortFillPixPat(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle _rv;
+ PixPatHandle fillPattern;
+#ifndef GetPortFillPixPat
+ PyMac_PRECHECK(GetPortFillPixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &fillPattern))
+ return NULL;
+ _rv = GetPortFillPixPat(_self->ob_itself,
+ fillPattern);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortPenSize(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point penSize;
+#ifndef GetPortPenSize
+ PyMac_PRECHECK(GetPortPenSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &penSize))
+ return NULL;
+ GetPortPenSize(_self->ob_itself,
+ &penSize);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, penSize);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortPenMode(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+#ifndef GetPortPenMode
+ PyMac_PRECHECK(GetPortPenMode);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortPenMode(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortPenLocation(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point penLocation;
+#ifndef GetPortPenLocation
+ PyMac_PRECHECK(GetPortPenLocation);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &penLocation))
+ return NULL;
+ GetPortPenLocation(_self->ob_itself,
+ &penLocation);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, penLocation);
+ return _res;
+}
+
+static PyObject *GrafObj_IsPortRegionBeingDefined(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsPortRegionBeingDefined
+ PyMac_PRECHECK(IsPortRegionBeingDefined);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsPortRegionBeingDefined(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_IsPortPictureBeingDefined(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsPortPictureBeingDefined
+ PyMac_PRECHECK(IsPortPictureBeingDefined);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsPortPictureBeingDefined(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *GrafObj_IsPortPolyBeingDefined(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsPortPolyBeingDefined
+ PyMac_PRECHECK(IsPortPolyBeingDefined);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsPortPolyBeingDefined(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *GrafObj_IsPortOffscreen(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsPortOffscreen
+ PyMac_PRECHECK(IsPortOffscreen);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsPortOffscreen(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *GrafObj_IsPortColor(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsPortColor
+ PyMac_PRECHECK(IsPortColor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsPortColor(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *GrafObj_SetPortBounds(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect rect;
+#ifndef SetPortBounds
+ PyMac_PRECHECK(SetPortBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &rect))
+ return NULL;
+ SetPortBounds(_self->ob_itself,
+ &rect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortOpColor(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor opColor;
+#ifndef SetPortOpColor
+ PyMac_PRECHECK(SetPortOpColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &opColor))
+ return NULL;
+ SetPortOpColor(_self->ob_itself,
+ &opColor);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortVisibleRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle visRgn;
+#ifndef SetPortVisibleRegion
+ PyMac_PRECHECK(SetPortVisibleRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &visRgn))
+ return NULL;
+ SetPortVisibleRegion(_self->ob_itself,
+ visRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortClipRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle clipRgn;
+#ifndef SetPortClipRegion
+ PyMac_PRECHECK(SetPortClipRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &clipRgn))
+ return NULL;
+ SetPortClipRegion(_self->ob_itself,
+ clipRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortPenPixPat(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle penPattern;
+#ifndef SetPortPenPixPat
+ PyMac_PRECHECK(SetPortPenPixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &penPattern))
+ return NULL;
+ SetPortPenPixPat(_self->ob_itself,
+ penPattern);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortFillPixPat(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle penPattern;
+#ifndef SetPortFillPixPat
+ PyMac_PRECHECK(SetPortFillPixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &penPattern))
+ return NULL;
+ SetPortFillPixPat(_self->ob_itself,
+ penPattern);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortBackPixPat(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle backPattern;
+#ifndef SetPortBackPixPat
+ PyMac_PRECHECK(SetPortBackPixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &backPattern))
+ return NULL;
+ SetPortBackPixPat(_self->ob_itself,
+ backPattern);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortPenSize(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point penSize;
+#ifndef SetPortPenSize
+ PyMac_PRECHECK(SetPortPenSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &penSize))
+ return NULL;
+ SetPortPenSize(_self->ob_itself,
+ penSize);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortPenMode(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 penMode;
+#ifndef SetPortPenMode
+ PyMac_PRECHECK(SetPortPenMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &penMode))
+ return NULL;
+ SetPortPenMode(_self->ob_itself,
+ penMode);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortFracHPenLocation(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short pnLocHFrac;
+#ifndef SetPortFracHPenLocation
+ PyMac_PRECHECK(SetPortFracHPenLocation);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &pnLocHFrac))
+ return NULL;
+ SetPortFracHPenLocation(_self->ob_itself,
+ pnLocHFrac);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *GrafObj_DisposePort(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef DisposePort
+ PyMac_PRECHECK(DisposePort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DisposePort(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *GrafObj_QDIsPortBuffered(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef QDIsPortBuffered
+ PyMac_PRECHECK(QDIsPortBuffered);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = QDIsPortBuffered(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_QDIsPortBufferDirty(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef QDIsPortBufferDirty
+ PyMac_PRECHECK(QDIsPortBufferDirty);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = QDIsPortBufferDirty(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_QDFlushPortBuffer(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle region;
+#ifndef QDFlushPortBuffer
+ PyMac_PRECHECK(QDFlushPortBuffer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ OptResObj_Convert, &region))
+ return NULL;
+ QDFlushPortBuffer(_self->ob_itself,
+ region);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *GrafObj_QDGetDirtyRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ RgnHandle rgn;
+#ifndef QDGetDirtyRegion
+ PyMac_PRECHECK(QDGetDirtyRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ _err = QDGetDirtyRegion(_self->ob_itself,
+ rgn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *GrafObj_QDSetDirtyRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ RgnHandle rgn;
+#ifndef QDSetDirtyRegion
+ PyMac_PRECHECK(QDSetDirtyRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ _err = QDSetDirtyRegion(_self->ob_itself,
+ rgn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
static PyMethodDef GrafObj_methods[] = {
+ {"MacSetPort", (PyCFunction)GrafObj_MacSetPort, 1,
+ PyDoc_STR("() -> None")},
+
+#if TARGET_API_MAC_CARBON
+ {"IsValidPort", (PyCFunction)GrafObj_IsValidPort, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+#endif
+ {"GetPortPixMap", (PyCFunction)GrafObj_GetPortPixMap, 1,
+ PyDoc_STR("() -> (PixMapHandle _rv)")},
+ {"GetPortBitMapForCopyBits", (PyCFunction)GrafObj_GetPortBitMapForCopyBits, 1,
+ PyDoc_STR("() -> (const BitMap * _rv)")},
+ {"GetPortBounds", (PyCFunction)GrafObj_GetPortBounds, 1,
+ PyDoc_STR("() -> (Rect rect)")},
+ {"GetPortForeColor", (PyCFunction)GrafObj_GetPortForeColor, 1,
+ PyDoc_STR("() -> (RGBColor foreColor)")},
+ {"GetPortBackColor", (PyCFunction)GrafObj_GetPortBackColor, 1,
+ PyDoc_STR("() -> (RGBColor backColor)")},
+ {"GetPortOpColor", (PyCFunction)GrafObj_GetPortOpColor, 1,
+ PyDoc_STR("() -> (RGBColor opColor)")},
+ {"GetPortHiliteColor", (PyCFunction)GrafObj_GetPortHiliteColor, 1,
+ PyDoc_STR("() -> (RGBColor hiliteColor)")},
+ {"GetPortTextFont", (PyCFunction)GrafObj_GetPortTextFont, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortTextFace", (PyCFunction)GrafObj_GetPortTextFace, 1,
+ PyDoc_STR("() -> (Style _rv)")},
+ {"GetPortTextMode", (PyCFunction)GrafObj_GetPortTextMode, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortTextSize", (PyCFunction)GrafObj_GetPortTextSize, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortChExtra", (PyCFunction)GrafObj_GetPortChExtra, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortFracHPenLocation", (PyCFunction)GrafObj_GetPortFracHPenLocation, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortSpExtra", (PyCFunction)GrafObj_GetPortSpExtra, 1,
+ PyDoc_STR("() -> (Fixed _rv)")},
+ {"GetPortPenVisibility", (PyCFunction)GrafObj_GetPortPenVisibility, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortVisibleRegion", (PyCFunction)GrafObj_GetPortVisibleRegion, 1,
+ PyDoc_STR("(RgnHandle visRgn) -> (RgnHandle _rv)")},
+ {"GetPortClipRegion", (PyCFunction)GrafObj_GetPortClipRegion, 1,
+ PyDoc_STR("(RgnHandle clipRgn) -> (RgnHandle _rv)")},
+ {"GetPortBackPixPat", (PyCFunction)GrafObj_GetPortBackPixPat, 1,
+ PyDoc_STR("(PixPatHandle backPattern) -> (PixPatHandle _rv)")},
+ {"GetPortPenPixPat", (PyCFunction)GrafObj_GetPortPenPixPat, 1,
+ PyDoc_STR("(PixPatHandle penPattern) -> (PixPatHandle _rv)")},
+ {"GetPortFillPixPat", (PyCFunction)GrafObj_GetPortFillPixPat, 1,
+ PyDoc_STR("(PixPatHandle fillPattern) -> (PixPatHandle _rv)")},
+ {"GetPortPenSize", (PyCFunction)GrafObj_GetPortPenSize, 1,
+ PyDoc_STR("(Point penSize) -> (Point penSize)")},
+ {"GetPortPenMode", (PyCFunction)GrafObj_GetPortPenMode, 1,
+ PyDoc_STR("() -> (SInt32 _rv)")},
+ {"GetPortPenLocation", (PyCFunction)GrafObj_GetPortPenLocation, 1,
+ PyDoc_STR("(Point penLocation) -> (Point penLocation)")},
+ {"IsPortRegionBeingDefined", (PyCFunction)GrafObj_IsPortRegionBeingDefined, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"IsPortPictureBeingDefined", (PyCFunction)GrafObj_IsPortPictureBeingDefined, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+
+#if TARGET_API_MAC_CARBON
+ {"IsPortPolyBeingDefined", (PyCFunction)GrafObj_IsPortPolyBeingDefined, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"IsPortOffscreen", (PyCFunction)GrafObj_IsPortOffscreen, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"IsPortColor", (PyCFunction)GrafObj_IsPortColor, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+#endif
+ {"SetPortBounds", (PyCFunction)GrafObj_SetPortBounds, 1,
+ PyDoc_STR("(Rect rect) -> None")},
+ {"SetPortOpColor", (PyCFunction)GrafObj_SetPortOpColor, 1,
+ PyDoc_STR("(RGBColor opColor) -> None")},
+ {"SetPortVisibleRegion", (PyCFunction)GrafObj_SetPortVisibleRegion, 1,
+ PyDoc_STR("(RgnHandle visRgn) -> None")},
+ {"SetPortClipRegion", (PyCFunction)GrafObj_SetPortClipRegion, 1,
+ PyDoc_STR("(RgnHandle clipRgn) -> None")},
+ {"SetPortPenPixPat", (PyCFunction)GrafObj_SetPortPenPixPat, 1,
+ PyDoc_STR("(PixPatHandle penPattern) -> None")},
+ {"SetPortFillPixPat", (PyCFunction)GrafObj_SetPortFillPixPat, 1,
+ PyDoc_STR("(PixPatHandle penPattern) -> None")},
+ {"SetPortBackPixPat", (PyCFunction)GrafObj_SetPortBackPixPat, 1,
+ PyDoc_STR("(PixPatHandle backPattern) -> None")},
+ {"SetPortPenSize", (PyCFunction)GrafObj_SetPortPenSize, 1,
+ PyDoc_STR("(Point penSize) -> None")},
+ {"SetPortPenMode", (PyCFunction)GrafObj_SetPortPenMode, 1,
+ PyDoc_STR("(SInt32 penMode) -> None")},
+ {"SetPortFracHPenLocation", (PyCFunction)GrafObj_SetPortFracHPenLocation, 1,
+ PyDoc_STR("(short pnLocHFrac) -> None")},
+
+#if TARGET_API_MAC_CARBON
+ {"DisposePort", (PyCFunction)GrafObj_DisposePort, 1,
+ PyDoc_STR("() -> None")},
+#endif
+ {"QDIsPortBuffered", (PyCFunction)GrafObj_QDIsPortBuffered, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"QDIsPortBufferDirty", (PyCFunction)GrafObj_QDIsPortBufferDirty, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"QDFlushPortBuffer", (PyCFunction)GrafObj_QDFlushPortBuffer, 1,
+ PyDoc_STR("(RgnHandle region) -> None")},
+
+#if TARGET_API_MAC_CARBON
+ {"QDGetDirtyRegion", (PyCFunction)GrafObj_QDGetDirtyRegion, 1,
+ PyDoc_STR("(RgnHandle rgn) -> None")},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"QDSetDirtyRegion", (PyCFunction)GrafObj_QDSetDirtyRegion, 1,
+ PyDoc_STR("(RgnHandle rgn) -> None")},
+#endif
{NULL, NULL, 0}
};
-PyMethodChain GrafObj_chain = { GrafObj_methods, NULL };
-
-static PyObject *GrafObj_getattr(GrafPortObject *self, char *name)
+static PyObject *GrafObj_get_visRgn(GrafPortObject *self, void *closure)
{
-#if !ACCESSOR_CALLS_ARE_FUNCTIONS
+ RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
+ return Py_BuildValue("O&", ResObj_New, (Handle)GetPortVisibleRegion(self->ob_itself, h));
+
+}
+
+#define GrafObj_set_visRgn NULL
- { CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
+static PyObject *GrafObj_get_clipRgn(GrafPortObject *self, void *closure)
+{
+ RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
+ return Py_BuildValue("O&", ResObj_New, (Handle)GetPortClipRegion(self->ob_itself, h));
- if ( strcmp(name, "data") == 0 )
- return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(GrafPort));
-
- if ( (itself_color->portVersion&0xc000) == 0xc000 ) {
- /* Color-only attributes */
-
- if ( strcmp(name, "portBits") == 0 )
- /* XXXX Do we need HLock() stuff here?? */
- return BMObj_New((BitMapPtr)*itself_color->portPixMap);
- if ( strcmp(name, "grafVars") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->visRgn);
- if ( strcmp(name, "chExtra") == 0 )
- return Py_BuildValue("h", itself_color->chExtra);
- if ( strcmp(name, "pnLocHFrac") == 0 )
- return Py_BuildValue("h", itself_color->pnLocHFrac);
- if ( strcmp(name, "bkPixPat") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->bkPixPat);
- if ( strcmp(name, "rgbFgColor") == 0 )
- return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbFgColor);
- if ( strcmp(name, "rgbBkColor") == 0 )
- return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbBkColor);
- if ( strcmp(name, "pnPixPat") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->pnPixPat);
- if ( strcmp(name, "fillPixPat") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->fillPixPat);
- } else {
- /* Mono-only attributes */
- if ( strcmp(name, "portBits") == 0 )
- return BMObj_New(&self->ob_itself->portBits);
- if ( strcmp(name, "bkPat") == 0 )
- return Py_BuildValue("s#", (char *)&self->ob_itself->bkPat, sizeof(Pattern));
- if ( strcmp(name, "fillPat") == 0 )
- return Py_BuildValue("s#", (char *)&self->ob_itself->fillPat, sizeof(Pattern));
- if ( strcmp(name, "pnPat") == 0 )
- return Py_BuildValue("s#", (char *)&self->ob_itself->pnPat, sizeof(Pattern));
- }
- /*
- ** Accessible for both color/mono windows.
- ** portVersion is really color-only, but we put it here
- ** for convenience
- */
- if ( strcmp(name, "portVersion") == 0 )
- return Py_BuildValue("h", itself_color->portVersion);
- if ( strcmp(name, "device") == 0 )
- return PyInt_FromLong((long)self->ob_itself->device);
- if ( strcmp(name, "portRect") == 0 )
- return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->portRect);
- if ( strcmp(name, "visRgn") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->visRgn);
- if ( strcmp(name, "clipRgn") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->clipRgn);
- if ( strcmp(name, "pnLoc") == 0 )
- return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnLoc);
- if ( strcmp(name, "pnSize") == 0 )
- return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnSize);
- if ( strcmp(name, "pnMode") == 0 )
- return Py_BuildValue("h", self->ob_itself->pnMode);
- if ( strcmp(name, "pnVis") == 0 )
- return Py_BuildValue("h", self->ob_itself->pnVis);
- if ( strcmp(name, "txFont") == 0 )
- return Py_BuildValue("h", self->ob_itself->txFont);
- if ( strcmp(name, "txFace") == 0 )
- return Py_BuildValue("h", (short)self->ob_itself->txFace);
- if ( strcmp(name, "txMode") == 0 )
- return Py_BuildValue("h", self->ob_itself->txMode);
- if ( strcmp(name, "txSize") == 0 )
- return Py_BuildValue("h", self->ob_itself->txSize);
- if ( strcmp(name, "spExtra") == 0 )
- return Py_BuildValue("O&", PyMac_BuildFixed, self->ob_itself->spExtra);
- /* XXXX Add more, as needed */
- /* This one is so we can compare grafports: */
- if ( strcmp(name, "_id") == 0 )
- return Py_BuildValue("l", (long)self->ob_itself);
- }
-#else
+}
+
+#define GrafObj_set_clipRgn NULL
+
+static PyGetSetDef GrafObj_getsetlist[] = {
+ {"visRgn", (getter)GrafObj_get_visRgn, (setter)GrafObj_set_visRgn, "Convenience attribute: return a copy of the visible region"},
+ {"clipRgn", (getter)GrafObj_get_clipRgn, (setter)GrafObj_set_clipRgn, "Convenience attribute: return a copy of the clipping region"},
+ {NULL, NULL, NULL, NULL},
+};
- { CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
- if ( strcmp(name, "portBits") == 0 )
- return BMObj_New((BitMapPtr)GetPortBitMapForCopyBits(itself_color));
- if ( strcmp(name, "chExtra") == 0 )
- return Py_BuildValue("h", GetPortChExtra(itself_color));
- if ( strcmp(name, "pnLocHFrac") == 0 )
- return Py_BuildValue("h", GetPortFracHPenLocation(itself_color));
- if ( strcmp(name, "bkPixPat") == 0 ) {
- PixPatHandle h=0;
- return Py_BuildValue("O&", ResObj_New, (Handle)GetPortBackPixPat(itself_color, h));
- }
- if ( strcmp(name, "rgbFgColor") == 0 ) {
- RGBColor c;
- return Py_BuildValue("O&", QdRGB_New, GetPortForeColor(itself_color, &c));
- }
- if ( strcmp(name, "rgbBkColor") == 0 ) {
- RGBColor c;
- return Py_BuildValue("O&", QdRGB_New, GetPortBackColor(itself_color, &c));
- }
- if ( strcmp(name, "pnPixPat") == 0 ) {
- PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */
-
- return Py_BuildValue("O&", ResObj_New, (Handle)GetPortPenPixPat(itself_color, h));
- }
- if ( strcmp(name, "fillPixPat") == 0 ) {
- PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */
- return Py_BuildValue("O&", ResObj_New, (Handle)GetPortFillPixPat(itself_color, h));
- }
- if ( strcmp(name, "portRect") == 0 ) {
- Rect r;
- return Py_BuildValue("O&", PyMac_BuildRect, GetPortBounds(itself_color, &r));
- }
- if ( strcmp(name, "visRgn") == 0 ) {
- RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
- return Py_BuildValue("O&", ResObj_New, (Handle)GetPortVisibleRegion(itself_color, h));
- }
- if ( strcmp(name, "clipRgn") == 0 ) {
- RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
- return Py_BuildValue("O&", ResObj_New, (Handle)GetPortClipRegion(itself_color, h));
- }
- if ( strcmp(name, "pnLoc") == 0 ) {
- Point p;
- return Py_BuildValue("O&", PyMac_BuildPoint, *GetPortPenLocation(itself_color, &p));
- }
- if ( strcmp(name, "pnSize") == 0 ) {
- Point p;
- return Py_BuildValue("O&", PyMac_BuildPoint, *GetPortPenSize(itself_color, &p));
- }
- if ( strcmp(name, "pnMode") == 0 )
- return Py_BuildValue("h", GetPortPenMode(itself_color));
- if ( strcmp(name, "pnVis") == 0 )
- return Py_BuildValue("h", GetPortPenVisibility(itself_color));
- if ( strcmp(name, "txFont") == 0 )
- return Py_BuildValue("h", GetPortTextFont(itself_color));
- if ( strcmp(name, "txFace") == 0 )
- return Py_BuildValue("h", (short)GetPortTextFace(itself_color));
- if ( strcmp(name, "txMode") == 0 )
- return Py_BuildValue("h", GetPortTextMode(itself_color));
- if ( strcmp(name, "txSize") == 0 )
- return Py_BuildValue("h", GetPortTextSize(itself_color));
- if ( strcmp(name, "spExtra") == 0 )
- return Py_BuildValue("O&", PyMac_BuildFixed, GetPortSpExtra(itself_color));
- /* XXXX Add more, as needed */
- /* This one is so we can compare grafports: */
- if ( strcmp(name, "_id") == 0 )
- return Py_BuildValue("l", (long)self->ob_itself);
- }
-#endif
- return Py_FindMethodInChain(&GrafObj_chain, (PyObject *)self, name);
-}
-
-#define GrafObj_setattr NULL
#define GrafObj_compare NULL
@@ -381,14 +1125,31 @@ PyTypeObject GrafPort_Type = {
/* methods */
(destructor) GrafObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) GrafObj_getattr, /*tp_getattr*/
- (setattrfunc) GrafObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) GrafObj_compare, /*tp_compare*/
(reprfunc) GrafObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) GrafObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ GrafObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ GrafObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* -------------------- End object type GrafPort -------------------- */
@@ -476,198 +1237,95 @@ static PyMethodDef BMObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain BMObj_chain = { BMObj_methods, NULL };
-
-static PyObject *BMObj_getattr(BitMapObject *self, char *name)
-{
- if ( strcmp(name, "baseAddr") == 0 )
- return PyInt_FromLong((long)self->ob_itself->baseAddr);
- if ( strcmp(name, "rowBytes") == 0 )
- return PyInt_FromLong((long)self->ob_itself->rowBytes);
- if ( strcmp(name, "bounds") == 0 )
- return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);
- /* XXXX Add more, as needed */
- if ( strcmp(name, "bitmap_data") == 0 )
- return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap));
- if ( strcmp(name, "pixmap_data") == 0 )
- return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap));
-
- return Py_FindMethodInChain(&BMObj_chain, (PyObject *)self, name);
+static PyObject *BMObj_get_baseAddr(BitMapObject *self, void *closure)
+{
+ return PyInt_FromLong((long)self->ob_itself->baseAddr);
}
-#define BMObj_setattr NULL
-
-#define BMObj_compare NULL
-
-#define BMObj_repr NULL
-
-#define BMObj_hash NULL
-
-PyTypeObject BitMap_Type = {
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
- "_Qd.BitMap", /*tp_name*/
- sizeof(BitMapObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- /* methods */
- (destructor) BMObj_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- (getattrfunc) BMObj_getattr, /*tp_getattr*/
- (setattrfunc) BMObj_setattr, /*tp_setattr*/
- (cmpfunc) BMObj_compare, /*tp_compare*/
- (reprfunc) BMObj_repr, /*tp_repr*/
- (PyNumberMethods *)0, /* tp_as_number */
- (PySequenceMethods *)0, /* tp_as_sequence */
- (PyMappingMethods *)0, /* tp_as_mapping */
- (hashfunc) BMObj_hash, /*tp_hash*/
-};
-
-/* --------------------- End object type BitMap --------------------- */
-
+#define BMObj_set_baseAddr NULL
-/* ------------------ Object type QDGlobalsAccess ------------------- */
-
-static PyTypeObject QDGlobalsAccess_Type;
-
-#define QDGA_Check(x) ((x)->ob_type == &QDGlobalsAccess_Type)
+static PyObject *BMObj_get_rowBytes(BitMapObject *self, void *closure)
+{
+ return PyInt_FromLong((long)self->ob_itself->rowBytes);
+}
-typedef struct QDGlobalsAccessObject {
- PyObject_HEAD
-} QDGlobalsAccessObject;
+#define BMObj_set_rowBytes NULL
-static PyObject *QDGA_New(void)
+static PyObject *BMObj_get_bounds(BitMapObject *self, void *closure)
{
- QDGlobalsAccessObject *it;
- it = PyObject_NEW(QDGlobalsAccessObject, &QDGlobalsAccess_Type);
- if (it == NULL) return NULL;
- return (PyObject *)it;
+ return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);
}
-static void QDGA_dealloc(QDGlobalsAccessObject *self)
+#define BMObj_set_bounds NULL
+
+static PyObject *BMObj_get_bitmap_data(BitMapObject *self, void *closure)
{
- PyObject_Del(self);
+ return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap));
}
-static PyMethodDef QDGA_methods[] = {
- {NULL, NULL, 0}
-};
-
-static PyMethodChain QDGA_chain = { QDGA_methods, NULL };
+#define BMObj_set_bitmap_data NULL
-static PyObject *QDGA_getattr(QDGlobalsAccessObject *self, char *name)
+static PyObject *BMObj_get_pixmap_data(BitMapObject *self, void *closure)
{
-#if !ACCESSOR_CALLS_ARE_FUNCTIONS
+ return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap));
+}
- if ( strcmp(name, "arrow") == 0 )
- return PyString_FromStringAndSize((char *)&qd.arrow, sizeof(qd.arrow));
- if ( strcmp(name, "black") == 0 )
- return PyString_FromStringAndSize((char *)&qd.black, sizeof(qd.black));
- if ( strcmp(name, "white") == 0 )
- return PyString_FromStringAndSize((char *)&qd.white, sizeof(qd.white));
- if ( strcmp(name, "gray") == 0 )
- return PyString_FromStringAndSize((char *)&qd.gray, sizeof(qd.gray));
- if ( strcmp(name, "ltGray") == 0 )
- return PyString_FromStringAndSize((char *)&qd.ltGray, sizeof(qd.ltGray));
- if ( strcmp(name, "dkGray") == 0 )
- return PyString_FromStringAndSize((char *)&qd.dkGray, sizeof(qd.dkGray));
- if ( strcmp(name, "screenBits") == 0 )
- return BMObj_New(&qd.screenBits);
- if ( strcmp(name, "thePort") == 0 )
- return GrafObj_New(qd.thePort);
- if ( strcmp(name, "randSeed") == 0 )
- return Py_BuildValue("l", &qd.randSeed);
-
-#else
+#define BMObj_set_pixmap_data NULL
- if ( strcmp(name, "arrow") == 0 ) {
- Cursor rv;
- GetQDGlobalsArrow(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "black") == 0 ) {
- Pattern rv;
- GetQDGlobalsBlack(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "white") == 0 ) {
- Pattern rv;
- GetQDGlobalsWhite(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "gray") == 0 ) {
- Pattern rv;
- GetQDGlobalsGray(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "ltGray") == 0 ) {
- Pattern rv;
- GetQDGlobalsLightGray(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "dkGray") == 0 ) {
- Pattern rv;
- GetQDGlobalsDarkGray(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "screenBits") == 0 ) {
- BitMap rv;
- GetQDGlobalsScreenBits(&rv);
- return BMObj_NewCopied(&rv);
- }
- if ( strcmp(name, "thePort") == 0 )
- return GrafObj_New(GetQDGlobalsThePort());
- if ( strcmp(name, "randSeed") == 0 )
- return Py_BuildValue("l", GetQDGlobalsRandomSeed());
-
-#endif
- return Py_FindMethodInChain(&QDGA_chain, (PyObject *)self, name);
-}
+static PyGetSetDef BMObj_getsetlist[] = {
+ {"baseAddr", (getter)BMObj_get_baseAddr, (setter)BMObj_set_baseAddr, NULL},
+ {"rowBytes", (getter)BMObj_get_rowBytes, (setter)BMObj_set_rowBytes, NULL},
+ {"bounds", (getter)BMObj_get_bounds, (setter)BMObj_set_bounds, NULL},
+ {"bitmap_data", (getter)BMObj_get_bitmap_data, (setter)BMObj_set_bitmap_data, NULL},
+ {"pixmap_data", (getter)BMObj_get_pixmap_data, (setter)BMObj_set_pixmap_data, NULL},
+ {NULL, NULL, NULL, NULL},
+};
-#define QDGA_setattr NULL
-#define QDGA_compare NULL
+#define BMObj_compare NULL
-#define QDGA_repr NULL
+#define BMObj_repr NULL
-#define QDGA_hash NULL
+#define BMObj_hash NULL
-static PyTypeObject QDGlobalsAccess_Type = {
+PyTypeObject BitMap_Type = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "_Qd.QDGlobalsAccess", /*tp_name*/
- sizeof(QDGlobalsAccessObject), /*tp_basicsize*/
+ "_Qd.BitMap", /*tp_name*/
+ sizeof(BitMapObject), /*tp_basicsize*/
0, /*tp_itemsize*/
/* methods */
- (destructor) QDGA_dealloc, /*tp_dealloc*/
+ (destructor) BMObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) QDGA_getattr, /*tp_getattr*/
- (setattrfunc) QDGA_setattr, /*tp_setattr*/
- (cmpfunc) QDGA_compare, /*tp_compare*/
- (reprfunc) QDGA_repr, /*tp_repr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) BMObj_compare, /*tp_compare*/
+ (reprfunc) BMObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
- (hashfunc) QDGA_hash, /*tp_hash*/
+ (hashfunc) BMObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ BMObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ BMObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
-/* ---------------- End object type QDGlobalsAccess ----------------- */
-
+/* --------------------- End object type BitMap --------------------- */
-static PyObject *Qd_MacSetPort(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- GrafPtr port;
-#ifndef MacSetPort
- PyMac_PRECHECK(MacSetPort);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- MacSetPort(port);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
static PyObject *Qd_GetPort(PyObject *_self, PyObject *_args)
{
@@ -4068,725 +4726,6 @@ static PyObject *Qd_AngleFromSlope(PyObject *_self, PyObject *_args)
return _res;
}
-#if TARGET_API_MAC_CARBON
-
-static PyObject *Qd_IsValidPort(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- CGrafPtr port;
-#ifndef IsValidPort
- PyMac_PRECHECK(IsValidPort);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = IsValidPort(port);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-#endif
-
-static PyObject *Qd_GetPortPixMap(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- PixMapHandle _rv;
- CGrafPtr port;
-#ifndef GetPortPixMap
- PyMac_PRECHECK(GetPortPixMap);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = GetPortPixMap(port);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
- return _res;
-}
-
-static PyObject *Qd_GetPortBitMapForCopyBits(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- const BitMap * _rv;
- CGrafPtr port;
-#ifndef GetPortBitMapForCopyBits
- PyMac_PRECHECK(GetPortBitMapForCopyBits);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = GetPortBitMapForCopyBits(port);
- _res = Py_BuildValue("O&",
- BMObj_New, _rv);
- return _res;
-}
-
-static PyObject *Qd_GetPortBounds(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- Rect rect;
-#ifndef GetPortBounds
- PyMac_PRECHECK(GetPortBounds);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- GetPortBounds(port,
- &rect);
- _res = Py_BuildValue("O&",
- PyMac_BuildRect, &rect);
- return _res;
-}
-
-static PyObject *Qd_GetPortForeColor(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- RGBColor foreColor;
-#ifndef GetPortForeColor
- PyMac_PRECHECK(GetPortForeColor);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- GetPortForeColor(port,
- &foreColor);
- _res = Py_BuildValue("O&",
- QdRGB_New, &foreColor);
- return _res;
-}
-
-static PyObject *Qd_GetPortBackColor(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- RGBColor backColor;
-#ifndef GetPortBackColor
- PyMac_PRECHECK(GetPortBackColor);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- GetPortBackColor(port,
- &backColor);
- _res = Py_BuildValue("O&",
- QdRGB_New, &backColor);
- return _res;
-}
-
-static PyObject *Qd_GetPortOpColor(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- RGBColor opColor;
-#ifndef GetPortOpColor
- PyMac_PRECHECK(GetPortOpColor);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- GetPortOpColor(port,
- &opColor);
- _res = Py_BuildValue("O&",
- QdRGB_New, &opColor);
- return _res;
-}
-
-static PyObject *Qd_GetPortHiliteColor(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- RGBColor hiliteColor;
-#ifndef GetPortHiliteColor
- PyMac_PRECHECK(GetPortHiliteColor);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- GetPortHiliteColor(port,
- &hiliteColor);
- _res = Py_BuildValue("O&",
- QdRGB_New, &hiliteColor);
- return _res;
-}
-
-static PyObject *Qd_GetPortTextFont(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- short _rv;
- CGrafPtr port;
-#ifndef GetPortTextFont
- PyMac_PRECHECK(GetPortTextFont);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = GetPortTextFont(port);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
-}
-
-static PyObject *Qd_GetPortTextFace(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Style _rv;
- CGrafPtr port;
-#ifndef GetPortTextFace
- PyMac_PRECHECK(GetPortTextFace);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = GetPortTextFace(port);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-
-static PyObject *Qd_GetPortTextMode(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- short _rv;
- CGrafPtr port;
-#ifndef GetPortTextMode
- PyMac_PRECHECK(GetPortTextMode);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = GetPortTextMode(port);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
-}
-
-static PyObject *Qd_GetPortTextSize(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- short _rv;
- CGrafPtr port;
-#ifndef GetPortTextSize
- PyMac_PRECHECK(GetPortTextSize);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = GetPortTextSize(port);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
-}
-
-static PyObject *Qd_GetPortChExtra(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- short _rv;
- CGrafPtr port;
-#ifndef GetPortChExtra
- PyMac_PRECHECK(GetPortChExtra);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = GetPortChExtra(port);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
-}
-
-static PyObject *Qd_GetPortFracHPenLocation(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- short _rv;
- CGrafPtr port;
-#ifndef GetPortFracHPenLocation
- PyMac_PRECHECK(GetPortFracHPenLocation);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = GetPortFracHPenLocation(port);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
-}
-
-static PyObject *Qd_GetPortSpExtra(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Fixed _rv;
- CGrafPtr port;
-#ifndef GetPortSpExtra
- PyMac_PRECHECK(GetPortSpExtra);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = GetPortSpExtra(port);
- _res = Py_BuildValue("O&",
- PyMac_BuildFixed, _rv);
- return _res;
-}
-
-static PyObject *Qd_GetPortPenVisibility(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- short _rv;
- CGrafPtr port;
-#ifndef GetPortPenVisibility
- PyMac_PRECHECK(GetPortPenVisibility);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = GetPortPenVisibility(port);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
-}
-
-static PyObject *Qd_GetPortVisibleRegion(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- RgnHandle _rv;
- CGrafPtr port;
- RgnHandle visRgn;
-#ifndef GetPortVisibleRegion
- PyMac_PRECHECK(GetPortVisibleRegion);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &visRgn))
- return NULL;
- _rv = GetPortVisibleRegion(port,
- visRgn);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
- return _res;
-}
-
-static PyObject *Qd_GetPortClipRegion(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- RgnHandle _rv;
- CGrafPtr port;
- RgnHandle clipRgn;
-#ifndef GetPortClipRegion
- PyMac_PRECHECK(GetPortClipRegion);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &clipRgn))
- return NULL;
- _rv = GetPortClipRegion(port,
- clipRgn);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
- return _res;
-}
-
-static PyObject *Qd_GetPortBackPixPat(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- PixPatHandle _rv;
- CGrafPtr port;
- PixPatHandle backPattern;
-#ifndef GetPortBackPixPat
- PyMac_PRECHECK(GetPortBackPixPat);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &backPattern))
- return NULL;
- _rv = GetPortBackPixPat(port,
- backPattern);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
- return _res;
-}
-
-static PyObject *Qd_GetPortPenPixPat(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- PixPatHandle _rv;
- CGrafPtr port;
- PixPatHandle penPattern;
-#ifndef GetPortPenPixPat
- PyMac_PRECHECK(GetPortPenPixPat);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &penPattern))
- return NULL;
- _rv = GetPortPenPixPat(port,
- penPattern);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
- return _res;
-}
-
-static PyObject *Qd_GetPortFillPixPat(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- PixPatHandle _rv;
- CGrafPtr port;
- PixPatHandle fillPattern;
-#ifndef GetPortFillPixPat
- PyMac_PRECHECK(GetPortFillPixPat);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &fillPattern))
- return NULL;
- _rv = GetPortFillPixPat(port,
- fillPattern);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
- return _res;
-}
-
-static PyObject *Qd_GetPortPenSize(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- Point penSize;
-#ifndef GetPortPenSize
- PyMac_PRECHECK(GetPortPenSize);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- PyMac_GetPoint, &penSize))
- return NULL;
- GetPortPenSize(port,
- &penSize);
- _res = Py_BuildValue("O&",
- PyMac_BuildPoint, penSize);
- return _res;
-}
-
-static PyObject *Qd_GetPortPenMode(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 _rv;
- CGrafPtr port;
-#ifndef GetPortPenMode
- PyMac_PRECHECK(GetPortPenMode);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = GetPortPenMode(port);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
-}
-
-static PyObject *Qd_GetPortPenLocation(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- Point penLocation;
-#ifndef GetPortPenLocation
- PyMac_PRECHECK(GetPortPenLocation);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- PyMac_GetPoint, &penLocation))
- return NULL;
- GetPortPenLocation(port,
- &penLocation);
- _res = Py_BuildValue("O&",
- PyMac_BuildPoint, penLocation);
- return _res;
-}
-
-static PyObject *Qd_IsPortRegionBeingDefined(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- CGrafPtr port;
-#ifndef IsPortRegionBeingDefined
- PyMac_PRECHECK(IsPortRegionBeingDefined);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = IsPortRegionBeingDefined(port);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-
-static PyObject *Qd_IsPortPictureBeingDefined(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- CGrafPtr port;
-#ifndef IsPortPictureBeingDefined
- PyMac_PRECHECK(IsPortPictureBeingDefined);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = IsPortPictureBeingDefined(port);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-
-#if TARGET_API_MAC_CARBON
-
-static PyObject *Qd_IsPortPolyBeingDefined(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- CGrafPtr port;
-#ifndef IsPortPolyBeingDefined
- PyMac_PRECHECK(IsPortPolyBeingDefined);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = IsPortPolyBeingDefined(port);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-#endif
-
-#if TARGET_API_MAC_CARBON
-
-static PyObject *Qd_IsPortOffscreen(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- CGrafPtr port;
-#ifndef IsPortOffscreen
- PyMac_PRECHECK(IsPortOffscreen);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = IsPortOffscreen(port);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-#endif
-
-#if TARGET_API_MAC_CARBON
-
-static PyObject *Qd_IsPortColor(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- CGrafPtr port;
-#ifndef IsPortColor
- PyMac_PRECHECK(IsPortColor);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = IsPortColor(port);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-#endif
-
-static PyObject *Qd_SetPortBounds(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- Rect rect;
-#ifndef SetPortBounds
- PyMac_PRECHECK(SetPortBounds);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- PyMac_GetRect, &rect))
- return NULL;
- SetPortBounds(port,
- &rect);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *Qd_SetPortOpColor(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- RGBColor opColor;
-#ifndef SetPortOpColor
- PyMac_PRECHECK(SetPortOpColor);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- QdRGB_Convert, &opColor))
- return NULL;
- SetPortOpColor(port,
- &opColor);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *Qd_SetPortVisibleRegion(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- RgnHandle visRgn;
-#ifndef SetPortVisibleRegion
- PyMac_PRECHECK(SetPortVisibleRegion);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &visRgn))
- return NULL;
- SetPortVisibleRegion(port,
- visRgn);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *Qd_SetPortClipRegion(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- RgnHandle clipRgn;
-#ifndef SetPortClipRegion
- PyMac_PRECHECK(SetPortClipRegion);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &clipRgn))
- return NULL;
- SetPortClipRegion(port,
- clipRgn);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *Qd_SetPortPenPixPat(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- PixPatHandle penPattern;
-#ifndef SetPortPenPixPat
- PyMac_PRECHECK(SetPortPenPixPat);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &penPattern))
- return NULL;
- SetPortPenPixPat(port,
- penPattern);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *Qd_SetPortFillPixPat(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- PixPatHandle penPattern;
-#ifndef SetPortFillPixPat
- PyMac_PRECHECK(SetPortFillPixPat);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &penPattern))
- return NULL;
- SetPortFillPixPat(port,
- penPattern);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *Qd_SetPortBackPixPat(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- PixPatHandle backPattern;
-#ifndef SetPortBackPixPat
- PyMac_PRECHECK(SetPortBackPixPat);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &backPattern))
- return NULL;
- SetPortBackPixPat(port,
- backPattern);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *Qd_SetPortPenSize(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- Point penSize;
-#ifndef SetPortPenSize
- PyMac_PRECHECK(SetPortPenSize);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- PyMac_GetPoint, &penSize))
- return NULL;
- SetPortPenSize(port,
- penSize);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *Qd_SetPortPenMode(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- SInt32 penMode;
-#ifndef SetPortPenMode
- PyMac_PRECHECK(SetPortPenMode);
-#endif
- if (!PyArg_ParseTuple(_args, "O&l",
- GrafObj_Convert, &port,
- &penMode))
- return NULL;
- SetPortPenMode(port,
- penMode);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *Qd_SetPortFracHPenLocation(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- short pnLocHFrac;
-#ifndef SetPortFracHPenLocation
- PyMac_PRECHECK(SetPortFracHPenLocation);
-#endif
- if (!PyArg_ParseTuple(_args, "O&h",
- GrafObj_Convert, &port,
- &pnLocHFrac))
- return NULL;
- SetPortFracHPenLocation(port,
- pnLocHFrac);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
static PyObject *Qd_GetPixBounds(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -5054,25 +4993,6 @@ static PyObject *Qd_CreateNewPort(PyObject *_self, PyObject *_args)
#if TARGET_API_MAC_CARBON
-static PyObject *Qd_DisposePort(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
-#ifndef DisposePort
- PyMac_PRECHECK(DisposePort);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- DisposePort(port);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-#endif
-
-#if TARGET_API_MAC_CARBON
-
static PyObject *Qd_SetQDError(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -5090,107 +5010,6 @@ static PyObject *Qd_SetQDError(PyObject *_self, PyObject *_args)
}
#endif
-static PyObject *Qd_QDIsPortBuffered(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- CGrafPtr port;
-#ifndef QDIsPortBuffered
- PyMac_PRECHECK(QDIsPortBuffered);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = QDIsPortBuffered(port);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-
-static PyObject *Qd_QDIsPortBufferDirty(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- CGrafPtr port;
-#ifndef QDIsPortBufferDirty
- PyMac_PRECHECK(QDIsPortBufferDirty);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = QDIsPortBufferDirty(port);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-
-static PyObject *Qd_QDFlushPortBuffer(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- RgnHandle region;
-#ifndef QDFlushPortBuffer
- PyMac_PRECHECK(QDFlushPortBuffer);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- OptResObj_Convert, &region))
- return NULL;
- QDFlushPortBuffer(port,
- region);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-#if TARGET_API_MAC_CARBON
-
-static PyObject *Qd_QDGetDirtyRegion(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSStatus _err;
- CGrafPtr port;
- RgnHandle rgn;
-#ifndef QDGetDirtyRegion
- PyMac_PRECHECK(QDGetDirtyRegion);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &rgn))
- return NULL;
- _err = QDGetDirtyRegion(port,
- rgn);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-#endif
-
-#if TARGET_API_MAC_CARBON
-
-static PyObject *Qd_QDSetDirtyRegion(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSStatus _err;
- CGrafPtr port;
- RgnHandle rgn;
-#ifndef QDSetDirtyRegion
- PyMac_PRECHECK(QDSetDirtyRegion);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &rgn))
- return NULL;
- _err = QDSetDirtyRegion(port,
- rgn);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-#endif
-
static PyObject *Qd_LMGetScrVRes(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -6461,8 +6280,6 @@ static PyObject *Qd_RawBitMap(PyObject *_self, PyObject *_args)
}
static PyMethodDef Qd_methods[] = {
- {"MacSetPort", (PyCFunction)Qd_MacSetPort, 1,
- PyDoc_STR("(GrafPtr port) -> None")},
{"GetPort", (PyCFunction)Qd_GetPort, 1,
PyDoc_STR("() -> (GrafPtr port)")},
{"GrafDevice", (PyCFunction)Qd_GrafDevice, 1,
@@ -6826,96 +6643,6 @@ static PyMethodDef Qd_methods[] = {
PyDoc_STR("(short angle) -> (Fixed _rv)")},
{"AngleFromSlope", (PyCFunction)Qd_AngleFromSlope, 1,
PyDoc_STR("(Fixed slope) -> (short _rv)")},
-
-#if TARGET_API_MAC_CARBON
- {"IsValidPort", (PyCFunction)Qd_IsValidPort, 1,
- PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
-#endif
- {"GetPortPixMap", (PyCFunction)Qd_GetPortPixMap, 1,
- PyDoc_STR("(CGrafPtr port) -> (PixMapHandle _rv)")},
- {"GetPortBitMapForCopyBits", (PyCFunction)Qd_GetPortBitMapForCopyBits, 1,
- PyDoc_STR("(CGrafPtr port) -> (const BitMap * _rv)")},
- {"GetPortBounds", (PyCFunction)Qd_GetPortBounds, 1,
- PyDoc_STR("(CGrafPtr port) -> (Rect rect)")},
- {"GetPortForeColor", (PyCFunction)Qd_GetPortForeColor, 1,
- PyDoc_STR("(CGrafPtr port) -> (RGBColor foreColor)")},
- {"GetPortBackColor", (PyCFunction)Qd_GetPortBackColor, 1,
- PyDoc_STR("(CGrafPtr port) -> (RGBColor backColor)")},
- {"GetPortOpColor", (PyCFunction)Qd_GetPortOpColor, 1,
- PyDoc_STR("(CGrafPtr port) -> (RGBColor opColor)")},
- {"GetPortHiliteColor", (PyCFunction)Qd_GetPortHiliteColor, 1,
- PyDoc_STR("(CGrafPtr port) -> (RGBColor hiliteColor)")},
- {"GetPortTextFont", (PyCFunction)Qd_GetPortTextFont, 1,
- PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
- {"GetPortTextFace", (PyCFunction)Qd_GetPortTextFace, 1,
- PyDoc_STR("(CGrafPtr port) -> (Style _rv)")},
- {"GetPortTextMode", (PyCFunction)Qd_GetPortTextMode, 1,
- PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
- {"GetPortTextSize", (PyCFunction)Qd_GetPortTextSize, 1,
- PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
- {"GetPortChExtra", (PyCFunction)Qd_GetPortChExtra, 1,
- PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
- {"GetPortFracHPenLocation", (PyCFunction)Qd_GetPortFracHPenLocation, 1,
- PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
- {"GetPortSpExtra", (PyCFunction)Qd_GetPortSpExtra, 1,
- PyDoc_STR("(CGrafPtr port) -> (Fixed _rv)")},
- {"GetPortPenVisibility", (PyCFunction)Qd_GetPortPenVisibility, 1,
- PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
- {"GetPortVisibleRegion", (PyCFunction)Qd_GetPortVisibleRegion, 1,
- PyDoc_STR("(CGrafPtr port, RgnHandle visRgn) -> (RgnHandle _rv)")},
- {"GetPortClipRegion", (PyCFunction)Qd_GetPortClipRegion, 1,
- PyDoc_STR("(CGrafPtr port, RgnHandle clipRgn) -> (RgnHandle _rv)")},
- {"GetPortBackPixPat", (PyCFunction)Qd_GetPortBackPixPat, 1,
- PyDoc_STR("(CGrafPtr port, PixPatHandle backPattern) -> (PixPatHandle _rv)")},
- {"GetPortPenPixPat", (PyCFunction)Qd_GetPortPenPixPat, 1,
- PyDoc_STR("(CGrafPtr port, PixPatHandle penPattern) -> (PixPatHandle _rv)")},
- {"GetPortFillPixPat", (PyCFunction)Qd_GetPortFillPixPat, 1,
- PyDoc_STR("(CGrafPtr port, PixPatHandle fillPattern) -> (PixPatHandle _rv)")},
- {"GetPortPenSize", (PyCFunction)Qd_GetPortPenSize, 1,
- PyDoc_STR("(CGrafPtr port, Point penSize) -> (Point penSize)")},
- {"GetPortPenMode", (PyCFunction)Qd_GetPortPenMode, 1,
- PyDoc_STR("(CGrafPtr port) -> (SInt32 _rv)")},
- {"GetPortPenLocation", (PyCFunction)Qd_GetPortPenLocation, 1,
- PyDoc_STR("(CGrafPtr port, Point penLocation) -> (Point penLocation)")},
- {"IsPortRegionBeingDefined", (PyCFunction)Qd_IsPortRegionBeingDefined, 1,
- PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
- {"IsPortPictureBeingDefined", (PyCFunction)Qd_IsPortPictureBeingDefined, 1,
- PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
-
-#if TARGET_API_MAC_CARBON
- {"IsPortPolyBeingDefined", (PyCFunction)Qd_IsPortPolyBeingDefined, 1,
- PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
-#endif
-
-#if TARGET_API_MAC_CARBON
- {"IsPortOffscreen", (PyCFunction)Qd_IsPortOffscreen, 1,
- PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
-#endif
-
-#if TARGET_API_MAC_CARBON
- {"IsPortColor", (PyCFunction)Qd_IsPortColor, 1,
- PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
-#endif
- {"SetPortBounds", (PyCFunction)Qd_SetPortBounds, 1,
- PyDoc_STR("(CGrafPtr port, Rect rect) -> None")},
- {"SetPortOpColor", (PyCFunction)Qd_SetPortOpColor, 1,
- PyDoc_STR("(CGrafPtr port, RGBColor opColor) -> None")},
- {"SetPortVisibleRegion", (PyCFunction)Qd_SetPortVisibleRegion, 1,
- PyDoc_STR("(CGrafPtr port, RgnHandle visRgn) -> None")},
- {"SetPortClipRegion", (PyCFunction)Qd_SetPortClipRegion, 1,
- PyDoc_STR("(CGrafPtr port, RgnHandle clipRgn) -> None")},
- {"SetPortPenPixPat", (PyCFunction)Qd_SetPortPenPixPat, 1,
- PyDoc_STR("(CGrafPtr port, PixPatHandle penPattern) -> None")},
- {"SetPortFillPixPat", (PyCFunction)Qd_SetPortFillPixPat, 1,
- PyDoc_STR("(CGrafPtr port, PixPatHandle penPattern) -> None")},
- {"SetPortBackPixPat", (PyCFunction)Qd_SetPortBackPixPat, 1,
- PyDoc_STR("(CGrafPtr port, PixPatHandle backPattern) -> None")},
- {"SetPortPenSize", (PyCFunction)Qd_SetPortPenSize, 1,
- PyDoc_STR("(CGrafPtr port, Point penSize) -> None")},
- {"SetPortPenMode", (PyCFunction)Qd_SetPortPenMode, 1,
- PyDoc_STR("(CGrafPtr port, SInt32 penMode) -> None")},
- {"SetPortFracHPenLocation", (PyCFunction)Qd_SetPortFracHPenLocation, 1,
- PyDoc_STR("(CGrafPtr port, short pnLocHFrac) -> None")},
{"GetPixBounds", (PyCFunction)Qd_GetPixBounds, 1,
PyDoc_STR("(PixMapHandle pixMap) -> (Rect bounds)")},
{"GetPixDepth", (PyCFunction)Qd_GetPixDepth, 1,
@@ -6956,30 +6683,9 @@ static PyMethodDef Qd_methods[] = {
#endif
#if TARGET_API_MAC_CARBON
- {"DisposePort", (PyCFunction)Qd_DisposePort, 1,
- PyDoc_STR("(CGrafPtr port) -> None")},
-#endif
-
-#if TARGET_API_MAC_CARBON
{"SetQDError", (PyCFunction)Qd_SetQDError, 1,
PyDoc_STR("(OSErr err) -> None")},
#endif
- {"QDIsPortBuffered", (PyCFunction)Qd_QDIsPortBuffered, 1,
- PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
- {"QDIsPortBufferDirty", (PyCFunction)Qd_QDIsPortBufferDirty, 1,
- PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
- {"QDFlushPortBuffer", (PyCFunction)Qd_QDFlushPortBuffer, 1,
- PyDoc_STR("(CGrafPtr port, RgnHandle region) -> None")},
-
-#if TARGET_API_MAC_CARBON
- {"QDGetDirtyRegion", (PyCFunction)Qd_QDGetDirtyRegion, 1,
- PyDoc_STR("(CGrafPtr port, RgnHandle rgn) -> None")},
-#endif
-
-#if TARGET_API_MAC_CARBON
- {"QDSetDirtyRegion", (PyCFunction)Qd_QDSetDirtyRegion, 1,
- PyDoc_STR("(CGrafPtr port, RgnHandle rgn) -> None")},
-#endif
{"LMGetScrVRes", (PyCFunction)Qd_LMGetScrVRes, 1,
PyDoc_STR("() -> (SInt16 _rv)")},
{"LMSetScrVRes", (PyCFunction)Qd_LMSetScrVRes, 1,
@@ -7172,20 +6878,6 @@ void init_Qd(void)
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;
-
- o = QDGA_New();
- if (o == NULL || PyDict_SetItemString(d, "qd", o) != 0)
- return;
- }
-
-
}
/* ========================= End module _Qd ========================= */
diff --git a/Mac/Modules/qd/qdscan.py b/Mac/Modules/qd/qdscan.py
index 4c69ab0543..15f5f921fb 100644
--- a/Mac/Modules/qd/qdscan.py
+++ b/Mac/Modules/qd/qdscan.py
@@ -53,6 +53,12 @@ class MyScanner(Scanner):
listname = "functions"
if arglist:
t, n, m = arglist[0]
+ if t in ('GrafPtr', 'CGrafPtr') and m == 'InMode':
+ classname = "Method"
+ listname = "gr_methods"
+ elif t == 'BitMapPtr' and m == 'InMode':
+ classname = "Method"
+ listname = "bm_methods"
## elif t == "PolyHandle" and m == "InMode":
## classname = "Method"
## listname = "p_methods"
diff --git a/Mac/Modules/qd/qdsupport.py b/Mac/Modules/qd/qdsupport.py
index 73c87d118e..c668e95db6 100644
--- a/Mac/Modules/qd/qdsupport.py
+++ b/Mac/Modules/qd/qdsupport.py
@@ -211,15 +211,7 @@ PyObject *BMObj_NewCopied(BitMapPtr itself)
"""
-variablestuff = """
-{
- PyObject *o;
-
- o = QDGA_New();
- if (o == NULL || PyDict_SetItemString(d, "qd", o) != 0)
- return;
-}
-"""
+variablestuff = ""
initstuff = initstuff + """
PyMac_INIT_TOOLBOX_OBJECT_NEW(BitMapPtr, BMObj_New);
@@ -244,7 +236,22 @@ initstuff = initstuff + """
## def outputFreeIt(self, itselfname):
## Output("KillPoly(%s);", itselfname)
-class MyGRObjectDefinition(GlobalObjectDefinition):
+class MyGRObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+ getsetlist = [
+ ('visRgn',
+ """RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
+ return Py_BuildValue("O&", ResObj_New, (Handle)GetPortVisibleRegion(self->ob_itself, h));
+ """,
+ None,
+ "Convenience attribute: return a copy of the visible region"
+ ), (
+ 'clipRgn',
+ """RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
+ return Py_BuildValue("O&", ResObj_New, (Handle)GetPortClipRegion(self->ob_itself, h));
+ """,
+ None,
+ "Convenience attribute: return a copy of the clipping region"
+ )]
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
def outputCheckConvertArg(self):
@@ -269,157 +276,35 @@ class MyGRObjectDefinition(GlobalObjectDefinition):
Output("return 1;")
OutRbrace()
Output("#endif")
- def outputGetattrHook(self):
- Output("#if !ACCESSOR_CALLS_ARE_FUNCTIONS")
- Output("""
- { CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
-
- if ( strcmp(name, "data") == 0 )
- return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(GrafPort));
-
- if ( (itself_color->portVersion&0xc000) == 0xc000 ) {
- /* Color-only attributes */
-
- if ( strcmp(name, "portBits") == 0 )
- /* XXXX Do we need HLock() stuff here?? */
- return BMObj_New((BitMapPtr)*itself_color->portPixMap);
- if ( strcmp(name, "grafVars") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->visRgn);
- if ( strcmp(name, "chExtra") == 0 )
- return Py_BuildValue("h", itself_color->chExtra);
- if ( strcmp(name, "pnLocHFrac") == 0 )
- return Py_BuildValue("h", itself_color->pnLocHFrac);
- if ( strcmp(name, "bkPixPat") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->bkPixPat);
- if ( strcmp(name, "rgbFgColor") == 0 )
- return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbFgColor);
- if ( strcmp(name, "rgbBkColor") == 0 )
- return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbBkColor);
- if ( strcmp(name, "pnPixPat") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->pnPixPat);
- if ( strcmp(name, "fillPixPat") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->fillPixPat);
- } else {
- /* Mono-only attributes */
- if ( strcmp(name, "portBits") == 0 )
- return BMObj_New(&self->ob_itself->portBits);
- if ( strcmp(name, "bkPat") == 0 )
- return Py_BuildValue("s#", (char *)&self->ob_itself->bkPat, sizeof(Pattern));
- if ( strcmp(name, "fillPat") == 0 )
- return Py_BuildValue("s#", (char *)&self->ob_itself->fillPat, sizeof(Pattern));
- if ( strcmp(name, "pnPat") == 0 )
- return Py_BuildValue("s#", (char *)&self->ob_itself->pnPat, sizeof(Pattern));
- }
- /*
- ** Accessible for both color/mono windows.
- ** portVersion is really color-only, but we put it here
- ** for convenience
- */
- if ( strcmp(name, "portVersion") == 0 )
- return Py_BuildValue("h", itself_color->portVersion);
- if ( strcmp(name, "device") == 0 )
- return PyInt_FromLong((long)self->ob_itself->device);
- if ( strcmp(name, "portRect") == 0 )
- return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->portRect);
- if ( strcmp(name, "visRgn") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->visRgn);
- if ( strcmp(name, "clipRgn") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->clipRgn);
- if ( strcmp(name, "pnLoc") == 0 )
- return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnLoc);
- if ( strcmp(name, "pnSize") == 0 )
- return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnSize);
- if ( strcmp(name, "pnMode") == 0 )
- return Py_BuildValue("h", self->ob_itself->pnMode);
- if ( strcmp(name, "pnVis") == 0 )
- return Py_BuildValue("h", self->ob_itself->pnVis);
- if ( strcmp(name, "txFont") == 0 )
- return Py_BuildValue("h", self->ob_itself->txFont);
- if ( strcmp(name, "txFace") == 0 )
- return Py_BuildValue("h", (short)self->ob_itself->txFace);
- if ( strcmp(name, "txMode") == 0 )
- return Py_BuildValue("h", self->ob_itself->txMode);
- if ( strcmp(name, "txSize") == 0 )
- return Py_BuildValue("h", self->ob_itself->txSize);
- if ( strcmp(name, "spExtra") == 0 )
- return Py_BuildValue("O&", PyMac_BuildFixed, self->ob_itself->spExtra);
- /* XXXX Add more, as needed */
- /* This one is so we can compare grafports: */
- if ( strcmp(name, "_id") == 0 )
- return Py_BuildValue("l", (long)self->ob_itself);
- }""")
- Output("#else")
- Output("""
- { CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
- if ( strcmp(name, "portBits") == 0 )
- return BMObj_New((BitMapPtr)GetPortBitMapForCopyBits(itself_color));
- if ( strcmp(name, "chExtra") == 0 )
- return Py_BuildValue("h", GetPortChExtra(itself_color));
- if ( strcmp(name, "pnLocHFrac") == 0 )
- return Py_BuildValue("h", GetPortFracHPenLocation(itself_color));
- if ( strcmp(name, "bkPixPat") == 0 ) {
- PixPatHandle h=0;
- return Py_BuildValue("O&", ResObj_New, (Handle)GetPortBackPixPat(itself_color, h));
- }
- if ( strcmp(name, "rgbFgColor") == 0 ) {
- RGBColor c;
- return Py_BuildValue("O&", QdRGB_New, GetPortForeColor(itself_color, &c));
- }
- if ( strcmp(name, "rgbBkColor") == 0 ) {
- RGBColor c;
- return Py_BuildValue("O&", QdRGB_New, GetPortBackColor(itself_color, &c));
- }
- if ( strcmp(name, "pnPixPat") == 0 ) {
- PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */
-
- return Py_BuildValue("O&", ResObj_New, (Handle)GetPortPenPixPat(itself_color, h));
- }
- if ( strcmp(name, "fillPixPat") == 0 ) {
- PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */
- return Py_BuildValue("O&", ResObj_New, (Handle)GetPortFillPixPat(itself_color, h));
- }
- if ( strcmp(name, "portRect") == 0 ) {
- Rect r;
- return Py_BuildValue("O&", PyMac_BuildRect, GetPortBounds(itself_color, &r));
- }
- if ( strcmp(name, "visRgn") == 0 ) {
- RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
- return Py_BuildValue("O&", ResObj_New, (Handle)GetPortVisibleRegion(itself_color, h));
- }
- if ( strcmp(name, "clipRgn") == 0 ) {
- RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
- return Py_BuildValue("O&", ResObj_New, (Handle)GetPortClipRegion(itself_color, h));
- }
- if ( strcmp(name, "pnLoc") == 0 ) {
- Point p;
- return Py_BuildValue("O&", PyMac_BuildPoint, *GetPortPenLocation(itself_color, &p));
- }
- if ( strcmp(name, "pnSize") == 0 ) {
- Point p;
- return Py_BuildValue("O&", PyMac_BuildPoint, *GetPortPenSize(itself_color, &p));
- }
- if ( strcmp(name, "pnMode") == 0 )
- return Py_BuildValue("h", GetPortPenMode(itself_color));
- if ( strcmp(name, "pnVis") == 0 )
- return Py_BuildValue("h", GetPortPenVisibility(itself_color));
- if ( strcmp(name, "txFont") == 0 )
- return Py_BuildValue("h", GetPortTextFont(itself_color));
- if ( strcmp(name, "txFace") == 0 )
- return Py_BuildValue("h", (short)GetPortTextFace(itself_color));
- if ( strcmp(name, "txMode") == 0 )
- return Py_BuildValue("h", GetPortTextMode(itself_color));
- if ( strcmp(name, "txSize") == 0 )
- return Py_BuildValue("h", GetPortTextSize(itself_color));
- if ( strcmp(name, "spExtra") == 0 )
- return Py_BuildValue("O&", PyMac_BuildFixed, GetPortSpExtra(itself_color));
- /* XXXX Add more, as needed */
- /* This one is so we can compare grafports: */
- if ( strcmp(name, "_id") == 0 )
- return Py_BuildValue("l", (long)self->ob_itself);
- }""")
- Output("#endif")
-class MyBMObjectDefinition(GlobalObjectDefinition):
+class MyBMObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+ getsetlist = [
+ (
+ 'baseAddr',
+ 'return PyInt_FromLong((long)self->ob_itself->baseAddr);',
+ None,
+ None
+ ), (
+ 'rowBytes',
+ 'return PyInt_FromLong((long)self->ob_itself->rowBytes);',
+ None,
+ None
+ ), (
+ 'bounds',
+ 'return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);',
+ None,
+ None
+ ), (
+ 'bitmap_data',
+ 'return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap));',
+ None,
+ None
+ ), (
+ 'pixmap_data',
+ 'return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap));',
+ None,
+ None
+ )]
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
def outputStructMembers(self):
@@ -434,104 +319,7 @@ class MyBMObjectDefinition(GlobalObjectDefinition):
Output("it->referred_bitmap = NULL;")
def outputCleanupStructMembers(self):
Output("Py_XDECREF(self->referred_object);")
- Output("if (self->referred_bitmap) free(self->referred_bitmap);")
- def outputGetattrHook(self):
- Output("""if ( strcmp(name, "baseAddr") == 0 )
- return PyInt_FromLong((long)self->ob_itself->baseAddr);
- if ( strcmp(name, "rowBytes") == 0 )
- return PyInt_FromLong((long)self->ob_itself->rowBytes);
- if ( strcmp(name, "bounds") == 0 )
- return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);
- /* XXXX Add more, as needed */
- if ( strcmp(name, "bitmap_data") == 0 )
- return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap));
- if ( strcmp(name, "pixmap_data") == 0 )
- return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap));
- """)
-
-# This object is instanciated once, and will access qd globals.
-class QDGlobalsAccessObjectDefinition(ObjectDefinition):
- def outputStructMembers(self):
- pass
- def outputNew(self):
- Output()
- Output("%sPyObject *%s_New(void)", self.static, self.prefix)
- OutLbrace()
- Output("%s *it;", self.objecttype)
- Output("it = PyObject_NEW(%s, &%s);", self.objecttype, self.typename)
- Output("if (it == NULL) return NULL;")
- Output("return (PyObject *)it;")
- OutRbrace()
- def outputConvert(self):
- pass
- def outputCleanupStructMembers(self):
- pass
-
- def outputGetattrHook(self):
- Output("#if !ACCESSOR_CALLS_ARE_FUNCTIONS")
- Output("""
- if ( strcmp(name, "arrow") == 0 )
- return PyString_FromStringAndSize((char *)&qd.arrow, sizeof(qd.arrow));
- if ( strcmp(name, "black") == 0 )
- return PyString_FromStringAndSize((char *)&qd.black, sizeof(qd.black));
- if ( strcmp(name, "white") == 0 )
- return PyString_FromStringAndSize((char *)&qd.white, sizeof(qd.white));
- if ( strcmp(name, "gray") == 0 )
- return PyString_FromStringAndSize((char *)&qd.gray, sizeof(qd.gray));
- if ( strcmp(name, "ltGray") == 0 )
- return PyString_FromStringAndSize((char *)&qd.ltGray, sizeof(qd.ltGray));
- if ( strcmp(name, "dkGray") == 0 )
- return PyString_FromStringAndSize((char *)&qd.dkGray, sizeof(qd.dkGray));
- if ( strcmp(name, "screenBits") == 0 )
- return BMObj_New(&qd.screenBits);
- if ( strcmp(name, "thePort") == 0 )
- return GrafObj_New(qd.thePort);
- if ( strcmp(name, "randSeed") == 0 )
- return Py_BuildValue("l", &qd.randSeed);
- """)
- Output("#else")
- Output("""
- if ( strcmp(name, "arrow") == 0 ) {
- Cursor rv;
- GetQDGlobalsArrow(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "black") == 0 ) {
- Pattern rv;
- GetQDGlobalsBlack(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "white") == 0 ) {
- Pattern rv;
- GetQDGlobalsWhite(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "gray") == 0 ) {
- Pattern rv;
- GetQDGlobalsGray(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "ltGray") == 0 ) {
- Pattern rv;
- GetQDGlobalsLightGray(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "dkGray") == 0 ) {
- Pattern rv;
- GetQDGlobalsDarkGray(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "screenBits") == 0 ) {
- BitMap rv;
- GetQDGlobalsScreenBits(&rv);
- return BMObj_NewCopied(&rv);
- }
- if ( strcmp(name, "thePort") == 0 )
- return GrafObj_New(GetQDGlobalsThePort());
- if ( strcmp(name, "randSeed") == 0 )
- return Py_BuildValue("l", GetQDGlobalsRandomSeed());
- """)
- Output("#endif")
+ Output("if (self->referred_bitmap) free(self->referred_bitmap);")
# Create the generator groups and link them
module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff, variablestuff)
@@ -543,8 +331,6 @@ gr_object = MyGRObjectDefinition("GrafPort", "GrafObj", "GrafPtr")
module.addobject(gr_object)
bm_object = MyBMObjectDefinition("BitMap", "BMObj", "BitMapPtr")
module.addobject(bm_object)
-qd_object = QDGlobalsAccessObjectDefinition("QDGlobalsAccess", "QDGA", "XXXX")
-module.addobject(qd_object)
# Create the generator classes used to populate the lists
@@ -553,15 +339,17 @@ Method = OSErrWeakLinkMethodGenerator
# Create and populate the lists
functions = []
-methods = []
+gr_methods = []
+bm_methods = []
+#methods = []
execfile(INPUTFILE)
execfile(EXTRAFILE)
# add the populated lists to the generator groups
# (in a different wordl the scan program would generate this)
for f in functions: module.add(f)
-##for f in r_methods: r_object.add(f)
-##for f in po_methods: po_object.add(f)
+for f in gr_methods: gr_object.add(f)
+for f in bm_methods: bm_object.add(f)
# Manual generator: get data out of a bitmap
getdata_body = """
diff --git a/Mac/Modules/qdoffs/_Qdoffsmodule.c b/Mac/Modules/qdoffs/_Qdoffsmodule.c
index c75daac2ab..9804b71cc0 100644
--- a/Mac/Modules/qdoffs/_Qdoffsmodule.c
+++ b/Mac/Modules/qdoffs/_Qdoffsmodule.c
@@ -131,14 +131,7 @@ static PyMethodDef GWorldObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain GWorldObj_chain = { GWorldObj_methods, NULL };
-
-static PyObject *GWorldObj_getattr(GWorldObject *self, char *name)
-{
- return Py_FindMethodInChain(&GWorldObj_chain, (PyObject *)self, name);
-}
-
-#define GWorldObj_setattr NULL
+#define GWorldObj_getsetlist NULL
#define GWorldObj_compare NULL
@@ -155,14 +148,31 @@ PyTypeObject GWorld_Type = {
/* methods */
(destructor) GWorldObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) GWorldObj_getattr, /*tp_getattr*/
- (setattrfunc) GWorldObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) GWorldObj_compare, /*tp_compare*/
(reprfunc) GWorldObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) GWorldObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ GWorldObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ GWorldObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* --------------------- End object type GWorld --------------------- */
diff --git a/Mac/Modules/qdoffs/qdoffssupport.py b/Mac/Modules/qdoffs/qdoffssupport.py
index 057f0a96ce..11ce8fdc94 100644
--- a/Mac/Modules/qdoffs/qdoffssupport.py
+++ b/Mac/Modules/qdoffs/qdoffssupport.py
@@ -57,7 +57,7 @@ initstuff = initstuff + """
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GWorldPtr, GWorldObj_Convert);
"""
-class MyObjectDefinition(GlobalObjectDefinition):
+class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
## def outputInitStructMembers(self):
diff --git a/Mac/Modules/qt/_Qtmodule.c b/Mac/Modules/qt/_Qtmodule.c
index 687aaeee7e..47ec3d9793 100644
--- a/Mac/Modules/qt/_Qtmodule.c
+++ b/Mac/Modules/qt/_Qtmodule.c
@@ -1090,14 +1090,7 @@ static PyMethodDef MovieCtlObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain MovieCtlObj_chain = { MovieCtlObj_methods, NULL };
-
-static PyObject *MovieCtlObj_getattr(MovieControllerObject *self, char *name)
-{
- return Py_FindMethodInChain(&MovieCtlObj_chain, (PyObject *)self, name);
-}
-
-#define MovieCtlObj_setattr NULL
+#define MovieCtlObj_getsetlist NULL
#define MovieCtlObj_compare NULL
@@ -1114,14 +1107,31 @@ PyTypeObject MovieController_Type = {
/* methods */
(destructor) MovieCtlObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) MovieCtlObj_getattr, /*tp_getattr*/
- (setattrfunc) MovieCtlObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) MovieCtlObj_compare, /*tp_compare*/
(reprfunc) MovieCtlObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) MovieCtlObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ MovieCtlObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ MovieCtlObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* ---------------- End object type MovieController ----------------- */
@@ -1541,14 +1551,7 @@ static PyMethodDef TimeBaseObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain TimeBaseObj_chain = { TimeBaseObj_methods, NULL };
-
-static PyObject *TimeBaseObj_getattr(TimeBaseObject *self, char *name)
-{
- return Py_FindMethodInChain(&TimeBaseObj_chain, (PyObject *)self, name);
-}
-
-#define TimeBaseObj_setattr NULL
+#define TimeBaseObj_getsetlist NULL
#define TimeBaseObj_compare NULL
@@ -1565,14 +1568,31 @@ PyTypeObject TimeBase_Type = {
/* methods */
(destructor) TimeBaseObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) TimeBaseObj_getattr, /*tp_getattr*/
- (setattrfunc) TimeBaseObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) TimeBaseObj_compare, /*tp_compare*/
(reprfunc) TimeBaseObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) TimeBaseObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ TimeBaseObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ TimeBaseObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* -------------------- End object type TimeBase -------------------- */
@@ -1845,14 +1865,7 @@ static PyMethodDef UserDataObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain UserDataObj_chain = { UserDataObj_methods, NULL };
-
-static PyObject *UserDataObj_getattr(UserDataObject *self, char *name)
-{
- return Py_FindMethodInChain(&UserDataObj_chain, (PyObject *)self, name);
-}
-
-#define UserDataObj_setattr NULL
+#define UserDataObj_getsetlist NULL
#define UserDataObj_compare NULL
@@ -1869,14 +1882,31 @@ PyTypeObject UserData_Type = {
/* methods */
(destructor) UserDataObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) UserDataObj_getattr, /*tp_getattr*/
- (setattrfunc) UserDataObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) UserDataObj_compare, /*tp_compare*/
(reprfunc) UserDataObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) UserDataObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ UserDataObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ UserDataObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* -------------------- End object type UserData -------------------- */
@@ -3020,14 +3050,7 @@ static PyMethodDef MediaObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain MediaObj_chain = { MediaObj_methods, NULL };
-
-static PyObject *MediaObj_getattr(MediaObject *self, char *name)
-{
- return Py_FindMethodInChain(&MediaObj_chain, (PyObject *)self, name);
-}
-
-#define MediaObj_setattr NULL
+#define MediaObj_getsetlist NULL
#define MediaObj_compare NULL
@@ -3044,14 +3067,31 @@ PyTypeObject Media_Type = {
/* methods */
(destructor) MediaObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) MediaObj_getattr, /*tp_getattr*/
- (setattrfunc) MediaObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) MediaObj_compare, /*tp_compare*/
(reprfunc) MediaObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) MediaObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ MediaObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ MediaObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* --------------------- End object type Media ---------------------- */
@@ -4301,14 +4341,7 @@ static PyMethodDef TrackObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain TrackObj_chain = { TrackObj_methods, NULL };
-
-static PyObject *TrackObj_getattr(TrackObject *self, char *name)
-{
- return Py_FindMethodInChain(&TrackObj_chain, (PyObject *)self, name);
-}
-
-#define TrackObj_setattr NULL
+#define TrackObj_getsetlist NULL
#define TrackObj_compare NULL
@@ -4325,14 +4358,31 @@ PyTypeObject Track_Type = {
/* methods */
(destructor) TrackObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) TrackObj_getattr, /*tp_getattr*/
- (setattrfunc) TrackObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) TrackObj_compare, /*tp_compare*/
(reprfunc) TrackObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) TrackObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ TrackObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ TrackObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* --------------------- End object type Track ---------------------- */
@@ -6722,14 +6772,7 @@ static PyMethodDef MovieObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain MovieObj_chain = { MovieObj_methods, NULL };
-
-static PyObject *MovieObj_getattr(MovieObject *self, char *name)
-{
- return Py_FindMethodInChain(&MovieObj_chain, (PyObject *)self, name);
-}
-
-#define MovieObj_setattr NULL
+#define MovieObj_getsetlist NULL
#define MovieObj_compare NULL
@@ -6746,14 +6789,31 @@ PyTypeObject Movie_Type = {
/* methods */
(destructor) MovieObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) MovieObj_getattr, /*tp_getattr*/
- (setattrfunc) MovieObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) MovieObj_compare, /*tp_compare*/
(reprfunc) MovieObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) MovieObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ MovieObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ MovieObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* --------------------- End object type Movie ---------------------- */
diff --git a/Mac/Modules/qt/qtsupport.py b/Mac/Modules/qt/qtsupport.py
index c6525c0894..8160a3094d 100644
--- a/Mac/Modules/qt/qtsupport.py
+++ b/Mac/Modules/qt/qtsupport.py
@@ -181,7 +181,7 @@ QTFloatSingle = Type("QTFloatSingle", "f")
dummyshortptr = FakeType('(short *)0')
dummyStringPtr = FakeType('(StringPtr)0')
-class MovieObjectDefinition(GlobalObjectDefinition):
+class MovieObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null Movie");
@@ -190,7 +190,7 @@ class MovieObjectDefinition(GlobalObjectDefinition):
def outputFreeIt(self, itselfname):
Output("DisposeMovie(%s);", itselfname)
-class TrackObjectDefinition(GlobalObjectDefinition):
+class TrackObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null Track");
@@ -199,7 +199,7 @@ class TrackObjectDefinition(GlobalObjectDefinition):
def outputFreeIt(self, itselfname):
Output("DisposeMovieTrack(%s);", itselfname)
-class MediaObjectDefinition(GlobalObjectDefinition):
+class MediaObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null Media");
@@ -208,7 +208,7 @@ class MediaObjectDefinition(GlobalObjectDefinition):
def outputFreeIt(self, itselfname):
Output("DisposeTrackMedia(%s);", itselfname)
-class UserDataObjectDefinition(GlobalObjectDefinition):
+class UserDataObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null UserData");
@@ -217,7 +217,7 @@ class UserDataObjectDefinition(GlobalObjectDefinition):
def outputFreeIt(self, itselfname):
Output("DisposeUserData(%s);", itselfname)
-class TimeBaseObjectDefinition(GlobalObjectDefinition):
+class TimeBaseObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null TimeBase");
@@ -226,7 +226,7 @@ class TimeBaseObjectDefinition(GlobalObjectDefinition):
## def outputFreeIt(self, itselfname):
## Output("DisposeTimeBase(%s);", itselfname)
-class MovieCtlObjectDefinition(GlobalObjectDefinition):
+class MovieCtlObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null MovieController");
diff --git a/Mac/Modules/res/_Resmodule.c b/Mac/Modules/res/_Resmodule.c
index 421b9d7c82..1884230f3f 100644
--- a/Mac/Modules/res/_Resmodule.c
+++ b/Mac/Modules/res/_Resmodule.c
@@ -551,54 +551,61 @@ static PyMethodDef ResObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain ResObj_chain = { ResObj_methods, NULL };
-
-static PyObject *ResObj_getattr(ResourceObject *self, char *name)
-{
-
- if (strcmp(name, "size") == 0)
- return PyInt_FromLong(GetHandleSize(self->ob_itself));
- if (strcmp(name, "data") == 0) {
- PyObject *res;
- char state;
- state = HGetState(self->ob_itself);
- HLock(self->ob_itself);
- res = PyString_FromStringAndSize(
- *self->ob_itself,
- GetHandleSize(self->ob_itself));
- HUnlock(self->ob_itself);
- HSetState(self->ob_itself, state);
- return res;
- }
- if (strcmp(name, "__members__") == 0)
- return Py_BuildValue("[ss]", "data", "size");
-
- return Py_FindMethodInChain(&ResObj_chain, (PyObject *)self, name);
+static PyObject *ResObj_get_data(ResourceObject *self, void *closure)
+{
+
+ PyObject *res;
+ char state;
+
+ state = HGetState(self->ob_itself);
+ HLock(self->ob_itself);
+ res = PyString_FromStringAndSize(
+ *self->ob_itself,
+ GetHandleSize(self->ob_itself));
+ HUnlock(self->ob_itself);
+ HSetState(self->ob_itself, state);
+ return res;
+
+}
+
+static int ResObj_set_data(ResourceObject *self, PyObject *v, void *closure)
+{
+
+ char *data;
+ long size;
+
+ if ( v == NULL )
+ return -1;
+ if ( !PyString_Check(v) )
+ return -1;
+ size = PyString_Size(v);
+ data = PyString_AsString(v);
+ /* XXXX Do I need the GetState/SetState calls? */
+ SetHandleSize(self->ob_itself, size);
+ if ( MemError())
+ return -1;
+ HLock(self->ob_itself);
+ memcpy((char *)*self->ob_itself, data, size);
+ HUnlock(self->ob_itself);
+ /* XXXX Should I do the Changed call immedeately? */
+ return 0;
+
+ return 0;
}
-static int
-ResObj_setattr(ResourceObject *self, char *name, PyObject *value)
+static PyObject *ResObj_get_size(ResourceObject *self, void *closure)
{
- char *data;
- long size;
-
- if (strcmp(name, "data") != 0 || value == NULL )
- return -1;
- if ( !PyString_Check(value) )
- return -1;
- size = PyString_Size(value);
- data = PyString_AsString(value);
- /* XXXX Do I need the GetState/SetState calls? */
- SetHandleSize(self->ob_itself, size);
- if ( MemError())
- return -1;
- HLock(self->ob_itself);
- memcpy((char *)*self->ob_itself, data, size);
- HUnlock(self->ob_itself);
- /* XXXX Should I do the Changed call immedeately? */
- return 0;
+ return PyInt_FromLong(GetHandleSize(self->ob_itself));
}
+#define ResObj_set_size NULL
+
+static PyGetSetDef ResObj_getsetlist[] = {
+ {"data", (getter)ResObj_get_data, (setter)ResObj_set_data, "The resource data"},
+ {"size", (getter)ResObj_get_size, (setter)ResObj_set_size, "The length of the resource data"},
+ {NULL, NULL, NULL, NULL},
+};
+
#define ResObj_compare NULL
@@ -615,14 +622,31 @@ PyTypeObject Resource_Type = {
/* methods */
(destructor) ResObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) ResObj_getattr, /*tp_getattr*/
- (setattrfunc) ResObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) ResObj_compare, /*tp_compare*/
(reprfunc) ResObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) ResObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ ResObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ ResObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* -------------------- End object type Resource -------------------- */
diff --git a/Mac/Modules/res/ressupport.py b/Mac/Modules/res/ressupport.py
index c0bfc8ac18..8f6cb8dc55 100644
--- a/Mac/Modules/res/ressupport.py
+++ b/Mac/Modules/res/ressupport.py
@@ -100,51 +100,49 @@ initstuff = initstuff + """
module = MacModule('_Res', 'Res', includestuff, finalstuff, initstuff)
-getattrHookCode = """
-if (strcmp(name, "size") == 0)
- return PyInt_FromLong(GetHandleSize(self->ob_itself));
-if (strcmp(name, "data") == 0) {
- PyObject *res;
- char state;
- state = HGetState(self->ob_itself);
- HLock(self->ob_itself);
- res = PyString_FromStringAndSize(
- *self->ob_itself,
- GetHandleSize(self->ob_itself));
- HUnlock(self->ob_itself);
- HSetState(self->ob_itself, state);
- return res;
-}
-if (strcmp(name, "__members__") == 0)
- return Py_BuildValue("[ss]", "data", "size");
-"""
-
-setattrCode = """
-static int
-ResObj_setattr(ResourceObject *self, char *name, PyObject *value)
-{
- char *data;
- long size;
+class ResDefinition(PEP252Mixin, GlobalObjectDefinition):
+ getsetlist = [
+ ('data',
+ """
+ PyObject *res;
+ char state;
+
+ state = HGetState(self->ob_itself);
+ HLock(self->ob_itself);
+ res = PyString_FromStringAndSize(
+ *self->ob_itself,
+ GetHandleSize(self->ob_itself));
+ HUnlock(self->ob_itself);
+ HSetState(self->ob_itself, state);
+ return res;
+ """,
+ """
+ char *data;
+ long size;
- if (strcmp(name, "data") != 0 || value == NULL )
- return -1;
- if ( !PyString_Check(value) )
- return -1;
- size = PyString_Size(value);
- data = PyString_AsString(value);
- /* XXXX Do I need the GetState/SetState calls? */
- SetHandleSize(self->ob_itself, size);
- if ( MemError())
- return -1;
- HLock(self->ob_itself);
- memcpy((char *)*self->ob_itself, data, size);
- HUnlock(self->ob_itself);
- /* XXXX Should I do the Changed call immedeately? */
- return 0;
-}
-"""
-
-class ResDefinition(GlobalObjectDefinition):
+ if ( v == NULL )
+ return -1;
+ if ( !PyString_Check(v) )
+ return -1;
+ size = PyString_Size(v);
+ data = PyString_AsString(v);
+ /* XXXX Do I need the GetState/SetState calls? */
+ SetHandleSize(self->ob_itself, size);
+ if ( MemError())
+ return -1;
+ HLock(self->ob_itself);
+ memcpy((char *)*self->ob_itself, data, size);
+ HUnlock(self->ob_itself);
+ /* XXXX Should I do the Changed call immedeately? */
+ return 0;
+ """,
+ 'The resource data'
+ ), (
+ 'size',
+ 'return PyInt_FromLong(GetHandleSize(self->ob_itself));',
+ None,
+ 'The length of the resource data'
+ )]
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
@@ -163,12 +161,6 @@ class ResDefinition(GlobalObjectDefinition):
Output("PyErr_Clear();")
OutRbrace()
- def outputGetattrHook(self):
- Output(getattrHookCode)
-
- def outputSetattr(self):
- Output(setattrCode)
-
def outputStructMembers(self):
GlobalObjectDefinition.outputStructMembers(self)
Output("void (*ob_freeit)(%s ptr);", self.itselftype)
diff --git a/Mac/Modules/scrap/scrapsupport.py b/Mac/Modules/scrap/scrapsupport.py
index 57d7578a63..43fcb46f6b 100644
--- a/Mac/Modules/scrap/scrapsupport.py
+++ b/Mac/Modules/scrap/scrapsupport.py
@@ -55,7 +55,7 @@ ScrapFlavorFlags = Type('ScrapFlavorFlags', 'l')
#ScrapFlavorInfo = OpaqueType('ScrapFlavorInfo', 'ScrapFlavorInfo')
putscrapbuffer = FixedInputBufferType('void *')
-class MyObjectDefinition(GlobalObjectDefinition):
+class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
pass
# Create the generator groups and link them
diff --git a/Mac/Modules/snd/_Sndmodule.c b/Mac/Modules/snd/_Sndmodule.c
index 7ce479971c..412ae9db88 100644
--- a/Mac/Modules/snd/_Sndmodule.c
+++ b/Mac/Modules/snd/_Sndmodule.c
@@ -300,14 +300,8 @@ static PyMethodDef SndCh_methods[] = {
{NULL, NULL, 0}
};
-static PyMethodChain SndCh_chain = { SndCh_methods, NULL };
+#define SndCh_getsetlist NULL
-static PyObject *SndCh_getattr(SndChannelObject *self, char *name)
-{
- return Py_FindMethodInChain(&SndCh_chain, (PyObject *)self, name);
-}
-
-#define SndCh_setattr NULL
#define SndCh_compare NULL
@@ -324,14 +318,31 @@ static PyTypeObject SndChannel_Type = {
/* methods */
(destructor) SndCh_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) SndCh_getattr, /*tp_getattr*/
- (setattrfunc) SndCh_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) SndCh_compare, /*tp_compare*/
(reprfunc) SndCh_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) SndCh_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ SndCh_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ SndCh_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* ------------------- End object type SndChannel ------------------- */
@@ -391,52 +402,66 @@ static PyMethodDef SPBObj_methods[] = {
{NULL, NULL, 0}
};
-static PyMethodChain SPBObj_chain = { SPBObj_methods, NULL };
+static PyObject *SPBObj_get_inRefNum(SPBObject *self, void *closure)
+{
+ return Py_BuildValue("l", self->ob_spb.inRefNum);
+}
-static PyObject *SPBObj_getattr(SPBObject *self, char *name)
+static int SPBObj_set_inRefNum(SPBObject *self, PyObject *v, void *closure)
{
+ return -1 + PyArg_Parse(v, "l", &self->ob_spb.inRefNum);
+ return 0;
+}
- if (strcmp(name, "inRefNum") == 0)
- return Py_BuildValue("l", self->ob_spb.inRefNum);
- else if (strcmp(name, "count") == 0)
- return Py_BuildValue("l", self->ob_spb.count);
- else if (strcmp(name, "milliseconds") == 0)
- return Py_BuildValue("l", self->ob_spb.milliseconds);
- else if (strcmp(name, "error") == 0)
- return Py_BuildValue("h", self->ob_spb.error);
- return Py_FindMethodInChain(&SPBObj_chain, (PyObject *)self, name);
+static PyObject *SPBObj_get_count(SPBObject *self, void *closure)
+{
+ return Py_BuildValue("l", self->ob_spb.count);
}
-static int SPBObj_setattr(SPBObject *self, char *name, PyObject *value)
+static int SPBObj_set_count(SPBObject *self, PyObject *v, void *closure)
{
+ return -1 + PyArg_Parse(v, "l", &self->ob_spb.count);
+ return 0;
+}
- int rv = 0;
-
- if (strcmp(name, "inRefNum") == 0)
- rv = PyArg_Parse(value, "l", &self->ob_spb.inRefNum);
- else if (strcmp(name, "count") == 0)
- rv = PyArg_Parse(value, "l", &self->ob_spb.count);
- else if (strcmp(name, "milliseconds") == 0)
- rv = PyArg_Parse(value, "l", &self->ob_spb.milliseconds);
- else if (strcmp(name, "buffer") == 0)
- rv = PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength);
- else if (strcmp(name, "completionRoutine") == 0) {
- self->ob_spb.completionRoutine = NewSICompletionUPP(SPB_completion);
- self->ob_completion = value;
- Py_INCREF(value);
- rv = 1;
-#if !TARGET_API_MAC_CARBON
- } else if (strcmp(name, "interruptRoutine") == 0) {
- self->ob_spb.completionRoutine = NewSIInterruptUPP(SPB_interrupt);
- self->ob_interrupt = value;
- Py_INCREF(value);
- rv = 1;
-#endif
- }
- if ( rv ) return 0;
- else return -1;
+static PyObject *SPBObj_get_milliseconds(SPBObject *self, void *closure)
+{
+ return Py_BuildValue("l", self->ob_spb.milliseconds);
}
+static int SPBObj_set_milliseconds(SPBObject *self, PyObject *v, void *closure)
+{
+ return -1 + PyArg_Parse(v, "l", &self->ob_spb.milliseconds);
+ return 0;
+}
+
+static PyObject *SPBObj_get_error(SPBObject *self, void *closure)
+{
+ return Py_BuildValue("h", self->ob_spb.error);
+}
+
+#define SPBObj_set_error NULL
+
+#define SPBObj_get_completionRoutine NULL
+
+static int SPBObj_set_completionRoutine(SPBObject *self, PyObject *v, void *closure)
+{
+ self->ob_spb.completionRoutine = NewSICompletionUPP(SPB_completion);
+ self->ob_completion = v;
+ Py_INCREF(v);
+ return 0;
+ return 0;
+}
+
+static PyGetSetDef SPBObj_getsetlist[] = {
+ {"inRefNum", (getter)SPBObj_get_inRefNum, (setter)SPBObj_set_inRefNum, NULL},
+ {"count", (getter)SPBObj_get_count, (setter)SPBObj_set_count, NULL},
+ {"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},
+};
+
+
#define SPBObj_compare NULL
#define SPBObj_repr NULL
@@ -452,14 +477,31 @@ static PyTypeObject SPB_Type = {
/* methods */
(destructor) SPBObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) SPBObj_getattr, /*tp_getattr*/
- (setattrfunc) SPBObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) SPBObj_compare, /*tp_compare*/
(reprfunc) SPBObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) SPBObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ SPBObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ SPBObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* ---------------------- End object type SPB ----------------------- */
diff --git a/Mac/Modules/snd/sndsupport.py b/Mac/Modules/snd/sndsupport.py
index 47c17cebe0..073f612ed9 100644
--- a/Mac/Modules/snd/sndsupport.py
+++ b/Mac/Modules/snd/sndsupport.py
@@ -211,7 +211,7 @@ SPB_interrupt(SPBPtr my_spb)
# create the module and object definition and link them
-class SndObjectDefinition(ObjectDefinition):
+class SndObjectDefinition(PEP252Mixin, ObjectDefinition):
def outputStructMembers(self):
ObjectDefinition.outputStructMembers(self)
@@ -237,7 +237,37 @@ class SndObjectDefinition(ObjectDefinition):
#
-class SpbObjectDefinition(ObjectDefinition):
+class SpbObjectDefinition(PEP252Mixin, ObjectDefinition):
+ getsetlist = [
+ (
+ 'inRefNum',
+ 'return Py_BuildValue("l", self->ob_spb.inRefNum);',
+ 'return -1 + PyArg_Parse(v, "l", &self->ob_spb.inRefNum);',
+ None,
+ ), (
+ 'count',
+ 'return Py_BuildValue("l", self->ob_spb.count);',
+ 'return -1 + PyArg_Parse(v, "l", &self->ob_spb.count);',
+ None
+ ), (
+ 'milliseconds',
+ 'return Py_BuildValue("l", self->ob_spb.milliseconds);',
+ 'return -1 + PyArg_Parse(v, "l", &self->ob_spb.milliseconds);',
+ None,
+ ), (
+ 'error',
+ 'return Py_BuildValue("h", self->ob_spb.error);',
+ None,
+ None
+ ), (
+ 'completionRoutine',
+ None,
+ """self->ob_spb.completionRoutine = NewSICompletionUPP(SPB_completion);
+ self->ob_completion = v;
+ Py_INCREF(v);
+ return 0;""",
+ None,
+ )]
def outputStructMembers(self):
Output("/* Members used to implement callbacks: */")
@@ -286,54 +316,6 @@ class SpbObjectDefinition(ObjectDefinition):
Output("*p_itself = &((%s *)v)->ob_spb;", self.objecttype)
Output("return 1;")
OutRbrace()
-
- def outputSetattr(self):
- Output()
- Output("static int %s_setattr(%s *self, char *name, PyObject *value)",
- self.prefix, self.objecttype)
- OutLbrace()
- self.outputSetattrBody()
- OutRbrace()
-
- def outputSetattrBody(self):
- Output("""
- int rv = 0;
-
- if (strcmp(name, "inRefNum") == 0)
- rv = PyArg_Parse(value, "l", &self->ob_spb.inRefNum);
- else if (strcmp(name, "count") == 0)
- rv = PyArg_Parse(value, "l", &self->ob_spb.count);
- else if (strcmp(name, "milliseconds") == 0)
- rv = PyArg_Parse(value, "l", &self->ob_spb.milliseconds);
- else if (strcmp(name, "buffer") == 0)
- rv = PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength);
- else if (strcmp(name, "completionRoutine") == 0) {
- self->ob_spb.completionRoutine = NewSICompletionUPP(SPB_completion);
- self->ob_completion = value;
- Py_INCREF(value);
- rv = 1;
-#if !TARGET_API_MAC_CARBON
- } else if (strcmp(name, "interruptRoutine") == 0) {
- self->ob_spb.completionRoutine = NewSIInterruptUPP(SPB_interrupt);
- self->ob_interrupt = value;
- Py_INCREF(value);
- rv = 1;
-#endif
- }
- if ( rv ) return 0;
- else return -1;""")
-
- def outputGetattrHook(self):
- Output("""
- if (strcmp(name, "inRefNum") == 0)
- return Py_BuildValue("l", self->ob_spb.inRefNum);
- else if (strcmp(name, "count") == 0)
- return Py_BuildValue("l", self->ob_spb.count);
- else if (strcmp(name, "milliseconds") == 0)
- return Py_BuildValue("l", self->ob_spb.milliseconds);
- else if (strcmp(name, "error") == 0)
- return Py_BuildValue("h", self->ob_spb.error);""")
-
sndobject = SndObjectDefinition('SndChannel', 'SndCh', 'SndChannelPtr')
diff --git a/Mac/Modules/te/_TEmodule.c b/Mac/Modules/te/_TEmodule.c
index 1788620da4..a89826b588 100644
--- a/Mac/Modules/te/_TEmodule.c
+++ b/Mac/Modules/te/_TEmodule.c
@@ -850,52 +850,137 @@ static PyMethodDef TEObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain TEObj_chain = { TEObj_methods, NULL };
-
-static PyObject *TEObj_getattr(TEObject *self, char *name)
-{
-
- if( strcmp(name, "destRect") == 0 )
- return Py_BuildValue("O&", PyMac_BuildRect,
- &(*self->ob_itself)->destRect);
- if( strcmp(name, "viewRect") == 0 )
- return Py_BuildValue("O&", PyMac_BuildRect,
- &(*self->ob_itself)->viewRect);
- if( strcmp(name, "selRect") == 0 )
- return Py_BuildValue("O&", PyMac_BuildRect,
- &(*self->ob_itself)->selRect);
- if( strcmp(name, "lineHeight") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->lineHeight);
- if( strcmp(name, "fontAscent") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->fontAscent);
- if( strcmp(name, "selPoint") == 0 )
- return Py_BuildValue("O&", PyMac_BuildPoint,
- (*self->ob_itself)->selPoint);
- if( strcmp(name, "selStart") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->selStart);
- if( strcmp(name, "selEnd") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->selEnd);
- if( strcmp(name, "active") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->active);
- if( strcmp(name, "just") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->just);
- if( strcmp(name, "teLength") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->teLength);
- if( strcmp(name, "txFont") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->txFont);
- if( strcmp(name, "txFace") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->txFace);
- if( strcmp(name, "txMode") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->txMode);
- if( strcmp(name, "txSize") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->txSize);
- if( strcmp(name, "nLines") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->nLines);
-
- return Py_FindMethodInChain(&TEObj_chain, (PyObject *)self, name);
-}
-
-#define TEObj_setattr NULL
+static PyObject *TEObj_get_destRect(TEObject *self, void *closure)
+{
+ return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->destRect);
+}
+
+#define TEObj_set_destRect NULL
+
+static PyObject *TEObj_get_viewRect(TEObject *self, void *closure)
+{
+ return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->viewRect);
+}
+
+#define TEObj_set_viewRect NULL
+
+static PyObject *TEObj_get_selRect(TEObject *self, void *closure)
+{
+ return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->selRect);
+}
+
+#define TEObj_set_selRect NULL
+
+static PyObject *TEObj_get_lineHeight(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->lineHeight);
+}
+
+#define TEObj_set_lineHeight NULL
+
+static PyObject *TEObj_get_fontAscent(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->fontAscent);
+}
+
+#define TEObj_set_fontAscent NULL
+
+static PyObject *TEObj_get_selPoint(TEObject *self, void *closure)
+{
+ return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->selPoint);
+}
+
+#define TEObj_set_selPoint NULL
+
+static PyObject *TEObj_get_selStart(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->selStart);
+}
+
+#define TEObj_set_selStart NULL
+
+static PyObject *TEObj_get_selEnd(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->selEnd);
+}
+
+#define TEObj_set_selEnd NULL
+
+static PyObject *TEObj_get_active(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->active);
+}
+
+#define TEObj_set_active NULL
+
+static PyObject *TEObj_get_just(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->just);
+}
+
+#define TEObj_set_just NULL
+
+static PyObject *TEObj_get_teLength(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->teLength);
+}
+
+#define TEObj_set_teLength NULL
+
+static PyObject *TEObj_get_txFont(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->txFont);
+}
+
+#define TEObj_set_txFont NULL
+
+static PyObject *TEObj_get_txFace(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->txFace);
+}
+
+#define TEObj_set_txFace NULL
+
+static PyObject *TEObj_get_txMode(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->txMode);
+}
+
+#define TEObj_set_txMode NULL
+
+static PyObject *TEObj_get_txSize(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->txSize);
+}
+
+#define TEObj_set_txSize NULL
+
+static PyObject *TEObj_get_nLines(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->nLines);
+}
+
+#define TEObj_set_nLines NULL
+
+static PyGetSetDef TEObj_getsetlist[] = {
+ {"destRect", (getter)TEObj_get_destRect, (setter)TEObj_set_destRect, "Destination rectangle"},
+ {"viewRect", (getter)TEObj_get_viewRect, (setter)TEObj_set_viewRect, "Viewing rectangle"},
+ {"selRect", (getter)TEObj_get_selRect, (setter)TEObj_set_selRect, "Selection rectangle"},
+ {"lineHeight", (getter)TEObj_get_lineHeight, (setter)TEObj_set_lineHeight, "Height of a line"},
+ {"fontAscent", (getter)TEObj_get_fontAscent, (setter)TEObj_set_fontAscent, "Ascent of a line"},
+ {"selPoint", (getter)TEObj_get_selPoint, (setter)TEObj_set_selPoint, "Selection Point"},
+ {"selStart", (getter)TEObj_get_selStart, (setter)TEObj_set_selStart, "Start of selection"},
+ {"selEnd", (getter)TEObj_get_selEnd, (setter)TEObj_set_selEnd, "End of selection"},
+ {"active", (getter)TEObj_get_active, (setter)TEObj_set_active, "TBD"},
+ {"just", (getter)TEObj_get_just, (setter)TEObj_set_just, "Justification"},
+ {"teLength", (getter)TEObj_get_teLength, (setter)TEObj_set_teLength, "TBD"},
+ {"txFont", (getter)TEObj_get_txFont, (setter)TEObj_set_txFont, "Current font"},
+ {"txFace", (getter)TEObj_get_txFace, (setter)TEObj_set_txFace, "Current font variant"},
+ {"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"},
+};
+
#define TEObj_compare NULL
@@ -912,14 +997,31 @@ PyTypeObject TE_Type = {
/* methods */
(destructor) TEObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) TEObj_getattr, /*tp_getattr*/
- (setattrfunc) TEObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) TEObj_compare, /*tp_compare*/
(reprfunc) TEObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) TEObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ TEObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ TEObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* ----------------------- End object type TE ----------------------- */
diff --git a/Mac/Modules/te/tesupport.py b/Mac/Modules/te/tesupport.py
index a77250c656..f11e7182b3 100644
--- a/Mac/Modules/te/tesupport.py
+++ b/Mac/Modules/te/tesupport.py
@@ -93,7 +93,91 @@ class TEMethodGenerator(OSErrWeakLinkMethodGenerator):
-class MyObjectDefinition(GlobalObjectDefinition):
+class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+ # Attributes that can be set.
+ getsetlist = [
+ (
+ 'destRect',
+ 'return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->destRect);',
+ None,
+ 'Destination rectangle'
+ ), (
+ 'viewRect',
+ 'return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->viewRect);',
+ None,
+ 'Viewing rectangle'
+ ), (
+ 'selRect',
+ 'return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->selRect);',
+ None,
+ 'Selection rectangle'
+ ), (
+ 'lineHeight',
+ 'return Py_BuildValue("h", (*self->ob_itself)->lineHeight);',
+ None,
+ 'Height of a line'
+ ), (
+ 'fontAscent',
+ 'return Py_BuildValue("h", (*self->ob_itself)->fontAscent);',
+ None,
+ 'Ascent of a line'
+ ), (
+ "selPoint",
+ 'return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->selPoint);',
+ None,
+ 'Selection Point'
+ ), (
+ 'selStart',
+ 'return Py_BuildValue("h", (*self->ob_itself)->selStart);',
+ None,
+ 'Start of selection'
+ ), (
+ 'selEnd',
+ 'return Py_BuildValue("h", (*self->ob_itself)->selEnd);',
+ None,
+ 'End of selection'
+ ), (
+ 'active',
+ 'return Py_BuildValue("h", (*self->ob_itself)->active);',
+ None,
+ 'TBD'
+ ), (
+ 'just',
+ 'return Py_BuildValue("h", (*self->ob_itself)->just);',
+ None,
+ 'Justification'
+ ), (
+ 'teLength',
+ 'return Py_BuildValue("h", (*self->ob_itself)->teLength);',
+ None,
+ 'TBD'
+ ), (
+ 'txFont',
+ 'return Py_BuildValue("h", (*self->ob_itself)->txFont);',
+ None,
+ 'Current font'
+ ), (
+ 'txFace',
+ 'return Py_BuildValue("h", (*self->ob_itself)->txFace);',
+ None,
+ 'Current font variant'
+ ), (
+ 'txMode',
+ 'return Py_BuildValue("h", (*self->ob_itself)->txMode);',
+ None,
+ 'Current text-drawing mode'
+ ), (
+ 'txSize',
+ 'return Py_BuildValue("h", (*self->ob_itself)->txSize);',
+ None,
+ 'Current font size'
+ ), (
+ 'nLines',
+ 'return Py_BuildValue("h", (*self->ob_itself)->nLines);',
+ None,
+ 'TBD'
+ )]
+
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(TE_Error,"Cannot create null TE");
@@ -102,45 +186,6 @@ class MyObjectDefinition(GlobalObjectDefinition):
def outputFreeIt(self, itselfname):
Output("TEDispose(%s);", itselfname)
- def outputGetattrHook(self):
- Output("""
- if( strcmp(name, "destRect") == 0 )
- return Py_BuildValue("O&", PyMac_BuildRect,
- &(*self->ob_itself)->destRect);
- if( strcmp(name, "viewRect") == 0 )
- return Py_BuildValue("O&", PyMac_BuildRect,
- &(*self->ob_itself)->viewRect);
- if( strcmp(name, "selRect") == 0 )
- return Py_BuildValue("O&", PyMac_BuildRect,
- &(*self->ob_itself)->selRect);
- if( strcmp(name, "lineHeight") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->lineHeight);
- if( strcmp(name, "fontAscent") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->fontAscent);
- if( strcmp(name, "selPoint") == 0 )
- return Py_BuildValue("O&", PyMac_BuildPoint,
- (*self->ob_itself)->selPoint);
- if( strcmp(name, "selStart") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->selStart);
- if( strcmp(name, "selEnd") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->selEnd);
- if( strcmp(name, "active") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->active);
- if( strcmp(name, "just") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->just);
- if( strcmp(name, "teLength") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->teLength);
- if( strcmp(name, "txFont") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->txFont);
- if( strcmp(name, "txFace") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->txFace);
- if( strcmp(name, "txMode") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->txMode);
- if( strcmp(name, "txSize") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->txSize);
- if( strcmp(name, "nLines") == 0 )
- return Py_BuildValue("h", (*self->ob_itself)->nLines);
- """)
# From here on it's basically all boiler plate...
diff --git a/Mac/Modules/waste/wastemodule.c b/Mac/Modules/waste/wastemodule.c
index e50107452c..93f8aa5ed2 100644
--- a/Mac/Modules/waste/wastemodule.c
+++ b/Mac/Modules/waste/wastemodule.c
@@ -384,14 +384,7 @@ static PyMethodDef WEOObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain WEOObj_chain = { WEOObj_methods, NULL };
-
-static PyObject *WEOObj_getattr(WEOObject *self, char *name)
-{
- return Py_FindMethodInChain(&WEOObj_chain, (PyObject *)self, name);
-}
-
-#define WEOObj_setattr NULL
+#define WEOObj_getsetlist NULL
#define WEOObj_compare NULL
@@ -408,14 +401,31 @@ PyTypeObject WEO_Type = {
/* methods */
(destructor) WEOObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) WEOObj_getattr, /*tp_getattr*/
- (setattrfunc) WEOObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) WEOObj_compare, /*tp_compare*/
(reprfunc) WEOObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) WEOObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ WEOObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ WEOObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* ---------------------- End object type WEO ----------------------- */
@@ -2096,14 +2106,7 @@ static PyMethodDef wasteObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain wasteObj_chain = { wasteObj_methods, NULL };
-
-static PyObject *wasteObj_getattr(wasteObject *self, char *name)
-{
- return Py_FindMethodInChain(&wasteObj_chain, (PyObject *)self, name);
-}
-
-#define wasteObj_setattr NULL
+#define wasteObj_getsetlist NULL
#define wasteObj_compare NULL
@@ -2120,14 +2123,31 @@ PyTypeObject waste_Type = {
/* methods */
(destructor) wasteObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) wasteObj_getattr, /*tp_getattr*/
- (setattrfunc) wasteObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) wasteObj_compare, /*tp_compare*/
(reprfunc) wasteObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) wasteObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ wasteObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ wasteObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* --------------------- End object type waste ---------------------- */
diff --git a/Mac/Modules/waste/wastesupport.py b/Mac/Modules/waste/wastesupport.py
index 674f9f94f0..b9c1bfbf93 100644
--- a/Mac/Modules/waste/wastesupport.py
+++ b/Mac/Modules/waste/wastesupport.py
@@ -277,7 +277,7 @@ class WEMethodGenerator(OSErrMethodGenerator):
-class WEObjectDefinition(GlobalObjectDefinition):
+class WEObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(waste_Error,"Cannot create null WE");
@@ -289,7 +289,7 @@ class WEObjectDefinition(GlobalObjectDefinition):
def outputFreeIt(self, itselfname):
Output("WEDispose(%s);", itselfname)
-class WEOObjectDefinition(GlobalObjectDefinition):
+class WEOObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
Py_INCREF(Py_None);
diff --git a/Mac/Modules/win/_Winmodule.c b/Mac/Modules/win/_Winmodule.c
index 0685c260c0..60ff824839 100644
--- a/Mac/Modules/win/_Winmodule.c
+++ b/Mac/Modules/win/_Winmodule.c
@@ -2926,14 +2926,7 @@ static PyMethodDef WinObj_methods[] = {
{NULL, NULL, 0}
};
-PyMethodChain WinObj_chain = { WinObj_methods, NULL };
-
-static PyObject *WinObj_getattr(WindowObject *self, char *name)
-{
- return Py_FindMethodInChain(&WinObj_chain, (PyObject *)self, name);
-}
-
-#define WinObj_setattr NULL
+#define WinObj_getsetlist NULL
static int WinObj_compare(WindowObject *self, WindowObject *other)
{
@@ -2963,14 +2956,31 @@ PyTypeObject Window_Type = {
/* methods */
(destructor) WinObj_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc) WinObj_getattr, /*tp_getattr*/
- (setattrfunc) WinObj_setattr, /*tp_setattr*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
(cmpfunc) WinObj_compare, /*tp_compare*/
(reprfunc) WinObj_repr, /*tp_repr*/
(PyNumberMethods *)0, /* tp_as_number */
(PySequenceMethods *)0, /* tp_as_sequence */
(PyMappingMethods *)0, /* tp_as_mapping */
(hashfunc) WinObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 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*/
+ WinObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ WinObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
};
/* --------------------- End object type Window --------------------- */
diff --git a/Mac/Modules/win/winsupport.py b/Mac/Modules/win/winsupport.py
index bcd5119bc9..ba7fe14f06 100644
--- a/Mac/Modules/win/winsupport.py
+++ b/Mac/Modules/win/winsupport.py
@@ -128,7 +128,7 @@ initstuff = initstuff + """
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WindowPtr, WinObj_Convert);
"""
-class MyObjectDefinition(GlobalObjectDefinition):
+class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
def outputStructMembers(self):