Imported Upstream version 3.3.1
[platform/upstream/pygobject2.git] / gi / pygi-closure.h
1 /* -*- Mode: C; c-basic-offset: 4 -*-
2  * vim: tabstop=4 shiftwidth=4 expandtab
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
17  * USA
18  */
19
20 #ifndef __PYGI_CLOSURE_H__
21 #define __PYGI_CLOSURE_H__
22
23 #include <Python.h>
24 #include <girffi.h>
25 #include <ffi.h>
26
27 G_BEGIN_DECLS
28
29
30 /* Private */
31
32 typedef struct _PyGICClosure
33 {
34     GICallableInfo *info;
35     PyObject *function;
36
37     ffi_closure *closure;
38     ffi_cif cif;
39
40     GIScopeType scope;
41
42     PyObject* user_data;
43 } PyGICClosure;
44
45 void _pygi_closure_handle (ffi_cif *cif, void *result, void
46                            **args, void *userdata);
47
48 void _pygi_invoke_closure_free (gpointer user_data);
49
50 PyGICClosure* _pygi_make_native_closure (GICallableInfo* info,
51                                          GIScopeType scope,
52                                          PyObject *function,
53                                          gpointer user_data);
54
55 G_END_DECLS
56
57 #endif /* __PYGI_CLOSURE_H__ */