Skip to content

Commit

Permalink
Updated (and regenerated) for name change in tp_init method arguments:
Browse files Browse the repository at this point in the history
they are now _self, _args and _kwds.
  • Loading branch information
jackjansen committed Jul 3, 2005
1 parent a6af76c commit 918a9e2
Show file tree
Hide file tree
Showing 29 changed files with 1,802 additions and 1,791 deletions.
125 changes: 63 additions & 62 deletions Mac/Modules/ae/_AEmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ AEEventHandlerUPP upp_GenericEventHandler;

static pascal Boolean AEIdleProc(EventRecord *theEvent, long *sleepTime, RgnHandle *mouseRgn)
{
if ( PyOS_InterruptOccurred() )
return 1;
return 0;
if ( PyOS_InterruptOccurred() )
return 1;
return 0;
}

AEIdleUPP upp_AEIdleProc;
Expand Down Expand Up @@ -64,6 +64,7 @@ PyObject *AEDesc_New(AEDesc *itself)
it->ob_owned = 1;
return (PyObject *)it;
}

int AEDesc_Convert(PyObject *v, AEDesc *p_itself)
{
if (!AEDesc_Check(v))
Expand Down Expand Up @@ -829,20 +830,20 @@ static PyObject *AEDesc_get_type(AEDescObject *self, void *closure)
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;
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_set_data NULL
Expand All @@ -863,16 +864,16 @@ static PyGetSetDef AEDesc_getsetlist[] = {

#define AEDesc_tp_alloc PyType_GenericAlloc

static PyObject *AEDesc_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static PyObject *AEDesc_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
{
PyObject *self;
PyObject *_self;
AEDesc itself;
char *kw[] = {"itself", 0};

if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, AEDesc_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((AEDescObject *)self)->ob_itself = itself;
return self;
if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, AEDesc_Convert, &itself)) return NULL;
if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
((AEDescObject *)_self)->ob_itself = itself;
return _self;
}

#define AEDesc_tp_free PyObject_Del
Expand Down Expand Up @@ -1383,44 +1384,44 @@ static PyMethodDef AE_methods[] = {
static pascal OSErr
GenericEventHandler(const AppleEvent *request, AppleEvent *reply, refcontype refcon)
{
PyObject *handler = (PyObject *)refcon;
AEDescObject *requestObject, *replyObject;
PyObject *args, *res;
if ((requestObject = (AEDescObject *)AEDesc_New((AppleEvent *)request)) == NULL) {
return -1;
}
if ((replyObject = (AEDescObject *)AEDesc_New(reply)) == NULL) {
Py_DECREF(requestObject);
return -1;
}
if ((args = Py_BuildValue("OO", requestObject, replyObject)) == NULL) {
Py_DECREF(requestObject);
Py_DECREF(replyObject);
return -1;
}
res = PyEval_CallObject(handler, args);
requestObject->ob_itself.descriptorType = 'null';
requestObject->ob_itself.dataHandle = NULL;
replyObject->ob_itself.descriptorType = 'null';
replyObject->ob_itself.dataHandle = NULL;
Py_DECREF(args);
if (res == NULL) {
PySys_WriteStderr("Exception in AE event handler function\n");
PyErr_Print();
return -1;
}
Py_DECREF(res);
return noErr;
PyObject *handler = (PyObject *)refcon;
AEDescObject *requestObject, *replyObject;
PyObject *args, *res;
if ((requestObject = (AEDescObject *)AEDesc_New((AppleEvent *)request)) == NULL) {
return -1;
}
if ((replyObject = (AEDescObject *)AEDesc_New(reply)) == NULL) {
Py_DECREF(requestObject);
return -1;
}
if ((args = Py_BuildValue("OO", requestObject, replyObject)) == NULL) {
Py_DECREF(requestObject);
Py_DECREF(replyObject);
return -1;
}
res = PyEval_CallObject(handler, args);
requestObject->ob_itself.descriptorType = 'null';
requestObject->ob_itself.dataHandle = NULL;
replyObject->ob_itself.descriptorType = 'null';
replyObject->ob_itself.dataHandle = NULL;
Py_DECREF(args);
if (res == NULL) {
PySys_WriteStderr("Exception in AE event handler function\n");
PyErr_Print();
return -1;
}
Py_DECREF(res);
return noErr;
}

PyObject *AEDesc_NewBorrowed(AEDesc *itself)
{
PyObject *it;
it = AEDesc_New(itself);
if (it)
((AEDescObject *)it)->ob_owned = 0;
return (PyObject *)it;
PyObject *it;

it = AEDesc_New(itself);
if (it)
((AEDescObject *)it)->ob_owned = 0;
return (PyObject *)it;
}


Expand All @@ -1432,11 +1433,11 @@ void init_AE(void)



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


m = Py_InitModule("_AE", AE_methods);
Expand Down
15 changes: 8 additions & 7 deletions Mac/Modules/app/_Appmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

int ThemeButtonDrawInfo_Convert(PyObject *v, ThemeButtonDrawInfo *p_itself)
{
return PyArg_Parse(v, "(iHH)", &p_itself->state, &p_itself->value, &p_itself->adornment);
return PyArg_Parse(v, "(iHH)", &p_itself->state, &p_itself->value, &p_itself->adornment);
}


Expand All @@ -45,6 +45,7 @@ PyObject *ThemeDrawingStateObj_New(ThemeDrawingState itself)
it->ob_itself = itself;
return (PyObject *)it;
}

int ThemeDrawingStateObj_Convert(PyObject *v, ThemeDrawingState *p_itself)
{
if (!ThemeDrawingStateObj_Check(v))
Expand Down Expand Up @@ -115,16 +116,16 @@ static PyMethodDef ThemeDrawingStateObj_methods[] = {

#define ThemeDrawingStateObj_tp_alloc PyType_GenericAlloc

static PyObject *ThemeDrawingStateObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static PyObject *ThemeDrawingStateObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
{
PyObject *self;
PyObject *_self;
ThemeDrawingState itself;
char *kw[] = {"itself", 0};

if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, ThemeDrawingStateObj_Convert, &itself)) return NULL;
if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
((ThemeDrawingStateObject *)self)->ob_itself = itself;
return self;
if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, ThemeDrawingStateObj_Convert, &itself)) return NULL;
if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
((ThemeDrawingStateObject *)_self)->ob_itself = itself;
return _self;
}

#define ThemeDrawingStateObj_tp_free PyObject_Del
Expand Down
Loading

0 comments on commit 918a9e2

Please sign in to comment.