64711cb1a21894563b4f62083658fb6d3f48c042
[platform/upstream/pygobject2.git] / gi / pygi-invoke-state-struct.h
1 #ifndef __PYGI_INVOKE_STATE_STRUCT_H__
2 #define __PYGI_INVOKE_STATE_STRUCT_H__
3
4 #include <Python.h>
5
6 #include <girepository.h>
7
8 G_BEGIN_DECLS
9
10 typedef struct _PyGIInvokeArgState
11 {
12     /* Holds memory for the C value of arguments marshaled "to" or "from" Python. */
13     GIArgument arg_value;
14
15     /* Holds pointers to values in arg_values or a caller allocated chunk of
16      * memory via arg_pointer.v_pointer.
17      */
18     GIArgument arg_pointer;
19
20     /* Holds from_py marshaler cleanup data. */
21     gpointer arg_cleanup_data;
22
23 } PyGIInvokeArgState;
24
25
26 typedef struct _PyGIInvokeState
27 {
28     PyObject *py_in_args;
29     gssize n_py_in_args;
30
31     /* Number of arguments the ffi wrapped C function takes. Used as the exact
32      * count for argument related arrays held in this struct.
33      */
34     gssize n_args;
35
36     /* List of arguments passed to ffi. Elements can point directly to values held in
37      * arg_values for "in/from Python" or indirectly via arg_pointers for
38      * "out/inout/to Python". In the latter case, the args[x].arg_pointer.v_pointer
39      * member points to memory for the value storage.
40      */
41     GIArgument **ffi_args;
42
43     /* Array of size n_args containing per argument state */
44     PyGIInvokeArgState *args;
45
46     /* Memory to receive the result of the C ffi function call. */
47     GIArgument return_arg;
48
49     /* A GError exception which is indirectly bound into the last position of
50      * the "args" array if the callable caches "throws" member is set.
51      */
52     GError *error;
53
54     gboolean failed;
55
56     gpointer user_data;
57
58     /* Function pointer to call with ffi. */
59     gpointer function_ptr;
60
61 } PyGIInvokeState;
62
63 G_END_DECLS
64
65 #endif