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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
/* -*- Mode: C; c-basic-offset: 4 -*-
* vim: tabstop=4 shiftwidth=4 expandtab
*/
#ifndef __PYGI_PRIVATE_H__
#define __PYGI_PRIVATE_H__
#ifdef __PYGI_H__
# error "Import pygi.h or pygi-private.h, but not both"
#endif
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <Python.h>
#include "pygi.h"
#include "pygi-repository.h"
#include "pygi-info.h"
#include "pygi-argument.h"
#include "pygi-boxed.h"
G_BEGIN_DECLS
/* Python types */
extern PyTypeObject PyGIRepository_Type;
extern PyTypeObject PyGIBaseInfo_Type;
extern PyTypeObject PyGICallableInfo_Type;
extern PyTypeObject PyGIFunctionInfo_Type;
extern PyTypeObject PyGIRegisteredTypeInfo_Type;
extern PyTypeObject PyGIStructInfo_Type;
extern PyTypeObject PyGIEnumInfo_Type;
extern PyTypeObject PyGIObjectInfo_Type;
extern PyTypeObject PyGIInterfaceInfo_Type;
extern PyTypeObject PyGIValueInfo_Type;
extern PyTypeObject PyGIFieldInfo_Type;
extern PyTypeObject PyGIUnresolvedInfo_Type;
/* Errors */
extern PyObject *PyGIRepositoryError;
/* Functions (defined in gimodule.c) */
PyObject* pygi_type_find_by_name (const char *namespace_,
const char *name);
PyObject* pygi_type_find_by_gi_info (GIBaseInfo *info);
/* Private */
GIBaseInfo* _pygi_object_get_gi_info (PyObject *object,
PyTypeObject *type);
#define _PyGI_ERROR_PREFIX(format, ...) G_STMT_START { \
PyObject *py_error_prefix; \
py_error_prefix = PyString_FromFormat(format, ## __VA_ARGS__); \
if (py_error_prefix != NULL) { \
PyObject *py_error_type, *py_error_value, *py_error_traceback; \
PyErr_Fetch(&py_error_type, &py_error_value, &py_error_traceback); \
if (PyString_Check(py_error_value)) { \
PyString_ConcatAndDel(&py_error_prefix, py_error_value); \
if (py_error_prefix != NULL) { \
py_error_value = py_error_prefix; \
} \
} \
PyErr_Restore(py_error_type, py_error_value, py_error_traceback); \
} \
} G_STMT_END
/* GArray */
#if GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 22
# define g_array_get_element_size(a) \
*(guint *)((gpointer)(a) + sizeof(guint8 *) + sizeof(guint) * 2)
#endif
/* Redefine g_array_index because we want it to return the i-th element, casted
* to the type t, of the array a, and not the i-th element of the array a casted to the type t. */
#define _g_array_index(a,t,i) \
*(t *)((a)->data + g_array_get_element_size(a) * (i))
G_END_DECLS
#endif /* __PYGI_PRIVATE_H__ */
|