Commit Graph

380 Commits

Author SHA1 Message Date
Simon McVittie
456379be29 girparser: backtrace_stderr: fix int/ssize_t format mismatch
backtrace() is defined in terms of int, which differs from ssize_t on
x86-64, and @size is also an int.
2010-05-19 16:17:06 +01:00
Johan Dahlin
75c9df12f1 [GIBaseInfo] Document all functions 2010-05-18 23:40:24 -03:00
Johan Dahlin
51118b3338 [girepository] Document most of the structs 2010-05-18 18:11:58 -03:00
Johan Dahlin
9f4cadec60 [girepository] Update gtk-doc syntax
Update the gtk-doc syntax to remove a couple of warnings
2010-05-18 18:11:57 -03:00
Tomeu Vizoso
c9213eaea3 Add support for GArrays: add g_type_info_get_array_type() and properly scan GArray args
Based on a previous patch by C. Scott Ananian <cscott@litl.com>

https://bugzilla.gnome.org/show_bug.cgi?id=581687
2010-05-04 16:58:15 +02:00
Tomeu Vizoso
1301850f3d Revert "Add support for GArrays: add g_type_info_get_array_type() and properly scan GArray args"
This reverts commit 87291e08b0fd34b62e1ad9811c174108b38311a9.
2010-05-03 19:17:00 +02:00
Tomeu Vizoso
e12cea0a53 Add support for GArrays: add g_type_info_get_array_type() and properly scan GArray args
Based on a previous patch by C. Scott Ananian <cscott@litl.com>

https://bugzilla.gnome.org/show_bug.cgi?id=581687
2010-04-30 18:15:23 +02:00
Owen W. Taylor
9d2fd90f0a Correctly use ffi_closure_alloc(), fixing mmap permissions error
This restores the reverted-commit ed8634d:

    Author: Dan Winship <danw@gnome.org>
    Date:   Mon Apr 5 14:05:52 2010 -0400

    g_callable_info_prepare_closure: handle mmap permissions error

    When SELinux or similar is active, a process may not be able to mmap()
    a segment that is both writable and executable, which would causing
    g_callable_info_prepare_closure() to fail. Libffi has a workaround for
    this problem though (it maps the same non-anonymous region twice, once
    writable and once executable, and returns two separate pointers to
    it), so use that.

But with an added fix, when using ffi_closure_alloc(), we need to use
ffi_prep_closure_loc() so we can pass in the executable address of the
trampoline separately from the writable address, rather than the
deprecated ffi_prep_closure().

https://bugzilla.gnome.org/show_bug.cgi?id=615105
2010-04-08 10:50:04 -04:00
Colin Walters
6545640515 Revert "g_callable_info_prepare_closure: handle mmap permissions error"
This reverts commit ed8634ddf73a56cb1935fd87254b3c6c04352893.

This commit caused crashes in gjs/gnome-shell, which we're still trying
to track down.  See: http://bugzilla.gnome.org/615078
2010-04-07 15:22:00 -04:00
Colin Walters
611929ec55 [giroffsets] Also update this code for change to signed enumeration values 2010-04-07 11:29:55 -04:00
Dan Winship
24363834ff g_callable_info_prepare_closure: handle mmap permissions error
When SELinux or similar is active, a process may not be able to mmap()
a segment that is both writable and executable, which would causing
g_callable_info_prepare_closure() to fail. Libffi has a workaround for
this problem though (it maps the same non-anonymous region twice, once
writable and once executable, and returns two separate pointers to
it), so use that.

https://bugzilla.gnome.org/show_bug.cgi?id=614903
2010-04-06 08:33:54 -04:00
Johan Dahlin
14f13c1760 Add support for foreign structs
Foreign structs are special in the sense that there might
be native bindings (for instance PyCairo for PyGI) that provides
the same functionallity as the introspected variant.

https://bugzilla.gnome.org/show_bug.cgi?id=610357
2010-03-25 23:12:12 -03:00
Johan Dahlin
3b91df6678 [typelib] Remove space/indent mismatch 2010-03-25 09:23:12 -03:00
Johan Dahlin
d9e0c19ce2 Remove unused file girwriter.c 2010-03-25 09:19:25 -03:00
Johan Dahlin
591e740611 Remove trailing whitespace 2010-03-25 09:19:20 -03:00
Johan Dahlin
6b0463dd16 [girepository] Remove trailing whitespace 2010-03-24 15:02:05 -03:00
Colin Walters
a837d99ee6 Enumerations can be negative
Change the internal type for ValueBlob to gint32, since it's perfectly
valid for enumerations to have negative values.

https://bugzilla.gnome.org/show_bug.cgi?id=613203
2010-03-18 09:50:33 -04:00
Colin Walters
30fb514e67 Delete stray g_return_if_fail
If g_alloca failed we're pretty much screwed, and g_return_if_fail
is for API entry points, not internal assertions.
2010-02-11 17:49:51 -05:00
Kedar Sovani
6962d65125 Fix Alignment Errors.
Signed-off-by: Kedar Sovani <kedars@marvell.com>

https://bugzilla.gnome.org/show_bug.cgi?id=606139
2010-02-11 17:31:01 -05:00
Colin Walters
3a8a1d2653 [g-ir-compiler] Slightly less lame error messages
To make things really better we should track the line origin of
element from the .gir file (and actually we need to do better
checking in the scanner), but this is slightly less lame.
2010-02-11 17:18:28 -05:00
Maxim Ermilov
c5319f668d increase limit of GIRealInfo's ref_count
New limit is 0x7FFFFFFF.
2010-01-25 22:08:11 +03:00
Colin Walters
7d5da3d09f Correctly cast to a CommonBlob when looking up embedded types
When looking at an embedded type (e.g. a Callback after a Field), the
offset we put in the info structure was to the CallbackBlob itself.

However the code in g_type_info_get_interface assumed that the offset
was to a SimpleTypeBlob, which it wasn't.

https://bugzilla.gnome.org/show_bug.cgi?id=606180
2010-01-12 17:13:10 -05:00
Johan Dahlin
109159ee05 The private header should be included in girffi.c
Not in the public girffi.h.
2009-12-31 17:37:21 +01:00
Johan Dahlin
be1c2991cf Add missing include girffi-private.h 2009-12-31 15:29:43 +01:00
Colin Walters
e6ac69fccd Allow stack allocating GIBaseInfo, add stack retrieval variants
We don't want to malloc each GIBaseInfo when they can be used in
function invocation; instead, allow stack allocation.

There were a lot of structure typedefs which were actually just
exactly the same as GIBaseInfo, with the one exception of GITypeInfo.

Instead, just put the single GITypeInfo boolean inside GIBaseInfo
as a bit in a bitfield.

GIBaseInfo is still opaque publicly; GIRealInfo is the new
internal structure.

Using this, add new functions to retrieve arguments and argument types
on the stack.

https://bugzilla.gnome.org/show_bug.cgi?id=604074
2009-12-16 18:18:35 -05:00
Colin Walters
f2f0625622 [girffi] Clean up API, add g_function_info_prep_invoker
Rather than having bindings use g_function_info_invoke, which is basically
a toy/demo API, export a convenience utility function which takes the introspection
information and sets up things we need to pass to libffi.

Then invocation can be done directly to libffi by a binding.

As part of this work, remove some (unused by gjs) public functions from the
girffi API, and instead export a function to map to libffi which can work
semi-correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=604074
2009-12-16 18:17:12 -05:00
Colin Walters
3bff396653 Fix compilation warning in ginvoke.c 2009-12-16 18:17:12 -05:00
Javier Jardón
e568b5f9fd Substitute deprecated Glib symbol: g_mapped_file_free
glib-compat.h file created to use g_mapped_file_unref only if
glib >= 2.22 is available

https://bugzilla.gnome.org/show_bug.cgi?id=603727
2009-12-15 11:06:50 -02:00
Saleem Abdulrasool
b50974235b protect on null retval
ffi_call does not protect against retval being NULL, resulting in a segfault.

https://bugzilla.gnome.org/show_bug.cgi?id=604472
2009-12-15 11:01:55 -02:00
Johan Dahlin
954312db60 Revert "GI_TYPE_TAG_VOID != ffi_type_void"
This reverts commit 28cccba737ec2214da66b0d74059278162cf5fd0.
2009-12-15 11:00:52 -02:00
Johan Dahlin
91459565ef Improve the error message 2009-12-09 16:39:47 -02:00
Bastien Nocera
e3cd97d492 Make error more verbose in parser
By printing the function when arguments are missing

https://bugzilla.gnome.org/show_bug.cgi?id=604161
2009-12-09 11:22:24 +00:00
Iain Nicol
c22f11f1b8 Remove some unportable integral type size assumptions
https://bugzilla.gnome.org/show_bug.cgi?id=602762
2009-12-02 10:45:20 -02:00
Jasper Lievisse Adriaanse
a7c04b69de Fix build on OpenBSD
Due to a missing header, gobject-introspection fails to compile on OpenBSD.
And only due to headers-including-headers practice this doesn't blow up on
many other platforms.

https://bugzilla.gnome.org/show_bug.cgi?id=596226
2009-12-02 10:39:31 -02:00
Maxim Ermilov
4b796371ae GI_TYPE_TAG_VOID != ffi_type_void
https://bugzilla.gnome.org/show_bug.cgi?id=603157
2009-12-02 10:37:19 -02:00
Maxim Ermilov
a668ac5303 Plug a leak in g_callable_info_get_ffi_return_type
https://bugzilla.gnome.org/show_bug.cgi?id=603526
2009-12-02 10:19:45 -02:00
Simon van der Linden
46e36632af Add a method to compare infos
Add g_base_info_equal.
2009-11-20 10:40:07 +01:00
Tomeu Vizoso
43f1c2db17 Add g_ir_ffi_convert_arguments 2009-11-12 10:53:45 +01:00
Tomeu Vizoso
03dc6a590b Implement callbacks as part of struct fields. Fixes #557383
gir: embed <callback> inside <field>
typelib: if a field contains a callback, store it just after the FieldBlob
girepository API: no additions
2009-11-11 13:55:00 +01:00
Colin Walters
8ba5a13d17 [gtypelib.h] Document SimpleTypeBlob more 2009-11-04 11:43:13 -05:00
Colin Walters
6b5a358371 Use best known derived parent
In the case where a known class derives from a hidden one, we want
to use the most-derived parent class, rather than simply falling back
to GObject.

Example:
ShellEmbedWidget in gnome-shell derives from ClutterGLXTexturePixmap from clutter,
which is a hidden class.  ClutterGLXTexturePixmap's parent itself is
ClutterX11TexturePixmap, which is also hidden.  But its parent is
ClutterTexture, which we do know.  Use that.

https://bugzilla.gnome.org/show_bug.cgi?id=598993
2009-10-21 14:19:26 -04:00
Colin Walters
7e7f7599b9 Correctly ref repository in GIUnresolvedInfo
Followup to previous patch.
2009-09-04 17:02:14 -04:00
Colin Walters
5f6b975d87 Bug 593322 - Fix unref of GIUnresolvedInfo instances
We are treating GIUnresolvedInfo as a GIBaseInfo, but the structures
had drifted out of sync.  Add a repository pointer and bring them
back into sync.

Based on a report and patch from Jan Hudec <bulb@ucw.cz>
2009-09-04 16:52:35 -04:00
Colin Walters
1735ebde9a [typelib] Clean up dlopen handling
It's was busted that g_typelib_new_* does the dlopen() since that caused
g-ir-compiler to load the modules even though it wasn't going to do
anything with them.

Instead, change things so that g_module_symbol does the dlopen on-demand.
Remove the extra dlopen(NULL) inside girepository.c, we had another
already in gtypelib.c.

Thanks to Owen Taylor for suggesting this approach.
2009-08-19 11:05:08 -04:00
Owen W. Taylor
90de854ee5 Don't open shared libraries twice
If loading a referenced shared library succeeds, don't try loading it again.

http://bugzilla.gnome.org/show_bug.cgi?id=591737
2009-08-13 15:56:04 -04:00
Owen W. Taylor
46d5a2392d Fix checks in gfield.c
When checking if the readable/writable flags are missing for the fields
we are trying to read and write, use (a & flag) == 0, not (!a & flag).

http://bugzilla.gnome.org/show_bug.cgi?id=579727
2009-07-09 11:06:20 +01:00
Dan Winship
933fcbc88c Sync the basic types array in girnode.c:serialize_type with GITypeTag
Fixes a crash compiling GIRepository-2.0.gir.

http://bugzilla.gnome.org/show_bug.cgi?id=587823
2009-07-06 11:32:41 -04:00
Tobias Mueller
65e241fab8 Name unions to enable compilation on Solaris
Patch by Brian Cameron <brian.cameron@sun.com>.
Fixes bug 578199.
2009-06-24 23:52:05 +02:00
Mark Lee
378350f3a9 Bug 584423 – Add short/ushort support
Add type tags for short and ushort, plus all of the requisite code needed
to utilize them in libgirepository.
Add support in the scanner's AST files.
Add test functions to the everything library and the expected gir file.

gtypelib.c constant validation fixed by Colin Walters <walters@verbum.org>
2009-06-22 14:01:56 -04:00
Simon van der Linden
0a046b7aa0 Bug 585328 - Only set zero_terminated flag for types we know are
Rationalize our setting of the zero_terminated flag; we shouldn't
set it if the gir doesn't say to.
2009-06-17 17:32:48 -04:00