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;
130 guint allow_none : 1;
132 guint transfer_ownership : 1;
133 guint transfer_container_ownership : 1;
134 guint return_value : 1;
141 SimpleTypeBlob arg_type;
146 SimpleTypeBlob return_type;
148 guint16 may_return_null : 1;
149 guint16 caller_owns_return_value : 1;
150 guint16 caller_owns_return_container : 1;
151 guint16 reserved :13;
160 guint16 blob_type; /* 1 */
162 guint16 deprecated : 1;
163 guint16 reserved :15;
170 guint16 blob_type; /* 1 */
172 guint16 deprecated : 1;
175 guint16 constructor : 1;
176 guint16 wraps_vfunc : 1;
179 /* Note the bits above need to match CommonBlob
180 * and are thus exhausted, extend things using
181 * the reserved block below. */
187 guint16 is_static : 1;
188 guint16 reserved : 15;
189 guint16 reserved2 : 16;
194 guint16 blob_type; /* 2 */
196 guint16 deprecated : 1;
197 guint16 reserved :15;
218 guint16 zero_terminated :1;
219 guint16 has_length :1;
221 guint16 reserved2 :5;
240 SimpleTypeBlob type[];
257 guint16 blob_type; /* 10 */
259 guint16 deprecated : 1;
260 guint16 reserved :15;
271 guint32 deprecated : 1;
272 guint32 reserved :31;
286 guint16 struct_offset;
294 guint16 deprecated : 1;
295 guint16 unregistered : 1;
296 guint16 reserved :14;
301 } RegisteredTypeBlob;
307 guint16 deprecated : 1;
308 guint16 unregistered : 1;
309 guint16 is_class_struct : 1;
310 guint16 alignment : 6;
311 guint16 reserved : 7;
324 /* variable-length parts of the blob */
326 FunctionBlob methods[];
333 guint16 deprecated : 1;
334 guint16 unregistered : 1;
335 guint16 discriminated : 1;
336 guint16 alignment : 6;
337 guint16 reserved : 7;
348 gint32 discriminator_offset;
349 SimpleTypeBlob discriminator_type;
353 FunctionBlob functions[];
354 ConstantBlob discriminator_values[]
362 guint16 deprecated : 1;
363 guint16 unregistered : 1;
364 guint16 storage_type : 5;
365 guint16 reserved : 9;
382 guint32 deprecated : 1;
383 guint32 readable : 1;
384 guint32 writable : 1;
385 guint32 construct : 1;
386 guint32 construct_only : 1;
387 guint32 reserved :27;
395 guint16 deprecated : 1;
396 guint16 run_first : 1;
397 guint16 run_last : 1;
398 guint16 run_cleanup : 1;
399 guint16 no_recurse : 1;
400 guint16 detailed : 1;
402 guint16 no_hooks : 1;
403 guint16 has_class_closure : 1;
404 guint16 true_stops_emit : 1;
405 guint16 reserved : 6;
407 guint16 class_closure;
418 guint16 must_chain_up : 1;
419 guint16 must_be_implemented : 1;
420 guint16 must_not_be_implemented : 1;
421 guint16 class_closure : 1;
422 guint16 reserved :12;
425 guint16 struct_offset;
432 guint16 blob_type; /* 7 */
433 guint16 deprecated : 1;
434 guint16 abstract : 1;
435 guint16 reserved :14;
442 guint16 class_struct;
445 guint16 n_interfaces;
447 guint16 n_properties;
453 guint16 interfaces[];
456 /* variable-length parts of the blob */
458 PropertyBlob properties[];
459 FunctionBlob methods[];
460 SignalBlob signals[];
462 ConstantBlob constants[];
469 guint16 deprecated : 1;
470 guint16 reserved :15;
476 guint16 n_prerequisites;
477 guint16 n_properties;
483 guint16 prerequisites[];
486 /* variable-length parts of the blob */
487 PropertyBlob properties[];
488 FunctionBlob methods[];
489 SignalBlob signals[];
491 ConstantBlob constants[];
499 guint16 deprecated : 1;
500 guint16 reserved :15;
520 gboolean owns_memory;
525 DirEntry *g_typelib_get_dir_entry (GTypelib *typelib,
528 void g_typelib_check_sanity (void);
530 #define g_typelib_get_string(typelib,offset) ((const gchar*)&(typelib->data)[(offset)])
535 G_TYPELIB_ERROR_INVALID,
536 G_TYPELIB_ERROR_INVALID_HEADER,
537 G_TYPELIB_ERROR_INVALID_DIRECTORY,
538 G_TYPELIB_ERROR_INVALID_ENTRY,
539 G_TYPELIB_ERROR_INVALID_BLOB
542 #define G_TYPELIB_ERROR (g_typelib_error_quark ())
544 GQuark g_typelib_error_quark (void);
546 gboolean g_typelib_validate (GTypelib *typelib,
552 #endif /* __G_TYPELIB_H__ */