⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ambulantmodule.cpp

📁 彩信浏览器
💻 CPP
📖 第 1 页 / 共 5 页
字号:
		*p_itself = Py_WrapAs_event(v);		if (*p_itself) return 1;	}#endif	if (!eventObj_Check(v))	{		PyErr_SetString(PyExc_TypeError, "event required");		return 0;	}	*p_itself = ((eventObject *)v)->ob_itself;	return 1;}static void eventObj_dealloc(eventObject *self){	pycppbridge_Type.tp_dealloc((PyObject *)self);}static PyObject *eventObj_fire(eventObject *_self, PyObject *_args){	PyObject *_res = NULL;	if (!PyArg_ParseTuple(_args, ""))		return NULL;	PyThreadState *_save = PyEval_SaveThread();	_self->ob_itself->fire();	PyEval_RestoreThread(_save);	Py_INCREF(Py_None);	_res = Py_None;	return _res;}static PyMethodDef eventObj_methods[] = {	{"fire", (PyCFunction)eventObj_fire, 1,	 PyDoc_STR("() -> None")},	{NULL, NULL, 0}};#define eventObj_getsetlist NULLstatic int eventObj_compare(eventObject *self, eventObject *other){	if ( self->ob_itself > other->ob_itself ) return 1;	if ( self->ob_itself < other->ob_itself ) return -1;	return 0;}#define eventObj_repr NULLstatic int eventObj_hash(eventObject *self){	return (int)self->ob_itself;}static int eventObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds){	ambulant::lib::event* itself;	Py_KEYWORDS_STRING_TYPE *kw[] = {"itself", 0};	if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, eventObj_Convert, &itself))	{		((eventObject *)_self)->ob_itself = itself;		return 0;	}	return -1;}#define eventObj_tp_alloc PyType_GenericAllocstatic PyObject *eventObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds){	PyObject *_self;	if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;	((eventObject *)_self)->ob_itself = NULL;	return _self;}#define eventObj_tp_free PyObject_DelPyTypeObject event_Type = {	PyObject_HEAD_INIT(NULL)	0, /*ob_size*/	"ambulant.event", /*tp_name*/	sizeof(eventObject), /*tp_basicsize*/	0, /*tp_itemsize*/	/* methods */	(destructor) eventObj_dealloc, /*tp_dealloc*/	0, /*tp_print*/	(getattrfunc)0, /*tp_getattr*/	(setattrfunc)0, /*tp_setattr*/	(cmpfunc) eventObj_compare, /*tp_compare*/	(reprfunc) eventObj_repr, /*tp_repr*/	(PyNumberMethods *)0, /* tp_as_number */	(PySequenceMethods *)0, /* tp_as_sequence */	(PyMappingMethods *)0, /* tp_as_mapping */	(hashfunc) eventObj_hash, /*tp_hash*/	0, /*tp_call*/	0, /*tp_str*/	PyObject_GenericGetAttr, /*tp_getattro*/	PyObject_GenericSetAttr, /*tp_setattro */	0, /*tp_as_buffer*/	Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */	0, /*tp_doc*/	0, /*tp_traverse*/	0, /*tp_clear*/	0, /*tp_richcompare*/	0, /*tp_weaklistoffset*/	0, /*tp_iter*/	0, /*tp_iternext*/	eventObj_methods, /* tp_methods */	0, /*tp_members*/	eventObj_getsetlist, /*tp_getset*/	0, /*tp_base*/	0, /*tp_dict*/	0, /*tp_descr_get*/	0, /*tp_descr_set*/	0, /*tp_dictoffset*/	eventObj_tp_init, /* tp_init */	eventObj_tp_alloc, /* tp_alloc */	eventObj_tp_new, /* tp_new */	eventObj_tp_free, /* tp_free */};/* --------------------- End object type event ---------------------- *//* ------------------ Object type event_processor ------------------- */extern PyTypeObject event_processor_Type;inline bool event_processorObj_Check(PyObject *x){	return ((x)->ob_type == &event_processor_Type);}typedef struct event_processorObject {	PyObject_HEAD	void *ob_dummy_wrapper; // Overlays bridge object storage	ambulant::lib::event_processor* ob_itself;} event_processorObject;PyObject *event_processorObj_New(ambulant::lib::event_processor* itself){	event_processorObject *it;	if (itself == NULL)	{		Py_INCREF(Py_None);		return Py_None;	}#ifdef BGEN_BACK_SUPPORT_event_processor	event_processor *encaps_itself = dynamic_cast<event_processor *>(itself);	if (encaps_itself && encaps_itself->py_event_processor)	{		Py_INCREF(encaps_itself->py_event_processor);		return encaps_itself->py_event_processor;	}#endif	it = PyObject_NEW(event_processorObject, &event_processor_Type);	if (it == NULL) return NULL;	/* XXXX Should we tp_init or tp_new our basetype? */	it->ob_dummy_wrapper = NULL; // XXXX Should be done in base class	it->ob_itself = itself;	return (PyObject *)it;}int event_processorObj_Convert(PyObject *v, ambulant::lib::event_processor* *p_itself){	if (v == Py_None)	{		*p_itself = NULL;		return 1;	}#ifdef BGEN_BACK_SUPPORT_event_processor	if (!event_processorObj_Check(v))	{		*p_itself = Py_WrapAs_event_processor(v);		if (*p_itself) return 1;	}#endif	if (!event_processorObj_Check(v))	{		PyErr_SetString(PyExc_TypeError, "event_processor required");		return 0;	}	*p_itself = ((event_processorObject *)v)->ob_itself;	return 1;}static void event_processorObj_dealloc(event_processorObject *self){	pycppbridge_Type.tp_dealloc((PyObject *)self);}static PyObject *event_processorObj_add_event(event_processorObject *_self, PyObject *_args){	PyObject *_res = NULL;	ambulant::lib::event* pe;	ambulant::lib::timer::time_type t;	ambulant::lib::event_priority priority;	if (!PyArg_ParseTuple(_args, "O&ll",	                      eventObj_Convert, &pe,	                      &t,	                      &priority))		return NULL;	PyThreadState *_save = PyEval_SaveThread();	_self->ob_itself->add_event(pe,	                            t,	                            priority);	PyEval_RestoreThread(_save);	Py_INCREF(Py_None);	_res = Py_None;	return _res;}static PyObject *event_processorObj_cancel_all_events(event_processorObject *_self, PyObject *_args){	PyObject *_res = NULL;	if (!PyArg_ParseTuple(_args, ""))		return NULL;	PyThreadState *_save = PyEval_SaveThread();	_self->ob_itself->cancel_all_events();	PyEval_RestoreThread(_save);	Py_INCREF(Py_None);	_res = Py_None;	return _res;}static PyObject *event_processorObj_cancel_event(event_processorObject *_self, PyObject *_args){	PyObject *_res = NULL;	ambulant::lib::event* pe;	ambulant::lib::event_priority priority;	if (!PyArg_ParseTuple(_args, "O&l",	                      eventObj_Convert, &pe,	                      &priority))		return NULL;	PyThreadState *_save = PyEval_SaveThread();	bool _rv = _self->ob_itself->cancel_event(pe,	                                          priority);	PyEval_RestoreThread(_save);	_res = Py_BuildValue("O&",	                     bool_New, _rv);	return _res;}static PyObject *event_processorObj_serve_events(event_processorObject *_self, PyObject *_args){	PyObject *_res = NULL;	if (!PyArg_ParseTuple(_args, ""))		return NULL;	PyThreadState *_save = PyEval_SaveThread();	_self->ob_itself->serve_events();	PyEval_RestoreThread(_save);	Py_INCREF(Py_None);	_res = Py_None;	return _res;}static PyObject *event_processorObj_get_timer(event_processorObject *_self, PyObject *_args){	PyObject *_res = NULL;	if (!PyArg_ParseTuple(_args, ""))		return NULL;	PyThreadState *_save = PyEval_SaveThread();	ambulant::lib::timer* _rv = _self->ob_itself->get_timer();	PyEval_RestoreThread(_save);	_res = Py_BuildValue("O&",	                     timerObj_New, _rv);	return _res;}static PyObject *event_processorObj_stop_processor_thread(event_processorObject *_self, PyObject *_args){	PyObject *_res = NULL;	if (!PyArg_ParseTuple(_args, ""))		return NULL;	PyThreadState *_save = PyEval_SaveThread();	_self->ob_itself->stop_processor_thread();	PyEval_RestoreThread(_save);	Py_INCREF(Py_None);	_res = Py_None;	return _res;}static PyMethodDef event_processorObj_methods[] = {	{"add_event", (PyCFunction)event_processorObj_add_event, 1,	 PyDoc_STR("(ambulant::lib::event* pe, ambulant::lib::timer::time_type t, ambulant::lib::event_priority priority) -> None")},	{"cancel_all_events", (PyCFunction)event_processorObj_cancel_all_events, 1,	 PyDoc_STR("() -> None")},	{"cancel_event", (PyCFunction)event_processorObj_cancel_event, 1,	 PyDoc_STR("(ambulant::lib::event* pe, ambulant::lib::event_priority priority) -> (bool _rv)")},	{"serve_events", (PyCFunction)event_processorObj_serve_events, 1,	 PyDoc_STR("() -> None")},	{"get_timer", (PyCFunction)event_processorObj_get_timer, 1,	 PyDoc_STR("() -> (ambulant::lib::timer* _rv)")},	{"stop_processor_thread", (PyCFunction)event_processorObj_stop_processor_thread, 1,	 PyDoc_STR("() -> None")},	{NULL, NULL, 0}};#define event_processorObj_getsetlist NULLstatic int event_processorObj_compare(event_processorObject *self, event_processorObject *other){	if ( self->ob_itself > other->ob_itself ) return 1;	if ( self->ob_itself < other->ob_itself ) return -1;	return 0;}#define event_processorObj_repr NULLstatic int event_processorObj_hash(event_processorObject *self){	return (int)self->ob_itself;}static int event_processorObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds){	ambulant::lib::event_processor* itself;	Py_KEYWORDS_STRING_TYPE *kw[] = {"itself", 0};	if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, event_processorObj_Convert, &itself))	{		((event_processorObject *)_self)->ob_itself = itself;		return 0;	}	return -1;}#define event_processorObj_tp_alloc PyType_GenericAllocstatic PyObject *event_processorObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds){	PyObject *_self;	if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;	((event_processorObject *)_self)->ob_itself = NULL;	return _self;}#define event_processorObj_tp_free PyObject_DelPyTypeObject event_processor_Type = {	PyObject_HEAD_INIT(NULL)	0, /*ob_size*/	"ambulant.event_processor", /*tp_name*/	sizeof(event_processorObject), /*tp_basicsize*/	0, /*tp_itemsize*/	/* methods */	(destructor) event_processorObj_dealloc, /*tp_dealloc*/	0, /*tp_print*/	(getattrfunc)0, /*tp_getattr*/	(setattrfunc)0, /*tp_setattr*/	(cmpfunc) event_processorObj_compare, /*tp_compare*/	(reprfunc) event_processorObj_repr, /*tp_repr*/	(PyNumberMethods *)0, /* tp_as_number */	(PySequenceMethods *)0, /* tp_as_sequence */	(PyMappingMethods *)0, /* tp_as_mapping */	(hashfunc) event_processorObj_hash, /*tp_hash*/	0, /*tp_call*/	0, /*tp_str*/	PyObject_GenericGetAttr, /*tp_getattro*/	PyObject_GenericSetAttr, /*tp_setattro */	0, /*tp_as_buffer*/	Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */	0, /*tp_doc*/	0, /*tp_traverse*/	0, /*tp_clear*/	0, /*tp_richcompare*/	0, /*tp_weaklistoffset*/	0, /*tp_iter*/	0, /*tp_iternext*/	event_processorObj_methods, /* tp_methods */	0, /*tp_members*/	event_processorObj_getsetlist, /*tp_getset*/	0, /*tp_base*/	0, /*tp_dict*/	0, /*tp_descr_get*/	0, /*tp_descr_set*/	0, /*tp_dictoffset*/	event_processorObj_tp_init, /* tp_init */	event_processorObj_tp_alloc, /* tp_alloc */	event_processorObj_tp_new, /* tp_new */	event_processorObj_tp_free, /* tp_free */};/* ---------------- End object type event_processor ----------------- *//* ------------------- Object type parser_factory ------------------- */extern PyTypeObject parser_factory_Type;inline bool parser_factoryObj_Check(PyObject *x){	return ((x)->ob_type == &parser_factory_Type);}typedef struct parser_factoryObject {	PyObject_HEAD	void *ob_dummy_wrapper; // Overlays bridge object storage	ambulant::lib::parser_factory* ob_itself;} parser_factoryObject;PyObject *parser_factoryObj_New(ambulant::lib::parser_factory* itself){	parser_factoryObject *it;	if (itself == NULL)	{		Py_INCREF(Py_None);		return Py_None;	}#ifdef BGEN_BACK_SUPPORT_parser_factory	parser_factory *encaps_itself = dynamic_cast<parser_factory *>(itself);	if (encaps_itself && encaps_itself->py_parser_factory)	{		Py_INCREF(encaps_itself->py_parser_factory);		return encaps_itself->py_parser_factory;	}#endif	it = PyObject_NEW(parser_factoryObject, &parser_factory_Type);	if (it == NULL) return NULL;	/* XXXX Should we tp_init or tp_new our basetype? */	it->ob_dummy_wrapper = NULL; // XXXX Should be done in base class	it->ob_itself = itself;	return (PyObject *)it;}int parser_factoryObj_Convert(PyObject *v, ambulant::lib::parser_factory* *p_itself){	if (v == Py_None)	{		*p_itself = NULL;		return 1;	}#ifdef BGEN_BACK_SUPPORT_parser_factory	if (!parser_factoryObj_Check(v))	{		*p_itself = Py_WrapAs_parser_factory(v);		if (*p_itself) return 1;	}#endif	if (!parser_factoryObj_Check(v))	{		PyErr_SetString(PyExc_TypeError, "parser_factory required");		return 0;	}	*p_itself = ((parser_factoryObject *)v)->ob_itself;	return 1;}static void parser_factoryObj_dealloc(parser_factoryObject *self){	pycppbridge_Type.tp_dealloc((PyObject *)self);}static PyObject *parser_factoryObj_get_parser_name(parser_factoryObject *_self, PyObject *_args){	PyObject *_res = NULL;	if (!PyArg_ParseTuple(_args, "")

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -