remove yaze_py header, move all to src
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
#include "yaze_py.h"
|
|
||||||
|
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
|
|
||||||
#include <boost/python.hpp>
|
#include <boost/python.hpp>
|
||||||
|
|
||||||
|
#include "base/snes_color.h"
|
||||||
|
#include "base/sprite.h"
|
||||||
#include "yaze.h"
|
#include "yaze.h"
|
||||||
|
|
||||||
|
static PyObject *yaze_init(PyObject *self, PyObject *args);
|
||||||
|
|
||||||
BOOST_PYTHON_MODULE(yaze) {
|
BOOST_PYTHON_MODULE(yaze) {
|
||||||
using namespace boost::python;
|
using namespace boost::python;
|
||||||
def("yaze_init", yaze_init);
|
def("yaze_init", yaze_init);
|
||||||
@@ -15,9 +17,24 @@ BOOST_PYTHON_MODULE(yaze) {
|
|||||||
.def_readonly("data", &Rom::data)
|
.def_readonly("data", &Rom::data)
|
||||||
.def_readonly("size", &Rom::size)
|
.def_readonly("size", &Rom::size)
|
||||||
.def_readonly("impl", &Rom::impl);
|
.def_readonly("impl", &Rom::impl);
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject *SpamError;
|
/**
|
||||||
|
* Python C API Example, in case I need more functionality than Boost.Python
|
||||||
|
*/
|
||||||
|
static PyMethodDef YazeMethods[] = {
|
||||||
|
{"system", yaze_init, METH_VARARGS, "Initialize the yaze lib."},
|
||||||
|
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct PyModuleDef yaze_module = {PyModuleDef_HEAD_INIT,
|
||||||
|
"yaze", // Module title
|
||||||
|
NULL, // Documentation
|
||||||
|
-1, // Interpreter state size
|
||||||
|
YazeMethods};
|
||||||
|
|
||||||
|
// PyMODINIT_FUNC PyInit_yaze(void) { return PyModule_Create(&yaze_module); }
|
||||||
|
|
||||||
|
static PyObject *YazeError;
|
||||||
|
|
||||||
static PyObject *yaze_init(PyObject *self, PyObject *args) {
|
static PyObject *yaze_init(PyObject *self, PyObject *args) {
|
||||||
const char *command;
|
const char *command;
|
||||||
@@ -26,7 +43,7 @@ static PyObject *yaze_init(PyObject *self, PyObject *args) {
|
|||||||
if (!PyArg_ParseTuple(args, "s", &command)) return NULL;
|
if (!PyArg_ParseTuple(args, "s", &command)) return NULL;
|
||||||
sts = system(command);
|
sts = system(command);
|
||||||
if (sts < 0) {
|
if (sts < 0) {
|
||||||
PyErr_SetString(SpamError, "System command failed");
|
PyErr_SetString(YazeError, "System command failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return PyLong_FromLong(sts);
|
return PyLong_FromLong(sts);
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
#ifndef YAZE_PYTHON_H
|
|
||||||
#define YAZE_PYTHON_H
|
|
||||||
|
|
||||||
#include <Python.h>
|
|
||||||
|
|
||||||
static PyObject *yaze_init(PyObject *self, PyObject *args);
|
|
||||||
|
|
||||||
static PyMethodDef YazeMethods[] = {
|
|
||||||
{"system", yaze_init, METH_VARARGS, "Initialize the yaze lib."},
|
|
||||||
{NULL, NULL, 0, NULL} /* Sentinel */
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct PyModuleDef yaze_module = {PyModuleDef_HEAD_INIT,
|
|
||||||
"yaze", // Module title
|
|
||||||
NULL, // Documentation
|
|
||||||
-1, // Interpreter state size
|
|
||||||
YazeMethods};
|
|
||||||
|
|
||||||
// PyMODINIT_FUNC PyInit_yaze(void) { return PyModule_Create(&yaze_module); }
|
|
||||||
|
|
||||||
#endif // YAZE_PYTHON_H
|
|
||||||
Reference in New Issue
Block a user