2004-06-01 12:22:42 -03:00
|
|
|
|
|
|
|
/* Generator object interface */
|
|
|
|
|
2010-12-03 16:14:31 -04:00
|
|
|
#ifndef Py_LIMITED_API
|
2004-06-01 12:22:42 -03:00
|
|
|
#ifndef Py_GENOBJECT_H
|
|
|
|
#define Py_GENOBJECT_H
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2004-06-27 12:43:12 -03:00
|
|
|
struct _frame; /* Avoid including frameobject.h */
|
|
|
|
|
2004-06-01 12:22:42 -03:00
|
|
|
typedef struct {
|
2012-01-14 02:08:08 -04:00
|
|
|
PyObject_HEAD
|
|
|
|
/* The gi_ prefix is intended to remind of generator-iterator. */
|
2004-06-01 12:22:42 -03:00
|
|
|
|
2012-01-14 02:08:08 -04:00
|
|
|
/* Note: gi_frame can be NULL if the generator is "finished" */
|
|
|
|
struct _frame *gi_frame;
|
2004-06-01 12:22:42 -03:00
|
|
|
|
2012-01-14 02:08:08 -04:00
|
|
|
/* True if generator is being executed. */
|
2012-03-10 18:43:12 -04:00
|
|
|
char gi_running;
|
2012-03-15 17:37:39 -03:00
|
|
|
|
2012-01-14 02:08:08 -04:00
|
|
|
/* The code object backing the generator */
|
|
|
|
PyObject *gi_code;
|
2004-06-01 12:22:42 -03:00
|
|
|
|
2012-01-14 02:08:08 -04:00
|
|
|
/* List of weak reference. */
|
|
|
|
PyObject *gi_weakreflist;
|
2004-06-01 12:22:42 -03:00
|
|
|
} PyGenObject;
|
|
|
|
|
|
|
|
PyAPI_DATA(PyTypeObject) PyGen_Type;
|
|
|
|
|
|
|
|
#define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type)
|
2007-12-18 22:45:37 -04:00
|
|
|
#define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type)
|
2004-06-01 12:22:42 -03:00
|
|
|
|
2004-06-27 12:43:12 -03:00
|
|
|
PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *);
|
2006-04-21 07:40:58 -03:00
|
|
|
PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *);
|
2012-06-17 02:15:49 -03:00
|
|
|
PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
|
2012-03-15 17:37:39 -03:00
|
|
|
PyObject *_PyGen_Send(PyGenObject *, PyObject *);
|
2004-06-01 12:22:42 -03:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* !Py_GENOBJECT_H */
|
2010-12-03 16:14:31 -04:00
|
|
|
#endif /* Py_LIMITED_API */
|