When ./configure --prefix $HOME/some/where is used gobject-introspection
will happily install the files into $HOME/some/where/data/gir-1.0 but
it will refuse to find them. Apply the same trick as in
girepository/girepository.c:init_globals to find the gir files.
Unifiy the name gir-1.0 in GIR_SUFFIX and use it throughout the
project, introduce GIR_DIR which holds the path to the gir files and
update girparser and transformer.py to look into this path.
The enumeration values cited here were out of date. Rewrite to eliminate
the explicit mention of the enumeration value, to prevent it from
drifting out of date again in the future.
Parse the c:prefix from the .gir, include it in the header. Armed with this
information, we can now optimize lookups of GTypes because we
have the requirement that GTypes must start with the c:prefix. We do
fall back though if a lookup fails.
Broadly speaking, this change adds the concept of <vfunc> to the .gir.
The typelib already had most of the infrastructure for virtual functions,
though there is one API addition.
The scanner assumes that any class callback slot that doesn't match
a signal name is a virtual. In the .gir, we write out *both* the <method>
wrapper and a <vfunc>. If we can determine an association between
them (based on the names matching, or a new Virtual: annotation),
then we notate that in the .gir.
The typelib gains an association from the vfunc to the function, if
it exists. This will be useful for bindings since they already know
how to consume FunctionInfo.
We now support an extensible mechanism where arbitrary key-value
pairs may be associated with almost all items, including objects,
methods, and properties.
These attributes appear in both the .gir and the .typelib.
Similar to GObject class structs, we pair up GInterfaces with
their C structures.
Also, move some GLib-specific things into glibast.py, and make
the naming more generic.
Expand various typelib objects to ensure we have at least 16 bits
left for each one to add another string indirection or directory offset,
and also that we have at least a few bits for more flags.
typelib-format.txt was growing out of date; a good solution to this is
to move it closer to the code it's documenting. By doing this we also
gain the ability to use gtk-doc on it.
When generating a .gir file, we now first parse all of our .gir includes
to pick up their <package> headers. Then, we merge that with the set of
--pkg arguments passed to us, run pkg-config to gather the arguments,
and finally save the merged pkg-config list to our new .gir file.
This is useful for software which needs to map from .gir to pkg-config
in a programmatic way.
Inside glibtransformer, we now look at structures ending in "Class" and
see if they have an associated GlibObject (i.e. a structure of the same
name without the "Class" suffix). If found, pair them up.
The .gir file for <class> gains an attribute denoting its associated
class struct. Any <record> many now have a glib:is-class-struct-for
annotation which tells which (if any) <class> for which it defines the
layout.
In the .typelib, we record the association between the class and
its structure. Generic structures however just have a boolean
saying whether they're a class struct. (Going from a generic class
struct to its class should not be necessary).
Finally, we expose GIRepository APIs to access both bits of information
from the .typelib.
svn path=/trunk/; revision=1088
Patch from Andreas Rottmann <a.rottmann@gmx.at>.
* tests/scanner/utility.h (UtilityTaggedValue): Make the union
member anonymous.
(UtilityByte): New union typedef with an unnamed struct in it.
* giscanner/transformer.py (Transformer._create_struct): Create
unnamed structs for symbols with a None ident.
(Transformer._create_union): Likewise.
* giscanner/girwriter.py (GIRWriter._write_record): Allow name
being None.
(GIRWriter._write_union): Likewise.
* girepository/girparser.c (start_struct): Allow a NULL name for
non-toplevel structs.
(start_union): Likewise.
* tests/scanner/utility.h (UtilityTaggedValue): New struct
typedef, which has a nested union member.
* tests/scanner/utility-expected.gir: Adapted.
* giscanner/transformer.py (Transformer._create_member): Create
struct/union members if appropriate.
(Transformer._create_struct, Transformer._create_union): Allow for
structs/unions without a C type.
* giscanner/glibtransformer.py (GLibTransformer._resolve_field):
We don't need to resolve non-typef'd
(GLibTransformer._resolve_field): Add cases for non-typedef'd
struct/union "fields".
* giscanner/girwriter.py (GIRWriter._write_record): Allow for
records without a C type.
(GIRWriter._write_field): structs and unions may appear in places
where fields do.
svn path=/trunk/; revision=1082
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