1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
/**
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <Python.h>
typedef struct {
} voPackage;
/**
* VOP_TASKLIST -- List the tasks in the named package.
*/
static PyObject*
vop_taskList (PyObject* self, PyObject* args) /* pkg,pattern=None */
{
const char *binpath;
int status;
if (!PyArg_ParseTuple (args, "s", &binpath))
return NULL;
sts = system(command);
return Py_BuildValue("s", args);
}
/**
* VOP_PKGLIST -- List the packages in the search directory.
*/
static PyObject*
vop_pkgList (PyObject* self, PyObject* args) /* pattern=None */
{
char *s = "Hello from vop_pkgList";
return Py_BuildValue("s", s);
}
static PyObject*
vop_scan (PyObject* self, PyObject* args)
{
char *s = "Hello from vop_scan";
return Py_BuildValue("s", s);
}
static PyObject*
vop_loadPackage (PyObject* self, PyObject* args) /* name, file=None */
{
char *s = "Hello from vop_loadPackage";
return Py_BuildValue("s", s);
}
/** ************************************************************************ */
/*
* Bind Python function names to our C functions
*/
static PyMethodDef voPackage_methods[] = {
{ "vop_taskList", vop_taskList, METH_VARARGS },
{ "vop_pkgList", vop_pkgList, METH_VARARGS },
{ "vop_scan", vop_scan, METH_VARARGS },
{ "vop_loadPackage", vop_loadPackage, METH_VARARGS },
{ NULL, NULL, 0 }
};
/**
* INITVOPACKAGE -- Python calls this to let us initialize our module
*/
void initvoPackage()
{
(void) Py_InitModule("voPackage", voPackage_methods);
}
|