Guido van Rossum | 77654a7 | 1996-01-12 00:44:03 +0000 | [diff] [blame] | 1 | #ifndef Py_COBJECT_H |
| 2 | #define Py_COBJECT_H |
| 3 | #ifdef __cplusplus |
| 4 | extern "C" { |
| 5 | #endif |
| 6 | |
| 7 | /*********************************************************** |
| 8 | Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, |
| 9 | The Netherlands. |
| 10 | |
| 11 | All Rights Reserved |
| 12 | |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame] | 13 | Permission to use, copy, modify, and distribute this software and its |
| 14 | documentation for any purpose and without fee is hereby granted, |
Guido van Rossum | 77654a7 | 1996-01-12 00:44:03 +0000 | [diff] [blame] | 15 | provided that the above copyright notice appear in all copies and that |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame] | 16 | both that copyright notice and this permission notice appear in |
Guido van Rossum | 77654a7 | 1996-01-12 00:44:03 +0000 | [diff] [blame] | 17 | supporting documentation, and that the names of Stichting Mathematisch |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame] | 18 | Centrum or CWI or Corporation for National Research Initiatives or |
| 19 | CNRI not be used in advertising or publicity pertaining to |
| 20 | distribution of the software without specific, written prior |
| 21 | permission. |
Guido van Rossum | 77654a7 | 1996-01-12 00:44:03 +0000 | [diff] [blame] | 22 | |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame] | 23 | While CWI is the initial source for this software, a modified version |
| 24 | is made available by the Corporation for National Research Initiatives |
| 25 | (CNRI) at the Internet address ftp://ftp.python.org. |
| 26 | |
| 27 | STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH |
| 28 | REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF |
| 29 | MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH |
| 30 | CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL |
| 31 | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 32 | PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 33 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 34 | PERFORMANCE OF THIS SOFTWARE. |
Guido van Rossum | 77654a7 | 1996-01-12 00:44:03 +0000 | [diff] [blame] | 35 | |
| 36 | ******************************************************************/ |
| 37 | |
| 38 | /* C objects to be exported from one extension module to another. |
| 39 | |
| 40 | C objects are used for communication between extension modules. |
| 41 | They provide a way for an extension module to export a C interface |
| 42 | to other extension modules, so that extension modules can use the |
| 43 | Python import mechanism to link to one another. |
| 44 | |
| 45 | */ |
| 46 | |
| 47 | extern DL_IMPORT(PyTypeObject) PyCObject_Type; |
| 48 | |
| 49 | #define PyCObject_Check(op) ((op)->ob_type == &PyCObject_Type) |
| 50 | |
| 51 | /* Create a PyCObject from a pointer to a C object and an optional |
| 52 | destrutor function. If the second argument is non-null, then it |
| 53 | will be called with the first argument if and when the PyCObject is |
| 54 | destroyed. |
| 55 | |
| 56 | */ |
| 57 | |
| 58 | extern PyObject * |
| 59 | PyCObject_FromVoidPtr Py_PROTO((void *cobj, void (*destruct)(void*))); |
| 60 | |
| 61 | /* Retrieve a pointer to a C object from a PyCObject. */ |
| 62 | extern void * |
| 63 | PyCObject_AsVoidPtr Py_PROTO((PyObject *)); |
| 64 | |
| 65 | #ifdef __cplusplus |
| 66 | } |
| 67 | #endif |
| 68 | #endif /* !Py_COBJECT_H */ |