ยปCore Development>Code coverage>Mac/Modules/gestaltmodule.c

Python code coverage for Mac/Modules/gestaltmodule.c

#countcontent
1n/a/***********************************************************
2n/aCopyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam,
3n/aThe Netherlands.
4n/a
5n/a All Rights Reserved
6n/a
7n/aPermission to use, copy, modify, and distribute this software and its
8n/adocumentation for any purpose and without fee is hereby granted,
9n/aprovided that the above copyright notice appear in all copies and that
10n/aboth that copyright notice and this permission notice appear in
11n/asupporting documentation, and that the names of Stichting Mathematisch
12n/aCentrum or CWI not be used in advertising or publicity pertaining to
13n/adistribution of the software without specific, written prior permission.
14n/a
15n/aSTICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
16n/aTHIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17n/aFITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
18n/aFOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19n/aWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20n/aACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21n/aOF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22n/a
23n/a******************************************************************/
24n/a
25n/a/* Macintosh Gestalt interface */
26n/a
27n/a#include "Python.h"
28n/a#include "pymactoolbox.h"
29n/a
30n/a#include <Carbon/Carbon.h>
31n/a
32n/astatic PyObject *
33n/agestalt_gestalt(PyObject *self, PyObject *args)
34n/a{
35n/a OSErr iErr;
36n/a OSType selector;
37n/a SInt32 response;
38n/a if (!PyArg_ParseTuple(args, "O&", PyMac_GetOSType, &selector))
39n/a return NULL;
40n/a iErr = Gestalt ( selector, &response );
41n/a if (iErr != 0)
42n/a return PyMac_Error(iErr);
43n/a return PyInt_FromLong(response);
44n/a}
45n/a
46n/astatic struct PyMethodDef gestalt_methods[] = {
47n/a {"gestalt", gestalt_gestalt, METH_VARARGS},
48n/a {NULL, NULL} /* Sentinel */
49n/a};
50n/a
51n/avoid
52n/ainitgestalt(void)
53n/a{
54n/a Py_InitModule("gestalt", gestalt_methods);
55n/a}