Py_INCREF(&binding_BufferType);
PyModule_AddObject(m, "Buffer", (PyObject *)&binding_BufferType);
-
+ PySys_SetPath(".");
+ pName = PyString_FromString("te_test");
+
+ pModule = PyImport_Import(pName);
+
+ if (pModule == NULL) {
+ perror("Unable to open te_test.py !");
+ PyErr_Print();
+ getc(stdin);
+ exit(EXIT_FAILURE);
+ }
+
+ Py_DECREF(pName);
+}
+
+void terminate_python(void)
+{
+ Py_DECREF(pFunc);
+ Py_DECREF(pModule);
+
+}
+PyObject *Te_notifyprintf(PyObject *self, PyObject *args)
+{
+ const char *str;
+ int sts;
+
+ if (!PyArg_ParseTuple(args, "s", &str))
+ return NULL;
+
+ miniprintf("%s", str);
+ return Py_BuildValue("i", 0); /* miniprintf is always successful */
+
}
PyObject *Buffer_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
self->buf->point = (int) PyInt_AsLong(value);
}
+
#include <Python.h>
#include <structmember.h>
#include "buffer.h"
+
+static PyObject *pName, *pModule, *pDict, *pFunc;
void init_interp(void);
+
+PyObject *Te_notifyprintf(PyObject *self, PyObject *args);
+
+/* the methods of the te module */
+static PyMethodDef TeMethods[] = {
+// {"system", spam_system, METH_VARARGS,
+// "Execute a shell command."},
+ {"notifyprintf", Te_notifyprintf, METH_VARARGS, "Print a message in the minibuffer"},
+ {NULL, NULL, 0, NULL} /* Sentinel */
+};
+
+/*
+ Definition of the buffer object type.
+ */
typedef struct {
PyObject_HEAD
PyObject *Buffer_getcontents(TeBuffer *self, void *closure);
int Buffer_setcontents(TeBuffer *self, PyObject *value, void *closure);
-
+
+
static PyMemberDef Buffer_members[] = {
{NULL} /* Sentinel */
};
};
-/* the methods of the te module */
-static PyMethodDef TeMethods[] = {
-// {"system", spam_system, METH_VARARGS,
-// "Execute a shell command."},
- {NULL, NULL, 0, NULL} /* Sentinel */
-};
PyMODINIT_FUNC init_python(void);