Commit Graph

670 Commits

Author SHA1 Message Date
Jasper St. Pierre
3e1486f924 girffi: Fix compiler warnings 2012-01-06 15:00:46 -05:00
Jasper St. Pierre
c18e0be549 repository: Squash memory leak in _get_func and fix up style 2012-01-06 15:00:39 -05:00
Ray Strode
c99df8f34c ffi: Treat enums as 32 bit signed values to fix PPC64
To call a function dynamically using ffi, the caller
first has to tell ffi the size of all the input arguments
of the function. On little endian architectures (like x86_64)
specifying a size that's too large will happen to work because
of how the bits are laid out in memory.  On big endian architectures,
however, specifying the wrong size can lead to reading the wrong
bits.

The function g_type_info_get_ffi_type maps input giargument types to
specific sizes. It was assuming enums were word (pointer) sized; in
fact they can be in theory any size (1,2,4,8 bytes), but in practice
in introspection (via GIArgument) as well as GValue we're limited to 4
byte enums.

This commit fixes PPC64 (big endian, 64 bit).

Signed-off-by: Colin Walters <walters@verbum.org>

https://bugzilla.gnome.org/show_bug.cgi?id=665150
2011-12-21 15:55:18 -05:00
Jasper St. Pierre
cfcbd719ea gitypelib: Fix compiler warnings
These variables are unused.

https://bugzilla.gnome.org/show_bug.cgi?id=665249
2011-12-01 10:55:19 -05:00
Jasper St. Pierre
fd0625aa6e gibaseinfo: Fix compiler warnings
g_slice_free complains when you pass it a pointer of a different type
than it was expecting, like it should.

https://bugzilla.gnome.org/show_bug.cgi?id=665249
2011-12-01 10:55:19 -05:00
Sjoerd Simons
acd55584c2 Use the correct size when freeing unused info
A GIBaseInfo struct can underneath either be GIRealInfo *or*
GIUnresolvedInfo if the type is GI_INFO_TYPE_UNRESOLVED. So when we
eventually free the structures slice use the correct struct type
otherwise things get unhappy.
2011-10-20 10:24:33 +02:00
Alberto Ruiz
c87a386cd1 parser: prevents a segfault when _g_ir_parser_parse_string returns NULL 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
2011-10-18 16:59:34 +01:00
Jasper St. Pierre
b75e788785 giconstantinfo: Add API to fix memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=654069
2011-10-05 16:46:33 -04:00
Colin Walters
11cf4c56f3 repository: Fix g_irepository_get_c_prefix()
It was returning the wrong data.

https://bugzilla.gnome.org/show_bug.cgi?id=659749
2011-09-21 14:05:52 -04:00
Pavel Holejsovsky
87fd1d5dad Fix g_type_info_is_pointer() for overriden types of arguments.
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
2011-09-12 20:16:32 +02:00
Dieter Verfaillie
8461962337 Windows port: compute GOBJECT_INTROSPECTION_LIBDIR at runtime.
Otherwise, we fail to properly locate the typelibs, because on Windows
the value of GOBJECT_INTROSPECTION_LIBDIR depends on where Glib has been
installed. Due to the nature of how we handle software that depends on
Glib on Windows (it is recommended that each program bundles it's private
copy), we're working in a "multi-prefixed" environment. Hence the value
computed at build time will most likely not even exist at runtime.

https://bugzilla.gnome.org/show_bug.cgi?id=620566
2011-09-07 22:00:09 +02:00
Dieter Verfaillie
522ebcd2d6 Windows port: cmph_time.h includes sys/resource.h which is not available on Windows.
So only include it when WIN32 is not defined.

https://bugzilla.gnome.org/show_bug.cgi?id=620566
2011-09-07 21:59:52 +02:00
Colin Walters
61c8a0dda2 gi-dump-types: New uninstalled debugging program
Usage: ./_build/gi-dump-types g_object_get_type
2011-09-03 12:34:29 -04:00
Colin Walters
6f0cf9a0aa girffi: Remove unnecessary sys/mman.h include
While we're here move config.h to the top for consistency.
2011-09-03 12:03:34 -04:00
Pavel Holejsovsky
b8010062b5 Fix g_irepository_find_by_gtype() for GDK_TYPE_RECTANGLE
Complement fix for g-ir-scanner which converts every GdkRectangle
gtype to CairoRectangleInt.  Make sure that C-side API is also aware
of this workaround.

Use case requiring this patch:

When binding implementation wants to get/set property, it can use either
GI-based approach (g_property_info_xxx() funcs), or just GLib facilities.
Although former is probably preferred, there are cases when latter is still
needed (e.g. gstreamer uses dynamic properties, which are not present in the
gir).  In this case, binding implementation queries the type of the propertyb
(using g_object_class_find_property()), it gets GDK_TYPE_RECTANGLE,
and without the patch it cannot map it to any known type.

https://bugzilla.gnome.org/show_bug.cgi?id=655423
2011-08-25 21:22:25 +02:00
Torsten Schönfeld
13069a377f Add 'Since:' tags to the newly added GIEnumInfo methods 2011-08-18 22:51:57 +02:00
Torsten Schönfeld
322ac4f0a3 Allow enums and bitfields to have static methods
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
2011-08-16 18:43:23 +02:00
Johan Dahlin
5167265aae Merge remote-tracking branch 'origin/gir-docbook'
Conflicts:
	.gitignore
	tests/scanner/Regress-1.0-expected.gir
2011-08-13 14:42:05 -03:00
Johan Dahlin
4ce922a903 Add signal flags
This adds all GSignalFlags into the gir.

https://bugzilla.gnome.org/show_bug.cgi?id=656457
2011-08-13 11:21:05 -03:00
Johan Dahlin
1dcf01a490 Add signal flags
This adds all GSignalFlags into the gir.

https://bugzilla.gnome.org/show_bug.cgi?id=656457
2011-08-13 11:10:21 -03:00
Dan Winship
ff6cada552 Add g_irepository_find_by_error_domain()
Add a method to look up a GIEnumInfo given its associated error quark.

Based on a patch from Colin Walters.

https://bugzilla.gnome.org/show_bug.cgi?id=602516
2011-08-13 09:42:38 -03:00
Dan Winship
215d83ebb0 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-13 09:42:37 -03:00
Dan Winship
6ee82c14e8 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-13 09:42:37 -03:00
Dan Winship
34c298a51e girepository: fix some doc comment syntax 2011-08-13 09:42:37 -03:00
Dan Winship
bf9c31f49c Add g_irepository_find_by_error_domain()
Add a method to look up a GIEnumInfo given its associated error quark.

Based on a patch from Colin Walters.

https://bugzilla.gnome.org/show_bug.cgi?id=602516
2011-08-12 11:11:45 -04: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
Dan Winship
2c0d884330 girepository: fix some doc comment syntax 2011-08-12 11:10:43 -04:00
Jasper Lievisse Adriaanse
a9b2dfd09a Rename ALIGN to GI_ALIGN to prevent redefining this macro on some platforms
https://bugzilla.gnome.org/show_bug.cgi?id=652625
2011-06-21 13:44:56 +02:00
Giovanni Campagna
98067194d6 Free allocated ffi_types in g_callable_info_free_closure()
g_callable_info_prepare_closure() allocates memory for the argument
types in the ffi_cif, so we need to free it.

https://bugzilla.gnome.org/show_bug.cgi?id=652954
2011-06-20 21:19:05 +02:00
Giovanni Campagna
a1b527c79f Rework how fundamental GObject types are introspected
Change the special code for handling GObject and GInitiallyUnowned
so that it exposes GParamSpec as a class, and it allows GVariant to
have a GType without using the deprecate g_variant_get_gtype.

It is a sort of ABI break, in that new typelibs won't work with
previous versions of libgirepository.

https://bugzilla.gnome.org/show_bug.cgi?id=646635
2011-06-08 17:45:31 +02:00
Giovanni Campagna
fef2a7b8dd Fix accessing structure fields that are arrays
We need to distinguish inline arrays inside structures, and arrays
that are pointers and annotations, and we can do it with
g_type_info_is_pointer(), setting it to FALSE for fixed size arrays.
As a side effect, (array fixed-size=N) on a pointer type has no longer
the expected result.

https://bugzilla.gnome.org/show_bug.cgi?id=646635
2011-06-08 17:45:13 +02:00
Tomeu Vizoso
343c76431a Assume only that an array is embedded in a struct if it's fixed size 2011-06-06 20:13:50 +02:00
Colin Walters
9948f518dc gifieldinfo.c: Quiet some compiler warnings 2011-05-23 09:59:02 -04:00
Colin Walters
0c5d8c1aa9 Add Since: for g_arg_info_is_skip() 2011-05-13 14:23:05 -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
Maxim Ermilov
eeddf77567 g_field_info_get_field: return correct pointer for C array
Also add a test case.

https://bugzilla.gnome.org/show_bug.cgi?id=640468
2011-05-04 15:01:10 -04:00
Serkan Kaba
1611ff77df girparser: use c:identifier-prefixes instead of c:prefix
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
2011-03-26 12:18:40 -04:00
John (J5) Palmieri
feedce8029 support setting gobjects and ginterfaces in struct fields
https://bugzilla.gnome.org/show_bug.cgi?id=644749
2011-03-16 14:33:05 -04:00
Laszlo Pandy
8304598583 Add "c:identifier" attribute to GIrNodeValue (for flags and enum values).
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
2011-02-23 13:55:04 +01:00
Giovanni Campagna
a0890f3d8f GIrNode: fix lookup of cached type nodes
Different types of array have different type nodes, so they should
produce different keys in the cache of already seen type nodes, to
avoid turning a GByteArray into a reference to a GPtrArray.

https://bugzilla.gnome.org/show_bug.cgi?id=642300
2011-02-21 11:32:46 -05:00
Laszlo Pandy
f478da144f Fix argument name of MISSING_ATTRIBUTE macro ('ctx' => 'context').
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.
2011-02-17 18:01:31 +01:00
Jonathan Matthew
5debbc28a9 Account for arg direction in g_callable_info_get_ffi_arg_types
https://bugzilla.gnome.org/show_bug.cgi?id=641647
2011-02-09 07:52:53 +10:00
Tomeu Vizoso
04c822609a Pass shared-library as-is to g_module_open
Because it already has the lib prefix and the .so postfix

https://bugzilla.gnome.org/show_bug.cgi?id=639961
2011-01-21 10:48:56 +01:00
Pavel Holejsovsky
5857d9c231 Add support for g[u]intptr in scanner and girwriter.
https://bugzilla.gnome.org/show_bug.cgi?id=634838
2011-01-13 16:20:01 +01:00
Tomeu Vizoso
95cf1ef4d6 Add g_vfunc_info_invoke and g_vfunc_info_get_address
for calling the native implementation of a virtual function. Refactors
the code common with g_function_info_invoke in _g_callable_info_invoke.

https://bugzilla.gnome.org/show_bug.cgi?id=637145
2011-01-12 20:05:09 +01:00
Benjamin Otte
66f164c0ea scanner: Rename g_irepository_dump when included from the dumper
This avoids a naming conflict when compiling GiRepository.gir, where
g_irepository_dump() was defined in an included header.
2011-01-11 15:11:05 +01:00
Kristian Rietveld
0e05b14044 Avoid using namespace as identifier in public header files 2010-12-28 10:41:16 +01:00
Andreas Rottmann
732911c703 Don't emit shadowed methods into the typelib
Ignore shadowed methods when parsing the GIR.
2010-12-07 00:07:08 +01:00
Colin Walters
d01de67d02 g_object_info_find_method_using_interfaces: Fix crash if not found
If a method wasn't found, we'd try to unref NULL.
2010-12-06 11:14:53 -05:00