Commit Graph

548 Commits

Author SHA1 Message Date
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
Colin Walters
eb153575a4 g_object_info_find_method_using_interfaces: New function
Pull this down into introspection from gjs; this will allow us
to cache this better in the future (for example, by caching the
infos for interfaces in the info for the object).

https://bugzilla.gnome.org/show_bug.cgi?id=632924
2010-12-06 10:09:50 -05:00
Colin Walters
a1d7beda01 Add directory index section
Use the internal perfect hashing API to add an index to the directory.

To support this, add the notion of additional "sections" to the
typelib.  A section index is inserted between the header and the
directory.

https://bugzilla.gnome.org/show_bug.cgi?id=554943
2010-12-03 16:03:33 -05:00
Colin Walters
409c40f663 Add internal hashing API designed for the typelib
In multiple places in the typelib, but most importantly the directory,
we need some fast indexing.  Perfect hashing, as implemented by CMPH
(previous commit), is an exact fit for the problem domain.

Add an API built on top of CMPH which maps strings->guint16 (we just
need a guint16 for the typelib index).

https://bugzilla.gnome.org/show_bug.cgi?id=554943
2010-12-03 16:03:32 -05:00
Colin Walters
abb1b39ce9 cmph-bdz-test: New test
Add a basic test of CMPH (without any layers on top).
2010-12-03 16:03:32 -05:00
Colin Walters
f9ba452081 cmph: Squash a lot of gcc -Wall compiler warnings
* Functions taking no parameters need to explicitly say (void).
* Mark some functions as static that are
* Comment out an unused function in bdz.c
* Change loop indicies "i" to be unsigned if our limit is unsigned
2010-12-03 16:03:32 -05:00
Colin Walters
9aadb1d583 cmph: Modify types to use GLib types
The 64 bit #ifdefs is just hackish and broken; e.g. it will fail
on ppc64/linux and WIN64.

Use the GLib typedefs, which I know are more correct.
2010-12-03 16:03:32 -05:00
Colin Walters
6178293a83 Import CMPH 1.0
This will be used for typelib indexing.  See README-CMPH-IMPORT.txt
for more information.
2010-12-03 16:03:31 -05:00
Colin Walters
ff33cc0791 girepository: Consistently prefix internal functions with _
This should better avoid them being exported.  Rename
girepository-parser.la to girepository-internals.la for clarity.
2010-11-16 16:58:39 -05:00
Colin Walters
61e5bdb7ba gitypelib: Extend warning for validation 2010-11-16 15:13:41 -05:00
Colin Walters
f9a3bb7300 Add support for gunichar in typelib
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
2010-11-12 16:00:10 -05:00
Colin Walters
30d5255a03 Add g_object_info_find_signal
This matches g_object_info_find_method, and allows us to add indexing
later.

https://bugzilla.gnome.org/show_bug.cgi?id=633204
2010-11-12 15:35:44 -05:00
Colin Walters
e6bb30500c Export gi_type_tag_get_ffi_type
This is needed by the offsets code, and is generally useful.  We
need to export it for a future patch which won't export symbols
with a leading _.
2010-11-09 17:07:26 -05:00
Colin Walters
307843c55f Switch to nonrecursive make for core (i.e. not tests/)
This is cleaner and faster, and prepares us better for an incoming
import of CMPH.
2010-11-09 13:56:43 -05: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
Owen W. Taylor
7fa7162361 Compute enumeration storage types more accurately
Previously we just were sloppy and didn't bother to accurately compute
signed/unsigned for enumeration types.  But since we expect bindings
to decode a field value or function return value from an integer to
an enumeration they have know whether an integer value is
0xffffffff or -1, so we need to do the full computation.

https://bugzilla.gnome.org/show_bug.cgi?id=629704
2010-11-01 16:38:51 -04:00
Colin Walters
aa154a1776 girepository: Use G_TYPE_TAG_IS_BASIC consistently
This is a preparatory patch for adding a new basic tag.
2010-10-26 10:04:46 -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
Colin Walters
54a1a7be49 girepository: Refactor lookup code
This is a cleanup patch in preparation for future indexing
patches.

The lookup code was a mess trying to mash in the 3 different
cases of name, GType, and index into one mega-function.

Split it up properly, and move the core typelib internal-scanning
bits into gitypelib.c where it belongs.
2010-10-18 12:04:08 -04:00
Colin Walters
8d9a983848 typelib: Don't fail on minor version
Previously we bombed out if the minor version didn't match what
we expected; this was silly since the whole point of the minor
version is to enumerate compatible changes.
2010-10-11 12:41:40 -04:00
Johan Dahlin
b31fdc5152 Improve documentation for g_registered_type_info_get_g_type 2010-10-06 14:27:49 -03:00
Colin Walters
795116b391 dumper: Make g_irepository_dump static when being used in dumper
Otherwise we'll bomb out if CFLAGS contains -Werror.
2010-10-01 12:44:08 -04:00
Colin Walters
26841c0b51 scanner: Don't link to -lgirepository when dumping
This helps us avoid a problematic case where in say jhbuild, using
a system (/usr/lib) glib, adding in -l girepository-1.0 will inject
-L /path/to/builddir, when we don't want that.

https://bugzilla.gnome.org/show_bug.cgi?id=630342
2010-09-30 13:47:25 -04:00