summaryrefslogtreecommitdiff
path: root/giscanner/girparser.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/+8
| | | | | | This adds all GSignalFlags into the gir. https://bugzilla.gnome.org/show_bug.cgi?id=656457
* scanner: Don't throw away blank lines in the docsColin Walters2011-08-131-1/+2
| | | | | | For generating documentation, we actually want to preserve these. https://bugzilla.gnome.org/show_bug.cgi?id=656389
* Switch to storing string form of error quarksDan Winship2011-08-131-2/+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
* scanner: Fix handling of property transferColin Walters2011-01-051-2/+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: Properly parse recursive list type nodesColin Walters2011-01-051-5/+10
| | | | | | | Previously we were just looking for <type> inside a GLib.List, but it may be <array>. See bug 637262 for code that triggered this.
* [girparser] Callbacks and VFunctions can be shadowedJohan Dahlin2010-09-241-2/+3
|
* Add a script to extract gio annotationsJohan Dahlin2010-09-241-0/+3
|
* [scanner] Support private/public directivesJohan Dahlin2010-09-201-0/+1
| | | | Fixes https://bugzilla.gnome.org/show_bug.cgi?id=594125
* [scanner] Only store types in cache storeJohan Dahlin2010-09-201-16/+28
| | | | | | | | | | | | Only store types that can be referenced in the cache store this reduces the size of the serialized Gtk-3.0.gir in the store from 5.7M to 366k on my system. It also reduces the time it takes to create a gir in gtksourceview by 35% and the time to run the warnings test by more than 50% This also disables the cache for passthrough mode since it needs access to the whole serialized tree.
* Remove leftover, type is set aboveJohan Dahlin2010-09-201-1/+0
|
* scanner: Parse annotations for typedefsColin Walters2010-09-141-0/+1
| | | | | | | | * Explicitly check for ast.Alias in annotation pass * Add "generic" attribs handling for aliases like docs, introspectable=0 etc. https://bugzilla.gnome.org/show_bug.cgi?id=629668
* scanner: Unify parsing of compoundsColin Walters2010-09-091-38/+23
| | | | Avoids duplicate code.
* scanner: Kill glibastColin Walters2010-09-081-57/+39
| | | | | | | | | | | | 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.
* Major rewriteColin Walters2010-08-311-164/+323
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Move alias target to <type>Colin Walters2010-08-311-1/+2
| | | | | | | This makes type parsing more uniform. Delete the typedef for GSList in foo.h - that's not supported anymore, or at least for now.
* Fix trailing whitespaceColin Walters2010-06-191-1/+1
|
* Better error message for incompatible versionsColin Walters2010-06-171-2/+18
|
* More explicitly document how we'll use the version= attribute on repositoryColin Walters2010-06-171-0/+7
| | | | | | I want to start bumping it on incompatible .gir changes. https://bugzilla.gnome.org/show_bug.cgi?id=621895
* Add support for GArrays: add g_type_info_get_array_type() and properly scan ↵Tomeu Vizoso2010-05-041-2/+14
| | | | | | | | GArray args Based on a previous patch by C. Scott Ananian <cscott@litl.com> https://bugzilla.gnome.org/show_bug.cgi?id=581687
* Don't assume _pkgconfig_packages is set.Johan Dahlin2009-02-261-0/+4
| | | | | This fixes a cache issue where the pickle in the cache doesn't have self._pkgconfig_packages set in its instance
* Bug 567906 - Put pkg-config dependencies in .gir filesColin Walters2009-02-111-0/+10
| | | | | | | | | | 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.
* Bug 563794 - Redo annotation parsing & applyingJohan Dahlin2009-01-121-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix inconsistencies with PEP8Jürg Billeter2009-01-031-2/+0
| | | | | | | | | | | | | | | | 2009-01-03 Jürg Billeter <j@bitron.ch> * giscanner/ast.py: * giscanner/dumper.py: * giscanner/girparser.py: * giscanner/glibtransformer.py: * giscanner/sourcescanner.py: * giscanner/transformer.py: * giscanner/xmlwriter.py: Fix inconsistencies with PEP8 svn path=/trunk/; revision=997
* Parse interface prerequisitesColin Walters2008-11-171-0/+2
| | | | svn path=/trunk/; revision=934
* Bug 560248 – "disguised structures"Owen Taylor2008-11-101-1/+3
| | | | | | | | | | | | | | Certain types like GIConv and GdkAtom are pointers internally but don't look like pointers when referenced. They have the form. typedef struct _X *X; Parse these as structures/records but mark them in the gir with a 'disguised' attribute so that we know that they need special handling. In the typelib treat them like any other structure. svn path=/trunk/; revision=872
* Relicense the giscanner library under LGPLv2+. This has been approved byJohan Dahlin2008-11-041-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2008-11-04 Johan Dahlin <jdahlin@async.com.br> * giscanner/__init__.py: * giscanner/ast.py: * giscanner/cachestore.py: * giscanner/cgobject.py: * giscanner/girparser.py: * giscanner/girwriter.py: * giscanner/giscannermodule.c: * giscanner/glibast.py: * giscanner/glibtransformer.py: * giscanner/libtoolimporter.py: * giscanner/minixpath.py: * giscanner/odict.py: * giscanner/sourcescanner.c: * giscanner/sourcescanner.h: * giscanner/sourcescanner.py: * giscanner/transformer.py: * giscanner/utils.py: * giscanner/xmlwriter.py: * COPYING: Relicense the giscanner library under LGPLv2+. This has been approved by all contributors. svn path=/trunk/; revision=862
* Bug 558848 giparser.py: shared library should be optionalOwen Taylor2008-11-011-2/+3
| | | | | | | | | | | | 2008-11-01 Owen Taylor <otaylor@redhat.com> Bug 558848 giparser.py: shared library should be optional When parsing a .gir, allow the shared-library attribute of <namespace/> to be missing: this corresponds to the handling in libgirepository and elsewhere. svn path=/trunk/; revision=860
* Remove arguments from the constructor, move them to separate accessors.Johan Dahlin2008-10-301-18/+18
| | | | | | | | | | | | | | | | | | | | 2008-10-30 Johan Dahlin <jdahlin@async.com.br> * giscanner/girparser.py: Remove arguments from the constructor, move them to separate accessors. Add a new parse_tree method which takes an element tree instance. * tools/g-ir-scanner: Update callsite for this * giscanner/Makefile.am: * giscanner/cachestore.py: * giscanner/transformer.py: Cache the include parsing. Saves ~25% time when creating vte (which includes everything up to gtk+). svn path=/trunk/; revision=842
* Avoid parsing parameters, types etc when parsing includes. Should speed upJohan Dahlin2008-10-301-23/+45
| | | | | | | | | | | | 2008-10-30 Johan Dahlin <jdahlin@async.com.br> * giscanner/girparser.py: * giscanner/transformer.py: Avoid parsing parameters, types etc when parsing includes. Should speed up include parsing a bit. svn path=/trunk/; revision=838
* Avoid big if/else and use a dispatch table like approach.Johan Dahlin2008-10-301-51/+72
| | | | | | | | | | | 2008-10-30 Johan Dahlin <jdahlin@async.com.br> * giscanner/girparser.py: Avoid big if/else and use a dispatch table like approach. svn path=/trunk/; revision=837
* Bug 557241 – "throws" flag for functionsJohan Bilien2008-10-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2008-10-21 Johan Bilien <jobi@via.ecp.fr> Bug 557241 – "throws" flag for functions * tests/scanner/drawable-1.0-expected.gir, tests/scanner/drawable-injected-1.0-expected.gir, tests/scanner/drawable.[ch]: add simple test for throwing function (has GError ** as last argument) * giscanner/ast.py: add a 'throws' flag to Function * giscanner/glibtransformer.py: if a function's last paramerter is a GError, set the 'throws' flag and remove that parameter * giscanner/girwriter.py: write out the 'throws' attribute * giscanner/girparser.py: support parsing the 'throws' attribute * tests/repository/gitestthrows.c: add a simple test to check the throws flag in a typelib and invoke the function * girepository/ginfo.c, girepository/girnode.[ch], girepository/girnode.h, girepository/girparser.c, girepository/girepository.h: Add and parse the GI_FUNCTION_THROWS flag * girepository/ginvoke.c: if a function throws, add a GError as last arguments, and propagate the error to the invoker. svn path=/trunk/; revision=773
* Bug 557011 - Add g_object_info_get_abstractColin Walters2008-10-201-5/+10
| | | | svn path=/trunk/; revision=757
* giscanner: don't lose 'transfer-ownership' attributes when injectingTommi Komulainen2008-10-201-1/+1
| | | | | | | | * giscanner/girparser.py (_parse_function): don't lose 'transfer-ownership' attributes when injecting, check for the correct attribute svn path=/trunk/; revision=755
* Parse array length= to ensure it doesn't get lost from --injectColin Walters2008-10-191-2/+6
| | | | svn path=/trunk/; revision=752
* Bug 556732 – generate gir files consistentlyTommi Komulainen2008-10-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 2008-10-17 Tommi Komulainen <tommi.komulainen@iki.fi> Bug 556732 – generate gir files consistently * giscanner/ast.py (Field): add readable and writable properties * giscanner/girparser.py (_parse_field): copy 'readable' and 'writable' attributes * giscanner/transformer.py (_create_member): create fields as read-write * giscanner/glibtransformer.py (_introspect_object, _pair_class_struct): make object instance and class fields read-only * giscanner/girwriter.py (_write_field): * tools/generate.c (write_field_info): write field 'readable' and 'writable' attributes only if non-default (read-only) * girepository/girparser.c (start_field): in the absence of attributes assume fields are read-only * tests/boxed.gir: * tests/struct.gir: remove redundant readable="1" from fields * tests/scanner/foo-1.0-expected.gir: * tests/scanner/utility-1.0-expected.gir: add writable="1" to all record and union fields svn path=/trunk/; revision=743
* Bug 556610 – giscanner/girparser.py drops parameter optionsJohan Bilien2008-10-171-2/+6
| | | | | | | | | | | | | | | 2008-10-16 Johan Bilien <jobi@via.ecp.fr> Bug 556610 – giscanner/girparser.py drops parameter options * tests/scanner/drawable-injected-1.0-expected.gir, tests/scanner/DrawableAdditions.xml: added simple test for injection. * giscanner/ast.py: allow Parameter to take options in the constructor * giscanner/girparser.py: parse parameter options (transfer, direction, allow-none) svn path=/trunk/; revision=738
* Merge branch 'bug556331-includecleanup'Colin Walters2008-10-161-2/+4
| | | | svn path=/trunk/; revision=724
* Parse bits attribute of fieldsJürg Billeter2008-10-121-1/+2
| | | | | | | | 2008-10-12 Jürg Billeter <j@bitron.ch> * giscanner/girparser.py: Parse bits attribute of fields svn path=/trunk/; revision=700
* actually add the parsed constant nodesJohan Bilien2008-10-121-1/+1
| | | | | | | | | 2008-10-12 Johan Bilien <jobi@via.ecp.fr> * giscanner/girparser.py: actually add the parsed constant nodes svn path=/trunk/; revision=698
* parse constant nodes in gir filesJohan Bilien2008-10-121-2/+11
| | | | | | | | | 2008-10-12 Johan Bilien <jobi@via.ecp.fr> * giscanner/girparser.py: parse constant nodes in gir files svn path=/trunk/; revision=695
* Fix parsing transfer-ownership attribute of <return-value>Jürg Billeter2008-10-121-4/+1
| | | | | | | | | 2008-10-12 Jürg Billeter <j@bitron.ch> * giscanner/girparser.py: Fix parsing transfer-ownership attribute of <return-value> svn path=/trunk/; revision=685
* Bug 552858: versioningColin Walters2008-10-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a big patch. You should probably remove your installation tree to be cleaner. * docs/typelib-format.txt: Add nsversion entry which holds version of namespace. * girepository/girepository.h: Add 'version' parameter to g_irepository_require. This may be NULL. Normally bindings should pass an explicit version though. * girepository/girepository.c: Lots of infrastructure to support versioning. Add some more documentation. Disallow some usage of NULL namespaces. * girepository/girmodule.c: Add version parameter. * girepository/gtypelib.c: Update header size. * giscanner/ast.py: Add version to Namespace. * giscanner/girparser.py: Parse version attribute from XML, pass to Namespace. * giscanner/girwriter.py: Write out version parameter. * giscanner/transformer.py: Clean up include registration. * tests/*: Add version attribute. * tests/invoke/invoke.c: Don't try looking up test before it's loaded in repository. * tools/generate.c: Output version parameter. * gir/Makefile.am: Add 2.0 version to .gir files. svn path=/trunk/; revision=677
* fix typo on 'members' variable.Lucas Rocha2008-10-121-1/+1
| | | | | | | | | 2008-10-11 Lucas Rocha <lucasr@gnome.org> * giscanner/girparser.py (_parse_enumeration_bitfield): fix typo on 'members' variable. svn path=/trunk/; revision=675
* Also parse enums which are not glib types.Johan Dahlin2008-10-111-8/+20
| | | | | | | | | | 2008-10-11 Johan Dahlin <johan@gnome.org> * giscanner/girparser.py: Also parse enums which are not glib types. svn path=/trunk/; revision=669
* Bug 554854: The --typelib-xml and --inject options should reuse giscannerLucas Rocha2008-10-111-21/+82
| | | | | | | | | | | | | | | | | | | 2008-10-11 Lucas Rocha <lucasr@gnome.org> Bug 554854: The --typelib-xml and --inject options should reuse giscanner parser/writer. * giscanner/ast.py: add constructor list to Struct and Union. Add new param in Return's contructor to define transfer. * giscanner/girparser.py: several additions to the parser in order to have parsing all nodes of the gir xml files. * tools/g-ir-scanner (typelib_xml_strip, inject): use gir parser and writer in --inject and --typelib-xml options. * giscanner/xmlwriter.py: ignore empty attributes instead of raising an error as this basically exposes a bug in GIRParser. This should be reverted as soon as the parser is fixed. svn path=/trunk/; revision=665
* fix the last parameter of GLibEnumMember constructor as it should be theLucas Rocha2008-10-031-1/+1
| | | | | | | | | 2008-10-03 Lucas Rocha <lucasr@gnome.org> * giscanner/girwriter.py (_parser_member): fix the last parameter of GLibEnumMember constructor as it should be the enum member nick. svn path=/trunk/; revision=651
* Rework to use recursive XMLColin Walters2008-09-291-6/+14
| | | | svn path=/trunk/; revision=637
* Parse c:type for boxed records/unions; try resolving types using the GType ↵Colin Walters2008-09-131-2/+4
| | | | | | | | | | names. * giscanner/girparser.py: Parse c:type for boxed records/unions. * giscanner/glibast.py: Avoid overwriting ctype. * giscsanner/transformer.py: Try resolving types using the GType names. svn path=/trunk/; revision=594
* Allow both union and struct to be boxed or notColin Walters2008-09-061-9/+27
| | | | | | | | | | | | | | | | | | | | | | | | * girepository/girnode.c: Allow gtype_name and gtype_init in struct and union. * girepository/girparser.c: Parse glib: boxed bits for both structure and union. * girepository/gtypelib.c: Don't barf if structure is boxed. * giscanner/girparser.py: Parse new XML format. * giscanner/girwriter.py: Write out new XML format. * giscanner/glibast.py: Define new classes which are both Boxed and Struct/Union, as well as an "Other" for everything else. * giscanner/glibtransformer.py: Handle boxed types specially; we try to merge them with a struct/union if one exists, otherwise fall back to generic boxed. * tests/*: Update. * tools/generate.c: Write out new format. svn path=/trunk/; revision=575