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
|