summaryrefslogtreecommitdiff
path: root/giscanner
Commit message (Collapse)AuthorAgeFilesLines
* scanner: Honor nested types on array declarations as wellColin Walters2014-09-051-1/+4
| | | | | | | | | We have special code to look at (type GLib.List(utf8)), but (type GLib.PtrArray(utf8)) didn't work. This allows NetworkManager to annotate the ActiveConnections property. https://bugzilla.gnome.org/show_bug.cgi?id=733879
* giscanner: Add Optional Options for CodegenChun-wei Fan2014-09-043-6/+82
| | | | | | | | | | | | | | | | | This adds options to scannermain so that we can decorate functions with macros as needed, so that we can use compiler annotations for symbol export for example. Options are also added to include headers before or after the main include block at the top so that we can include headers as necessary in the generated sources and/or headers, so that we could for example grab definitions from those headers as needed, such as to grab definitions of macros used for symbol export. The testcodegen.py script has been updated as well to make use of this functionality, if needed. https://bugzilla.gnome.org/show_bug.cgi?id=732669
* Fix windows buildIgnacio Casal Quinteiro2014-09-021-2/+2
|
* scannerlexer.l: Update to Support MSVC PreprocessorChun-wei Fan2014-08-151-5/+18
| | | | | | | | | | | | | | This updates giscanner/scannerlexer.l by ignoring the Visual C++-specific directives, so that the scanner will not bail out while trying to produce the introspection dumper program source code, and silence many of the warnings that are produced in the process. As the Visual C++ processor produces slightly different line markers, we need to handle this here as well, otherwise the sources/headers would not be processed to acquire the _get_type and _get_gtype symbols to put in the introspection dumper sources, producing bad results. https://bugzilla.gnome.org/show_bug.cgi?id=728313
* Revert "codegen.py: Update Generation of everything.[c|h]"Chun-wei Fan2014-08-151-10/+1
| | | | This reverts commit 7a82752734b496bb619fce62572c0c7f8578350a.
* codegen.py: Update Generation of everything.[c|h]Chun-wei Fan2014-08-151-1/+10
| | | | | | | | Update everything.h include the header used to decorate symbols with the macro for export and everything.c to include config.h first, and have the symbols decorated with the aforementioned macro. https://bugzilla.gnome.org/show_bug.cgi?id=732669
* Check for MINGW instead of MINGW32Ignacio Casal Quinteiro2014-08-061-1/+2
| | | | | | New versions of msys2 provide a MINGW64 env variable instead. https://bugzilla.gnome.org/show_bug.cgi?id=734163
* giscanner: Add New CCompiler ModuleChun-wei Fan2014-08-053-157/+221
| | | | | | | | | | | | | | | This adds a CCompiler module for the giscanner Python scripts so that items related to the run of the preprocessor, compiler and linker can be done in this module, and this marks the beginning of the move of building the introspection files using Python's distutils. This patch first moves _add_[internal|external]_link_flags() to ccompiler.py as get_[internal|external]_link_flags and also moves the Windows shlibs resolution (deducing the DLLs the introspection files should link to from the libraries passed in) in shlibs.py to resolve_windows_libs() in ccompiler.py https://bugzilla.gnome.org/show_bug.cgi?id=728313
* giscanner/cachestore.py: Clean up a bitChun-wei Fan2014-08-011-4/+1
| | | | | | | Use the special os.path.expanduser('~'), as it it more portable, instead of quering the HOME or HOMEPATH envvar. https://bugzilla.gnome.org/show_bug.cgi?id=732668
* giscanner: Make _get_cachedir() Always Work on WindowsChun-wei Fan2014-07-041-1/+4
| | | | | | | | | | On Windows, checking for $(HOME) will work in a MSYS shell but not in cmd.exe (i.e. Visual Studio command prompt), so we need to check for HOMEPATH when we are building under a Visual Studio command prompt to get the users's home directory correctly. This will enable g-ir-doc-tool to work on Windows when run from cmd.exe. https://bugzilla.gnome.org/show_bug.cgi?id=732668
* scanner: Add --identifier-filter-cmdSimon Feltman2014-06-032-2/+21
| | | | | | | | | 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
* annotationparser: more nullable fixesRyan Lortie2014-05-081-0/+2
| | | | | Add ANN_NULLABLE and ANN_OPTIONAL in the one (and only) other place that ANN_ALLOW_NONE is mentioned...
* giscanner: allow (nullable) and (optional)Ryan Lortie2014-05-071-2/+2
| | | | | | | Add (nullable) and (optional) as recognised annotations in the same places that (allow-none) is allowed. This should have been done in the previous commits but the tests were passing because the only ill effect was that a warning was issued.
* Revert "giscanner: don't accept (allow-none) on Returns:"Ryan Lortie2014-05-061-1/+1
| | | | | | | This reverts commit 0839e696e9fbc1942ac5c61054de3b47e9578152. This was accidentally picked up by my 'git bz apply' against the bug as I was getting ready to push the last set of changes.
* giscanner: fix a comparisonRyan Lortie2014-05-061-1/+1
| | | | | | | | In the case that a parameter has not been explicitly annotated, the value of node.direction will be None, not 'in'. Instead of comparing as == 'in' we should therefore check for being != 'out'. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* giscanner: support nullable return types tooRyan Lortie2014-05-063-6/+9
| | | | | | | | | | Promote the 'nullable' field to the TypeContainer base class (which is shared by Return and Parameter types). Add .gir support for nullability on return values, both in the writer and in the (scanner's) parser. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* giscanner: add (nullable) and (optional) annotationsRyan Lortie2014-05-062-1/+33
| | | | | | | | | | | Add two new annotations, (nullable) and (optional). (nullable) always means "the type of this value can also contain null". (optional) always means "this out parameter can be ignored by passing NULL to the C function". https://bugzilla.gnome.org/show_bug.cgi?id=660879
* giscanner: write nullable and optional attributesRyan Lortie2014-05-063-3/+8
| | | | | | | | | | | | | | | | | | | Record our internal 'nullable' and 'optional' attributes into the written .gir file. It is now theoretically possible to express the concept of an out parameter with a nullable type (although presently there is no way to do this). Modify our own internal parser (in the scanner) to understand the newly-written attributes. Update the expected output of the 'Regress-1.0.gir' test to account for the new attributes. Nothing else understands 'nullable' yet, but the girparser in the typelib compiler already understands 'optional' and records a bit for it in the typelib. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* giscanner: change some internal field logicRyan Lortie2014-05-063-5/+20
| | | | | | | | | | | | | | | | | | Replace the 'allow_none' field on parameters with two separate fields: 'nullable' and 'optional'. Currently, we use 'nullable' to mean the same thing as 'allow-none' for normal (non-out) parameters. For out parameters, we use the 'optional' field instead. Note that the special case for GCancellable and GAsyncReadyCallback is already guarded by a check for being an in parameter, so we always use 'nullable' here. On the .gir writer side, we decide which variable to consult when writing the allow-none attribute depending on the parameter direction. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* giscanner: tweak GCancellable null special caseRyan Lortie2014-05-061-2/+3
| | | | | | | | | | | | | | We treat GCancellable and GAsyncReadyCallback as if they were always tagged (allow-none) because these parameters universally allow %NULL to be given as a value when they appear as in parameters on functions. Unfortunately, the meaning of (allow-none) is different on out parameters. There it means that you can give %NULL to ignore the return value. Limit this special case to only in parameters. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* maintransformer: split up a complex conditionalRyan Lortie2014-05-061-3/+5
| | | | | | | | | | | | We assign node.allow_none in two separate cases: - if the (allow-none) annotation was given - for GCancellable and GAsyncReadyCallback, as special cases Split the two up. This will simplify future commits. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* giscanner: don't accept (allow-none) on Returns:Dieter Verfaillie2014-05-061-1/+1
| | | | | | | | | The old annotationparser.py happily parsed this, but giscanner/girwriter.py never serialized an allow-none attribute to the .gir file and girepository/girparser.c never looked for an allow-none attribute either. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* giscanner: Use range instead of xrange for Python 3 compatibilitySimon Feltman2014-05-011-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=679438
* giscanner: Use modern exception handling for Python 3 compatibilitySimon Feltman2014-05-011-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=679438
* giscanner: Use Python 3 compatible octal literal syntaxSimon Feltman2014-05-011-2/+2
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=679438
* cachestore: Use "write new, then rename" pattern, not "write in place"Colin Walters2014-04-011-1/+7
| | | | | | | This should fix race conditions when multiple processes attempt to access the cache concurrently. https://bugzilla.gnome.org/show_bug.cgi?id=724886
* docwriter/gjs: fix boolean return valuesGiovanni Campagna2014-03-051-1/+1
| | | | | | | | | | | | | | 'ok' != 'return_value', and we never restore 'Returns:'. At the same time, do the same fix for (out) parameters if the return value is void, so this void my_object_get_foo (MyObject *object, Foo *) is turned into function get_foo() : Foo Returns: ....
* docwriter/gjs: restore documentation for return valuesGiovanni Campagna2014-03-051-2/+4
|
* docwriter/gjs: format GObject.Closure as "Function"Giovanni Campagna2014-03-051-0/+2
| | | | | | | | | | GClosures are represented in gjs as JS functions for in parameters, so it makes sense to use Function in place of the boxed structure (which is also not part of the documentation) Note that GClosures returned from C code are marshalled as boxed types, but this is a gjs bug really, and JS code should never touch them.
* docwriter: format bitfields like enumsGiovanni Campagna2014-03-051-2/+2
| | | | They are enums after all.
* docwriter/gjs: format GObject.Value as "Any"Giovanni Campagna2014-03-051-0/+2
| | | | | | GValues are transparently marshalled by GJS, so you can never use them as boxed (and they are not part of the documentation as such).
* scanner: Ignore C11 _Noreturn keywordColin Walters2014-02-271-0/+1
| | | | | | | | | | This shows up in the headers in FreeBSD's stdlib. Now I didn't add anything to regress.h because I think that'd introduce an effective hard dependency on a C11-capable compiler, unless we used #ifdef trickery. But the problem with #ifdef is that the -expected.gir isn't conditional. https://bugzilla.gnome.org/show_bug.cgi?id=724851
* scanner: Make sure .libs directory existsРуслан Ижбулатов2014-02-271-0/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=724882
* PEP8 fixes in shlib.pySimon Feltman2014-02-261-7/+7
| | | | | | | Conform shlibs.py to the PEP8 standard. New additions were causing make check to fail: Fixed E211 whitespace before '(' Fixed E501 line too long (104 > 99 characters)
* docwriter: improve xrefsGiovanni Campagna2014-02-261-7/+17
| | | | | | | | | | | If a xref points to a node that was not visited, because it was not introspectable, don't assume it has no parent. Instead, try to fetch the parent from the node directly. This is still wrong (the xref points nowhere because no page is generated), but it looks less wrong. If OTOH a xref points to a different namespace, generate the link directly, because yelp-build is not capable of translating it.
* girparser: fix parsing of enum methodsGiovanni Campagna2014-02-261-0/+1
| | | | Make sure to set the parent of the function
* docwriter/Gjs: include static methods in the enum pageGiovanni Campagna2014-02-261-0/+8
| | | | | Switch enum from a topic to a guide page, and include links to all static methods.
* docwriter: extend the "node without namespace" filtering to all languagesGiovanni Campagna2014-02-261-8/+8
| | | | | | As the comment says, it's an AST bug, the structure there cannot be reasonably represented in gobject-introspection, and it makes the tests for C and Python crash, so whatever.
* maintransformer: don't pair methods if the symbol prefix does not match with ↵Giovanni Campagna2014-02-261-7/+27
| | | | | | | | | | | a final underscore In cases like g_resources_register() and gdk_events_get_angle(), the c_symbol_prefix of the first parameter (resp. g_resource and gdk_event) is a prefix of the symbol, but the next character is not _, so that should not be considered a method. For backward compatibility reasons, we still generate one, but then it's not included in the documentation (because of moved_to)
* docwriter: don't ignore disguised structuresGiovanni Campagna2014-02-261-2/+4
| | | | | | Unless they have no methods, static methods and constructors (because then they are useless) Fixes GLib.BookmarkFile, GLib.PatternSpec and probably others.
* docwriter/gjs: fix constructorsGiovanni Campagna2014-02-261-12/+13
| | | | | | | | | | We should only look at introspectable constructors when resolving the default and zero args. Also, a disguised structure or one with zero fields can't be allocated directly. In addition, restore availability of all constructors, because we need a page to document the default one, and because some classes have problems with GObject construction.
* docwriter/gjs: include non GObject instantiatable typesGiovanni Campagna2014-02-261-13/+10
| | | | | | Support for fundamental types was just merged in gjs, so just filter out GParamSpec subclasses (because there is only one class in gjs)
* docwriter/gjs: add support for shadowed function namesGiovanni Campagna2014-02-262-5/+17
| | | | | If a function is shadowed, omit it from the documentation, and if a function shadows, uses the new name.
* docwriter/gjs: report arrays of (u)int8 and GBytes as ByteArrayGiovanni Campagna2014-02-261-1/+6
| | | | | The ByteArray class is special in gjs, it's not a normal Array, so make sure it's flagged as such.
* docwriter/gjs: ignore nodes without a namespaceGiovanni Campagna2014-02-261-0/+8
| | | | g-ir-compiler ignores them too, and they cause a crash, so whatever.
* scanner: Make shlib Resolution Work Also With Visual C++Chun-wei Fan2014-02-251-18/+52
| | | | | | | | | | | | | | | | | | | Commit f3fcdf97 introduced shlib resolution for Windows, but it only works with MinGW and would therefore break builds of introspection files for Visual C++. Improve on the situation by adding capabilities to do the same with Visual C++, as the introspection dumper program is still compiled and linked with the Microsoft tool set (only the proprocessor to process the various headers is using GCC/MinGW). This makes use of the dumpbin utility that is shipped with Visual C++, which will query a .lib file, which leads to the DLL that the .lib file will link to. The 'gcc -print-search-dirs' can be replaced on Visual C++ builds by querying the LIB environment variable, as this is what the Visual C++ compiler/linker really looks at during compilation and linkage. https://bugzilla.gnome.org/show_bug.cgi?id=724890
* scanner: Fix shlib resolution on W32Руслан Ижбулатов2014-02-221-3/+52
| | | | | | | | | GI just adds '.dll' to library name and calls it a day. There's a comment about how this function might work, i've used it to implement something better. This requires a compiler that supports -print-search-dirs argument (i.e. gcc) and a dlltool. https://bugzilla.gnome.org/show_bug.cgi?id=724890
* scanner: Support __restrict__Руслан Ижбулатов2014-02-221-0/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=724887
* scnaner: Support asm __volatile__Руслан Ижбулатов2014-02-221-0/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=724887
* Fix some PEP8 errors from previous commitsColin Walters2014-02-222-3/+7
|