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/help/_Helpmodule.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
     
    2323static PyObject *Help_HMGetHelpMenu(PyObject *_self, PyObject *_args)
    2424{
    25         PyObject *_res = NULL;
    26         OSStatus _err;
    27         MenuRef outHelpMenu;
    28         MenuItemIndex outFirstCustomItemIndex;
    29         if (!PyArg_ParseTuple(_args, ""))
    30                 return NULL;
    31         _err = HMGetHelpMenu(&outHelpMenu,
    32                              &outFirstCustomItemIndex);
    33         if (_err != noErr) return PyMac_Error(_err);
    34         _res = Py_BuildValue("O&H",
    35                              MenuObj_New, outHelpMenu,
    36                              outFirstCustomItemIndex);
    37         return _res;
     25    PyObject *_res = NULL;
     26    OSStatus _err;
     27    MenuRef outHelpMenu;
     28    MenuItemIndex outFirstCustomItemIndex;
     29    if (!PyArg_ParseTuple(_args, ""))
     30        return NULL;
     31    _err = HMGetHelpMenu(&outHelpMenu,
     32                         &outFirstCustomItemIndex);
     33    if (_err != noErr) return PyMac_Error(_err);
     34    _res = Py_BuildValue("O&H",
     35                         MenuObj_New, outHelpMenu,
     36                         outFirstCustomItemIndex);
     37    return _res;
    3838}
    3939
    4040static PyObject *Help_HMAreHelpTagsDisplayed(PyObject *_self, PyObject *_args)
    4141{
    42         PyObject *_res = NULL;
    43         Boolean _rv;
    44         if (!PyArg_ParseTuple(_args, ""))
    45                 return NULL;
    46         _rv = HMAreHelpTagsDisplayed();
    47         _res = Py_BuildValue("b",
    48                              _rv);
    49         return _res;
     42    PyObject *_res = NULL;
     43    Boolean _rv;
     44    if (!PyArg_ParseTuple(_args, ""))
     45        return NULL;
     46    _rv = HMAreHelpTagsDisplayed();
     47    _res = Py_BuildValue("b",
     48                         _rv);
     49    return _res;
    5050}
    5151
    5252static PyObject *Help_HMSetHelpTagsDisplayed(PyObject *_self, PyObject *_args)
    5353{
    54         PyObject *_res = NULL;
    55         OSStatus _err;
    56         Boolean inDisplayTags;
    57         if (!PyArg_ParseTuple(_args, "b",
    58                               &inDisplayTags))
    59                 return NULL;
    60         _err = HMSetHelpTagsDisplayed(inDisplayTags);
    61         if (_err != noErr) return PyMac_Error(_err);
    62         Py_INCREF(Py_None);
    63         _res = Py_None;
    64         return _res;
     54    PyObject *_res = NULL;
     55    OSStatus _err;
     56    Boolean inDisplayTags;
     57    if (!PyArg_ParseTuple(_args, "b",
     58                          &inDisplayTags))
     59        return NULL;
     60    _err = HMSetHelpTagsDisplayed(inDisplayTags);
     61    if (_err != noErr) return PyMac_Error(_err);
     62    Py_INCREF(Py_None);
     63    _res = Py_None;
     64    return _res;
    6565}
    6666
    6767static PyObject *Help_HMSetTagDelay(PyObject *_self, PyObject *_args)
    6868{
    69         PyObject *_res = NULL;
    70         OSStatus _err;
    71         Duration inDelay;
    72         if (!PyArg_ParseTuple(_args, "l",
    73                               &inDelay))
    74                 return NULL;
    75         _err = HMSetTagDelay(inDelay);
    76         if (_err != noErr) return PyMac_Error(_err);
    77         Py_INCREF(Py_None);
    78         _res = Py_None;
    79         return _res;
     69    PyObject *_res = NULL;
     70    OSStatus _err;
     71    Duration inDelay;
     72    if (!PyArg_ParseTuple(_args, "l",
     73                          &inDelay))
     74        return NULL;
     75    _err = HMSetTagDelay(inDelay);
     76    if (_err != noErr) return PyMac_Error(_err);
     77    Py_INCREF(Py_None);
     78    _res = Py_None;
     79    return _res;
    8080}
    8181
    8282static PyObject *Help_HMGetTagDelay(PyObject *_self, PyObject *_args)
    8383{
    84         PyObject *_res = NULL;
    85         OSStatus _err;
    86         Duration outDelay;
    87         if (!PyArg_ParseTuple(_args, ""))
    88                 return NULL;
    89         _err = HMGetTagDelay(&outDelay);
    90         if (_err != noErr) return PyMac_Error(_err);
    91         _res = Py_BuildValue("l",
    92                              outDelay);
    93         return _res;
     84    PyObject *_res = NULL;
     85    OSStatus _err;
     86    Duration outDelay;
     87    if (!PyArg_ParseTuple(_args, ""))
     88        return NULL;
     89    _err = HMGetTagDelay(&outDelay);
     90    if (_err != noErr) return PyMac_Error(_err);
     91    _res = Py_BuildValue("l",
     92                         outDelay);
     93    return _res;
    9494}
    9595
    9696static PyObject *Help_HMSetMenuHelpFromBalloonRsrc(PyObject *_self, PyObject *_args)
    9797{
    98         PyObject *_res = NULL;
    99         OSStatus _err;
    100         MenuRef inMenu;
    101         SInt16 inHmnuRsrcID;
    102         if (!PyArg_ParseTuple(_args, "O&h",
    103                               MenuObj_Convert, &inMenu,
    104                               &inHmnuRsrcID))
    105                 return NULL;
    106         _err = HMSetMenuHelpFromBalloonRsrc(inMenu,
    107                                             inHmnuRsrcID);
    108         if (_err != noErr) return PyMac_Error(_err);
    109         Py_INCREF(Py_None);
    110         _res = Py_None;
    111         return _res;
     98    PyObject *_res = NULL;
     99    OSStatus _err;
     100    MenuRef inMenu;
     101    SInt16 inHmnuRsrcID;
     102    if (!PyArg_ParseTuple(_args, "O&h",
     103                          MenuObj_Convert, &inMenu,
     104                          &inHmnuRsrcID))
     105        return NULL;
     106    _err = HMSetMenuHelpFromBalloonRsrc(inMenu,
     107                                        inHmnuRsrcID);
     108    if (_err != noErr) return PyMac_Error(_err);
     109    Py_INCREF(Py_None);
     110    _res = Py_None;
     111    return _res;
    112112}
    113113
    114114static PyObject *Help_HMSetDialogHelpFromBalloonRsrc(PyObject *_self, PyObject *_args)
    115115{
    116         PyObject *_res = NULL;
    117         OSStatus _err;
    118         DialogPtr inDialog;
    119         SInt16 inHdlgRsrcID;
    120         SInt16 inItemStart;
    121         if (!PyArg_ParseTuple(_args, "O&hh",
    122                               DlgObj_Convert, &inDialog,
    123                               &inHdlgRsrcID,
    124                               &inItemStart))
    125                 return NULL;
    126         _err = HMSetDialogHelpFromBalloonRsrc(inDialog,
    127                                               inHdlgRsrcID,
    128                                               inItemStart);
    129         if (_err != noErr) return PyMac_Error(_err);
    130         Py_INCREF(Py_None);
    131         _res = Py_None;
    132         return _res;
     116    PyObject *_res = NULL;
     117    OSStatus _err;
     118    DialogPtr inDialog;
     119    SInt16 inHdlgRsrcID;
     120    SInt16 inItemStart;
     121    if (!PyArg_ParseTuple(_args, "O&hh",
     122                          DlgObj_Convert, &inDialog,
     123                          &inHdlgRsrcID,
     124                          &inItemStart))
     125        return NULL;
     126    _err = HMSetDialogHelpFromBalloonRsrc(inDialog,
     127                                          inHdlgRsrcID,
     128                                          inItemStart);
     129    if (_err != noErr) return PyMac_Error(_err);
     130    Py_INCREF(Py_None);
     131    _res = Py_None;
     132    return _res;
    133133}
    134134
    135135static PyObject *Help_HMHideTag(PyObject *_self, PyObject *_args)
    136136{
    137         PyObject *_res = NULL;
    138         OSStatus _err;
    139         if (!PyArg_ParseTuple(_args, ""))
    140                 return NULL;
    141         _err = HMHideTag();
    142         if (_err != noErr) return PyMac_Error(_err);
    143         Py_INCREF(Py_None);
    144         _res = Py_None;
    145         return _res;
     137    PyObject *_res = NULL;
     138    OSStatus _err;
     139    if (!PyArg_ParseTuple(_args, ""))
     140        return NULL;
     141    _err = HMHideTag();
     142    if (_err != noErr) return PyMac_Error(_err);
     143    Py_INCREF(Py_None);
     144    _res = Py_None;
     145    return _res;
    146146}
    147147
     
    150150static PyMethodDef Help_methods[] = {
    151151#ifndef __LP64__
    152         {"HMGetHelpMenu", (PyCFunction)Help_HMGetHelpMenu, 1,
    153         PyDoc_STR("() -> (MenuRef outHelpMenu, MenuItemIndex outFirstCustomItemIndex)")},
    154         {"HMAreHelpTagsDisplayed", (PyCFunction)Help_HMAreHelpTagsDisplayed, 1,
    155         PyDoc_STR("() -> (Boolean _rv)")},
    156         {"HMSetHelpTagsDisplayed", (PyCFunction)Help_HMSetHelpTagsDisplayed, 1,
    157         PyDoc_STR("(Boolean inDisplayTags) -> None")},
    158         {"HMSetTagDelay", (PyCFunction)Help_HMSetTagDelay, 1,
    159         PyDoc_STR("(Duration inDelay) -> None")},
    160         {"HMGetTagDelay", (PyCFunction)Help_HMGetTagDelay, 1,
    161         PyDoc_STR("() -> (Duration outDelay)")},
    162         {"HMSetMenuHelpFromBalloonRsrc", (PyCFunction)Help_HMSetMenuHelpFromBalloonRsrc, 1,
    163         PyDoc_STR("(MenuRef inMenu, SInt16 inHmnuRsrcID) -> None")},
    164         {"HMSetDialogHelpFromBalloonRsrc", (PyCFunction)Help_HMSetDialogHelpFromBalloonRsrc, 1,
    165         PyDoc_STR("(DialogPtr inDialog, SInt16 inHdlgRsrcID, SInt16 inItemStart) -> None")},
    166         {"HMHideTag", (PyCFunction)Help_HMHideTag, 1,
    167         PyDoc_STR("() -> None")},
     152    {"HMGetHelpMenu", (PyCFunction)Help_HMGetHelpMenu, 1,
     153    PyDoc_STR("() -> (MenuRef outHelpMenu, MenuItemIndex outFirstCustomItemIndex)")},
     154    {"HMAreHelpTagsDisplayed", (PyCFunction)Help_HMAreHelpTagsDisplayed, 1,
     155    PyDoc_STR("() -> (Boolean _rv)")},
     156    {"HMSetHelpTagsDisplayed", (PyCFunction)Help_HMSetHelpTagsDisplayed, 1,
     157    PyDoc_STR("(Boolean inDisplayTags) -> None")},
     158    {"HMSetTagDelay", (PyCFunction)Help_HMSetTagDelay, 1,
     159    PyDoc_STR("(Duration inDelay) -> None")},
     160    {"HMGetTagDelay", (PyCFunction)Help_HMGetTagDelay, 1,
     161    PyDoc_STR("() -> (Duration outDelay)")},
     162    {"HMSetMenuHelpFromBalloonRsrc", (PyCFunction)Help_HMSetMenuHelpFromBalloonRsrc, 1,
     163    PyDoc_STR("(MenuRef inMenu, SInt16 inHmnuRsrcID) -> None")},
     164    {"HMSetDialogHelpFromBalloonRsrc", (PyCFunction)Help_HMSetDialogHelpFromBalloonRsrc, 1,
     165    PyDoc_STR("(DialogPtr inDialog, SInt16 inHdlgRsrcID, SInt16 inItemStart) -> None")},
     166    {"HMHideTag", (PyCFunction)Help_HMHideTag, 1,
     167    PyDoc_STR("() -> None")},
    168168#endif /* __LP64__ */
    169         {NULL, NULL, 0}
     169    {NULL, NULL, 0}
    170170};
    171171
     
    175175void init_Help(void)
    176176{
    177         PyObject *m;
     177    PyObject *m;
    178178#ifndef __LP64__
    179         PyObject *d;
     179    PyObject *d;
    180180#endif /* __LP64__ */
    181181
     
    183183
    184184
    185         m = Py_InitModule("_Help", Help_methods);
     185    m = Py_InitModule("_Help", Help_methods);
    186186#ifndef __LP64__
    187         d = PyModule_GetDict(m);
    188         Help_Error = PyMac_GetOSErrException();
    189         if (Help_Error == NULL ||
    190             PyDict_SetItemString(d, "Error", Help_Error) != 0)
    191                 return;
     187    d = PyModule_GetDict(m);
     188    Help_Error = PyMac_GetOSErrException();
     189    if (Help_Error == NULL ||
     190        PyDict_SetItemString(d, "Error", Help_Error) != 0)
     191        return;
    192192#endif /* __LP64__ */
    193193}
Note: See TracChangeset for help on using the changeset viewer.