Patch from Andreas Rottmann <a.rottmann@gmx.at>.
This change modifies the parser to hold a stack of nodes, instead of
a single concept of "current" node. This allows the parser to recurse
into nested nodes.
svn path=/trunk/; revision=1081
* girepository/ginfo.c (g_registered_type_info_get_g_type): handle
the special case for GObject, whose glib:get-type is listed as
"intern".
svn path=/trunk/; revision=1080
The scanner misses all fields of the GObject struct -- there
are no <field> children of the <class> element for GObject in the GIR. This of
course yields wrong field offsets for all derived objects.
svn path=/trunk/; revision=1079
Arrays are currently not handled specially, and hence treated as pointers in
giroffsets.c:get_field_size_alignment(), which is (obviously) wrong.
svn path=/trunk/; revision=1078
2009-01-26 Johan Dahlin <jdahlin@async.com.br>
* girepository/ginfo.c (g_base_info_unref):
Only unref the repository if it's actually set.
svn path=/trunk/; revision=1068
2009-01-15 Johan Dahlin <jdahlin@async.com.br>
* gir/freetype2-2.0.gir: add FT_Int32
* gir/xft-2.0.gir: add XftFont
* girepository/gdump.c (g_irepository_dump):
Report errors when an invalid type is encountered
* giscanner/glibtransformer.py:
Make the error message a bit nicer.
Part of preparating for gir generating inside pango.
svn path=/trunk/; revision=1050
We want the environment variable to override so that people can
easily write scripts that run their programs uninstalled.
svn path=/trunk/; revision=1024
The intended use of g_irepository_get_option_group is that your
application more transparently supports --introspection-dump; we
should exit so that your app doesn't continue trying to launch.
svn path=/trunk/; revision=1023
Since GObject-Introspection depends on both ffi and GObject, it's
a convenient home for jdahlin's generic signal marshaller until
such time as GObject can directly depend on ffi.
When it gets added to GObject, we can simply point our marshaller
at that one.
svn path=/trunk/; revision=1022
2008-01-03 Andreas Rottmann <a.rottmann@gmx.at>
Bug 556489 – callback annotations
* giscanner/transformer.py
* tools/generate.c (write_callable_info): Write out the new scope,
closure and destroy attributes.
* giscanner/transformer.py (Transformer._type_is_callback): New
method, checking if a given type is a callback.
(Transformer._augment_callback_params): New method; adds
information (closure, destroy) to callback parameters.
(Transformer._handle_closure, Transformer._handle_destroy): New methods,
auxiliary to _augment_callback_params.
(Transformer._create_function): Call _augment_callback_params().
(Transformer._create_parameter): Handle scope option.
(Transformer._create_typedef_callback): New method, creates a
callback, and registers it in the typedef namespace
(Transformer._create_typedef): Use _create_typedef_callback()
instead of the plain _create_callback().
* giscanner/ast.py (Parameter): Added callback-related fields.
* giscanner/girwriter.py: Write out new Parameter fields.
* girepository/girnode.h (GIrNodeParam): Added fields scope,
closure and destroy.
* girepository/gtypelib.h (ArgBlob): Ditto.
* girepository/girparser.c (start_parameter): Handle new fields.
* girepository/girmodule.c (g_ir_module_build_typelib): Adjust
arg_blob_size, bump major version due to this change.
* girepository/girnode.c (g_ir_node_get_full_size_internal)
(g_ir_node_build_typelib)
* girepository/gtypelib.c (g_typelib_check_sanity): ArgBlob size
adjustments.
(g_ir_node_build_typelib): Fill in new ArgBlob flags from param.
* girepository/girepository.h (GIScope): New enumeration, listing
the different possible scopes for callbacks.
* girepository/ginfo.c (g_arg_info_get_scope)
(g_arg_info_get_closure, g_arg_info_get_destroy): Accessors for
callback-related argument indices (callback scope, closure for a
callback, destroy notification for a callback).
* tests/scanner/: Added testcases for new features.
svn path=/trunk/; revision=998
2008-12-10 Johan Bilien <jobi@via.ecp.fr>
Bug 563998 – Cache the GIBaseInfo for GTypes
* girepository/girepository.c (g_irepository_find_by_gtype):
add a cache of GType -> GIBaseInfo.
svn path=/trunk/; revision=991
This change makes us stop calling g_irepository_get_default inside ginfo.c,
which won't work for non-default repositories.
Change GIBaseInfo to not only keep track of its source repository,
we hold a reference. This makes memmgt much clearer.
svn path=/trunk/; revision=970
2008-11-24 Johan Dahlin <jdahlin@async.com.br>
* girepository/gdump.c (dump_type): Remove a warning,
be less verbose on error on fundamental types.
svn path=/trunk/; revision=963
In order to set and get enum and flag fields in structures, we need
to know the integral type that the enumeration is stored as. We are already
computing that at compile time in order to compute struct offsets, so the
easiest thing to do is to save that in the typelib.
* docs/typelib-format.txt girepository/girnode.[ch] girepository/giroffsets.c
girepository/gtypelib.h: Add 'storage_type' to the typelib format for EnumBlob
and compute and save it at compile time.
* girepository/girepository.h girepository/ginfo.c:
Add g_enum_info_get_storage_type().
* girepository/gfield.c: Implement reading and writing enum and flags fields
based on the storage type.
http://bugzilla.gnome.org/show_bug.cgi?id=561296
svn path=/trunk/; revision=944
Add a '*' to the serialization for the cases where we set is_pointer
in the type blob we write out depending on node->is_pointer. Don't
add the '*' in the cases where is_pointer is set or not set in a
fixed fashion.
http://bugzilla.gnome.org/show_bug.cgi?id=561087
svn path=/trunk/; revision=931
Include the size and alignment of structures and unions in the typelib,
and add getter methods to retrieve them from GIStructInfo/GIUnionInfo.
* docs/typelib-format.txt girepository/gtypelib.h girepository/girnode.c
girepository/girmodule.c girepository/gtypelib.c: Add size and alignment
to StructBlob and UnionBlob.
* girepository/ginfo.c girepository/girepository.h:
Add g_[struct|union]_get[size|alignment]().
* test/offsets/gen-gitestoffsets: Test overall structure size and alignment.
svn path=/trunk/; revision=930
Add convenience functions g_field_info_set_field() and
g_field_info_get_field() to set and get fields based on the offsets
in GIFieldInfo.
svn path=/trunk/; revision=929
Keep track of all modules parsed within a GIrParser, and when a
module is referenced a second time, use the existing parsed copy
instead of reparsing.
svn path=/trunk/; revision=906
Fix some trivial bugs in managing the list of include modules.
(Add to module's list twice, not initialized to NULL, not freed.)
svn path=/trunk/; revision=905
When parsing, keep keep a separate hash tables of aliases and
'disguised' flags for each module, and store that on the module.
After parsing an include merge the aliases/disguised flags to the
including module.
Remove 'prefix_aliases' flag and always prefix aliases/disguised
structure types when parsing; this simplifies the code considerably.
svn path=/trunk/; revision=904
The logic in girparser.c didn't work very well if there were multiple
<namespace/> nodes within a single <repository/> (context->namespace
was always the overall filename and not the the name specified in the
<namespace/> element for one thing; this would cause aliases to
be mis-prefixed in include modules.) Also check that the "name" in
the <namespace/> node matches the filename.
svn path=/trunk/; revision=902
Add a toplevel GirParser object to hold state that is global across
a compilation. Currently just holds the include path, but will
eventually also keep a cached list of parsed modules.
svn path=/trunk/; revision=901
2008-11-12 Johan Dahlin <jdahlin@async.com.br>
* girepository/girepository.c:
Change the element type from utf8 to filename
* girepository/girnode.c (g_ir_node_build_typelib):
Special case filename equally to utf8 here.
svn path=/trunk/; revision=895
2008-11-12 Johan Dahlin <jdahlin@async.com.br>
* girepository/girepository.c (g_irepository_get_search_path):
* girepository/girepository.h:
Add a g_irepository_get_search_path, so we can access the search
paths from runtime.
svn path=/trunk/; revision=893
2008-11-12 Johan Bilien <jobi@via.ecp.fr>
Bug 560474 – g-ir-compiler crashes when compiling the glib gir
* girepository/girparser.c: avoid freeing an uninitialized pointer
svn path=/trunk/; revision=891
2008-11-11 Owen Taylor <otaylor@redhat.com>
Compute field offsets and overall size for object structures
Bug 560326 – Fails to build Gtk-2.0.typelib with "Unexpected non-pointer
field of type object in structure"
Do basic computation of field offsets for objects and interfaces;
this doesn't attempt to address all of the "mess" for virtual
functions described in Bug 560281.
svn path=/trunk/; revision=888
2008-11-11 Owen Taylor <otaylor@redhat.com>
* girepository/girparser.c: Search provided include dirs before
the default directories.
svn path=/trunk/; revision=885
2008-11-11 Owen Taylor <otaylor@redhat.com>
* girepository/giroffsets.c: Include fully-qualified names in
all error messages.
svn path=/trunk/; revision=884
2008-11-11 Owen Taylor <otaylor@redhat.com>
* girepository/giroffsets.c: Fail gracefully with an informative
error message when recursion is encountered when computing a
structure size.
svn path=/trunk/; revision=882