summaryrefslogtreecommitdiff
path: root/giscanner/transformer.py
Commit message (Collapse)AuthorAgeFilesLines
* scanner: Add --identifier-filter-cmdSimon Feltman2014-06-031-1/+14
| | | | | | | | | Add the command line flag --identifier-filter-cmd to g-ir-scanner which allows running identifier names through a filtering shell command. The identifier is sent as stdin to the filter command and expects a filtered result written to stdout. https://bugzilla.gnome.org/show_bug.cgi?706898
* scanner: Replace GInitiallyUnowned field sharing with generic solutionSimon Feltman2014-01-041-6/+7
| | | | | | | | | | | | Remove GInitiallyUnowned special case in gdumpparser where fields are copied from GObject. Add generic solution where anytime we have multiple typedef structs, the fields become shared: typedef struct _Foo Foo; typedef struct _Foo Bar; struct _Foo {...}; https://bugzilla.gnome.org/show_bug.cgi?id=581525
* scanner: Cleanup exception handling in the transformerSimon Feltman2014-01-041-42/+15
| | | | | | | | | Move exception handling of various symbol/identifier stripping into the outer level parse function. This removes a lot of embedded try excepts peppered throughout the code by letting exceptions flow to the top level where they can be handled just as gracefully. https://bugzilla.gnome.org/show_bug.cgi?id=581525
* scanner: Remove typedef namespace cacheSimon Feltman2014-01-041-20/+0
| | | | | | | | | Remove the caching of typedefs in Transformer._typedef_ns. This is no longer used due to the added _tag_ns cache which store tags rather than typedefs. Remove adding of callback typdefs to the typedef_ns since these were not being used anyhow. https://bugzilla.gnome.org/show_bug.cgi?id=581525
* scanner: Use tag namespace for parsing unionsSimon Feltman2014-01-041-74/+30
| | | | | | | Generalize _create_tag_ns_struct for both structs and unions. Remove _create_compound newer struct parsing code has completely replaced it. https://bugzilla.gnome.org/show_bug.cgi?id=581525
* scanner: Add simplified parsing for nested structsSimon Feltman2014-01-041-4/+7
| | | | | | | | Add _create_member_struct for the parsing of nested structs. This is precursory work to remove the member/anonymous flag from other struct/union creation code and allow simplification of those code paths. https://bugzilla.gnome.org/show_bug.cgi?id=581525
* scanner: Fix parsing for various typedef struct orderingsSimon Feltman2014-01-041-5/+95
| | | | | | | | | 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
* scanner: Support boolean constantsFlorian Müllner2013-11-291-0/+3
| | | | | | | | Aliasing TRUE or FALSE is not very common, but done occasionally for extra clarity. Namely G_SOURCE_REMOVE / G_SOURCE_CONTINUE are self-explanatory, unlike the "raw" booleans. https://bugzilla.gnome.org/show_bug.cgi?id=719566
* giscanner: don't generate synthetic names for '...' parameterDieter Verfaillie2013-10-081-8/+8
| | | | tests/warn/unkown-parameter.h:41 still passes with this...
* giscanner: remove dead codeDieter Verfaillie2013-10-081-37/+0
| | | | | Last call sites where removed in 36aa515f1036978ced8d4ffb808260844f7229e0 about 3 years ago.
* tests: Update misc/pep8.py to 1.4.6Dieter Verfaillie2013-10-081-2/+1
| | | | | Updated from: https://raw.github.com/jcrocholl/pep8/1.4.6/pep8.py
* tests: Update misc/pep8.py to 1.4.5Dieter Verfaillie2013-05-071-25/+20
| | | | | | | | | | | | | | | | | 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
* transformer: Remove annotationsJasper St. Pierre2013-05-071-4/+0
| | | | | | | The transformer doesn't need the annotations, so why are we giving it to it? https://bugzilla.gnome.org/show_bug.cgi?id=699854
* giscanner: prefer "except X as e" over "except X, e"Dieter Verfaillie2013-04-091-12/+12
| | | | | | It's more readable and as an added bonus Python 3 compatible. https://bugzilla.gnome.org/show_bug.cgi?id=697616
* scanner: Don't re-parse includes we already foundColin Walters2013-02-271-2/+3
| | | | | | | This fixes the Pango build where it has a chain of two --include-uninstalled. https://bugzilla.gnome.org/show_bug.cgi?id=694593
* scanner: internals cleanup: Move pkgconfig list to NamespaceColin Walters2013-02-261-1/+1
| | | | Continuation of previous work.
* scanner: internals cleanup: Key more things off NamespaceColin Walters2013-02-261-17/+14
| | | | | | | | | | | 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: Synthesize argument names if we don't see oneColin Walters2013-02-261-6/+10
| | | | | | | While this is a bit lame, we need to do something. We preserve the warning message. https://bugzilla.gnome.org/show_bug.cgi?id=694593
* scanner: Fix use of undeclared variable in previous commitColin Walters2013-02-071-1/+1
| | | | Fixes the NetworkManager build.
* transformer: Ensure that types aren't resolved if we can't find themJasper St. Pierre2013-02-071-4/+26
| | | | | | | | This ensures that things can't try to reference undefined/invalid types without emitting warnings, and that users need to include other GIRs at build time if they want to reference another type. https://bugzilla.gnome.org/show_bug.cgi?id=693098
* transformer: Warn on unnamed params in declarationsJasper St. Pierre2013-02-071-5/+9
| | | | | | | These params are unannotatable and undocumentable. They really should not be allowed. https://bugzilla.gnome.org/show_bug.cgi?id=693098
* giscanner: Apply standard annotations to constant valuesJasper St. Pierre2013-02-011-4/+1
| | | | | | | | | | While there's no particular reason I need to do this, there really isn't any reason to not do this, and it helps with doctool or whatever in the future if we want to document when a constant showed up. g-ir-compiler also keeps track of constant deprecations, so this fixes constants not ever being deprecated. https://bugzilla.gnome.org/show_bug.cgi?id=693040
* giscanner: remove unused variablesDieter Verfaillie2012-11-281-2/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=688897
* scanner: Ignore #defines starting with _Colin Walters2012-10-271-0/+3
| | | | | | | | | This matches our behavior for symbols (and we should probably fix this more globally...I think we still scan _-prefixed enums). Noticed from gudev which had #define _GUDEV_INSIDE_H 1 https://bugzilla.gnome.org/show_bug.cgi?id=674072
* giscanner: Don't prefer identifier prefixes over namespaces in depsStef Walter2012-10-231-1/+2
| | | | | Use namespaces in dependencies before falling back to the deprecated --identifier-prefix prefixes.
* scanner: Deprecate using identifier prefixes in GINamesColin Walters2012-10-231-3/+7
| | | | | | | | Instead of crashing. For more details, see the attached bug. Based on a patch by Stef Walter <stefw@gnome.org>. https://bugzilla.gnome.org/show_bug.cgi?id=684370
* scanner: handle unsigned properly for type of defined sizeAlban Browaeys2012-08-031-1/+17
|
* giscanner: special case G_GINT64_CONSTANT and G_GUINT64_CONSTANT + miscAlban Browaeys2012-08-031-1/+4
| | | | | | | | | This let the macro expands to its value as gint64/guint64. Also - fix lexer identifier/typdef detection for macro and misc - do not discard cast
* scanner: Ensure "complete_ctype" patch doesn't throw an exception for ↵Colin Walters2012-07-081-0/+2
| | | | | | | | anonymous unions The previous patch introduced a regression where we would crash on encountering an anonymous union. Work around this by just writing out 'gpointer' in this case, and add a regression test.
* giscanner: Write detailed information in "type" tag's "c:type" attribute.Krzesimir Nowak2012-07-071-15/+69
| | | | | | | | 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: Turn dead code into assertionColin Walters2012-07-061-2/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=656445
* scanner: Don't use an O(N) lookup when we already have a hashmapJasper St. Pierre2012-06-281-7/+4
| | | | This is a general code cleanup.
* Add constant value annotationJohan Dahlin2011-09-141-1/+2
| | | | | Add an annotation tag "Value:" which can be used on constants to override the value.
* scanner: correctly handle structs with arrays of anon unionsTorsten Schönfeld2011-09-111-11/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This applies mainly to GValue, which is defined as: struct _GValue { /*< private >*/ GType g_type; /* public for GTypeValueTable methods */ union { gint v_int; guint v_uint; glong v_long; gulong v_ulong; gint64 v_int64; guint64 v_uint64; gfloat v_float; gdouble v_double; gpointer v_pointer; } data[2]; }; Previously, the scanner did not understand the array of unions. This resulted in g_struct_info_get_size returning an incorrect size for GValue (at least on 32bit systems). Fix this by making up a separate union declaration for the GIR that can be referenced by the array. https://bugzilla.gnome.org/show_bug.cgi?id=657040
* Windows port: Do not append '/usr/share' to _xdg_data_dirs...Dieter Verfaillie2011-09-071-2/+6
| | | | | | | ... on Windows as it points to the MinGW installation directory, which doesn't have any .gir files to start with anyway. https://bugzilla.gnome.org/show_bug.cgi?id=620566
* giscanner: Allow passing additional include dirs when parsing a girTomeu Vizoso2011-08-151-1/+3
|
* Use a classmethod and s/Transformer/cls/ + s/transformer/self/Johan Dahlin2011-08-111-9/+9
|
* [docbook] Add "Details" title above all methods.Laszlo Pandy2011-08-111-0/+1
|
* [docbook] Make DocBookWriter use TransformerLaszlo Pandy2011-08-111-0/+9
|
* Make the Transformer respect 'skip' annotationsStef Walter2011-08-101-1/+8
| | | | | | * In order to suppress unnecessary warnings on macros which are skipped at later passes of the scanning, we use the annotations to skip AST stuff being created for symbols that are skipped.
* Kill off config.pyColin Walters2011-07-271-3/+2
| | | | | Generating Python source code is problematic for srcdir != builddir; steal a the trick of putting global data in __builtins__ from jhbuild.
* Make caller-allocates detection work for struct aliasesPavel Holejsovsky2011-01-131-7/+10
| | | | | | | | | | | | 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
* Add proper unicode support to the source scannerJohan Dahlin2010-12-021-1/+1
| | | | | | The assumption is that the only allowed source encoding is utf-8. Always strings as unicode and fix up the transformer and xml writer to properly output utf-8.
* Fix --include-uninstalledColin Walters2010-09-281-3/+3
| | | | | Somehow, this regressed; i have no idea how. We need to be comparing Include objects, not string versus Include.
* [scanner] Make sure private enums are filteredJohan Dahlin2010-09-261-2/+2
| | | | This is a follow-up to 60a8c75 which wasn't properly fixed.
* [scanner] Mark enum members as private in transformerJohan Dahlin2010-09-261-1/+1
| | | | | | | Remove enum members which follows /* <private> */ comments inside the transformer instead of the sourcescanner itself. Fixes a crash when creating the gir for GstBase.
* Revert "[transformer] Ignore hidden symbols"Johan Dahlin2010-09-211-2/+3
| | | | This reverts commit ad4934ca1d44285ab46d6e419d1788b886e48d82.
* [transformer] Ignore hidden symbolsJohan Dahlin2010-09-201-3/+2
| | | | Do not warn about hidden symbols.
* [scanner] Support private/public directivesJohan Dahlin2010-09-201-1/+8
| | | | Fixes https://bugzilla.gnome.org/show_bug.cgi?id=594125
* [scanner] Only store types in cache storeJohan Dahlin2010-09-201-3/+13
| | | | | | | | | | | | 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.