Commit Graph

297 Commits

Author SHA1 Message Date
Johan Dahlin
7a383b6126 [girepository] Correct GI_IS_ENUM_INFO macro
A GIEnumInfo represents either an enum or a set of flags
2010-05-30 21:56:25 -03:00
Johan Dahlin
58ac4f880a [ginfo] Document enum and enum values
Document GIEnumInfo and GIValueInfo
2010-05-30 21:55:55 -03:00
Johan Dahlin
81a263edfe [info] Fix-up prototype indentation 2010-05-30 21:55:45 -03:00
Johan Dahlin
a6c822d505 [build] Remove gcov support
It's been broken for some time, remove it instead of letting
it bitrot.
2010-05-28 20:49:54 -03:00
Johan Dahlin
3bab700cd4 [doc] Document GIErrorDomainInfo methods 2010-05-28 20:49:39 -03:00
Johan Dahlin
c2b89be46e [GITypeInfo] Document and check type
Document GITypeInfo and check the info type in all functions.
2010-05-28 13:47:48 -03:00
Johan Dahlin
a8eff27124 Remove leftover function 2010-05-28 08:49:49 -03:00
Johan Dahlin
27c9f77335 [girepository] Check types function/callable/arg
Check the info types for functions, callable and args.
Verifies that the right type is sent in
2010-05-27 23:25:36 -03:00
Johan Dahlin
e66f46042d [girepository] Add macros for checking struct type
Add macros for checking the sub-struct type. These are
similar to the standard GObject macros.
2010-05-27 23:18:58 -03:00
Colin Walters
23e9949e1d Remove g_arg_info_is_dipper from public API
It wasn't useful, the new g_arg_info_is_caller_allocates is.
2010-05-26 18:14:39 -04:00
Colin Walters
a20c2ad7c2 [girparser] Don't hard require caller-allocates since it breaks parsing
We need to support parsing older .girs for inclusion purposes.  (But
we should probably have an explicit .gir version, and require the
attribute for newer versions)
2010-05-26 13:53:29 -04:00
Colin Walters
46d9ef151e Support (out caller-allocates)
People have wanted support for marking (out) on functions of the
form:

/**
 * clutter_color_from_pixel:
 * @pixel: A pixel
 * @color: (out): Color to initialize with value of @pixel
 */
void
clutter_color_from_pixel (guint32 pixel, ClutterColor *color);

Where the caller is supposed to have allocated the argument; the
C function just initializes it.  This patch adds support for this
argument passing style to introspection.  In this case, we see the
(out), and notice that there's only a single indirection (*) on
the argument, and assume that this means (out caller-allocates).

https://bugzilla.gnome.org/show_bug.cgi?id=604749
2010-05-26 13:00:56 -04:00
Johan Dahlin
9505b6eb44 [docs] Document GICallableInfo and GIArgInfo
Make docs more consistent and also fix a couple of broken links
2010-05-21 18:30:58 -03:00
Johan Dahlin
7e2e379388 [girepository] Use g_slice
Use g_slice to allocate instead of g_new(x, 1); It uses a memory
pool internally and should be faster, especially for GBaseInfo/GRealInfo,
structs which are tiny.
2010-05-20 11:41:44 -03:00
Johan Dahlin
cc270b03d6 [docs] Make gtk-doc language consistent.
Make the language we use in the gtk-doc comments
more consistent. Add transfer annotation for all functions
returning a struct and mention how they should be freed.
2010-05-19 20:57:19 -03:00
Johan Dahlin
c94b539788 [GIFunctionInfo] Document struct and functions 2010-05-19 13:54:26 -03:00
Johan Dahlin
3e473d93ca [docs] Reference g_module_open instead of dlopen
dlopen() is not cross platform, it's better to mention
g_module_open everywhere as that's actually what we call internally.
2010-05-19 13:53:48 -03:00
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