summaryrefslogtreecommitdiff
path: root/giscanner/ast.py
Commit message (Collapse)AuthorAgeFilesLines
* scanner: Fix parsing for various typedef struct orderingsSimon Feltman2014-01-041-5/+11
| | | | | | | | | Add structs parsed from C's "tag namespace" into their own cache for lookup by typdef parsing. This fixes issues where a typedef declared after a struct would not have a correct name. This also cleans up the need for special casing struct tags prefixed with an underscore. https://bugzilla.gnome.org/show_bug.cgi?id=581525
* giscanner: Correctly consume field annotations on structsStef Walter2013-10-281-0/+12
| | | | | | | | A hidden exception was being thrown (which we now log), due to fields being treated as function parameters. Fixed to make field array annotations be transformed and written out to the gir correctly. https://bugzilla.gnome.org/show_bug.cgi?id=710561
* giscanner: make Annotated.attributes an OrderedDictDieter Verfaillie2013-10-081-1/+1
| | | | | | annotationparser.py already stores attributes in a mapping so it makes little sense using a list of tuples (suggesting multiple duplicate keys would be allowed) on the ast side.
* giscanner: fix description field storage in .gir filesDieter Verfaillie2013-10-081-1/+3
| | | | | | | | | | | | | | | | | | GTK-Doc description fields for tags can contain multiple lines and even multiple paragraphs. Whitespace cannot be preserved in XML attributes, so we move the "deprecated" description text into a "<doc-deprecated />" element right next to where we already have the "<doc />" element. Keep the "deprecated" attribute around for backwards compatibility though, but set its value to "1" (analogous to the "writable", "contruct", etc attributes) if the annotated symbol is marked as deprecated. While at it, add <doc-version /> and <doc-stability /> which was not yet available in the .gir files... This takes care of the "Since:", "Stability:" and "Deprecated:" GTK-Doc tags. Nothing needs to be done for the "Returns:" tag as as we already write a "<doc />" child element on "<return-value />".
* tests: Update misc/pep8.py to 1.4.5Dieter Verfaillie2013-05-071-41/+47
| | | | | | | | | | | | | | | | | Version in our tree is a wee bit outdated. For example, later work will introduce an utf8 encoded python source file which our old pep8.py does not yet understand (yeah, it really was *that* ancient)... Updated from: https://raw.github.com/jcrocholl/pep8/1.4.5/pep8.py Takes 552c1f1525e37a30376790151c1ba437776682c5, f941537d1c0a40f0906490ed160db6c79af572d3, 5a4afe2a77d0ff7d9fea13dd93c3304a6ca993de and a17f157e19bd6792c00321c8020dca5e5a281f45 into account... https://bugzilla.gnome.org/show_bug.cgi?id=699535
* giscanner: move odict.OrderedDict into a collections packageDieter Verfaillie2013-05-071-1/+1
| | | | | | because we'll add more related code to collections later on https://bugzilla.gnome.org/show_bug.cgi?id=699536
* giscanner: use SqlAlchemy's OrderedDict implementationDieter Verfaillie2013-04-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | g-ir-scanner can be a bit on the slow side. While true we now do a bit more work parsing GTK-Doc comment blocks and more is still to come, one of the biggest hotspots besides what's going on in _giscanner.SourceScanner() comes from the OrderedDict implementations we have been using. For example, time needed to build Gtk-3.0.gir on a relatively slow machine using "python2 -m cProfile -o $prefix/bin/g-ir-scanner ...": 1) Our original DictMixin sublass: 92,79867 seconds 2) Python's collections.OrderedDict class: 88,65786 seconds 3) Larosa/Foord implementation from http://www.voidspace.org.uk/python/odict.html : 71,64323 seconds 4) SqlAlchemy's implementation: 66,12449 seconds Looks like we have a clear winner with the SqlAclchemy implementation, which comes in at around 20 seconds without profiling on the same machine. Not bad. https://bugzilla.gnome.org/show_bug.cgi?id=697620
* scanner: internals cleanup: Move pkgconfig list to NamespaceColin Walters2013-02-261-0/+1
| | | | Continuation of previous work.
* scanner: internals cleanup: Move c_includes to NamespaceColin Walters2013-02-261-0/+1
| | | | Continuation of previous work.
* scanner: internals cleanup: Move shared libraries to NamespaceColin Walters2013-02-261-0/+1
| | | | Continuing on with previous commit.
* scanner: internals cleanup: Key more things off NamespaceColin Walters2013-02-261-0/+1
| | | | | | | | | | | The .gir format has a weird legacy where stuff like the includes are outside of the <namespace>. But conceptually they're tied together, so let's start reflecting this in the code. This way we can just pass around and look at a Namespace object instead of a 4-tuple of (namespace, includes, c_includes, pkg_config). https://bugzilla.gnome.org/show_bug.cgi?id=694593
* scanner: Also traverse GObject properties when walking namespaceColin Walters2013-02-261-0/+2
| | | | | | | This could be done manually by the caller, but it's better if we're consistent here, since we do traverse fields. https://bugzilla.gnome.org/show_bug.cgi?id=694593
* ast: Fix indentationJasper St. Pierre2013-02-151-1/+1
|
* ast: Fall back to the namespace for the parent of a NodeJasper St. Pierre2013-02-151-0/+11
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=693876
* ast: Rename Class.parent to parent_typeJasper St. Pierre2013-02-151-4/+4
| | | | | | | | | The eventual model I want to have is that .parent is the "container" of the node. In all the cases where we don't explicitly set the parent, this is the namespace, but having this under one field name would be a big cleanup for the docwriter. https://bugzilla.gnome.org/show_bug.cgi?id=693876
* ast: Allow more options in unresolved_typeJasper St. Pierre2013-02-111-0/+2
| | | | | | | If there's an unresolved type for an annotation, it's very likely it's using a target_giname. https://bugzilla.gnome.org/show_bug.cgi?id=693598
* scanner: remove backcompat copies more safelyTorsten Schönfeld2013-02-101-0/+1
| | | | | | | | Instead of modifying the namespace while we are iterating over it, which leads to nodes not being tested, set an 'internal_skipped' property on the function and read it in the GIR writer. https://bugzilla.gnome.org/show_bug.cgi?id=660698
* ast: Add a quick __repr__ to Field and MemberJasper St. Pierre2013-02-071-0/+5
| | | | | | Nothing too specific, just something to help with debugging. https://bugzilla.gnome.org/show_bug.cgi?id=693098
* ast: Allow lookup of the instance parameter by nameJasper St. Pierre2013-02-011-1/+1
| | | | | This will be used by the doctool to properly identify the instance parameter.
* ast: Add a new all_parameters property to CallableJasper St. Pierre2013-02-011-0/+8
| | | | | This will be used by the doctool to show the self parameter in C and Python docs.
* ast: Make sure to export c:type for signals and propertiesJasper St. Pierre2013-02-011-1/+2
|
* ast: Track enum/bitfield member parentsJasper St. Pierre2013-02-011-0/+5
| | | | | | | We need this for the doctool so that we can link to an enum definition when we reference one of the member values. https://bugzilla.gnome.org/show_bug.cgi?id=693040
* ast: Track enum members by symbolJasper St. Pierre2013-02-011-0/+3
| | | | | | | | | The doctool eventually wants to parse inline references to constant values like %GTK_TEXT_DIRECTION_LTR, so we need to have a way to look up the original symbol value for an enum member. https://bugzilla.gnome.org/show_bug.cgi?id=693040
* Ast: Add parent to FieldsGiovanni Campagna2012-10-281-0/+1
| | | | | | | Properties have it, there is no reason for Field not to, and in this way mallard docs can treat a field almost like a property. https://bugzilla.gnome.org/show_bug.cgi?id=683046
* Namespace: fix appending of nodesGiovanni Campagna2012-10-281-0/+19
| | | | | | | | Traverse appended nodes for methods, so that namespace.symbols contains all known symbols and not just global functions. Also, ensure that all relevant nodes are appended when parsing GIRs. https://bugzilla.gnome.org/show_bug.cgi?id=683046
* girparser: Track methods/constructors by symbolJasper St. Pierre2012-08-291-13/+21
| | | | | | | In order to be able to linkify a constructor/method, we need to first track it by symbol. https://bugzilla.gnome.org/show_bug.cgi?id=682969
* ast: Remove what looks to be a copy/paste errorJasper St. Pierre2012-08-291-2/+0
| | | | | | | | A symbol isn't a ctype. None of the tests failed when I removed this, git blame wasn't very enlightening, and we don't remove this in the remove method, so I'm thinking it's an error. https://bugzilla.gnome.org/show_bug.cgi?id=682969
* scanner: support stability tagEvan Nemerson2012-07-101-0/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=679160
* giscanner: Write detailed information in "type" tag's "c:type" attribute.Krzesimir Nowak2012-07-071-1/+3
| | | | | | | | That is - write also type qualifiers (const and volatile here). Update existing tests and add a new struct to regress.h having members with type qualifiers. https://bugzilla.gnome.org/show_bug.cgi?id=656445
* scanner: Remove propertiesJasper St. Pierre2012-06-281-40/+24
| | | | We don't need a basic getter for a private field - this isn't Java.
* scanner: Don't use an O(N) lookup when we already have a hashmapJasper St. Pierre2012-06-281-0/+1
| | | | This is a general code cleanup.
* Add the fixed width C99 types from stdint.hNeil Roberts2012-05-021-0/+9
| | | | | | | | | | | | | C99 has standard types for fixed width signed and unsigned integers. This adds types to giscanner to map them to the glib equivalent types. stdint.h also has other types to specify specify sizes with at least a certain number of bits, the fastest type with at least some number of bits, a type big enough to store a pointer and a type containing the most number of bits. These don't map well to glib types so I have ignored them. https://bugzilla.gnome.org/show_bug.cgi?id=674796
* scanner: Remove array fields from List.clone()Jesse van den Kieboom2012-03-151-5/+1
| | | | | | These were apparently copied by mistake. https://bugzilla.gnome.org/show_bug.cgi?id=667701
* Fix matching of methods named *_get_type()Matthew Booth2012-03-061-0/+21
| | | | | | | | | | | | | 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
* g-ir-doc-tool: More Mallard work, using experimantal api extensionShaun McCance2012-02-171-0/+2
|
* scanner: Remove duplicate declaration of ErrorQuarkFunctionJasper St. Pierre2012-01-061-7/+0
|
* Add constant value annotationJohan Dahlin2011-09-141-1/+2
| | | | | Add an annotation tag "Value:" which can be used on constants to override the value.
* Forbid GPtrArrays holding non-pointer typesGiovanni Campagna2011-08-181-0/+4
| | | | | | | | | 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-0/+10
| | | | | | | | | | | | | 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
* Merge remote-tracking branch 'origin/gir-docbook'Johan Dahlin2011-08-131-0/+7
|\ | | | | | | | | | | Conflicts: .gitignore tests/scanner/Regress-1.0-expected.gir
| * 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
* | Make sure signal works when there isn't one specifiedJohan 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
* | scanner: add a moved_to property to backcompat functionsTorsten Schönfeld2011-08-131-0/+1
| | | | | | | | | | | | | | 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-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | 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-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-111-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