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

📄 ambulantinterface.cpp

📁 彩信浏览器
💻 CPP
📖 第 1 页 / 共 5 页
字号:
	Py_XDECREF(py_rv);	Py_XDECREF(py_pe);	Py_XDECREF(py_t);	Py_XDECREF(py_priority);	PyGILState_Release(_GILState);}void event_processor::cancel_all_events(){	PyGILState_STATE _GILState = PyGILState_Ensure();	PyObject *py_rv = PyObject_CallMethod(py_event_processor, "cancel_all_events", "()");	if (PyErr_Occurred())	{		PySys_WriteStderr("Python exception during event_processor::cancel_all_events() callback:\n");		PyErr_Print();	}	Py_XDECREF(py_rv);	PyGILState_Release(_GILState);}bool event_processor::cancel_event(ambulant::lib::event* pe, ambulant::lib::event_priority priority){	PyGILState_STATE _GILState = PyGILState_Ensure();	bool _rv;	PyObject *py_pe = Py_BuildValue("O&", eventObj_New, pe);	PyObject *py_priority = Py_BuildValue("l", priority);	PyObject *py_rv = PyObject_CallMethod(py_event_processor, "cancel_event", "(OO)", py_pe, py_priority);	if (PyErr_Occurred())	{		PySys_WriteStderr("Python exception during event_processor::cancel_event() callback:\n");		PyErr_Print();	}	if (py_rv && !PyArg_Parse(py_rv, "O&", bool_Convert, &_rv))	{		PySys_WriteStderr("Python exception during event_processor::cancel_event() return:\n");		PyErr_Print();	}	Py_XDECREF(py_rv);	Py_XDECREF(py_pe);	Py_XDECREF(py_priority);	PyGILState_Release(_GILState);	return _rv;}void event_processor::serve_events(){	PyGILState_STATE _GILState = PyGILState_Ensure();	PyObject *py_rv = PyObject_CallMethod(py_event_processor, "serve_events", "()");	if (PyErr_Occurred())	{		PySys_WriteStderr("Python exception during event_processor::serve_events() callback:\n");		PyErr_Print();	}	Py_XDECREF(py_rv);	PyGILState_Release(_GILState);}ambulant::lib::timer* event_processor::get_timer() const{	PyGILState_STATE _GILState = PyGILState_Ensure();	ambulant::lib::timer* _rv;	PyObject *py_rv = PyObject_CallMethod(py_event_processor, "get_timer", "()");	if (PyErr_Occurred())	{		PySys_WriteStderr("Python exception during event_processor::get_timer() callback:\n");		PyErr_Print();	}	if (py_rv && !PyArg_Parse(py_rv, "O&", timerObj_Convert, &_rv))	{		PySys_WriteStderr("Python exception during event_processor::get_timer() return:\n");		PyErr_Print();	}	Py_XDECREF(py_rv);	PyGILState_Release(_GILState);	return _rv;}void event_processor::stop_processor_thread(){	PyGILState_STATE _GILState = PyGILState_Ensure();	PyObject *py_rv = PyObject_CallMethod(py_event_processor, "stop_processor_thread", "()");	if (PyErr_Occurred())	{		PySys_WriteStderr("Python exception during event_processor::stop_processor_thread() callback:\n");		PyErr_Print();	}	Py_XDECREF(py_rv);	PyGILState_Release(_GILState);}/* ---------------------- Class parser_factory ---------------------- */parser_factory::parser_factory(PyObject *itself){	PyGILState_STATE _GILState = PyGILState_Ensure();	if (itself)	{		if (!PyObject_HasAttrString(itself, "get_parser_name")) PyErr_Warn(PyExc_Warning, "parser_factory: missing attribute: get_parser_name");	}	if (itself == NULL) itself = Py_None;	py_parser_factory = itself;	Py_XINCREF(itself);	PyGILState_Release(_GILState);}parser_factory::~parser_factory(){	PyGILState_STATE _GILState = PyGILState_Ensure();	Py_XDECREF(py_parser_factory);	py_parser_factory = NULL;	PyGILState_Release(_GILState);}std::string parser_factory::get_parser_name(){	PyGILState_STATE _GILState = PyGILState_Ensure();	std::string _rv;	PyObject *py_rv = PyObject_CallMethod(py_parser_factory, "get_parser_name", "()");	if (PyErr_Occurred())	{		PySys_WriteStderr("Python exception during parser_factory::get_parser_name() callback:\n");		PyErr_Print();	}	char *_rv_cstr;	if (py_rv && !PyArg_Parse(py_rv, "s", &_rv_cstr))	{		PySys_WriteStderr("Python exception during parser_factory::get_parser_name() return:\n");		PyErr_Print();	}	_rv = _rv_cstr;	Py_XDECREF(py_rv);	PyGILState_Release(_GILState);	return _rv;}/* ------------------------ Class xml_parser ------------------------ */xml_parser::xml_parser(PyObject *itself){	PyGILState_STATE _GILState = PyGILState_Ensure();	if (itself)	{		if (!PyObject_HasAttrString(itself, "parse")) PyErr_Warn(PyExc_Warning, "xml_parser: missing attribute: parse");	}	if (itself == NULL) itself = Py_None;	py_xml_parser = itself;	Py_XINCREF(itself);	PyGILState_Release(_GILState);}xml_parser::~xml_parser(){	PyGILState_STATE _GILState = PyGILState_Ensure();	Py_XDECREF(py_xml_parser);	py_xml_parser = NULL;	PyGILState_Release(_GILState);}bool xml_parser::parse(const char *buf__in__, size_t buf__len__, bool final){	PyGILState_STATE _GILState = PyGILState_Ensure();	bool _rv;	PyObject *py_buf = Py_BuildValue("s#", buf__in__, (int)buf__len__);	PyObject *py_final = Py_BuildValue("O&", bool_New, final);	PyObject *py_rv = PyObject_CallMethod(py_xml_parser, "parse", "(OO)", py_buf, py_final);	if (PyErr_Occurred())	{		PySys_WriteStderr("Python exception during xml_parser::parse() callback:\n");		PyErr_Print();	}	if (py_rv && !PyArg_Parse(py_rv, "O&", bool_Convert, &_rv))	{		PySys_WriteStderr("Python exception during xml_parser::parse() return:\n");		PyErr_Print();	}	Py_XDECREF(py_rv);	Py_XDECREF(py_buf);	Py_XDECREF(py_final);	PyGILState_Release(_GILState);	return _rv;}/* --------------------- Class system_embedder ---------------------- */system_embedder::system_embedder(PyObject *itself){	PyGILState_STATE _GILState = PyGILState_Ensure();	if (itself)	{		if (!PyObject_HasAttrString(itself, "show_file")) PyErr_Warn(PyExc_Warning, "system_embedder: missing attribute: show_file");	}	if (itself == NULL) itself = Py_None;	py_system_embedder = itself;	Py_XINCREF(itself);	PyGILState_Release(_GILState);}system_embedder::~system_embedder(){	PyGILState_STATE _GILState = PyGILState_Ensure();	Py_XDECREF(py_system_embedder);	py_system_embedder = NULL;	PyGILState_Release(_GILState);}void system_embedder::show_file(const ambulant::net::url& href){	PyGILState_STATE _GILState = PyGILState_Ensure();	PyObject *py_href = Py_BuildValue("O", ambulant_url_New(href));	PyObject *py_rv = PyObject_CallMethod(py_system_embedder, "show_file", "(O)", py_href);	if (PyErr_Occurred())	{		PySys_WriteStderr("Python exception during system_embedder::show_file() callback:\n");		PyErr_Print();	}	Py_XDECREF(py_rv);	Py_XDECREF(py_href);	PyGILState_Release(_GILState);}/* ----------------------- Class timer_events ----------------------- */timer_events::timer_events(PyObject *itself){	PyGILState_STATE _GILState = PyGILState_Ensure();	if (itself)	{		if (!PyObject_HasAttrString(itself, "speed_changed")) PyErr_Warn(PyExc_Warning, "timer_events: missing attribute: speed_changed");	}	if (itself == NULL) itself = Py_None;	py_timer_events = itself;	Py_XINCREF(itself);	PyGILState_Release(_GILState);}timer_events::~timer_events(){	PyGILState_STATE _GILState = PyGILState_Ensure();	Py_XDECREF(py_timer_events);	py_timer_events = NULL;	PyGILState_Release(_GILState);}void timer_events::speed_changed(){	PyGILState_STATE _GILState = PyGILState_Ensure();	PyObject *py_rv = PyObject_CallMethod(py_timer_events, "speed_changed", "()");	if (PyErr_Occurred())	{		PySys_WriteStderr("Python exception during timer_events::speed_changed() callback:\n");		PyErr_Print();	}	Py_XDECREF(py_rv);	PyGILState_Release(_GILState);}/* -------------------------- Class timer --------------------------- */timer::timer(PyObject *itself){	PyGILState_STATE _GILState = PyGILState_Ensure();	if (itself)	{		if (!PyObject_HasAttrString(itself, "elapsed")) PyErr_Warn(PyExc_Warning, "timer: missing attribute: elapsed");		if (!PyObject_HasAttrString(itself, "get_realtime_speed")) PyErr_Warn(PyExc_Warning, "timer: missing attribute: get_realtime_speed");	}	if (itself == NULL) itself = Py_None;	py_timer = itself;	Py_XINCREF(itself);	PyGILState_Release(_GILState);}timer::~timer(){	PyGILState_STATE _GILState = PyGILState_Ensure();	Py_XDECREF(py_timer);	py_timer = NULL;	PyGILState_Release(_GILState);}ambulant::lib::timer::time_type timer::elapsed() const{	PyGILState_STATE _GILState = PyGILState_Ensure();	ambulant::lib::timer::time_type _rv;	PyObject *py_rv = PyObject_CallMethod(py_timer, "elapsed", "()");	if (PyErr_Occurred())	{		PySys_WriteStderr("Python exception during timer::elapsed() callback:\n");		PyErr_Print();	}	if (py_rv && !PyArg_Parse(py_rv, "l", &_rv))	{		PySys_WriteStderr("Python exception during timer::elapsed() return:\n");		PyErr_Print();	}	Py_XDECREF(py_rv);	PyGILState_Release(_GILState);	return _rv;}double timer::get_realtime_speed() const{	PyGILState_STATE _GILState = PyGILState_Ensure();	double _rv;	PyObject *py_rv = PyObject_CallMethod(py_timer, "get_realtime_speed", "()");	if (PyErr_Occurred())	{		PySys_WriteStderr("Python exception during timer::get_realtime_speed() callback:\n");		PyErr_Print();	}	if (py_rv && !PyArg_Parse(py_rv, "d", &_rv))	{		PySys_WriteStderr("Python exception during timer::get_realtime_speed() return:\n");		PyErr_Print();	}	Py_XDECREF(py_rv);	PyGILState_Release(_GILState);	return _rv;}/* ---------------------- Class timer_control ----------------------- */timer_control::timer_control(PyObject *itself):	::timer(itself){	PyGILState_STATE _GILState = PyGILState_Ensure();	if (itself)	{		if (!PyObject_HasAttrString(itself, "elapsed")) PyErr_Warn(PyExc_Warning, "timer_control: missing attribute: elapsed");		if (!PyObject_HasAttrString(itself, "elapsed")) PyErr_Warn(PyExc_Warning, "timer_control: missing attribute: elapsed");		if (!PyObject_HasAttrString(itself, "start")) PyErr_Warn(PyExc_Warning, "timer_control: missing attribute: start");		if (!PyObject_HasAttrString(itself, "stop")) PyErr_Warn(PyExc_Warning, "timer_control: missing attribute: stop");		if (!PyObject_HasAttrString(itself, "pause")) PyErr_Warn(PyExc_Warning, "timer_control: missing attribute: pause");		if (!PyObject_HasAttrString(itself, "resume")) PyErr_Warn(PyExc_Warning, "timer_control: missing attribute: resume");		if (!PyObject_HasAttrString(itself, "set_speed")) PyErr_Warn(PyExc_Warning, "timer_control: missing attribute: set_speed");		if (!PyObject_HasAttrString(itself, "set_time")) PyErr_Warn(PyExc_Warning, "timer_control: missing attribute: set_time");		if (!PyObject_HasAttrString(itself, "get_speed")) PyErr_Warn(PyExc_Warning, "timer_control: missing attribute: get_speed");		if (!PyObject_HasAttrString(itself, "running")) PyErr_Warn(PyExc_Warning, "timer_control: missing attribute: running");		if (!PyObject_HasAttrString(itself, "get_realtime_speed")) PyErr_Warn(PyExc_Warning, "timer_control: missing attribute: get_realtime_speed");	}	if (itself == NULL) itself = Py_None;	py_timer_control = itself;	Py_XINCREF(itself);	PyGILState_Release(_GILState);}timer_control::~timer_control(){	PyGILState_STATE _GILState = PyGILState_Ensure();	Py_XDECREF(py_timer_control);	py_timer_control = NULL;	PyGILState_Release(_GILState);}ambulant::lib::timer::time_type timer_control::elapsed() const{	PyGILState_STATE _GILState = PyGILState_Ensure();	ambulant::lib::timer::time_type _rv;	PyObject *py_rv = PyObject_CallMethod(py_timer_control, "elapsed", "()");	if (PyErr_Occurred())	{		PySys_WriteStderr("Python exception during timer_control::elapsed() callback:\n");		PyErr_Print();	}	if (py_rv && !PyArg_Parse(py_rv, "l", &_rv))	{		PySys_WriteStderr("Python exception during timer_control::elapsed() return:\n");		PyErr_Print();	}	Py_XDECREF(py_rv);	PyGILState_Release(_GILState);	return _rv;}ambulant::lib::timer::time_type timer_control::elapsed(ambulant::lib::timer::time_type pt) const{	PyGILState_STATE _GILState = PyGILState_Ensure();	ambulant::lib::timer::time_type _rv;	PyObject *py_pt = Py_BuildValue("l", pt);	PyObject *py_rv = PyObject_CallMethod(py_timer_control, "elapsed", "(O)", py_pt);	if (PyErr_Occurred())	{		PySys_WriteStderr("Python exception during timer_control::elapsed() callback:\n");		PyErr_Print();	}	if (py_rv && !PyArg_Parse(py_rv, "l", &_rv))	{		PySys_WriteStderr("Python exception during timer_control::elapsed() return:\n");		PyErr_Print();	}	Py_XDECREF(py_rv);	Py_XDECREF(py_pt);	PyGILState_Release(_GILState);	return _rv;}void timer_control::start(ambulant::lib::timer::time_type t){	PyGILState_STATE _GILState = PyGILState_Ensure();	PyObject *py_t = Py_BuildValue("l", t);	PyObject *py_rv = PyObject_CallMethod(py_timer_control, "start", "(O)", py_t);	if (PyErr_Occurred())	{

⌨️ 快捷键说明

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