Commit Graph

439 Commits

Author SHA1 Message Date
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
Tomeu Vizoso
9468bd36c9 Actually do something about fundamentals when parsing a .gir
https://bugzilla.gnome.org/show_bug.cgi?id=630710
2010-09-29 15:55:37 +02:00
Pavel Holejsovsky
508edb91ad Fix memory leak. 2010-09-25 11:32:28 -03:00
Pavel Holejsovsky
916798b704 Update annotations for GIRepository.Repository.
https://bugzilla.gnome.org/show_bug.cgi?id=628753
2010-09-15 09:48:46 -03:00
Pavel Holejsovsky
c664ffed5f Box GIBaseInfo structure.
This puts it into typelibs and allows to use it safely from scripts.

https://bugzilla.gnome.org/show_bug.cgi?id=628753
2010-09-15 09:48:44 -03:00
Colin Walters
6bc078f1ee typelib compiler: Passthrough <doc> at any point
This should have been in the previous commit.
2010-09-14 12:31:58 -04:00
Johan Dahlin
2e360c3fb7 [girepository] Add a missing include 2010-09-07 15:51:55 -03:00
Joe Marcus Clarke
09afe7361d [girepository] Support strict align platforms
Such as Sparc64.

https://bugzilla.gnome.org/show_bug.cgi?id=620769
2010-09-07 11:42:49 -03:00
Tomeu Vizoso
30922b36c1 Remove extra lines from the license comment 2010-09-06 11:23:01 +02:00
Steve Frécinaux
8548baf3b9 [VFuncBlob] Unknown struct offset should be 0xFFFF
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
2010-09-06 08:33:40 +02:00