Jeremy Hylton | fbd849f | 2001-01-25 20:04:14 +0000 | [diff] [blame] | 1 | /* Cell object interface */ |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 2 | #ifndef Py_LIMITED_API |
Jeremy Hylton | fbd849f | 2001-01-25 20:04:14 +0000 | [diff] [blame] | 3 | #ifndef Py_CELLOBJECT_H |
| 4 | #define Py_CELLOBJECT_H |
| 5 | #ifdef __cplusplus |
| 6 | extern "C" { |
| 7 | #endif |
| 8 | |
| 9 | typedef struct { |
Jeremy Hylton | 31e233a | 2002-02-28 23:46:34 +0000 | [diff] [blame] | 10 | PyObject_HEAD |
Armin Rigo | 89a3946 | 2004-10-28 16:32:00 +0000 | [diff] [blame] | 11 | PyObject *ob_ref; /* Content of the cell or NULL when empty */ |
Jeremy Hylton | fbd849f | 2001-01-25 20:04:14 +0000 | [diff] [blame] | 12 | } PyCellObject; |
| 13 | |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 14 | PyAPI_DATA(PyTypeObject) PyCell_Type; |
Jeremy Hylton | fbd849f | 2001-01-25 20:04:14 +0000 | [diff] [blame] | 15 | |
Christian Heimes | 90aa764 | 2007-12-19 02:45:37 +0000 | [diff] [blame] | 16 | #define PyCell_Check(op) (Py_TYPE(op) == &PyCell_Type) |
Jeremy Hylton | fbd849f | 2001-01-25 20:04:14 +0000 | [diff] [blame] | 17 | |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 18 | PyAPI_FUNC(PyObject *) PyCell_New(PyObject *); |
| 19 | PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *); |
| 20 | PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *); |
Jeremy Hylton | fbd849f | 2001-01-25 20:04:14 +0000 | [diff] [blame] | 21 | |
| 22 | #define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref) |
| 23 | #define PyCell_SET(op, v) (((PyCellObject *)(op))->ob_ref = v) |
| 24 | |
| 25 | #ifdef __cplusplus |
| 26 | } |
| 27 | #endif |
| 28 | #endif /* !Py_TUPLEOBJECT_H */ |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 29 | #endif /* Py_LIMITED_API */ |