Back to index

python3.2  3.2.2
Functions | Variables
_gestalt.c File Reference
#include "Python.h"
#include <Carbon/Carbon.h>

Go to the source code of this file.

Functions

static int convert_to_OSType (PyObject *v, OSType *pr)
static PyObjectgestalt_gestalt (PyObject *self, PyObject *args)
PyMODINIT_FUNC PyInit__gestalt (void)

Variables

static struct PyMethodDef []
static struct PyModuleDef

Function Documentation

static int convert_to_OSType ( PyObject v,
OSType *  pr 
) [static]

Definition at line 33 of file _gestalt.c.

{
    uint32_t tmp;
    if (!PyUnicode_Check(v) || PyUnicode_GetSize(v) != 4) {
    PyErr_SetString(PyExc_TypeError,
                    "OSType arg must be string of 4 chars");
    return 0;
    }
    memcpy((char *)&tmp, _PyUnicode_AsString(v), 4);
    *pr = (OSType)ntohl(tmp);
    return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PyObject* gestalt_gestalt ( PyObject self,
PyObject args 
) [static]

Definition at line 47 of file _gestalt.c.

{
    OSErr iErr;
    OSType selector;
    SInt32 response;
    if (!PyArg_ParseTuple(args, "O&", convert_to_OSType, &selector))
        return NULL;
    iErr = Gestalt(selector, &response);
    if (iErr != 0) {
    PyErr_SetString(PyExc_OSError,
                    "non-zero exit code!");
    return NULL;
    }
    return PyLong_FromLong(response);
}

Here is the call graph for this function:

Definition at line 81 of file _gestalt.c.

{
    return PyModule_Create(&gestaltmodule);
}

Variable Documentation

struct PyMethodDef[] [static]
Initial value:
 {
    {"gestalt", gestalt_gestalt, METH_VARARGS},
    {NULL, NULL} 
}

Definition at line 63 of file _gestalt.c.

struct PyModuleDef [static]
Initial value:
 {
    PyModuleDef_HEAD_INIT,
    "_gestalt",
    NULL,
    -1,
    gestalt_methods,
    NULL,
    NULL,
    NULL,
    NULL
}

Definition at line 68 of file _gestalt.c.