summaryrefslogtreecommitdiff
path: root/giscanner/sourcescanner.py
Commit message (Collapse)AuthorAgeFilesLines
* Switch to nonrecursive make for core (i.e. not tests/)Colin Walters2010-11-091-3/+7
| | | | | This is cleaner and faster, and prepares us better for an incoming import of CMPH.
* scanner: fail if cpp failsVincent Untz2010-09-271-0/+5
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=630101
* [scanner] Support private/public directivesJohan Dahlin2010-09-201-0/+4
| | | | Fixes https://bugzilla.gnome.org/show_bug.cgi?id=594125
* [scanner] Add a Position classJohan Dahlin2010-09-201-1/+6
| | | | | | Add a position class which will make it easier to send filename/line/column information to the message class.
* Major rewriteColin Walters2010-08-311-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [scanner] Also parse C++ filesGustavo Noronha Silva2010-08-171-1/+2
| | | | | | | | This is to support cases such as WebKitGTK+, that have C API implemented in C++ files. Do note this does not mean we support proper C++ parsing. https://bugzilla.gnome.org/show_bug.cgi?id=627152
* [scanner] Make it compatible with python 2.yJohan Dahlin2010-07-221-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=618562
* Support introspectable=no attribute, add warnings frameworkColin Walters2010-06-171-0/+4
| | | | | | | | | | | | | | | | | | 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-4/+0
| | | | This reverts commit 074192b89c6afcdd7f062f03989972e44334b8bf.
* Support introspectable=no attribute, add warnings frameworkColin Walters2010-06-161-0/+4
| | | | | | | | | | | | | | | | 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.
* Bug 590883 - Use 'cc' instead of 'gcc' for preprocessingColin Walters2009-08-241-1/+1
| | | | | Don't hardcode gcc, any cc which handles those options is good enough; in particular this is reported to fix Sun Studio.
* Back out the previous change. Now go back to hardcoding compiler to gcc.Brian Cameron2009-08-051-1/+1
| | | | | | Using CC fails when building gobject-introspection because CC is defined to be $(SHELL) scripts/shave cc '$(SHAVE_SAVED_CC)'. A more sophisticated fix will be needed later.
* Check the CC environment variable instead of assuming to use the gcc compiler.Brian Cameron2009-08-051-1/+1
|
* Bug 555964 - Parse floating-point #definesColin Walters2009-02-251-1/+6
| | | | | | Previously we just supported int and string, add double to this. Technically we should probably differentiate between float and double, but it's not likely to be very useful in practice to do so.
* Bug 572790 - Don't register #defines from .c files as constantsColin Walters2009-02-241-0/+4
| | | | | We keep track of the source filename for every symbol. This enables us to later filter symbols based on that name.
* Bug 563591 – Flags not recognized when there is no introspection dataJohan Dahlin2009-01-121-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | 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-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* 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 558383 – builddir != srcdir build fails if giscanner python moduleJohan Dahlin2008-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | 2008-10-30 Johan Dahlin <jdahlin@async.com.br> Bug 558383 – builddir != srcdir build fails if giscanner python module not already installed * gir/Makefile.am: construct PYTHONPATH just once * tests/everything/Makefile.am: * tests/scanner/Makefile.am: add $(top_srcdir) to PYTHONPATH to handle builddir != srcdir * giscanner/libtoolimporter.py: * giscanner/sourcescanner.py: Make the libtoolimporter work when distchecking too. Mostly based on patch by Tommi Komulainen svn path=/trunk/; revision=833
* Clean up the libtool importer a bit. Add a context so we can use itJohan Dahlin2008-10-291-5/+6
| | | | | | | | | | | | | | 2008-10-29 Johan Dahlin <jdahlin@async.com.br> * giscanner/libtoolimporter.py: * giscanner/sourcescanner.py: Clean up the libtool importer a bit. Add a context so we can use it through a with statement. Don't just look in the current directory, look in the whole sys.path. svn path=/trunk/; revision=830
* Bug 556358 - don't use libtool internalsJohan Dahlin2008-10-211-0/+3
| | | | | | | | | | | | | | | 2008-10-21 Johan Dahlin <johan@gnome.org> Bug 556358 - don't use libtool internals * giscanner/Makefile.am: * giscanner/libtoolimporter.py: * giscanner/sourcescanner.py: * giscanner/utils.py: Add a python meta importer and remove a libtool symlink hack. svn path=/trunk/; revision=767
* ignore non-UTF-8 string constantsJohan Bilien2008-10-111-3/+7
| | | | | | | | | | | | | | | | | | | | | | 2008-10-11 Johan Bilien <jobi@litl.com> * giscanner/scannerparser.y: ignore non-UTF-8 string constants 2008-10-11 Johan Bilien <jobi@litl.com> Bug 552347: Parse #defines constants * girepository/gtypelib.c: update the list of value_size with recently defined type tags * giscanner/scannerparser.y: brought back parsing of #defined, as present in older version * giscanner/giscannermodule.c: bind gi_source_scanner_append_filename * giscanner/girwriter.py: write out constant tags in the gir * giscanner/sourcescanner.py: add accessor for const_string * giscanner/transformer.py, giscanner/glibtransformer.py: handle constant svn path=/trunk/; revision=673
* Merge branch 'bug552393-varargs'Colin Walters2008-10-021-1/+3
| | | | svn path=/trunk/; revision=643
* Add type_qualifier to SourceType.__members__Johan Dahlin2008-09-151-1/+2
| | | | svn path=/trunk/; revision=609
* Add a wrapper for type_qualifier as well.Johan Dahlin2008-09-151-0/+4
| | | | | | | | | | 2008-09-15 Johan Dahlin <johan@gnome.org> * giscanner/sourcescanner.py (SourceType.type_qualifier): Add a wrapper for type_qualifier as well. svn path=/trunk/; revision=608
* Parse GCC extensions in the parser instead of just undeffing them in theJohan Dahlin2008-08-311-5/+1
| | | | | | | | | | | | | | 2008-08-31 Johan Dahlin <johan@gnome.org> * giscanner/scannerlexer.l: * giscanner/scannerparser.y: * giscanner/sourcescanner.h: * giscanner/sourcescanner.py: Parse GCC extensions in the parser instead of just undeffing them in the pre-processor. svn path=/trunk/; revision=553
* Make g-ir-scanner work on Windows. Still problems with the typelib code.Tor Lillqvist2008-08-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2008-08-27 Tor Lillqvist <tml@novell.com> Make g-ir-scanner work on Windows. Still problems with the typelib code. Changes okayed by jdahlin. * configure.ac: Check for Windows, set Automake conditional OS_WIN32. Change backslashes to forward slashes in pyexecdir to avoid shell quoting issues * girepository/Makefile.am: Use -no-undefined so that libtool agrees to build a shared library on Windows. * girepository/girparser.c (backtrace_stderr): No backtrace() on Windows. Empty implementation on Windows so far. * girepository/gtypelib.c (g_typelib_check_sanity): Give more informative error message for the assertion failures. Tell also what the expected size of the struct is. Check all sizes first and fail afterwards if at least one size was different from expected. * tools/Makefile.am: Reorder libraries into proper logical dependency order. * tools/generate.c: Don't include <dlfcn.h>, not used. * giscanner/Makefile.am: On Windows, link with the Python library, and install the module DLL as _giscanner.pyd. Remove the unnecessary import library and libtool library that libtool has installed. * giscanner/scannerlexer.l: Recognize the gcc __attribute__ syntax and just skip it. Recognize also two "l" suffixes for long long constants. Recognize also __inline__. * giscanner/grealpath.h (g_realpath): Implement on Windows, using GetFullPathName(). As such, GetFullPathName() does more than the UNIX realpath(). It also changes relative paths into absolute paths. But for our purposes that shouldn't matter. * giscanner/giscannermodule.c (pygi_source_scanner_parse_file): On Windows the file descriptor passed to us is from Python. Python Python2.5 uses the msvcr71.dll C library, while mingw-built code uses msvcrt.dll. On Windows, file descriptors are specific to which C library is used. So we must find out what underlying OS handle corresponds to the file descriptor Python passes us, and then make that into a file descriptor valid for the C library this code uses. * giscanner/sourcescanner.py (_parse): Don't need to bypass __attribute__ as the lexer now handles it. The definition as empty was ineffective for mingw anyway, as mingw's _mingw.h undefines __attribute__. Close the temp file before unlinking it. * giscanner/cgobject.py: Use correct library name for the gobject DLL on Windows. * gir/Makefile.am: Must pass the full basename of the DLLs on Windows to g-ir-scanner. It's a bit ugly that we have to "know" that the names of the GLib DLLs are like libglib-2.0-0.dll, but in reality they won't change, until there is a GLib 3, and then also the Unix code here needs changing. Must pass CPPFLAGS to g-ir-scanner when building GLib.gir so that libintl.h is found. svn path=/trunk/; revision=503
* Avoid undeffing __GNUC__, instead define __attribute__ & friends. RemoveJohan Dahlin2008-08-261-19/+9
| | | | | | | | | | | | | | | 2008-08-26 Johan Dahlin <johan@gnome.org> * gir/Makefile.am: * giscanner/Makefile.am: * giscanner/cgobject.py: * giscanner/config.py.in: * giscanner/sourcescanner.py: Avoid undeffing __GNUC__, instead define __attribute__ & friends. Remove glibconfig.h hack. svn path=/trunk/; revision=496
* Check for ../gobject-introspection-1.0.pc.in to determine if we runJohan Dahlin2008-08-221-2/+4
| | | | | | | | | | | 2008-08-22 Johan Dahlin <johan@gnome.org> * giscanner/sourcescanner.py: Check for ../gobject-introspection-1.0.pc.in to determine if we run installed or uninstalled. svn path=/trunk/; revision=464
* Send in undefs/defines via writing it directly to stdin of cpp instead ofJohan Dahlin2008-08-221-12/+15
| | | | | | | | | | | | 2008-08-22 Johan Dahlin <johan@gnome.org> * gir/Makefile.am: * giscanner/sourcescanner.py: Send in undefs/defines via writing it directly to stdin of cpp instead of via arguments. svn path=/trunk/; revision=463
* Don't pase _LIBINTL_HJohan Dahlin2008-08-221-0/+3
| | | | svn path=/trunk/; revision=459
* Use the generated glibconfig.h for all scanner invokations. Rename it toJohan Dahlin2008-08-221-0/+11
| | | | | | | | | | | | | | | | 2008-08-22 Johan Dahlin <johan@gnome.org> * configure.ac: * gir/Makefile.am: * giscanner/Makefile.am: * giscanner/config.py.in: * giscanner/sourcescanner.py: Use the generated glibconfig.h for all scanner invokations. Rename it to glibconfig-scanner.h and install it. Add a config.py which so far contains the include dir. svn path=/trunk/; revision=456
* PEP8ifyJohan Dahlin2008-08-091-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add a new source type enum for member. Use __repr__ for improved debuggingJohan Dahlin2008-05-311-3/+19
| | | | | | | | | | | | | | | | | | | 2008-05-31 Johan Dahlin <jdahlin@async.com.br> * giscanner/scannerparser.y: * giscanner/sourcescanner.h: * giscanner/sourcescanner.py: Add a new source type enum for member. Use __repr__ for improved debugging * giscanner/girparser.py: Ignore some more * giscanner/transformer.py: Improve parsing of struct members. * tests/parser/foo-object.h: Add a new testcase svn path=/trunk/; revision=281
* Add ctype_name, a function to convert a CTYPE symbol to a stringJohan Dahlin2008-05-311-0/+14
| | | | | | | | | | 2008-05-31 Johan Dahlin <jdahlin@async.com.br> * giscanner/sourcescanner.py (ctype_name): Add ctype_name, a function to convert a CTYPE symbol to a string svn path=/trunk/; revision=275
* Revert back to using temporary files to send in headers. Allow FunctionsJohan Dahlin2008-05-241-23/+32
| | | | | | | | | | | | | | | | | | | 2008-05-24 Johan Dahlin <jdahlin@async.com.br> * giscanner/ast.py: * giscanner/girwriter.py: * giscanner/giscannermodule.c (pygi_source_scanner_append_filename), (pygi_source_scanner_parse_file): * giscanner/glibtransformer.py: * giscanner/sourcescanner.py: Revert back to using temporary files to send in headers. Allow Functions to be passed in as callbacks, add a couple of try/excepts missing features. We can now scan pango svn path=/trunk/; revision=274
* Move sourcescanner symbols to the sourcescanner module, instead of in theJohan Dahlin2008-05-051-0/+54
| | | | | | | | | | | | | 2008-05-05 Johan Dahlin <johan@gnome.org> * giscanner/__init__.py: * giscanner/sourcescanner.py: * giscanner/transformer.py: Move sourcescanner symbols to the sourcescanner module, instead of in the global __init__ namespace. svn path=/trunk/; revision=266
* Avoid recursion when scanning girepository.hJohan Dahlin2008-04-281-0/+1
| | | | | | | | | | | | | 2008-04-28 Johan Dahlin <johan@gnome.org> * giscanner/transformer.py (Transformer._traverse_one): Avoid recursion when scanning girepository.h * giscanner/sourcescanner.py (SourceScanner._preprocess): Define a __GI_SCANNER__ when we run. svn path=/trunk/; revision=254
* Line wrap license headerJohan Dahlin2008-04-281-1/+2
| | | | svn path=/trunk/; revision=247
* Add LGPLv2 license header and install all python filesJohan Dahlin2008-04-261-2/+21
| | | | | | | | | | | | | | | | | | | | | | 2008-04-25 Johan Dahlin <jdahlin@async.com.br> * giscanner/Makefile.am: * giscanner/__init__.py: * giscanner/cgobject.py: * giscanner/gidlparser.py: * giscanner/gidlwriter.py: * giscanner/girwriter.py: * giscanner/gobjecttreebuilder.py: * giscanner/odict.py: * giscanner/sourcescanner.py: * giscanner/treebuilder.py: * giscanner/xmlwriter.py: * tools/Makefile.am: * tools/g-ir-scanner: Add LGPLv2 license header and install all python files svn path=/trunk/; revision=227
* Add support for virtual methods. Pair struct FooClass with struct Foo.Johan Dahlin2008-04-251-6/+36
| | | | | | | | | | | | | | | | | | | | | | | | 2008-04-25 Johan Dahlin <jdahlin@async.com.br> * TODO: * giscanner/gidlwriter.py: * giscanner/giscannermodule.c (pygi_source_directive_new), (directive_get_options), (pygi_source_symbol_new), (symbol_get_base_type), (pygi_source_type_new), (type_get_base_type), (type_get_child_list), (pygi_source_scanner_get_symbols), (pygi_source_scanner_get_directives): * giscanner/gobjecttreebuilder.py: * giscanner/sourcescanner.py: * giscanner/treebuilder.py: * tests/parser/foo-object.h: Add support for virtual methods. Pair struct FooClass with struct Foo. Clean up the SourceScanner bindings a bit. Add a testcase for virtual methods. svn path=/trunk/; revision=226
* Add support for source/header annotations.Johan Dahlin2008-04-251-8/+39
| | | | | | | | | | | | | | | | | | | | | | 2008-04-24 Johan Dahlin <jdahlin@async.com.br> * giscanner/gidlwriter.py: * giscanner/girwriter.py: * giscanner/giscannermodule.c (directive_get_name), (directive_get_value), (directive_get_options), (symbol_get_directives), (symbol_set_directives), (pygi_source_scanner_parse_file), (pygi_source_scanner_lex_filename), (pygi_source_scanner_get_directives), (init_giscanner): * giscanner/sourcescanner.c (gi_source_scanner_get_directives): * giscanner/sourcescanner.h: * giscanner/sourcescanner.py: * giscanner/treebuilder.py: * tools/g-ir-scanner: Add support for source/header annotations. svn path=/trunk/; revision=224
* avoid sending the same options multiple times to cppJohan Dahlin2008-04-221-1/+3
| | | | svn path=/trunk/; revision=208
* split tree building and source scanning interface to separate files.Johan Dahlin2008-04-181-0/+72
2008-04-18 Johan Dahlin <johan@gnome.org> * giscanner/sourcescanner.py: * giscanner/treebuilder.py: * tools/g-ir-scanner: split tree building and source scanning interface to separate files. svn path=/trunk/; revision=174