Any annotation where the key has a dot in the name will go into the
attribute list. For example
* @arg: (foo.bar baz): some arg
the parameter @arg will get the attribute with key foo.bar and value
baz. This also works for.
* Returns: (foo.bar2 baz2): the return value
Also add tests for this new feature.
See https://bugzilla.gnome.org/show_bug.cgi?id=571548
Signed-off-by: David Zeuthen <davidz@redhat.com>
This work allows us to move closer to replacing gtk-doc, among other
things. We add a generic attribute "introspectable", and inside the
typelib compiler if we see "introspectable=no", we don't put it in the
typelib. This replaces the hackish pre-filter for varargs with a much
more generic mechanism.
The varargs is now handled in the scanner, and we emit
introspectable=no for them.
Add generic metadata to Node with references to file/line/column,
which currently comes from symbols.
Add scanner options --warn-all and --warn-error.
https://bugzilla.gnome.org/show_bug.cgi?id=621570
This work allows us to move closer to replacing gtk-doc, among other
things. We add a generic attribute "introspectable", and inside the
typelib compiler if we see "introspectable=no", we don't put it in the
typelib. This replaces the hackish pre-filter for varargs with a much
more generic mechanism.
The varargs is now handled in the scanner, and we emit
introspectable=no for them.
Add generic metadata to Node with references to file/line/column,
which currently comes from symbols.
Add scanner options --Wall and --Werror.
* girepository/*: Add g_property_info_get_ownership_transfer() and write
the transfer attribute of properties into the typelib.
* giscanner/*: Parse the (transfer) annotation and write it into the .gir.
* tools/generate.c: Read the transfer annotation for properties and write
to the .tgir.
https://bugzilla.gnome.org/show_bug.cgi?id=620484
* gir/gimarshallingtests.[hc]: Add a test for GStrv in function args and
as struct fields.
* girepository/giroffsets.c: Correctly compute the size of structs with
array fields
* girepository/girparser.c: Set is_pointer to FALSE for arrays with
fixed size that are inside structs.
* giscanner/glibtransformer.py: Special case GStrv as arrays of utf8.
* giscanner/annotationparser.py: Make full transfer the default for
arrays of char* returned by functions.
https://bugzilla.gnome.org/show_bug.cgi?id=620170
We need to support parsing older .girs for inclusion purposes. (But
we should probably have an explicit .gir version, and require the
attribute for newer versions)
People have wanted support for marking (out) on functions of the
form:
/**
* clutter_color_from_pixel:
* @pixel: A pixel
* @color: (out): Color to initialize with value of @pixel
*/
void
clutter_color_from_pixel (guint32 pixel, ClutterColor *color);
Where the caller is supposed to have allocated the argument; the
C function just initializes it. This patch adds support for this
argument passing style to introspection. In this case, we see the
(out), and notice that there's only a single indirection (*) on
the argument, and assume that this means (out caller-allocates).
https://bugzilla.gnome.org/show_bug.cgi?id=604749
Foreign structs are special in the sense that there might
be native bindings (for instance PyCairo for PyGI) that provides
the same functionallity as the introspected variant.
https://bugzilla.gnome.org/show_bug.cgi?id=610357
Add type tags for short and ushort, plus all of the requisite code needed
to utilize them in libgirepository.
Add support in the scanner's AST files.
Add test functions to the everything library and the expected gir file.
gtypelib.c constant validation fixed by Colin Walters <walters@verbum.org>
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.
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.
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
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
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