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 | |
Martin v. Löwis | 8d97e33 | 2004-06-27 15:43:12 +0000 | [diff] [blame] | 10 | struct _frame; /* Avoid including frameobject.h */ |
| 11 | |
Martin v. Löwis | e440e47 | 2004-06-01 15:22:42 +0000 | [diff] [blame] | 12 | typedef struct { |
| 13 | PyObject_HEAD |
| 14 | /* The gi_ prefix is intended to remind of generator-iterator. */ |
| 15 | |
Martin v. Löwis | 8d97e33 | 2004-06-27 15:43:12 +0000 | [diff] [blame] | 16 | struct _frame *gi_frame; |
Martin v. Löwis | e440e47 | 2004-06-01 15:22:42 +0000 | [diff] [blame] | 17 | |
| 18 | /* True if generator is being executed. */ |
| 19 | int gi_running; |
| 20 | |
| 21 | /* List of weak reference. */ |
| 22 | PyObject *gi_weakreflist; |
| 23 | } PyGenObject; |
| 24 | |
| 25 | PyAPI_DATA(PyTypeObject) PyGen_Type; |
| 26 | |
| 27 | #define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type) |
| 28 | #define PyGen_CheckExact(op) ((op)->ob_type == &PyGen_Type) |
| 29 | |
Martin v. Löwis | 8d97e33 | 2004-06-27 15:43:12 +0000 | [diff] [blame] | 30 | PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *); |
Martin v. Löwis | e440e47 | 2004-06-01 15:22:42 +0000 | [diff] [blame] | 31 | |
| 32 | #ifdef __cplusplus |
| 33 | } |
| 34 | #endif |
| 35 | #endif /* !Py_GENOBJECT_H */ |