Commit Graph

22 Commits

Author SHA1 Message Date
Garrett Regier
96deb9ede5 girepository: Support GError exceptions on callbacks
Generalize "throws" attribute to SignatureBlob which can be used by all
callable blob types. Keep FunctionBlob and VFuncBlob throw attributes
around and functional for compatibility. Refactor girwriter.c to write
out throws attribute for all callable types.

Based on a patch by Simon Feltman.

https://bugzilla.gnome.org/show_bug.cgi?id=729543
2015-06-21 13:01:25 -07:00
Philip Withnall
e222ca2ef2 girepository: Add g_irepository_get_immediate_dependencies()
g_irepository_get_dependencies() is supposed to return the transitive
closure of all dependencies of the given namespace. However, it just
loads the dependencies field from the typelib, which is supposed to only
list immediate dependencies.

Introduce a new g_irepository_get_immediate_dependencies() which does
this, and rewrite g_irepository_get_dependencies() to build the
transitive closure of all its namespace dependencies. This does not
require loading any new typelibs, as the transitive closure of
dependencies should already have been loaded by g_irepository_require()
or g_irepository_load_typelib().

https://bugzilla.gnome.org/show_bug.cgi?id=743782
2015-02-16 08:49:28 +00:00
Johan Dahlin
0a96da9284 Make introspection compile with -Wall -Werror
Address all gcc warnings, -Werror is not enabled yet but at least
-Wall -Werror passes on my machine.
2012-04-09 14:19:23 -03:00
Colin Walters
e865dcb7b4 Add Emacs mode lines to C sources 2012-02-03 13:42:56 -05:00
Colin Walters
b9d0981460 girepository: Add GI_VFUNC_THROWS
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
2012-02-03 13:20:57 -05:00
Dan Winship
57554d4b2d Switch to storing string form of error quarks
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
2011-08-12 11:10:43 -04:00
Dan Winship
f9ebb4e99d Deprecate ErrorDomain
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
2011-08-12 11:10:43 -04:00
David Zeuthen
b35c985e15 Add support for the (skip) annotation on parameters or return values
This was discussed in bug 649657.

https://bugzilla.gnome.org/show_bug.cgi?id=649657

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-05-13 14:18:48 -04:00
Owen W. Taylor
ec76ea8628 Handle enumerations with the full range of signed and unsigned values
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
2010-11-01 17:25:45 -04:00
Colin Walters
3d7bb7feaf Fix regression in g_irepository_get_info
Commit f97cc8687469f25752f79275 broke the lookup in
g_irepository_get_info; the passed offset is 0-based, then
we convert it to 1-based (and then back to 0 later...which needs
to be fixed).
2010-10-21 15:01:07 -04:00
Johan Dahlin
9c80c84dc7 [GIRepository] Rename GArgument to GIArgument
Keep a typedef for backwards compatibility, until
the major bindings has moved over.
2010-08-31 17:35:57 -03:00
Colin Walters
3a310fd242 Don't include machine-dependent integral types in the typelib
Previously we had both e.g. GI_TYPE_TAG_LONG and GI_TYPE_TAG_INT64,
but in fact the typelib is already machine-specific, so it makes sense
to just encode this as a fixed type.  The .gir remains abstract.

We also remove size_t from the typelib; one would never want to treat
it differently than an integer.

time_t is removed as well; while bindings like gjs had special handling
to turn it into e.g. a JS Date object, I don't think we should encourage
people to use these POSIX types in their API.  Use GTimeVal or the like
instead.

Because the typelib is now really machine-specific, we need to remove
the -expected.tgirs from git.  (We could potentially add a check
which wasn't just a literal diff later)

https://bugzilla.gnome.org/show_bug.cgi?id=623774
2010-07-09 14:15:52 -04:00
Johan Dahlin
b6d50e2951 Add support for non-GObject fundamental objects
This patch adds support for instantiable fundamental object types,
which are not GObject based. This is mostly interesting for being
able to support GstMiniObject's which are extensivly used in GStreamer.
Includes a big test case to the Everything module (inspired by
GstMiniObject) which should be used by language bindings who wishes to
test this functionallity.

This patch increases the size of the typelib and breaks compatibility
with older typelibs.

https://bugzilla.gnome.org/show_bug.cgi?id=568913
2010-07-09 10:15:45 -03:00
David Zeuthen
3d0dc7d214 Allow attributes on parameters and return values
Any annotation where the key has a dot in the name will go into the
attribute list. For example

  * @arg: (foo.bar baz): some arg

the parameter @arg will get the attribute with key foo.bar and value
baz. This also works for.

  * Returns: (foo.bar2 baz2): the return value

Also add tests for this new feature.

See https://bugzilla.gnome.org/show_bug.cgi?id=571548

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-06-24 11:53:18 -04:00
Johan Dahlin
adcb85871b [girwriter] Use GSlice 2010-06-12 11:23:21 -03:00
Johan Dahlin
a9a1fdabd8 [gir_writer_write] Document properly 2010-06-11 21:06:31 -03:00
Tomeu Vizoso
518765acf3 Support the (transfer) annotation for properties.
* girepository/*: Add g_property_info_get_ownership_transfer() and write
  the transfer attribute of properties into the typelib.

* giscanner/*: Parse the (transfer) annotation and write it into the .gir.

* tools/generate.c: Read the transfer annotation for properties and write
  to the .tgir.

https://bugzilla.gnome.org/show_bug.cgi?id=620484
2010-06-08 17:35:12 +02:00
Johan Dahlin
27511f220b [girwriter] Refactor out of generate.c
Move out the girwriter out of generate.c. Still a private API,
but that will probably change in the future.
2010-06-07 10:52:43 -03:00
Johan Dahlin
d9e0c19ce2 Remove unused file girwriter.c 2010-03-25 09:19:25 -03:00
Johan Dahlin
6b0463dd16 [girepository] Remove trailing whitespace 2010-03-24 15:02:05 -03:00
Tommi Komulainen
04c5badd69 Bug 557405 – Use 'allow-none' consistently
2008-10-22  Tommi Komulainen  <tommi.komulainen@iki.fi>

	* docs/typelib-format.txt:
	* girepository/ginfo.c (g_arg_info_may_be_null):
	* girepository/girnode.c (g_ir_node_build_typelib):
	* girepository/girnode.h (struct _GIrNodeParam):
	* girepository/girparser.c (start_parameter):
	* girepository/girwriter.c (function_generate):
	* girepository/gtypelib.h (ArgBlob):
	* tests/errors.gir:
	* tests/function.gir:
	* tools/generate.c (write_callable_info): Use 'allow-none'
	consistently throughout

svn path=/trunk/; revision=782
2008-10-22 14:02:02 +00:00
Johan Dahlin
282a6c644e Move shared *.[ch] files to girepository from tools
2008-08-09  Johan Dahlin  <johan@gnome.org>

    * girepository/Makefile.am:
    * tools/Makefile.am:
    * tools/girmodule.c:
    * tools/girmodule.h:
    * tools/girnode.c:
    * tools/girnode.h:
    * tools/girparser.c:
    * tools/girparser.h:
    * tools/girwriter.c:
    * tools/girwriter.h:
    Move shared *.[ch] files to girepository from tools


svn path=/trunk/; revision=337
2008-08-09 12:46:48 +00:00