Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Mac/Modules/drag/_Dragmodule.c

    r2 r391  
    1111/* Macro to test whether a weak-loaded CFM function exists */
    1212#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
    13         PyErr_SetString(PyExc_NotImplementedError, \
    14         "Not available in this shared library/OS version"); \
    15         return NULL; \
     13    PyErr_SetString(PyExc_NotImplementedError, \
     14    "Not available in this shared library/OS version"); \
     15    return NULL; \
    1616    }} while(0)
    1717
     
    4545
    4646typedef struct DragObjObject {
    47         PyObject_HEAD
    48         DragRef ob_itself;
    49         PyObject *sendproc;
     47    PyObject_HEAD
     48    DragRef ob_itself;
     49    PyObject *sendproc;
    5050} DragObjObject;
    5151
    5252PyObject *DragObj_New(DragRef itself)
    5353{
    54         DragObjObject *it;
    55         if (itself == NULL) {
    56                                         PyErr_SetString(Drag_Error,"Cannot create null Drag");
    57                                         return NULL;
    58                                 }
    59         it = PyObject_NEW(DragObjObject, &DragObj_Type);
    60         if (it == NULL) return NULL;
    61         it->ob_itself = itself;
    62         it->sendproc = NULL;
    63         return (PyObject *)it;
     54    DragObjObject *it;
     55    if (itself == NULL) {
     56                                    PyErr_SetString(Drag_Error,"Cannot create null Drag");
     57                                    return NULL;
     58                            }
     59    it = PyObject_NEW(DragObjObject, &DragObj_Type);
     60    if (it == NULL) return NULL;
     61    it->ob_itself = itself;
     62    it->sendproc = NULL;
     63    return (PyObject *)it;
    6464}
    6565
    6666int DragObj_Convert(PyObject *v, DragRef *p_itself)
    6767{
    68         if (!DragObj_Check(v))
    69         {
    70                 PyErr_SetString(PyExc_TypeError, "DragObj required");
    71                 return 0;
    72         }
    73         *p_itself = ((DragObjObject *)v)->ob_itself;
    74         return 1;
     68    if (!DragObj_Check(v))
     69    {
     70        PyErr_SetString(PyExc_TypeError, "DragObj required");
     71        return 0;
     72    }
     73    *p_itself = ((DragObjObject *)v)->ob_itself;
     74    return 1;
    7575}
    7676
    7777static void DragObj_dealloc(DragObjObject *self)
    7878{
    79         Py_XDECREF(self->sendproc);
    80         self->ob_type->tp_free((PyObject *)self);
     79    Py_XDECREF(self->sendproc);
     80    self->ob_type->tp_free((PyObject *)self);
    8181}
    8282
    8383static PyObject *DragObj_DisposeDrag(DragObjObject *_self, PyObject *_args)
    8484{
    85         PyObject *_res = NULL;
    86         OSErr _err;
     85    PyObject *_res = NULL;
     86    OSErr _err;
    8787#ifndef DisposeDrag
    88         PyMac_PRECHECK(DisposeDrag);
    89 #endif
    90         if (!PyArg_ParseTuple(_args, ""))
    91                 return NULL;
    92         _err = DisposeDrag(_self->ob_itself);
    93         if (_err != noErr) return PyMac_Error(_err);
    94         Py_INCREF(Py_None);
    95         _res = Py_None;
    96         return _res;
     88    PyMac_PRECHECK(DisposeDrag);
     89#endif
     90    if (!PyArg_ParseTuple(_args, ""))
     91        return NULL;
     92    _err = DisposeDrag(_self->ob_itself);
     93    if (_err != noErr) return PyMac_Error(_err);
     94    Py_INCREF(Py_None);
     95    _res = Py_None;
     96    return _res;
    9797}
    9898
    9999static PyObject *DragObj_AddDragItemFlavor(DragObjObject *_self, PyObject *_args)
    100100{
    101         PyObject *_res = NULL;
    102         OSErr _err;
    103         ItemReference theItemRef;
    104         FlavorType theType;
    105         char *dataPtr__in__;
    106         long dataPtr__len__;
    107         int dataPtr__in_len__;
    108         FlavorFlags theFlags;
     101    PyObject *_res = NULL;
     102    OSErr _err;
     103    ItemReference theItemRef;
     104    FlavorType theType;
     105    char *dataPtr__in__;
     106    long dataPtr__len__;
     107    int dataPtr__in_len__;
     108    FlavorFlags theFlags;
    109109#ifndef AddDragItemFlavor
    110         PyMac_PRECHECK(AddDragItemFlavor);
    111 #endif
    112         if (!PyArg_ParseTuple(_args, "lO&z#l",
    113                               &theItemRef,
    114                               PyMac_GetOSType, &theType,
    115                               &dataPtr__in__, &dataPtr__in_len__,
    116                               &theFlags))
    117                 return NULL;
    118         dataPtr__len__ = dataPtr__in_len__;
    119         _err = AddDragItemFlavor(_self->ob_itself,
    120                                  theItemRef,
    121                                  theType,
    122                                  dataPtr__in__, dataPtr__len__,
    123                                  theFlags);
    124         if (_err != noErr) return PyMac_Error(_err);
    125         Py_INCREF(Py_None);
    126         _res = Py_None;
    127         return _res;
     110    PyMac_PRECHECK(AddDragItemFlavor);
     111#endif
     112    if (!PyArg_ParseTuple(_args, "lO&z#l",
     113                          &theItemRef,
     114                          PyMac_GetOSType, &theType,
     115                          &dataPtr__in__, &dataPtr__in_len__,
     116                          &theFlags))
     117        return NULL;
     118    dataPtr__len__ = dataPtr__in_len__;
     119    _err = AddDragItemFlavor(_self->ob_itself,
     120                             theItemRef,
     121                             theType,
     122                             dataPtr__in__, dataPtr__len__,
     123                             theFlags);
     124    if (_err != noErr) return PyMac_Error(_err);
     125    Py_INCREF(Py_None);
     126    _res = Py_None;
     127    return _res;
    128128}
    129129
    130130static PyObject *DragObj_SetDragItemFlavorData(DragObjObject *_self, PyObject *_args)
    131131{
    132         PyObject *_res = NULL;
    133         OSErr _err;
    134         ItemReference theItemRef;
    135         FlavorType theType;
    136         char *dataPtr__in__;
    137         long dataPtr__len__;
    138         int dataPtr__in_len__;
    139         UInt32 dataOffset;
     132    PyObject *_res = NULL;
     133    OSErr _err;
     134    ItemReference theItemRef;
     135    FlavorType theType;
     136    char *dataPtr__in__;
     137    long dataPtr__len__;
     138    int dataPtr__in_len__;
     139    UInt32 dataOffset;
    140140#ifndef SetDragItemFlavorData
    141         PyMac_PRECHECK(SetDragItemFlavorData);
    142 #endif
    143         if (!PyArg_ParseTuple(_args, "lO&z#l",
    144                               &theItemRef,
    145                               PyMac_GetOSType, &theType,
    146                               &dataPtr__in__, &dataPtr__in_len__,
    147                               &dataOffset))
    148                 return NULL;
    149         dataPtr__len__ = dataPtr__in_len__;
    150         _err = SetDragItemFlavorData(_self->ob_itself,
    151                                      theItemRef,
    152                                      theType,
    153                                      dataPtr__in__, dataPtr__len__,
    154                                      dataOffset);
    155         if (_err != noErr) return PyMac_Error(_err);
    156         Py_INCREF(Py_None);
    157         _res = Py_None;
    158         return _res;
     141    PyMac_PRECHECK(SetDragItemFlavorData);
     142#endif
     143    if (!PyArg_ParseTuple(_args, "lO&z#l",
     144                          &theItemRef,
     145                          PyMac_GetOSType, &theType,
     146                          &dataPtr__in__, &dataPtr__in_len__,
     147                          &dataOffset))
     148        return NULL;
     149    dataPtr__len__ = dataPtr__in_len__;
     150    _err = SetDragItemFlavorData(_self->ob_itself,
     151                                 theItemRef,
     152                                 theType,
     153                                 dataPtr__in__, dataPtr__len__,
     154                                 dataOffset);
     155    if (_err != noErr) return PyMac_Error(_err);
     156    Py_INCREF(Py_None);
     157    _res = Py_None;
     158    return _res;
    159159}
    160160
    161161static PyObject *DragObj_SetDragImage(DragObjObject *_self, PyObject *_args)
    162162{
    163         PyObject *_res = NULL;
    164         OSErr _err;
    165         PixMapHandle imagePixMap;
    166         RgnHandle imageRgn;
    167         Point imageOffsetPt;
    168         DragImageFlags theImageFlags;
     163    PyObject *_res = NULL;
     164    OSErr _err;
     165    PixMapHandle imagePixMap;
     166    RgnHandle imageRgn;
     167    Point imageOffsetPt;
     168    DragImageFlags theImageFlags;
    169169#ifndef SetDragImage
    170         PyMac_PRECHECK(SetDragImage);
    171 #endif
    172         if (!PyArg_ParseTuple(_args, "O&O&O&l",
    173                               ResObj_Convert, &imagePixMap,
    174                               ResObj_Convert, &imageRgn,
    175                               PyMac_GetPoint, &imageOffsetPt,
    176                               &theImageFlags))
    177                 return NULL;
    178         _err = SetDragImage(_self->ob_itself,
    179                             imagePixMap,
    180                             imageRgn,
    181                             imageOffsetPt,
    182                             theImageFlags);
    183         if (_err != noErr) return PyMac_Error(_err);
    184         Py_INCREF(Py_None);
    185         _res = Py_None;
    186         return _res;
     170    PyMac_PRECHECK(SetDragImage);
     171#endif
     172    if (!PyArg_ParseTuple(_args, "O&O&O&l",
     173                          ResObj_Convert, &imagePixMap,
     174                          ResObj_Convert, &imageRgn,
     175                          PyMac_GetPoint, &imageOffsetPt,
     176                          &theImageFlags))
     177        return NULL;
     178    _err = SetDragImage(_self->ob_itself,
     179                        imagePixMap,
     180                        imageRgn,
     181                        imageOffsetPt,
     182                        theImageFlags);
     183    if (_err != noErr) return PyMac_Error(_err);
     184    Py_INCREF(Py_None);
     185    _res = Py_None;
     186    return _res;
    187187}
    188188
    189189static PyObject *DragObj_ChangeDragBehaviors(DragObjObject *_self, PyObject *_args)
    190190{
    191         PyObject *_res = NULL;
    192         OSErr _err;
    193         DragBehaviors inBehaviorsToSet;
    194         DragBehaviors inBehaviorsToClear;
     191    PyObject *_res = NULL;
     192    OSErr _err;
     193    DragBehaviors inBehaviorsToSet;
     194    DragBehaviors inBehaviorsToClear;
    195195#ifndef ChangeDragBehaviors
    196         PyMac_PRECHECK(ChangeDragBehaviors);
    197 #endif
    198         if (!PyArg_ParseTuple(_args, "ll",
    199                               &inBehaviorsToSet,
    200                               &inBehaviorsToClear))
    201                 return NULL;
    202         _err = ChangeDragBehaviors(_self->ob_itself,
    203                                    inBehaviorsToSet,
    204                                    inBehaviorsToClear);
    205         if (_err != noErr) return PyMac_Error(_err);
    206         Py_INCREF(Py_None);
    207         _res = Py_None;
    208         return _res;
     196    PyMac_PRECHECK(ChangeDragBehaviors);
     197#endif
     198    if (!PyArg_ParseTuple(_args, "ll",
     199                          &inBehaviorsToSet,
     200                          &inBehaviorsToClear))
     201        return NULL;
     202    _err = ChangeDragBehaviors(_self->ob_itself,
     203                               inBehaviorsToSet,
     204                               inBehaviorsToClear);
     205    if (_err != noErr) return PyMac_Error(_err);
     206    Py_INCREF(Py_None);
     207    _res = Py_None;
     208    return _res;
    209209}
    210210
    211211static PyObject *DragObj_TrackDrag(DragObjObject *_self, PyObject *_args)
    212212{
    213         PyObject *_res = NULL;
    214         OSErr _err;
    215         EventRecord theEvent;
    216         RgnHandle theRegion;
     213    PyObject *_res = NULL;
     214    OSErr _err;
     215    EventRecord theEvent;
     216    RgnHandle theRegion;
    217217#ifndef TrackDrag
    218         PyMac_PRECHECK(TrackDrag);
    219 #endif
    220         if (!PyArg_ParseTuple(_args, "O&O&",
    221                               PyMac_GetEventRecord, &theEvent,
    222                               ResObj_Convert, &theRegion))
    223                 return NULL;
    224         _err = TrackDrag(_self->ob_itself,
    225                          &theEvent,
    226                          theRegion);
    227         if (_err != noErr) return PyMac_Error(_err);
    228         Py_INCREF(Py_None);
    229         _res = Py_None;
    230         return _res;
     218    PyMac_PRECHECK(TrackDrag);
     219#endif
     220    if (!PyArg_ParseTuple(_args, "O&O&",
     221                          PyMac_GetEventRecord, &theEvent,
     222                          ResObj_Convert, &theRegion))
     223        return NULL;
     224    _err = TrackDrag(_self->ob_itself,
     225                     &theEvent,
     226                     theRegion);
     227    if (_err != noErr) return PyMac_Error(_err);
     228    Py_INCREF(Py_None);
     229    _res = Py_None;
     230    return _res;
    231231}
    232232
    233233static PyObject *DragObj_CountDragItems(DragObjObject *_self, PyObject *_args)
    234234{
    235         PyObject *_res = NULL;
    236         OSErr _err;
    237         UInt16 numItems;
     235    PyObject *_res = NULL;
     236    OSErr _err;
     237    UInt16 numItems;
    238238#ifndef CountDragItems
    239         PyMac_PRECHECK(CountDragItems);
    240 #endif
    241         if (!PyArg_ParseTuple(_args, ""))
    242                 return NULL;
    243         _err = CountDragItems(_self->ob_itself,
    244                               &numItems);
    245         if (_err != noErr) return PyMac_Error(_err);
    246         _res = Py_BuildValue("H",
    247                              numItems);
    248         return _res;
     239    PyMac_PRECHECK(CountDragItems);
     240#endif
     241    if (!PyArg_ParseTuple(_args, ""))
     242        return NULL;
     243    _err = CountDragItems(_self->ob_itself,
     244                          &numItems);
     245    if (_err != noErr) return PyMac_Error(_err);
     246    _res = Py_BuildValue("H",
     247                         numItems);
     248    return _res;
    249249}
    250250
    251251static PyObject *DragObj_GetDragItemReferenceNumber(DragObjObject *_self, PyObject *_args)
    252252{
    253         PyObject *_res = NULL;
    254         OSErr _err;
    255         UInt16 index;
    256         ItemReference theItemRef;
     253    PyObject *_res = NULL;
     254    OSErr _err;
     255    UInt16 index;
     256    ItemReference theItemRef;
    257257#ifndef GetDragItemReferenceNumber
    258         PyMac_PRECHECK(GetDragItemReferenceNumber);
    259 #endif
    260         if (!PyArg_ParseTuple(_args, "H",
    261                               &index))
    262                 return NULL;
    263         _err = GetDragItemReferenceNumber(_self->ob_itself,
    264                                           index,
    265                                           &theItemRef);
    266         if (_err != noErr) return PyMac_Error(_err);
    267         _res = Py_BuildValue("l",
    268                              theItemRef);
    269         return _res;
     258    PyMac_PRECHECK(GetDragItemReferenceNumber);
     259#endif
     260    if (!PyArg_ParseTuple(_args, "H",
     261                          &index))
     262        return NULL;
     263    _err = GetDragItemReferenceNumber(_self->ob_itself,
     264                                      index,
     265                                      &theItemRef);
     266    if (_err != noErr) return PyMac_Error(_err);
     267    _res = Py_BuildValue("l",
     268                         theItemRef);
     269    return _res;
    270270}
    271271
    272272static PyObject *DragObj_CountDragItemFlavors(DragObjObject *_self, PyObject *_args)
    273273{
    274         PyObject *_res = NULL;
    275         OSErr _err;
    276         ItemReference theItemRef;
    277         UInt16 numFlavors;
     274    PyObject *_res = NULL;
     275    OSErr _err;
     276    ItemReference theItemRef;
     277    UInt16 numFlavors;
    278278#ifndef CountDragItemFlavors
    279         PyMac_PRECHECK(CountDragItemFlavors);
    280 #endif
    281         if (!PyArg_ParseTuple(_args, "l",
    282                               &theItemRef))
    283                 return NULL;
    284         _err = CountDragItemFlavors(_self->ob_itself,
    285                                     theItemRef,
    286                                     &numFlavors);
    287         if (_err != noErr) return PyMac_Error(_err);
    288         _res = Py_BuildValue("H",
    289                              numFlavors);
    290         return _res;
     279    PyMac_PRECHECK(CountDragItemFlavors);
     280#endif
     281    if (!PyArg_ParseTuple(_args, "l",
     282                          &theItemRef))
     283        return NULL;
     284    _err = CountDragItemFlavors(_self->ob_itself,
     285                                theItemRef,
     286                                &numFlavors);
     287    if (_err != noErr) return PyMac_Error(_err);
     288    _res = Py_BuildValue("H",
     289                         numFlavors);
     290    return _res;
    291291}
    292292
    293293static PyObject *DragObj_GetFlavorType(DragObjObject *_self, PyObject *_args)
    294294{
    295         PyObject *_res = NULL;
    296         OSErr _err;
    297         ItemReference theItemRef;
    298         UInt16 index;
    299         FlavorType theType;
     295    PyObject *_res = NULL;
     296    OSErr _err;
     297    ItemReference theItemRef;
     298    UInt16 index;
     299    FlavorType theType;
    300300#ifndef GetFlavorType
    301         PyMac_PRECHECK(GetFlavorType);
    302 #endif
    303         if (!PyArg_ParseTuple(_args, "lH",
    304                               &theItemRef,
    305                               &index))
    306                 return NULL;
    307         _err = GetFlavorType(_self->ob_itself,
    308                              theItemRef,
    309                              index,
    310                              &theType);
    311         if (_err != noErr) return PyMac_Error(_err);
    312         _res = Py_BuildValue("O&",
    313                              PyMac_BuildOSType, theType);
    314         return _res;
     301    PyMac_PRECHECK(GetFlavorType);
     302#endif
     303    if (!PyArg_ParseTuple(_args, "lH",
     304                          &theItemRef,
     305                          &index))
     306        return NULL;
     307    _err = GetFlavorType(_self->ob_itself,
     308                         theItemRef,
     309                         index,
     310                         &theType);
     311    if (_err != noErr) return PyMac_Error(_err);
     312    _res = Py_BuildValue("O&",
     313                         PyMac_BuildOSType, theType);
     314    return _res;
    315315}
    316316
    317317static PyObject *DragObj_GetFlavorFlags(DragObjObject *_self, PyObject *_args)
    318318{
    319         PyObject *_res = NULL;
    320         OSErr _err;
    321         ItemReference theItemRef;
    322         FlavorType theType;
    323         FlavorFlags theFlags;
     319    PyObject *_res = NULL;
     320    OSErr _err;
     321    ItemReference theItemRef;
     322    FlavorType theType;
     323    FlavorFlags theFlags;
    324324#ifndef GetFlavorFlags
    325         PyMac_PRECHECK(GetFlavorFlags);
    326 #endif
    327         if (!PyArg_ParseTuple(_args, "lO&",
    328                               &theItemRef,
    329                               PyMac_GetOSType, &theType))
    330                 return NULL;
    331         _err = GetFlavorFlags(_self->ob_itself,
    332                               theItemRef,
    333                               theType,
    334                               &theFlags);
    335         if (_err != noErr) return PyMac_Error(_err);
    336         _res = Py_BuildValue("l",
    337                              theFlags);
    338         return _res;
     325    PyMac_PRECHECK(GetFlavorFlags);
     326#endif
     327    if (!PyArg_ParseTuple(_args, "lO&",
     328                          &theItemRef,
     329                          PyMac_GetOSType, &theType))
     330        return NULL;
     331    _err = GetFlavorFlags(_self->ob_itself,
     332                          theItemRef,
     333                          theType,
     334                          &theFlags);
     335    if (_err != noErr) return PyMac_Error(_err);
     336    _res = Py_BuildValue("l",
     337                         theFlags);
     338    return _res;
    339339}
    340340
    341341static PyObject *DragObj_GetFlavorDataSize(DragObjObject *_self, PyObject *_args)
    342342{
    343         PyObject *_res = NULL;
    344         OSErr _err;
    345         ItemReference theItemRef;
    346         FlavorType theType;
    347         Size dataSize;
     343    PyObject *_res = NULL;
     344    OSErr _err;
     345    ItemReference theItemRef;
     346    FlavorType theType;
     347    Size dataSize;
    348348#ifndef GetFlavorDataSize
    349         PyMac_PRECHECK(GetFlavorDataSize);
    350 #endif
    351         if (!PyArg_ParseTuple(_args, "lO&",
    352                               &theItemRef,
    353                               PyMac_GetOSType, &theType))
    354                 return NULL;
    355         _err = GetFlavorDataSize(_self->ob_itself,
    356                                  theItemRef,
    357                                  theType,
    358                                  &dataSize);
    359         if (_err != noErr) return PyMac_Error(_err);
    360         _res = Py_BuildValue("l",
    361                              dataSize);
    362         return _res;
     349    PyMac_PRECHECK(GetFlavorDataSize);
     350#endif
     351    if (!PyArg_ParseTuple(_args, "lO&",
     352                          &theItemRef,
     353                          PyMac_GetOSType, &theType))
     354        return NULL;
     355    _err = GetFlavorDataSize(_self->ob_itself,
     356                             theItemRef,
     357                             theType,
     358                             &dataSize);
     359    if (_err != noErr) return PyMac_Error(_err);
     360    _res = Py_BuildValue("l",
     361                         dataSize);
     362    return _res;
    363363}
    364364
    365365static PyObject *DragObj_GetFlavorData(DragObjObject *_self, PyObject *_args)
    366366{
    367         PyObject *_res = NULL;
    368         OSErr _err;
    369         ItemReference theItemRef;
    370         FlavorType theType;
    371         char *dataPtr__out__;
    372         long dataPtr__len__;
    373         int dataPtr__in_len__;
    374         UInt32 dataOffset;
     367    PyObject *_res = NULL;
     368    OSErr _err;
     369    ItemReference theItemRef;
     370    FlavorType theType;
     371    char *dataPtr__out__;
     372    long dataPtr__len__;
     373    int dataPtr__in_len__;
     374    UInt32 dataOffset;
    375375#ifndef GetFlavorData
    376         PyMac_PRECHECK(GetFlavorData);
    377 #endif
    378         if (!PyArg_ParseTuple(_args, "lO&il",
    379                               &theItemRef,
    380                               PyMac_GetOSType, &theType,
    381                               &dataPtr__in_len__,
    382                               &dataOffset))
    383                 return NULL;
    384         if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL)
    385         {
    386                 PyErr_NoMemory();
    387                 goto dataPtr__error__;
    388         }
    389         dataPtr__len__ = dataPtr__in_len__;
    390         _err = GetFlavorData(_self->ob_itself,
    391                              theItemRef,
    392                              theType,
    393                              dataPtr__out__, &dataPtr__len__,
    394                              dataOffset);
    395         if (_err != noErr) return PyMac_Error(_err);
    396         _res = Py_BuildValue("s#",
    397                              dataPtr__out__, (int)dataPtr__len__);
    398         free(dataPtr__out__);
     376    PyMac_PRECHECK(GetFlavorData);
     377#endif
     378    if (!PyArg_ParseTuple(_args, "lO&il",
     379                          &theItemRef,
     380                          PyMac_GetOSType, &theType,
     381                          &dataPtr__in_len__,
     382                          &dataOffset))
     383        return NULL;
     384    if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL)
     385    {
     386        PyErr_NoMemory();
     387        goto dataPtr__error__;
     388    }
     389    dataPtr__len__ = dataPtr__in_len__;
     390    _err = GetFlavorData(_self->ob_itself,
     391                         theItemRef,
     392                         theType,
     393                         dataPtr__out__, &dataPtr__len__,
     394                         dataOffset);
     395    if (_err != noErr) return PyMac_Error(_err);
     396    _res = Py_BuildValue("s#",
     397                         dataPtr__out__, (int)dataPtr__len__);
     398    free(dataPtr__out__);
    399399 dataPtr__error__: ;
    400         return _res;
     400    return _res;
    401401}
    402402
    403403static PyObject *DragObj_GetDragItemBounds(DragObjObject *_self, PyObject *_args)
    404404{
    405         PyObject *_res = NULL;
    406         OSErr _err;
    407         ItemReference theItemRef;
    408         Rect itemBounds;
     405    PyObject *_res = NULL;
     406    OSErr _err;
     407    ItemReference theItemRef;
     408    Rect itemBounds;
    409409#ifndef GetDragItemBounds
    410         PyMac_PRECHECK(GetDragItemBounds);
    411 #endif
    412         if (!PyArg_ParseTuple(_args, "l",
    413                               &theItemRef))
    414                 return NULL;
    415         _err = GetDragItemBounds(_self->ob_itself,
    416                                  theItemRef,
    417                                  &itemBounds);
    418         if (_err != noErr) return PyMac_Error(_err);
    419         _res = Py_BuildValue("O&",
    420                              PyMac_BuildRect, &itemBounds);
    421         return _res;
     410    PyMac_PRECHECK(GetDragItemBounds);
     411#endif
     412    if (!PyArg_ParseTuple(_args, "l",
     413                          &theItemRef))
     414        return NULL;
     415    _err = GetDragItemBounds(_self->ob_itself,
     416                             theItemRef,
     417                             &itemBounds);
     418    if (_err != noErr) return PyMac_Error(_err);
     419    _res = Py_BuildValue("O&",
     420                         PyMac_BuildRect, &itemBounds);
     421    return _res;
    422422}
    423423
    424424static PyObject *DragObj_SetDragItemBounds(DragObjObject *_self, PyObject *_args)
    425425{
    426         PyObject *_res = NULL;
    427         OSErr _err;
    428         ItemReference theItemRef;
    429         Rect itemBounds;
     426    PyObject *_res = NULL;
     427    OSErr _err;
     428    ItemReference theItemRef;
     429    Rect itemBounds;
    430430#ifndef SetDragItemBounds
    431         PyMac_PRECHECK(SetDragItemBounds);
    432 #endif
    433         if (!PyArg_ParseTuple(_args, "lO&",
    434                               &theItemRef,
    435                               PyMac_GetRect, &itemBounds))
    436                 return NULL;
    437         _err = SetDragItemBounds(_self->ob_itself,
    438                                  theItemRef,
    439                                  &itemBounds);
    440         if (_err != noErr) return PyMac_Error(_err);
    441         Py_INCREF(Py_None);
    442         _res = Py_None;
    443         return _res;
     431    PyMac_PRECHECK(SetDragItemBounds);
     432#endif
     433    if (!PyArg_ParseTuple(_args, "lO&",
     434                          &theItemRef,
     435                          PyMac_GetRect, &itemBounds))
     436        return NULL;
     437    _err = SetDragItemBounds(_self->ob_itself,
     438                             theItemRef,
     439                             &itemBounds);
     440    if (_err != noErr) return PyMac_Error(_err);
     441    Py_INCREF(Py_None);
     442    _res = Py_None;
     443    return _res;
    444444}
    445445
    446446static PyObject *DragObj_GetDropLocation(DragObjObject *_self, PyObject *_args)
    447447{
    448         PyObject *_res = NULL;
    449         OSErr _err;
    450         AEDesc dropLocation;
     448    PyObject *_res = NULL;
     449    OSErr _err;
     450    AEDesc dropLocation;
    451451#ifndef GetDropLocation
    452         PyMac_PRECHECK(GetDropLocation);
    453 #endif
    454         if (!PyArg_ParseTuple(_args, ""))
    455                 return NULL;
    456         _err = GetDropLocation(_self->ob_itself,
    457                                &dropLocation);
    458         if (_err != noErr) return PyMac_Error(_err);
    459         _res = Py_BuildValue("O&",
    460                              AEDesc_New, &dropLocation);
    461         return _res;
     452    PyMac_PRECHECK(GetDropLocation);
     453#endif
     454    if (!PyArg_ParseTuple(_args, ""))
     455        return NULL;
     456    _err = GetDropLocation(_self->ob_itself,
     457                           &dropLocation);
     458    if (_err != noErr) return PyMac_Error(_err);
     459    _res = Py_BuildValue("O&",
     460                         AEDesc_New, &dropLocation);
     461    return _res;
    462462}
    463463
    464464static PyObject *DragObj_SetDropLocation(DragObjObject *_self, PyObject *_args)
    465465{
    466         PyObject *_res = NULL;
    467         OSErr _err;
    468         AEDesc dropLocation;
     466    PyObject *_res = NULL;
     467    OSErr _err;
     468    AEDesc dropLocation;
    469469#ifndef SetDropLocation
    470         PyMac_PRECHECK(SetDropLocation);
    471 #endif
    472         if (!PyArg_ParseTuple(_args, "O&",
    473                               AEDesc_Convert, &dropLocation))
    474                 return NULL;
    475         _err = SetDropLocation(_self->ob_itself,
    476                                &dropLocation);
    477         if (_err != noErr) return PyMac_Error(_err);
    478         Py_INCREF(Py_None);
    479         _res = Py_None;
    480         return _res;
     470    PyMac_PRECHECK(SetDropLocation);
     471#endif
     472    if (!PyArg_ParseTuple(_args, "O&",
     473                          AEDesc_Convert, &dropLocation))
     474        return NULL;
     475    _err = SetDropLocation(_self->ob_itself,
     476                           &dropLocation);
     477    if (_err != noErr) return PyMac_Error(_err);
     478    Py_INCREF(Py_None);
     479    _res = Py_None;
     480    return _res;
    481481}
    482482
    483483static PyObject *DragObj_GetDragAttributes(DragObjObject *_self, PyObject *_args)
    484484{
    485         PyObject *_res = NULL;
    486         OSErr _err;
    487         DragAttributes flags;
     485    PyObject *_res = NULL;
     486    OSErr _err;
     487    DragAttributes flags;
    488488#ifndef GetDragAttributes
    489         PyMac_PRECHECK(GetDragAttributes);
    490 #endif
    491         if (!PyArg_ParseTuple(_args, ""))
    492                 return NULL;
    493         _err = GetDragAttributes(_self->ob_itself,
    494                                  &flags);
    495         if (_err != noErr) return PyMac_Error(_err);
    496         _res = Py_BuildValue("l",
    497                              flags);
    498         return _res;
     489    PyMac_PRECHECK(GetDragAttributes);
     490#endif
     491    if (!PyArg_ParseTuple(_args, ""))
     492        return NULL;
     493    _err = GetDragAttributes(_self->ob_itself,
     494                             &flags);
     495    if (_err != noErr) return PyMac_Error(_err);
     496    _res = Py_BuildValue("l",
     497                         flags);
     498    return _res;
    499499}
    500500
    501501static PyObject *DragObj_GetDragMouse(DragObjObject *_self, PyObject *_args)
    502502{
    503         PyObject *_res = NULL;
    504         OSErr _err;
    505         Point mouse;
    506         Point globalPinnedMouse;
     503    PyObject *_res = NULL;
     504    OSErr _err;
     505    Point mouse;
     506    Point globalPinnedMouse;
    507507#ifndef GetDragMouse
    508         PyMac_PRECHECK(GetDragMouse);
    509 #endif
    510         if (!PyArg_ParseTuple(_args, ""))
    511                 return NULL;
    512         _err = GetDragMouse(_self->ob_itself,
    513                             &mouse,
    514                             &globalPinnedMouse);
    515         if (_err != noErr) return PyMac_Error(_err);
    516         _res = Py_BuildValue("O&O&",
    517                              PyMac_BuildPoint, mouse,
    518                              PyMac_BuildPoint, globalPinnedMouse);
    519         return _res;
     508    PyMac_PRECHECK(GetDragMouse);
     509#endif
     510    if (!PyArg_ParseTuple(_args, ""))
     511        return NULL;
     512    _err = GetDragMouse(_self->ob_itself,
     513                        &mouse,
     514                        &globalPinnedMouse);
     515    if (_err != noErr) return PyMac_Error(_err);
     516    _res = Py_BuildValue("O&O&",
     517                         PyMac_BuildPoint, mouse,
     518                         PyMac_BuildPoint, globalPinnedMouse);
     519    return _res;
    520520}
    521521
    522522static PyObject *DragObj_SetDragMouse(DragObjObject *_self, PyObject *_args)
    523523{
    524         PyObject *_res = NULL;
    525         OSErr _err;
    526         Point globalPinnedMouse;
     524    PyObject *_res = NULL;
     525    OSErr _err;
     526    Point globalPinnedMouse;
    527527#ifndef SetDragMouse
    528         PyMac_PRECHECK(SetDragMouse);
    529 #endif
    530         if (!PyArg_ParseTuple(_args, "O&",
    531                               PyMac_GetPoint, &globalPinnedMouse))
    532                 return NULL;
    533         _err = SetDragMouse(_self->ob_itself,
    534                             globalPinnedMouse);
    535         if (_err != noErr) return PyMac_Error(_err);
    536         Py_INCREF(Py_None);
    537         _res = Py_None;
    538         return _res;
     528    PyMac_PRECHECK(SetDragMouse);
     529#endif
     530    if (!PyArg_ParseTuple(_args, "O&",
     531                          PyMac_GetPoint, &globalPinnedMouse))
     532        return NULL;
     533    _err = SetDragMouse(_self->ob_itself,
     534                        globalPinnedMouse);
     535    if (_err != noErr) return PyMac_Error(_err);
     536    Py_INCREF(Py_None);
     537    _res = Py_None;
     538    return _res;
    539539}
    540540
    541541static PyObject *DragObj_GetDragOrigin(DragObjObject *_self, PyObject *_args)
    542542{
    543         PyObject *_res = NULL;
    544         OSErr _err;
    545         Point globalInitialMouse;
     543    PyObject *_res = NULL;
     544    OSErr _err;
     545    Point globalInitialMouse;
    546546#ifndef GetDragOrigin
    547         PyMac_PRECHECK(GetDragOrigin);
    548 #endif
    549         if (!PyArg_ParseTuple(_args, ""))
    550                 return NULL;
    551         _err = GetDragOrigin(_self->ob_itself,
    552                              &globalInitialMouse);
    553         if (_err != noErr) return PyMac_Error(_err);
    554         _res = Py_BuildValue("O&",
    555                              PyMac_BuildPoint, globalInitialMouse);
    556         return _res;
     547    PyMac_PRECHECK(GetDragOrigin);
     548#endif
     549    if (!PyArg_ParseTuple(_args, ""))
     550        return NULL;
     551    _err = GetDragOrigin(_self->ob_itself,
     552                         &globalInitialMouse);
     553    if (_err != noErr) return PyMac_Error(_err);
     554    _res = Py_BuildValue("O&",
     555                         PyMac_BuildPoint, globalInitialMouse);
     556    return _res;
    557557}
    558558
    559559static PyObject *DragObj_GetDragModifiers(DragObjObject *_self, PyObject *_args)
    560560{
    561         PyObject *_res = NULL;
    562         OSErr _err;
    563         SInt16 modifiers;
    564         SInt16 mouseDownModifiers;
    565         SInt16 mouseUpModifiers;
     561    PyObject *_res = NULL;
     562    OSErr _err;
     563    SInt16 modifiers;
     564    SInt16 mouseDownModifiers;
     565    SInt16 mouseUpModifiers;
    566566#ifndef GetDragModifiers
    567         PyMac_PRECHECK(GetDragModifiers);
    568 #endif
    569         if (!PyArg_ParseTuple(_args, ""))
    570                 return NULL;
    571         _err = GetDragModifiers(_self->ob_itself,
    572                                 &modifiers,
    573                                 &mouseDownModifiers,
    574                                 &mouseUpModifiers);
    575         if (_err != noErr) return PyMac_Error(_err);
    576         _res = Py_BuildValue("hhh",
    577                              modifiers,
    578                              mouseDownModifiers,
    579                              mouseUpModifiers);
    580         return _res;
     567    PyMac_PRECHECK(GetDragModifiers);
     568#endif
     569    if (!PyArg_ParseTuple(_args, ""))
     570        return NULL;
     571    _err = GetDragModifiers(_self->ob_itself,
     572                            &modifiers,
     573                            &mouseDownModifiers,
     574                            &mouseUpModifiers);
     575    if (_err != noErr) return PyMac_Error(_err);
     576    _res = Py_BuildValue("hhh",
     577                         modifiers,
     578                         mouseDownModifiers,
     579                         mouseUpModifiers);
     580    return _res;
    581581}
    582582
    583583static PyObject *DragObj_ShowDragHilite(DragObjObject *_self, PyObject *_args)
    584584{
    585         PyObject *_res = NULL;
    586         OSErr _err;
    587         RgnHandle hiliteFrame;
    588         Boolean inside;
     585    PyObject *_res = NULL;
     586    OSErr _err;
     587    RgnHandle hiliteFrame;
     588    Boolean inside;
    589589#ifndef ShowDragHilite
    590         PyMac_PRECHECK(ShowDragHilite);
    591 #endif
    592         if (!PyArg_ParseTuple(_args, "O&b",
    593                               ResObj_Convert, &hiliteFrame,
    594                               &inside))
    595                 return NULL;
    596         _err = ShowDragHilite(_self->ob_itself,
    597                               hiliteFrame,
    598                               inside);
    599         if (_err != noErr) return PyMac_Error(_err);
    600         Py_INCREF(Py_None);
    601         _res = Py_None;
    602         return _res;
     590    PyMac_PRECHECK(ShowDragHilite);
     591#endif
     592    if (!PyArg_ParseTuple(_args, "O&b",
     593                          ResObj_Convert, &hiliteFrame,
     594                          &inside))
     595        return NULL;
     596    _err = ShowDragHilite(_self->ob_itself,
     597                          hiliteFrame,
     598                          inside);
     599    if (_err != noErr) return PyMac_Error(_err);
     600    Py_INCREF(Py_None);
     601    _res = Py_None;
     602    return _res;
    603603}
    604604
    605605static PyObject *DragObj_HideDragHilite(DragObjObject *_self, PyObject *_args)
    606606{
    607         PyObject *_res = NULL;
    608         OSErr _err;
     607    PyObject *_res = NULL;
     608    OSErr _err;
    609609#ifndef HideDragHilite
    610         PyMac_PRECHECK(HideDragHilite);
    611 #endif
    612         if (!PyArg_ParseTuple(_args, ""))
    613                 return NULL;
    614         _err = HideDragHilite(_self->ob_itself);
    615         if (_err != noErr) return PyMac_Error(_err);
    616         Py_INCREF(Py_None);
    617         _res = Py_None;
    618         return _res;
     610    PyMac_PRECHECK(HideDragHilite);
     611#endif
     612    if (!PyArg_ParseTuple(_args, ""))
     613        return NULL;
     614    _err = HideDragHilite(_self->ob_itself);
     615    if (_err != noErr) return PyMac_Error(_err);
     616    Py_INCREF(Py_None);
     617    _res = Py_None;
     618    return _res;
    619619}
    620620
    621621static PyObject *DragObj_DragPreScroll(DragObjObject *_self, PyObject *_args)
    622622{
    623         PyObject *_res = NULL;
    624         OSErr _err;
    625         SInt16 dH;
    626         SInt16 dV;
     623    PyObject *_res = NULL;
     624    OSErr _err;
     625    SInt16 dH;
     626    SInt16 dV;
    627627#ifndef DragPreScroll
    628         PyMac_PRECHECK(DragPreScroll);
    629 #endif
    630         if (!PyArg_ParseTuple(_args, "hh",
    631                               &dH,
    632                               &dV))
    633                 return NULL;
    634         _err = DragPreScroll(_self->ob_itself,
    635                              dH,
    636                              dV);
    637         if (_err != noErr) return PyMac_Error(_err);
    638         Py_INCREF(Py_None);
    639         _res = Py_None;
    640         return _res;
     628    PyMac_PRECHECK(DragPreScroll);
     629#endif
     630    if (!PyArg_ParseTuple(_args, "hh",
     631                          &dH,
     632                          &dV))
     633        return NULL;
     634    _err = DragPreScroll(_self->ob_itself,
     635                         dH,
     636                         dV);
     637    if (_err != noErr) return PyMac_Error(_err);
     638    Py_INCREF(Py_None);
     639    _res = Py_None;
     640    return _res;
    641641}
    642642
    643643static PyObject *DragObj_DragPostScroll(DragObjObject *_self, PyObject *_args)
    644644{
    645         PyObject *_res = NULL;
    646         OSErr _err;
     645    PyObject *_res = NULL;
     646    OSErr _err;
    647647#ifndef DragPostScroll
    648         PyMac_PRECHECK(DragPostScroll);
    649 #endif
    650         if (!PyArg_ParseTuple(_args, ""))
    651                 return NULL;
    652         _err = DragPostScroll(_self->ob_itself);
    653         if (_err != noErr) return PyMac_Error(_err);
    654         Py_INCREF(Py_None);
    655         _res = Py_None;
    656         return _res;
     648    PyMac_PRECHECK(DragPostScroll);
     649#endif
     650    if (!PyArg_ParseTuple(_args, ""))
     651        return NULL;
     652    _err = DragPostScroll(_self->ob_itself);
     653    if (_err != noErr) return PyMac_Error(_err);
     654    Py_INCREF(Py_None);
     655    _res = Py_None;
     656    return _res;
    657657}
    658658
    659659static PyObject *DragObj_UpdateDragHilite(DragObjObject *_self, PyObject *_args)
    660660{
    661         PyObject *_res = NULL;
    662         OSErr _err;
    663         RgnHandle updateRgn;
     661    PyObject *_res = NULL;
     662    OSErr _err;
     663    RgnHandle updateRgn;
    664664#ifndef UpdateDragHilite
    665         PyMac_PRECHECK(UpdateDragHilite);
    666 #endif
    667         if (!PyArg_ParseTuple(_args, "O&",
    668                               ResObj_Convert, &updateRgn))
    669                 return NULL;
    670         _err = UpdateDragHilite(_self->ob_itself,
    671                                 updateRgn);
    672         if (_err != noErr) return PyMac_Error(_err);
    673         Py_INCREF(Py_None);
    674         _res = Py_None;
    675         return _res;
     665    PyMac_PRECHECK(UpdateDragHilite);
     666#endif
     667    if (!PyArg_ParseTuple(_args, "O&",
     668                          ResObj_Convert, &updateRgn))
     669        return NULL;
     670    _err = UpdateDragHilite(_self->ob_itself,
     671                            updateRgn);
     672    if (_err != noErr) return PyMac_Error(_err);
     673    Py_INCREF(Py_None);
     674    _res = Py_None;
     675    return _res;
    676676}
    677677
    678678static PyMethodDef DragObj_methods[] = {
    679         {"DisposeDrag", (PyCFunction)DragObj_DisposeDrag, 1,
    680         PyDoc_STR("() -> None")},
    681         {"AddDragItemFlavor", (PyCFunction)DragObj_AddDragItemFlavor, 1,
    682         PyDoc_STR("(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, FlavorFlags theFlags) -> None")},
    683         {"SetDragItemFlavorData", (PyCFunction)DragObj_SetDragItemFlavorData, 1,
    684         PyDoc_STR("(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> None")},
    685         {"SetDragImage", (PyCFunction)DragObj_SetDragImage, 1,
    686         PyDoc_STR("(PixMapHandle imagePixMap, RgnHandle imageRgn, Point imageOffsetPt, DragImageFlags theImageFlags) -> None")},
    687         {"ChangeDragBehaviors", (PyCFunction)DragObj_ChangeDragBehaviors, 1,
    688         PyDoc_STR("(DragBehaviors inBehaviorsToSet, DragBehaviors inBehaviorsToClear) -> None")},
    689         {"TrackDrag", (PyCFunction)DragObj_TrackDrag, 1,
    690         PyDoc_STR("(EventRecord theEvent, RgnHandle theRegion) -> None")},
    691         {"CountDragItems", (PyCFunction)DragObj_CountDragItems, 1,
    692         PyDoc_STR("() -> (UInt16 numItems)")},
    693         {"GetDragItemReferenceNumber", (PyCFunction)DragObj_GetDragItemReferenceNumber, 1,
    694         PyDoc_STR("(UInt16 index) -> (ItemReference theItemRef)")},
    695         {"CountDragItemFlavors", (PyCFunction)DragObj_CountDragItemFlavors, 1,
    696         PyDoc_STR("(ItemReference theItemRef) -> (UInt16 numFlavors)")},
    697         {"GetFlavorType", (PyCFunction)DragObj_GetFlavorType, 1,
    698         PyDoc_STR("(ItemReference theItemRef, UInt16 index) -> (FlavorType theType)")},
    699         {"GetFlavorFlags", (PyCFunction)DragObj_GetFlavorFlags, 1,
    700         PyDoc_STR("(ItemReference theItemRef, FlavorType theType) -> (FlavorFlags theFlags)")},
    701         {"GetFlavorDataSize", (PyCFunction)DragObj_GetFlavorDataSize, 1,
    702         PyDoc_STR("(ItemReference theItemRef, FlavorType theType) -> (Size dataSize)")},
    703         {"GetFlavorData", (PyCFunction)DragObj_GetFlavorData, 1,
    704         PyDoc_STR("(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> (Buffer dataPtr)")},
    705         {"GetDragItemBounds", (PyCFunction)DragObj_GetDragItemBounds, 1,
    706         PyDoc_STR("(ItemReference theItemRef) -> (Rect itemBounds)")},
    707         {"SetDragItemBounds", (PyCFunction)DragObj_SetDragItemBounds, 1,
    708         PyDoc_STR("(ItemReference theItemRef, Rect itemBounds) -> None")},
    709         {"GetDropLocation", (PyCFunction)DragObj_GetDropLocation, 1,
    710         PyDoc_STR("() -> (AEDesc dropLocation)")},
    711         {"SetDropLocation", (PyCFunction)DragObj_SetDropLocation, 1,
    712         PyDoc_STR("(AEDesc dropLocation) -> None")},
    713         {"GetDragAttributes", (PyCFunction)DragObj_GetDragAttributes, 1,
    714         PyDoc_STR("() -> (DragAttributes flags)")},
    715         {"GetDragMouse", (PyCFunction)DragObj_GetDragMouse, 1,
    716         PyDoc_STR("() -> (Point mouse, Point globalPinnedMouse)")},
    717         {"SetDragMouse", (PyCFunction)DragObj_SetDragMouse, 1,
    718         PyDoc_STR("(Point globalPinnedMouse) -> None")},
    719         {"GetDragOrigin", (PyCFunction)DragObj_GetDragOrigin, 1,
    720         PyDoc_STR("() -> (Point globalInitialMouse)")},
    721         {"GetDragModifiers", (PyCFunction)DragObj_GetDragModifiers, 1,
    722         PyDoc_STR("() -> (SInt16 modifiers, SInt16 mouseDownModifiers, SInt16 mouseUpModifiers)")},
    723         {"ShowDragHilite", (PyCFunction)DragObj_ShowDragHilite, 1,
    724         PyDoc_STR("(RgnHandle hiliteFrame, Boolean inside) -> None")},
    725         {"HideDragHilite", (PyCFunction)DragObj_HideDragHilite, 1,
    726         PyDoc_STR("() -> None")},
    727         {"DragPreScroll", (PyCFunction)DragObj_DragPreScroll, 1,
    728         PyDoc_STR("(SInt16 dH, SInt16 dV) -> None")},
    729         {"DragPostScroll", (PyCFunction)DragObj_DragPostScroll, 1,
    730         PyDoc_STR("() -> None")},
    731         {"UpdateDragHilite", (PyCFunction)DragObj_UpdateDragHilite, 1,
    732         PyDoc_STR("(RgnHandle updateRgn) -> None")},
    733         {NULL, NULL, 0}
     679    {"DisposeDrag", (PyCFunction)DragObj_DisposeDrag, 1,
     680    PyDoc_STR("() -> None")},
     681    {"AddDragItemFlavor", (PyCFunction)DragObj_AddDragItemFlavor, 1,
     682    PyDoc_STR("(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, FlavorFlags theFlags) -> None")},
     683    {"SetDragItemFlavorData", (PyCFunction)DragObj_SetDragItemFlavorData, 1,
     684    PyDoc_STR("(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> None")},
     685    {"SetDragImage", (PyCFunction)DragObj_SetDragImage, 1,
     686    PyDoc_STR("(PixMapHandle imagePixMap, RgnHandle imageRgn, Point imageOffsetPt, DragImageFlags theImageFlags) -> None")},
     687    {"ChangeDragBehaviors", (PyCFunction)DragObj_ChangeDragBehaviors, 1,
     688    PyDoc_STR("(DragBehaviors inBehaviorsToSet, DragBehaviors inBehaviorsToClear) -> None")},
     689    {"TrackDrag", (PyCFunction)DragObj_TrackDrag, 1,
     690    PyDoc_STR("(EventRecord theEvent, RgnHandle theRegion) -> None")},
     691    {"CountDragItems", (PyCFunction)DragObj_CountDragItems, 1,
     692    PyDoc_STR("() -> (UInt16 numItems)")},
     693    {"GetDragItemReferenceNumber", (PyCFunction)DragObj_GetDragItemReferenceNumber, 1,
     694    PyDoc_STR("(UInt16 index) -> (ItemReference theItemRef)")},
     695    {"CountDragItemFlavors", (PyCFunction)DragObj_CountDragItemFlavors, 1,
     696    PyDoc_STR("(ItemReference theItemRef) -> (UInt16 numFlavors)")},
     697    {"GetFlavorType", (PyCFunction)DragObj_GetFlavorType, 1,
     698    PyDoc_STR("(ItemReference theItemRef, UInt16 index) -> (FlavorType theType)")},
     699    {"GetFlavorFlags", (PyCFunction)DragObj_GetFlavorFlags, 1,
     700    PyDoc_STR("(ItemReference theItemRef, FlavorType theType) -> (FlavorFlags theFlags)")},
     701    {"GetFlavorDataSize", (PyCFunction)DragObj_GetFlavorDataSize, 1,
     702    PyDoc_STR("(ItemReference theItemRef, FlavorType theType) -> (Size dataSize)")},
     703    {"GetFlavorData", (PyCFunction)DragObj_GetFlavorData, 1,
     704    PyDoc_STR("(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> (Buffer dataPtr)")},
     705    {"GetDragItemBounds", (PyCFunction)DragObj_GetDragItemBounds, 1,
     706    PyDoc_STR("(ItemReference theItemRef) -> (Rect itemBounds)")},
     707    {"SetDragItemBounds", (PyCFunction)DragObj_SetDragItemBounds, 1,
     708    PyDoc_STR("(ItemReference theItemRef, Rect itemBounds) -> None")},
     709    {"GetDropLocation", (PyCFunction)DragObj_GetDropLocation, 1,
     710    PyDoc_STR("() -> (AEDesc dropLocation)")},
     711    {"SetDropLocation", (PyCFunction)DragObj_SetDropLocation, 1,
     712    PyDoc_STR("(AEDesc dropLocation) -> None")},
     713    {"GetDragAttributes", (PyCFunction)DragObj_GetDragAttributes, 1,
     714    PyDoc_STR("() -> (DragAttributes flags)")},
     715    {"GetDragMouse", (PyCFunction)DragObj_GetDragMouse, 1,
     716    PyDoc_STR("() -> (Point mouse, Point globalPinnedMouse)")},
     717    {"SetDragMouse", (PyCFunction)DragObj_SetDragMouse, 1,
     718    PyDoc_STR("(Point globalPinnedMouse) -> None")},
     719    {"GetDragOrigin", (PyCFunction)DragObj_GetDragOrigin, 1,
     720    PyDoc_STR("() -> (Point globalInitialMouse)")},
     721    {"GetDragModifiers", (PyCFunction)DragObj_GetDragModifiers, 1,
     722    PyDoc_STR("() -> (SInt16 modifiers, SInt16 mouseDownModifiers, SInt16 mouseUpModifiers)")},
     723    {"ShowDragHilite", (PyCFunction)DragObj_ShowDragHilite, 1,
     724    PyDoc_STR("(RgnHandle hiliteFrame, Boolean inside) -> None")},
     725    {"HideDragHilite", (PyCFunction)DragObj_HideDragHilite, 1,
     726    PyDoc_STR("() -> None")},
     727    {"DragPreScroll", (PyCFunction)DragObj_DragPreScroll, 1,
     728    PyDoc_STR("(SInt16 dH, SInt16 dV) -> None")},
     729    {"DragPostScroll", (PyCFunction)DragObj_DragPostScroll, 1,
     730    PyDoc_STR("() -> None")},
     731    {"UpdateDragHilite", (PyCFunction)DragObj_UpdateDragHilite, 1,
     732    PyDoc_STR("(RgnHandle updateRgn) -> None")},
     733    {NULL, NULL, 0}
    734734};
    735735
     
    748748static PyObject *DragObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
    749749{
    750         PyObject *_self;
    751         DragRef itself;
    752         char *kw[] = {"itself", 0};
    753 
    754         if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, DragObj_Convert, &itself)) return NULL;
    755         if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
    756         ((DragObjObject *)_self)->ob_itself = itself;
    757         return _self;
     750    PyObject *_self;
     751    DragRef itself;
     752    char *kw[] = {"itself", 0};
     753
     754    if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, DragObj_Convert, &itself)) return NULL;
     755    if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
     756    ((DragObjObject *)_self)->ob_itself = itself;
     757    return _self;
    758758}
    759759
     
    762762
    763763PyTypeObject DragObj_Type = {
    764         PyObject_HEAD_INIT(NULL)
    765         0, /*ob_size*/
    766         "_Drag.DragObj", /*tp_name*/
    767         sizeof(DragObjObject), /*tp_basicsize*/
    768         0, /*tp_itemsize*/
    769         /* methods */
    770         (destructor) DragObj_dealloc, /*tp_dealloc*/
    771         0, /*tp_print*/
    772         (getattrfunc)0, /*tp_getattr*/
    773         (setattrfunc)0, /*tp_setattr*/
    774         (cmpfunc) DragObj_compare, /*tp_compare*/
    775         (reprfunc) DragObj_repr, /*tp_repr*/
    776         (PyNumberMethods *)0, /* tp_as_number */
    777         (PySequenceMethods *)0, /* tp_as_sequence */
    778         (PyMappingMethods *)0, /* tp_as_mapping */
    779         (hashfunc) DragObj_hash, /*tp_hash*/
    780         0, /*tp_call*/
    781         0, /*tp_str*/
    782         PyObject_GenericGetAttr, /*tp_getattro*/
    783         PyObject_GenericSetAttr, /*tp_setattro */
    784         0, /*tp_as_buffer*/
    785         Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
    786         0, /*tp_doc*/
    787         0, /*tp_traverse*/
    788         0, /*tp_clear*/
    789         0, /*tp_richcompare*/
    790         0, /*tp_weaklistoffset*/
    791         0, /*tp_iter*/
    792         0, /*tp_iternext*/
    793         DragObj_methods, /* tp_methods */
    794         0, /*tp_members*/
    795         DragObj_getsetlist, /*tp_getset*/
    796         0, /*tp_base*/
    797         0, /*tp_dict*/
    798         0, /*tp_descr_get*/
    799         0, /*tp_descr_set*/
    800         0, /*tp_dictoffset*/
    801         DragObj_tp_init, /* tp_init */
    802         DragObj_tp_alloc, /* tp_alloc */
    803         DragObj_tp_new, /* tp_new */
    804         DragObj_tp_free, /* tp_free */
     764    PyObject_HEAD_INIT(NULL)
     765    0, /*ob_size*/
     766    "_Drag.DragObj", /*tp_name*/
     767    sizeof(DragObjObject), /*tp_basicsize*/
     768    0, /*tp_itemsize*/
     769    /* methods */
     770    (destructor) DragObj_dealloc, /*tp_dealloc*/
     771    0, /*tp_print*/
     772    (getattrfunc)0, /*tp_getattr*/
     773    (setattrfunc)0, /*tp_setattr*/
     774    (cmpfunc) DragObj_compare, /*tp_compare*/
     775    (reprfunc) DragObj_repr, /*tp_repr*/
     776    (PyNumberMethods *)0, /* tp_as_number */
     777    (PySequenceMethods *)0, /* tp_as_sequence */
     778    (PyMappingMethods *)0, /* tp_as_mapping */
     779    (hashfunc) DragObj_hash, /*tp_hash*/
     780    0, /*tp_call*/
     781    0, /*tp_str*/
     782    PyObject_GenericGetAttr, /*tp_getattro*/
     783    PyObject_GenericSetAttr, /*tp_setattro */
     784    0, /*tp_as_buffer*/
     785    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
     786    0, /*tp_doc*/
     787    0, /*tp_traverse*/
     788    0, /*tp_clear*/
     789    0, /*tp_richcompare*/
     790    0, /*tp_weaklistoffset*/
     791    0, /*tp_iter*/
     792    0, /*tp_iternext*/
     793    DragObj_methods, /* tp_methods */
     794    0, /*tp_members*/
     795    DragObj_getsetlist, /*tp_getset*/
     796    0, /*tp_base*/
     797    0, /*tp_dict*/
     798    0, /*tp_descr_get*/
     799    0, /*tp_descr_set*/
     800    0, /*tp_dictoffset*/
     801    DragObj_tp_init, /* tp_init */
     802    DragObj_tp_alloc, /* tp_alloc */
     803    DragObj_tp_new, /* tp_new */
     804    DragObj_tp_free, /* tp_free */
    805805};
    806806
     
    810810static PyObject *Drag_NewDrag(PyObject *_self, PyObject *_args)
    811811{
    812         PyObject *_res = NULL;
    813         OSErr _err;
    814         DragRef theDrag;
     812    PyObject *_res = NULL;
     813    OSErr _err;
     814    DragRef theDrag;
    815815#ifndef NewDrag
    816         PyMac_PRECHECK(NewDrag);
    817 #endif
    818         if (!PyArg_ParseTuple(_args, ""))
    819                 return NULL;
    820         _err = NewDrag(&theDrag);
    821         if (_err != noErr) return PyMac_Error(_err);
    822         _res = Py_BuildValue("O&",
    823                              DragObj_New, theDrag);
    824         return _res;
     816    PyMac_PRECHECK(NewDrag);
     817#endif
     818    if (!PyArg_ParseTuple(_args, ""))
     819        return NULL;
     820    _err = NewDrag(&theDrag);
     821    if (_err != noErr) return PyMac_Error(_err);
     822    _res = Py_BuildValue("O&",
     823                         DragObj_New, theDrag);
     824    return _res;
    825825}
    826826
    827827static PyObject *Drag_GetDragHiliteColor(PyObject *_self, PyObject *_args)
    828828{
    829         PyObject *_res = NULL;
    830         OSErr _err;
    831         WindowPtr window;
    832         RGBColor color;
     829    PyObject *_res = NULL;
     830    OSErr _err;
     831    WindowPtr window;
     832    RGBColor color;
    833833#ifndef GetDragHiliteColor
    834         PyMac_PRECHECK(GetDragHiliteColor);
    835 #endif
    836         if (!PyArg_ParseTuple(_args, "O&",
    837                               WinObj_Convert, &window))
    838                 return NULL;
    839         _err = GetDragHiliteColor(window,
    840                                   &color);
    841         if (_err != noErr) return PyMac_Error(_err);
    842         _res = Py_BuildValue("O&",
    843                              QdRGB_New, &color);
    844         return _res;
     834    PyMac_PRECHECK(GetDragHiliteColor);
     835#endif
     836    if (!PyArg_ParseTuple(_args, "O&",
     837                          WinObj_Convert, &window))
     838        return NULL;
     839    _err = GetDragHiliteColor(window,
     840                              &color);
     841    if (_err != noErr) return PyMac_Error(_err);
     842    _res = Py_BuildValue("O&",
     843                         QdRGB_New, &color);
     844    return _res;
    845845}
    846846
    847847static PyObject *Drag_WaitMouseMoved(PyObject *_self, PyObject *_args)
    848848{
    849         PyObject *_res = NULL;
    850         Boolean _rv;
    851         Point initialMouse;
     849    PyObject *_res = NULL;
     850    Boolean _rv;
     851    Point initialMouse;
    852852#ifndef WaitMouseMoved
    853         PyMac_PRECHECK(WaitMouseMoved);
    854 #endif
    855         if (!PyArg_ParseTuple(_args, "O&",
    856                               PyMac_GetPoint, &initialMouse))
    857                 return NULL;
    858         _rv = WaitMouseMoved(initialMouse);
    859         _res = Py_BuildValue("b",
    860                              _rv);
    861         return _res;
     853    PyMac_PRECHECK(WaitMouseMoved);
     854#endif
     855    if (!PyArg_ParseTuple(_args, "O&",
     856                          PyMac_GetPoint, &initialMouse))
     857        return NULL;
     858    _rv = WaitMouseMoved(initialMouse);
     859    _res = Py_BuildValue("b",
     860                         _rv);
     861    return _res;
    862862}
    863863
    864864static PyObject *Drag_ZoomRects(PyObject *_self, PyObject *_args)
    865865{
    866         PyObject *_res = NULL;
    867         OSErr _err;
    868         Rect fromRect;
    869         Rect toRect;
    870         SInt16 zoomSteps;
    871         ZoomAcceleration acceleration;
     866    PyObject *_res = NULL;
     867    OSErr _err;
     868    Rect fromRect;
     869    Rect toRect;
     870    SInt16 zoomSteps;
     871    ZoomAcceleration acceleration;
    872872#ifndef ZoomRects
    873         PyMac_PRECHECK(ZoomRects);
    874 #endif
    875         if (!PyArg_ParseTuple(_args, "O&O&hh",
    876                               PyMac_GetRect, &fromRect,
    877                               PyMac_GetRect, &toRect,
    878                               &zoomSteps,
    879                               &acceleration))
    880                 return NULL;
    881         _err = ZoomRects(&fromRect,
    882                          &toRect,
    883                          zoomSteps,
    884                          acceleration);
    885         if (_err != noErr) return PyMac_Error(_err);
    886         Py_INCREF(Py_None);
    887         _res = Py_None;
    888         return _res;
     873    PyMac_PRECHECK(ZoomRects);
     874#endif
     875    if (!PyArg_ParseTuple(_args, "O&O&hh",
     876                          PyMac_GetRect, &fromRect,
     877                          PyMac_GetRect, &toRect,
     878                          &zoomSteps,
     879                          &acceleration))
     880        return NULL;
     881    _err = ZoomRects(&fromRect,
     882                     &toRect,
     883                     zoomSteps,
     884                     acceleration);
     885    if (_err != noErr) return PyMac_Error(_err);
     886    Py_INCREF(Py_None);
     887    _res = Py_None;
     888    return _res;
    889889}
    890890
    891891static PyObject *Drag_ZoomRegion(PyObject *_self, PyObject *_args)
    892892{
    893         PyObject *_res = NULL;
    894         OSErr _err;
    895         RgnHandle region;
    896         Point zoomDistance;
    897         SInt16 zoomSteps;
    898         ZoomAcceleration acceleration;
     893    PyObject *_res = NULL;
     894    OSErr _err;
     895    RgnHandle region;
     896    Point zoomDistance;
     897    SInt16 zoomSteps;
     898    ZoomAcceleration acceleration;
    899899#ifndef ZoomRegion
    900         PyMac_PRECHECK(ZoomRegion);
    901 #endif
    902         if (!PyArg_ParseTuple(_args, "O&O&hh",
    903                               ResObj_Convert, &region,
    904                               PyMac_GetPoint, &zoomDistance,
    905                               &zoomSteps,
    906                               &acceleration))
    907                 return NULL;
    908         _err = ZoomRegion(region,
    909                           zoomDistance,
    910                           zoomSteps,
    911                           acceleration);
    912         if (_err != noErr) return PyMac_Error(_err);
    913         Py_INCREF(Py_None);
    914         _res = Py_None;
    915         return _res;
     900    PyMac_PRECHECK(ZoomRegion);
     901#endif
     902    if (!PyArg_ParseTuple(_args, "O&O&hh",
     903                          ResObj_Convert, &region,
     904                          PyMac_GetPoint, &zoomDistance,
     905                          &zoomSteps,
     906                          &acceleration))
     907        return NULL;
     908    _err = ZoomRegion(region,
     909                      zoomDistance,
     910                      zoomSteps,
     911                      acceleration);
     912    if (_err != noErr) return PyMac_Error(_err);
     913    Py_INCREF(Py_None);
     914    _res = Py_None;
     915    return _res;
    916916}
    917917
    918918static PyObject *Drag_InstallTrackingHandler(PyObject *_self, PyObject *_args)
    919919{
    920         PyObject *_res = NULL;
    921 
    922             PyObject *callback;
    923             WindowPtr theWindow = NULL;
    924             OSErr _err;
    925 
    926             if ( !PyArg_ParseTuple(_args, "O|O&", &callback, WinObj_Convert, &theWindow) )
    927                 return NULL;
    928             Py_INCREF(callback);        /* Cannot decref later, too bad */
    929             _err = InstallTrackingHandler(dragglue_TrackingHandlerUPP, theWindow, (void *)callback);
    930                 if (_err != noErr) return PyMac_Error(_err);
    931                 Py_INCREF(Py_None);
    932                 _res = Py_None;
    933                 return _res;
     920    PyObject *_res = NULL;
     921
     922        PyObject *callback;
     923        WindowPtr theWindow = NULL;
     924        OSErr _err;
     925
     926        if ( !PyArg_ParseTuple(_args, "O|O&", &callback, WinObj_Convert, &theWindow) )
     927        return NULL;
     928        Py_INCREF(callback);        /* Cannot decref later, too bad */
     929        _err = InstallTrackingHandler(dragglue_TrackingHandlerUPP, theWindow, (void *)callback);
     930        if (_err != noErr) return PyMac_Error(_err);
     931        Py_INCREF(Py_None);
     932        _res = Py_None;
     933        return _res;
    934934
    935935}
     
    937937static PyObject *Drag_InstallReceiveHandler(PyObject *_self, PyObject *_args)
    938938{
    939         PyObject *_res = NULL;
    940 
    941             PyObject *callback;
    942             WindowPtr theWindow = NULL;
    943             OSErr _err;
    944 
    945             if ( !PyArg_ParseTuple(_args, "O|O&", &callback, WinObj_Convert, &theWindow) )
    946                 return NULL;
    947             Py_INCREF(callback);        /* Cannot decref later, too bad */
    948             _err = InstallReceiveHandler(dragglue_ReceiveHandlerUPP, theWindow, (void *)callback);
    949                 if (_err != noErr) return PyMac_Error(_err);
    950                 Py_INCREF(Py_None);
    951                 _res = Py_None;
    952                 return _res;
     939    PyObject *_res = NULL;
     940
     941        PyObject *callback;
     942        WindowPtr theWindow = NULL;
     943        OSErr _err;
     944
     945        if ( !PyArg_ParseTuple(_args, "O|O&", &callback, WinObj_Convert, &theWindow) )
     946        return NULL;
     947        Py_INCREF(callback);        /* Cannot decref later, too bad */
     948        _err = InstallReceiveHandler(dragglue_ReceiveHandlerUPP, theWindow, (void *)callback);
     949        if (_err != noErr) return PyMac_Error(_err);
     950        Py_INCREF(Py_None);
     951        _res = Py_None;
     952        return _res;
    953953
    954954}
     
    956956static PyObject *Drag_RemoveTrackingHandler(PyObject *_self, PyObject *_args)
    957957{
    958         PyObject *_res = NULL;
    959 
    960             WindowPtr theWindow = NULL;
    961             OSErr _err;
    962 
    963             if ( !PyArg_ParseTuple(_args, "|O&", WinObj_Convert, &theWindow) )
    964                 return NULL;
    965             _err = RemoveTrackingHandler(dragglue_TrackingHandlerUPP, theWindow);
    966                 if (_err != noErr) return PyMac_Error(_err);
    967                 Py_INCREF(Py_None);
    968                 _res = Py_None;
    969                 return _res;
     958    PyObject *_res = NULL;
     959
     960        WindowPtr theWindow = NULL;
     961        OSErr _err;
     962
     963        if ( !PyArg_ParseTuple(_args, "|O&", WinObj_Convert, &theWindow) )
     964        return NULL;
     965        _err = RemoveTrackingHandler(dragglue_TrackingHandlerUPP, theWindow);
     966        if (_err != noErr) return PyMac_Error(_err);
     967        Py_INCREF(Py_None);
     968        _res = Py_None;
     969        return _res;
    970970
    971971}
     
    973973static PyObject *Drag_RemoveReceiveHandler(PyObject *_self, PyObject *_args)
    974974{
    975         PyObject *_res = NULL;
    976 
    977             WindowPtr theWindow = NULL;
    978             OSErr _err;
    979 
    980             if ( !PyArg_ParseTuple(_args, "|O&", WinObj_Convert, &theWindow) )
    981                 return NULL;
    982             _err = RemoveReceiveHandler(dragglue_ReceiveHandlerUPP, theWindow);
    983                 if (_err != noErr) return PyMac_Error(_err);
    984                 Py_INCREF(Py_None);
    985                 _res = Py_None;
    986                 return _res;
     975    PyObject *_res = NULL;
     976
     977        WindowPtr theWindow = NULL;
     978        OSErr _err;
     979
     980        if ( !PyArg_ParseTuple(_args, "|O&", WinObj_Convert, &theWindow) )
     981        return NULL;
     982        _err = RemoveReceiveHandler(dragglue_ReceiveHandlerUPP, theWindow);
     983        if (_err != noErr) return PyMac_Error(_err);
     984        Py_INCREF(Py_None);
     985        _res = Py_None;
     986        return _res;
    987987
    988988}
    989989
    990990static PyMethodDef Drag_methods[] = {
    991         {"NewDrag", (PyCFunction)Drag_NewDrag, 1,
    992         PyDoc_STR("() -> (DragRef theDrag)")},
    993         {"GetDragHiliteColor", (PyCFunction)Drag_GetDragHiliteColor, 1,
    994         PyDoc_STR("(WindowPtr window) -> (RGBColor color)")},
    995         {"WaitMouseMoved", (PyCFunction)Drag_WaitMouseMoved, 1,
    996         PyDoc_STR("(Point initialMouse) -> (Boolean _rv)")},
    997         {"ZoomRects", (PyCFunction)Drag_ZoomRects, 1,
    998         PyDoc_STR("(Rect fromRect, Rect toRect, SInt16 zoomSteps, ZoomAcceleration acceleration) -> None")},
    999         {"ZoomRegion", (PyCFunction)Drag_ZoomRegion, 1,
    1000         PyDoc_STR("(RgnHandle region, Point zoomDistance, SInt16 zoomSteps, ZoomAcceleration acceleration) -> None")},
    1001         {"InstallTrackingHandler", (PyCFunction)Drag_InstallTrackingHandler, 1,
    1002         PyDoc_STR(NULL)},
    1003         {"InstallReceiveHandler", (PyCFunction)Drag_InstallReceiveHandler, 1,
    1004         PyDoc_STR(NULL)},
    1005         {"RemoveTrackingHandler", (PyCFunction)Drag_RemoveTrackingHandler, 1,
    1006         PyDoc_STR(NULL)},
    1007         {"RemoveReceiveHandler", (PyCFunction)Drag_RemoveReceiveHandler, 1,
    1008         PyDoc_STR(NULL)},
    1009         {NULL, NULL, 0}
     991    {"NewDrag", (PyCFunction)Drag_NewDrag, 1,
     992    PyDoc_STR("() -> (DragRef theDrag)")},
     993    {"GetDragHiliteColor", (PyCFunction)Drag_GetDragHiliteColor, 1,
     994    PyDoc_STR("(WindowPtr window) -> (RGBColor color)")},
     995    {"WaitMouseMoved", (PyCFunction)Drag_WaitMouseMoved, 1,
     996    PyDoc_STR("(Point initialMouse) -> (Boolean _rv)")},
     997    {"ZoomRects", (PyCFunction)Drag_ZoomRects, 1,
     998    PyDoc_STR("(Rect fromRect, Rect toRect, SInt16 zoomSteps, ZoomAcceleration acceleration) -> None")},
     999    {"ZoomRegion", (PyCFunction)Drag_ZoomRegion, 1,
     1000    PyDoc_STR("(RgnHandle region, Point zoomDistance, SInt16 zoomSteps, ZoomAcceleration acceleration) -> None")},
     1001    {"InstallTrackingHandler", (PyCFunction)Drag_InstallTrackingHandler, 1,
     1002    PyDoc_STR(NULL)},
     1003    {"InstallReceiveHandler", (PyCFunction)Drag_InstallReceiveHandler, 1,
     1004    PyDoc_STR(NULL)},
     1005    {"RemoveTrackingHandler", (PyCFunction)Drag_RemoveTrackingHandler, 1,
     1006    PyDoc_STR(NULL)},
     1007    {"RemoveReceiveHandler", (PyCFunction)Drag_RemoveReceiveHandler, 1,
     1008    PyDoc_STR(NULL)},
     1009    {NULL, NULL, 0}
    10101010};
    10111011
     
    10161016                         void *handlerRefCon, DragReference theDrag)
    10171017{
    1018         PyObject *args, *rv;
    1019         int i;
    1020 
    1021         args = Py_BuildValue("hO&O&", theMessage, DragObj_New, theDrag, WinObj_WhichWindow, theWindow);
    1022         if ( args == NULL )
    1023                 return -1;
    1024         rv = PyEval_CallObject((PyObject *)handlerRefCon, args);
    1025         Py_DECREF(args);
    1026         if ( rv == NULL ) {
    1027                 PySys_WriteStderr("Drag: Exception in TrackingHandler\n");
    1028                 PyErr_Print();
    1029                 return -1;
    1030         }
    1031         i = -1;
    1032         if ( rv == Py_None )
    1033                 i = 0;
    1034         else
    1035                 PyArg_Parse(rv, "l", &i);
    1036         Py_DECREF(rv);
    1037         return i;
     1018    PyObject *args, *rv;
     1019    int i;
     1020
     1021    args = Py_BuildValue("hO&O&", theMessage, DragObj_New, theDrag, WinObj_WhichWindow, theWindow);
     1022    if ( args == NULL )
     1023        return -1;
     1024    rv = PyEval_CallObject((PyObject *)handlerRefCon, args);
     1025    Py_DECREF(args);
     1026    if ( rv == NULL ) {
     1027        PySys_WriteStderr("Drag: Exception in TrackingHandler\n");
     1028        PyErr_Print();
     1029        return -1;
     1030    }
     1031    i = -1;
     1032    if ( rv == Py_None )
     1033        i = 0;
     1034    else
     1035        PyArg_Parse(rv, "l", &i);
     1036    Py_DECREF(rv);
     1037    return i;
    10381038}
    10391039
     
    10421042                        DragReference theDrag)
    10431043{
    1044         PyObject *args, *rv;
    1045         int i;
    1046 
    1047         args = Py_BuildValue("O&O&", DragObj_New, theDrag, WinObj_WhichWindow, theWindow);
    1048         if ( args == NULL )
    1049                 return -1;
    1050         rv = PyEval_CallObject((PyObject *)handlerRefCon, args);
    1051         Py_DECREF(args);
    1052         if ( rv == NULL ) {
    1053                 PySys_WriteStderr("Drag: Exception in ReceiveHandler\n");
    1054                 PyErr_Print();
    1055                 return -1;
    1056         }
    1057         i = -1;
    1058         if ( rv == Py_None )
    1059                 i = 0;
    1060         else
    1061                 PyArg_Parse(rv, "l", &i);
    1062         Py_DECREF(rv);
    1063         return i;
     1044    PyObject *args, *rv;
     1045    int i;
     1046
     1047    args = Py_BuildValue("O&O&", DragObj_New, theDrag, WinObj_WhichWindow, theWindow);
     1048    if ( args == NULL )
     1049        return -1;
     1050    rv = PyEval_CallObject((PyObject *)handlerRefCon, args);
     1051    Py_DECREF(args);
     1052    if ( rv == NULL ) {
     1053        PySys_WriteStderr("Drag: Exception in ReceiveHandler\n");
     1054        PyErr_Print();
     1055        return -1;
     1056    }
     1057    i = -1;
     1058    if ( rv == Py_None )
     1059        i = 0;
     1060    else
     1061        PyArg_Parse(rv, "l", &i);
     1062    Py_DECREF(rv);
     1063    return i;
    10641064}
    10651065
     
    10681068                      ItemReference theItem, DragReference theDrag)
    10691069{
    1070         DragObjObject *self = (DragObjObject *)dragSendRefCon;
    1071         PyObject *args, *rv;
    1072         int i;
    1073 
    1074         if ( self->sendproc == NULL )
    1075                 return -1;
    1076         args = Py_BuildValue("O&l", PyMac_BuildOSType, theType, theItem);
    1077         if ( args == NULL )
    1078                 return -1;
    1079         rv = PyEval_CallObject(self->sendproc, args);
    1080         Py_DECREF(args);
    1081         if ( rv == NULL ) {
    1082                 PySys_WriteStderr("Drag: Exception in SendDataHandler\n");
    1083                 PyErr_Print();
    1084                 return -1;
    1085         }
    1086         i = -1;
    1087         if ( rv == Py_None )
    1088                 i = 0;
    1089         else
    1090                 PyArg_Parse(rv, "l", &i);
    1091         Py_DECREF(rv);
    1092         return i;
     1070    DragObjObject *self = (DragObjObject *)dragSendRefCon;
     1071    PyObject *args, *rv;
     1072    int i;
     1073
     1074    if ( self->sendproc == NULL )
     1075        return -1;
     1076    args = Py_BuildValue("O&l", PyMac_BuildOSType, theType, theItem);
     1077    if ( args == NULL )
     1078        return -1;
     1079    rv = PyEval_CallObject(self->sendproc, args);
     1080    Py_DECREF(args);
     1081    if ( rv == NULL ) {
     1082        PySys_WriteStderr("Drag: Exception in SendDataHandler\n");
     1083        PyErr_Print();
     1084        return -1;
     1085    }
     1086    i = -1;
     1087    if ( rv == Py_None )
     1088        i = 0;
     1089    else
     1090        PyArg_Parse(rv, "l", &i);
     1091    Py_DECREF(rv);
     1092    return i;
    10931093}
    10941094
     
    11101110#else /* __LP64__ */
    11111111static PyMethodDef Drag_methods[] = {
    1112         {NULL, NULL, 0}
     1112    {NULL, NULL, 0}
    11131113};
    11141114#endif /* __LP64__ */
     
    11171117void init_Drag(void)
    11181118{
    1119         PyObject *m;
     1119    PyObject *m;
    11201120#ifndef __LP64__
    1121         PyObject *d;
    1122 
    1123 
    1124 
    1125                 PyMac_INIT_TOOLBOX_OBJECT_NEW(DragRef, DragObj_New);
    1126                 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DragRef, DragObj_Convert);
     1121    PyObject *d;
     1122
     1123
     1124
     1125        PyMac_INIT_TOOLBOX_OBJECT_NEW(DragRef, DragObj_New);
     1126        PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DragRef, DragObj_Convert);
    11271127#endif /* !__LP64__ */
    11281128
    11291129
    1130         m = Py_InitModule("_Drag", Drag_methods);
     1130    m = Py_InitModule("_Drag", Drag_methods);
    11311131#ifndef __LP64__
    1132         d = PyModule_GetDict(m);
    1133         Drag_Error = PyMac_GetOSErrException();
    1134         if (Drag_Error == NULL ||
    1135             PyDict_SetItemString(d, "Error", Drag_Error) != 0)
    1136                 return;
    1137         DragObj_Type.ob_type = &PyType_Type;
    1138         if (PyType_Ready(&DragObj_Type) < 0) return;
    1139         Py_INCREF(&DragObj_Type);
    1140         PyModule_AddObject(m, "DragObj", (PyObject *)&DragObj_Type);
    1141         /* Backward-compatible name */
    1142         Py_INCREF(&DragObj_Type);
    1143         PyModule_AddObject(m, "DragObjType", (PyObject *)&DragObj_Type);
    1144 
    1145         dragglue_TrackingHandlerUPP = NewDragTrackingHandlerUPP(dragglue_TrackingHandler);
    1146         dragglue_ReceiveHandlerUPP = NewDragReceiveHandlerUPP(dragglue_ReceiveHandler);
    1147         dragglue_SendDataUPP = NewDragSendDataUPP(dragglue_SendData);
     1132    d = PyModule_GetDict(m);
     1133    Drag_Error = PyMac_GetOSErrException();
     1134    if (Drag_Error == NULL ||
     1135        PyDict_SetItemString(d, "Error", Drag_Error) != 0)
     1136        return;
     1137    DragObj_Type.ob_type = &PyType_Type;
     1138    if (PyType_Ready(&DragObj_Type) < 0) return;
     1139    Py_INCREF(&DragObj_Type);
     1140    PyModule_AddObject(m, "DragObj", (PyObject *)&DragObj_Type);
     1141    /* Backward-compatible name */
     1142    Py_INCREF(&DragObj_Type);
     1143    PyModule_AddObject(m, "DragObjType", (PyObject *)&DragObj_Type);
     1144
     1145    dragglue_TrackingHandlerUPP = NewDragTrackingHandlerUPP(dragglue_TrackingHandler);
     1146    dragglue_ReceiveHandlerUPP = NewDragReceiveHandlerUPP(dragglue_ReceiveHandler);
     1147    dragglue_SendDataUPP = NewDragSendDataUPP(dragglue_SendData);
    11481148#if 0
    1149         dragglue_InputUPP = NewDragInputUPP(dragglue_Input);
    1150         dragglue_DrawingUPP = NewDragDrawingUPP(dragglue_Drawing);
     1149    dragglue_InputUPP = NewDragInputUPP(dragglue_Input);
     1150    dragglue_DrawingUPP = NewDragDrawingUPP(dragglue_Drawing);
    11511151#endif
    11521152
Note: See TracChangeset for help on using the changeset viewer.