1 /* GObject introspection: struct definitions for the binary
2 * typelib format, validation
4 * Copyright (C) 2005 Matthias Clasen
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.
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.
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.
22 #ifndef __G_TYPELIB_H__
23 #define __G_TYPELIB_H__
26 #include "girepository.h"
30 #define G_IR_MAGIC "GOBJ\nMETADATA\r\n\032"
44 BLOB_TYPE_ERROR_DOMAIN,
48 #define BLOB_IS_REGISTERED_TYPE(blob) \
49 ((blob)->blob_type == BLOB_TYPE_STRUCT || \
50 (blob)->blob_type == BLOB_TYPE_UNION || \
51 (blob)->blob_type == BLOB_TYPE_ENUM || \
52 (blob)->blob_type == BLOB_TYPE_OBJECT || \
53 (blob)->blob_type == BLOB_TYPE_INTERFACE)
62 guint16 n_local_entries;
64 guint32 n_annotations;
72 guint32 shared_library;
74 guint16 entry_blob_size;
75 guint16 function_blob_size;
76 guint16 callback_blob_size;
77 guint16 signal_blob_size;
78 guint16 vfunc_blob_size;
79 guint16 arg_blob_size;
80 guint16 property_blob_size;
81 guint16 field_blob_size;
82 guint16 value_blob_size;
83 guint16 annotation_blob_size;
84 guint16 constant_blob_size;
85 guint16 error_domain_blob_size;
87 guint16 signature_blob_size;
88 guint16 enum_blob_size;
89 guint16 struct_blob_size;
90 guint16 object_blob_size;
91 guint16 interface_blob_size;
92 guint16 union_blob_size;
102 guint16 reserved :15;
132 guint transfer_ownership : 1;
133 guint transfer_container_ownership : 1;
134 guint return_value : 1;
137 SimpleTypeBlob arg_type;
142 SimpleTypeBlob return_type;
144 guint16 may_return_null : 1;
145 guint16 caller_owns_return_value : 1;
146 guint16 caller_owns_return_container : 1;
147 guint16 reserved :13;
156 guint16 blob_type; /* 1 */
158 guint16 deprecated : 1;
159 guint16 reserved :15;
166 guint16 blob_type; /* 1 */
168 guint16 deprecated : 1;
171 guint16 constructor : 1;
172 guint16 wraps_vfunc : 1;
183 guint16 blob_type; /* 2 */
185 guint16 deprecated : 1;
186 guint16 reserved :15;
207 guint16 zero_terminated :1;
208 guint16 has_length :1;
209 guint16 reserved2 :6;
225 SimpleTypeBlob type[];
242 guint16 blob_type; /* 10 */
244 guint16 deprecated : 1;
245 guint16 reserved :15;
256 guint32 deprecated : 1;
257 guint32 reserved :31;
271 guint16 struct_offset;
279 guint16 deprecated : 1;
280 guint16 unregistered : 1;
281 guint16 reserved :14;
286 } RegisteredTypeBlob;
292 guint16 deprecated : 1;
293 guint16 unregistered : 1;
294 guint16 reserved :14;
305 /* variable-length parts of the blob */
307 FunctionBlob methods[];
314 guint16 deprecated : 1;
315 guint16 unregistered : 1;
316 guint16 discriminated : 1;
317 guint16 reserved :13;
326 gint32 discriminator_offset;
327 SimpleTypeBlob discriminator_type;
331 FunctionBlob functions[];
332 ConstantBlob discriminator_values[]
340 guint16 deprecated : 1;
341 guint16 unregistered : 1;
342 guint16 reserved :14;
359 guint32 deprecated : 1;
360 guint32 readable : 1;
361 guint32 writable : 1;
362 guint32 construct : 1;
363 guint32 construct_only : 1;
364 guint32 reserved :27;
372 guint16 deprecated : 1;
373 guint16 run_first : 1;
374 guint16 run_last : 1;
375 guint16 run_cleanup : 1;
376 guint16 no_recurse : 1;
377 guint16 detailed : 1;
379 guint16 no_hooks : 1;
380 guint16 has_class_closure : 1;
381 guint16 true_stops_emit : 1;
382 guint16 reserved : 6;
384 guint16 class_closure;
395 guint16 must_chain_up : 1;
396 guint16 must_be_implemented : 1;
397 guint16 must_not_be_implemented : 1;
398 guint16 class_closure : 1;
399 guint16 reserved :12;
402 guint16 struct_offset;
409 guint16 blob_type; /* 7 */
410 guint16 deprecated : 1;
411 guint16 abstract : 1;
412 guint16 reserved :14;
420 guint16 n_interfaces;
422 guint16 n_properties;
428 guint16 interfaces[];
431 /* variable-length parts of the blob */
433 PropertyBlob properties[];
434 FunctionBlob methods[];
435 SignalBlob signals[];
437 ConstantBlob constants[];
444 guint16 deprecated : 1;
445 guint16 reserved :15;
451 guint16 n_prerequisites;
452 guint16 n_properties;
458 guint16 prerequisites[];
461 /* variable-length parts of the blob */
462 PropertyBlob properties[];
463 FunctionBlob methods[];
464 SignalBlob signals[];
466 ConstantBlob constants[];
474 guint16 deprecated : 1;
475 guint16 reserved :15;
495 gboolean owns_memory;
500 DirEntry *g_typelib_get_dir_entry (GTypelib *typelib,
503 void g_typelib_check_sanity (void);
505 #define g_typelib_get_string(typelib,offset) ((const gchar*)&(typelib->data)[(offset)])
510 G_TYPELIB_ERROR_INVALID,
511 G_TYPELIB_ERROR_INVALID_HEADER,
512 G_TYPELIB_ERROR_INVALID_DIRECTORY,
513 G_TYPELIB_ERROR_INVALID_ENTRY,
514 G_TYPELIB_ERROR_INVALID_BLOB
517 #define G_TYPELIB_ERROR (g_typelib_error_quark ())
519 GQuark g_typelib_error_quark (void);
521 gboolean g_typelib_validate (GTypelib *typelib,
527 #endif /* __G_TYPELIB_H__ */