Debian Codegraph @

gi/pygi-invoke-state-struct.h

raw
1 #ifndef __PYGI_INVOKE_STATE_STRUCT_H__
2 #define __PYGI_INVOKE_STATE_STRUCT_H__
3
4 #include <girepository/girepository.h>
5 #include <pythoncapi_compat.h>
6
7 G_BEGIN_DECLS
8
9 typedef struct _PyGIInvokeArgState {
10 /* Holds memory for the C value of arguments marshaled "to" or "from" Python. */
11 GIArgument arg_value;
12
13 /* Holds pointers to values in arg_values or a caller allocated chunk of
14 * memory via arg_pointer.v_pointer.
15 */
16 GIArgument arg_pointer;
17
18 /* Holds from_py marshaler cleanup data. */
19 gpointer arg_cleanup_data;
20
21 /* Holds to_py marshaler cleanup data. */
22 gpointer to_py_arg_cleanup_data;
23 } PyGIInvokeArgState;
24
25
26 typedef struct _PyGIInvokeState {
27 PyObject *py_in_args;
28 gssize n_py_in_args;
29
30 /* Number of arguments the ffi wrapped C function takes. Used as the exact
31 * count for argument related arrays held in this struct.
32 */
33 gssize n_args;
34
35 /* List of arguments passed to ffi. Elements can point directly to values held in
36 * arg_values for "in/from Python" or indirectly via arg_pointers for
37 * "out/inout/to Python". In the latter case, the args[x].arg_pointer.v_pointer
38 * member points to memory for the value storage.
39 */
40 GIArgument **ffi_args;
41
42 /* Array of size n_args containing per argument state */
43 PyGIInvokeArgState *args;
44
45 /* Memory to receive the result of the C ffi function call. */
46 GIArgument return_arg;
47 gpointer to_py_return_arg_cleanup_data;
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 /* An awaitable to return for an async function that was called with
57 * default arguments.
58 */
59 PyObject *py_async;
60
61 gpointer user_data;
62
63 /* Function pointer to call with ffi. */
64 gpointer function_ptr;
65
66 } PyGIInvokeState;
67
68 G_END_DECLS
69
70 #endif