jpayne@69
|
1
|
jpayne@69
|
2 /* Capsule objects let you wrap a C "void *" pointer in a Python
|
jpayne@69
|
3 object. They're a way of passing data through the Python interpreter
|
jpayne@69
|
4 without creating your own custom type.
|
jpayne@69
|
5
|
jpayne@69
|
6 Capsules are used for communication between extension modules.
|
jpayne@69
|
7 They provide a way for an extension module to export a C interface
|
jpayne@69
|
8 to other extension modules, so that extension modules can use the
|
jpayne@69
|
9 Python import mechanism to link to one another.
|
jpayne@69
|
10
|
jpayne@69
|
11 For more information, please see "c-api/capsule.html" in the
|
jpayne@69
|
12 documentation.
|
jpayne@69
|
13 */
|
jpayne@69
|
14
|
jpayne@69
|
15 #ifndef Py_CAPSULE_H
|
jpayne@69
|
16 #define Py_CAPSULE_H
|
jpayne@69
|
17 #ifdef __cplusplus
|
jpayne@69
|
18 extern "C" {
|
jpayne@69
|
19 #endif
|
jpayne@69
|
20
|
jpayne@69
|
21 PyAPI_DATA(PyTypeObject) PyCapsule_Type;
|
jpayne@69
|
22
|
jpayne@69
|
23 typedef void (*PyCapsule_Destructor)(PyObject *);
|
jpayne@69
|
24
|
jpayne@69
|
25 #define PyCapsule_CheckExact(op) (Py_TYPE(op) == &PyCapsule_Type)
|
jpayne@69
|
26
|
jpayne@69
|
27
|
jpayne@69
|
28 PyAPI_FUNC(PyObject *) PyCapsule_New(
|
jpayne@69
|
29 void *pointer,
|
jpayne@69
|
30 const char *name,
|
jpayne@69
|
31 PyCapsule_Destructor destructor);
|
jpayne@69
|
32
|
jpayne@69
|
33 PyAPI_FUNC(void *) PyCapsule_GetPointer(PyObject *capsule, const char *name);
|
jpayne@69
|
34
|
jpayne@69
|
35 PyAPI_FUNC(PyCapsule_Destructor) PyCapsule_GetDestructor(PyObject *capsule);
|
jpayne@69
|
36
|
jpayne@69
|
37 PyAPI_FUNC(const char *) PyCapsule_GetName(PyObject *capsule);
|
jpayne@69
|
38
|
jpayne@69
|
39 PyAPI_FUNC(void *) PyCapsule_GetContext(PyObject *capsule);
|
jpayne@69
|
40
|
jpayne@69
|
41 PyAPI_FUNC(int) PyCapsule_IsValid(PyObject *capsule, const char *name);
|
jpayne@69
|
42
|
jpayne@69
|
43 PyAPI_FUNC(int) PyCapsule_SetPointer(PyObject *capsule, void *pointer);
|
jpayne@69
|
44
|
jpayne@69
|
45 PyAPI_FUNC(int) PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor);
|
jpayne@69
|
46
|
jpayne@69
|
47 PyAPI_FUNC(int) PyCapsule_SetName(PyObject *capsule, const char *name);
|
jpayne@69
|
48
|
jpayne@69
|
49 PyAPI_FUNC(int) PyCapsule_SetContext(PyObject *capsule, void *context);
|
jpayne@69
|
50
|
jpayne@69
|
51 PyAPI_FUNC(void *) PyCapsule_Import(
|
jpayne@69
|
52 const char *name, /* UTF-8 encoded string */
|
jpayne@69
|
53 int no_block);
|
jpayne@69
|
54
|
jpayne@69
|
55
|
jpayne@69
|
56 #ifdef __cplusplus
|
jpayne@69
|
57 }
|
jpayne@69
|
58 #endif
|
jpayne@69
|
59 #endif /* !Py_CAPSULE_H */
|