Initial packaging for Tizen
[profile/ivi/gobject-introspection.git] / girepository / girepository-private.h
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
2  * GObject introspection: Private headers
3  *
4  * Copyright (C) 2010 Johan Dahlin
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #ifndef __GIREPOSITORY_PRIVATE_H__
23 #define __GIREPOSITORY_PRIVATE_H__
24
25 #include <ffi.h>
26 #include <glib.h>
27
28 #define __GIREPOSITORY_H_INSIDE__
29
30 #include <gibaseinfo.h>
31 #include <girepository.h>
32 #include <gitypelib.h>
33
34 typedef struct _GIRealInfo GIRealInfo;
35
36 /*
37  * We just use one structure for all of the info object
38  * types; in general, we should be reading data directly
39  * from the typelib, and not having computed data in
40  * per-type structures.
41  */
42 struct _GIRealInfo
43 {
44   /* Keep this part in sync with GIUnresolvedInfo below */
45   gint32 type;
46   gint32 ref_count;
47   GIRepository *repository;
48   GIBaseInfo *container;
49
50   /* Resolved specific */
51
52   GITypelib *typelib;
53   guint32 offset;
54
55   guint32 type_is_embedded : 1; /* Used by GITypeInfo */
56   guint32 reserved : 31;
57
58   gpointer reserved2[4];
59 };
60
61 struct _GIUnresolvedInfo
62 {
63   /* Keep this part in sync with GIBaseInfo above */
64   gint32 type;
65   gint32 ref_count;
66   GIRepository *repository;
67   GIBaseInfo *container;
68
69   /* Unresolved specific */
70
71   const gchar *name;
72   const gchar *namespace;
73 };
74
75 void         _g_info_init       (GIRealInfo   *info,
76                                  GIInfoType    type,
77                                  GIRepository *repository,
78                                  GIBaseInfo   *container,
79                                  GITypelib     *typelib,
80                                  guint32       offset);
81
82 GIBaseInfo * _g_info_from_entry (GIRepository *repository,
83                                  GITypelib     *typelib,
84                                  guint16       index);
85
86 GIBaseInfo * _g_info_new_full   (GIInfoType    type,
87                                  GIRepository *repository,
88                                  GIBaseInfo   *container,
89                                  GITypelib     *typelib,
90                                  guint32       offset);
91
92 GITypeInfo * _g_type_info_new   (GIBaseInfo   *container,
93                                  GITypelib     *typelib,
94                                  guint32       offset);
95
96 void         _g_type_info_init  (GIBaseInfo   *info,
97                                  GIBaseInfo   *container,
98                                  GITypelib     *typelib,
99                                  guint32       offset);
100
101 GIFunctionInfo * _g_base_info_find_method (GIBaseInfo   *base,
102                                            guint32       offset,
103                                            gint          n_methods,
104                                            const gchar  *name);
105
106 GIVFuncInfo * _g_base_info_find_vfunc (GIRealInfo   *rinfo,
107                                        guint32       offset,
108                                        gint          n_vfuncs,
109                                        const gchar  *name);
110
111 extern ffi_status ffi_prep_closure_loc (ffi_closure *,
112                                         ffi_cif *,
113                                         void (*fun)(ffi_cif *, void *, void **, void *),
114                                         void *user_data,
115                                         void *codeloc);
116 extern void *ffi_closure_alloc (size_t size, void **code);
117 extern void ffi_closure_free (void *);
118
119
120 #endif /* __GIREPOSITORY_PRIVATE_H__ */