summaryrefslogtreecommitdiff
path: root/giscanner/maintransformer.py
Commit message (Collapse)AuthorAgeFilesLines
* scanner: methods cannot have an out-arg as their first argTorsten Schönfeld2012-08-211-0/+6
| | | | | | | | | | | | This ensures that if the first argument of a function like gboolean gdk_rgba_parse (GdkRGBA *rgba, const gchar *spec); is annotated as being an out-arg, the result is a class function with two arguments, not a method with one argument. Previously, the (out) annotation was simply ignored. https://bugzilla.gnome.org/show_bug.cgi?id=682124
* Revert "Implement "rename to" annotation for records"Colin Walters2012-08-131-15/+5
| | | | | | | | | | | | | This reverts commit 764366f7e4ef5a765a24ffac8c60b811f38b9ad9. It can't work right now because to really use the structures, you need to register them as a boxed, and that means we also need to rename the boxed type. A future version of this patch will need to handle both the structure name and the GType name. https://bugzilla.gnome.org/show_bug.cgi?id=675985
* Implement "rename to" annotation for recordsJon Nordby2012-07-271-5/+15
| | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=675985 Moving the early annotation pass is needed to avoid the first type resolve pass to resolve to the not-renamed type.
* scanner: support stability tagEvan Nemerson2012-07-101-1/+11
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=679160
* Maintransfomer: fix again paring error domains with unregistered enumsGiovanni Campagna2012-07-021-13/+3
| | | | | | | | | Previous fix was wrong, as it called to_underscores_noprefix on a prefixed type name. The actual fix is to call the transformer to do the prefix / type_name split, and turn the latter to underscores. Test case included. https://bugzilla.gnome.org/show_bug.cgi?id=634202
* Revert scanner fix in 64f3832Jasper St. Pierre2012-06-271-1/+1
| | | | | | This is incorrect -- the type name that's passed to the function should contain a prefix. This fixes error domains for GLib errors. Don't revert doc changes or test additions.
* scanner: complete the enum-to-error-quark fixGiovanni Campagna2012-06-181-1/+1
| | | | | | | | | | Turns out that the problem was not only in the wrong matching to GType enums, but also that the non-GType heuristics used to_underscores instead of to_underscores_noprefix, turning DBusError into D_Bus_Error instead of DBus_Error. Complete with various tests. https://bugzilla.gnome.org/show_bug.cgi?id=669350
* scanner: fix pairing of error quarks with registered enumsGiovanni Campagna2012-06-161-3/+5
| | | | | | | | | | _uscore_type_names maps from the c_symbol_prefix, which has the global ns prefix removed, so we need to split the function symbol before the lookup. Previously it worked because it used the heuristics for unregistered enums (and failed for GDBusError, which has two uppercase letters in succession) https://bugzilla.gnome.org/show_bug.cgi?id=669350
* scanner: allow for functions that look like constructors but aren'tDan Winship2012-05-261-3/+4
| | | | | | | | | | | | If the scanner found a function with _new in its name, but not prefixed by the name of a known type, it would assume that the function was a constructor, and then complain that it couldn't figure out what it was a constructor for, and mark it introspectable=0. Instead, just assume that the function is not actually a constructor in that case (unless it's explicitly tagged as such). https://bugzilla.gnome.org/show_bug.cgi?id=676815
* Split parameter and tag storage in annotationparser parse treeDieter Verfaillie2012-04-051-20/+20
| | | | | | | | | | | This avoids tags overwriting parameters if they happen to share the same name. For example, this was triggered by valid code in libgnome-keyring. tests/scanner/regress.c and tests/scanner/regress.h test written by Colin Walters <walters@verbum.org>. https://bugzilla.gnome.org/show_bug.cgi?id=672254
* Now make AnnotationParser do what gobject-introspection needs it to do.Dieter Verfaillie2012-04-051-3/+4
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=672254
* Fix matching of methods named *_get_type()Matthew Booth2012-03-061-3/+4
| | | | | | | | | | | | | The code which heuristically turned functions into class methods would always ignore any function called *_get_type or *_get_gtype. However, the code which looked for GI metadata functions to execute them was much more comprehensive, checking not just the name, but also that it had no parameters and that it returned a GType. This change abstracts the more comprehensive check into the Function class, and uses the same check in both places. https://bugzilla.gnome.org/show_bug.cgi?id=671218
* giscanner: Add better errors for unknown param namesJasper St. Pierre2012-02-131-11/+14
| | | | Exclude the names we've already matched up from the "should be one of..." list
* scanner: Allow adding annotations to vfuncs directlyJasper St. Pierre2012-02-091-0/+4
| | | | | | Some vfuncs may not have public invokers. In these cases, annotations may still be needed to correctly implement or chain up to a virtual method from a subclass's implementation.
* Allow using GLib.List(Foo) instead of GLib.List<Foo>Olivier Crête2012-01-101-3/+4
| | | | | | | Using < and > for delimiters is problematic because gtk-doc is Docbook which in turn is SGML, and those are reserved characters. https://bugzilla.gnome.org/show_bug.cgi?id=663190
* Add a floating alias for noneJohan Dahlin2011-11-251-3/+10
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=657202
* scanner: allow GObject.Object as a superclass return typeDan Winship2011-10-131-1/+1
| | | | | | | 6172c268 made the scanner think GObject* wasn't a superclass of its subclasses. Fix that. https://bugzilla.gnome.org/show_bug.cgi?id=661677
* Add constant value annotationJohan Dahlin2011-09-141-1/+11
| | | | | Add an annotation tag "Value:" which can be used on constants to override the value.
* scanner: Don't try to copy c:type if we're parsing (element-type)Colin Walters2011-08-291-5/+10
| | | | | | | | | | | | | Commit 81abc2eb63317003a11d1484e84698a37e8ec035 tries harder to keep the c:type if it was overriden by a (type) annotation. However, the _resolve() function was also called for (element-type), which had undesirable effects - we'd copy the container c:type to the element type. Fix this by splitting out the c:type preservation to only happen when processing toplevel types. https://bugzilla.gnome.org/show_bug.cgi?id=656931
* scanner: Remove some dead debugging codeColin Walters2011-08-291-3/+0
|
* Add tests for newly added warningsGiovanni Campagna2011-08-181-3/+3
| | | | | g-ir-scanner now warns for invalid (element-type) annotations in GPtrArray and in GByteArray. Test that.
* Disallow non byte types for GByteArraysGiovanni Campagna2011-08-181-2/+14
| | | | | | | | | Similarly to GPtrArrays, GByteArrays can only contain bytes. Emit a warning if an inconsistent (element-type) is placed, and ensure that the default is guint8 if nothing is added. This way bindings can support GByteArrays without special casing them. https://bugzilla.gnome.org/show_bug.cgi?id=652753
* Forbid GPtrArrays holding non-pointer typesGiovanni Campagna2011-08-181-0/+14
| | | | | | | | | It should be safe for bindings to assume that GPtrArrays hold only pointers (or values as big as it), so there is no need to go through hoops for converting smaller integers when marshalling. Libraries that need arrays of integers should use GArray. https://bugzilla.gnome.org/show_bug.cgi?id=652753
* Allow enums and bitfields to have static methodsTorsten Schönfeld2011-08-161-1/+1
| | | | | | | | | | | | | This uses the same backcompat machinery that was introduced for static methods for non-class types, so this change does not break users of the existing presentations. New libgirepository API: g_enum_info_get_n_methods g_enum_info_get_method https://bugzilla.gnome.org/show_bug.cgi?id=656499
* Recognize constructors ending in 'newv'Torsten Schönfeld2011-08-141-4/+15
| | | | | | Like gtk_list_store_newv and gtk_tree_store_newv. https://bugzilla.gnome.org/show_bug.cgi?id=656460
* Try harder to preserve c:typeJohan Dahlin2011-08-131-1/+5
| | | | | When we replace a type using annotation we should keep the ctype of the original type.
* scanner: add a moved_to property to backcompat functionsTorsten Schönfeld2011-08-131-3/+3
| | | | | | | Use it to remove backcompat copies of functions that non introspectable anyway. https://bugzilla.gnome.org/show_bug.cgi?id=572408
* scanner: handle static methods on all typesTorsten Schönfeld2011-08-131-11/+27
| | | | | | | | | | | | Instead of just handling static methods for classes, handle them for: - Records and boxed - Unions - Interfaces Based on a patch by Owen Taylor. https://bugzilla.gnome.org/show_bug.cgi?id=572408
* Switch to storing string form of error quarksDan Winship2011-08-121-4/+2
| | | | | | | | | | | | | | | | Instead of storing the name of the function to call to get the error quark, store the string form of the error quark, which we derive from the introspection binary during scanning. Update EnumBlob and GIEnumInfo to include the new information. This will allow determining a back-mapping from error quark to error domain without having to dlsym() and call all the known error quark functions. Based on earlier patches from Owen Taylor and Maxim Ermilov. https://bugzilla.gnome.org/show_bug.cgi?id=602516
* giscanner: mark GAsyncReadyCallbacks as allow-noneDan Winship2011-07-011-0/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=653484
* Rework how fundamental GObject types are introspectedGiovanni Campagna2011-06-081-3/+1
| | | | | | | | | | | Change the special code for handling GObject and GInitiallyUnowned so that it exposes GParamSpec as a class, and it allows GVariant to have a GType without using the deprecate g_variant_get_gtype. It is a sort of ABI break, in that new typelibs won't work with previous versions of libgirepository. https://bugzilla.gnome.org/show_bug.cgi?id=646635
* Always add a zero-terminated attribute when it cannot be impliedGiovanni Campagna2011-06-041-0/+2
| | | | | | | | | | | | g-ir-compiler assumes that an array is zero terminated when the attribute is absent and there is no other attribute (length and fixed-size), but g-ir-scanner only added the attribute when it is 0. This means that an explicit zero-terminated=1 annotation would have had no effect. Fix that and at the same time ensure that all other arrays are not zero-terminated by default. https://bugzilla.gnome.org/show_bug.cgi?id=646635
* scanner: Support _get_gtype() as a GType creation suffixColin Walters2011-06-031-1/+3
| | | | | | Based on a patch by Giovanni Campagna <gcampagna@src.gnome.org> https://bugzilla.gnome.org/show_bug.cgi?id=646635
* Add support for the (skip) annotation on parameters or return valuesDavid Zeuthen2011-05-131-0/+3
| | | | | | | | This was discussed in bug 649657. https://bugzilla.gnome.org/show_bug.cgi?id=649657 Signed-off-by: David Zeuthen <davidz@redhat.com>
* giscanner: read (array) and (element-type) annotations for fieldsGiovanni Campagna2011-05-111-3/+7
| | | | | | | This way fields are no longer limited to basic types, and can be supported without accessor methods. https://bugzilla.gnome.org/show_bug.cgi?id=646635
* Add warnings for the (constructor) annotationTomeu Vizoso2011-02-221-11/+50
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=641347
* Add warnings for the (method) annotationTomeu Vizoso2011-02-221-4/+16
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=641347
* Add (method) overridesTomeu Vizoso2011-02-021-13/+33
| | | | | | So methods such as gtk_drag_dest_set() can be put inside Gtk.Widget https://bugzilla.gnome.org/show_bug.cgi?id=639945
* Preserve gtk-doc section namesJohan Dahlin2011-02-011-0/+5
| | | | | Preserve the section names and write them out on the class/record/ interface.
* Add (constructor) annotationTomeu Vizoso2011-01-281-11/+22
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=561264
* [scanner] Don't crash if we don't have a ctype in array element typesTomeu Vizoso2011-01-211-1/+2
|
* Preserve the c:type of array elementsTomeu Vizoso2011-01-211-2/+3
| | | | | | So the element type has the correct is_pointer flag https://bugzilla.gnome.org/show_bug.cgi?id=638929
* Disable missing class structure warning, add a bug referenceJohan Dahlin2011-01-201-2/+3
|
* Make caller-allocates detection work for struct aliasesPavel Holejsovsky2011-01-131-0/+1
| | | | | | | | | | | | Scanner tries to detect caller-allocates attribute automatically if not explicitly specified by checking that parameter is not double-referenced and is struct or union. This patch adds resolving of aliases when checking whether parameter is struct or union. Also removes old incorrect method transformer.follow_aliases, which was never used in current code. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=639081
* scanner: Make sure that vfuncs made to the GIRTomeu Vizoso2011-01-071-13/+0
| | | | | | | * don't skip those associated to a signal * don't warn if it doesn't have an invoker https://bugzilla.gnome.org/show_bug.cgi?id=637215
* scanner: avoid crash when annotation explicitly changes 'self' argumentPavel Holejsovsky2010-12-211-1/+1
|
* scanner: support typedefs for container typesJonathan Matthew2010-12-161-10/+0
| | | | | | | | | | | Inside an alias definition, we only need the name of the alias target type. Add a method to GIRWriter to write out a type reference rather than full type definition and use it when writing out an alias. Determine introspectableness of aliases in IntrospectablePass so functions using aliases can be marked not-introspectable if the alias itself is not. https://bugzilla.gnome.org/show_bug.cgi?id=629682
* giscanner: don't ignore signal parameter names from annotations.Pavel Holejsovsky2010-12-151-1/+4
| | | | | | | | | | | | | | If present in annotation, use parameter names from annotation instead of (object, p0, p1, ...) names generated by dumpparser. Assign names for all parameters before trying to resolve annotation types, so that annotations containing forward references to other arguments, e.g. * GApplication::open: * @application: the application * @files: (array length=n_files) (element-type GFile): an array of #GFiles * @n_files: the length of @files
* scanner: Only mark structures and unions as out-caller-allocatesColin Walters2010-11-191-1/+4
| | | | | | | | These are the only things for which we expect native values to be preserved; for e.g. flags and integers, we expect bindings to convert. The particular rationale for this patch is to avoid flagging flags (sic) as (out caller-allocates).
* scanner: Fall back to default uscoring for method pairing if possibleColin Walters2010-11-161-6/+16
| | | | | | The commit to use the c_symbol_prefix works in every case, except for gdk_window_object_get_type(), which screws us. Fall back to the old heuristic in this case.