00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __PYTHON_PLUGIN_H_
00021
00022 #define __PYTHON_PLUGIN_H_
00023
00024 #include <Python.h>
00025
00026 typedef struct
00027 {
00028 PyObject_HEAD;
00029 char *name;
00030 int prio;
00031 int loaded;
00032 } ekg_pluginObj;
00033
00034 void ekg_plugin_dealloc(ekg_pluginObj *o);
00035 int ekg_plugin_init(ekg_pluginObj *self, PyObject *args, PyObject *kwds);
00036 PyObject* ekg_plugin_unload(ekg_pluginObj *self, PyObject *args);
00037 PyObject* ekg_plugin_load(ekg_pluginObj *self, PyObject *args);
00038 PyObject* ekg_plugin_is_loaded(ekg_pluginObj *self, PyObject *args);
00039 PyObject* ekg_plugin_get_attr(ekg_pluginObj * self, char * attr);
00040
00041 staticforward PyMethodDef ekg_plugin_methods[] = {
00042 {"load", (PyCFunction)ekg_plugin_load, METH_VARARGS, "Load plugin"},
00043 {"unload", (PyCFunction)ekg_plugin_unload, METH_NOARGS, "Unload plugin"},
00044 {"isLoaded", (PyCFunction)ekg_plugin_is_loaded, METH_NOARGS, "Check if plugin is loaded"},
00045 {NULL, NULL, 0, NULL}
00046 };
00047
00048 static PyTypeObject ekg_plugin_type = {
00049 PyObject_HEAD_INIT(NULL)
00050 0,
00051 "plugin",
00052 sizeof(ekg_pluginObj),
00053 0,
00054 (destructor)ekg_plugin_dealloc,
00055 0,
00056 (getattrfunc)ekg_plugin_get_attr,
00057 0,
00058 0,
00059 0,
00060 0,
00061 0,
00062 0,
00063 0,
00064 0,
00065 0,
00066 0,
00067 0,
00068 0,
00069 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
00070 "Plugin object",
00071 0,
00072 0,
00073 0,
00074 0,
00075 0,
00076 0,
00077 ekg_plugin_methods,
00078 0,
00079 0,
00080 0,
00081 0,
00082 0,
00083 0,
00084 0,
00085 (initproc)ekg_plugin_init,
00086 0,
00087 0,
00088 };
00089
00090
00091 #endif
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101