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