forked from sbinet/go-python
-
Notifications
You must be signed in to change notification settings - Fork 1
/
capi.go
35 lines (30 loc) · 995 Bytes
/
capi.go
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
package python
// #include "go-python.h"
import "C"
// PyObject* Py_BuildValue(const char *format, ...)
// Return value: New reference.
func Py_BuildValue(format string, args ...interface{}) *PyObject {
return nil
}
// PyMethodDef
// ml_name char * name of the method
// ml_meth PyCFunction pointer to the C implementation
// ml_flags int flag bits indicating how the call should be constructed
// ml_doc char * points to the contents of the docstring
type PyMethodDef struct {
Name string // name of the method
Meth func(self, args *PyObject) *PyObject
Flags MethodDefFlags
Doc string
}
type MethodDefFlags int
const (
MethVarArgs MethodDefFlags = C.METH_VARARGS
MethKeyWords = C.METH_KEYWORDS
MethNoArgs = C.METH_NOARGS
MethO = C.METH_O
MethOldArgs = C.METH_OLDARGS
MethClass = C.METH_CLASS
MethStatic = C.METH_STATIC
MethCoexist = C.METH_COEXIST
)