Commit Graph

426 Commits

Author SHA1 Message Date
Steve Frécinaux
318843cead Fix warning when using g_irepository_enumerate_version()
The reason for the warning was that g_irepository_get_version() expects
the typelib to be already loaded, but enumerate_version() can be called
on typelibs that are not.
2010-08-18 22:45:19 +02:00
Steve Frécinaux
2b07f1ed31 Include the loaded version in g_irepository_enumerate_versions()
Logically speaking, the already loaded version of a namespace is part of
the currently available versions, and can be forgotten if we only
consider the versions available in GI_TYPELIB_PATH, as it could have
been loaded using g_irepository_require_private().

As a side effect, it meant that bindings relying on enumerate_version()
(like pygobject) were not able to require private versions through their
classical requirement scheme.

This patch fixes it by adding the loaded version to the unsorted list of
available versions returned by g_irepository_enumerate_versions()

This patch also uses g_list_prepend() instead of g_list_append() in that
function.

https://bugzilla.gnome.org/show_bug.cgi?id=625983
2010-08-18 20:07:18 +02:00
Colin Walters
62f1b65cc8 [gircompiler] Clean up parsing
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...
2010-08-17 13:14:51 -04:00
Colin Walters
9b1bb64e83 [girepository] Fix up error printing
We didn't show the right error message if we failed to find
the symbol; fix this by removing error printing from the
middle of the dumper, and add it correctly to the toplevel
dump entry point.
2010-08-17 13:12:52 -04:00
Colin Walters
f552f46f88 [girparser] Cleanly pass through c:include 2010-08-17 13:11:03 -04:00
Steve Frécinaux
439753a5b3 Do not leak typelibs with wrong header info.
Previously the typelibs that were loaded but whose header information
weren't right were just leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=625672
2010-08-03 23:42:08 +02:00
Steve Frécinaux
e3b7e76b86 Add new API g_typelib_require_private()
This is equivalent to g_typelib_require() but intended for use with
private typelibs, which get loaded from the provided directory.

https://bugzilla.gnome.org/show_bug.cgi?id=625672
2010-08-03 23:36:54 +02:00
Colin Walters
9771d87b4d Add BLOB_TYPE_FLAGS to BLOB_IS_REGISTERED_TYPE 2010-07-28 16:35:47 +02:00
Johan Dahlin
899718c93c [girepository-private] Add ffi declarations
Add declarations for the ffi closure api we're using, this silents
GCC warnings on systems with broken ffi headers.
2010-07-28 09:01:33 -03:00
Johan Dahlin
c93fbff870 [girepository] Update documentation 2010-07-28 08:52:45 -03:00
Johan Dahlin
ab9085eda3 [GIRepository] Rename g_irepository_enumerate
Rename it to g_irepository_enumerate_versions
2010-07-28 08:52:05 -03:00
Tomeu Vizoso
da698167a0 Add g_info_type_to_string (GIInfoType type) 2010-07-28 12:24:10 +02:00
Colin Walters
958b70d8b0 Add g_irepository_enumerate
This will be used for pygobject to enumerate namespaces.
2010-07-27 17:56:36 +02:00
Colin Walters
c0b26bf0a0 [girepository] Include path to file in typelib load failure error
This makes version conflicts more obvious.
2010-07-22 13:48:32 -04:00
Colin Walters
c8fb0f97a8 Fix two compilation warnings 2010-07-19 17:48:17 -04:00
Florian Müllner
5b5ab282a6 [girepository] Fix ordering in override_search_path
Entries in the GI_TYPELIB_PATH environment variable are added to the
global search path in reverse order - instead, add entries in the
same order in which they are specified.
2010-07-15 23:40:28 +02:00
Colin Walters
1b8bf7a4dc [girepository] Actually verify header of loaded typelibs in g_irepository_require
Take a GError * for typelib loading code, validate the header.  This
fixes bizarre errors from gjs where g_irepository_require would happily
load old typelibs.
2010-07-14 11:59:11 -04: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
Colin Walters
cf2b0074ad Bump shared library version, typelib version
https://bugzilla.gnome.org/show_bug.cgi?id=623774
2010-07-09 14:15:52 -04:00
Johan Dahlin
4994c3d4b8 Remove trailing whitespace 2010-07-09 10:20:57 -03: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
Colin Walters
68b4fb43bb Move doc to toplevel element, write <any> for unknown containers
Moving to <doc> allows us to better preserve whitespace.  XML has no
facility for whitespace-preserving attributes.

Second, for arrays and lists, both types with unknown element_type can
occur in the current scanner; it's least wrong if we write out an
<any> type.
2010-07-08 14:42:54 -04: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
David Zeuthen
c57c9efe6f Attribute bug-fixes
Rectify an assumption that nodes are ordered according to offset
- since this assumption was not true, attributes ended up being not
ordered either and the bsearch() when looking up attributes failed
mysteriously. Instead of making such assumptions, simply sort the
list of nodes we want to extract attributes from.

The total attribute size computation was wrong as we didn't properly
descend into subnodes. This resulted in memory access violations
when writing the typelib (because not enough data was allocated).
Instead of having a separate function for this, just include the
attribute size in the existing function.

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
Colin Walters
e169006ed6 [girparser] Remove backtrace()
It's not useful; we never got good info from it, and modern operating
systems ship with crash catching systems.
2010-06-22 18:03:36 -04:00
Johan Dahlin
9a9825b0f9 [giregisteredinfo] A Boxed is also a registered type 2010-06-22 10:17:02 -03:00
Colin Walters
2f11782f51 Support introspectable=no attribute, add warnings framework
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
2010-06-17 13:05:59 -04:00
Colin Walters
911d98bb9d More explicitly document how we'll use the version= attribute on repository
I want to start bumping it on incompatible .gir changes.

https://bugzilla.gnome.org/show_bug.cgi?id=621895
2010-06-17 10:49:41 -04:00
Johan Dahlin
c3790c1af7 Revert "Support introspectable=no attribute, add warnings framework"
This reverts commit 074192b89c6afcdd7f062f03989972e44334b8bf.
2010-06-17 09:14:04 -03:00
Colin Walters
97c497bfea Support introspectable=no attribute, add warnings framework
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.
2010-06-16 21:58:18 -04:00
Johan Dahlin
1223ef3560 [girparser] Annotate return transfer for public API 2010-06-12 11:31:06 -03:00
Johan Dahlin
adcb85871b [girwriter] Use GSlice 2010-06-12 11:23:21 -03:00
Johan Dahlin
9313f23ed5 [GIVInterfaceInfo] Document and check args 2010-06-12 11:14:36 -03:00
Johan Dahlin
401baff470 [GIObjectInfo] Fix a typo and document a func 2010-06-12 11:14:22 -03:00
Johan Dahlin
a9a1fdabd8 [gir_writer_write] Document properly 2010-06-11 21:06:31 -03:00
Johan Dahlin
2e570b7704 [g_property_info_get_flags] Document properly 2010-06-11 21:06:02 -03:00
Johan Dahlin
bd0c9a4170 [gitypelib-internal.h] Add missing <public> 2010-06-11 21:05:42 -03:00
Johan Dahlin
55c7dc37ac [GIObjectInfo] Document and check types 2010-06-11 20:51:32 -03:00
Johan Dahlin
d89eb01974 [GICallableInfo] Fix a typo in the doc 2010-06-11 20:16:29 -03:00
Johan Dahlin
1eca3abe67 [docs] Add struct hierarchy to each section 2010-06-11 20:16:00 -03:00
Johan Dahlin
5a0016133a [GIVFuncInfo] Document and check args 2010-06-11 11:11:46 -03:00
Johan Dahlin
4af59a4c04 [GIPropertyInfo] Document and check args 2010-06-11 11:10:52 -03:00
Tomeu Vizoso
d9bbf572b0 Allow for methods in GLib
* girepository/gitypelib.c: Don't complain about constructors
  returning types other than objects or interfaces if the container
  type isn't an object or interface itself.

* giscanner/glibtransformer.py: Don't give up parsing a method just
  because it's in the GLib namespace.

https://bugzilla.gnome.org/show_bug.cgi?id=621069
2010-06-09 08:38:04 -03:00
Tomeu Vizoso
ba97c98827 Use a default value for transfer-ownership in properties. 2010-06-08 19:20:06 +02: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
b2575e8210 Philip, you didn't write all of this 2010-06-08 11:28:02 -03:00
Johan Dahlin
825c230941 [gisignalinfo] Document and check parameters 2010-06-07 17:20:02 -03: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
06d778dc3c [Makefile.am] Reindent 2010-06-07 10:29:53 -03:00
Johan Dahlin
6b4647c088 [girepository] Kill girffi-private.h 2010-06-06 23:22:57 -03:00