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/evt/_Evtmodule.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
     
    2424static PyObject *Evt_GetMouse(PyObject *_self, PyObject *_args)
    2525{
    26         PyObject *_res = NULL;
    27         Point mouseLoc;
     26    PyObject *_res = NULL;
     27    Point mouseLoc;
    2828#ifndef GetMouse
    29         PyMac_PRECHECK(GetMouse);
    30 #endif
    31         if (!PyArg_ParseTuple(_args, ""))
    32                 return NULL;
    33         GetMouse(&mouseLoc);
    34         _res = Py_BuildValue("O&",
    35                              PyMac_BuildPoint, mouseLoc);
    36         return _res;
     29    PyMac_PRECHECK(GetMouse);
     30#endif
     31    if (!PyArg_ParseTuple(_args, ""))
     32        return NULL;
     33    GetMouse(&mouseLoc);
     34    _res = Py_BuildValue("O&",
     35                         PyMac_BuildPoint, mouseLoc);
     36    return _res;
    3737}
    3838
    3939static PyObject *Evt_Button(PyObject *_self, PyObject *_args)
    4040{
    41         PyObject *_res = NULL;
    42         Boolean _rv;
     41    PyObject *_res = NULL;
     42    Boolean _rv;
    4343#ifndef Button
    44         PyMac_PRECHECK(Button);
    45 #endif
    46         if (!PyArg_ParseTuple(_args, ""))
    47                 return NULL;
    48         _rv = Button();
    49         _res = Py_BuildValue("b",
    50                              _rv);
    51         return _res;
     44    PyMac_PRECHECK(Button);
     45#endif
     46    if (!PyArg_ParseTuple(_args, ""))
     47        return NULL;
     48    _rv = Button();
     49    _res = Py_BuildValue("b",
     50                         _rv);
     51    return _res;
    5252}
    5353
    5454static PyObject *Evt_StillDown(PyObject *_self, PyObject *_args)
    5555{
    56         PyObject *_res = NULL;
    57         Boolean _rv;
     56    PyObject *_res = NULL;
     57    Boolean _rv;
    5858#ifndef StillDown
    59         PyMac_PRECHECK(StillDown);
    60 #endif
    61         if (!PyArg_ParseTuple(_args, ""))
    62                 return NULL;
    63         _rv = StillDown();
    64         _res = Py_BuildValue("b",
    65                              _rv);
    66         return _res;
     59    PyMac_PRECHECK(StillDown);
     60#endif
     61    if (!PyArg_ParseTuple(_args, ""))
     62        return NULL;
     63    _rv = StillDown();
     64    _res = Py_BuildValue("b",
     65                         _rv);
     66    return _res;
    6767}
    6868
    6969static PyObject *Evt_WaitMouseUp(PyObject *_self, PyObject *_args)
    7070{
    71         PyObject *_res = NULL;
    72         Boolean _rv;
     71    PyObject *_res = NULL;
     72    Boolean _rv;
    7373#ifndef WaitMouseUp
    74         PyMac_PRECHECK(WaitMouseUp);
    75 #endif
    76         if (!PyArg_ParseTuple(_args, ""))
    77                 return NULL;
    78         _rv = WaitMouseUp();
    79         _res = Py_BuildValue("b",
    80                              _rv);
    81         return _res;
     74    PyMac_PRECHECK(WaitMouseUp);
     75#endif
     76    if (!PyArg_ParseTuple(_args, ""))
     77        return NULL;
     78    _rv = WaitMouseUp();
     79    _res = Py_BuildValue("b",
     80                         _rv);
     81    return _res;
    8282}
    8383
    8484static PyObject *Evt_GetCaretTime(PyObject *_self, PyObject *_args)
    8585{
    86         PyObject *_res = NULL;
    87         UInt32 _rv;
     86    PyObject *_res = NULL;
     87    UInt32 _rv;
    8888#ifndef GetCaretTime
    89         PyMac_PRECHECK(GetCaretTime);
    90 #endif
    91         if (!PyArg_ParseTuple(_args, ""))
    92                 return NULL;
    93         _rv = GetCaretTime();
    94         _res = Py_BuildValue("l",
    95                              _rv);
    96         return _res;
     89    PyMac_PRECHECK(GetCaretTime);
     90#endif
     91    if (!PyArg_ParseTuple(_args, ""))
     92        return NULL;
     93    _rv = GetCaretTime();
     94    _res = Py_BuildValue("l",
     95                         _rv);
     96    return _res;
    9797}
    9898
    9999static PyObject *Evt_GetKeys(PyObject *_self, PyObject *_args)
    100100{
    101         PyObject *_res = NULL;
    102         KeyMap theKeys__out__;
     101    PyObject *_res = NULL;
     102    KeyMap theKeys__out__;
    103103#ifndef GetKeys
    104         PyMac_PRECHECK(GetKeys);
    105 #endif
    106         if (!PyArg_ParseTuple(_args, ""))
    107                 return NULL;
    108         GetKeys(theKeys__out__);
    109         _res = Py_BuildValue("s#",
    110                              (char *)&theKeys__out__, (int)sizeof(KeyMap));
    111         return _res;
     104    PyMac_PRECHECK(GetKeys);
     105#endif
     106    if (!PyArg_ParseTuple(_args, ""))
     107        return NULL;
     108    GetKeys(theKeys__out__);
     109    _res = Py_BuildValue("s#",
     110                         (char *)&theKeys__out__, (int)sizeof(KeyMap));
     111    return _res;
    112112}
    113113
    114114static PyObject *Evt_GetDblTime(PyObject *_self, PyObject *_args)
    115115{
    116         PyObject *_res = NULL;
    117         UInt32 _rv;
     116    PyObject *_res = NULL;
     117    UInt32 _rv;
    118118#ifndef GetDblTime
    119         PyMac_PRECHECK(GetDblTime);
    120 #endif
    121         if (!PyArg_ParseTuple(_args, ""))
    122                 return NULL;
    123         _rv = GetDblTime();
    124         _res = Py_BuildValue("l",
    125                              _rv);
    126         return _res;
     119    PyMac_PRECHECK(GetDblTime);
     120#endif
     121    if (!PyArg_ParseTuple(_args, ""))
     122        return NULL;
     123    _rv = GetDblTime();
     124    _res = Py_BuildValue("l",
     125                         _rv);
     126    return _res;
    127127}
    128128
    129129static PyObject *Evt_SetEventMask(PyObject *_self, PyObject *_args)
    130130{
    131         PyObject *_res = NULL;
    132         EventMask value;
     131    PyObject *_res = NULL;
     132    EventMask value;
    133133#ifndef SetEventMask
    134         PyMac_PRECHECK(SetEventMask);
    135 #endif
    136         if (!PyArg_ParseTuple(_args, "H",
    137                               &value))
    138                 return NULL;
    139         SetEventMask(value);
    140         Py_INCREF(Py_None);
    141         _res = Py_None;
    142         return _res;
     134    PyMac_PRECHECK(SetEventMask);
     135#endif
     136    if (!PyArg_ParseTuple(_args, "H",
     137                          &value))
     138        return NULL;
     139    SetEventMask(value);
     140    Py_INCREF(Py_None);
     141    _res = Py_None;
     142    return _res;
    143143}
    144144
    145145static PyObject *Evt_GetNextEvent(PyObject *_self, PyObject *_args)
    146146{
    147         PyObject *_res = NULL;
    148         Boolean _rv;
    149         EventMask eventMask;
    150         EventRecord theEvent;
     147    PyObject *_res = NULL;
     148    Boolean _rv;
     149    EventMask eventMask;
     150    EventRecord theEvent;
    151151#ifndef GetNextEvent
    152         PyMac_PRECHECK(GetNextEvent);
    153 #endif
    154         if (!PyArg_ParseTuple(_args, "H",
    155                               &eventMask))
    156                 return NULL;
    157         _rv = GetNextEvent(eventMask,
    158                            &theEvent);
    159         _res = Py_BuildValue("bO&",
    160                              _rv,
    161                              PyMac_BuildEventRecord, &theEvent);
    162         return _res;
     152    PyMac_PRECHECK(GetNextEvent);
     153#endif
     154    if (!PyArg_ParseTuple(_args, "H",
     155                          &eventMask))
     156        return NULL;
     157    _rv = GetNextEvent(eventMask,
     158                       &theEvent);
     159    _res = Py_BuildValue("bO&",
     160                         _rv,
     161                         PyMac_BuildEventRecord, &theEvent);
     162    return _res;
    163163}
    164164
    165165static PyObject *Evt_EventAvail(PyObject *_self, PyObject *_args)
    166166{
    167         PyObject *_res = NULL;
    168         Boolean _rv;
    169         EventMask eventMask;
    170         EventRecord theEvent;
     167    PyObject *_res = NULL;
     168    Boolean _rv;
     169    EventMask eventMask;
     170    EventRecord theEvent;
    171171#ifndef EventAvail
    172         PyMac_PRECHECK(EventAvail);
    173 #endif
    174         if (!PyArg_ParseTuple(_args, "H",
    175                               &eventMask))
    176                 return NULL;
    177         _rv = EventAvail(eventMask,
    178                          &theEvent);
    179         _res = Py_BuildValue("bO&",
    180                              _rv,
    181                              PyMac_BuildEventRecord, &theEvent);
    182         return _res;
     172    PyMac_PRECHECK(EventAvail);
     173#endif
     174    if (!PyArg_ParseTuple(_args, "H",
     175                          &eventMask))
     176        return NULL;
     177    _rv = EventAvail(eventMask,
     178                     &theEvent);
     179    _res = Py_BuildValue("bO&",
     180                         _rv,
     181                         PyMac_BuildEventRecord, &theEvent);
     182    return _res;
    183183}
    184184
    185185static PyObject *Evt_PostEvent(PyObject *_self, PyObject *_args)
    186186{
    187         PyObject *_res = NULL;
    188         OSErr _err;
    189         EventKind eventNum;
    190         UInt32 eventMsg;
     187    PyObject *_res = NULL;
     188    OSErr _err;
     189    EventKind eventNum;
     190    UInt32 eventMsg;
    191191#ifndef PostEvent
    192         PyMac_PRECHECK(PostEvent);
    193 #endif
    194         if (!PyArg_ParseTuple(_args, "Hl",
    195                               &eventNum,
    196                               &eventMsg))
    197                 return NULL;
    198         _err = PostEvent(eventNum,
    199                          eventMsg);
    200         if (_err != noErr) return PyMac_Error(_err);
    201         Py_INCREF(Py_None);
    202         _res = Py_None;
    203         return _res;
     192    PyMac_PRECHECK(PostEvent);
     193#endif
     194    if (!PyArg_ParseTuple(_args, "Hl",
     195                          &eventNum,
     196                          &eventMsg))
     197        return NULL;
     198    _err = PostEvent(eventNum,
     199                     eventMsg);
     200    if (_err != noErr) return PyMac_Error(_err);
     201    Py_INCREF(Py_None);
     202    _res = Py_None;
     203    return _res;
    204204}
    205205
    206206static PyObject *Evt_FlushEvents(PyObject *_self, PyObject *_args)
    207207{
    208         PyObject *_res = NULL;
    209         EventMask whichMask;
    210         EventMask stopMask;
     208    PyObject *_res = NULL;
     209    EventMask whichMask;
     210    EventMask stopMask;
    211211#ifndef FlushEvents
    212         PyMac_PRECHECK(FlushEvents);
    213 #endif
    214         if (!PyArg_ParseTuple(_args, "HH",
    215                               &whichMask,
    216                               &stopMask))
    217                 return NULL;
    218         FlushEvents(whichMask,
    219                     stopMask);
    220         Py_INCREF(Py_None);
    221         _res = Py_None;
    222         return _res;
     212    PyMac_PRECHECK(FlushEvents);
     213#endif
     214    if (!PyArg_ParseTuple(_args, "HH",
     215                          &whichMask,
     216                          &stopMask))
     217        return NULL;
     218    FlushEvents(whichMask,
     219                stopMask);
     220    Py_INCREF(Py_None);
     221    _res = Py_None;
     222    return _res;
    223223}
    224224
    225225static PyObject *Evt_GetGlobalMouse(PyObject *_self, PyObject *_args)
    226226{
    227         PyObject *_res = NULL;
    228         Point globalMouse;
     227    PyObject *_res = NULL;
     228    Point globalMouse;
    229229#ifndef GetGlobalMouse
    230         PyMac_PRECHECK(GetGlobalMouse);
    231 #endif
    232         if (!PyArg_ParseTuple(_args, ""))
    233                 return NULL;
    234         GetGlobalMouse(&globalMouse);
    235         _res = Py_BuildValue("O&",
    236                              PyMac_BuildPoint, globalMouse);
    237         return _res;
     230    PyMac_PRECHECK(GetGlobalMouse);
     231#endif
     232    if (!PyArg_ParseTuple(_args, ""))
     233        return NULL;
     234    GetGlobalMouse(&globalMouse);
     235    _res = Py_BuildValue("O&",
     236                         PyMac_BuildPoint, globalMouse);
     237    return _res;
    238238}
    239239
    240240static PyObject *Evt_GetCurrentKeyModifiers(PyObject *_self, PyObject *_args)
    241241{
    242         PyObject *_res = NULL;
    243         UInt32 _rv;
     242    PyObject *_res = NULL;
     243    UInt32 _rv;
    244244#ifndef GetCurrentKeyModifiers
    245         PyMac_PRECHECK(GetCurrentKeyModifiers);
    246 #endif
    247         if (!PyArg_ParseTuple(_args, ""))
    248                 return NULL;
    249         _rv = GetCurrentKeyModifiers();
    250         _res = Py_BuildValue("l",
    251                              _rv);
    252         return _res;
     245    PyMac_PRECHECK(GetCurrentKeyModifiers);
     246#endif
     247    if (!PyArg_ParseTuple(_args, ""))
     248        return NULL;
     249    _rv = GetCurrentKeyModifiers();
     250    _res = Py_BuildValue("l",
     251                         _rv);
     252    return _res;
    253253}
    254254
    255255static PyObject *Evt_CheckEventQueueForUserCancel(PyObject *_self, PyObject *_args)
    256256{
    257         PyObject *_res = NULL;
    258         Boolean _rv;
     257    PyObject *_res = NULL;
     258    Boolean _rv;
    259259#ifndef CheckEventQueueForUserCancel
    260         PyMac_PRECHECK(CheckEventQueueForUserCancel);
    261 #endif
    262         if (!PyArg_ParseTuple(_args, ""))
    263                 return NULL;
    264         _rv = CheckEventQueueForUserCancel();
    265         _res = Py_BuildValue("b",
    266                              _rv);
    267         return _res;
     260    PyMac_PRECHECK(CheckEventQueueForUserCancel);
     261#endif
     262    if (!PyArg_ParseTuple(_args, ""))
     263        return NULL;
     264    _rv = CheckEventQueueForUserCancel();
     265    _res = Py_BuildValue("b",
     266                         _rv);
     267    return _res;
    268268}
    269269
    270270static PyObject *Evt_KeyScript(PyObject *_self, PyObject *_args)
    271271{
    272         PyObject *_res = NULL;
    273         short code;
     272    PyObject *_res = NULL;
     273    short code;
    274274#ifndef KeyScript
    275         PyMac_PRECHECK(KeyScript);
    276 #endif
    277         if (!PyArg_ParseTuple(_args, "h",
    278                               &code))
    279                 return NULL;
    280         KeyScript(code);
    281         Py_INCREF(Py_None);
    282         _res = Py_None;
    283         return _res;
     275    PyMac_PRECHECK(KeyScript);
     276#endif
     277    if (!PyArg_ParseTuple(_args, "h",
     278                          &code))
     279        return NULL;
     280    KeyScript(code);
     281    Py_INCREF(Py_None);
     282    _res = Py_None;
     283    return _res;
    284284}
    285285
    286286static PyObject *Evt_IsCmdChar(PyObject *_self, PyObject *_args)
    287287{
    288         PyObject *_res = NULL;
    289         Boolean _rv;
    290         EventRecord event;
    291         short test;
     288    PyObject *_res = NULL;
     289    Boolean _rv;
     290    EventRecord event;
     291    short test;
    292292#ifndef IsCmdChar
    293         PyMac_PRECHECK(IsCmdChar);
    294 #endif
    295         if (!PyArg_ParseTuple(_args, "O&h",
    296                               PyMac_GetEventRecord, &event,
    297                               &test))
    298                 return NULL;
    299         _rv = IsCmdChar(&event,
    300                         test);
    301         _res = Py_BuildValue("b",
    302                              _rv);
    303         return _res;
     293    PyMac_PRECHECK(IsCmdChar);
     294#endif
     295    if (!PyArg_ParseTuple(_args, "O&h",
     296                          PyMac_GetEventRecord, &event,
     297                          &test))
     298        return NULL;
     299    _rv = IsCmdChar(&event,
     300                    test);
     301    _res = Py_BuildValue("b",
     302                         _rv);
     303    return _res;
    304304}
    305305
    306306static PyObject *Evt_LMGetKeyThresh(PyObject *_self, PyObject *_args)
    307307{
    308         PyObject *_res = NULL;
    309         SInt16 _rv;
     308    PyObject *_res = NULL;
     309    SInt16 _rv;
    310310#ifndef LMGetKeyThresh
    311         PyMac_PRECHECK(LMGetKeyThresh);
    312 #endif
    313         if (!PyArg_ParseTuple(_args, ""))
    314                 return NULL;
    315         _rv = LMGetKeyThresh();
    316         _res = Py_BuildValue("h",
    317                              _rv);
    318         return _res;
     311    PyMac_PRECHECK(LMGetKeyThresh);
     312#endif
     313    if (!PyArg_ParseTuple(_args, ""))
     314        return NULL;
     315    _rv = LMGetKeyThresh();
     316    _res = Py_BuildValue("h",
     317                         _rv);
     318    return _res;
    319319}
    320320
    321321static PyObject *Evt_LMSetKeyThresh(PyObject *_self, PyObject *_args)
    322322{
    323         PyObject *_res = NULL;
    324         SInt16 value;
     323    PyObject *_res = NULL;
     324    SInt16 value;
    325325#ifndef LMSetKeyThresh
    326         PyMac_PRECHECK(LMSetKeyThresh);
    327 #endif
    328         if (!PyArg_ParseTuple(_args, "h",
    329                               &value))
    330                 return NULL;
    331         LMSetKeyThresh(value);
    332         Py_INCREF(Py_None);
    333         _res = Py_None;
    334         return _res;
     326    PyMac_PRECHECK(LMSetKeyThresh);
     327#endif
     328    if (!PyArg_ParseTuple(_args, "h",
     329                          &value))
     330        return NULL;
     331    LMSetKeyThresh(value);
     332    Py_INCREF(Py_None);
     333    _res = Py_None;
     334    return _res;
    335335}
    336336
    337337static PyObject *Evt_LMGetKeyRepThresh(PyObject *_self, PyObject *_args)
    338338{
    339         PyObject *_res = NULL;
    340         SInt16 _rv;
     339    PyObject *_res = NULL;
     340    SInt16 _rv;
    341341#ifndef LMGetKeyRepThresh
    342         PyMac_PRECHECK(LMGetKeyRepThresh);
    343 #endif
    344         if (!PyArg_ParseTuple(_args, ""))
    345                 return NULL;
    346         _rv = LMGetKeyRepThresh();
    347         _res = Py_BuildValue("h",
    348                              _rv);
    349         return _res;
     342    PyMac_PRECHECK(LMGetKeyRepThresh);
     343#endif
     344    if (!PyArg_ParseTuple(_args, ""))
     345        return NULL;
     346    _rv = LMGetKeyRepThresh();
     347    _res = Py_BuildValue("h",
     348                         _rv);
     349    return _res;
    350350}
    351351
    352352static PyObject *Evt_LMSetKeyRepThresh(PyObject *_self, PyObject *_args)
    353353{
    354         PyObject *_res = NULL;
    355         SInt16 value;
     354    PyObject *_res = NULL;
     355    SInt16 value;
    356356#ifndef LMSetKeyRepThresh
    357         PyMac_PRECHECK(LMSetKeyRepThresh);
    358 #endif
    359         if (!PyArg_ParseTuple(_args, "h",
    360                               &value))
    361                 return NULL;
    362         LMSetKeyRepThresh(value);
    363         Py_INCREF(Py_None);
    364         _res = Py_None;
    365         return _res;
     357    PyMac_PRECHECK(LMSetKeyRepThresh);
     358#endif
     359    if (!PyArg_ParseTuple(_args, "h",
     360                          &value))
     361        return NULL;
     362    LMSetKeyRepThresh(value);
     363    Py_INCREF(Py_None);
     364    _res = Py_None;
     365    return _res;
    366366}
    367367
    368368static PyObject *Evt_LMGetKbdLast(PyObject *_self, PyObject *_args)
    369369{
    370         PyObject *_res = NULL;
    371         UInt8 _rv;
     370    PyObject *_res = NULL;
     371    UInt8 _rv;
    372372#ifndef LMGetKbdLast
    373         PyMac_PRECHECK(LMGetKbdLast);
    374 #endif
    375         if (!PyArg_ParseTuple(_args, ""))
    376                 return NULL;
    377         _rv = LMGetKbdLast();
    378         _res = Py_BuildValue("b",
    379                              _rv);
    380         return _res;
     373    PyMac_PRECHECK(LMGetKbdLast);
     374#endif
     375    if (!PyArg_ParseTuple(_args, ""))
     376        return NULL;
     377    _rv = LMGetKbdLast();
     378    _res = Py_BuildValue("b",
     379                         _rv);
     380    return _res;
    381381}
    382382
    383383static PyObject *Evt_LMSetKbdLast(PyObject *_self, PyObject *_args)
    384384{
    385         PyObject *_res = NULL;
    386         UInt8 value;
     385    PyObject *_res = NULL;
     386    UInt8 value;
    387387#ifndef LMSetKbdLast
    388         PyMac_PRECHECK(LMSetKbdLast);
    389 #endif
    390         if (!PyArg_ParseTuple(_args, "b",
    391                               &value))
    392                 return NULL;
    393         LMSetKbdLast(value);
    394         Py_INCREF(Py_None);
    395         _res = Py_None;
    396         return _res;
     388    PyMac_PRECHECK(LMSetKbdLast);
     389#endif
     390    if (!PyArg_ParseTuple(_args, "b",
     391                          &value))
     392        return NULL;
     393    LMSetKbdLast(value);
     394    Py_INCREF(Py_None);
     395    _res = Py_None;
     396    return _res;
    397397}
    398398
    399399static PyObject *Evt_LMGetKbdType(PyObject *_self, PyObject *_args)
    400400{
    401         PyObject *_res = NULL;
    402         UInt8 _rv;
     401    PyObject *_res = NULL;
     402    UInt8 _rv;
    403403#ifndef LMGetKbdType
    404         PyMac_PRECHECK(LMGetKbdType);
    405 #endif
    406         if (!PyArg_ParseTuple(_args, ""))
    407                 return NULL;
    408         _rv = LMGetKbdType();
    409         _res = Py_BuildValue("b",
    410                              _rv);
    411         return _res;
     404    PyMac_PRECHECK(LMGetKbdType);
     405#endif
     406    if (!PyArg_ParseTuple(_args, ""))
     407        return NULL;
     408    _rv = LMGetKbdType();
     409    _res = Py_BuildValue("b",
     410                         _rv);
     411    return _res;
    412412}
    413413
    414414static PyObject *Evt_LMSetKbdType(PyObject *_self, PyObject *_args)
    415415{
    416         PyObject *_res = NULL;
    417         UInt8 value;
     416    PyObject *_res = NULL;
     417    UInt8 value;
    418418#ifndef LMSetKbdType
    419         PyMac_PRECHECK(LMSetKbdType);
    420 #endif
    421         if (!PyArg_ParseTuple(_args, "b",
    422                               &value))
    423                 return NULL;
    424         LMSetKbdType(value);
    425         Py_INCREF(Py_None);
    426         _res = Py_None;
    427         return _res;
     419    PyMac_PRECHECK(LMSetKbdType);
     420#endif
     421    if (!PyArg_ParseTuple(_args, "b",
     422                          &value))
     423        return NULL;
     424    LMSetKbdType(value);
     425    Py_INCREF(Py_None);
     426    _res = Py_None;
     427    return _res;
    428428}
    429429
    430430static PyObject *Evt_TickCount(PyObject *_self, PyObject *_args)
    431431{
    432         PyObject *_res = NULL;
    433         UInt32 _rv;
     432    PyObject *_res = NULL;
     433    UInt32 _rv;
    434434#ifndef TickCount
    435         PyMac_PRECHECK(TickCount);
    436 #endif
    437         if (!PyArg_ParseTuple(_args, ""))
    438                 return NULL;
    439         _rv = TickCount();
    440         _res = Py_BuildValue("l",
    441                              _rv);
    442         return _res;
     435    PyMac_PRECHECK(TickCount);
     436#endif
     437    if (!PyArg_ParseTuple(_args, ""))
     438        return NULL;
     439    _rv = TickCount();
     440    _res = Py_BuildValue("l",
     441                         _rv);
     442    return _res;
    443443}
    444444
    445445static PyObject *Evt_WaitNextEvent(PyObject *_self, PyObject *_args)
    446446{
    447         PyObject *_res = NULL;
    448 
    449         Boolean _rv;
    450         EventMask eventMask;
    451         EventRecord theEvent;
    452         UInt32 sleep;
    453         Handle mouseregion = (Handle)0;
    454 
    455         if (!PyArg_ParseTuple(_args, "Hl|O&",
    456                               &eventMask,
    457                               &sleep,
    458                               OptResObj_Convert, &mouseregion))
    459                 return NULL;
    460         _rv = WaitNextEvent(eventMask,
    461                             &theEvent,
    462                             sleep,
    463                             (RgnHandle)mouseregion);
    464         _res = Py_BuildValue("bO&",
    465                              _rv,
    466                              PyMac_BuildEventRecord, &theEvent);
    467         return _res;
     447    PyObject *_res = NULL;
     448
     449    Boolean _rv;
     450    EventMask eventMask;
     451    EventRecord theEvent;
     452    UInt32 sleep;
     453    Handle mouseregion = (Handle)0;
     454
     455    if (!PyArg_ParseTuple(_args, "Hl|O&",
     456                          &eventMask,
     457                          &sleep,
     458                          OptResObj_Convert, &mouseregion))
     459        return NULL;
     460    _rv = WaitNextEvent(eventMask,
     461                        &theEvent,
     462                        sleep,
     463                        (RgnHandle)mouseregion);
     464    _res = Py_BuildValue("bO&",
     465                         _rv,
     466                         PyMac_BuildEventRecord, &theEvent);
     467    return _res;
    468468
    469469}
    470470
    471471static PyMethodDef Evt_methods[] = {
    472         {"GetMouse", (PyCFunction)Evt_GetMouse, 1,
    473         PyDoc_STR("() -> (Point mouseLoc)")},
    474         {"Button", (PyCFunction)Evt_Button, 1,
    475         PyDoc_STR("() -> (Boolean _rv)")},
    476         {"StillDown", (PyCFunction)Evt_StillDown, 1,
    477         PyDoc_STR("() -> (Boolean _rv)")},
    478         {"WaitMouseUp", (PyCFunction)Evt_WaitMouseUp, 1,
    479         PyDoc_STR("() -> (Boolean _rv)")},
    480         {"GetCaretTime", (PyCFunction)Evt_GetCaretTime, 1,
    481         PyDoc_STR("() -> (UInt32 _rv)")},
    482         {"GetKeys", (PyCFunction)Evt_GetKeys, 1,
    483         PyDoc_STR("() -> (KeyMap theKeys)")},
    484         {"GetDblTime", (PyCFunction)Evt_GetDblTime, 1,
    485         PyDoc_STR("() -> (UInt32 _rv)")},
    486         {"SetEventMask", (PyCFunction)Evt_SetEventMask, 1,
    487         PyDoc_STR("(EventMask value) -> None")},
    488         {"GetNextEvent", (PyCFunction)Evt_GetNextEvent, 1,
    489         PyDoc_STR("(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)")},
    490         {"EventAvail", (PyCFunction)Evt_EventAvail, 1,
    491         PyDoc_STR("(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)")},
    492         {"PostEvent", (PyCFunction)Evt_PostEvent, 1,
    493         PyDoc_STR("(EventKind eventNum, UInt32 eventMsg) -> None")},
    494         {"FlushEvents", (PyCFunction)Evt_FlushEvents, 1,
    495         PyDoc_STR("(EventMask whichMask, EventMask stopMask) -> None")},
    496         {"GetGlobalMouse", (PyCFunction)Evt_GetGlobalMouse, 1,
    497         PyDoc_STR("() -> (Point globalMouse)")},
    498         {"GetCurrentKeyModifiers", (PyCFunction)Evt_GetCurrentKeyModifiers, 1,
    499         PyDoc_STR("() -> (UInt32 _rv)")},
    500         {"CheckEventQueueForUserCancel", (PyCFunction)Evt_CheckEventQueueForUserCancel, 1,
    501         PyDoc_STR("() -> (Boolean _rv)")},
    502         {"KeyScript", (PyCFunction)Evt_KeyScript, 1,
    503         PyDoc_STR("(short code) -> None")},
    504         {"IsCmdChar", (PyCFunction)Evt_IsCmdChar, 1,
    505         PyDoc_STR("(EventRecord event, short test) -> (Boolean _rv)")},
    506         {"LMGetKeyThresh", (PyCFunction)Evt_LMGetKeyThresh, 1,
    507         PyDoc_STR("() -> (SInt16 _rv)")},
    508         {"LMSetKeyThresh", (PyCFunction)Evt_LMSetKeyThresh, 1,
    509         PyDoc_STR("(SInt16 value) -> None")},
    510         {"LMGetKeyRepThresh", (PyCFunction)Evt_LMGetKeyRepThresh, 1,
    511         PyDoc_STR("() -> (SInt16 _rv)")},
    512         {"LMSetKeyRepThresh", (PyCFunction)Evt_LMSetKeyRepThresh, 1,
    513         PyDoc_STR("(SInt16 value) -> None")},
    514         {"LMGetKbdLast", (PyCFunction)Evt_LMGetKbdLast, 1,
    515         PyDoc_STR("() -> (UInt8 _rv)")},
    516         {"LMSetKbdLast", (PyCFunction)Evt_LMSetKbdLast, 1,
    517         PyDoc_STR("(UInt8 value) -> None")},
    518         {"LMGetKbdType", (PyCFunction)Evt_LMGetKbdType, 1,
    519         PyDoc_STR("() -> (UInt8 _rv)")},
    520         {"LMSetKbdType", (PyCFunction)Evt_LMSetKbdType, 1,
    521         PyDoc_STR("(UInt8 value) -> None")},
    522         {"TickCount", (PyCFunction)Evt_TickCount, 1,
    523         PyDoc_STR("() -> (UInt32 _rv)")},
    524         {"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1,
    525         PyDoc_STR("(EventMask eventMask, UInt32 sleep [,RegionHandle]) -> (Boolean _rv, EventRecord theEvent)")},
    526         {NULL, NULL, 0}
     472    {"GetMouse", (PyCFunction)Evt_GetMouse, 1,
     473    PyDoc_STR("() -> (Point mouseLoc)")},
     474    {"Button", (PyCFunction)Evt_Button, 1,
     475    PyDoc_STR("() -> (Boolean _rv)")},
     476    {"StillDown", (PyCFunction)Evt_StillDown, 1,
     477    PyDoc_STR("() -> (Boolean _rv)")},
     478    {"WaitMouseUp", (PyCFunction)Evt_WaitMouseUp, 1,
     479    PyDoc_STR("() -> (Boolean _rv)")},
     480    {"GetCaretTime", (PyCFunction)Evt_GetCaretTime, 1,
     481    PyDoc_STR("() -> (UInt32 _rv)")},
     482    {"GetKeys", (PyCFunction)Evt_GetKeys, 1,
     483    PyDoc_STR("() -> (KeyMap theKeys)")},
     484    {"GetDblTime", (PyCFunction)Evt_GetDblTime, 1,
     485    PyDoc_STR("() -> (UInt32 _rv)")},
     486    {"SetEventMask", (PyCFunction)Evt_SetEventMask, 1,
     487    PyDoc_STR("(EventMask value) -> None")},
     488    {"GetNextEvent", (PyCFunction)Evt_GetNextEvent, 1,
     489    PyDoc_STR("(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)")},
     490    {"EventAvail", (PyCFunction)Evt_EventAvail, 1,
     491    PyDoc_STR("(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)")},
     492    {"PostEvent", (PyCFunction)Evt_PostEvent, 1,
     493    PyDoc_STR("(EventKind eventNum, UInt32 eventMsg) -> None")},
     494    {"FlushEvents", (PyCFunction)Evt_FlushEvents, 1,
     495    PyDoc_STR("(EventMask whichMask, EventMask stopMask) -> None")},
     496    {"GetGlobalMouse", (PyCFunction)Evt_GetGlobalMouse, 1,
     497    PyDoc_STR("() -> (Point globalMouse)")},
     498    {"GetCurrentKeyModifiers", (PyCFunction)Evt_GetCurrentKeyModifiers, 1,
     499    PyDoc_STR("() -> (UInt32 _rv)")},
     500    {"CheckEventQueueForUserCancel", (PyCFunction)Evt_CheckEventQueueForUserCancel, 1,
     501    PyDoc_STR("() -> (Boolean _rv)")},
     502    {"KeyScript", (PyCFunction)Evt_KeyScript, 1,
     503    PyDoc_STR("(short code) -> None")},
     504    {"IsCmdChar", (PyCFunction)Evt_IsCmdChar, 1,
     505    PyDoc_STR("(EventRecord event, short test) -> (Boolean _rv)")},
     506    {"LMGetKeyThresh", (PyCFunction)Evt_LMGetKeyThresh, 1,
     507    PyDoc_STR("() -> (SInt16 _rv)")},
     508    {"LMSetKeyThresh", (PyCFunction)Evt_LMSetKeyThresh, 1,
     509    PyDoc_STR("(SInt16 value) -> None")},
     510    {"LMGetKeyRepThresh", (PyCFunction)Evt_LMGetKeyRepThresh, 1,
     511    PyDoc_STR("() -> (SInt16 _rv)")},
     512    {"LMSetKeyRepThresh", (PyCFunction)Evt_LMSetKeyRepThresh, 1,
     513    PyDoc_STR("(SInt16 value) -> None")},
     514    {"LMGetKbdLast", (PyCFunction)Evt_LMGetKbdLast, 1,
     515    PyDoc_STR("() -> (UInt8 _rv)")},
     516    {"LMSetKbdLast", (PyCFunction)Evt_LMSetKbdLast, 1,
     517    PyDoc_STR("(UInt8 value) -> None")},
     518    {"LMGetKbdType", (PyCFunction)Evt_LMGetKbdType, 1,
     519    PyDoc_STR("() -> (UInt8 _rv)")},
     520    {"LMSetKbdType", (PyCFunction)Evt_LMSetKbdType, 1,
     521    PyDoc_STR("(UInt8 value) -> None")},
     522    {"TickCount", (PyCFunction)Evt_TickCount, 1,
     523    PyDoc_STR("() -> (UInt32 _rv)")},
     524    {"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1,
     525    PyDoc_STR("(EventMask eventMask, UInt32 sleep [,RegionHandle]) -> (Boolean _rv, EventRecord theEvent)")},
     526    {NULL, NULL, 0}
    527527};
    528528
     
    531531
    532532static PyMethodDef Evt_methods[] = {
    533         {NULL, NULL, 0}
     533    {NULL, NULL, 0}
    534534};
    535535#endif /* __LP64__ */
     
    538538void init_Evt(void)
    539539{
    540         PyObject *m;
     540    PyObject *m;
    541541#ifndef __LP64__
    542         PyObject *d;
     542    PyObject *d;
    543543#endif /* __LP64__ */
    544544
     
    546546
    547547
    548         m = Py_InitModule("_Evt", Evt_methods);
     548    m = Py_InitModule("_Evt", Evt_methods);
    549549#ifndef __LP64__
    550         d = PyModule_GetDict(m);
    551         Evt_Error = PyMac_GetOSErrException();
    552         if (Evt_Error == NULL ||
    553             PyDict_SetItemString(d, "Error", Evt_Error) != 0)
    554                 return;
     550    d = PyModule_GetDict(m);
     551    Evt_Error = PyMac_GetOSErrException();
     552    if (Evt_Error == NULL ||
     553        PyDict_SetItemString(d, "Error", Evt_Error) != 0)
     554        return;
    555555#endif /* __LP64__ */
    556556}
Note: See TracChangeset for help on using the changeset viewer.