summaryrefslogtreecommitdiff
path: root/girepository/girparser.c
Commit message (Collapse)AuthorAgeFilesLines
* girepository: Fix leak in _g_ir_parser_parse_fileDavid King2021-06-181-1/+5
| | | | | | Found by Coverity. https://bugzilla.redhat.com/show_bug.cgi?id=1938731
* Add the notion of standalone doc sections.Mathieu Duponchelle2020-07-121-1/+2
| | | | | | | | Up to now, section annotations had to match a class or interface name in order to be serialized in the gir. With this commit, they now get serialized as docsection nodes, for potential use by documentation tools.
* Fix build reproducibilityJoshua Watt2019-12-111-4/+0
| | | | | | | | | | | | ba744068 ("Make meson.override_find_program working on more complex use cases") made the build no longer reproducible by encoding a build system path into the output. This shouldn't be necessary anyway, since it should be possible to add new paths to search for gir files by setting the XDG_DATA_DIR environment variable. Closes #318 Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
* Make meson.override_find_program working on more complex use casesThibault Saunier2019-08-151-0/+4
| | | | | | | Add some missing `meson.override_find_program` And make sure that the `.gir` we build are found when used uninstalled as a concequence of `meson.override_find_program`.
* scanner: parse and expose function macrosMathieu Duponchelle2019-07-191-1/+6
| | | | | This is useful for documentation tools, and other utilities that rely on full introspection of the C API of a given library.
* writer: Include documentation and symbol position in source filesThibault Saunier2018-11-281-1/+8
| | | | | | | | | | | Some documentation tool (as hotdoc[0]) need to have information about symbol declaration and documentation positions in the source files to be able to do smart indexing (automatically build the documenation index). [0] https://hotdoc.github.io/ Fixes #175
* build: enable -Wswitch-defaultChristoph Reiter2018-07-291-0/+2
| | | | | | | In case the surrounding code handles missing cases break, otherwise add a g_assert_not_reached(). The generated parser code triggers this as well, so disable it there only.
* build: enable -Wimplicit-fallthroughChristoph Reiter2018-07-291-1/+1
| | | | and fix a missplaced break
* build: enable -WshadowChristoph Reiter2018-07-291-1/+2
|
* girparser: Avoid a crash with an unset transfer annotationColin Walters2015-10-041-2/+2
| | | | | | Spotted by Coverity. https://bugzilla.gnome.org/show_bug.cgi?id=752549
* girepository: Include config.h First in All SourcesChun-wei Fan2014-07-071-1/+2
| | | | | | | | | This includes config.h in all the C-sources of girepository so that we can get the correct export directive from config.h during compile time and therefore export the symbols as necessary, like what GLib and GTK+ is currently doing. https://bugzilla.gnome.org/show_bug.cgi?id=732669
* Parse and expose ownership transfer for instance parametersGiovanni Campagna2014-07-031-5/+69
| | | | | | | | | | | Knowing the ownership transfer for instance parameters is necessary for correct memory management of functions which "eat" their instance argument, such as g_dbus_method_invocation_return_*. Parse this information from the gir file and store in the typelib, and then provide new API on GICallableInfo to retrieve this. https://bugzilla.gnome.org/show_bug.cgi?id=729662
* compiler: girparser: parse 'nullable' attributeRyan Lortie2014-05-061-1/+16
| | | | | | | | | | | Parse the 'nullable' attribute on parameters and function return types. Additionally, tweak the meaning of the 'allow-none' attribute. We now only treat it as equivalent to 'nullable' for non-out parameters. For out parameters, we treat it to mean the same as the already-recognised 'optional' parameter (which we only recently started actually using). https://bugzilla.gnome.org/show_bug.cgi?id=660879
* girepository: ArgBlob: rename allow_none parameterRyan Lortie2014-05-061-2/+2
| | | | | | | | | Rename the "allow_none" parameter on internal/private structure ArgBlob to "nullable". This is a straight rename with no other changes. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* g-ir-compiler: Add support for callback fields on GObjectsSimon Feltman2014-02-271-20/+21
| | | | | | | | | | | | | | | | | Use ParseState enum instead of a boolean for the ParseContexts embedded_type flag. This allows specific tracking of the embedded type currently being parsed which can now either be STATE_STRUCT_FIELD or STATE_CLASS_FIELD (or allow for future expansion). Add ParseState::STATE_NONE as the default for this field. Fix GObject FieldBlob validation to take into account the sizeof CallbackBlobs (copied from the struct validator). Add static g_object_info_get_field_offset which parallels g_struct_info_get_field_offset which is needed since callback fields may vary in size. https://bugzilla.gnome.org/show_bug.cgi?id=725198
* giscanner: fix description field storage in .gir filesDieter Verfaillie2013-10-081-1/+2
| | | | | | | | | | | | | | | | | | 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 />".
* Use case insensitive compare for signal "when" attributeSimon Feltman2013-10-051-2/+2
| | | | | | | | Update parser to use g_ascii_strcasecmp instead of strcmp. This fixes incorrect flags being set when the incomming gir is using lowercase values for the "when" attribute. https://bugzilla.gnome.org/show_bug.cgi?id=709462
* girparser: Also honor legacy c:prefixColin Walters2013-04-151-0/+3
| | | | | | | vala generates this, and we need to honor it now that we're using the c:prefix as an optimization when searching for gtypes. https://bugzilla.gnome.org/697759
* girparser: Serialize and read back the instance_parameterJasper St. Pierre2013-02-011-0/+5
| | | | | | | | g-ir-doc-tool wants to use the instance parameter to read docs and the parameter name, so it needs to be shuttled through the GIR. https://bugzilla.gnome.org/show_bug.cgi?id=693040
* girparser: Clean up passthrough handlingJasper St. Pierre2013-02-011-6/+4
| | | | | | | Instead of remembering to have to set unknown_depth, smarten up state_switch to do it for us. https://bugzilla.gnome.org/show_bug.cgi?id=693040
* girparser: Move <doc> handling to passthroughJasper St. Pierre2013-02-011-27/+6
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=693040
* girepository: gchar is a signed typeMartin Pitt2013-01-111-1/+2
| | | | | | | gchar is signed, not unsigned. Add "guchar" alias as unsigned for completeness (but usually it appears as guint8). https://bugzilla.gnome.org/show_bug.cgi?id=691524
* girepository: Remove C99ism and other updatesChun-wei Fan2012-10-271-6/+27
| | | | | | | | | | -Make code using libgirepository_internals relocatable on Windows, like what is done in the GTK+ stack, and the girepository DLL. -Remove C99isms -"interface" is a reserved keyword on certain compilers, so change that to "giinterface" https://bugzilla.gnome.org/show_bug.cgi?id=681820
* repository: Ensure error is set if we're parsing a malformed fileJean Bréfort2012-02-171-4/+5
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=661951
* Add Emacs mode lines to C sourcesColin Walters2012-02-031-1/+2
|
* girepository: Add GI_VFUNC_THROWSColin Walters2012-02-031-0/+7
| | | | | | | | Virtual functions can definitely throw an error. Right now the scanner omits the GError parameter for them and adds throws="1", but g-ir-compiler ignores this. https://bugzilla.gnome.org/show_bug.cgi?id=669332
* parser: prevents a segfault when _g_ir_parser_parse_string returns NULL ↵Alberto Ruiz2011-10-181-0/+5
| | | | | | | | | | error was not set. Noticed the segmentation fault while using Vala to generate a .gir, a bug has been filed tomake sure Vala doesn't export gir symbols outside of a namespace (see https://bugzilla.gnome.org/show_bug.cgi?id=661952) https://bugzilla.gnome.org/show_bug.cgi?id=661951
* Fix g_type_info_is_pointer() for overriden types of arguments.Pavel Holejsovsky2011-09-121-0/+4
| | | | | | | | | Algorithm which detects whether argument type is pointer checks for trailing '*' characters in c:type .gir elements. This failed if ctype is either 'gpointer' or 'gconstpointer'. Add specific check for gpointer/gconstpointer types when deducing pointerness of the type. https://bugzilla.gnome.org/show_bug.cgi?id=658848
* Allow enums and bitfields to have static methodsTorsten Schönfeld2011-08-161-0/+17
| | | | | | | | | | | | | 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
* Switch to storing string form of error quarksDan Winship2011-08-121-0/+4
| | | | | | | | | | | | | | | | 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
* Deprecate ErrorDomainDan Winship2011-08-121-78/+3
| | | | | | | | | | | | | | The previous ErrorDomain blob was never actually scanned or used, and it was kind of a lame API conceptually. To keep some compatibility, rather than removing the enumeration values, rename them to _INVALID, and don't bump the typelib version. This should in theory allow a new libgirepository to read an old typelib. Based on a patch from Colin Walters https://bugzilla.gnome.org/show_bug.cgi?id=602516
* Add support for the (skip) annotation on parameters or return valuesDavid Zeuthen2011-05-131-0/+14
| | | | | | | | This was discussed in bug 649657. https://bugzilla.gnome.org/show_bug.cgi?id=649657 Signed-off-by: David Zeuthen <davidz@redhat.com>
* girparser: use c:identifier-prefixes instead of c:prefixSerkan Kaba2011-03-261-1/+1
| | | | | | | | This bug was introduced with http://git.gnome.org/browse/gobject-introspection/commit/?id=36aa515f1036978ced8d4ffb808260844f7229e0 due to rename of c:prefix to c:identifier-prefixes. https://bugzilla.gnome.org/show_bug.cgi?id=640264
* Add "c:identifier" attribute to GIrNodeValue (for flags and enum values).GOBJECT_INTROSPECTION_0_10_3Laszlo Pandy2011-02-231-0/+6
| | | | | | | | | | | | | | | Flags and enums with a GType have a value_nick and value_name strings available in the class struct. But for flags and enums without GType, we need to get this information from introspection. g_base_info_get_name() gives the string for value_nick. In the GIR, the attribute "c:identifier" is the string neede for value_name. This patch adds the "c:identifier" from GIR to the typelib for all flags and enum values. It can be retireved using g_base_info_get_attribute(info, "c:identifier"). https://bugzilla.gnome.org/show_bug.cgi?id=642757
* Fix argument name of MISSING_ATTRIBUTE macro ('ctx' => 'context').Laszlo Pandy2011-02-171-1/+1
| | | | | | | The argument was called 'ctx' but the macro was using 'context'. This wasn't causing the build to fail because the variable 'context' was already defined in all the scopes where this macro was used.
* Add support for g[u]intptr in scanner and girwriter.Pavel Holejsovsky2011-01-131-3/+5
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=634838
* Don't emit shadowed methods into the typelibAndreas Rottmann2010-12-071-1/+4
| | | | Ignore shadowed methods when parsing the GIR.
* girepository: Consistently prefix internal functions with _Colin Walters2010-11-161-48/+48
| | | | | This should better avoid them being exported. Rename girepository-parser.la to girepository-internals.la for clarity.
* Add support for gunichar in typelibColin Walters2010-11-121-1/+2
| | | | | | | Some API such as gtk_text_iter_get_char returns an individual "gunichar"; we should support this. https://bugzilla.gnome.org/show_bug.cgi?id=633197
* Handle enumerations with the full range of signed and unsigned valuesOwen W. Taylor2010-11-011-5/+5
| | | | | | | | | | | | | 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
* Actually do something about fundamentals when parsing a .girTomeu Vizoso2010-09-291-0/+2
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=630710
* typelib compiler: Passthrough <doc> at any pointColin Walters2010-09-141-1/+1
| | | | This should have been in the previous commit.
* [VFuncBlob] Unknown struct offset should be 0xFFFFSteve Frécinaux2010-09-061-1/+1
| | | | | | | | | | | | Documentation says about g_vfunc_get_offset(): "Obtain the offset of the function pointer in the class struct. The value 0xFFFF indicates that the struct offset is unknown." But g-ir-compiler did set the value to 0 when the offset is unknown. This patch fixes it. https://bugzilla.gnome.org/show_bug.cgi?id=628270
* scanner: Fix previous rename-to handling commitColin Walters2010-09-031-1/+1
|
* scanner: Fix rename-to handlingColin Walters2010-09-031-0/+5
| | | | | We were writing the attributes backwards. Also actually use the attribute in the typelib generation.
* Major rewriteColin Walters2010-08-311-38/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Use GLib types consistentlyColin Walters2010-08-311-29/+29
| | | | | | | | | Rather than have the scanner/parser handle both e.g. "glong" and "long", simply use the GLib types everywhere. This commit adds TYPE_LONG_LONG and TYPE_LONG_DOUBLE to the scanner types; however, rather than add them to the typelib, they're just marked as not-introspectable.
* Move alias target to <type>Colin Walters2010-08-311-27/+72
| | | | | | | This makes type parsing more uniform. Delete the typedef for GSList in foo.h - that's not supported anymore, or at least for now.
* [gircompiler] Clean up parsingColin Walters2010-08-171-37/+60
| | | | | | | | | | | | | | We never actually include multiple modules in the compiler, so just nuke that. Also rather than passing around GIrModule consistently pass around a GIrTypelibBuild structure which has various things. This lets us maintain a stack there which we can walk for better error messages. Also, fix up the node lookup in giroffsets.c; previously it didn't really handle includes correctly. We really need to switch to always using Foo.Bar (i.e. GIName) names internally...
* [girparser] Cleanly pass through c:includeColin Walters2010-08-171-0/+13
|