Martin v. Löwis | e440e47 | 2004-06-01 15:22:42 +0000 | [diff] [blame] | 1 | |
| 2 | /* Generator object interface */ |
| 3 | |
| 4 | #ifndef Py_GENOBJECT_H |
| 5 | #define Py_GENOBJECT_H |
| 6 | #ifdef __cplusplus |
| 7 | extern "C" { |
| 8 | #endif |
| 9 | |
| 10 | typedef struct { |
| 11 | PyObject_HEAD |
| 12 | /* The gi_ prefix is intended to remind of generator-iterator. */ |
| 13 | |
| 14 | PyFrameObject *gi_frame; |
| 15 | |
| 16 | /* True if generator is being executed. */ |
| 17 | int gi_running; |
| 18 | |
| 19 | /* List of weak reference. */ |
| 20 | PyObject *gi_weakreflist; |
| 21 | } PyGenObject; |
| 22 | |
| 23 | PyAPI_DATA(PyTypeObject) PyGen_Type; |
| 24 | |
| 25 | #define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type) |
| 26 | #define PyGen_CheckExact(op) ((op)->ob_type == &PyGen_Type) |
| 27 | |
| 28 | PyAPI_FUNC(PyObject *) PyGen_New(PyFrameObject *); |
| 29 | |
| 30 | #ifdef __cplusplus |
| 31 | } |
| 32 | #endif |
| 33 | #endif /* !Py_GENOBJECT_H */ |