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