[wpdev-commits] wolfpack/python pyaction.cpp,NONE,1.1 pyaction.h,NONE,1.1
Brought to you by:
rip,
thiagocorrea
From: Sebastian H. <dar...@us...> - 2004-08-31 19:24:25
|
Update of /cvsroot/wpdev/wolfpack/python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27655/python Added Files: pyaction.cpp pyaction.h Log Message: account syncro --- NEW FILE: pyaction.cpp --- #include "pyaction.h" cActionPythonCode::cActionPythonCode(PyObject *code, PyObject *args) { this->code = code; this->args = args; // Keep references around of both objects Py_INCREF(this->code); Py_INCREF(this->args); } cActionPythonCode::~cActionPythonCode() { // Free both objects. Py_DECREF(this->code); Py_DECREF(this->args); } void cActionPythonCode::execute() { // Execute the code object if (PyCallable_Check(code)) { PyObject *result = PyObject_CallObject(code, args); Py_XDECREF(result); reportPythonError(); } } --- NEW FILE: pyaction.h --- #if !defined(__PYACTION_H__) #define __PYACTION_H__ #include "../action.h" #include "engine.h" class cActionPythonCode : public cAction { protected: PyObject *code; PyObject *args; public: cActionPythonCode(PyObject *code, PyObject *args); virtual ~cActionPythonCode(); void execute(); }; #endif |