summaryrefslogtreecommitdiff
path: root/giscanner/glibast.py
AgeCommit message (Collapse)AuthorFilesLines
2010-08-31Major rewriteColin Walters1-38/+53
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-44/+6
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/+5
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
2009-06-22Bug 584423 – Add short/ushort supportMark Lee1-6/+6
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>
2009-02-25Bug 572434 - Associate interfaces with their C structuresColin Walters1-1/+17
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.
2009-01-22Bug 562622 – Errordomains missingJohan Dahlin1-0/+1
2009-01-21 Johan Dahlin <jdahlin@async.com.br> Bug 562622 – Errordomains missing * giscanner/girwriter.py: * giscanner/glibast.py: * giscanner/glibtransformer.py: * tests/scanner/Makefile.am: * tests/scanner/foo-1.0-expected.gir: * tests/scanner/foo-1.0-expected.tgir: * tests/scanner/foo.c (foo_error_get_type), (foo_error_quark): * tests/scanner/foo.h: svn path=/trunk/; revision=1057
2009-01-20Bug 562615 – Struct methods missingJohan Dahlin1-2/+2
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
2009-01-13Bug 555036 – put gtk-doc in GIRJohan Dahlin1-1/+2
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
2009-01-12Bug 563591 – Flags not recognized when there is no introspection dataJohan Dahlin1-8/+15
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
2008-11-04Relicense the giscanner library under LGPLv2+. This has been approved byJohan Dahlin1-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
2008-10-20Also register g variants of default_array_types.Colin Walters1-1/+7
svn path=/trunk/; revision=758
2008-10-20Bug 557011 - Add g_object_info_get_abstractColin Walters1-2/+3
svn path=/trunk/; revision=757
2008-09-25Remove non-repository types from GIRColin Walters1-0/+1
* giscanner/ast.py: The canonical name is 'utf8', not 'string'. * giscanner/glibast.py: A few more glib type mappings. * girepository/girparser.c: We only parse repository types. * tests/*.gir: Update. svn path=/trunk/; revision=628
2008-09-25Bug 552564: Map guchar to uint8Colin Walters1-0/+1
svn path=/trunk/; revision=627
2008-09-13Parse c:type for boxed records/unions; try resolving types using the GType ↵Colin Walters1-6/+5
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
2008-09-06Allow both union and struct to be boxed or notColin Walters1-5/+25
* 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
2008-08-20Add gshort/gushort typesJohan Dahlin1-0/+2
2008-08-20 Johan Dahlin <johan@gnome.org> * giscanner/glibast.py: Add gshort/gushort types svn path=/trunk/; revision=424
2008-08-19Type checking reworkColin Walters1-11/+14
svn path=/trunk/; revision=400
2008-08-18Redo type resolving and validation. Add a couple of new tests. PatchJohan Dahlin1-3/+6
2008-08-18 Johan Dahlin <johan@gnome.org> * giscanner/ast.py: * giscanner/girparser.py: * giscanner/girwriter.py: * giscanner/glibast.py: * giscanner/glibtransformer.py: * giscanner/transformer.py: * tests/scanner/Foo-expected.gir: * tests/scanner/foo-object.h: * tests/scanner/utility-expected.gir: * tests/scanner/utility.h: Redo type resolving and validation. Add a couple of new tests. Patch mostly written by Colin. svn path=/trunk/; revision=398
2008-08-14Define an internal _H_ variable so we skip parsing both i18n headers, onlyJohan Dahlin1-0/+1
2008-08-14 Johan Dahlin <johan@gnome.org> * gir/Makefile.am: Define an internal _H_ variable so we skip parsing both i18n headers, only one is needed. * gir/glib-2.0.gir: Add the glib-2.0.gir too. * giscanner/glibast.py: Add gconstpointer as an alias for ANY * giscanner/transformer.py: Do not lower case enumeration names per se. Skip functions which has parameters called 'va_list' svn path=/trunk/; revision=374
2008-08-14Add pyflakes.py and run it in make check. Update the source code to fixJohan Dahlin1-3/+2
2008-08-14 Johan Dahlin <johan@gnome.org> * giscanner/girwriter.py: * giscanner/glibast.py: * giscanner/glibtransformer.py: * giscanner/transformer.py: * misc/pyflakes.py: * tests/Makefile.am: Add pyflakes.py and run it in make check. Update the source code to fix the errors reported by pyflakes. svn path=/trunk/; revision=370
2008-08-14Refactor the parser a bit. Add parent type to interfaces and updateJohan Dahlin1-2/+2
2008-08-14 Johan Dahlin <johan@gnome.org> * giscanner/ast.py: * giscanner/girparser.py: * giscanner/glibast.py: * giscanner/glibtransformer.py: Refactor the parser a bit. Add parent type to interfaces and update callsites. svn path=/trunk/; revision=369
2008-08-09PEP8ifyJohan Dahlin1-0/+8
2008-08-09 Johan Dahlin <johan@gnome.org> * giscanner/__init__.py: * giscanner/ast.py: * giscanner/cgobject.py: * giscanner/gidlparser.py: * giscanner/gidlwriter.py: * giscanner/girparser.py: * giscanner/girwriter.py: * giscanner/glibast.py: * giscanner/glibtransformer.py: * giscanner/odict.py: * giscanner/sourcescanner.py: * giscanner/transformer.py: * giscanner/utils.py: * giscanner/xmlwriter.py: * tools/g-ir-scanner: PEP8ify svn path=/trunk/; revision=341
2008-08-08type -> ntypeJohan Dahlin1-1/+1
2008-08-08 Johan Dahlin <johan@gnome.org> * giscanner/girwriter.py: type -> ntype * giscanner/glibast.py: * giscanner/glibtransformer.py: Swap order of members, to keep it consistent with base enum class svn path=/trunk/; revision=326
2008-07-08Fix typoJürg Billeter1-1/+1
2008-07-08 Jürg Billeter <j@bitron.ch> * giscanner/glibast.py: Fix typo svn path=/trunk/; revision=295
2008-06-20Start using abstract type instead of the raw C types. Register a bunch ofJohan Dahlin1-1/+26
2008-06-19 Johan Dahlin <jdahlin@async.com.br> * giscanner/ast.py: * giscanner/girwriter.py: * giscanner/glibast.py: * giscanner/glibtransformer.py: * giscanner/transformer.py: * tests/parser/Foo-expected.gir: Start using abstract type instead of the raw C types. Register a bunch of glib types we care about. svn path=/trunk/; revision=290
2008-06-03Improve enum member parsing and introspectionJohan Dahlin1-2/+2
2008-06-03 Johan Dahlin <jdahlin@async.com.br> * giscanner/Makefile.am: * giscanner/ast.py: * giscanner/girwriter.py: * giscanner/glibast.py: * giscanner/glibtransformer.py: * giscanner/transformer.py: * giscanner/utils.py: * tests/parser/Foo-expected.gir: Improve enum member parsing and introspection svn path=/trunk/; revision=283
2008-05-09Clean up and refactor enum namespacingJohan Dahlin1-1/+1
svn path=/trunk/; revision=273
2008-04-28Add a --strip-prefix and sort out confusion between names and symbols forJohan Dahlin1-1/+2
2008-04-28 Johan Dahlin <jdahlin@async.com.br> * giscanner/ast.py: * giscanner/glibast.py: * giscanner/glibtransformer.py: * giscanner/transformer.py: * tools/g-ir-scanner: Add a --strip-prefix and sort out confusion between names and symbols for functions and struct + derivaties. Refactor bootstrap of g-ir-scanner, so we can set options on Transformer() before parsing everything. svn path=/trunk/; revision=255
2008-04-28Rename most c:identifier to c:type. Add new ones toJohan Dahlin1-0/+4
2008-04-28 Johan Dahlin <jdahlin@async.com.br> * giscanner/ast.py: * giscanner/girwriter.py: * giscanner/glibast.py: * giscanner/glibtransformer.py: * tests/parser/Foo-expected.gir: * tests/parser/utility-expected.gir: Rename most c:identifier to c:type. Add new ones to class/interface/enum/boxed. svn path=/trunk/; revision=252
2008-04-28Line wrap license headerJohan Dahlin1-1/+2
svn path=/trunk/; revision=247
2008-04-26Split out nodes to ast.py and glibast.pyJohan Dahlin1-0/+79
2008-04-25 Johan Dahlin <johan@gnome.org> * giscanner/Makefile.am: * giscanner/ast.py: * giscanner/gidlparser.py: * giscanner/gidlwriter.py: * giscanner/girwriter.py: * giscanner/glibast.py: * giscanner/glibtransformer.py: * giscanner/transformer.py: Split out nodes to ast.py and glibast.py svn path=/trunk/; revision=229