Write simple initialization function as well as a test function.
This commit is contained in:
27
include/pyliblexmodule.h
Normal file
27
include/pyliblexmodule.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef PYLIBLEX_H
|
||||
#define PYLIBLEX_H
|
||||
|
||||
#include "Python.h"
|
||||
|
||||
static PyObject* pyliblex_init(PyObject* self, PyObject* args);
|
||||
static PyObject* pyliblex_add_definitions(PyObject* self, PyObject* args);
|
||||
static PyObject* pyliblex_lex(PyObject* self, PyObject* args);
|
||||
static PyObject* pyliblex_test(PyObject* self, PyObject* args);
|
||||
|
||||
static const char module_docstring[] = "A wrapper around a homemade lexing library, liblex.";
|
||||
static PyMethodDef module_methods[] = {
|
||||
{"init", pyliblex_init, METH_VARARGS, "Initialize a liblex library object." },
|
||||
{"test", pyliblex_test, METH_VARARGS, "Tests whether the library is working." },
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
static struct PyModuleDef module_object = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"pyliblex",
|
||||
module_docstring,
|
||||
-1,
|
||||
module_methods
|
||||
};
|
||||
|
||||
PyMODINIT_FUNC PyInit_pyliblex();
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user