summaryrefslogtreecommitdiff
path: root/giscanner/sourcescanner.h
Commit message (Collapse)AuthorAgeFilesLines
* scanner: parse and expose function macrosMathieu Duponchelle2019-07-191-0/+1
| | | | | This is useful for documentation tools, and other utilities that rely on full introspection of the C API of a given library.
* Replace linked lists with arrays in source scannerTomasz Miąsko2018-12-091-6/+6
| | | | Reduce total number of memory allocations and increase data locality.
* sourcescanner: collect error messages and expose themChristoph Reiter2018-12-081-0/+2
| | | | | | | | | | | It just printed errors to stderr and always returns success even if parsing fails. This prevents us to write any tests for it. As a first step collect all lexing/parsing error messages and print them to stderr after the scanner is done. This allows us to add some regression tests for !78. In the future we probably want to raise an exception with those errors if parsing fails.
* gi_source_scanner_parse_file: use a filename instead of a FILE structChristoph Reiter2018-12-061-1/+1
| | | | | | This allows us to get rid of the msvc hacks which are needed in case Python is built with a different msvc than g-i. By passing a filename the FILE struct never passes over library boundaries.
* Reuse const_table between calls to SourceScanner parse_files and parse_macros.Tomasz Miąsko2018-02-131-0/+1
| | | | | | | | Macro constants may now refer to constants defined in source files. Test case provided by Philip Chimento. Fixes issues #173 and #75.
* giscanner: Recognize _Thread_local as a storage class specifierTing-Wei Lan2018-01-091-1/+2
| | | | | | | | | _Thread_local is a C11 keyword, and thread_local is a macro to make it more confortable to read. As this keyword can only be used in variable declarations, not in function return values or parameters, it cannot be included in bindable APIs and we can safely ignore it. https://bugzilla.gnome.org/show_bug.cgi?id=756921
* scanner: Support boolean constantsFlorian Müllner2013-11-291-0/+2
| | | | | | | | 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
* sourcescanner: Removed unused struct_or_union_or_enum_table fieldStef Walter2013-10-211-1/+0
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=710560
* giscanner: Respect __GI_SCANNER__ when scanning for macrosStef Walter2013-10-211-0/+4
| | | | | | | | | When scanning for macros respect ifdefs of __GI_SCANNER__ in the various header files. Only #ifdef and #ifndef are supported. If __GI_SCANNER__ appears in plain #if statements, a warning is printed. https://bugzilla.gnome.org/show_bug.cgi?id=698367
* giscanner: speed up SourceScanner().parse_files()Dieter Verfaillie2013-10-171-3/+4
| | | | | | | | | | | | | | | | | | | Was looking around a bit and noticed about 2/3 of g-ir-scanner time is spent in SourceScanner().parse_files(). Some profiling quickly shows most of that 2/3 is used by gi_source_scanner_add_symbol() where it creates a whole bunch of GFile instances just to compare paths and throw them away again. With this a scanner instance now maintains a hash table of GFile instances instead of a list of file names, so comparing those paths can be reduced to a fast g_hash_table_contains() call. This makes "g-ir-scanner <whole_bunch_of_options> --output Gtk-3.0.gir" complete in about 10 seconds on my box instead of about 30 seconds (both best of 3 runs). https://bugzilla.gnome.org/show_bug.cgi?id=710320
* sourcescanner: Fix symbolic references in enum membersJasper St. Pierre2013-02-161-0/+1
| | | | | | | We need to copy the source symbols, otherwise we'll overwrite their values. This isn't good. https://bugzilla.gnome.org/show_bug.cgi?id=693939
* sourcescanner: Remove unused "id" fieldJasper St. Pierre2013-02-161-1/+0
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=693939
* scanner: Correctly handle large 64 bit integer constantsColin Walters2012-10-301-0/+1
| | | | | | | | | | | | | | | | In C, positive integer constants are by default unsigned. This means an expression like 0x8000000000000000 will be "unsigned long long". In the actual scanner code, we were parsing them as "gint64", and storing them as gint64. This was incorrect; we need to parse them as guint64, and store the bits we get from that. This gives us an equivalent result to what the C compiler does. However, when we actually return the value as a Python "long" (arbitrary length integer), we need to treat the value as unsigned if the result indicated it was. https://bugzilla.gnome.org/show_bug.cgi?id=685022
* Fix symbols being reported in invalid filesStef Walter2011-08-101-1/+1
| | | | | | | | | | | * Due to the way that flex/bison works, the symbols were being added to the scanner after additional lines are parsed. * If these lines are #line directives, then scanner->current_filename can change between when the symbol is parsed and when it's added. * Change so that symbol gets filename when parsing rather than when being added to the scanner. https://bugzilla.gnome.org/show_bug.cgi?id=650200
* Support glib-mkenums comment /*< flags >*/Andreas Rottmann2010-12-071-0/+1
| | | | | | | | | | | | | | | - Modify the lexer to consider all "trigraph" comments specially, and parse them for "flags" as well as "private" and "public" (which were previously hardcoded). This change allows for future support of multiple annotations inside a single trigraph comment. - Change the parser to consider the additional field "flags" set by the lexer when constructing enums. - Add a test case for the "flags" trigraph comment to the scanner annotation tests. See <https://bugzilla.gnome.org/show_bug.cgi?id=631530>.
* Handle enumerations with the full range of signed and unsigned valuesOwen W. Taylor2010-11-011-1/+1
| | | | | | | | | | | | | The C compiler will pick an enumeration type that accomodates the specified values for the enumeration, so ignoring 64-bit enumerations, we can have enumeration values from MININT32 to MAXUINT32. To handle this properly: - Use gint64 for holding eumeration values when scanning - Add a 'unsigned_value' bit to ValueBlob so we can distinguish the int32 vs. uint32 cases in the typelib - Change the return value of g_value_info_get_value() to gint64. https://bugzilla.gnome.org/show_bug.cgi?id=629704
* [scanner] Support private/public directivesJohan Dahlin2010-09-201-0/+2
| | | | Fixes https://bugzilla.gnome.org/show_bug.cgi?id=594125
* Save the line number of a source commentJohan Dahlin2010-09-191-1/+9
|
* [sourcescanner] Support for line numbers on SymbolAlan Knowles2010-05-251-1/+2
| | | | | Add line numbers to symbols, which can be useful in later stages of the scanner.
* Bug 555964 - Parse floating-point #definesColin Walters2009-02-251-0/+2
| | | | | | 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/+1
| | | | | We keep track of the source filename for every symbol. This enables us to later filter symbols based on that name.
* Fix warnings pointed out by GCCJohan Dahlin2009-02-201-0/+2
|
* Bug 563591 – Flags not recognized when there is no introspection dataJohan Dahlin2009-01-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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-17/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Relicense the giscanner library under LGPLv2+. This has been approved byJohan Dahlin2008-11-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 557786 - support fixed size arraysColin Walters2008-10-251-2/+1
| | | | svn path=/trunk/; revision=814
* Bug 556543 – reduce compiler warningsTommi Komulainen2008-10-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2008-10-16 Tommi Komulainen <tommi.komulainen@iki.fi> Bug 556543 – reduce compiler warnings * girepository/ginfo.c: * girepository/girepository.c (register_internal, count_interfaces, find_interface, find_namespace_version, parse_version, g_irepository_require): * girepository/girmodule.c (g_ir_module_build_typelib): * girepository/girnode.c (init_stats, dump_stats, _g_irnode_init_stats, _g_irnode_dump_stats, g_ir_node_can_have_member): * girepository/girparser.c (firstpass_end_element_handler, locate_gir, parse_basic, parse_type_internal, resolve_aliases, start_alias, start_type, end_type_top, parse_include, cleanup, post_filter): * girepository/gtypelib.c (validate_function_blob, validate_enum_blob): * giscanner/giscannermodule.c (directive_get_options, type_get_child_list): * giscanner/scannerlexer.l (parse_gtkdoc): * giscanner/scannerparser.y (ctype_free): * giscanner/sourcescanner.c: * giscanner/sourcescanner.h (gi_source_scanner_parse_macros): * tests/types/gitesttypes.c: * tools/compiler.c (main): * tools/generate.c (write_repository): Remove unused variables and code, add missing includes, declarations and case statements. svn path=/trunk/; revision=730
* Merge branch 'bug552393-varargs'Colin Walters2008-10-021-0/+1
| | | | svn path=/trunk/; revision=643
* Parse GCC extensions in the parser instead of just undeffing them in theJohan Dahlin2008-08-311-1/+2
| | | | | | | | | | | | | | 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
* Add a new source type enum for member. Use __repr__ for improved debuggingJohan Dahlin2008-05-311-1/+2
| | | | | | | | | | | | | | | | | | | 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 support for source/header annotations.Johan Dahlin2008-04-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | 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
* Add constants and wrap a few more SymbolType fieldsJohan Dahlin2008-03-251-1/+1
| | | | | | | | | | | | | 2008-03-25 Johan Dahlin <johan@gnome.org> * giscanner/__init__.py: * giscanner/giscannermodule.c: * giscanner/sourcescanner.c: * giscanner/sourcescanner.h: Add constants and wrap a few more SymbolType fields svn path=/trunk/; revision=166
* Move the scanner to a separate library.Johan Dahlin2008-03-251-0/+179
2008-03-25 Johan Dahlin <johan@gnome.org> * Makefile.am: * configure.ac: * giscanner/Makefile.am: * giscanner/sourcescanner.c: * giscanner/sourcescanner.h: * tools/Makefile.am: * tools/grealpath.h: * tools/sourcescanner.c: * tools/sourcescanner.h: Move the scanner to a separate library. svn path=/trunk/; revision=164