summaryrefslogtreecommitdiff
path: root/giscanner/annotationparser.py
AgeCommit message (Collapse)AuthorFilesLines
2010-09-19[annotationparser] Preserve line numbersJohan Dahlin1-17/+35
Make sure that the linenumbers of the documentation blocks and tags are preserved and accurate so they can be used in warning messages. Also: * Rename Options to DocOptions for consistency * Add a reference to the docblock a tag and an option belong to
2010-09-19Save the line number of a source commentJohan Dahlin1-1/+2
2010-09-14Add a parameter mismatch warningJohan Dahlin1-0/+3
https://bugzilla.gnome.org/show_bug.cgi?id=629708
2010-09-02[annotationparser] Send in comments directlyJohan Dahlin1-4/+3
2010-08-31Major rewriteColin Walters1-729/+5
One of the first big changes in this rewrite is changing the Type object to have separate target_fundamental and target_giname properties, rather than just being strings. Previously in the scanner, it was awful because we used heuristics around strings. The ast.py is refactored so that not everything is a Node - that was a rather useless abstraction. Now, only things which can have a GIName are Node. E.g. Type and Field are no longer Node. More things were merged from glibast.py into ast.py, since it isn't a very useful split. transformer.py gains more intelligence and will e.g. turn GLib.List into a List() object earlier. The namespace processing is a lot cleaner now; since we parse the included .girs, we know the C prefix for each namespace, and have functions to parse both C type names (GtkFooBar) and symbols gtk_foo_bar into their symbols cleanly. Type resolution is much, much saner because we know Type(target_giname=Gtk.Foo) maps to the namespace Gtk. glibtransformer.py now just handles the XML processing from the dump, and a few miscellaneous things. The major heavy lifting now lives in primarytransformer.py, which is a combination of most of annotationparser.py and half of glibtransformer.py. annotationparser.py now literally just parses annotations; it's no longer in the business of e.g. guessing transfer too. finaltransformer.py is a new file which does post-analysis for "introspectability" mainly. girparser.c is fixed for some introspectable=0 processing.
2010-08-31Use GLib types consistentlyColin Walters1-1/+1
Rather than have the scanner/parser handle both e.g. "glong" and "long", simply use the GLib types everywhere. This commit adds TYPE_LONG_LONG and TYPE_LONG_DOUBLE to the scanner types; however, rather than add them to the typelib, they're just marked as not-introspectable.
2010-07-09Add support for non-GObject fundamental objectsJohan Dahlin1-0/+15
This patch adds support for instantiable fundamental object types, which are not GObject based. This is mostly interesting for being able to support GstMiniObject's which are extensivly used in GStreamer. Includes a big test case to the Everything module (inspired by GstMiniObject) which should be used by language bindings who wishes to test this functionallity. This patch increases the size of the typelib and breaks compatibility with older typelibs. https://bugzilla.gnome.org/show_bug.cgi?id=568913
2010-06-25Initialize value memberColin Walters1-0/+1
2010-06-25Clean up annotation parsing, don't try to parse invalid annotationsColin Walters1-62/+87
The old parser tried to parse: @foo: some text here (other text) Reject this. We strictly require another colon at the end to parse the text in between as (option) (other option). Futher ensure we only attempt to do option parse if we find something that matches the strict regexp ([A-Za-z]+). This could be tightened further. TODO: Have a warning for something that looks like an annotation, but isn't. https://bugzilla.gnome.org/show_bug.cgi?id=622659
2010-06-24Allow attributes on parameters and return valuesDavid Zeuthen1-0/+6
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>
2010-06-22[annotationparser] Reuse method for determining array typeJohan Dahlin1-3/+1
2010-06-16Apply annotations from invoker to vfuncColin Walters1-1/+6
We typically expect people to annotate e.g. GList for virtuals on the invoker, not on the virtual slot, since the invoker feels like the public API. https://bugzilla.gnome.org/show_bug.cgi?id=621570
2010-06-08Support the (transfer) annotation for properties.Tomeu Vizoso1-2/+13
* 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
2010-06-02Fix marshalling of GStrv.GOBJECT_INTROSPECTION_0_6_13Tomeu Vizoso1-1/+5
* 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
2010-05-31[giscanner] Parse multiline gtk-doc commentsJohan Dahlin1-2/+10
2010-05-27Add type annotation for propertiesJohan Dahlin1-0/+4
Add type annotation syntax for GObject properties. This makes it possible to override the type of a property. For instance, this will allow function pointers with a G_TYPE_POINTER type set to be used from a language binding which reads the typelib information in addition g_object_class_find_property. https://bugzilla.gnome.org/show_bug.cgi?id=618318
2010-05-27[scanner] Element-type annotation for GArray typesJohan Dahlin1-4/+13
Add support for (element-type) annotations for G*Array types. https://bugzilla.gnome.org/show_bug.cgi?id=619545
2010-05-27[annotationparser] Avoid a couple of \Johan Dahlin1-3/+3
2010-05-26Support (out caller-allocates)Colin Walters1-2/+22
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
2010-05-23Add support for the 'foreign' annotation to g-i-scannerGOBJECT_INTROSPECTION_0_6_12Tomeu Vizoso1-0/+7
https://bugzilla.gnome.org/show_bug.cgi?id=619450
2010-05-07Fix parameter ordering in error messageOwen W. Taylor1-1/+1
The function name and parameter name were backwards when warning about bad parameter references.
2010-05-07Validate parameter referencesOwen W. Taylor1-3/+20
When an annotation references another parameter, check that that parameter actually exists. Add a comment to the handling of (closure) for callbacks to explain why we don't need the same handling there despite the use of get_parameter_index(). https://bugzilla.gnome.org/show_bug.cgi?id=617978
2010-05-07Validate scope annotation valuesOwen W. Taylor1-0/+10
Make sure that the value specified for scope in a callback annotation is one of the legal values. https://bugzilla.gnome.org/show_bug.cgi?id=617978
2010-05-07Use -1 not None for closure/destroy indicesOwen W. Taylor1-2/+2
Don't assign None to closure and destroy indices in case of collision, they are supposed to be numeric. https://bugzilla.gnome.org/show_bug.cgi?id=617978
2010-05-04Add support for GArrays: add g_type_info_get_array_type() and properly scan ↵Tomeu Vizoso1-2/+20
GArray args Based on a previous patch by C. Scott Ananian <cscott@litl.com> https://bugzilla.gnome.org/show_bug.cgi?id=581687
2010-05-03Revert "Add support for GArrays: add g_type_info_get_array_type() and ↵Tomeu Vizoso1-6/+0
properly scan GArray args" This reverts commit 87291e08b0fd34b62e1ad9811c174108b38311a9.
2010-04-30Add support for GArrays: add g_type_info_get_array_type() and properly scan ↵Tomeu Vizoso1-0/+6
GArray args Based on a previous patch by C. Scott Ananian <cscott@litl.com> https://bugzilla.gnome.org/show_bug.cgi?id=581687
2010-04-28[annotationparser] Disable warningJohan Dahlin1-2/+3
2010-04-28Warn about annotations for unknown argsTomeu Vizoso1-0/+14
https://bugzilla.gnome.org/show_bug.cgi?id=615890
2010-03-15Small fix to handle @attributes: .... (.....) as a parameter to a functionAlan Knowles1-1/+2
Previously crashed out, now just ignores the attribute
2010-02-11Assume allow-none for GCancellableColin Walters1-2/+4
All GCancellables are allow-none, this allows us to remove a lot of custom annotations. https://bugzilla.gnome.org/show_bug.cgi?id=604658
2010-01-14scanner: Always explicitely set the scope of callbacksJohan Bilien1-1/+1
default to 'call' as stated in the annotation documentation. https://bugzilla.gnome.org/show_bug.cgi?id=607026
2009-12-09[scanner] Fix various hardcoded type name checksDan Winship1-7/+12
Various places that check hardcoded type names were not always handling the case of the type being used from within its own library (in which case it won't have a type prefix). Make them more consistent. https://bugzilla.gnome.org/show_bug.cgi?id=602512
2009-12-09Fix an annotationparser bug for empty tagsJohan Dahlin1-0/+2
Makes sure we can parse empty tags such as '@foo:' without adding a : in the end which the typelib compiler will complain about
2009-12-08Wrap line in 80 charactersJohan Dahlin1-2/+3
2009-12-04annotationparser: include symbol name in warningStefan Kost1-2/+2
Telling file and line would be better, but alreday this way one atleast has a chance to fix it actually.
2009-12-03Check for AsyncReadyCallback / DestroyNotifyJohan Dahlin1-2/+3
This should have been included with f74823. Fixes the async/notified scope annotation for glib/gio.
2009-12-02Better scope in GAsyncReadyCallback/GDestroyNotifyJohan Dahlin1-1/+18
GAsyncReadyCallback should have use the async scope per default and GDestroyNotify should be notified if the previous parameters are a callback and user data. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=602862
2009-08-24Bug 556628 – (skip) annotationDan Winship1-0/+7
Adds a (skip) option that can be added to the header of any doc comment to cause that symbol to be skipped in the .gir output
2009-07-03Allow annotations on fieldsAndreas Rottmann1-5/+15
Plain fields (i.e. non-callbacks) may have a 'type' annotation now.
2009-06-23Bug 579008 - Don't override element-type for arraysColin Walters1-1/+2
Annotation parser patch from: Tim Horton <hortont424@gmail.com> If an explicit element type is specified, don't override it with guint8.
2009-06-12Bug 581685: Parse parameterized types (using <>) in annotations.C. Scott Ananian1-14/+49
You can now specify a nested parameterized type in annotations as (for example): @param: (type GLib.HashTable<utf8,GLib.HashTable<utf,utf>>) or @param: (element-type utf8 GLib.HashTable<utf,utf>) New test functions for the Everything typelib show how it works.
2009-06-09Bug 584453 - Handle char ** correctly (and const variation)Colin Walters1-3/+2
This patch fixes our default handling of char **. We add Return node types as a case where we test for array handling. Remove the hardcoded assumption of array = "no transfer", just use the separate Parameter/Return cases. This change causes inout char ** to be transfer="full", but that seems more correct.
2009-05-12Allow the use of the "Rename To" annotation for literal method renaming.C. Scott Ananian1-2/+15
As originally implemented, this annotation was only used for method overloading (argument signature polymorphism). Allow it to be used to clean up historically poorly-named methods as well.
2009-03-23Bug 574284 - Add support for a 'closure' and 'destroy' annotationsAndreas Rottmann1-1/+26
This allows to annotate cases where the heuristics don't work. TODO: According to Juerbi, there are cases where two callbacks refer to the same user_data, which is prohibited by the current implementation. Signed-off-by: Andreas Rottmann <a.rottmann@gmx.at>
2009-03-19Bug 556475 – support Shadows: annotationAndreas Rottmann1-1/+25
Add support for the 'Rename To:' annotation for functions and methods.
2009-03-16Bug 565147 - Add (type) annotation to override the C type definitionColin Walters1-1/+6
We previously supported (type) on signals only, extend it to all cases. This is useful for a few cases where libraries use a superclass like GtkWidget* for C convenience, where the actual type is a subclass.
2009-03-05Bug 557383 - Virtual method supportColin Walters1-14/+43
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.
2009-03-04Bug 573332 - Allow annotation of enums as bitfieldsAndreas Rottmann1-0/+7
Add support for a `(type bitfield)' annotation for enums. Signed-off-by: Andreas Rottmann <a.rottmann@gmx.at>
2009-03-04Introduce documentation-block optionsAndreas Rottmann1-7/+18
Allow a documentation block to have options, e.g.: /* * SomeType: (OPT-NAME VALUE) ... */ Signed-off-by: Andreas Rottmann <a.rottmann@gmx.at>