summaryrefslogtreecommitdiff
path: root/tools/girnode.h
blob: 66144d38b13df36f41aa0cccd5a9e6d309ac6438 (plain)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
/* GObject introspection: Parsed GIR
 *
 * Copyright (C) 2005 Matthias Clasen
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __G_IR_NODE_H__
#define __G_IR_NODE_H__

#include <glib.h>

G_BEGIN_DECLS

typedef struct _GIrNode GIrNode; 
typedef struct _GIrNodeFunction GIrNodeFunction;
typedef struct _GIrNodeParam GIrNodeParam;
typedef struct _GIrNodeType GIrNodeType;
typedef struct _GIrNodeInterface GIrNodeInterface;
typedef struct _GIrNodeSignal GIrNodeSignal;
typedef struct _GIrNodeProperty GIrNodeProperty;
typedef struct _GIrNodeVFunc GIrNodeVFunc;
typedef struct _GIrNodeField GIrNodeField;
typedef struct _GIrNodeValue GIrNodeValue;
typedef struct _GIrNodeEnum GIrNodeEnum;
typedef struct _GIrNodeBoxed GIrNodeBoxed;
typedef struct _GIrNodeStruct GIrNodeStruct;
typedef struct _GIrNodeConstant GIrNodeConstant;
typedef struct _GIrNodeErrorDomain GIrNodeErrorDomain;
typedef struct _GIrNodeXRef GIrNodeXRef;
typedef struct _GIrNodeUnion GIrNodeUnion;

typedef enum 
{
  G_IR_NODE_INVALID      =  0,
  G_IR_NODE_FUNCTION     =  1,
  G_IR_NODE_CALLBACK     =  2,
  G_IR_NODE_STRUCT       =  3,
  G_IR_NODE_BOXED        =  4,
  G_IR_NODE_ENUM         =  5,
  G_IR_NODE_FLAGS        =  6, 
  G_IR_NODE_OBJECT       =  7,
  G_IR_NODE_INTERFACE    =  8,
  G_IR_NODE_CONSTANT     =  9,
  G_IR_NODE_ERROR_DOMAIN = 10,
  G_IR_NODE_UNION        = 11,
  G_IR_NODE_PARAM        = 12,
  G_IR_NODE_TYPE         = 13,
  G_IR_NODE_PROPERTY     = 14,
  G_IR_NODE_SIGNAL       = 15,
  G_IR_NODE_VALUE        = 16,
  G_IR_NODE_VFUNC        = 17,
  G_IR_NODE_FIELD        = 18,
  G_IR_NODE_XREF         = 19
} GIrNodeTypeId;

struct _GIrNode
{
  GIrNodeTypeId type;
  gchar *name;
};

struct _GIrNodeXRef
{
  GIrNode node;

  gchar *namespace;
};

struct _GIrNodeFunction
{
  GIrNode node;

  gboolean deprecated;

  gboolean is_method;
  gboolean is_setter;
  gboolean is_getter;
  gboolean is_constructor;
  gboolean wraps_vfunc;

  gchar *symbol;

  GIrNodeParam *result;
  GList *parameters;
};

struct _GIrNodeType 
{
  GIrNode node;

  gboolean is_pointer;
  gboolean is_basic;
  gboolean is_array;
  gboolean is_glist;
  gboolean is_gslist;
  gboolean is_ghashtable;
  gboolean is_interface;
  gboolean is_error;
  gint tag;

  gchar *unparsed;

  gboolean zero_terminated;
  gboolean has_length;
  gint length;
  
  GIrNodeType *parameter_type1;
  GIrNodeType *parameter_type2;  

  gchar *interface;
  gchar **errors;
};

struct _GIrNodeParam 
{
  GIrNode node;

  gboolean in;
  gboolean out;
  gboolean dipper;
  gboolean optional;
  gboolean retval;
  gboolean null_ok;
  gboolean transfer;
  gboolean shallow_transfer;
  
  GIrNodeType *type;
};

struct _GIrNodeProperty
{
  GIrNode node;

  gboolean deprecated;

  gchar *name;
  gboolean readable;
  gboolean writable;
  gboolean construct;
  gboolean construct_only;
  
  GIrNodeType *type;
};

struct _GIrNodeSignal 
{
  GIrNode node;

  gboolean deprecated;

  gboolean run_first;
  gboolean run_last;
  gboolean run_cleanup;
  gboolean no_recurse;
  gboolean detailed;
  gboolean action;
  gboolean no_hooks;
  
  gboolean has_class_closure;
  gboolean true_stops_emit;
  
  gint class_closure;
  
  GList *parameters;
  GIrNodeParam *result;    
};

struct _GIrNodeVFunc 
{
  GIrNode node;

  gboolean must_chain_up;
  gboolean must_be_implemented;
  gboolean must_not_be_implemented;
  gboolean is_class_closure;
  
  GList *parameters;
  GIrNodeParam *result;      

  gint offset;
};

struct _GIrNodeField
{
  GIrNode node;

  gboolean readable;
  gboolean writable;
  gint bits;
  gint offset;
  
  GIrNodeType *type;
};

struct _GIrNodeInterface
{
  GIrNode node;

  gboolean deprecated;

  gchar *gtype_name;
  gchar *gtype_init;

  gchar *parent;
  
  GList *interfaces;
  GList *prerequisites;

  GList *members;
};

struct _GIrNodeValue
{
  GIrNode node;

  gboolean deprecated;

  guint32 value;
};

struct _GIrNodeConstant
{
  GIrNode node;

  gboolean deprecated;

  GIrNodeType *type;
  
  gchar *value;
};

struct _GIrNodeEnum
{
  GIrNode node;

  gboolean deprecated;

  gchar *gtype_name;
  gchar *gtype_init;

  GList *values;
};

struct _GIrNodeBoxed
{ 
  GIrNode node;

  gboolean deprecated;

  gchar *gtype_name;
  gchar *gtype_init;
  
  GList *members;
};

struct _GIrNodeStruct
{
  GIrNode node;

  gboolean deprecated;
  
  GList *members;
};

struct _GIrNodeUnion
{
  GIrNode node;

  gboolean deprecated;
  
  GList *members;
  GList *discriminators;

  gchar *gtype_name;
  gchar *gtype_init;

  gint discriminator_offset;
  GIrNodeType *discriminator_type;
};


struct _GIrNodeErrorDomain
{
  GIrNode node;

  gboolean deprecated;
  
  gchar *name;
  gchar *getquark;
  gchar *codes;
};


GIrNode * g_ir_node_new             (GIrNodeTypeId type);
void      g_ir_node_free            (GIrNode    *node);
guint32   g_ir_node_get_size        (GIrNode    *node);
guint32   g_ir_node_get_full_size   (GIrNode    *node);
void      g_ir_node_build_metadata  (GIrNode    *node,
				      GIrModule  *module,
				      GList       *modules,
                                      GHashTable  *strings,
                                      GHashTable  *types,
				      guchar      *data,
				      guint32     *offset,
                                      guint32     *offset2);
int       g_ir_node_cmp             (GIrNode    *node,
				      GIrNode    *other);
gboolean  g_ir_node_can_have_member (GIrNode    *node);
void      g_ir_node_add_member      (GIrNode         *node,
				      GIrNodeFunction *member);
guint32   write_string               (const gchar *str,
				      GHashTable  *strings, 
				      guchar      *data,
				      guint32     *offset);

const gchar * g_ir_node_param_direction_string (GIrNodeParam * node);

G_END_DECLS

#endif  /* __G_IR_NODE_H__ */