summaryrefslogtreecommitdiff
path: root/giscanner/ast.py
Commit message (Collapse)AuthorAgeFilesLines
* Make sure signal works when there isn't one specifiedgir-docbookJohan Dahlin2011-08-131-1/+1
|
* Add signal flagsJohan Dahlin2011-08-131-1/+14
| | | | | | This adds all GSignalFlags into the gir. https://bugzilla.gnome.org/show_bug.cgi?id=656457
* Switch to storing string form of error quarksDan Winship2011-08-131-2/+9
| | | | | | | | | | | | | | | | 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
* Automatically turn Gdk.Rectangle gtype into cairo.RectangleIntPavel Holejsovsky2011-08-131-0/+7
| | | | | | | | Gdk.Rectangle is 'boxed alias', which is not currently weel supported by g-i. Work around by transforming Gdk.Rectangle gtype into cairo.RectangleInt. https://bugzilla.gnome.org/show_bug.cgi?id=655423
* ast: cleanup clone() methodsJohan Dahlin2011-01-201-4/+1
|
* Add support for g[u]intptr in scanner and girwriter.Pavel Holejsovsky2011-01-131-4/+11
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=634838
* scanner: Fix handling of property transferColin Walters2011-01-051-1/+4
| | | | | | * gdumpparser.py was incorrectly passing the ctype for transfer * Property constructor wasn't actually doing anything with passed transfer * Parse transfer-ownership in girparser
* scanner: Support GStrv as signal parametersColin Walters2010-10-211-0/+5
|
* [scanner] Support private/public directivesJohan Dahlin2010-09-201-0/+1
| | | | Fixes https://bugzilla.gnome.org/show_bug.cgi?id=594125
* [scanner] Add a Position classJohan Dahlin2010-09-201-3/+4
| | | | | | Add a position class which will make it easier to send filename/line/column information to the message class.
* Add a parameter mismatch warningJohan Dahlin2010-09-141-0/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=629708
* scanner: Handle G_TYPE_HASH_TABLEColin Walters2010-09-141-1/+6
| | | | | Our Type creation from GType names didn't know how to handle the GObject boxeds for GHashTable, GArray etc.
* scanner: Kill glibastColin Walters2010-09-081-48/+153
| | | | | | | | | | | | It was a stupid abstraction split, we only support GObject. * Clean up how we handle c:type - we only set it if we've actually seen a corresponding structure. * Add a warning if we don't see the structure typedef for an interface, since that's pretty bogus. (And fix regress.h to have one) * Rename the "type_name" attribute internally to "gtype_name" for clarity.
* Handle casing better for constantsOwen W. Taylor2010-09-071-0/+2
| | | | | | | | | | | | | | | | | Instead of handling constants by lower-casing them, stripping the lower-case prefix and upper-casing them again, leave them in the original case and check against upper-cased versions of namespace.symbol_prefixes. Wwe detect what version to test against by looking at the first character of the identifier, so we assume that --symbol-prefix options are always in lowercase. If that needs to be relaxed, then we'll have to check all symbols against both sets of prefixes. Add tests for constants to Regress.h and fix tests/warn/unresolved-type.h for a warning message that improved with this change. https://bugzilla.gnome.org/show_bug.cgi?id=629007
* [scanner] Clarify exception messageJohan Dahlin2010-09-061-1/+1
|
* [scanner] Remove a bunch of unused functionsJohan Dahlin2010-09-061-19/+0
|
* scanner: Add backwards compatibility with some annotation typesColin Walters2010-09-031-0/+6
| | | | These were listed on the wiki up until just now...
* [scanner] Move a function from transformer to astJohan Dahlin2010-09-021-1/+12
| | | | | It doesn't use any internal state, so it can easily be moved over to the type as a factory function
* scanner: Better handling of GType namesColin Walters2010-09-011-3/+15
| | | | | | | | Before, Type instances could be indeterminate, holding a "ctype", which means "This is some unresolved string". However, we also get data from GType, so add gtype_name as another indeterminate state. Clean up how we create and resolve Type instances from GType data.
* scanner: Better handling of empty namespace prefix for XColin Walters2010-08-311-2/+2
| | | | | Add namespacing prefixes to the static .gir files. Support the empty prefix, as is needed for xlib.
* Major rewriteColin Walters2010-08-311-262/+490
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Use GLib types consistentlyColin Walters2010-08-311-72/+82
| | | | | | | | | 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.
* Don't include machine-dependent integral types in the typelibColin Walters2010-07-091-10/+6
| | | | | | | | | | | | | | | | | | | | Previously we had both e.g. GI_TYPE_TAG_LONG and GI_TYPE_TAG_INT64, but in fact the typelib is already machine-specific, so it makes sense to just encode this as a fixed type. The .gir remains abstract. We also remove size_t from the typelib; one would never want to treat it differently than an integer. time_t is removed as well; while bindings like gjs had special handling to turn it into e.g. a JS Date object, I don't think we should encourage people to use these POSIX types in their API. Use GTimeVal or the like instead. Because the typelib is now really machine-specific, we need to remove the -expected.tgirs from git. (We could potentially add a check which wasn't just a literal diff later) https://bugzilla.gnome.org/show_bug.cgi?id=623774
* Support introspectable=no attribute, add warnings frameworkColin Walters2010-06-171-1/+13
| | | | | | | | | | | | | | | | | | 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
* Revert "Support introspectable=no attribute, add warnings framework"Johan Dahlin2010-06-171-13/+1
| | | | This reverts commit 074192b89c6afcdd7f062f03989972e44334b8bf.
* Support introspectable=no attribute, add warnings frameworkColin Walters2010-06-161-1/+13
| | | | | | | | | | | | | | | | 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.
* Support the (transfer) annotation for properties.Tomeu Vizoso2010-06-081-3/+3
| | | | | | | | | | | | * 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
* Support (out caller-allocates)Colin Walters2010-05-261-0/+1
| | | | | | | | | | | | | | | | | | | | | 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
* [scanner] Support unsigned long/short intAlan Knowles2010-05-251-0/+2
|
* Add support for the 'foreign' annotation to g-i-scannerGOBJECT_INTROSPECTION_0_6_12Tomeu Vizoso2010-05-231-0/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=619450
* Add uid_t, gid_t, dev_t to integral type conversionsColin Walters2010-05-191-3/+19
| | | | | | | | Continuing where we were going with pid_t, define a few more POSIX types by converting them to their fundamental integers. See commentary in patch for more explanation on rationale. https://bugzilla.gnome.org/show_bug.cgi?id=618778
* Validate scope annotation valuesOwen W. Taylor2010-05-071-0/+4
| | | | | | | 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
* Add support for GArrays: add g_type_info_get_array_type() and properly scan ↵Tomeu Vizoso2010-05-041-2/+4
| | | | | | | | GArray args Based on a previous patch by C. Scott Ananian <cscott@litl.com> https://bugzilla.gnome.org/show_bug.cgi?id=581687
* Bug 556628 – (skip) annotationDan Winship2009-08-241-0/+1
| | | | | 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
* Bug 584423 – Add short/ushort supportMark Lee2009-06-221-9/+13
| | | | | | | | | 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>
* Bug 581685: Parse parameterized types (using <>) in annotations.C. Scott Ananian2009-06-121-1/+1
| | | | | | | | | | 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.
* Bug 574284 - Add support for a 'closure' and 'destroy' annotationsAndreas Rottmann2009-03-231-0/+10
| | | | | | | | | | 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>
* Bug 556475 – support Shadows: annotationAndreas Rottmann2009-03-191-0/+20
| | | | Add support for the 'Rename To:' annotation for functions and methods.
* Bug 557383 - Virtual method supportColin Walters2009-03-051-10/+26
| | | | | | | | | | | | | | | | 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.
* Bug 571548 - Generic attributesColin Walters2009-03-031-0/+1
| | | | | | | | 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.
* Revert "Bug 557383 - Virtual function support"Colin Walters2009-02-261-1/+5
| | | | | | | This reverts commit 4470a24e8cf3827efaddcfe240c3271cf1a0d6c0. Needs more work as it turns out, we need to figure out the binding story.
* Bug 557383 - Virtual function supportColin Walters2009-02-261-5/+1
| | | | | | | In order to determine whether a method is virtual, by default we look at the class table to find a callback field. This should be fairly reliable, but we may also later need annotations to more finely control this in the case of a name clash with a signal.
* Bug 572434 - Associate interfaces with their C structuresColin Walters2009-02-251-5/+3
| | | | | | | | 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.
* Bug 571483 - Sort toplevel .gir entriesColin Walters2009-02-171-0/+3
| | | | This ensures we're stable on a macro level.
* Bug 551738 - Associate classes with their structsColin Walters2009-02-061-0/+4
| | | | | | | | | | | | | | | | | | | | | 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
* Bug 562615 – Struct methods missingJohan Dahlin2009-01-201-0/+3
| | | | | | | | | | | | | | | | | 2009-01-20 Johan Dahlin <jdahlin@async.com.br> Bug 562615 – Struct methods missing * giscanner/annotationparser.py: * giscanner/ast.py: * giscanner/girwriter.py: * giscanner/glibast.py: * giscanner/glibtransformer.py: * tests/scanner/foo-1.0-expected.gir: * tests/scanner/foo-1.0-expected.tgir: svn path=/trunk/; revision=1054
* Bug 555036 – put gtk-doc in GIRJohan Dahlin2009-01-131-0/+11
| | | | | | | | | | | | | | | | | 2009-01-13 Johan Dahlin <jdahlin@async.com.br> Bug 555036 – put gtk-doc in GIR * giscanner/annotationparser.py: * giscanner/ast.py: * giscanner/girwriter.py: * giscanner/glibast.py: * tests/scanner/annotation-1.0-expected.gir: * tests/scanner/annotation.h: * tests/scanner/foo-1.0-expected.gir: svn path=/trunk/; revision=1032
* Bug 563591 – Flags not recognized when there is no introspection dataJohan Dahlin2009-01-121-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | 2009-01-12 Johan Dahlin <jdahlin@async.com.br> Bug 563591 – Flags not recognized when there is no introspection data * giscanner/ast.py: * giscanner/girwriter.py: * giscanner/giscannermodule.c (type_get_is_bitfield): * giscanner/glibast.py: * giscanner/glibtransformer.py: * giscanner/scannerparser.y: * giscanner/sourcescanner.c (gi_source_type_copy): * giscanner/sourcescanner.h: * giscanner/sourcescanner.py: * giscanner/transformer.py: * tests/scanner/foo-1.0-expected.gir: * tests/scanner/foo-1.0-expected.tgir: * tests/scanner/foo.h: Large parts of this patch was done by Jürg Billeter. svn path=/trunk/; revision=1025
* Bug 563794 - Redo annotation parsing & applyingJohan Dahlin2009-01-121-8/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-01-12 Johan Dahlin <jdahlin@async.com.br> Bug 563794 - Redo annotation parsing & applying Thanks to Colin for helping out considerably in landing this. * giscanner/Makefile.am: * giscanner/ast.py: * giscanner/dumper.py: * giscanner/girparser.py: * giscanner/giscannermodule.c (pygi_source_scanner_get_comments), (calc_attrs_length), (pygi_collect_attributes), (init_giscanner): * giscanner/glibtransformer.py: * giscanner/scannerlexer.l: * giscanner/sourcescanner.c (gi_source_symbol_unref), (gi_source_scanner_new), (gi_source_scanner_free), (gi_source_scanner_get_comments): * giscanner/sourcescanner.h: * giscanner/sourcescanner.py: * giscanner/transformer.py: * giscanner/xmlwriter.py: * tests/scanner/annotation-1.0-expected.gir: * tests/scanner/annotation-1.0-expected.tgir: * tests/scanner/annotation.c: * tests/scanner/annotation.h: * tests/scanner/foo-1.0-expected.gir: * tests/scanner/foo-1.0-expected.tgir: * tests/scanner/foo.h: * tools/g-ir-scanner: This commit merges the annotation parser rewrite branch. It'll change the annotation parsing to be done completely in python code which will make it easier to do further annotation parsing easier. svn path=/trunk/; revision=1017
* Bug 556489 – callback annotationsAndreas Rottmann2009-01-031-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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