Commit Graph

19 Commits

Author SHA1 Message Date
Emmanuele Bassi
4dbd25b033 Rename argument in the declation
It must match the argument in the definition and the documentation.
2022-02-13 14:41:48 +00:00
Emmanuele Bassi
edbd878523 Use the proper private triglyph
It's `/*< ... >*/`, not `/* <...> */`.
2022-02-13 14:20:03 +00:00
Philip Chimento
b68a03b9b6 girffi: Add gi_type_tag_extract_ffi_return_value()
This new API does the same thing as gi_type_info_extract_ffi_return_value,
but takes a GITypeTag instead of GITypeInfo pointer, and additionally a
GIInfoType if the GITypeTag is GI_TYPE_TAG_INTERFACE. (These pieces of
data are the only things used from the GITypeInfo structure.)

It's intended for bindings using an argument cache, such as GJS and
PyGObject, so that they don't have to store a whole 64-bit GITypeInfo
pointer in their cache in many common cases, and can just store the 5-bit
type tag instead, or the 5-bit interface type in case of
GI_TYPE_TAG_INTERFACE.

The original gi_type_info_extract_ffi_return_value() is reimplemented in
terms of the new gi_type_tag_extract_ffi_return_value().
2022-02-13 12:25:18 +00:00
Cimbali
8e96029a32 Create new API for libffi closures
Deprecate the previous API as per discussion in !283.
2021-11-23 23:04:26 +00:00
Sergei Trofimovich
5e053279b5 girffi.h: add g_callable_info_get_closure_native_address() API
Commit 6bab939bf ("girffi.c: fix return value for g_callable_info_prepare_closure()")
effectively changes semantics of return value from code pointer to data pinter (closure).

`gjs` (and probably other software) relies on old (incorrect) semantics of
g_callable_info_prepare_closure(): https://gitlab.gnome.org/GNOME/gjs/-/issues/428

This change exposes the API that allows extracting directly
callacble code pointer. `gjs` will have to adapt to the new API.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2021-11-23 23:04:26 +00:00
Chun-wei Fan
265ea792c1 girepository: Add Header for Version Macros
This adds a header to the girepository library, which is then included
either directly or indirectly by the other headers so that all the public
symbols (and the 2 symbols in gitypelib-internal.h used by the tools) are
decorated by a macro, that can later be used to export the symbols and also
to be used to display compile-time warnings for usage of deprecated APIs,
which is like what is now being done in GLib (and GTK+, Clutter, and so
on).

This marks the first step that we begin to stop depending on the .symbols/
.def files to export the symbols.

https://bugzilla.gnome.org/show_bug.cgi?id=732669
2014-08-15 09:45:41 +08:00
Dieter Verfaillie
bb7f8d57c2 docs: fix up reference docs a bit
- require GTK-Doc 1.19
      - remove sgml mode
      - automatically generate gi.types (needs GTK-Doc 1.19)
      - fix https://bugzilla.gnome.org/show_bug.cgi?id=700025
[WIP] - rearange sections a bit
[WIP] - add gi-building, gi-programming sections
[WIP] - mark missing docs with TODO, which is only marginaly
        better than nothing but at least can be grepped :)

https://bugzilla.gnome.org/show_bug.cgi?id=571648
2013-10-10 16:48:51 -04:00
Colin Walters
4b71be0ef0 repository: Add new public gi_type_info_extract_ffi_return_value() API
Dealing with FFI and return values is very tricky; this API allows
sharing the bits to do it between gobject-introspection and gjs (and
potentially other FFI binding consumers).

**NOTE** I swapped the order of the arguments, under the premise that
out arguments should generally be last.

https://bugzilla.gnome.org/show_bug.cgi?id=668902
2012-03-05 09:56:56 -05:00
Colin Walters
e865dcb7b4 Add Emacs mode lines to C sources 2012-02-03 13:42:56 -05:00
Jasper St. Pierre
a0d19ca066 girffi: Add new g_function_invoker_new_for_address
This is a new method designed to make a GIFunctionInvoker for
any GICallableInfo*, for bindings to use.
2012-02-03 11:52:33 -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
Johan Dahlin
51118b3338 [girepository] Document most of the structs 2010-05-18 18:11:58 -03:00
Johan Dahlin
6b0463dd16 [girepository] Remove trailing whitespace 2010-03-24 15:02:05 -03: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
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
Tomeu Vizoso
43f1c2db17 Add g_ir_ffi_convert_arguments 2009-11-12 10:53:45 +01:00
Johan Dahlin
314ad462dc Add utility functions for invocing closures given a GICallableInfo using
2009-02-04  Johan Dahlin  <jdahlin@async.com.br>

    * girepository/Makefile.am:
    * girepository/girffi.c (g_callable_info_get_ffi_arg_types),
    (g_callable_info_get_ffi_return_type),
    (g_callable_info_prepare_closure), (g_callable_info_free_closure):
    * girepository/girffi.h:
    Add utility functions for invocing closures given a GICallableInfo
    using libffi.


svn path=/trunk/; revision=1084
2009-02-05 00:40:14 +00:00
Owen Taylor
d041deae59 Split g_ir_ffi_get_ffi_type() out from ginvoke.c
Extract a function to convert GITypeTag to ffi_type from the internals
of ginvoke.c. This will be useful in figure out structure alignment.

Also fix handling of gsize and time_t to be portable. (Add a check
to configure.ac to figure out the width of time_t.)

svn path=/trunk/; revision=873
2008-11-11 00:04:45 +00:00