summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2020-09-18 14:42:17 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2020-09-18 14:42:17 +0900
commitf7e31cb0df3fe34fe3a5431f07eb2152d03e693e (patch)
tree17185140b6cc69f47582e97d3b331aef295b0b5a
parent429279dc364bf678b2989cb8c344a3bfddeccaac (diff)
downloadgobject-introspection-f7e31cb0df3fe34fe3a5431f07eb2152d03e693e.tar.gz
gobject-introspection-f7e31cb0df3fe34fe3a5431f07eb2152d03e693e.tar.bz2
gobject-introspection-f7e31cb0df3fe34fe3a5431f07eb2152d03e693e.zip
Imported Upstream version 1.66.0upstream/1.66.0
-rw-r--r--MSVC.README.rst9
-rw-r--r--NEWS23
-rw-r--r--docs/g-ir-compiler.12
-rw-r--r--docs/g-ir-generate.12
-rw-r--r--docs/g-ir-scanner.12
-rw-r--r--docs/reference/gi-struct-hierarchy.xml4
-rw-r--r--docs/website/tools/g-ir-compiler.rst2
-rw-r--r--docs/website/tools/g-ir-generate.rst2
-rw-r--r--docs/website/tools/g-ir-scanner.rst2
-rw-r--r--docs/website/users.rst2
-rw-r--r--docs/website/writingbindableapis.rst9
-rw-r--r--gir/gio-2.0.c402
-rw-r--r--gir/glib-2.0.c1605
-rw-r--r--gir/gobject-2.0.c72
-rw-r--r--gir/meson.build28
-rw-r--r--girepository/cmph/meson.build2
-rw-r--r--girepository/gi-dump-types.c21
-rw-r--r--girepository/giobjectinfo.c30
-rw-r--r--girepository/girepository.c2
-rw-r--r--girepository/girparser.c3
-rw-r--r--girepository/gitypeinfo.c170
-rw-r--r--girepository/gitypeinfo.h12
-rw-r--r--girepository/giversionmacros.h6
-rw-r--r--girepository/meson.build7
-rw-r--r--giscanner/annotationparser.py81
-rw-r--r--giscanner/ast.py5
-rw-r--r--giscanner/ccompiler.py14
-rw-r--r--giscanner/dumper.py4
-rw-r--r--giscanner/girparser.py6
-rw-r--r--giscanner/girwriter.py9
-rw-r--r--giscanner/maintransformer.py65
-rw-r--r--giscanner/msvccompiler.py22
-rw-r--r--giscanner/sectionparser.py2
-rw-r--r--giscanner/utils.py2
-rw-r--r--gobject-introspection-1.0.pc.in24
-rw-r--r--gobject-introspection-no-export-1.0.pc.in23
-rw-r--r--gobject-introspection.doap2
-rw-r--r--meson.build101
-rw-r--r--meson_options.txt4
-rw-r--r--tests/gimarshallingtests.c58
-rw-r--r--tests/gimarshallingtests.h38
-rw-r--r--tests/meson.build10
-rw-r--r--tests/repository/meson.build10
-rw-r--r--tests/scanner/Regress-1.0-C-expected/Regress.AnnotationFields-field4.page14
-rw-r--r--tests/scanner/Regress-1.0-C-expected/Regress.standalone_section.page15
-rw-r--r--tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationBitfield.page4
-rw-r--r--tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationFields-field4.page18
-rw-r--r--tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationFields.page1
-rw-r--r--tests/scanner/Regress-1.0-Gjs-expected/Regress.standalone_section.page15
-rw-r--r--tests/scanner/Regress-1.0-Python-expected/Regress.AnnotationBitfield.page4
-rw-r--r--tests/scanner/Regress-1.0-Python-expected/Regress.AnnotationFields-field4.page14
-rw-r--r--tests/scanner/Regress-1.0-Python-expected/Regress.standalone_section.page15
-rw-r--r--tests/scanner/Regress-1.0-expected.gir217
-rw-r--r--tests/scanner/Regress-1.0-sections-expected.txt3
-rw-r--r--tests/scanner/annotation.h17
-rw-r--r--tests/scanner/annotationparser/gi/identifier_section.xml34
-rw-r--r--tests/scanner/annotationparser/test_patterns.py154
-rw-r--r--tests/scanner/foo.c7
-rw-r--r--tests/scanner/meson.build40
-rw-r--r--tests/warn/meson.build8
-rwxr-xr-xtools/g-ir-tool-template.in9
-rw-r--r--tools/meson.build14
62 files changed, 2881 insertions, 621 deletions
diff --git a/MSVC.README.rst b/MSVC.README.rst
index d8941de4..ec5ddb56 100644
--- a/MSVC.README.rst
+++ b/MSVC.README.rst
@@ -109,3 +109,12 @@ the following so that we ensure the manifests are embedded to the built DLLs and
for /r %f in (*.dll.manifest) do if exist $(PREFIX)\bin\%~nf mt /manifest %f /outputresource:$(PREFIX)\bin\%~nf;2
for /r %f in (*.exe.manifest) do if exist $(PREFIX)\bin\%~nf mt /manifest %f /outputresource:$(PREFIX)\bin\%~nf;1
+
+Additional notes on using clang-cl (LLVM/CLang's Visual Studio compiler emulation)
+----------------------------------------------------------------------------------
+Support has been added to build GObject-Introspection with clang-cl, specifically for
+running g-ir-scanner with clang-cl and lld-link as the compiler and linker. To enable
+such support, you need to set *both* the environment variables CC and CXX to clang-cl
+prior to building GObject-Introspection or running g-ir-scanner. This is in line with
+building with clang-cl in place of using the stock Visual Studio compiler to perform
+builds with the Meson build system.
diff --git a/NEWS b/NEWS
index ffe77b8a..958b08c9 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,26 @@
+1.66.0 - 2020-09-12
+-------------------
+
+* Support the gtk-doc action syntax :mr:`203`
+* Meson fixes with glib and/or g-i is a subproject :mr:`206` :mr:`208`
+* GITypeInfo storage type utility API :mr:`205`
+* Meson: Fix build as subproject :mr:`214`
+* Fixing XDG_DATA_DIRS logic :mr:`215`
+* libgirepository: Add a couple missing nullable annotations :mr:`217` :mr:`225`
+* dumper: Fix missing symbols in LTO case or with overridden symbol visibility settings :mr:`216`
+* Documentation improvements: :mr:`220` :mr:`232`
+* Remove old autoconf fallback code for the python tools :mr:`221`
+* meson: Rename option `gi_cross_use_{host -> prebuilt}_gi` mr:`211`
+* meson: Don't override finding executables when using pre-built tools. :mr:`212`
+* meson: gir: add a dependency for g-ir-compiler for building .girs :mr:`228`
+* meson: Use pkgconfig generator :mr:`207`
+* Fix gi-dump-types.c to build on Windows :mr:`218`
+* giscanner: parse block comments for members and fields :mr:`230`
+* Add the notion of standalone doc sections :mr:`226`
+* giscanner: Add support for using clang-cl :mr:`234`
+* giscanner: Fix section matching for documentation :mr:`237`
+
+
1.64.1 - 2020-04-05
-------------------
diff --git a/docs/g-ir-compiler.1 b/docs/g-ir-compiler.1
index 48dc5ceb..f3eda03c 100644
--- a/docs/g-ir-compiler.1
+++ b/docs/g-ir-compiler.1
@@ -72,7 +72,7 @@ Show program\(aqs version number and exit
Report bugs at \fI\%https://gitlab.gnome.org/GNOME/gobject\-introspection/issues\fP
.SH HOMEPAGE AND CONTACT
.sp
-\fI\%http://live.gnome.org/GObjectIntrospection\fP
+\fI\%https://gi.readthedocs.io/\fP
.SH AUTHORS
.sp
Mattias Clasen
diff --git a/docs/g-ir-generate.1 b/docs/g-ir-generate.1
index 038d171f..f05a295a 100644
--- a/docs/g-ir-generate.1
+++ b/docs/g-ir-generate.1
@@ -58,7 +58,7 @@ Show program\(aqs version number and exit
Report bugs at \fI\%https://gitlab.gnome.org/GNOME/gobject\-introspection/issues\fP
.SH HOMEPAGE AND CONTACT
.sp
-\fI\%http://live.gnome.org/GObjectIntrospection\fP
+\fI\%https://gi.readthedocs.io/\fP
.SH AUTHORS
.sp
Mattias Clasen
diff --git a/docs/g-ir-scanner.1 b/docs/g-ir-scanner.1
index 528bed5c..d25f321b 100644
--- a/docs/g-ir-scanner.1
+++ b/docs/g-ir-scanner.1
@@ -177,7 +177,7 @@ generating introspection data in a cross-compilation environment.
Report bugs at \fI\%https://gitlab.gnome.org/GNOME/gobject\-introspection/issues\fP
.SH HOMEPAGE AND CONTACT
.sp
-\fI\%http://live.gnome.org/GObjectIntrospection\fP
+\fI\%https://gi.readthedocs.io/\fP
.SH AUTHORS
.sp
Johan Dahlin
diff --git a/docs/reference/gi-struct-hierarchy.xml b/docs/reference/gi-struct-hierarchy.xml
index 685f85aa..7d40e053 100644
--- a/docs/reference/gi-struct-hierarchy.xml
+++ b/docs/reference/gi-struct-hierarchy.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
diff --git a/docs/website/tools/g-ir-compiler.rst b/docs/website/tools/g-ir-compiler.rst
index 5c17a7ce..28ca44aa 100644
--- a/docs/website/tools/g-ir-compiler.rst
+++ b/docs/website/tools/g-ir-compiler.rst
@@ -62,7 +62,7 @@ Report bugs at https://gitlab.gnome.org/GNOME/gobject-introspection/issues
HOMEPAGE and CONTACT
====================
-http://live.gnome.org/GObjectIntrospection
+https://gi.readthedocs.io/
AUTHORS
diff --git a/docs/website/tools/g-ir-generate.rst b/docs/website/tools/g-ir-generate.rst
index 931ee449..0b0c8fe0 100644
--- a/docs/website/tools/g-ir-generate.rst
+++ b/docs/website/tools/g-ir-generate.rst
@@ -48,7 +48,7 @@ Report bugs at https://gitlab.gnome.org/GNOME/gobject-introspection/issues
HOMEPAGE and CONTACT
====================
-http://live.gnome.org/GObjectIntrospection
+https://gi.readthedocs.io/
AUTHORS
diff --git a/docs/website/tools/g-ir-scanner.rst b/docs/website/tools/g-ir-scanner.rst
index fc6abe3e..e8df7457 100644
--- a/docs/website/tools/g-ir-scanner.rst
+++ b/docs/website/tools/g-ir-scanner.rst
@@ -166,7 +166,7 @@ Report bugs at https://gitlab.gnome.org/GNOME/gobject-introspection/issues
HOMEPAGE and CONTACT
====================
-http://live.gnome.org/GObjectIntrospection
+https://gi.readthedocs.io/
AUTHORS
diff --git a/docs/website/users.rst b/docs/website/users.rst
index 6d651092..c2faf51b 100644
--- a/docs/website/users.rst
+++ b/docs/website/users.rst
@@ -14,7 +14,7 @@ Bindings based on GObject-Introspection
* `JGIR <https://wiki.gnome.org/Projects/JGIR>`__ - Java/JVM bindings (compile time, using typelib)
* `GJS <https://wiki.gnome.org/Projects/Gjs>`__ - Javascript (spidermonkey) bindings (runtime)
* `Seed <https://wiki.gnome.org/Projects/Seed>`__ - Javascript (JSCore, WebKit JS engine) bindings (runtime)
-* `sbank <http://live.gnome.org/sbank>`__ - Scheme binding for gobject-introspection (runtime)
+* `sbank <https://wiki.gnome.org/sbank>`__ - Scheme binding for gobject-introspection (runtime)
* `GObjectIntrospection/GObjectConsume <https://wiki.gnome.org/Projects/GObjectIntrospection/GObjectConsume>`__ - Qt bindings (compile time)
* `GirFFI <http://github.com/mvz/ruby-gir-ffi>`__ - Ruby bindings (runtime)
* `Ruby-GNOME <https://github.com/ruby-gnome/ruby-gnome>`__ - Ruby bindings (runtime)
diff --git a/docs/website/writingbindableapis.rst b/docs/website/writingbindableapis.rst
index 9ab11b47..70d3bbc7 100644
--- a/docs/website/writingbindableapis.rst
+++ b/docs/website/writingbindableapis.rst
@@ -141,6 +141,15 @@ Error domain quarks should always be named in the form
GQuark foo_bar_errors_quark();
+Don't have properties and methods with the same name
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Some bindings for dynamic languages expose GObject properties and methods in the
+same way, as properties on an object instance. So don't make a GObject property
+with the same name as a method, e.g. a property named ``add-feature`` on a class
+named ``SoupSession`` which also has a method ``soup_session_add_feature()``.
+
+
Custom code in constructors
~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/gir/gio-2.0.c b/gir/gio-2.0.c
index 2d4e7bac..646a759a 100644
--- a/gir/gio-2.0.c
+++ b/gir/gio-2.0.c
@@ -1582,7 +1582,7 @@
* GDtlsClientConnection:validation-flags:
*
* What steps to perform when validating a certificate received from
- * a server. Server certificates that fail to validate in all of the
+ * a server. Server certificates that fail to validate in any of the
* ways indicated here will be rejected unless the application
* overrides the default via #GDtlsConnection::accept-certificate.
*
@@ -1649,7 +1649,7 @@
/**
- * GDtlsConnection:advertised-protocols:
+ * GDtlsConnection:advertised-protocols: (nullable)
*
* The list of application-layer protocols that the connection
* advertises that it is willing to speak. See
@@ -1680,7 +1680,7 @@
/**
- * GDtlsConnection:database:
+ * GDtlsConnection:database: (nullable)
*
* The certificate database to use when verifying this TLS connection.
* If no certificate database is set, then the default database will be
@@ -1691,7 +1691,7 @@
/**
- * GDtlsConnection:interaction:
+ * GDtlsConnection:interaction: (nullable)
*
* A #GTlsInteraction object to be used when the connection or certificate
* database need to interact with the user. This will be used to prompt the
@@ -1712,12 +1712,11 @@
/**
- * GDtlsConnection:peer-certificate:
+ * GDtlsConnection:peer-certificate: (nullable)
*
* The connection's peer's certificate, after the TLS handshake has
- * completed and the certificate has been accepted. Note in
- * particular that this is not yet set during the emission of
- * #GDtlsConnection::accept-certificate.
+ * completed or failed. Note in particular that this is not yet set
+ * during the emission of #GDtlsConnection::accept-certificate.
*
* (You can watch for a #GObject::notify signal on this property to
* detect when a handshake has occurred.)
@@ -1729,7 +1728,7 @@
/**
* GDtlsConnection:peer-certificate-errors:
*
- * The errors noticed-and-ignored while verifying
+ * The errors noticed while verifying
* #GDtlsConnection:peer-certificate. Normally this should be 0, but
* it may not be if #GDtlsClientConnection:validation-flags is not
* %G_TLS_CERTIFICATE_VALIDATE_ALL, or if
@@ -2246,7 +2245,7 @@
* @removed: the number of items removed
* @added: the number of items added
*
- * Emitted when a change has occured to the menu.
+ * Emitted when a change has occurred to the menu.
*
* The only changes that can occur to a menu is that items are removed
* or added. Items may not change (except by being removed and added
@@ -2383,7 +2382,7 @@
/**
* GMountOperation::show-unmount-progress:
* @op: a #GMountOperation:
- * @message: string containing a mesage to display to the user
+ * @message: string containing a message to display to the user
* @time_left: the estimated time left before the operation completes,
* in microseconds, or -1
* @bytes_left: the amount of bytes to be written before the operation
@@ -3562,7 +3561,7 @@
* GThreadedSocketService::run:
* @service: the #GThreadedSocketService.
* @connection: a new #GSocketConnection object.
- * @source_object: the source_object passed to g_socket_listener_add_address().
+ * @source_object: (nullable): the source_object passed to g_socket_listener_add_address().
*
* The ::run signal is emitted in a worker thread in response to an
* incoming connection. This thread is dedicated to handling
@@ -3724,7 +3723,7 @@
* GTlsClientConnection:validation-flags:
*
* What steps to perform when validating a certificate received from
- * a server. Server certificates that fail to validate in all of the
+ * a server. Server certificates that fail to validate in any of the
* ways indicated here will be rejected unless the application
* overrides the default via #GTlsConnection::accept-certificate.
*
@@ -3791,7 +3790,7 @@
/**
- * GTlsConnection:advertised-protocols:
+ * GTlsConnection:advertised-protocols: (nullable)
*
* The list of application-layer protocols that the connection
* advertises that it is willing to speak. See
@@ -3825,7 +3824,7 @@
/**
- * GTlsConnection:database:
+ * GTlsConnection:database: (nullable)
*
* The certificate database to use when verifying this TLS connection.
* If no certificate database is set, then the default database will be
@@ -3836,7 +3835,7 @@
/**
- * GTlsConnection:interaction:
+ * GTlsConnection:interaction: (nullable)
*
* A #GTlsInteraction object to be used when the connection or certificate
* database need to interact with the user. This will be used to prompt the
@@ -3857,12 +3856,11 @@
/**
- * GTlsConnection:peer-certificate:
+ * GTlsConnection:peer-certificate: (nullable)
*
* The connection's peer's certificate, after the TLS handshake has
- * completed and the certificate has been accepted. Note in
- * particular that this is not yet set during the emission of
- * #GTlsConnection::accept-certificate.
+ * completed or failed. Note in particular that this is not yet set
+ * during the emission of #GTlsConnection::accept-certificate.
*
* (You can watch for a #GObject::notify signal on this property to
* detect when a handshake has occurred.)
@@ -3874,7 +3872,7 @@
/**
* GTlsConnection:peer-certificate-errors:
*
- * The errors noticed-and-ignored while verifying
+ * The errors noticed while verifying
* #GTlsConnection:peer-certificate. Normally this should be 0, but
* it may not be if #GTlsClientConnection:validation-flags is not
* %G_TLS_CERTIFICATE_VALIDATE_ALL, or if
@@ -4736,7 +4734,7 @@
* arguments are passed through platform communication to the already
* running program. The already running instance of the program is
* called the "primary instance"; for non-unique applications this is
- * the always the current instance. On Linux, the D-Bus session bus
+ * always the current instance. On Linux, the D-Bus session bus
* is used for communication.
*
* The use of #GApplication differs from some other commonly-used
@@ -5056,6 +5054,7 @@
* GTask *task;
*
* task = g_task_new (initable, cancellable, callback, user_data);
+ * g_task_set_name (task, G_STRFUNC);
*
* switch (self->priv->state)
* {
@@ -5356,22 +5355,26 @@
* #GUnixCredentialsMessage, g_unix_connection_send_credentials() and
* g_unix_connection_receive_credentials() for details.
*
- * On Linux, the native credential type is a struct ucred - see the
+ * On Linux, the native credential type is a `struct ucred` - see the
* unix(7) man page for details. This corresponds to
* %G_CREDENTIALS_TYPE_LINUX_UCRED.
*
+ * On Apple operating systems (including iOS, tvOS, and macOS),
+ * the native credential type is a `struct xucred`.
+ * This corresponds to %G_CREDENTIALS_TYPE_APPLE_XUCRED.
+ *
* On FreeBSD, Debian GNU/kFreeBSD, and GNU/Hurd, the native
- * credential type is a struct cmsgcred. This corresponds
+ * credential type is a `struct cmsgcred`. This corresponds
* to %G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED.
*
- * On NetBSD, the native credential type is a struct unpcbid.
+ * On NetBSD, the native credential type is a `struct unpcbid`.
* This corresponds to %G_CREDENTIALS_TYPE_NETBSD_UNPCBID.
*
- * On OpenBSD, the native credential type is a struct sockpeercred.
+ * On OpenBSD, the native credential type is a `struct sockpeercred`.
* This corresponds to %G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED.
*
* On Solaris (including OpenSolaris and its derivatives), the native
- * credential type is a ucred_t. This corresponds to
+ * credential type is a `ucred_t`. This corresponds to
* %G_CREDENTIALS_TYPE_SOLARIS_UCRED.
*/
@@ -6064,7 +6067,7 @@
*
* If the #GDrive reports that media isn't automatically detected, one
* can poll for media; typically one should not do this periodically
- * as a poll for media operation is potententially expensive and may
+ * as a poll for media operation is potentially expensive and may
* spin up the drive creating noise.
*
* #GDrive supports starting and stopping drives with authentication
@@ -6264,7 +6267,7 @@
*
* Keys are strings that contain a key namespace and a key name, separated
* by a colon, e.g. "namespace::keyname". Namespaces are included to sort
- * key-value pairs by namespaces for relevance. Keys can be retrived
+ * key-value pairs by namespaces for relevance. Keys can be retrieved
* using wildcards, e.g. "standard::*" will return all of the keys in the
* "standard" namespace.
*
@@ -6689,7 +6692,7 @@
* unreferenced).
*
* For bindings in languages where the native constructor supports
- * exceptions the binding could check for objects implemention %GInitable
+ * exceptions the binding could check for objects implementing %GInitable
* during normal construction and automatically initialize them, throwing
* an exception on failure.
*/
@@ -6849,7 +6852,7 @@
* it are gone.
*
* On the other side, a consumer is expected only to hold references on
- * objects that are currently "user visible", in order to faciliate the
+ * objects that are currently "user visible", in order to facilitate the
* maximum level of laziness in the implementation of the list and to
* reduce the required number of signal connections at a given time.
*
@@ -6919,6 +6922,13 @@
* - Run a garbage collection cycle
* - Try and compress fragmented allocations
* - Exit on idle if the process has no reason to stay around
+ * - Call [`malloc_trim(3)`](man:malloc_trim) to return cached heap pages to
+ * the kernel (if supported by your libc)
+ *
+ * Note that some actions may not always improve system performance, and so
+ * should be profiled for your application. `malloc_trim()`, for example, may
+ * make future heap allocations slower (due to releasing cached heap pages back
+ * to the kernel).
*
* See #GMemoryMonitorWarningLevel for details on the various warning levels.
*
@@ -7583,6 +7593,13 @@
* set to the full path to the gdk-pixbuf-pixdata executable; otherwise the resource compiler will
* abort.
*
+ * `json-stripblanks` which will use the `json-glib-format` command to strip
+ * ignorable whitespace from the JSON file. For this to work, the
+ * `JSON_GLIB_FORMAT` environment variable must be set to the full path to the
+ * `json-glib-format` executable, or it must be in the `PATH`;
+ * otherwise the preprocessing step is skipped. In addition, at least version
+ * 1.6 of `json-glib-format` is required.
+ *
* Resource files will be exported in the GResource namespace using the
* combination of the given `prefix` and the filename from the `file` element.
* The `alias` attribute can be used to alter the filename to expose them at a
@@ -8472,7 +8489,7 @@
* g_socket_address_enumerator_next_finish() should be used where possible.
*
* Each #GSocketAddressEnumerator can only be enumerated once. Once
- * g_socket_address_enumerator_next() has returned %NULL (and no error), further
+ * g_socket_address_enumerator_next() has returned %NULL, further
* enumeration with that #GSocketAddressEnumerator is not possible, and it can
* be unreffed.
*/
@@ -10982,7 +10999,7 @@
*
* Gets the default #GAppInfo for a given content type.
*
- * Returns: (transfer full): #GAppInfo for given @content_type or
+ * Returns: (transfer full) (nullable): #GAppInfo for given @content_type or
* %NULL on error.
*/
@@ -10996,7 +11013,8 @@
* of the URI, up to but not including the ':', e.g. "http",
* "ftp" or "sip".
*
- * Returns: (transfer full): #GAppInfo for given @uri_scheme or %NULL on error.
+ * Returns: (transfer full) (nullable): #GAppInfo for given @uri_scheme or
+ * %NULL on error.
*/
@@ -11994,7 +12012,7 @@
* Gets the application's current busy state, as set through
* g_application_mark_busy() or g_application_bind_busy_property().
*
- * Returns: %TRUE if @application is currenty marked as busy
+ * Returns: %TRUE if @application is currently marked as busy
* Since: 2.44
*/
@@ -14135,7 +14153,8 @@
*
* This operation can fail if #GCredentials is not supported on the
* OS or if the native credentials type does not contain information
- * about the UNIX process ID.
+ * about the UNIX process ID (for example this is the case for
+ * %G_CREDENTIALS_TYPE_APPLE_XUCRED).
*
* Returns: The UNIX process ID, or -1 if @error is set.
* Since: 2.36
@@ -19775,7 +19794,8 @@
* in a GIO module. There is no reason for applications to use it
* directly. Applications should use g_app_info_get_default_for_uri_scheme().
*
- * Returns: (transfer full): #GAppInfo for given @uri_scheme or %NULL on error.
+ * Returns: (transfer full) (nullable): #GAppInfo for given @uri_scheme or
+ * %NULL on error.
* Deprecated: 2.28: The #GDesktopAppInfoLookup interface is deprecated and
* unused by GIO.
*/
@@ -19837,6 +19857,13 @@
* The algorithm for determining matches is undefined and may change at
* any time.
*
+ * None of the search results are subjected to the normal validation
+ * checks performed by g_desktop_app_info_new() (for example, checking that
+ * the executable referenced by a result exists), and so it is possible for
+ * g_desktop_app_info_new() to return %NULL when passed an app ID returned by
+ * this function. It is expected that calling code will do this when
+ * subsequently creating a #GDesktopAppInfo for each result.
+ *
* Returns: (array zero-terminated=1) (element-type GStrv) (transfer full): a
* list of strvs. Free each item with g_strfreev() and free the outer
* list with g_free().
@@ -20103,9 +20130,9 @@
* g_drive_is_media_check_automatic:
* @drive: a #GDrive.
*
- * Checks if @drive is capabable of automatically detecting media changes.
+ * Checks if @drive is capable of automatically detecting media changes.
*
- * Returns: %TRUE if the @drive is capabable of automatically detecting
+ * Returns: %TRUE if the @drive is capable of automatically detecting
* media changes, %FALSE otherwise.
*/
@@ -20396,19 +20423,46 @@
* Gets @conn's certificate, as set by
* g_dtls_connection_set_certificate().
*
- * Returns: (transfer none): @conn's certificate, or %NULL
+ * Returns: (transfer none) (nullable): @conn's certificate, or %NULL
* Since: 2.48
*/
/**
+ * g_dtls_connection_get_channel_binding_data:
+ * @conn: a #GDtlsConnection
+ * @type: #GTlsChannelBindingType type of data to fetch
+ * @data: (out callee-allocates) (optional) (transfer none): #GByteArray is
+ * filled with the binding data, or %NULL
+ * @error: a #GError pointer, or %NULL
+ *
+ * Query the TLS backend for TLS channel binding data of @type for @conn.
+ *
+ * This call retrieves TLS channel binding data as specified in RFC
+ * [5056](https://tools.ietf.org/html/rfc5056), RFC
+ * [5929](https://tools.ietf.org/html/rfc5929), and related RFCs. The
+ * binding data is returned in @data. The @data is resized by the callee
+ * using #GByteArray buffer management and will be freed when the @data
+ * is destroyed by g_byte_array_unref(). If @data is %NULL, it will only
+ * check whether TLS backend is able to fetch the data (e.g. whether @type
+ * is supported by the TLS backend). It does not guarantee that the data
+ * will be available though. That could happen if TLS connection does not
+ * support @type or the binding data is not available yet due to additional
+ * negotiation or input required.
+ *
+ * Returns: %TRUE on success, %FALSE otherwise
+ * Since: 2.66
+ */
+
+
+/**
* g_dtls_connection_get_database:
* @conn: a #GDtlsConnection
*
* Gets the certificate database that @conn uses to verify
* peer certificates. See g_dtls_connection_set_database().
*
- * Returns: (transfer none): the certificate database that @conn uses or %NULL
+ * Returns: (transfer none) (nullable): the certificate database that @conn uses or %NULL
* Since: 2.48
*/
@@ -20421,7 +20475,7 @@
* for things like prompting the user for passwords. If %NULL is returned, then
* no user interaction will occur for this connection.
*
- * Returns: (transfer none): The interaction object.
+ * Returns: (transfer none) (nullable): The interaction object.
* Since: 2.48
*/
@@ -20447,11 +20501,11 @@
* g_dtls_connection_get_peer_certificate:
* @conn: a #GDtlsConnection
*
- * Gets @conn's peer's certificate after the handshake has completed.
- * (It is not set during the emission of
+ * Gets @conn's peer's certificate after the handshake has completed
+ * or failed. (It is not set during the emission of
* #GDtlsConnection::accept-certificate.)
*
- * Returns: (transfer none): @conn's peer's certificate, or %NULL
+ * Returns: (transfer none) (nullable): @conn's peer's certificate, or %NULL
* Since: 2.48
*/
@@ -20461,8 +20515,8 @@
* @conn: a #GDtlsConnection
*
* Gets the errors associated with validating @conn's peer's
- * certificate, after the handshake has completed. (It is not set
- * during the emission of #GDtlsConnection::accept-certificate.)
+ * certificate, after the handshake has completed or failed. (It is
+ * not set during the emission of #GDtlsConnection::accept-certificate.)
*
* Returns: @conn's peer's certificate errors
* Since: 2.48
@@ -20617,7 +20671,7 @@
/**
* g_dtls_connection_set_database:
* @conn: a #GDtlsConnection
- * @database: a #GTlsDatabase
+ * @database: (nullable): a #GTlsDatabase
*
* Sets the certificate database that is used to verify peer certificates.
* This is set to the default database by default. See
@@ -21031,7 +21085,7 @@
*
* Gets the next matched attribute from a #GFileAttributeMatcher.
*
- * Returns: a string containing the next attribute or %NULL if
+ * Returns: (nullable): a string containing the next attribute or, %NULL if
* no more attribute exist.
*/
@@ -21440,6 +21494,21 @@
* Deletes a file. If the @file is a directory, it will only be
* deleted if it is empty. This has the same semantics as g_unlink().
*
+ * If @file doesn’t exist, %G_IO_ERROR_NOT_FOUND will be returned. This allows
+ * for deletion to be implemented avoiding
+ * [time-of-check to time-of-use races](https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use):
+ * |[
+ * g_autoptr(GError) local_error = NULL;
+ * if (!g_file_delete (my_file, my_cancellable, &local_error) &&
+ * !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+ * {
+ * // deletion failed for some reason other than the file not existing:
+ * // so report the error
+ * g_warning ("Failed to delete %s: %s",
+ * g_file_peek_path (my_file), local_error->message);
+ * }
+ * ]|
+ *
* If @cancellable is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
@@ -22275,7 +22344,7 @@
* @info: a #GFileInfo.
* @attribute: a file attribute key.
*
- * Gets the value of a attribute, formated as a string.
+ * Gets the value of a attribute, formatted as a string.
* This escapes things as needed to make the string valid
* UTF-8.
*
@@ -22305,7 +22374,7 @@
* Gets the value of a byte string attribute. If the attribute does
* not contain a byte string, %NULL will be returned.
*
- * Returns: the contents of the @attribute value as a byte string, or
+ * Returns: (nullable): the contents of the @attribute value as a byte string, or
* %NULL otherwise.
*/
@@ -22360,8 +22429,8 @@
* Gets the value of a #GObject attribute. If the attribute does
* not contain a #GObject, %NULL will be returned.
*
- * Returns: (transfer none): a #GObject associated with the given @attribute, or
- * %NULL otherwise.
+ * Returns: (transfer none) (nullable): a #GObject associated with the given @attribute,
+ * or %NULL otherwise.
*/
@@ -22385,8 +22454,8 @@
* Gets the value of a string attribute. If the attribute does
* not contain a string, %NULL will be returned.
*
- * Returns: the contents of the @attribute value as a UTF-8 string, or
- * %NULL otherwise.
+ * Returns: (nullable): the contents of the @attribute value as a UTF-8 string,
+ * or %NULL otherwise.
*/
@@ -22398,8 +22467,8 @@
* Gets the value of a stringv attribute. If the attribute does
* not contain a stringv, %NULL will be returned.
*
- * Returns: (transfer none): the contents of the @attribute value as a stringv, or
- * %NULL otherwise. Do not free. These returned strings are UTF-8.
+ * Returns: (transfer none) (nullable): the contents of the @attribute value as a stringv,
+ * or %NULL otherwise. Do not free. These returned strings are UTF-8.
* Since: 2.22
*/
@@ -22448,7 +22517,8 @@
*
* Gets the file's content type.
*
- * Returns: a string containing the file's content type.
+ * Returns: (nullable): a string containing the file's content type,
+ * or %NULL if unknown.
*/
@@ -22460,7 +22530,7 @@
* available in G_FILE_ATTRIBUTE_TRASH_DELETION_DATE. If the
* G_FILE_ATTRIBUTE_TRASH_DELETION_DATE attribute is unset, %NULL is returned.
*
- * Returns: a #GDateTime, or %NULL.
+ * Returns: (nullable): a #GDateTime, or %NULL.
* Since: 2.36
*/
@@ -22469,9 +22539,9 @@
* g_file_info_get_display_name:
* @info: a #GFileInfo.
*
- * Gets a display name for a file.
+ * Gets a display name for a file. This is guaranteed to always be set.
*
- * Returns: a string containing the display name.
+ * Returns: (not nullable): a string containing the display name.
*/
@@ -22580,9 +22650,9 @@
* g_file_info_get_name:
* @info: a #GFileInfo.
*
- * Gets the name for a file.
+ * Gets the name for a file. This is guaranteed to always be set.
*
- * Returns: (type filename): a string containing the file name.
+ * Returns: (type filename) (not nullable): a string containing the file name.
*/
@@ -25140,7 +25210,9 @@
* Sends @file to the "Trashcan", if possible. This is similar to
* deleting it, but the user can recover it before emptying the trashcan.
* Not all file systems support trashing, so this call can return the
- * %G_IO_ERROR_NOT_SUPPORTED error.
+ * %G_IO_ERROR_NOT_SUPPORTED error. Since GLib 2.66, the `x-gvfs-notrash` unix
+ * mount option can be used to disable g_file_trash() support for certain
+ * mounts, the %G_IO_ERROR_NOT_SUPPORTED error will be returned in that case.
*
* If @cancellable is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
@@ -25372,7 +25444,7 @@
/**
* g_icon_deserialize:
- * @value: a #GVariant created with g_icon_serialize()
+ * @value: (transfer none): a #GVariant created with g_icon_serialize()
*
* Deserializes a #GIcon previously serialized using g_icon_serialize().
*
@@ -25431,7 +25503,7 @@
* makes sense to transfer the #GVariant between processes on the same machine,
* (as opposed to over the network), and within the same file system namespace.
*
- * Returns: (transfer full): a #GVariant, or %NULL when serialization fails.
+ * Returns: (transfer full): a #GVariant, or %NULL when serialization fails. The #GVariant will not be floating.
* Since: 2.38
*/
@@ -25747,8 +25819,8 @@
*
* Parses @string as an IP address and creates a new #GInetAddress.
*
- * Returns: a new #GInetAddress corresponding to @string, or %NULL if
- * @string could not be parsed.
+ * Returns: (nullable) (transfer full): a new #GInetAddress corresponding
+ * to @string, or %NULL if @string could not be parsed.
* Free the returned object with g_object_unref().
* Since: 2.22
*/
@@ -25861,8 +25933,8 @@
* If @address is an IPv6 address, it can also contain a scope ID
* (separated from the address by a `%`).
*
- * Returns: a new #GInetSocketAddress, or %NULL if @address cannot be
- * parsed.
+ * Returns: (nullable) (transfer full): a new #GInetSocketAddress,
+ * or %NULL if @address cannot be parsed.
* Since: 2.40
*/
@@ -26694,7 +26766,7 @@
*
* This may not actually load and initialize all the types in each
* module, some modules may be lazily loaded and initialized when
- * an extension point it implementes is used with e.g.
+ * an extension point it implements is used with e.g.
* g_io_extension_point_get_extensions() or
* g_io_extension_point_get_extension_by_name().
*
@@ -26716,7 +26788,7 @@
*
* This may not actually load and initialize all the types in each
* module, some modules may be lazily loaded and initialized when
- * an extension point it implementes is used with e.g.
+ * an extension point it implements is used with e.g.
* g_io_extension_point_get_extensions() or
* g_io_extension_point_get_extension_by_name().
*
@@ -26965,7 +27037,7 @@
* @callback: (scope async): a #GAsyncReadyCallback.
* @user_data: (closure): user data passed to @callback.
*
- * Asyncronously splice the output stream of @stream1 to the input stream of
+ * Asynchronously splice the output stream of @stream1 to the input stream of
* @stream2, and splice the output stream of @stream2 to the input stream of
* @stream1.
*
@@ -29519,7 +29591,7 @@
* g_network_service_get_scheme:
* @srv: a #GNetworkService
*
- * Get's the URI scheme used to resolve proxies. By default, the service name
+ * Gets the URI scheme used to resolve proxies. By default, the service name
* is used as scheme.
*
* Returns: @srv's scheme name
@@ -32087,7 +32159,7 @@
*
* Sets the length of the stream to @offset. If the stream was previously
* larger than @offset, the extra data is discarded. If the stream was
- * previouly shorter than @offset, it is extended with NUL ('\0') bytes.
+ * previously shorter than @offset, it is extended with NUL ('\0') bytes.
*
* If @cancellable is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
@@ -32866,6 +32938,12 @@
* Creates a new #GSettings object with the schema specified by
* @schema_id.
*
+ * It is an error for the schema to not exist: schemas are an
+ * essential part of a program, as they provide type information.
+ * If schemas need to be dynamically loaded (for example, from an
+ * optional runtime dependency), g_settings_schema_source_lookup()
+ * can be used to test for their existence before loading them.
+ *
* Signals on the newly created #GSettings object will be dispatched
* via the thread-default #GMainContext in effect at the time of the
* call to g_settings_new(). The new #GSettings will hold a reference
@@ -35607,6 +35685,7 @@
* - OpenBSD since GLib 2.30
* - Solaris, Illumos and OpenSolaris since GLib 2.40
* - NetBSD since GLib 2.42
+ * - macOS, tvOS, iOS since GLib 2.66
*
* Other ways to obtain credentials from a foreign peer includes the
* #GUnixCredentialsMessage type and
@@ -36268,8 +36347,8 @@
/**
* g_socket_receive:
* @socket: a #GSocket
- * @buffer: (array length=size) (element-type guint8): a buffer to
- * read data into (which should be at least @size bytes long).
+ * @buffer: (array length=size) (element-type guint8) (out caller-allocates):
+ * a buffer to read data into (which should be at least @size bytes long).
* @size: the number of bytes you want to read from the socket
* @cancellable: (nullable): a %GCancellable or %NULL
* @error: #GError for error reporting, or %NULL to ignore.
@@ -36309,8 +36388,8 @@
* @socket: a #GSocket
* @address: (out) (optional): a pointer to a #GSocketAddress
* pointer, or %NULL
- * @buffer: (array length=size) (element-type guint8): a buffer to
- * read data into (which should be at least @size bytes long).
+ * @buffer: (array length=size) (element-type guint8) (out caller-allocates):
+ * a buffer to read data into (which should be at least @size bytes long).
* @size: the number of bytes you want to read from the socket
* @cancellable: (nullable): a %GCancellable or %NULL
* @error: #GError for error reporting, or %NULL to ignore.
@@ -36484,8 +36563,8 @@
/**
* g_socket_receive_with_blocking:
* @socket: a #GSocket
- * @buffer: (array length=size) (element-type guint8): a buffer to
- * read data into (which should be at least @size bytes long).
+ * @buffer: (array length=size) (element-type guint8) (out caller-allocates):
+ * a buffer to read data into (which should be at least @size bytes long).
* @size: the number of bytes you want to read from the socket
* @blocking: whether to do blocking or non-blocking I/O
* @cancellable: (nullable): a %GCancellable or %NULL
@@ -38522,7 +38601,7 @@
* g_task_return_error_if_cancelled() and then returned.
*
* This allows you to create a cancellable wrapper around an
- * uninterruptable function. The #GTaskThreadFunc just needs to be
+ * uninterruptible function. The #GTaskThreadFunc just needs to be
* careful that it does not modify any externally-visible state after
* it has been cancelled. To do that, the thread should call
* g_task_set_return_on_cancel() again to (atomically) set
@@ -38611,7 +38690,7 @@
* g_tcp_wrapper_connection_get_base_io_stream:
* @conn: a #GTcpWrapperConnection
*
- * Get's @conn's base #GIOStream
+ * Gets @conn's base #GIOStream
*
* Returns: (transfer none): @conn's base #GIOStream
*/
@@ -39138,6 +39217,16 @@
/**
+ * g_tls_channel_binding_error_quark:
+ *
+ * Gets the TLS channel binding error quark.
+ *
+ * Returns: a #GQuark.
+ * Since: 2.66
+ */
+
+
+/**
* g_tls_client_connection_copy_session_state:
* @conn: a #GTlsClientConnection
* @source: a #GTlsClientConnection
@@ -39321,19 +39410,46 @@
* Gets @conn's certificate, as set by
* g_tls_connection_set_certificate().
*
- * Returns: (transfer none): @conn's certificate, or %NULL
+ * Returns: (transfer none) (nullable): @conn's certificate, or %NULL
* Since: 2.28
*/
/**
+ * g_tls_connection_get_channel_binding_data:
+ * @conn: a #GTlsConnection
+ * @type: #GTlsChannelBindingType type of data to fetch
+ * @data: (out callee-allocates) (optional) (transfer none): #GByteArray is
+ * filled with the binding data, or %NULL
+ * @error: a #GError pointer, or %NULL
+ *
+ * Query the TLS backend for TLS channel binding data of @type for @conn.
+ *
+ * This call retrieves TLS channel binding data as specified in RFC
+ * [5056](https://tools.ietf.org/html/rfc5056), RFC
+ * [5929](https://tools.ietf.org/html/rfc5929), and related RFCs. The
+ * binding data is returned in @data. The @data is resized by the callee
+ * using #GByteArray buffer management and will be freed when the @data
+ * is destroyed by g_byte_array_unref(). If @data is %NULL, it will only
+ * check whether TLS backend is able to fetch the data (e.g. whether @type
+ * is supported by the TLS backend). It does not guarantee that the data
+ * will be available though. That could happen if TLS connection does not
+ * support @type or the binding data is not available yet due to additional
+ * negotiation or input required.
+ *
+ * Returns: %TRUE on success, %FALSE otherwise
+ * Since: 2.66
+ */
+
+
+/**
* g_tls_connection_get_database:
* @conn: a #GTlsConnection
*
* Gets the certificate database that @conn uses to verify
* peer certificates. See g_tls_connection_set_database().
*
- * Returns: (transfer none): the certificate database that @conn uses or %NULL
+ * Returns: (transfer none) (nullable): the certificate database that @conn uses or %NULL
* Since: 2.30
*/
@@ -39346,7 +39462,7 @@
* for things like prompting the user for passwords. If %NULL is returned, then
* no user interaction will occur for this connection.
*
- * Returns: (transfer none): The interaction object.
+ * Returns: (transfer none) (nullable): The interaction object.
* Since: 2.30
*/
@@ -39372,11 +39488,11 @@
* g_tls_connection_get_peer_certificate:
* @conn: a #GTlsConnection
*
- * Gets @conn's peer's certificate after the handshake has completed.
- * (It is not set during the emission of
+ * Gets @conn's peer's certificate after the handshake has completed
+ * or failed. (It is not set during the emission of
* #GTlsConnection::accept-certificate.)
*
- * Returns: (transfer none): @conn's peer's certificate, or %NULL
+ * Returns: (transfer none) (nullable): @conn's peer's certificate, or %NULL
* Since: 2.28
*/
@@ -39386,8 +39502,8 @@
* @conn: a #GTlsConnection
*
* Gets the errors associated with validating @conn's peer's
- * certificate, after the handshake has completed. (It is not set
- * during the emission of #GTlsConnection::accept-certificate.)
+ * certificate, after the handshake has completed or failed. (It is
+ * not set during the emission of #GTlsConnection::accept-certificate.)
*
* Returns: @conn's peer's certificate errors
* Since: 2.28
@@ -39560,7 +39676,7 @@
/**
* g_tls_connection_set_database:
* @conn: a #GTlsConnection
- * @database: a #GTlsDatabase
+ * @database: (nullable): a #GTlsDatabase
*
* Sets the certificate database that is used to verify peer certificates.
* This is set to the default database by default. See
@@ -39883,9 +39999,13 @@
* which means that the certificate is being used to authenticate a server
* (and we are acting as the client).
*
- * The @identity is used to check for pinned certificates (trust exceptions)
- * in the database. These will override the normal verification process on a
- * host by host basis.
+ * The @identity is used to ensure the server certificate is valid for
+ * the expected peer identity. If the identity does not match the
+ * certificate, %G_TLS_CERTIFICATE_BAD_IDENTITY will be set in the
+ * return value. If @identity is %NULL, that bit will never be set in
+ * the return value. The peer identity may also be used to check for
+ * pinned certificates (trust exceptions) in the database. These may
+ * override the normal verification process on a host-by-host basis.
*
* Currently there are no @flags, and %G_TLS_DATABASE_VERIFY_NONE should be
* used.
@@ -41154,6 +41274,24 @@
/**
+ * g_unix_mount_point_at:
+ * @mount_path: (type filename): path for a possible unix mount point.
+ * @time_read: (out) (optional): guint64 to contain a timestamp.
+ *
+ * Gets a #GUnixMountPoint for a given mount path. If @time_read is set, it
+ * will be filled with a unix timestamp for checking if the mount points have
+ * changed since with g_unix_mount_points_changed_since().
+ *
+ * If more mount points have the same mount path, the last matching mount point
+ * is returned.
+ *
+ * Returns: (transfer full) (nullable): a #GUnixMountPoint, or %NULL if no match
+ * is found.
+ * Since: 2.66
+ */
+
+
+/**
* g_unix_mount_point_compare:
* @mount1: a #GUnixMount.
* @mount2: a #GUnixMount.
@@ -42174,6 +42312,28 @@
/**
+ * g_win32_registry_get_os_dirs:
+ *
+ * Returns a list of directories for DLL lookups.
+ * Can be used with g_win32_registry_key_get_value().
+ *
+ * Returns: (array zero-terminated=1) (transfer none): a %NULL-terminated array of UTF-8 strings.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_win32_registry_get_os_dirs_w:
+ *
+ * Returns a list of directories for DLL lookups.
+ * Can be used with g_win32_registry_key_get_value_w().
+ *
+ * Returns: (array zero-terminated=1) (transfer none): a %NULL-terminated array of UTF-16 strings.
+ * Since: 2.66
+ */
+
+
+/**
* g_win32_registry_key_erase_change_indicator:
* @key: (in) (transfer none): a #GWin32RegistryKey
*
@@ -42239,6 +42399,10 @@
/**
* g_win32_registry_key_get_value:
* @key: (in) (transfer none): a #GWin32RegistryKey
+ * @mui_dll_dirs: (in) (transfer none) (array zero-terminated=1) (optional): a %NULL-terminated
+ * array of directory names where the OS
+ * should look for a DLL indicated in a MUI string, if the
+ * DLL path in the string is not absolute
* @auto_expand: (in): %TRUE to automatically expand G_WIN32_REGISTRY_VALUE_EXPAND_STR
* to G_WIN32_REGISTRY_VALUE_STR.
* @value_name: (in) (transfer none): name of the value to get (in UTF-8).
@@ -42252,14 +42416,37 @@
* Get data from a value of a key. String data is guaranteed to be
* appropriately terminated and will be in UTF-8.
*
+ * When not %NULL, @mui_dll_dirs indicates that `RegLoadMUIStringW()` API
+ * should be used instead of the usual `RegQueryValueExW()`. This implies
+ * that the value being queried is of type `REG_SZ` or `REG_EXPAND_SZ` (if it is not, the function
+ * falls back to `RegQueryValueExW()`), and that this string must undergo special processing
+ * (see [`SHLoadIndirectString()` documentation](https://docs.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-shloadindirectstring) for an explanation on what
+ * kinds of strings are processed) to get the result.
+ *
+ * If no specific MUI DLL directories need to be used, pass
+ * the return value of g_win32_registry_get_os_dirs() as @mui_dll_dirs
+ * (as an bonus, the value from g_win32_registry_get_os_dirs()
+ * does not add any extra UTF8->UTF16 conversion overhead).
+ *
+ * @auto_expand works with @mui_dll_dirs, but only affects the processed
+ * string, making it somewhat useless. The unprocessed string is always expanded
+ * internally, if its type is `REG_EXPAND_SZ` - there is no need to enable
+ * @auto_expand for this to work.
+ *
+ * The API for this function changed in GLib 2.66 to add the @mui_dll_dirs argument.
+ *
* Returns: %TRUE on success, %FALSE on failure.
- * Since: 2.46
+ * Since: 2.66
*/
/**
* g_win32_registry_key_get_value_w:
* @key: (in) (transfer none): a #GWin32RegistryKey
+ * @mui_dll_dirs: (in) (transfer none) (array zero-terminated=1) (optional): a %NULL-terminated
+ * array of directory names where the OS
+ * should look for a DLL indicated in a MUI string, if the
+ * DLL path in the string is not absolute
* @auto_expand: (in): %TRUE to automatically expand G_WIN32_REGISTRY_VALUE_EXPAND_STR
* to G_WIN32_REGISTRY_VALUE_STR.
* @value_name: (in) (transfer none): name of the value to get (in UTF-16).
@@ -42270,19 +42457,34 @@
* by @value_data.
* @error: (nullable): a pointer to %NULL #GError, or %NULL
*
- * Get data from a value of a key.
- *
* Get data from a value of a key. String data is guaranteed to be
* appropriately terminated and will be in UTF-16.
*
* When calling with value_data == NULL (to get data size without getting
* the data itself) remember that returned size corresponds to possibly
* unterminated string data (if value is some kind of string), because
- * termination cannot be checked and fixed unless the data is retreived
+ * termination cannot be checked and fixed unless the data is retrieved
* too.
*
+ * When not %NULL, @mui_dll_dirs indicates that `RegLoadMUIStringW()` API
+ * should be used instead of the usual `RegQueryValueExW()`. This implies
+ * that the value being queried is of type `REG_SZ` or `REG_EXPAND_SZ` (if it is not, the function
+ * falls back to `RegQueryValueExW()`), and that this string must undergo special processing
+ * (see [`SHLoadIndirectString()` documentation](https://docs.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-shloadindirectstring) for an explanation on what
+ * kinds of strings are processed) to get the result.
+ *
+ * If no specific MUI DLL directories need to be used, pass
+ * the return value of g_win32_registry_get_os_dirs_w() as @mui_dll_dirs.
+ *
+ * @auto_expand works with @mui_dll_dirs, but only affects the processed
+ * string, making it somewhat useless. The unprocessed string is always expanded
+ * internally, if its type is `REG_EXPAND_SZ` - there is no need to enable
+ * @auto_expand for this to work.
+ *
+ * The API for this function changed in GLib 2.66 to add the @mui_dll_dirs argument.
+ *
* Returns: %TRUE on success, %FALSE on failure.
- * Since: 2.46
+ * Since: 2.66
*/
diff --git a/gir/glib-2.0.c b/gir/glib-2.0.c
index 76876983..3463a2ac 100644
--- a/gir/glib-2.0.c
+++ b/gir/glib-2.0.c
@@ -269,7 +269,7 @@
*
* If it's declared on the stack, it will contain garbage so must be
* initialized with g_date_clear(). g_date_clear() makes the date invalid
- * but sane. An invalid date doesn't represent a day, it's "empty." A date
+ * but safe. An invalid date doesn't represent a day, it's "empty." A date
* becomes valid after you set it to a Julian day or you set a day, month,
* and year.
*/
@@ -605,7 +605,7 @@
* a more secure hash function when using a GHashTable with keys
* that originate in untrusted data (such as HTTP requests).
* Using g_str_hash() in that situation might make your application
- * vulerable to
+ * vulnerable to
* [Algorithmic Complexity Attacks](https://lwn.net/Articles/474912/).
*
* The key to choosing a good hash is unpredictability. Even
@@ -1068,7 +1068,7 @@
* @G_IO_STATUS_EOF: End of file.
* @G_IO_STATUS_AGAIN: Resource temporarily unavailable.
*
- * Stati returned by most of the #GIOFuncs functions.
+ * Statuses returned by most of the #GIOFuncs functions.
*/
@@ -2231,7 +2231,7 @@
* its grandchildren, and so on. Note that this is less
* efficient than the other orders.
*
- * Specifies the type of traveral performed by g_tree_traverse(),
+ * Specifies the type of traversal performed by g_tree_traverse(),
* g_node_traverse() and g_node_find(). The different orders are
* illustrated here:
* - In order: A, B, C, D, E, F, G, H, I
@@ -2540,6 +2540,84 @@
/**
+ * GUri:
+ *
+ * A parsed absolute URI.
+ *
+ * Since #GUri only represents absolute URIs, all #GUris will have a
+ * URI scheme, so g_uri_get_scheme() will always return a non-%NULL
+ * answer. Likewise, by definition, all URIs have a path component, so
+ * g_uri_get_path() will always return a non-%NULL string (which may be empty).
+ *
+ * If the URI string has an
+ * [‘authority’ component](https://tools.ietf.org/html/rfc3986#section-3) (that
+ * is, if the scheme is followed by `://` rather than just `:`), then the
+ * #GUri will contain a hostname, and possibly a port and ‘userinfo’.
+ * Additionally, depending on how the #GUri was constructed/parsed (for example,
+ * using the %G_URI_FLAGS_HAS_PASSWORD and %G_URI_FLAGS_HAS_AUTH_PARAMS flags),
+ * the userinfo may be split out into a username, password, and
+ * additional authorization-related parameters.
+ *
+ * Normally, the components of a #GUri will have all `%`-encoded
+ * characters decoded. However, if you construct/parse a #GUri with
+ * %G_URI_FLAGS_ENCODED, then the `%`-encoding will be preserved instead in
+ * the userinfo, path, and query fields (and in the host field if also
+ * created with %G_URI_FLAGS_NON_DNS). In particular, this is necessary if
+ * the URI may contain binary data or non-UTF-8 text, or if decoding
+ * the components might change the interpretation of the URI.
+ *
+ * For example, with the encoded flag:
+ *
+ * |[<!-- language="C" -->
+ * g_autoptr(GUri) uri = g_uri_parse ("http://host/path?query=http%3A%2F%2Fhost%2Fpath%3Fparam%3Dvalue", G_URI_FLAGS_ENCODED, &err);
+ * g_assert_cmpstr (g_uri_get_query (uri), ==, "query=http%3A%2F%2Fhost%2Fpath%3Fparam%3Dvalue");
+ * ]|
+ *
+ * While the default `%`-decoding behaviour would give:
+ *
+ * |[<!-- language="C" -->
+ * g_autoptr(GUri) uri = g_uri_parse ("http://host/path?query=http%3A%2F%2Fhost%2Fpath%3Fparam%3Dvalue", G_URI_FLAGS_NONE, &err);
+ * g_assert_cmpstr (g_uri_get_query (uri), ==, "query=http://host/path?param=value");
+ * ]|
+ *
+ * During decoding, if an invalid UTF-8 string is encountered, parsing will fail
+ * with an error indicating the bad string location:
+ *
+ * |[<!-- language="C" -->
+ * g_autoptr(GUri) uri = g_uri_parse ("http://host/path?query=http%3A%2F%2Fhost%2Fpath%3Fbad%3D%00alue", G_URI_FLAGS_NONE, &err);
+ * g_assert_error (err, G_URI_ERROR, G_URI_ERROR_BAD_QUERY);
+ * ]|
+ *
+ * You should pass %G_URI_FLAGS_ENCODED or %G_URI_FLAGS_ENCODED_QUERY if you
+ * need to handle that case manually. In particular, if the query string
+ * contains `=` characters that are `%`-encoded, you should let
+ * g_uri_parse_params() do the decoding once of the query.
+ *
+ * #GUri is immutable once constructed, and can safely be accessed from
+ * multiple threads. Its reference counting is atomic.
+ *
+ * Since: 2.66
+ */
+
+
+/**
+ * GUriParamsIter:
+ *
+ * Many URI schemes include one or more attribute/value pairs as part of the URI
+ * value. For example `scheme://server/path?query=string&is=there` has two
+ * attributes – `query=string` and `is=there` – in its query part.
+ *
+ * A #GUriParamsIter structure represents an iterator that can be used to
+ * iterate over the attribute/value pairs of a URI query string. #GUriParamsIter
+ * structures are typically allocated on the stack and then initialized with
+ * g_uri_params_iter_init(). See the documentation for g_uri_params_iter_init()
+ * for a usage example.
+ *
+ * Since: 2.66
+ */
+
+
+/**
* GVariant:
*
* #GVariant is an opaque data structure and can only be accessed
@@ -4858,7 +4936,7 @@
* If you need to clear the contents of the data, you will need to use an
* ancillary function that calls g_rc_box_release_full():
*
- * |[<!-- laguage="C" -->
+ * |[<!-- language="C" -->
* static void
* my_data_struct_release (MyDataStruct *data)
* {
@@ -4888,15 +4966,20 @@
*
* To create a new array use g_array_new().
*
- * To add elements to an array, use g_array_append_val(),
- * g_array_append_vals(), g_array_prepend_val(), and
- * g_array_prepend_vals().
+ * To add elements to an array with a cost of O(n) at worst, use
+ * g_array_append_val(), g_array_append_vals(), g_array_prepend_val(),
+ * g_array_prepend_vals(), g_array_insert_val() and g_array_insert_vals().
*
- * To access an element of an array, use g_array_index().
+ * To access an element of an array in O(1) (to read it or to write it),
+ * use g_array_index().
*
* To set the size of an array, use g_array_set_size().
*
- * To free an array, use g_array_free().
+ * To free an array, use g_array_unref() or g_array_free().
+ *
+ * All the sort functions are internally calling a quick-sort (or similar)
+ * function with an average cost of O(n log(n)) and a worst case
+ * cost of O(n^2).
*
* Here is an example that stores integers in a #GArray:
* |[<!-- language="C" -->
@@ -5160,7 +5243,7 @@
*
* The important caveat of bookmark files is that when you add a new
* bookmark you must also add the application that is registering it, using
- * g_bookmark_file_add_application() or g_bookmark_file_set_app_info().
+ * g_bookmark_file_add_application() or g_bookmark_file_set_application_info().
* If a bookmark has no applications then it won't be dumped when creating
* the on disk representation, using g_bookmark_file_to_data() or
* g_bookmark_file_to_file().
@@ -5453,8 +5536,8 @@
*
* #GDate is simple to use. First you need a "blank" date; you can get a
* dynamically allocated date from g_date_new(), or you can declare an
- * automatic variable or array and initialize it to a sane state by
- * calling g_date_clear(). A cleared date is sane; it's safe to call
+ * automatic variable or array and initialize it by
+ * calling g_date_clear(). A cleared date is safe; it's safe to call
* g_date_set_dmy() and the other mutator functions to initialize the
* value of a cleared date. However, a cleared date is initially
* invalid, meaning that it doesn't represent a day that exists.
@@ -5474,7 +5557,7 @@
/**
- * SECTION:date-time
+ * SECTION:datetime
* @title: GDateTime
* @short_description: a structure representing Date and Time
* @see_also: #GTimeZone
@@ -6008,15 +6091,119 @@
/**
- * SECTION:gurifuncs
- * @title: URI Functions
- * @short_description: manipulating URIs
+ * SECTION:guri
+ * @short_description: URI-handling utilities
+ * @include: glib.h
*
- * Functions for manipulating Universal Resource Identifiers (URIs) as
- * defined by
- * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).
- * It is highly recommended that you have read and
- * understand RFC 3986 for understanding this API.
+ * The #GUri type and related functions can be used to parse URIs into
+ * their components, and build valid URIs from individual components.
+ *
+ * Note that #GUri scope is to help manipulate URIs in various applications,
+ * following [RFC 3986](https://tools.ietf.org/html/rfc3986). In particular,
+ * it doesn't intend to cover web browser needs, and doesn't implement the
+ * [WHATWG URL](https://url.spec.whatwg.org/) standard. No APIs are provided to
+ * help prevent
+ * [homograph attacks](https://en.wikipedia.org/wiki/IDN_homograph_attack), so
+ * #GUri is not suitable for formatting URIs for display to the user for making
+ * security-sensitive decisions.
+ *
+ * ## Relative and absolute URIs # {#relative-absolute-uris}
+ *
+ * As defined in [RFC 3986](https://tools.ietf.org/html/rfc3986#section-4), the
+ * hierarchical nature of URIs means that they can either be ‘relative
+ * references’ (sometimes referred to as ‘relative URIs’) or ‘URIs’ (for
+ * clarity, ‘URIs’ are referred to in this documentation as
+ * ‘absolute URIs’ — although
+ * [in constrast to RFC 3986](https://tools.ietf.org/html/rfc3986#section-4.3),
+ * fragment identifiers are always allowed).
+ *
+ * Relative references have one or more components of the URI missing. In
+ * particular, they have no scheme. Any other component, such as hostname,
+ * query, etc. may be missing, apart from a path, which has to be specified (but
+ * may be empty). The path may be relative, starting with `./` rather than `/`.
+ *
+ * For example, a valid relative reference is `./path?query`,
+ * `/?query#fragment` or `//example.com`.
+ *
+ * Absolute URIs have a scheme specified. Any other components of the URI which
+ * are missing are specified as explicitly unset in the URI, rather than being
+ * resolved relative to a base URI using g_uri_parse_relative().
+ *
+ * For example, a valid absolute URI is `file:///home/bob` or
+ * `https://search.com?query=string`.
+ *
+ * A #GUri instance is always an absolute URI. A string may be an absolute URI
+ * or a relative reference; see the documentation for individual functions as to
+ * what forms they accept.
+ *
+ * ## Parsing URIs
+ *
+ * The most minimalist APIs for parsing URIs are g_uri_split() and
+ * g_uri_split_with_user(). These split a URI into its component
+ * parts, and return the parts; the difference between the two is that
+ * g_uri_split() treats the ‘userinfo’ component of the URI as a
+ * single element, while g_uri_split_with_user() can (depending on the
+ * #GUriFlags you pass) treat it as containing a username, password,
+ * and authentication parameters. Alternatively, g_uri_split_network()
+ * can be used when you are only interested in the components that are
+ * needed to initiate a network connection to the service (scheme,
+ * host, and port).
+ *
+ * g_uri_parse() is similar to g_uri_split(), but instead of returning
+ * individual strings, it returns a #GUri structure (and it requires
+ * that the URI be an absolute URI).
+ *
+ * g_uri_resolve_relative() and g_uri_parse_relative() allow you to
+ * resolve a relative URI relative to a base URI.
+ * g_uri_resolve_relative() takes two strings and returns a string,
+ * and g_uri_parse_relative() takes a #GUri and a string and returns a
+ * #GUri.
+ *
+ * All of the parsing functions take a #GUriFlags argument describing
+ * exactly how to parse the URI; see the documentation for that type
+ * for more details on the specific flags that you can pass. If you
+ * need to choose different flags based on the type of URI, you can
+ * use g_uri_peek_scheme() on the URI string to check the scheme
+ * first, and use that to decide what flags to parse it with.
+ *
+ * For example, you might want to use %G_URI_PARAMS_WWW_FORM when parsing the
+ * params for a web URI, so compare the result of g_uri_peek_scheme() against
+ * `http` and `https`.
+ *
+ * ## Building URIs
+ *
+ * g_uri_join() and g_uri_join_with_user() can be used to construct
+ * valid URI strings from a set of component strings. They are the
+ * inverse of g_uri_split() and g_uri_split_with_user().
+ *
+ * Similarly, g_uri_build() and g_uri_build_with_user() can be used to
+ * construct a #GUri from a set of component strings.
+ *
+ * As with the parsing functions, the building functions take a
+ * #GUriFlags argument. In particular, it is important to keep in mind
+ * whether the URI components you are using are already `%`-encoded. If so,
+ * you must pass the %G_URI_FLAGS_ENCODED flag.
+ *
+ * ## `file://` URIs
+ *
+ * Note that Windows and Unix both define special rules for parsing
+ * `file://` URIs (involving non-UTF-8 character sets on Unix, and the
+ * interpretation of path separators on Windows). #GUri does not
+ * implement these rules. Use g_filename_from_uri() and
+ * g_filename_to_uri() if you want to properly convert between
+ * `file://` URIs and local filenames.
+ *
+ * ## URI Equality
+ *
+ * Note that there is no `g_uri_equal ()` function, because comparing
+ * URIs usefully requires scheme-specific knowledge that #GUri does
+ * not have. For example, `http://example.com/` and
+ * `http://EXAMPLE.COM:80` have exactly the same meaning according
+ * to the HTTP specification, and `data:,foo` and
+ * `data:;base64,Zm9v` resolve to the same thing according to the
+ * `data:` URI specification.
+ *
+ * Since: 2.66
*/
@@ -6434,13 +6621,14 @@
* given a key the value can be found quickly
*
* A #GHashTable provides associations between keys and values which is
- * optimized so that given a key, the associated value can be found
- * very quickly.
+ * optimized so that given a key, the associated value can be found,
+ * inserted or removed in amortized O(1). All operations going through
+ * each element take O(n) time (list all keys/values, table resize, etc.).
*
* Note that neither keys nor values are copied when inserted into the
* #GHashTable, so they must exist for the lifetime of the #GHashTable.
* This means that the use of static strings is OK, but temporary
- * strings (i.e. those created in buffers and those returned by GTK+
+ * strings (i.e. those created in buffers and those returned by GTK
* widgets) should be copied with g_strdup() before being inserted.
*
* If keys or values are dynamically allocated, you must be careful to
@@ -6759,7 +6947,12 @@
* @short_description: linked lists that can be iterated over in both directions
*
* The #GList structure and its associated functions provide a standard
- * doubly-linked list data structure.
+ * doubly-linked list data structure. The benefit of this data-structure
+ * is to provide insertion/deletion operations in O(1) complexity where
+ * access/search operations are in O(n). The benefit of #GList over
+ * #GSList (singly linked list) is that the worst case on access/search
+ * operations is divided by two which comes at a cost in space as we need
+ * to retain two pointers in place of one.
*
* Each element in the list contains a piece of data, together with
* pointers which link to the previous and next elements in the list.
@@ -6839,7 +7032,12 @@
* @short_description: linked lists that can be iterated in one direction
*
* The #GSList structure and its associated functions provide a
- * standard singly-linked list data structure.
+ * standard singly-linked list data structure. The benefit of this
+ * data-structure is to provide insertion/deletion operations in O(1)
+ * complexity where access/search operations are in O(n). The benefit
+ * of #GSList over #GList (doubly linked list) is that they are lighter
+ * in space as they only need to retain one pointer but it double the
+ * cost of the worst case access/search operations.
*
* Each element in the list contains a piece of data, together with a
* pointer which links to the next element in the list. Using this
@@ -7075,11 +7273,15 @@
* If any call to allocate memory using functions g_new(), g_new0(), g_renew(),
* g_malloc(), g_malloc0(), g_malloc0_n(), g_realloc(), and g_realloc_n()
* fails, the application is terminated. This also means that there is no
- * need to check if the call succeeded. On the other hand, g_try_...() family
+ * need to check if the call succeeded. On the other hand, the `g_try_...()` family
* of functions returns %NULL on failure that can be used as a check
* for unsuccessful memory allocation. The application is not terminated
* in this case.
*
+ * As all GLib functions and data structures use `g_malloc()` internally, unless
+ * otherwise specified, any allocation failure will result in the application
+ * being terminated.
+ *
* It's important to match g_malloc() (and wrappers such as g_new()) with
* g_free(), g_slice_alloc() (and wrappers such as g_slice_new()) with
* g_slice_free(), plain malloc() with free(), and (if you're using C++)
@@ -7561,7 +7763,8 @@
*
* The #GQueue structure and its associated functions provide a standard
* queue data structure. Internally, GQueue uses the same data structure
- * as #GList to store elements.
+ * as #GList to store elements with the same complexity over
+ * insertion/deletion (O(1)) and access/search (O(n)) operations.
*
* The data contained in each element can be either integer values, by
* using one of the [Type Conversion Macros][glib-Type-Conversion-Macros],
@@ -7877,7 +8080,10 @@
*
* The #GSequence data structure has the API of a list, but is
* implemented internally with a balanced binary tree. This means that
- * it is possible to maintain a sorted list of n elements in time O(n log n).
+ * most of the operations (access, search, insertion, deletion, ...) on
+ * #GSequence are O(log(n)) in average and O(n) in worst case for time
+ * complexity. But, note that maintaining a balanced sorted list of n
+ * elements is done in time O(n log(n)).
* The data contained in each element can be either integer values, by using
* of the [Type Conversion Macros][glib-Type-Conversion-Macros], or simply
* pointers to any type of data.
@@ -8430,7 +8636,7 @@
* g_time_zone_get_identifier().
*
* A time zone contains a number of intervals. Each interval has
- * an abbreviation to describe it (for example, ‘PDT’), an offet to UTC and a
+ * an abbreviation to describe it (for example, ‘PDT’), an offset to UTC and a
* flag indicating if the daylight savings time is in effect during that
* interval. A time zone always has at least one interval — interval 0. Note
* that interval abbreviations are not the same as time zone identifiers
@@ -8472,18 +8678,24 @@
/**
- * SECTION:trees-binary
+ * SECTION:treesbinary
* @title: Balanced Binary Trees
* @short_description: a sorted collection of key/value pairs optimized
* for searching and traversing in order
*
* The #GTree structure and its associated functions provide a sorted
* collection of key/value pairs optimized for searching and traversing
- * in order.
+ * in order. This means that most of the operations (access, search,
+ * insertion, deletion, ...) on #GTree are O(log(n)) in average and O(n)
+ * in worst case for time complexity. But, note that maintaining a
+ * balanced sorted #GTree of n elements is done in time O(n log(n)).
*
* To create a new #GTree use g_tree_new().
*
- * To insert a key/value pair into a #GTree use g_tree_insert().
+ * To insert a key/value pair into a #GTree use g_tree_insert()
+ * (O(n log(n))).
+ *
+ * To remove a key/value pair use g_tree_remove() (O(n log(n))).
*
* To look up the value corresponding to a given key, use
* g_tree_lookup() and g_tree_lookup_extended().
@@ -8494,14 +8706,12 @@
* To traverse a #GTree, calling a function for each node visited in
* the traversal, use g_tree_foreach().
*
- * To remove a key/value pair use g_tree_remove().
- *
* To destroy a #GTree, use g_tree_destroy().
*/
/**
- * SECTION:trees-nary
+ * SECTION:treesnary
* @title: N-ary Trees
* @short_description: trees of data with any number of branches
*
@@ -8633,9 +8843,23 @@
* The implementations of the Unicode functions in GLib are based
* on the Unicode Character Data tables, which are available from
* [www.unicode.org](http://www.unicode.org/).
- * GLib 2.8 supports Unicode 4.0, GLib 2.10 supports Unicode 4.1,
- * GLib 2.12 supports Unicode 5.0, GLib 2.16.3 supports Unicode 5.1,
- * GLib 2.30 supports Unicode 6.0.
+ *
+ * * Unicode 4.0 was added in GLib 2.8
+ * * Unicode 4.1 was added in GLib 2.10
+ * * Unicode 5.0 was added in GLib 2.12
+ * * Unicode 5.1 was added in GLib 2.16.3
+ * * Unicode 6.0 was added in GLib 2.30
+ * * Unicode 6.1 was added in GLib 2.32
+ * * Unicode 6.2 was added in GLib 2.36
+ * * Unicode 6.3 was added in GLib 2.40
+ * * Unicode 7.0 was added in GLib 2.42
+ * * Unicode 8.0 was added in GLib 2.48
+ * * Unicode 9.0 was added in GLib 2.50.1
+ * * Unicode 10.0 was added in GLib 2.54
+ * * Unicode 11.10 was added in GLib 2.58
+ * * Unicode 12.0 was added in GLib 2.62
+ * * Unicode 12.1 was added in GLib 2.62
+ * * Unicode 13.0 was added in GLib 2.66
*/
@@ -8935,14 +9159,29 @@
* @i: the index of the element to return
*
* Returns the element of a #GArray at the given index. The return
- * value is cast to the given type.
+ * value is cast to the given type. This is the main way to read or write an
+ * element in a #GArray.
*
- * This example gets a pointer to an element in a #GArray:
+ * Writing an element is typically done by reference, as in the following
+ * example. This example gets a pointer to an element in a #GArray, and then
+ * writes to a field in it:
* |[<!-- language="C" -->
* EDayViewEvent *event;
* // This gets a pointer to the 4th element in the array of
* // EDayViewEvent structs.
* event = &g_array_index (events, EDayViewEvent, 3);
+ * event->start_time = g_get_current_time ();
+ * ]|
+ *
+ * This example reads from and writes to an array of integers:
+ * |[<!-- language="C" -->
+ * g_autoptr(GArray) int_array = g_array_new (FALSE, FALSE, sizeof (guint));
+ * for (guint i = 0; i < 10; i++)
+ * g_array_append_val (int_array, i);
+ *
+ * guint *my_int = &g_array_index (int_array, guint, 1);
+ * g_print ("Int at index 1 is %u; decrementing it\n", *my_int);
+ * *my_int = *my_int - 1;
* ]|
*
* Returns: the element of the #GArray at the index given by @i
@@ -8979,6 +9218,10 @@
* will be initialised to zero if the array was configured to clear elements;
* otherwise their values will be undefined.
*
+ * If @index_ is less than the array’s current length, new entries will be
+ * inserted into the array, and the existing entries above @index_ will be moved
+ * upwards.
+ *
* @data may be %NULL if (and only if) @len is zero. If @len is zero, this
* function is a no-op.
*
@@ -9742,7 +9985,7 @@
* g_ascii_xdigit_value:
* @c: an ASCII character.
*
- * Determines the numeric value of a character as a hexidecimal
+ * Determines the numeric value of a character as a hexadecimal
* digit. Differs from g_unichar_xdigit_value() because it takes
* a char, so there's no worry about sign extension if characters
* are signed.
@@ -9970,6 +10213,25 @@
/**
+ * g_assert_no_errno:
+ * @expr: the expression to check
+ *
+ * Debugging macro to check that an expression has a non-negative return value,
+ * as used by traditional POSIX functions (such as `rmdir()`) to indicate
+ * success.
+ *
+ * If the assertion fails (i.e. the @expr returns a negative value), an error
+ * message is logged and the testcase is marked as failed. The error message
+ * will contain the value of `errno` and its human-readable message from
+ * g_strerror().
+ *
+ * This macro will clear the value of `errno` before executing @expr.
+ *
+ * Since: 2.66
+ */
+
+
+/**
* g_assert_no_error:
* @err: a #GError, possibly %NULL
*
@@ -10869,7 +11131,7 @@
* @block_size: the size of the allocation, must be greater than 0
*
* Allocates @block_size bytes of memory, and adds atomic
- * referenc counting semantics to it.
+ * reference counting semantics to it.
*
* The contents of the returned data is set to zero.
*
@@ -11576,6 +11838,24 @@
*
* Returns: a timestamp
* Since: 2.12
+ * Deprecated: 2.66: Use g_bookmark_file_get_added_date_time() instead, as
+ * `time_t` is deprecated due to the year 2038 problem.
+ */
+
+
+/**
+ * g_bookmark_file_get_added_date_time:
+ * @bookmark: a #GBookmarkFile
+ * @uri: a valid URI
+ * @error: return location for a #GError, or %NULL
+ *
+ * Gets the time the bookmark for @uri was added to @bookmark
+ *
+ * In the event the URI cannot be found, %NULL is returned and
+ * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
+ *
+ * Returns: (transfer none): a #GDateTime
+ * Since: 2.66
*/
@@ -11590,7 +11870,7 @@
* @error: return location for a #GError, or %NULL
*
* Gets the registration information of @app_name for the bookmark for
- * @uri. See g_bookmark_file_set_app_info() for more information about
+ * @uri. See g_bookmark_file_set_application_info() for more information about
* the returned data.
*
* The string returned in @app_exec must be freed.
@@ -11605,6 +11885,37 @@
*
* Returns: %TRUE on success.
* Since: 2.12
+ * Deprecated: 2.66: Use g_bookmark_file_get_application_info() instead, as
+ * `time_t` is deprecated due to the year 2038 problem.
+ */
+
+
+/**
+ * g_bookmark_file_get_application_info:
+ * @bookmark: a #GBookmarkFile
+ * @uri: a valid URI
+ * @name: an application's name
+ * @exec: (out) (optional): return location for the command line of the application, or %NULL
+ * @count: (out) (optional): return location for the registration count, or %NULL
+ * @stamp: (out) (optional) (transfer none): return location for the last registration time, or %NULL
+ * @error: return location for a #GError, or %NULL
+ *
+ * Gets the registration information of @app_name for the bookmark for
+ * @uri. See g_bookmark_file_set_application_info() for more information about
+ * the returned data.
+ *
+ * The string returned in @app_exec must be freed.
+ *
+ * In the event the URI cannot be found, %FALSE is returned and
+ * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the
+ * event that no application with name @app_name has registered a bookmark
+ * for @uri, %FALSE is returned and error is set to
+ * #G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. In the event that unquoting
+ * the command line fails, an error of the #G_SHELL_ERROR domain is
+ * set and %FALSE is returned.
+ *
+ * Returns: %TRUE on success.
+ * Since: 2.66
*/
@@ -11734,6 +12045,24 @@
*
* Returns: a timestamp
* Since: 2.12
+ * Deprecated: 2.66: Use g_bookmark_file_get_modified_date_time() instead, as
+ * `time_t` is deprecated due to the year 2038 problem.
+ */
+
+
+/**
+ * g_bookmark_file_get_modified_date_time:
+ * @bookmark: a #GBookmarkFile
+ * @uri: a valid URI
+ * @error: return location for a #GError, or %NULL
+ *
+ * Gets the time when the bookmark for @uri was last modified.
+ *
+ * In the event the URI cannot be found, %NULL is returned and
+ * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
+ *
+ * Returns: (transfer none): a #GDateTime
+ * Since: 2.66
*/
@@ -11795,6 +12124,24 @@
*
* Returns: a timestamp.
* Since: 2.12
+ * Deprecated: 2.66: Use g_bookmark_file_get_visited_date_time() instead, as
+ * `time_t` is deprecated due to the year 2038 problem.
+ */
+
+
+/**
+ * g_bookmark_file_get_visited_date_time:
+ * @bookmark: a #GBookmarkFile
+ * @uri: a valid URI
+ * @error: return location for a #GError, or %NULL
+ *
+ * Gets the time the bookmark for @uri was last visited.
+ *
+ * In the event the URI cannot be found, %NULL is returned and
+ * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
+ *
+ * Returns: (transfer none): a #GDateTime
+ * Since: 2.66
*/
@@ -11996,6 +12343,22 @@
* If no bookmark for @uri is found then it is created.
*
* Since: 2.12
+ * Deprecated: 2.66: Use g_bookmark_file_set_added_date_time() instead, as
+ * `time_t` is deprecated due to the year 2038 problem.
+ */
+
+
+/**
+ * g_bookmark_file_set_added_date_time:
+ * @bookmark: a #GBookmarkFile
+ * @uri: a valid URI
+ * @added: a #GDateTime
+ *
+ * Sets the time the bookmark for @uri was added into @bookmark.
+ *
+ * If no bookmark for @uri is found then it is created.
+ *
+ * Since: 2.66
*/
@@ -12022,7 +12385,7 @@
* be expanded as the local file name retrieved from the bookmark's
* URI; "\%u", which will be expanded as the bookmark's URI.
* The expansion is done automatically when retrieving the stored
- * command line using the g_bookmark_file_get_app_info() function.
+ * command line using the g_bookmark_file_get_application_info() function.
* @count is the number of times the application has registered the
* bookmark; if is < 0, the current registration count will be increased
* by one, if is 0, the application with @name will be removed from
@@ -12041,6 +12404,53 @@
* Returns: %TRUE if the application's meta-data was successfully
* changed.
* Since: 2.12
+ * Deprecated: 2.66: Use g_bookmark_file_set_application_info() instead, as
+ * `time_t` is deprecated due to the year 2038 problem.
+ */
+
+
+/**
+ * g_bookmark_file_set_application_info:
+ * @bookmark: a #GBookmarkFile
+ * @uri: a valid URI
+ * @name: an application's name
+ * @exec: an application's command line
+ * @count: the number of registrations done for this application
+ * @stamp: (nullable): the time of the last registration for this application,
+ * which may be %NULL if @count is 0
+ * @error: return location for a #GError or %NULL
+ *
+ * Sets the meta-data of application @name inside the list of
+ * applications that have registered a bookmark for @uri inside
+ * @bookmark.
+ *
+ * You should rarely use this function; use g_bookmark_file_add_application()
+ * and g_bookmark_file_remove_application() instead.
+ *
+ * @name can be any UTF-8 encoded string used to identify an
+ * application.
+ * @exec can have one of these two modifiers: "\%f", which will
+ * be expanded as the local file name retrieved from the bookmark's
+ * URI; "\%u", which will be expanded as the bookmark's URI.
+ * The expansion is done automatically when retrieving the stored
+ * command line using the g_bookmark_file_get_application_info() function.
+ * @count is the number of times the application has registered the
+ * bookmark; if is < 0, the current registration count will be increased
+ * by one, if is 0, the application with @name will be removed from
+ * the list of registered applications.
+ * @stamp is the Unix time of the last registration.
+ *
+ * If you try to remove an application by setting its registration count to
+ * zero, and no bookmark for @uri is found, %FALSE is returned and
+ * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND; similarly,
+ * in the event that no application @name has registered a bookmark
+ * for @uri, %FALSE is returned and error is set to
+ * #G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. Otherwise, if no bookmark
+ * for @uri is found, one is created.
+ *
+ * Returns: %TRUE if the application's meta-data was successfully
+ * changed.
+ * Since: 2.66
*/
@@ -12135,9 +12545,30 @@
* The "modified" time should only be set when the bookmark's meta-data
* was actually changed. Every function of #GBookmarkFile that
* modifies a bookmark also changes the modification time, except for
- * g_bookmark_file_set_visited().
+ * g_bookmark_file_set_visited_date_time().
*
* Since: 2.12
+ * Deprecated: 2.66: Use g_bookmark_file_set_modified_date_time() instead, as
+ * `time_t` is deprecated due to the year 2038 problem.
+ */
+
+
+/**
+ * g_bookmark_file_set_modified_date_time:
+ * @bookmark: a #GBookmarkFile
+ * @uri: a valid URI
+ * @modified: a #GDateTime
+ *
+ * Sets the last time the bookmark for @uri was last modified.
+ *
+ * If no bookmark for @uri is found then it is created.
+ *
+ * The "modified" time should only be set when the bookmark's meta-data
+ * was actually changed. Every function of #GBookmarkFile that
+ * modifies a bookmark also changes the modification time, except for
+ * g_bookmark_file_set_visited_date_time().
+ *
+ * Since: 2.66
*/
@@ -12169,12 +12600,34 @@
* If no bookmark for @uri is found then it is created.
*
* The "visited" time should only be set if the bookmark was launched,
- * either using the command line retrieved by g_bookmark_file_get_app_info()
+ * either using the command line retrieved by g_bookmark_file_get_application_info()
* or by the default application for the bookmark's MIME type, retrieved
* using g_bookmark_file_get_mime_type(). Changing the "visited" time
* does not affect the "modified" time.
*
* Since: 2.12
+ * Deprecated: 2.66: Use g_bookmark_file_set_visited_date_time() instead, as
+ * `time_t` is deprecated due to the year 2038 problem.
+ */
+
+
+/**
+ * g_bookmark_file_set_visited_date_time:
+ * @bookmark: a #GBookmarkFile
+ * @uri: a valid URI
+ * @visited: a #GDateTime
+ *
+ * Sets the time the bookmark for @uri was last visited.
+ *
+ * If no bookmark for @uri is found then it is created.
+ *
+ * The "visited" time should only be set if the bookmark was launched,
+ * either using the command line retrieved by g_bookmark_file_get_application_info()
+ * or by the default application for the bookmark's MIME type, retrieved
+ * using g_bookmark_file_get_mime_type(). Changing the "visited" time
+ * does not affect the "modified" time.
+ *
+ * Since: 2.66
*/
@@ -14105,7 +14558,7 @@
* @date: pointer to one or more dates to clear
* @n_dates: number of dates to clear
*
- * Initializes one or more #GDate structs to a sane but invalid
+ * Initializes one or more #GDate structs to a safe but invalid
* state. The cleared dates will not represent an existing date, but will
* not contain garbage. Useful to init a date declared on the stack.
* Validity can be tested with g_date_valid().
@@ -14344,7 +14797,7 @@
* g_date_new:
*
* Allocates a #GDate and initializes
- * it to a sane state. The new date will
+ * it to a safe state. The new date will
* be cleared (as if you'd called g_date_clear()) but invalid (it won't
* represent an existing day). Free the return value with g_date_free().
*
@@ -14578,8 +15031,8 @@
*
* Creates a copy of @datetime and adds the specified timespan to the copy.
*
- * Returns: the newly created #GDateTime which should be freed with
- * g_date_time_unref().
+ * Returns: (transfer full) (nullable): the newly created #GDateTime which
+ * should be freed with g_date_time_unref(), or %NULL
* Since: 2.26
*/
@@ -14592,8 +15045,8 @@
* Creates a copy of @datetime and adds the specified number of days to the
* copy. Add negative values to subtract days.
*
- * Returns: the newly created #GDateTime which should be freed with
- * g_date_time_unref().
+ * Returns: (transfer full) (nullable): the newly created #GDateTime which
+ * should be freed with g_date_time_unref(), or %NULL
* Since: 2.26
*/
@@ -14611,8 +15064,8 @@
* Creates a new #GDateTime adding the specified values to the current date and
* time in @datetime. Add negative values to subtract.
*
- * Returns: the newly created #GDateTime that should be freed with
- * g_date_time_unref().
+ * Returns: (transfer full) (nullable): the newly created #GDateTime which
+ * should be freed with g_date_time_unref(), or %NULL
* Since: 2.26
*/
@@ -14625,8 +15078,8 @@
* Creates a copy of @datetime and adds the specified number of hours.
* Add negative values to subtract hours.
*
- * Returns: the newly created #GDateTime which should be freed with
- * g_date_time_unref().
+ * Returns: (transfer full) (nullable): the newly created #GDateTime which
+ * should be freed with g_date_time_unref(), or %NULL
* Since: 2.26
*/
@@ -14639,8 +15092,8 @@
* Creates a copy of @datetime adding the specified number of minutes.
* Add negative values to subtract minutes.
*
- * Returns: the newly created #GDateTime which should be freed with
- * g_date_time_unref().
+ * Returns: (transfer full) (nullable): the newly created #GDateTime which
+ * should be freed with g_date_time_unref(), or %NULL
* Since: 2.26
*/
@@ -14658,8 +15111,8 @@
* 31st January 2018, the result would be 28th February 2018. In 2020 (a leap
* year), the result would be 29th February.
*
- * Returns: the newly created #GDateTime which should be freed with
- * g_date_time_unref().
+ * Returns: (transfer full) (nullable): the newly created #GDateTime which
+ * should be freed with g_date_time_unref(), or %NULL
* Since: 2.26
*/
@@ -14672,8 +15125,8 @@
* Creates a copy of @datetime and adds the specified number of seconds.
* Add negative values to subtract seconds.
*
- * Returns: the newly created #GDateTime which should be freed with
- * g_date_time_unref().
+ * Returns: (transfer full) (nullable): the newly created #GDateTime which
+ * should be freed with g_date_time_unref(), or %NULL
* Since: 2.26
*/
@@ -14686,8 +15139,8 @@
* Creates a copy of @datetime and adds the specified number of weeks to the
* copy. Add negative values to subtract weeks.
*
- * Returns: the newly created #GDateTime which should be freed with
- * g_date_time_unref().
+ * Returns: (transfer full) (nullable): the newly created #GDateTime which
+ * should be freed with g_date_time_unref(), or %NULL
* Since: 2.26
*/
@@ -14703,8 +15156,8 @@
* As with g_date_time_add_months(), if the resulting date would be 29th
* February on a non-leap year, the day will be clamped to 28th February.
*
- * Returns: the newly created #GDateTime which should be freed with
- * g_date_time_unref().
+ * Returns: (transfer full) (nullable): the newly created #GDateTime which
+ * should be freed with g_date_time_unref(), or %NULL
* Since: 2.26
*/
@@ -14765,7 +15218,7 @@
* strftime() format language as specified by C99. The \%D, \%U and \%W
* conversions are not supported, nor is the 'E' modifier. The GNU
* extensions \%k, \%l, \%s and \%P are supported, however, as are the
- * '0', '_' and '-' modifiers.
+ * '0', '_' and '-' modifiers. The Python extension \%f is also supported.
*
* In contrast to strftime(), this function always produces a UTF-8
* string, regardless of the current locale. Note that the rendering of
@@ -14797,12 +15250,17 @@
* single digits are preceded by a blank
* - \%m: the month as a decimal number (range 01 to 12)
* - \%M: the minute as a decimal number (range 00 to 59)
+ * - \%f: the microsecond as a decimal number (range 000000 to 999999)
* - \%p: either "AM" or "PM" according to the given time value, or the
* corresponding strings for the current locale. Noon is treated as
- * "PM" and midnight as "AM".
+ * "PM" and midnight as "AM". Use of this format specifier is discouraged, as
+ * many locales have no concept of AM/PM formatting. Use \%c or \%X instead.
* - \%P: like \%p but lowercase: "am" or "pm" or a corresponding string for
- * the current locale
- * - \%r: the time in a.m. or p.m. notation
+ * the current locale. Use of this format specifier is discouraged, as
+ * many locales have no concept of AM/PM formatting. Use \%c or \%X instead.
+ * - \%r: the time in a.m. or p.m. notation. Use of this format specifier is
+ * discouraged, as many locales have no concept of AM/PM formatting. Use \%c
+ * or \%X instead.
* - \%R: the time in 24-hour notation (\%H:\%M)
* - \%s: the number of seconds since the Epoch, that is, since 1970-01-01
* 00:00:00 UTC
@@ -14854,10 +15312,10 @@
* strftime() extension expected to be added to the future POSIX specification,
* \%Ob and \%Oh are GNU strftime() extensions. Since: 2.56
*
- * Returns: a newly allocated string formatted to the requested format
- * or %NULL in the case that there was an error (such as a format specifier
- * not being supported in the current locale). The string
- * should be freed with g_free().
+ * Returns: (transfer full) (nullable): a newly allocated string formatted to
+ * the requested format or %NULL in the case that there was an error (such
+ * as a format specifier not being supported in the current locale). The
+ * string should be freed with g_free().
* Since: 2.26
*/
@@ -14870,9 +15328,11 @@
* including the date, time and time zone, and return that as a UTF-8 encoded
* string.
*
- * Returns: a newly allocated string formatted in ISO 8601 format
- * or %NULL in the case that there was an error. The string
- * should be freed with g_free().
+ * Since GLib 2.66, this will output to sub-second precision if needed.
+ *
+ * Returns: (transfer full) (nullable): a newly allocated string formatted in
+ * ISO 8601 format or %NULL in the case that there was an error. The string
+ * should be freed with g_free().
* Since: 2.62
*/
@@ -15143,7 +15603,7 @@
/**
- * g_date_time_new:
+ * g_date_time_new: (constructor)
* @tz: a #GTimeZone
* @year: the year component of the date
* @month: the month component of the date
@@ -15181,13 +15641,13 @@
* You should release the return value by calling g_date_time_unref()
* when you are done with it.
*
- * Returns: a new #GDateTime, or %NULL
+ * Returns: (transfer full) (nullable): a new #GDateTime, or %NULL
* Since: 2.26
*/
/**
- * g_date_time_new_from_iso8601:
+ * g_date_time_new_from_iso8601: (constructor)
* @text: an ISO 8601 formatted time string.
* @default_tz: (nullable): a #GTimeZone to use if the text doesn't contain a
* timezone, or %NULL.
@@ -15242,7 +15702,7 @@
/**
- * g_date_time_new_from_timeval_local:
+ * g_date_time_new_from_timeval_local: (constructor)
* @tv: a #GTimeVal
*
* Creates a #GDateTime corresponding to the given #GTimeVal @tv in the
@@ -15258,7 +15718,7 @@
* You should release the return value by calling g_date_time_unref()
* when you are done with it.
*
- * Returns: a new #GDateTime, or %NULL
+ * Returns: (transfer full) (nullable): a new #GDateTime, or %NULL
* Since: 2.26
* Deprecated: 2.62: #GTimeVal is not year-2038-safe. Use
* g_date_time_new_from_unix_local() instead.
@@ -15266,7 +15726,7 @@
/**
- * g_date_time_new_from_timeval_utc:
+ * g_date_time_new_from_timeval_utc: (constructor)
* @tv: a #GTimeVal
*
* Creates a #GDateTime corresponding to the given #GTimeVal @tv in UTC.
@@ -15280,7 +15740,7 @@
* You should release the return value by calling g_date_time_unref()
* when you are done with it.
*
- * Returns: a new #GDateTime, or %NULL
+ * Returns: (transfer full) (nullable): a new #GDateTime, or %NULL
* Since: 2.26
* Deprecated: 2.62: #GTimeVal is not year-2038-safe. Use
* g_date_time_new_from_unix_utc() instead.
@@ -15288,7 +15748,7 @@
/**
- * g_date_time_new_from_unix_local:
+ * g_date_time_new_from_unix_local: (constructor)
* @t: the Unix time
*
* Creates a #GDateTime corresponding to the given Unix time @t in the
@@ -15303,13 +15763,13 @@
* You should release the return value by calling g_date_time_unref()
* when you are done with it.
*
- * Returns: a new #GDateTime, or %NULL
+ * Returns: (transfer full) (nullable): a new #GDateTime, or %NULL
* Since: 2.26
*/
/**
- * g_date_time_new_from_unix_utc:
+ * g_date_time_new_from_unix_utc: (constructor)
* @t: the Unix time
*
* Creates a #GDateTime corresponding to the given Unix time @t in UTC.
@@ -15323,13 +15783,13 @@
* You should release the return value by calling g_date_time_unref()
* when you are done with it.
*
- * Returns: a new #GDateTime, or %NULL
+ * Returns: (transfer full) (nullable): a new #GDateTime, or %NULL
* Since: 2.26
*/
/**
- * g_date_time_new_local:
+ * g_date_time_new_local: (constructor)
* @year: the year component of the date
* @month: the month component of the date
* @day: the day component of the date
@@ -15343,33 +15803,32 @@
* This call is equivalent to calling g_date_time_new() with the time
* zone returned by g_time_zone_new_local().
*
- * Returns: a #GDateTime, or %NULL
+ * Returns: (transfer full) (nullable): a #GDateTime, or %NULL
* Since: 2.26
*/
/**
- * g_date_time_new_now:
+ * g_date_time_new_now: (constructor)
* @tz: a #GTimeZone
*
* Creates a #GDateTime corresponding to this exact instant in the given
* time zone @tz. The time is as accurate as the system allows, to a
* maximum accuracy of 1 microsecond.
*
- * This function will always succeed unless the system clock is set to
- * truly insane values (or unless GLib is still being used after the
- * year 9999).
+ * This function will always succeed unless GLib is still being used after the
+ * year 9999.
*
* You should release the return value by calling g_date_time_unref()
* when you are done with it.
*
- * Returns: a new #GDateTime, or %NULL
+ * Returns: (transfer full) (nullable): a new #GDateTime, or %NULL
* Since: 2.26
*/
/**
- * g_date_time_new_now_local:
+ * g_date_time_new_now_local: (constructor)
*
* Creates a #GDateTime corresponding to this exact instant in the local
* time zone.
@@ -15377,26 +15836,26 @@
* This is equivalent to calling g_date_time_new_now() with the time
* zone returned by g_time_zone_new_local().
*
- * Returns: a new #GDateTime, or %NULL
+ * Returns: (transfer full) (nullable): a new #GDateTime, or %NULL
* Since: 2.26
*/
/**
- * g_date_time_new_now_utc:
+ * g_date_time_new_now_utc: (constructor)
*
* Creates a #GDateTime corresponding to this exact instant in UTC.
*
* This is equivalent to calling g_date_time_new_now() with the time
* zone returned by g_time_zone_new_utc().
*
- * Returns: a new #GDateTime, or %NULL
+ * Returns: (transfer full) (nullable): a new #GDateTime, or %NULL
* Since: 2.26
*/
/**
- * g_date_time_new_utc:
+ * g_date_time_new_utc: (constructor)
* @year: the year component of the date
* @month: the month component of the date
* @day: the day component of the date
@@ -15410,7 +15869,7 @@
* This call is equivalent to calling g_date_time_new() with the time
* zone returned by g_time_zone_new_utc().
*
- * Returns: a #GDateTime, or %NULL
+ * Returns: (transfer full) (nullable): a #GDateTime, or %NULL
* Since: 2.26
*/
@@ -15436,7 +15895,8 @@
* This call is equivalent to calling g_date_time_to_timezone() with the
* time zone returned by g_time_zone_new_local().
*
- * Returns: the newly created #GDateTime
+ * Returns: (transfer full) (nullable): the newly created #GDateTime which
+ * should be freed with g_date_time_unref(), or %NULL
* Since: 2.26
*/
@@ -15479,10 +15939,8 @@
* example, converting 0001-01-01 00:00:00 UTC to a time zone west of
* Greenwich will fail (due to the year 0 being out of range).
*
- * You should release the return value by calling g_date_time_unref()
- * when you are done with it.
- *
- * Returns: a new #GDateTime, or %NULL
+ * Returns: (transfer full) (nullable): the newly created #GDateTime which
+ * should be freed with g_date_time_unref(), or %NULL
* Since: 2.26
*/
@@ -15512,7 +15970,8 @@
* This call is equivalent to calling g_date_time_to_timezone() with the
* time zone returned by g_time_zone_new_utc().
*
- * Returns: the newly created #GDateTime
+ * Returns: (transfer full) (nullable): the newly created #GDateTime which
+ * should be freed with g_date_time_unref(), or %NULL
* Since: 2.26
*/
@@ -15536,7 +15995,7 @@
* @tm: (not nullable): struct tm to fill
*
* Fills in the date-related bits of a struct tm using the @date value.
- * Initializes the non-date parts with something sane but meaningless.
+ * Initializes the non-date parts with something safe but meaningless.
*/
@@ -16200,11 +16659,43 @@
* @length: length of @contents, or -1 if @contents is a nul-terminated string
* @error: return location for a #GError, or %NULL
*
+ * Writes all of @contents to a file named @filename. This is a convenience
+ * wrapper around calling g_file_set_contents() with `flags` set to
+ * `G_FILE_SET_CONTENTS_CONSISTENT | G_FILE_SET_CONTENTS_ONLY_EXISTING` and
+ * `mode` set to `0666`.
+ *
+ * Returns: %TRUE on success, %FALSE if an error occurred
+ * Since: 2.8
+ */
+
+
+/**
+ * g_file_set_contents_full:
+ * @filename: (type filename): name of a file to write @contents to, in the GLib file name
+ * encoding
+ * @contents: (array length=length) (element-type guint8): string to write to the file
+ * @length: length of @contents, or -1 if @contents is a nul-terminated string
+ * @flags: flags controlling the safety vs speed of the operation
+ * @mode: file mode, as passed to `open()`; typically this will be `0666`
+ * @error: return location for a #GError, or %NULL
+ *
* Writes all of @contents to a file named @filename, with good error checking.
* If a file called @filename already exists it will be overwritten.
*
- * This write is atomic in the sense that it is first written to a temporary
- * file which is then renamed to the final name. Notes:
+ * @flags control the properties of the write operation: whether it’s atomic,
+ * and what the tradeoff is between returning quickly or being resilient to
+ * system crashes.
+ *
+ * As this function performs file I/O, it is recommended to not call it anywhere
+ * where blocking would cause problems, such as in the main loop of a graphical
+ * application. In particular, if @flags has any value other than
+ * %G_FILE_SET_CONTENTS_NONE then this function may call `fsync()`.
+ *
+ * If %G_FILE_SET_CONTENTS_CONSISTENT is set in @flags, the operation is atomic
+ * in the sense that it is first written to a temporary file which is then
+ * renamed to the final name.
+ *
+ * Notes:
*
* - On UNIX, if @filename already exists hard links to @filename will break.
* Also since the file is recreated, existing permissions, access control
@@ -16212,15 +16703,17 @@
* the link itself will be replaced, not the linked file.
*
* - On UNIX, if @filename already exists and is non-empty, and if the system
- * supports it (via a journalling filesystem or equivalent), the fsync()
- * call (or equivalent) will be used to ensure atomic replacement: @filename
+ * supports it (via a journalling filesystem or equivalent), and if
+ * %G_FILE_SET_CONTENTS_CONSISTENT is set in @flags, the `fsync()` call (or
+ * equivalent) will be used to ensure atomic replacement: @filename
* will contain either its old contents or @contents, even in the face of
* system power loss, the disk being unsafely removed, etc.
*
* - On UNIX, if @filename does not already exist or is empty, there is a
* possibility that system power loss etc. after calling this function will
* leave @filename empty or full of NUL bytes, depending on the underlying
- * filesystem.
+ * filesystem, unless %G_FILE_SET_CONTENTS_DURABLE and
+ * %G_FILE_SET_CONTENTS_CONSISTENT are set in @flags.
*
* - On Windows renaming a file will not remove an existing file with the
* new name, so on Windows there is a race condition between the existing
@@ -16237,8 +16730,12 @@
* Note that the name for the temporary file is constructed by appending up
* to 7 characters to @filename.
*
+ * If the file didn’t exist before and is created, it will be given the
+ * permissions from @mode. Otherwise, the permissions of the existing file may
+ * be changed to @mode depending on @flags, or they may remain unchanged.
+ *
* Returns: %TRUE on success, %FALSE if an error occurred
- * Since: 2.8
+ * Since: 2.66
*/
@@ -16501,7 +16998,7 @@
*
* As `close()` and `fclose()` are part of the C library, this implies that it is
* currently impossible to close a file if the application C library and the C library
- * used by GLib are different. Convenience functions like g_file_set_contents()
+ * used by GLib are different. Convenience functions like g_file_set_contents_full()
* avoid this problem.
*
* Returns: A `FILE*` if the file was successfully opened, or %NULL if
@@ -16622,10 +17119,13 @@
* g_fsync:
* @fd: a file descriptor
*
- * A wrapper for the POSIX fsync() function (_commit() on Windows).
- * The fsync() function is used to synchronize a file's in-core
+ * A wrapper for the POSIX `fsync()` function. On Windows, `_commit()` will be
+ * used. On macOS, `fcntl(F_FULLFSYNC)` will be used.
+ * The `fsync()` function is used to synchronize a file's in-core
* state with that of the disk.
*
+ * This wrapper will handle retrying on `EINTR`.
+ *
* See the C library manual for more details about fsync().
*
* Returns: 0 on success, or -1 if an error occurred.
@@ -18272,6 +18772,8 @@
* Tests if @hostname is the string form of an IPv4 or IPv6 address.
* (Eg, "192.168.0.1".)
*
+ * Since 2.66, IPv6 addresses with a zone-id are accepted (RFC6874).
+ *
* Returns: %TRUE if @hostname is an IP address
* Since: 2.22
*/
@@ -18814,7 +19316,7 @@
* @buf: (out caller-allocates) (array length=count) (element-type guint8):
* a buffer to read data into
* @count: (in): the size of the buffer. Note that the buffer may not be
- * complelely filled even if there is data in the buffer if the
+ * completely filled even if there is data in the buffer if the
* remaining data is not a complete character.
* @bytes_read: (out) (optional): The number of bytes read. This may be
* zero even on success if count < 6 and the channel's encoding
@@ -19747,7 +20249,7 @@
* @full_path. If the file could not be loaded then an %error is
* set to either a #GFileError or #GKeyFileError.
*
- * Returns: %TRUE if a key file could be loaded, %FALSE othewise
+ * Returns: %TRUE if a key file could be loaded, %FALSE otherwise
* Since: 2.6
*/
@@ -19874,7 +20376,9 @@
* @error: a pointer to a %NULL #GError, or %NULL
*
* Writes the contents of @key_file to @filename using
- * g_file_set_contents().
+ * g_file_set_contents(). If you need stricter guarantees about durability of
+ * the written file than are provided by g_file_set_contents(), use
+ * g_file_set_contents_full() with the return value of g_key_file_to_data().
*
* This function can fail for any of the reasons that
* g_file_set_contents() may fail.
@@ -20846,7 +21350,7 @@
*
* - `G_MESSAGES_PREFIXED`: A :-separated list of log levels for which
* messages should be prefixed by the program name and PID of the
- * aplication.
+ * application.
*
* - `G_MESSAGES_DEBUG`: A space-separated list of log domains for
* which debug and informational messages are printed. By default
@@ -26904,7 +27408,7 @@
* Compiles the regular expression to an internal form, and does
* the initial setup of the #GRegex structure.
*
- * Returns: (nullable): a #GRegex structure or %NULL if an error occured. Call
+ * Returns: (nullable): a #GRegex structure or %NULL if an error occurred. Call
* g_regex_unref() when you are done with it
* Since: 2.14
*/
@@ -26951,7 +27455,7 @@
* If you do not need to use backreferences use g_regex_replace_literal().
*
* The @replacement string must be UTF-8 encoded even if #G_REGEX_RAW was
- * passed to g_regex_new(). If you want to use not UTF-8 encoded stings
+ * passed to g_regex_new(). If you want to use not UTF-8 encoded strings
* you can use g_regex_replace_literal().
*
* Setting @start_position differs from just passing over a shortened
@@ -30976,7 +31480,7 @@
* to be used, or %NULL
* @allow_utf8: set %TRUE if the escaped string may include UTF8 characters
*
- * Appends @unescaped to @string, escaped any characters that
+ * Appends @unescaped to @string, escaping any characters that
* are reserved in URIs using URI-style escape sequences.
*
* Returns: (transfer none): @string
@@ -31760,7 +32264,8 @@
* g_strsplit_set:
* @string: The string to be tokenized
* @delimiters: A nul-terminated string containing bytes that are used
- * to split the string.
+ * to split the string (it can accept an empty string, which will result
+ * in no string splitting).
* @max_tokens: The maximum number of tokens to split @string into.
* If this is less than 1, the string is split completely
*
@@ -32055,8 +32560,11 @@
* @data_test: (scope async): the actual test function
* @data_teardown: (scope async): the function to teardown the fixture data
*
- * Create a new #GTestCase, named @test_name, this API is fairly
- * low level, calling g_test_add() or g_test_add_func() is preferable.
+ * Create a new #GTestCase, named @test_name.
+ *
+ * This API is fairly low level, and calling g_test_add() or g_test_add_func()
+ * is preferable.
+ *
* When this test is executed, a fixture structure of size @data_size
* will be automatically allocated and filled with zeros. Then @data_setup is
* called to initialize the fixture. After fixture setup, the actual test
@@ -32065,10 +32573,10 @@
* after that the memory is automatically released by the test framework.
*
* Splitting up a test run into fixture setup, test function and
- * fixture teardown is most useful if the same fixture is used for
+ * fixture teardown is most useful if the same fixture type is used for
* multiple tests. In this cases, g_test_create_case() will be
- * called with the same fixture, but varying @test_name and
- * @data_test arguments.
+ * called with the same type of fixture (the @data_size argument), but varying
+ * @test_name and @data_test arguments.
*
* Returns: a newly allocated #GTestCase.
* Since: 2.16
@@ -32625,16 +33133,14 @@
/**
* g_test_set_nonfatal_assertions:
*
- * Changes the behaviour of g_assert_cmpstr(), g_assert_cmpint(),
- * g_assert_cmpuint(), g_assert_cmphex(), g_assert_cmpfloat(),
- * g_assert_true(), g_assert_false(), g_assert_null(), g_assert_no_error(),
- * g_assert_error(), g_test_assert_expected_messages() and the various
- * g_test_trap_assert_*() macros to not abort to program, but instead
+ * Changes the behaviour of the various `g_assert_*()` macros,
+ * g_test_assert_expected_messages() and the various
+ * `g_test_trap_assert_*()` macros to not abort to program, but instead
* call g_test_fail() and continue. (This also changes the behavior of
* g_test_fail() so that it will not cause the test program to abort
* after completing the failed test.)
*
- * Note that the g_assert_not_reached() and g_assert() are not
+ * Note that the g_assert_not_reached() and g_assert() macros are not
* affected by this.
*
* This function can only be called after g_test_init().
@@ -33041,7 +33547,7 @@
/**
* g_thread_join:
- * @thread: a #GThread
+ * @thread: (transfer full): a #GThread
*
* Waits until @thread finishes, i.e. the function @func, as
* given to g_thread_new(), returns or g_thread_exit() is called.
@@ -33060,15 +33566,15 @@
* to be freed. Use g_thread_ref() to obtain an extra reference if you
* want to keep the GThread alive beyond the g_thread_join() call.
*
- * Returns: the return value of the thread
+ * Returns: (transfer full): the return value of the thread
*/
/**
* g_thread_new:
* @name: (nullable): an (optional) name for the new thread
- * @func: a function to execute in the new thread
- * @data: an argument to supply to the new thread
+ * @func: (closure data) (scope async): a function to execute in the new thread
+ * @data: (nullable): an argument to supply to the new thread
*
* This function creates a new thread. The new thread starts by invoking
* @func with the argument data. The thread will run until @func returns
@@ -33098,7 +33604,7 @@
* Starting with GLib 2.64 the behaviour is now consistent between Windows and
* POSIX and all threads inherit their parent thread's priority.
*
- * Returns: the new #GThread
+ * Returns: (transfer full): the new #GThread
* Since: 2.32
*/
@@ -33117,10 +33623,10 @@
* processing a task. Instead at least all still running threads
* can finish their tasks before the @pool is freed.
*
- * If @wait_ is %TRUE, the functions does not return before all
+ * If @wait_ is %TRUE, this function does not return before all
* tasks to be processed (dependent on @immediate, whether all
* or only the currently running) are ready.
- * Otherwise the function returns immediately.
+ * Otherwise this function returns immediately.
*
* After calling this function @pool must not be used anymore.
*/
@@ -33214,6 +33720,10 @@
* with the two arguments. The first one is the parameter to
* g_thread_pool_push() and the second one is @user_data.
*
+ * Pass g_get_num_processors() to @max_threads to create as many threads as
+ * there are logical processors on the system. This will not pin each thread to
+ * a specific processor.
+ *
* The parameter @exclusive determines whether the thread pool owns
* all threads exclusive or shares them with other thread pools.
* If @exclusive is %TRUE, @max_threads threads are started
@@ -33374,7 +33884,7 @@
*
* Increase the reference count on @thread.
*
- * Returns: a new reference to @thread
+ * Returns: (transfer full): a new reference to @thread
* Since: 2.32
*/
@@ -33392,7 +33902,7 @@
* (i.e. comparisons) but you must not use GLib functions (such
* as g_thread_join()) on these threads.
*
- * Returns: the #GThread representing the current thread
+ * Returns: (transfer none): the #GThread representing the current thread
*/
@@ -33412,8 +33922,8 @@
/**
* g_thread_try_new:
* @name: (nullable): an (optional) name for the new thread
- * @func: a function to execute in the new thread
- * @data: an argument to supply to the new thread
+ * @func: (closure data) (scope async): a function to execute in the new thread
+ * @data: (nullable): an argument to supply to the new thread
* @error: return location for error, or %NULL
*
* This function is the same as g_thread_new() except that
@@ -33422,14 +33932,14 @@
* If a thread can not be created (due to resource limits),
* @error is set and %NULL is returned.
*
- * Returns: the new #GThread, or %NULL if an error occurred
+ * Returns: (transfer full): the new #GThread, or %NULL if an error occurred
* Since: 2.32
*/
/**
* g_thread_unref:
- * @thread: a #GThread
+ * @thread: (transfer full): a #GThread
*
* Decrease the reference count on @thread, possibly freeing all
* resources associated with it.
@@ -34214,6 +34724,9 @@
*
* The tree is automatically 'balanced' as new key/value pairs are added,
* so that the distance from the root to every leaf is as small as possible.
+ * The cost of maintaining a balanced tree while inserting new key/value
+ * result in a O(n log(n)) operation where most of the other operations
+ * are O(log(n)).
*/
@@ -34327,6 +34840,10 @@
* make sure that any dynamically allocated values are freed yourself.
* If the key does not exist in the #GTree, the function does nothing.
*
+ * The cost of maintaining a balanced tree while removing a key/value
+ * result in a O(n log(n)) operation where most of the other operations
+ * are O(log(n)).
+ *
* Returns: %TRUE if the key was found (prior to 2.8, this function
* returned nothing)
*/
@@ -34992,7 +35509,7 @@
* g_unichar_isxdigit:
* @c: a Unicode character.
*
- * Determines if a character is a hexidecimal digit.
+ * Determines if a character is a hexadecimal digit.
*
* Returns: %TRUE if the character is a hexadecimal digit
*/
@@ -35092,7 +35609,7 @@
* g_unichar_xdigit_value:
* @c: a Unicode character
*
- * Determines the numeric value of a character as a hexidecimal
+ * Determines the numeric value of a character as a hexadecimal
* digit.
*
* Returns: If @c is a hex digit (according to
@@ -35402,28 +35919,330 @@
/**
+ * g_uri_build:
+ * @flags: flags describing how to build the #GUri
+ * @scheme: (not nullable): the URI scheme
+ * @userinfo: (nullable): the userinfo component, or %NULL
+ * @host: (nullable): the host component, or %NULL
+ * @port: the port, or `-1`
+ * @path: (not nullable): the path component
+ * @query: (nullable): the query component, or %NULL
+ * @fragment: (nullable): the fragment, or %NULL
+ *
+ * Creates a new #GUri from the given components according to @flags.
+ *
+ * See also g_uri_build_with_user(), which allows specifying the
+ * components of the "userinfo" separately.
+ *
+ * Returns: (transfer full): a new #GUri
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_build_with_user:
+ * @flags: flags describing how to build the #GUri
+ * @scheme: (not nullable): the URI scheme
+ * @user: (nullable): the user component of the userinfo, or %NULL
+ * @password: (nullable): the password component of the userinfo, or %NULL
+ * @auth_params: (nullable): the auth params of the userinfo, or %NULL
+ * @host: (nullable): the host component, or %NULL
+ * @port: the port, or `-1`
+ * @path: (not nullable): the path component
+ * @query: (nullable): the query component, or %NULL
+ * @fragment: (nullable): the fragment, or %NULL
+ *
+ * Creates a new #GUri from the given components according to @flags
+ * (%G_URI_FLAGS_HAS_PASSWORD is added unconditionally). The @flags must be
+ * coherent with the passed values, in particular use `%`-encoded values with
+ * %G_URI_FLAGS_ENCODED.
+ *
+ * In contrast to g_uri_build(), this allows specifying the components
+ * of the ‘userinfo’ field separately. Note that @user must be non-%NULL
+ * if either @password or @auth_params is non-%NULL.
+ *
+ * Returns: (transfer full): a new #GUri
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_escape_bytes:
+ * @unescaped: (array length=length): the unescaped input data.
+ * @length: the length of @unescaped
+ * @reserved_chars_allowed: (nullable): a string of reserved
+ * characters that are allowed to be used, or %NULL.
+ *
+ * Escapes arbitrary data for use in a URI.
+ *
+ * Normally all characters that are not ‘unreserved’ (i.e. ASCII
+ * alphanumerical characters plus dash, dot, underscore and tilde) are
+ * escaped. But if you specify characters in @reserved_chars_allowed
+ * they are not escaped. This is useful for the ‘reserved’ characters
+ * in the URI specification, since those are allowed unescaped in some
+ * portions of a URI.
+ *
+ * Though technically incorrect, this will also allow escaping nul
+ * bytes as `%``00`.
+ *
+ * Returns: (transfer full): an escaped version of @unescaped. The returned
+ * string should be freed when no longer needed.
+ * Since: 2.66
+ */
+
+
+/**
* g_uri_escape_string:
* @unescaped: the unescaped input string.
- * @reserved_chars_allowed: (nullable): a string of reserved characters that
- * are allowed to be used, or %NULL.
+ * @reserved_chars_allowed: (nullable): a string of reserved
+ * characters that are allowed to be used, or %NULL.
* @allow_utf8: %TRUE if the result can include UTF-8 characters.
*
* Escapes a string for use in a URI.
*
- * Normally all characters that are not "unreserved" (i.e. ASCII alphanumerical
- * characters plus dash, dot, underscore and tilde) are escaped.
- * But if you specify characters in @reserved_chars_allowed they are not
- * escaped. This is useful for the "reserved" characters in the URI
- * specification, since those are allowed unescaped in some portions of
- * a URI.
+ * Normally all characters that are not "unreserved" (i.e. ASCII
+ * alphanumerical characters plus dash, dot, underscore and tilde) are
+ * escaped. But if you specify characters in @reserved_chars_allowed
+ * they are not escaped. This is useful for the "reserved" characters
+ * in the URI specification, since those are allowed unescaped in some
+ * portions of a URI.
*
- * Returns: an escaped version of @unescaped. The returned string should be
- * freed when no longer needed.
+ * Returns: an escaped version of @unescaped. The returned string
+ * should be freed when no longer needed.
* Since: 2.16
*/
/**
+ * g_uri_get_auth_params:
+ * @uri: a #GUri
+ *
+ * Gets @uri's authentication parameters, which may contain
+ * `%`-encoding, depending on the flags with which @uri was created.
+ * (If @uri was not created with %G_URI_FLAGS_HAS_AUTH_PARAMS then this will
+ * be %NULL.)
+ *
+ * Depending on the URI scheme, g_uri_parse_params() may be useful for
+ * further parsing this information.
+ *
+ * Returns: (nullable): @uri's authentication parameters.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_get_flags:
+ * @uri: a #GUri
+ *
+ * Gets @uri's flags set upon construction.
+ *
+ * Returns: @uri's flags.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_get_fragment:
+ * @uri: a #GUri
+ *
+ * Gets @uri's fragment, which may contain `%`-encoding, depending on
+ * the flags with which @uri was created.
+ *
+ * Returns: (nullable): @uri's fragment.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_get_host:
+ * @uri: a #GUri
+ *
+ * Gets @uri's host. This will never have `%`-encoded characters,
+ * unless it is non-UTF-8 (which can only be the case if @uri was
+ * created with %G_URI_FLAGS_NON_DNS).
+ *
+ * If @uri contained an IPv6 address literal, this value will be just
+ * that address, without the brackets around it that are necessary in
+ * the string form of the URI. Note that in this case there may also
+ * be a scope ID attached to the address. Eg, `fe80::1234%``em1` (or
+ * `fe80::1234%``25em1` if the string is still encoded).
+ *
+ * Returns: (not nullable): @uri's host.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_get_password:
+ * @uri: a #GUri
+ *
+ * Gets @uri's password, which may contain `%`-encoding, depending on
+ * the flags with which @uri was created. (If @uri was not created
+ * with %G_URI_FLAGS_HAS_PASSWORD then this will be %NULL.)
+ *
+ * Returns: (nullable): @uri's password.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_get_path:
+ * @uri: a #GUri
+ *
+ * Gets @uri's path, which may contain `%`-encoding, depending on the
+ * flags with which @uri was created.
+ *
+ * Returns: (not nullable): @uri's path.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_get_port:
+ * @uri: a #GUri
+ *
+ * Gets @uri's port.
+ *
+ * Returns: @uri's port, or `-1` if no port was specified.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_get_query:
+ * @uri: a #GUri
+ *
+ * Gets @uri's query, which may contain `%`-encoding, depending on the
+ * flags with which @uri was created.
+ *
+ * For queries consisting of a series of `name=value` parameters,
+ * #GUriParamsIter or g_uri_parse_params() may be useful.
+ *
+ * Returns: (nullable): @uri's query.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_get_scheme:
+ * @uri: a #GUri
+ *
+ * Gets @uri's scheme. Note that this will always be all-lowercase,
+ * regardless of the string or strings that @uri was created from.
+ *
+ * Returns: (not nullable): @uri's scheme.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_get_user:
+ * @uri: a #GUri
+ *
+ * Gets the ‘username’ component of @uri's userinfo, which may contain
+ * `%`-encoding, depending on the flags with which @uri was created.
+ * If @uri was not created with %G_URI_FLAGS_HAS_PASSWORD or
+ * %G_URI_FLAGS_HAS_AUTH_PARAMS, this is the same as g_uri_get_userinfo().
+ *
+ * Returns: (nullable): @uri's user.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_get_userinfo:
+ * @uri: a #GUri
+ *
+ * Gets @uri's userinfo, which may contain `%`-encoding, depending on
+ * the flags with which @uri was created.
+ *
+ * Returns: (nullable): @uri's userinfo.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_is_valid:
+ * @uri_string: a string containing an absolute URI
+ * @flags: flags for parsing @uri_string
+ * @error: #GError for error reporting, or %NULL to ignore.
+ *
+ * Parses @uri_string according to @flags, to determine whether it is a valid
+ * [absolute URI][relative-absolute-uris], i.e. it does not need to be resolved
+ * relative to another URI using g_uri_parse_relative().
+ *
+ * If it’s not a valid URI, an error is returned explaining how it’s invalid.
+ *
+ * See g_uri_split(), and the definition of #GUriFlags, for more
+ * information on the effect of @flags.
+ *
+ * Returns: %TRUE if @uri_string is a valid absolute URI, %FALSE on error.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_join:
+ * @flags: flags describing how to build the URI string
+ * @scheme: (nullable): the URI scheme, or %NULL
+ * @userinfo: (nullable): the userinfo component, or %NULL
+ * @host: (nullable): the host component, or %NULL
+ * @port: the port, or `-1`
+ * @path: (not nullable): the path component
+ * @query: (nullable): the query component, or %NULL
+ * @fragment: (nullable): the fragment, or %NULL
+ *
+ * Joins the given components together according to @flags to create
+ * an absolute URI string. @path may not be %NULL (though it may be the empty
+ * string).
+ *
+ * When @host is present, @path must either be empty or begin with a slash (`/`)
+ * character. When @host is not present, @path cannot begin with two slash
+ * characters (`//`). See
+ * [RFC 3986, section 3](https://tools.ietf.org/html/rfc3986#section-3).
+ *
+ * See also g_uri_join_with_user(), which allows specifying the
+ * components of the ‘userinfo’ separately.
+ *
+ * %G_URI_FLAGS_HAS_PASSWORD and %G_URI_FLAGS_HAS_AUTH_PARAMS are ignored if set
+ * in @flags.
+ *
+ * Returns: (transfer full): an absolute URI string
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_join_with_user:
+ * @flags: flags describing how to build the URI string
+ * @scheme: (nullable): the URI scheme, or %NULL
+ * @user: (nullable): the user component of the userinfo, or %NULL
+ * @password: (nullable): the password component of the userinfo, or
+ * %NULL
+ * @auth_params: (nullable): the auth params of the userinfo, or
+ * %NULL
+ * @host: (nullable): the host component, or %NULL
+ * @port: the port, or `-1`
+ * @path: (not nullable): the path component
+ * @query: (nullable): the query component, or %NULL
+ * @fragment: (nullable): the fragment, or %NULL
+ *
+ * Joins the given components together according to @flags to create
+ * an absolute URI string. @path may not be %NULL (though it may be the empty
+ * string).
+ *
+ * In contrast to g_uri_join(), this allows specifying the components
+ * of the ‘userinfo’ separately. It otherwise behaves the same.
+ *
+ * %G_URI_FLAGS_HAS_PASSWORD and %G_URI_FLAGS_HAS_AUTH_PARAMS are ignored if set
+ * in @flags.
+ *
+ * Returns: (transfer full): an absolute URI string
+ * Since: 2.66
+ */
+
+
+/**
* g_uri_list_extract_uris:
* @uri_list: an URI list
*
@@ -35439,34 +36258,421 @@
/**
+ * g_uri_params_iter_init:
+ * @iter: an uninitialized #GUriParamsIter
+ * @params: a `%`-encoded string containing `attribute=value`
+ * parameters
+ * @length: the length of @params, or `-1` if it is nul-terminated
+ * @separators: the separator byte character set between parameters. (usually
+ * `&`, but sometimes `;` or both `&;`). Note that this function works on
+ * bytes not characters, so it can't be used to delimit UTF-8 strings for
+ * anything but ASCII characters. You may pass an empty set, in which case
+ * no splitting will occur.
+ * @flags: flags to modify the way the parameters are handled.
+ *
+ * Initializes an attribute/value pair iterator.
+ *
+ * The iterator keeps pointers to the @params and @separators arguments, those
+ * variables must thus outlive the iterator and not be modified during the
+ * iteration.
+ *
+ * If %G_URI_PARAMS_WWW_FORM is passed in @flags, `+` characters in the param
+ * string will be replaced with spaces in the output. For example, `foo=bar+baz`
+ * will give attribute `foo` with value `bar baz`. This is commonly used on the
+ * web (the `https` and `http` schemes only), but is deprecated in favour of
+ * the equivalent of encoding spaces as `%20`.
+ *
+ * Unlike with g_uri_parse_params(), %G_URI_PARAMS_CASE_INSENSITIVE has no
+ * effect if passed to @flags for g_uri_params_iter_init(). The caller is
+ * responsible for doing their own case-insensitive comparisons.
+ *
+ * |[<!-- language="C" -->
+ * GUriParamsIter iter;
+ * GError *error = NULL;
+ * gchar *unowned_attr, *unowned_value;
+ *
+ * g_uri_params_iter_init (&iter, "foo=bar&baz=bar&Foo=frob&baz=bar2", -1, "&", G_URI_PARAMS_NONE);
+ * while (g_uri_params_iter_next (&iter, &unowned_attr, &unowned_value, &error))
+ * {
+ * g_autofree gchar *attr = g_steal_pointer (&unowned_attr);
+ * g_autofree gchar *value = g_steal_pointer (&unowned_value);
+ * // do something with attr and value; this code will be called 4 times
+ * // for the params string in this example: once with attr=foo and value=bar,
+ * // then with baz/bar, then Foo/frob, then baz/bar2.
+ * }
+ * if (error)
+ * // handle parsing error
+ * ]|
+ *
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_params_iter_next:
+ * @iter: an initialized #GUriParamsIter
+ * @attribute: (out) (nullable) (optional) (transfer full): on return, contains
+ * the attribute, or %NULL.
+ * @value: (out) (nullable) (optional) (transfer full): on return, contains
+ * the value, or %NULL.
+ * @error: #GError for error reporting, or %NULL to ignore.
+ *
+ * Advances @iter and retrieves the next attribute/value. %FALSE is returned if
+ * an error has occurred (in which case @error is set), or if the end of the
+ * iteration is reached (in which case @attribute and @value are set to %NULL
+ * and the iterator becomes invalid). If %TRUE is returned,
+ * g_uri_params_iter_next() may be called again to receive another
+ * attribute/value pair.
+ *
+ * Note that the same @attribute may be returned multiple times, since URIs
+ * allow repeated attributes.
+ *
+ * Returns: %FALSE if the end of the parameters has been reached or an error was
+ * encountered. %TRUE otherwise.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_parse:
+ * @uri_string: a string representing an absolute URI
+ * @flags: flags describing how to parse @uri_string
+ * @error: #GError for error reporting, or %NULL to ignore.
+ *
+ * Parses @uri_string according to @flags. If the result is not a
+ * valid [absolute URI][relative-absolute-uris], it will be discarded, and an
+ * error returned.
+ *
+ * Returns: (transfer full): a new #GUri.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_parse_params:
+ * @params: a `%`-encoded string containing `attribute=value`
+ * parameters
+ * @length: the length of @params, or `-1` if it is nul-terminated
+ * @separators: the separator byte character set between parameters. (usually
+ * `&`, but sometimes `;` or both `&;`). Note that this function works on
+ * bytes not characters, so it can't be used to delimit UTF-8 strings for
+ * anything but ASCII characters. You may pass an empty set, in which case
+ * no splitting will occur.
+ * @flags: flags to modify the way the parameters are handled.
+ * @error: #GError for error reporting, or %NULL to ignore.
+ *
+ * Many URI schemes include one or more attribute/value pairs as part of the URI
+ * value. This method can be used to parse them into a hash table. When an
+ * attribute has multiple occurrences, the last value is the final returned
+ * value. If you need to handle repeated attributes differently, use
+ * #GUriParamsIter.
+ *
+ * The @params string is assumed to still be `%`-encoded, but the returned
+ * values will be fully decoded. (Thus it is possible that the returned values
+ * may contain `=` or @separators, if the value was encoded in the input.)
+ * Invalid `%`-encoding is treated as with the %G_URI_FLAGS_PARSE_RELAXED
+ * rules for g_uri_parse(). (However, if @params is the path or query string
+ * from a #GUri that was parsed without %G_URI_FLAGS_PARSE_RELAXED and
+ * %G_URI_FLAGS_ENCODED, then you already know that it does not contain any
+ * invalid encoding.)
+ *
+ * %G_URI_PARAMS_WWW_FORM is handled as documented for g_uri_params_iter_init().
+ *
+ * If %G_URI_PARAMS_CASE_INSENSITIVE is passed to @flags, attributes will be
+ * compared case-insensitively, so a params string `attr=123&Attr=456` will only
+ * return a single attribute–value pair, `Attr=456`. Case will be preserved in
+ * the returned attributes.
+ *
+ * If @params cannot be parsed (for example, it contains two @separators
+ * characters in a row), then @error is set and %NULL is returned.
+ *
+ * Returns: (transfer full) (element-type utf8 utf8): A hash table of
+ * attribute/value pairs, with both names and values fully-decoded; or %NULL
+ * on error.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_parse_relative:
+ * @base_uri: (nullable) (transfer none): a base absolute URI
+ * @uri_ref: a string representing a relative or absolute URI
+ * @flags: flags describing how to parse @uri_ref
+ * @error: #GError for error reporting, or %NULL to ignore.
+ *
+ * Parses @uri_ref according to @flags and, if it is a
+ * [relative URI][relative-absolute-uris], resolves it relative to @base_uri.
+ * If the result is not a valid absolute URI, it will be discarded, and an error
+ * returned.
+ *
+ * Returns: (transfer full): a new #GUri.
+ * Since: 2.66
+ */
+
+
+/**
* g_uri_parse_scheme:
* @uri: a valid URI.
*
- * Gets the scheme portion of a URI string. RFC 3986 decodes the scheme as:
+ * Gets the scheme portion of a URI string.
+ * [RFC 3986](https://tools.ietf.org/html/rfc3986#section-3) decodes the scheme
+ * as:
* |[
* URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
* ]|
- * Common schemes include "file", "http", "svn+ssh", etc.
+ * Common schemes include `file`, `https`, `svn+ssh`, etc.
*
- * Returns: The "Scheme" component of the URI, or %NULL on error.
- * The returned string should be freed when no longer needed.
+ * Returns: (transfer full) (nullable): The ‘scheme’ component of the URI, or
+ * %NULL on error. The returned string should be freed when no longer needed.
* Since: 2.16
*/
/**
+ * g_uri_peek_scheme:
+ * @uri: a valid URI.
+ *
+ * Gets the scheme portion of a URI string.
+ * [RFC 3986](https://tools.ietf.org/html/rfc3986#section-3) decodes the scheme
+ * as:
+ * |[
+ * URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
+ * ]|
+ * Common schemes include `file`, `https`, `svn+ssh`, etc.
+ *
+ * Unlike g_uri_parse_scheme(), the returned scheme is normalized to
+ * all-lowercase and does not need to be freed.
+ *
+ * Returns: (transfer none) (nullable): The ‘scheme’ component of the URI, or
+ * %NULL on error. The returned string is normalized to all-lowercase, and
+ * interned via g_intern_string(), so it does not need to be freed.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_ref: (skip)
+ * @uri: a #GUri
+ *
+ * Increments the reference count of @uri by one.
+ *
+ * Returns: @uri
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_resolve_relative:
+ * @base_uri_string: (nullable): a string representing a base URI
+ * @uri_ref: a string representing a relative or absolute URI
+ * @flags: flags describing how to parse @uri_ref
+ * @error: #GError for error reporting, or %NULL to ignore.
+ *
+ * Parses @uri_ref according to @flags and, if it is a
+ * [relative URI][relative-absolute-uris], resolves it relative to
+ * @base_uri_string. If the result is not a valid absolute URI, it will be
+ * discarded, and an error returned.
+ *
+ * (If @base_uri_string is %NULL, this just returns @uri_ref, or
+ * %NULL if @uri_ref is invalid or not absolute.)
+ *
+ * Returns: (transfer full): the resolved URI string.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_split:
+ * @uri_ref: a string containing a relative or absolute URI
+ * @flags: flags for parsing @uri_ref
+ * @scheme: (out) (nullable) (optional) (transfer full): on return, contains
+ * the scheme (converted to lowercase), or %NULL
+ * @userinfo: (out) (nullable) (optional) (transfer full): on return, contains
+ * the userinfo, or %NULL
+ * @host: (out) (nullable) (optional) (transfer full): on return, contains the
+ * host, or %NULL
+ * @port: (out) (optional) (transfer full): on return, contains the
+ * port, or `-1`
+ * @path: (out) (not nullable) (optional) (transfer full): on return, contains the
+ * path
+ * @query: (out) (nullable) (optional) (transfer full): on return, contains the
+ * query, or %NULL
+ * @fragment: (out) (nullable) (optional) (transfer full): on return, contains
+ * the fragment, or %NULL
+ * @error: #GError for error reporting, or %NULL to ignore.
+ *
+ * Parses @uri_ref (which can be an
+ * [absolute or relative URI][relative-absolute-uris]) according to @flags, and
+ * returns the pieces. Any component that doesn't appear in @uri_ref will be
+ * returned as %NULL (but note that all URIs always have a path component,
+ * though it may be the empty string).
+ *
+ * If @flags contains %G_URI_FLAGS_ENCODED, then `%`-encoded characters in
+ * @uri_ref will remain encoded in the output strings. (If not,
+ * then all such characters will be decoded.) Note that decoding will
+ * only work if the URI components are ASCII or UTF-8, so you will
+ * need to use %G_URI_FLAGS_ENCODED if they are not.
+ *
+ * Note that the %G_URI_FLAGS_HAS_PASSWORD and
+ * %G_URI_FLAGS_HAS_AUTH_PARAMS @flags are ignored by g_uri_split(),
+ * since it always returns only the full userinfo; use
+ * g_uri_split_with_user() if you want it split up.
+ *
+ * Returns: (skip): %TRUE if @uri_ref parsed successfully, %FALSE
+ * on error.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_split_network:
+ * @uri_string: a string containing an absolute URI
+ * @flags: flags for parsing @uri_string
+ * @scheme: (out) (nullable) (optional) (transfer full): on return, contains
+ * the scheme (converted to lowercase), or %NULL
+ * @host: (out) (nullable) (optional) (transfer full): on return, contains the
+ * host, or %NULL
+ * @port: (out) (optional) (transfer full): on return, contains the
+ * port, or `-1`
+ * @error: #GError for error reporting, or %NULL to ignore.
+ *
+ * Parses @uri_string (which must be an [absolute URI][relative-absolute-uris])
+ * according to @flags, and returns the pieces relevant to connecting to a host.
+ * See the documentation for g_uri_split() for more details; this is
+ * mostly a wrapper around that function with simpler arguments.
+ * However, it will return an error if @uri_string is a relative URI,
+ * or does not contain a hostname component.
+ *
+ * Returns: (skip): %TRUE if @uri_string parsed successfully,
+ * %FALSE on error.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_split_with_user:
+ * @uri_ref: a string containing a relative or absolute URI
+ * @flags: flags for parsing @uri_ref
+ * @scheme: (out) (nullable) (optional) (transfer full): on return, contains
+ * the scheme (converted to lowercase), or %NULL
+ * @user: (out) (nullable) (optional) (transfer full): on return, contains
+ * the user, or %NULL
+ * @password: (out) (nullable) (optional) (transfer full): on return, contains
+ * the password, or %NULL
+ * @auth_params: (out) (nullable) (optional) (transfer full): on return, contains
+ * the auth_params, or %NULL
+ * @host: (out) (nullable) (optional) (transfer full): on return, contains the
+ * host, or %NULL
+ * @port: (out) (optional) (transfer full): on return, contains the
+ * port, or `-1`
+ * @path: (out) (not nullable) (optional) (transfer full): on return, contains the
+ * path
+ * @query: (out) (nullable) (optional) (transfer full): on return, contains the
+ * query, or %NULL
+ * @fragment: (out) (nullable) (optional) (transfer full): on return, contains
+ * the fragment, or %NULL
+ * @error: #GError for error reporting, or %NULL to ignore.
+ *
+ * Parses @uri_ref (which can be an
+ * [absolute or relative URI][relative-absolute-uris]) according to @flags, and
+ * returns the pieces. Any component that doesn't appear in @uri_ref will be
+ * returned as %NULL (but note that all URIs always have a path component,
+ * though it may be the empty string).
+ *
+ * See g_uri_split(), and the definition of #GUriFlags, for more
+ * information on the effect of @flags. Note that @password will only
+ * be parsed out if @flags contains %G_URI_FLAGS_HAS_PASSWORD, and
+ * @auth_params will only be parsed out if @flags contains
+ * %G_URI_FLAGS_HAS_AUTH_PARAMS.
+ *
+ * Returns: (skip): %TRUE if @uri_ref parsed successfully, %FALSE
+ * on error.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_to_string:
+ * @uri: a #GUri
+ *
+ * Returns a string representing @uri.
+ *
+ * This is not guaranteed to return a string which is identical to the
+ * string that @uri was parsed from. However, if the source URI was
+ * syntactically correct (according to RFC 3986), and it was parsed
+ * with %G_URI_FLAGS_ENCODED, then g_uri_to_string() is guaranteed to return
+ * a string which is at least semantically equivalent to the source
+ * URI (according to RFC 3986).
+ *
+ * If @uri might contain sensitive details, such as authentication parameters,
+ * or private data in its query string, and the returned string is going to be
+ * logged, then consider using g_uri_to_string_partial() to redact parts.
+ *
+ * Returns: (transfer full): a string representing @uri, which the caller
+ * must free.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_to_string_partial:
+ * @uri: a #GUri
+ * @flags: flags describing what parts of @uri to hide
+ *
+ * Returns a string representing @uri, subject to the options in
+ * @flags. See g_uri_to_string() and #GUriHideFlags for more details.
+ *
+ * Returns: (transfer full): a string representing @uri, which the caller
+ * must free.
+ * Since: 2.66
+ */
+
+
+/**
+ * g_uri_unescape_bytes:
+ * @escaped_string: A URI-escaped string
+ * @length: the length (in bytes) of @escaped_string to escape, or `-1` if it
+ * is nul-terminated.
+ * @illegal_characters: (nullable): a string of illegal characters
+ * not to be allowed, or %NULL.
+ * @error: #GError for error reporting, or %NULL to ignore.
+ *
+ * Unescapes a segment of an escaped string as binary data.
+ *
+ * Note that in contrast to g_uri_unescape_string(), this does allow
+ * nul bytes to appear in the output.
+ *
+ * If any of the characters in @illegal_characters appears as an escaped
+ * character in @escaped_string, then that is an error and %NULL will be
+ * returned. This is useful if you want to avoid for instance having a slash
+ * being expanded in an escaped path element, which might confuse pathname
+ * handling.
+ *
+ * Returns: (transfer full): an unescaped version of @escaped_string or %NULL on
+ * error (if decoding failed, using %G_URI_ERROR_FAILED error code). The
+ * returned #GBytes should be unreffed when no longer needed.
+ * Since: 2.66
+ */
+
+
+/**
* g_uri_unescape_segment:
* @escaped_string: (nullable): A string, may be %NULL
- * @escaped_string_end: (nullable): Pointer to end of @escaped_string, may be %NULL
- * @illegal_characters: (nullable): An optional string of illegal characters not to be allowed, may be %NULL
+ * @escaped_string_end: (nullable): Pointer to end of @escaped_string,
+ * may be %NULL
+ * @illegal_characters: (nullable): An optional string of illegal
+ * characters not to be allowed, may be %NULL
*
* Unescapes a segment of an escaped string.
*
- * If any of the characters in @illegal_characters or the character zero appears
- * as an escaped character in @escaped_string then that is an error and %NULL
- * will be returned. This is useful it you want to avoid for instance having a
- * slash being expanded in an escaped path element, which might confuse pathname
- * handling.
+ * If any of the characters in @illegal_characters or the NUL
+ * character appears as an escaped character in @escaped_string, then
+ * that is an error and %NULL will be returned. This is useful if you
+ * want to avoid for instance having a slash being expanded in an
+ * escaped path element, which might confuse pathname handling.
+ *
+ * Note: `NUL` byte is not accepted in the output, in contrast to
+ * g_uri_unescape_bytes().
*
* Returns: an unescaped version of @escaped_string or %NULL on error.
* The returned string should be freed when no longer needed. As a
@@ -35479,16 +36685,16 @@
/**
* g_uri_unescape_string:
* @escaped_string: an escaped string to be unescaped.
- * @illegal_characters: (nullable): a string of illegal characters not to be
- * allowed, or %NULL.
+ * @illegal_characters: (nullable): a string of illegal characters
+ * not to be allowed, or %NULL.
*
* Unescapes a whole escaped string.
*
- * If any of the characters in @illegal_characters or the character zero appears
- * as an escaped character in @escaped_string then that is an error and %NULL
- * will be returned. This is useful it you want to avoid for instance having a
- * slash being expanded in an escaped path element, which might confuse pathname
- * handling.
+ * If any of the characters in @illegal_characters or the NUL
+ * character appears as an escaped character in @escaped_string, then
+ * that is an error and %NULL will be returned. This is useful if you
+ * want to avoid for instance having a slash being expanded in an
+ * escaped path element, which might confuse pathname handling.
*
* Returns: an unescaped version of @escaped_string. The returned string
* should be freed when no longer needed.
@@ -35497,6 +36703,19 @@
/**
+ * g_uri_unref: (skip)
+ * @uri: a #GUri
+ *
+ * Atomically decrements the reference count of @uri by one.
+ *
+ * When the reference count reaches zero, the resources allocated by
+ * @uri are freed
+ *
+ * Since: 2.66
+ */
+
+
+/**
* g_usleep:
* @microseconds: number of microseconds to pause
*
@@ -35556,7 +36775,7 @@
* Note that the input is expected to be already in native endianness,
* an initial byte-order-mark character is not handled specially.
* g_convert() can be used to convert a byte buffer of UTF-16 data of
- * ambiguous endianess.
+ * ambiguous endianness.
*
* Further note that this function does not validate the result
* string; it may e.g. include embedded NUL characters. The only
@@ -36997,6 +38216,12 @@
* The returned value is never floating. You should free it with
* g_variant_unref() when you're done with it.
*
+ * Note that values borrowed from the returned child are not guaranteed to
+ * still be valid after the child is freed even if you still hold a reference
+ * to @value, if @value has not been serialised at the time this function is
+ * called. To avoid this, you can serialize @value by calling
+ * g_variant_get_data() and optionally ignoring the return value.
+ *
* There may be implementation specific restrictions on deeply nested values,
* which would result in the unit tuple being returned as the child value,
* instead of further nested children. #GVariant is guaranteed to handle
@@ -37268,11 +38493,15 @@
* type. This includes the types %G_VARIANT_TYPE_STRING,
* %G_VARIANT_TYPE_OBJECT_PATH and %G_VARIANT_TYPE_SIGNATURE.
*
- * The string will always be UTF-8 encoded, and will never be %NULL.
+ * The string will always be UTF-8 encoded, will never be %NULL, and will never
+ * contain nul bytes.
*
* If @length is non-%NULL then the length of the string (in bytes) is
* returned there. For trusted values, this information is already
- * known. For untrusted values, a strlen() will be performed.
+ * known. Untrusted values will be validated and, if valid, a strlen() will be
+ * performed. If invalid, a default value will be returned — for
+ * %G_VARIANT_TYPE_OBJECT_PATH, this is `"/"`, and for other types it is the
+ * empty string.
*
* It is an error to call this function with a @value of any type
* other than those three.
@@ -37554,7 +38783,7 @@
* need it.
*
* A reference is taken to the container that @iter is iterating over
- * and will be releated only when g_variant_iter_free() is called.
+ * and will be related only when g_variant_iter_free() is called.
*
* Returns: (transfer full): a new heap-allocated #GVariantIter
* Since: 2.24
@@ -38700,7 +39929,7 @@
*
* Using this function on the return value of the user's callback allows
* the user to do whichever is more convenient for them. The caller
- * will alway receives exactly one full reference to the value: either
+ * will always receives exactly one full reference to the value: either
* the one that was returned in the first place, or a floating reference
* that has been converted to a full reference.
*
@@ -39564,7 +40793,7 @@
* installations of different versions of some GLib-using library, or
* GLib itself, is desirable for various reasons.
*
- * For this reason it is recommeded to always pass %NULL as
+ * For this reason it is recommended to always pass %NULL as
* @package to this function, to avoid the temptation to use the
* Registry. In version 2.20 of GLib the @package parameter
* will be ignored and this function won't look in the Registry at all.
@@ -39954,7 +41183,7 @@
* This is an internal function and should only be used by
* the internals of glib (such as libgio).
*
- * Returns: the transation of @str to the current locale
+ * Returns: the translation of @str to the current locale
*/
diff --git a/gir/gobject-2.0.c b/gir/gobject-2.0.c
index 9ea50c91..56947b35 100644
--- a/gir/gobject-2.0.c
+++ b/gir/gobject-2.0.c
@@ -419,8 +419,8 @@
*
* ## Parameter names # {#canonical-parameter-names}
*
- * A property name consists of segments consisting of ASCII letters and
- * digits, separated by either the `-` or `_` character. The first
+ * A property name consists of one or more segments consisting of ASCII letters
+ * and digits, separated by either the `-` or `_` character. The first
* character of a property name must be a letter. These are the same rules as
* for signal naming (see g_signal_new()).
*
@@ -2086,7 +2086,7 @@
* g_source_set_closure (source, g_cclosure_new (cb_func, cb_data));
* ]|
*
- * Generally, this function is used together with g_closure_ref(). Ane example
+ * Generally, this function is used together with g_closure_ref(). An example
* of storing a closure for later notification looks like:
* |[<!-- language="C" -->
* static GClosure *notify_closure = NULL;
@@ -2970,7 +2970,9 @@
* Creates a new instance of a #GObject subtype and sets its properties.
*
* Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY)
- * which are not explicitly specified are set to their default values.
+ * which are not explicitly specified are set to their default values. Any
+ * private data for the object is guaranteed to be initialized with zeros, as
+ * per g_type_create_instance().
*
* Note that in C, small integer types in variable argument lists are promoted
* up to #gint or #guint as appropriate, and read back accordingly. #gint is 32
@@ -3317,7 +3319,7 @@
* @data: (nullable): An opaque user data pointer
*
* This sets an opaque, named pointer on an object.
- * The name is specified through a #GQuark (retrived e.g. via
+ * The name is specified through a #GQuark (retrieved e.g. via
* g_quark_from_static_string()), and the pointer
* can be gotten back from the @object with g_object_get_qdata()
* until the @object is finalized.
@@ -3401,7 +3403,7 @@
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
- * // retrive the old string list
+ * // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
@@ -3796,6 +3798,22 @@
/**
+ * g_param_spec_is_valid_name:
+ * @name: the canonical name of the property
+ *
+ * Validate a property name for a #GParamSpec. This can be useful for
+ * dynamically-generated properties which need to be validated at run-time
+ * before actually trying to create them.
+ *
+ * See [canonical parameter names][canonical-parameter-names] for details of
+ * the rules for valid names.
+ *
+ * Returns: %TRUE if @name is a valid property name, %FALSE otherwise.
+ * Since: 2.66
+ */
+
+
+/**
* g_param_spec_long:
* @name: canonical name of the property specified
* @nick: nick name for the property specified
@@ -4209,7 +4227,7 @@
/**
* g_param_value_convert:
* @pspec: a valid #GParamSpec
- * @src_value: souce #GValue
+ * @src_value: source #GValue
* @dest_value: destination #GValue of correct type for @pspec
* @strict_validation: %TRUE requires @dest_value to conform to @pspec
* without modifications
@@ -4532,7 +4550,7 @@
*
* Blocks a handler of an instance so it will not be called during any
* signal emissions unless it is unblocked again. Thus "blocking" a
- * signal handler means to temporarily deactive it, a signal handler
+ * signal handler means to temporarily deactivate it, a signal handler
* has to be unblocked exactly the same amount of times it has been
* blocked before to become active again.
*
@@ -4719,6 +4737,22 @@
/**
+ * g_signal_is_valid_name:
+ * @name: the canonical name of the signal
+ *
+ * Validate a signal name. This can be useful for dynamically-generated signals
+ * which need to be validated at run-time before actually trying to create them.
+ *
+ * See [canonical parameter names][canonical-parameter-names] for details of
+ * the rules for valid names. The rules for signal names are the same as those
+ * for property names.
+ *
+ * Returns: %TRUE if @name is a valid signal name, %FALSE otherwise.
+ * Since: 2.66
+ */
+
+
+/**
* g_signal_list_ids:
* @itype: Instance or interface type.
* @n_ids: Location to store the number of signal ids for @itype.
@@ -4839,7 +4873,7 @@
* of a class offset for the signal's class handler. This function
* doesn't need a function pointer exposed in the class structure of
* an object definition, instead the function pointer is passed
- * directly and can be overriden by derived classes with
+ * directly and can be overridden by derived classes with
* g_signal_override_class_closure() or
* g_signal_override_class_handler()and chained to with
* g_signal_chain_from_overridden() or
@@ -5384,7 +5418,7 @@
* and structure setups for instances: actual instance creation should
* happen through functions supplied by the type's fundamental type
* implementation. So use of g_type_create_instance() is reserved for
- * implementators of fundamental types only. E.g. instances of the
+ * implementers of fundamental types only. E.g. instances of the
* #GObject hierarchy should be created via g_object_new() and never
* directly through g_type_create_instance() which doesn't handle things
* like singleton objects or object construction.
@@ -5423,7 +5457,7 @@
* and returns the default interface vtable for the type.
*
* If the type is not currently in use, then the default vtable
- * for the type will be created and initalized by calling
+ * for the type will be created and initialized by calling
* the base interface init and default vtable init functions for
* the type (the @base_init and @class_init members of #GTypeInfo).
* Calling g_type_default_interface_ref() is useful when you
@@ -6695,6 +6729,19 @@
/**
+ * g_value_set_interned_string:
+ * @value: a valid #GValue of type %G_TYPE_STRING
+ * @v_string: (nullable): static string to be set
+ *
+ * Set the contents of a %G_TYPE_STRING #GValue to @v_string. The string is
+ * assumed to be static and interned (canonical, for example from
+ * g_intern_string()), and is thus not duplicated when setting the #GValue.
+ *
+ * Since: 2.66
+ */
+
+
+/**
* g_value_set_long:
* @value: a valid #GValue of type %G_TYPE_LONG
* @v_long: long integer value to be set
@@ -6792,6 +6839,9 @@
* Set the contents of a %G_TYPE_STRING #GValue to @v_string.
* The string is assumed to be static, and is thus not duplicated
* when setting the #GValue.
+ *
+ * If the the string is a canonical string, using g_value_set_interned_string()
+ * is more appropriate.
*/
diff --git a/gir/meson.build b/gir/meson.build
index 04f9371a..557e5517 100644
--- a/gir/meson.build
+++ b/gir/meson.build
@@ -41,24 +41,14 @@ gir_files = [
typelibdir = join_paths(get_option('libdir'), 'girepository-1.0')
install_data(gir_files, install_dir: girdir)
-if get_option('gi_cross_use_host_gi')
- scanner_command = [
- 'g-ir-scanner',
- ]
-else
- scanner_command = [
- python,
- girscanner,
- ]
-endif
-
-scanner_command += [
- '--output=@OUTPUT@',
- '--no-libtool',
- '--quiet',
- '--reparse-validate',
- '--add-include-path', join_paths(meson.current_build_dir()),
- '--add-include-path', join_paths(meson.current_source_dir()),
+scanner_command = [
+ find_program('g-ir-scanner', native: true),
+ '--output=@OUTPUT@',
+ '--no-libtool',
+ '--quiet',
+ '--reparse-validate',
+ '--add-include-path', join_paths(meson.current_build_dir()),
+ '--add-include-path', join_paths(meson.current_source_dir()),
]
dep_type = glib_dep.type_name()
@@ -458,7 +448,7 @@ foreach gir : gir_files
typelibs += custom_target('generate-typelib-@0@'.format(gir).underscorify(),
input: gir,
output: '@BASENAME@.typelib',
- depends: [gobject_gir, ],
+ depends: [gobject_gir, gircompiler, ],
command: gircompiler_command,
install: true,
install_dir: typelibdir,
diff --git a/girepository/cmph/meson.build b/girepository/cmph/meson.build
index 5bc41a33..2a0cef7e 100644
--- a/girepository/cmph/meson.build
+++ b/girepository/cmph/meson.build
@@ -26,6 +26,7 @@ cmph_sources = [
cmph_deps = [
glib_dep,
+ gobject_dep,
cc.find_library('m', required: false),
]
@@ -67,6 +68,7 @@ cmph_test = executable('cmph-bdz-test', '../cmph-bdz-test.c',
dependencies: [
cmph_dep,
glib_dep,
+ gobject_dep,
],
c_args: custom_c_args,
)
diff --git a/girepository/gi-dump-types.c b/girepository/gi-dump-types.c
index 69d8b12d..aeef774c 100644
--- a/girepository/gi-dump-types.c
+++ b/girepository/gi-dump-types.c
@@ -1,16 +1,29 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
#include "gdump.c"
-#include <gio/gunixoutputstream.h>
+#ifdef G_OS_WIN32
+ #include <windows.h>
+ #include <io.h> /* For _get_osfhandle() */
+ #include <gio/gwin32outputstream.h>
+#else
+ #include <gio/gunixoutputstream.h>
+#endif
int
main (int argc,
char **argv)
{
int i;
- GOutputStream *stdout;
+ GOutputStream *Stdout;
GModule *self;
- stdout = g_unix_output_stream_new (1, FALSE);
+#if defined(G_OS_WIN32)
+ HANDLE *hnd = (HANDLE) _get_osfhandle (1);
+
+ g_return_val_if_fail (hnd && hnd != INVALID_HANDLE_VALUE, 1);
+ Stdout = g_win32_output_stream_new (hnd, FALSE);
+#else
+ Stdout = g_unix_output_stream_new (1, FALSE);
+#endif
self = g_module_open (NULL, 0);
@@ -26,7 +39,7 @@ main (int argc,
g_clear_error (&error);
}
else
- dump_type (type, argv[i], stdout);
+ dump_type (type, argv[i], Stdout);
}
return 0;
diff --git a/girepository/giobjectinfo.c b/girepository/giobjectinfo.c
index efb9ad76..13cfdaa8 100644
--- a/girepository/giobjectinfo.c
+++ b/girepository/giobjectinfo.c
@@ -89,7 +89,7 @@ g_object_info_get_field_offset (GIObjectInfo *info,
*
* Obtain the parent of the object type.
*
- * Returns: (transfer full): the #GIObjectInfo. Free the struct by calling
+ * Returns: (transfer full) (nullable): the #GIObjectInfo. Free the struct by calling
* g_base_info_unref() when done.
*/
GIObjectInfo *
@@ -419,7 +419,7 @@ g_object_info_get_method (GIObjectInfo *info,
* Obtain a method of the object type given a @name. %NULL will be
* returned if there's no method available with that name.
*
- * Returns: (transfer full): the #GIFunctionInfo. Free the struct by calling
+ * Returns: (transfer full) (nullable): the #GIFunctionInfo. Free the struct by calling
* g_base_info_unref() when done.
*/
GIFunctionInfo *
@@ -459,7 +459,7 @@ g_object_info_find_method (GIObjectInfo *info,
* Note that this function does *not* search parent classes; you will have
* to chain up if that's desired.
*
- * Returns: (transfer full): the #GIFunctionInfo. Free the struct by calling
+ * Returns: (transfer full) (nullable): the #GIFunctionInfo. Free the struct by calling
* g_base_info_unref() when done.
*/
GIFunctionInfo *
@@ -569,7 +569,7 @@ g_object_info_get_signal (GIObjectInfo *info,
*
* TODO
*
- * Returns: (transfer full): Info for the signal with name @name in @info, or %NULL on failure.
+ * Returns: (transfer full) (nullable): Info for the signal with name @name in @info, or %NULL on failure.
*/
GISignalInfo *
g_object_info_find_signal (GIObjectInfo *info,
@@ -668,7 +668,7 @@ g_object_info_get_vfunc (GIObjectInfo *info,
* See the documentation for g_vfunc_info_get_invoker() for more
* information on invoking virtuals.
*
- * Returns: (transfer full): the #GIVFuncInfo, or %NULL. Free it with
+ * Returns: (transfer full) (nullable): the #GIVFuncInfo, or %NULL. Free it with
* g_base_info_unref() when done.
*/
GIVFuncInfo *
@@ -713,7 +713,7 @@ g_object_info_find_vfunc (GIObjectInfo *info,
* Note that this function does *not* search parent classes; you will have
* to chain up if that's desired.
*
- * Returns: (transfer full): the #GIVFuncInfo. Free the struct by calling
+ * Returns: (transfer full) (nullable): the #GIVFuncInfo. Free the struct by calling
* g_base_info_unref() when done.
*/
GIVFuncInfo *
@@ -825,7 +825,7 @@ g_object_info_get_constant (GIObjectInfo *info,
* Every #GObject has two structures; an instance structure and a class
* structure. This function returns the metadata for the class structure.
*
- * Returns: (transfer full): the #GIStructInfo or %NULL. Free with
+ * Returns: (transfer full) (nullable): the #GIStructInfo or %NULL. Free with
* g_base_info_unref() when done.
*/
GIStructInfo *
@@ -889,7 +889,7 @@ _get_func(GIObjectInfo *info,
* the symbol is %GIObjectInfoRefFunction, to fetch the function pointer
* see g_object_info_get_ref_function().
*
- * Returns: the symbol or %NULL
+ * Returns: (nullable): the symbol or %NULL
*/
const char *
g_object_info_get_ref_function (GIObjectInfo *info)
@@ -917,7 +917,7 @@ g_object_info_get_ref_function (GIObjectInfo *info)
* This takes derivation into account and will reversely traverse
* the base classes of this type, starting at the top type.
*
- * Returns: the function pointer or %NULL
+ * Returns: (nullable): the function pointer or %NULL
*/
GIObjectInfoRefFunction
g_object_info_get_ref_function_pointer (GIObjectInfo *info)
@@ -937,7 +937,7 @@ g_object_info_get_ref_function_pointer (GIObjectInfo *info)
* the symbol is %GIObjectInfoUnrefFunction, to fetch the function pointer
* see g_object_info_get_unref_function().
*
- * Returns: the symbol or %NULL
+ * Returns: (nullable): the symbol or %NULL
*/
const char *
g_object_info_get_unref_function (GIObjectInfo *info)
@@ -965,7 +965,7 @@ g_object_info_get_unref_function (GIObjectInfo *info)
* This takes derivation into account and will reversely traverse
* the base classes of this type, starting at the top type.
*
- * Returns: the function pointer or %NULL
+ * Returns: (nullable): the function pointer or %NULL
*/
GIObjectInfoUnrefFunction
g_object_info_get_unref_function_pointer (GIObjectInfo *info)
@@ -986,7 +986,7 @@ g_object_info_get_unref_function_pointer (GIObjectInfo *info)
* is %GIObjectInfoSetValueFunction, to fetch the function pointer
* see g_object_info_get_set_value_function().
*
- * Returns: the symbol or %NULL
+ * Returns: (nullable): the symbol or %NULL
*/
const char *
g_object_info_get_set_value_function (GIObjectInfo *info)
@@ -1014,7 +1014,7 @@ g_object_info_get_set_value_function (GIObjectInfo *info)
* This takes derivation into account and will reversely traverse
* the base classes of this type, starting at the top type.
*
- * Returns: the function pointer or %NULL
+ * Returns: (nullable): the function pointer or %NULL
*/
GIObjectInfoSetValueFunction
g_object_info_get_set_value_function_pointer (GIObjectInfo *info)
@@ -1035,7 +1035,7 @@ g_object_info_get_set_value_function_pointer (GIObjectInfo *info)
* is %GIObjectInfoGetValueFunction, to fetch the function pointer
* see g_object_info_get_get_value_function().
*
- * Returns: the symbol or %NULL
+ * Returns: (nullable): the symbol or %NULL
*/
const char *
g_object_info_get_get_value_function (GIObjectInfo *info)
@@ -1063,7 +1063,7 @@ g_object_info_get_get_value_function (GIObjectInfo *info)
* This takes derivation into account and will reversely traverse
* the base classes of this type, starting at the top type.
*
- * Returns: the function pointer or %NULL
+ * Returns: (nullable): the function pointer or %NULL
*/
GIObjectInfoGetValueFunction
g_object_info_get_get_value_function_pointer (GIObjectInfo *info)
diff --git a/girepository/girepository.c b/girepository/girepository.c
index b7948d61..7d034859 100644
--- a/girepository/girepository.c
+++ b/girepository/girepository.c
@@ -1144,7 +1144,7 @@ g_irepository_get_version (GIRepository *repository,
* Note: The namespace must have already been loaded using a function
* such as g_irepository_require() before calling this function.
*
- * Returns: Comma-separated list of paths to shared libraries,
+ * Returns: (nullable): Comma-separated list of paths to shared libraries,
* or %NULL if none are associated
*/
const gchar *
diff --git a/girepository/girparser.c b/girepository/girparser.c
index 53450baf..ad676e33 100644
--- a/girepository/girparser.c
+++ b/girepository/girparser.c
@@ -2830,7 +2830,8 @@ start_element_handler (GMarkupParseContext *context,
ctx, error))
goto out;
if (strcmp ("doc", element_name) == 0 || strcmp ("doc-deprecated", element_name) == 0 ||
- strcmp ("doc-stability", element_name) == 0 || strcmp ("doc-version", element_name) == 0)
+ strcmp ("doc-stability", element_name) == 0 || strcmp ("doc-version", element_name) == 0 ||
+ strcmp ("docsection", element_name) == 0)
{
state_switch (ctx, STATE_PASSTHROUGH);
goto out;
diff --git a/girepository/gitypeinfo.c b/girepository/gitypeinfo.c
index 1434b2f3..e90f9463 100644
--- a/girepository/gitypeinfo.c
+++ b/girepository/gitypeinfo.c
@@ -347,3 +347,173 @@ g_type_info_get_array_type (GITypeInfo *info)
return -1;
}
+
+/**
+ * g_type_info_get_storage_type:
+ * @info: a #GITypeInfo
+ *
+ * Obtain the type tag corresponding to the underlying storage type in C for
+ * the type.
+ * See #GITypeTag for a list of type tags.
+ *
+ * Returns: the type tag
+ *
+ * Since: 1.66
+ */
+GITypeTag
+g_type_info_get_storage_type (GITypeInfo *info)
+{
+ GITypeTag type_tag = g_type_info_get_tag (info);
+
+ if (type_tag == GI_TYPE_TAG_INTERFACE)
+ {
+ GIBaseInfo *interface = g_type_info_get_interface (info);
+ GIInfoType info_type = g_base_info_get_type (interface);
+ if (info_type == GI_INFO_TYPE_ENUM || info_type == GI_INFO_TYPE_FLAGS)
+ type_tag = g_enum_info_get_storage_type (interface);
+ g_base_info_unref (interface);
+ }
+
+ return type_tag;
+}
+
+/**
+ * g_type_info_argument_from_hash_pointer:
+ * @info: a #GITypeInfo
+ * @hash_pointer: A pointer, such as a #GHashTable data pointer
+ * @arg: A #GIArgument to fill in
+ *
+ * GLib data structures, such as #GList, #GSList, and #GHashTable, all store
+ * data pointers.
+ * In the case where the list or hash table is storing single types rather than
+ * structs, these data pointers may have values stuffed into them via macros
+ * such as %GPOINTER_TO_INT.
+ *
+ * Use this function to ensure that all values are correctly extracted from
+ * stuffed pointers, regardless of the machine's architecture or endianness.
+ *
+ * This function fills in the appropriate field of @arg with the value extracted
+ * from @hash_pointer, depending on the storage type of @info.
+ *
+ * Since: 1.66
+ */
+void
+g_type_info_argument_from_hash_pointer (GITypeInfo *info,
+ gpointer hash_pointer,
+ GIArgument *arg)
+{
+ GITypeTag type_tag = g_type_info_get_storage_type (info);
+
+ switch (type_tag)
+ {
+ case GI_TYPE_TAG_BOOLEAN:
+ arg->v_boolean = !!GPOINTER_TO_INT (hash_pointer);
+ break;
+ case GI_TYPE_TAG_INT8:
+ arg->v_int8 = (gint8)GPOINTER_TO_INT (hash_pointer);
+ break;
+ case GI_TYPE_TAG_UINT8:
+ arg->v_uint8 = (guint8)GPOINTER_TO_UINT (hash_pointer);
+ break;
+ case GI_TYPE_TAG_INT16:
+ arg->v_int16 = (gint16)GPOINTER_TO_INT (hash_pointer);
+ break;
+ case GI_TYPE_TAG_UINT16:
+ arg->v_uint16 = (guint16)GPOINTER_TO_UINT (hash_pointer);
+ break;
+ case GI_TYPE_TAG_INT32:
+ arg->v_int32 = (gint32)GPOINTER_TO_INT (hash_pointer);
+ break;
+ case GI_TYPE_TAG_UINT32:
+ case GI_TYPE_TAG_UNICHAR:
+ arg->v_uint32 = (guint32)GPOINTER_TO_UINT (hash_pointer);
+ break;
+ case GI_TYPE_TAG_GTYPE:
+ arg->v_size = GPOINTER_TO_SIZE (hash_pointer);
+ break;
+ case GI_TYPE_TAG_UTF8:
+ case GI_TYPE_TAG_FILENAME:
+ case GI_TYPE_TAG_INTERFACE:
+ case GI_TYPE_TAG_ARRAY:
+ case GI_TYPE_TAG_GLIST:
+ case GI_TYPE_TAG_GSLIST:
+ case GI_TYPE_TAG_GHASH:
+ case GI_TYPE_TAG_ERROR:
+ arg->v_pointer = hash_pointer;
+ break;
+ case GI_TYPE_TAG_INT64:
+ case GI_TYPE_TAG_UINT64:
+ case GI_TYPE_TAG_FLOAT:
+ case GI_TYPE_TAG_DOUBLE:
+ default:
+ g_critical ("Unsupported type for pointer-stuffing: %s",
+ g_type_tag_to_string (type_tag));
+ arg->v_pointer = hash_pointer;
+ }
+}
+
+/**
+ * g_type_info_hash_pointer_from_argument:
+ * @info: a #GITypeInfo
+ * @arg: A #GIArgument with the value to stuff into a pointer
+ *
+ * GLib data structures, such as #GList, #GSList, and #GHashTable, all store
+ * data pointers.
+ * In the case where the list or hash table is storing single types rather than
+ * structs, these data pointers may have values stuffed into them via macros
+ * such as %GPOINTER_TO_INT.
+ *
+ * Use this function to ensure that all values are correctly stuffed into
+ * pointers, regardless of the machine's architecture or endianness.
+ *
+ * This function returns a pointer stuffed with the appropriate field of @arg,
+ * depending on the storage type of @info.
+ *
+ * Returns: A stuffed pointer, that can be stored in a #GHashTable, for example
+ *
+ * Since: 1.66
+ */
+gpointer
+g_type_info_hash_pointer_from_argument (GITypeInfo *info,
+ GIArgument *arg)
+{
+ GITypeTag type_tag = g_type_info_get_storage_type (info);
+
+ switch (type_tag)
+ {
+ case GI_TYPE_TAG_BOOLEAN:
+ return GINT_TO_POINTER (arg->v_boolean);
+ case GI_TYPE_TAG_INT8:
+ return GINT_TO_POINTER (arg->v_int8);
+ case GI_TYPE_TAG_UINT8:
+ return GUINT_TO_POINTER (arg->v_uint8);
+ case GI_TYPE_TAG_INT16:
+ return GINT_TO_POINTER (arg->v_int16);
+ case GI_TYPE_TAG_UINT16:
+ return GUINT_TO_POINTER (arg->v_uint16);
+ case GI_TYPE_TAG_INT32:
+ return GINT_TO_POINTER (arg->v_int32);
+ case GI_TYPE_TAG_UINT32:
+ case GI_TYPE_TAG_UNICHAR:
+ return GUINT_TO_POINTER (arg->v_uint32);
+ case GI_TYPE_TAG_GTYPE:
+ return GSIZE_TO_POINTER (arg->v_size);
+ case GI_TYPE_TAG_UTF8:
+ case GI_TYPE_TAG_FILENAME:
+ case GI_TYPE_TAG_INTERFACE:
+ case GI_TYPE_TAG_ARRAY:
+ case GI_TYPE_TAG_GLIST:
+ case GI_TYPE_TAG_GSLIST:
+ case GI_TYPE_TAG_GHASH:
+ case GI_TYPE_TAG_ERROR:
+ return arg->v_pointer;
+ case GI_TYPE_TAG_INT64:
+ case GI_TYPE_TAG_UINT64:
+ case GI_TYPE_TAG_FLOAT:
+ case GI_TYPE_TAG_DOUBLE:
+ default:
+ g_critical ("Unsupported type for pointer-stuffing: %s",
+ g_type_tag_to_string (type_tag));
+ return arg->v_pointer;
+ }
+}
diff --git a/girepository/gitypeinfo.h b/girepository/gitypeinfo.h
index 4d5679c9..fd7d5be6 100644
--- a/girepository/gitypeinfo.h
+++ b/girepository/gitypeinfo.h
@@ -80,6 +80,18 @@ gboolean g_type_info_is_zero_terminated (GITypeInfo *info);
GI_AVAILABLE_IN_ALL
GIArrayType g_type_info_get_array_type (GITypeInfo *info);
+GI_AVAILABLE_IN_1_66
+GITypeTag g_type_info_get_storage_type (GITypeInfo *info);
+
+GI_AVAILABLE_IN_1_66
+void g_type_info_argument_from_hash_pointer (GITypeInfo *info,
+ gpointer hash_pointer,
+ GIArgument *arg);
+
+GI_AVAILABLE_IN_1_66
+gpointer g_type_info_hash_pointer_from_argument (GITypeInfo *info,
+ GIArgument *arg);
+
G_END_DECLS
diff --git a/girepository/giversionmacros.h b/girepository/giversionmacros.h
index c32e5bb8..a941ee2d 100644
--- a/girepository/giversionmacros.h
+++ b/girepository/giversionmacros.h
@@ -159,4 +159,10 @@
# define GI_AVAILABLE_IN_1_60 _GI_EXTERN
#endif
+#if defined(GLIB_VERSION_2_66) && GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_66
+# define GI_AVAILABLE_IN_1_66 GLIB_UNAVAILABLE(2, 66)
+#else
+# define GI_AVAILABLE_IN_1_66 _GI_EXTERN
+#endif
+
#endif /* __GIVERSIONMACROS_H__ */
diff --git a/girepository/meson.build b/girepository/meson.build
index 204659fe..c8ef6aa9 100644
--- a/girepository/meson.build
+++ b/girepository/meson.build
@@ -17,12 +17,13 @@ girepo_gthash_lib = static_library('girepository-gthash',
cmph_dep,
glib_dep,
gmodule_dep,
+ gobject_dep,
],
)
girepo_gthash_dep = declare_dependency(
link_with: girepo_gthash_lib,
- dependencies: [glib_dep, gmodule_dep],
+ dependencies: [glib_dep, gmodule_dep, gobject_dep],
include_directories: include_directories('.'),
)
@@ -203,7 +204,7 @@ gthash_test = executable('gthash-test', 'gthash-test.c',
test('gthash-test', gthash_test)
-if giounix_dep.found()
+if giounix_dep.found() or giowin_dep.found()
executable('gi-dump-types', 'gi-dump-types.c',
- dependencies: [girepo_dep, giounix_dep])
+ dependencies: [girepo_dep, giounix_dep, giowin_dep])
endif
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index 9ab629b3..c9ff5c2b 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -440,6 +440,48 @@ SIGNAL_RE = re.compile(
''',
re.UNICODE | re.VERBOSE)
+# Pattern matching action identifiers.
+ACTION_RE = re.compile(
+ r'''
+ ^ # start
+ \s* # 0 or more whitespace characters
+ (?P<class_name>[\w]+) # class name
+ \s* # 0 or more whitespace characters
+ \|{1} # 1 required vertical bar
+ \s* # 0 or more whitespace characters
+ (?P<action_name>[\w-]+\.[\w-]+) # action name
+ \s* # 0 or more whitespace characters
+ (?P<delimiter>:?) # delimiter
+ \s* # 0 or more whitespace characters
+ (?P<fields>.*?) # annotations + description
+ \s* # 0 or more whitespace characters
+ :? # invalid delimiter
+ \s* # 0 or more whitespace characters
+ $ # end
+ ''',
+ re.UNICODE | re.VERBOSE)
+
+# Pattern matching struct fields.
+FIELD_RE = re.compile(
+ r'''
+ ^ # start
+ \s* # 0 or more whitespace characters
+ (?P<class_name>[\w]+) # class name
+ \s* # 0 or more whitespace characters
+ \.{1} # 1 required dot
+ \s* # 0 or more whitespace characters
+ (?P<field_name>[\w-]*\w) # field name
+ \s* # 0 or more whitespace characters
+ (?P<delimiter>:?) # delimiter
+ \s* # 0 or more whitespace characters
+ (?P<fields>.*?) # annotations + description
+ \s* # 0 or more whitespace characters
+ :? # invalid delimiter
+ \s* # 0 or more whitespace characters
+ $ # end
+ ''',
+ re.UNICODE | re.VERBOSE)
+
# Pattern matching parameters.
PARAMETER_RE = re.compile(
r'''
@@ -545,7 +587,7 @@ class GtkDocAnnotatable(object):
self.annotations = GtkDocAnnotations()
def __repr__(self):
- return "<GtkDocAnnotatable '%s' %r>" % (self.annotations, )
+ return "<GtkDocAnnotatable '%s'>" % (self.annotations, )
def validate(self):
'''
@@ -1315,7 +1357,12 @@ class GtkDocCommentBlockParser(object):
result = SECTION_RE.match(line)
if result:
- identifier_name = 'SECTION:%s' % (result.group('section_name'), )
+ # Some projects use kebab-case or CamelCase for section
+ # names. Convert them all to flat case so we can match
+ # them easily later on.
+ identifier_name = 'SECTION:%s' % (result.group('section_name')
+ .replace("-", "")
+ .lower(), )
identifier_delimiter = None
identifier_fields = None
identifier_fields_start = None
@@ -1338,13 +1385,31 @@ class GtkDocCommentBlockParser(object):
identifier_fields = result.group('fields')
identifier_fields_start = result.start('fields')
else:
- result = SYMBOL_RE.match(line)
+ result = ACTION_RE.match(line)
if result:
- identifier_name = '%s' % (result.group('symbol_name'), )
- identifier_delimiter = result.group('delimiter')
- identifier_fields = result.group('fields')
- identifier_fields_start = result.start('fields')
+ identifier_name = 'ACTION:%s:%s' % (result.group('class_name'),
+ result.group('action_name'))
+ identifier_delimiter = None
+ identifier_fields = None
+ identifier_fields_start = None
+ else:
+ result = FIELD_RE.match(line)
+
+ if result:
+ identifier_name = '%s.%s' % (result.group('class_name'),
+ result.group('field_name'))
+ identifier_delimiter = result.group('delimiter')
+ identifier_fields = result.group('fields')
+ identifier_fields_start = result.start('fields')
+ else:
+ result = SYMBOL_RE.match(line)
+
+ if result:
+ identifier_name = '%s' % (result.group('symbol_name'), )
+ identifier_delimiter = result.group('delimiter')
+ identifier_fields = result.group('fields')
+ identifier_fields_start = result.start('fields')
if result:
in_part = PART_IDENTIFIER
@@ -2117,7 +2182,7 @@ class GtkDocCommentBlockWriter(object):
lines = []
# Identifier part
- if block.name.startswith('SECTION'):
+ if block.name.startswith('SECTION') or block.name.startswith('ACTION'):
lines.append(block.name)
else:
if block.annotations:
diff --git a/giscanner/ast.py b/giscanner/ast.py
index 66fe0cf1..593969f2 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -660,6 +660,11 @@ GIName. It's possible for nodes to contain or point to other nodes."""
pass
+class DocSection(Node):
+ def __init__(self, name=None):
+ Node.__init__(self, name)
+
+
class Registered:
"""A node that (possibly) has gtype_name and get_type."""
def __init__(self, gtype_name, get_type):
diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py
index a81d4b86..bd1aa78e 100644
--- a/giscanner/ccompiler.py
+++ b/giscanner/ccompiler.py
@@ -163,9 +163,11 @@ class CCompiler(object):
elif os.environ.get('VCInstallDir'):
os.environ['MSSdk'] = os.environ.get('VCInstallDir')
- self.compiler_cmd = 'cl.exe'
-
- self._cflags_no_deprecation_warnings = "-wd4996"
+ if self.compiler.check_is_clang_cl():
+ self.compiler_cmd = os.environ.get('CC').split()[0]
+ else:
+ self.compiler_cmd = 'cl.exe'
+ self._cflags_no_deprecation_warnings = "-wd4996"
else:
if (isinstance(self.compiler, Mingw32CCompiler)):
self.compiler_cmd = self.compiler.compiler[0]
@@ -263,7 +265,7 @@ class CCompiler(object):
# Define these macros when using Visual C++ to silence many warnings,
# and prevent stepping on many Visual Studio-specific items, so that
# we don't have to handle them specifically in scannerlexer.l
- if self.check_is_msvc():
+ if self.check_is_msvc() and not self.compiler.check_is_clang_cl():
macros.append(('_USE_DECLSPECS_FOR_SAL', None))
macros.append(('_CRT_SECURE_NO_WARNINGS', None))
macros.append(('_CRT_NONSTDC_NO_WARNINGS', None))
@@ -318,7 +320,7 @@ class CCompiler(object):
args = []
libsearch = []
- # When we are using Visual C++...
+ # When we are using Visual C++ or clang-cl...
if self.check_is_msvc():
# The search path of the .lib's on Visual C++
# is dependent on the LIB environmental variable,
@@ -336,7 +338,7 @@ class CCompiler(object):
args.append('dumpbin.exe')
args.append('-symbols')
- # When we are not using Visual C++ (i.e. we are using GCC)...
+ # When we are not using Visual C++ nor clang-cl (i.e. we are using GCC)...
else:
libtool = utils.get_libtool_command(options)
if libtool:
diff --git a/giscanner/dumper.py b/giscanner/dumper.py
index 0c10a780..e4b6ea03 100644
--- a/giscanner/dumper.py
+++ b/giscanner/dumper.py
@@ -126,7 +126,7 @@ class DumpCompiler(object):
if len(self._get_type_functions) > 0:
for func in self._get_type_functions:
f.write("extern GType " + func + "(void);\n")
- f.write("GType (*GI_GET_TYPE_FUNCS_[])(void) = {\n")
+ f.write("G_MODULE_EXPORT GType (*GI_GET_TYPE_FUNCS_[])(void) = {\n")
first = True
for func in self._get_type_functions:
if first:
@@ -138,7 +138,7 @@ class DumpCompiler(object):
if len(self._error_quark_functions) > 0:
for func in self._error_quark_functions:
f.write("extern GQuark " + func + "(void);\n")
- f.write("GQuark (*GI_ERROR_QUARK_FUNCS_[])(void) = {\n")
+ f.write("G_MODULE_EXPORT GQuark (*GI_ERROR_QUARK_FUNCS_[])(void) = {\n")
first = True
for func in self._error_quark_functions:
if first:
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index 35206a41..d229b164 100644
--- a/giscanner/girparser.py
+++ b/giscanner/girparser.py
@@ -138,6 +138,7 @@ class GIRParser(object):
_corens('interface'): self._parse_object_interface,
_corens('record'): self._parse_record,
_corens('union'): self._parse_union,
+ _corens('docsection'): self._parse_doc_section,
_glibns('boxed'): self._parse_boxed}
if not self._types_only:
@@ -150,6 +151,11 @@ class GIRParser(object):
if method is not None:
method(node)
+ def _parse_doc_section(self, node):
+ docsection = ast.DocSection(node.attrib["name"])
+ self._parse_generic_attribs(node, docsection)
+ self._namespace.append(docsection)
+
def _parse_include(self, node):
include = ast.Include(node.attrib['name'], node.attrib['version'])
self._includes.add(include)
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py
index d1333cb7..2b837362 100644
--- a/giscanner/girwriter.py
+++ b/giscanner/girwriter.py
@@ -113,6 +113,8 @@ class GIRWriter(XMLWriter):
self._write_alias(node)
elif isinstance(node, ast.Constant):
self._write_constant(node)
+ elif isinstance(node, ast.DocSection):
+ self._write_doc_section(node)
else:
print('WRITER: Unhandled node', node)
@@ -437,11 +439,17 @@ class GIRWriter(XMLWriter):
attrs = [('name', member.name),
('value', str(member.value)),
('c:identifier', member.symbol)]
+ self._append_version(member, attrs)
if member.nick is not None:
attrs.append(('glib:nick', member.nick))
with self.tagcontext('member', attrs):
self._write_generic(member)
+ def _write_doc_section(self, doc_section):
+ attrs = [('name', doc_section.name)]
+ with self.tagcontext('docsection', attrs):
+ self._write_generic(doc_section)
+
def _write_constant(self, constant):
attrs = [('name', constant.name),
('value', constant.value),
@@ -626,6 +634,7 @@ class GIRWriter(XMLWriter):
raise AssertionError("Unknown field anonymous: %r" % (field.anonymous_node, ))
else:
attrs = [('name', field.name)]
+ self._append_version(field, attrs)
self._append_node_generic(field, attrs)
# Fields are assumed to be read-only
# (see also girparser.c and generate.c)
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 9468751d..9077a1d0 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -69,6 +69,10 @@ class MainTransformer(object):
# Read in most annotations now.
self._namespace.walk(self._pass_read_annotations)
+ # Now that we have associated doc SECTIONs to classes,
+ # add the unused section blocks as standalone nodes.
+ self._add_standalone_doc_sections()
+
# Now that we've possibly seen more types from annotations,
# do another type resolution pass.
self._namespace.walk(self._pass_type_resolution)
@@ -101,6 +105,14 @@ class MainTransformer(object):
# Private
+ def _add_standalone_doc_sections(self):
+ for block_name, block in self._blocks.items():
+ if block_name.startswith("SECTION:") and block.description:
+ node = ast.DocSection(block_name[8:])
+ node.doc = block.description
+ node.doc_position = block.position
+ self._namespace.append(node)
+
def _pass_fixup_hidden_fields(self, node, chain):
"""Hide all callbacks starting with _; the typical
usage is void (*_gtk_reserved1)(void);"""
@@ -240,7 +252,9 @@ class MainTransformer(object):
self._apply_annotations_field(node, block, field)
name = self._get_annotation_name(node)
section_name = 'SECTION:%s' % (name.lower(), )
- block = self._blocks.get(section_name)
+ # We pop it from our blocks so that we can serialize leftover
+ # SECTIONs as standalone nodes
+ block = self._blocks.pop(section_name, None)
self._apply_annotations_annotated(node, block)
if isinstance(node, (ast.Class, ast.Interface)):
for prop in node.properties:
@@ -858,19 +872,28 @@ class MainTransformer(object):
self._apply_annotations_params(node, node.parameters, block)
self._apply_annotations_return(node, node.retval, block)
- def _apply_annotations_field(self, parent, block, field):
- if not block:
- return
- tag = block.params.get(field.name)
- if not tag:
+ def _apply_annotations_field(self, parent, parent_block, field):
+ block = self._blocks.get('%s.%s' % (self._get_annotation_name(parent), field.name))
+
+ # Prioritize block level documentation
+ if block:
+ self._apply_annotations_annotated(field, block)
+ annotations = block.annotations
+ elif not parent_block:
return
- type_annotation = tag.annotations.get(ANN_TYPE)
+ else:
+ tag = parent_block.params.get(field.name)
+ if not tag:
+ return
+ annotations = tag.annotations
+ field.doc = tag.description
+ field.doc_position = tag.position
+
+ type_annotation = annotations.get(ANN_TYPE)
if type_annotation:
field.type = self._transformer.create_type_from_user_string(type_annotation[0])
- field.doc = tag.description
- field.doc_position = tag.position
try:
- self._adjust_container_type(parent, field, tag.annotations)
+ self._adjust_container_type(parent, field, annotations)
except AttributeError as ex:
print(ex)
@@ -938,15 +961,21 @@ class MainTransformer(object):
if value_annotation:
node.value = value_annotation[0]
- def _apply_annotations_enum_members(self, node, block):
- if block is None:
- return
-
+ def _apply_annotations_enum_members(self, node, parent_block):
for m in node.members:
- param = block.params.get(m.symbol, None)
- if param and param.description:
- m.doc = param.description
- m.doc_position = param.position
+ block = self._blocks.get(m.symbol)
+ # Prioritize block-level documentation
+ if block:
+ self._apply_annotations_annotated(m, block)
+ elif parent_block:
+ param = parent_block.params.get(m.symbol)
+
+ if not param:
+ continue
+
+ if param.description:
+ m.doc = param.description
+ m.doc_position = param.position
def _pass_read_annotations2(self, node, chain):
if isinstance(node, ast.Function):
diff --git a/giscanner/msvccompiler.py b/giscanner/msvccompiler.py
index d13eb808..0a543982 100644
--- a/giscanner/msvccompiler.py
+++ b/giscanner/msvccompiler.py
@@ -36,6 +36,7 @@ def get_msvc_compiler():
class MSVCCompiler(distutils.msvccompiler.MSVCCompiler):
def __init__(self, verbose=0, dry_run=0, force=0):
+ super(distutils.msvccompiler.MSVCCompiler, self).__init__()
CCompiler.__init__(self, verbose, dry_run, force)
self.__paths = []
self.__arch = None # deprecated name
@@ -44,6 +45,16 @@ class MSVCCompiler(distutils.msvccompiler.MSVCCompiler):
self.__version = distutils.msvc9compiler.VERSION
self.initialized = False
self.preprocess_options = None
+ if self.check_is_clang_cl():
+ cc_cmd = os.environ.get('CC').split()
+ self.cc = cc_cmd[0]
+ self.linker = 'lld-link'
+ self.compile_options = []
+ # Add any arguments added to clang-cl to self.compile_options
+ # such as cross-compilation flags
+ if len(cc_cmd) > 1:
+ self.compile_options.extend(cc_cmd[1:])
+ self.initialized = True
def preprocess(self,
source,
@@ -98,3 +109,14 @@ class MSVCCompiler(distutils.msvccompiler.MSVCCompiler):
return filename[filename.rfind('\\') + 1:]
else:
return filename[filename.rfind('\\') + 1:filename.rfind('.')]
+
+ def check_is_clang_cl(self):
+ # To run g-ir-scanner under Windows using clang-cl, set both `CC` and
+ # `CXX` to `clang-cl [<arch_args>]` and ensure that clang-cl.exe and
+ # lld-link.exe are in the PATH in a Visual Studio command prompt. Note
+ # that the Windows SDK is still needed in this case. This is in line
+ # with what is done in Meson
+ return (os.environ.get('CC') is not None and
+ os.environ.get('CXX') is not None and
+ os.environ.get('CC').split()[0] == 'clang-cl' and
+ os.environ.get('CXX').split()[0] == 'clang-cl')
diff --git a/giscanner/sectionparser.py b/giscanner/sectionparser.py
index ed4660fe..b8850432 100644
--- a/giscanner/sectionparser.py
+++ b/giscanner/sectionparser.py
@@ -148,5 +148,7 @@ def generate_sections_file(transformer):
append_symbol(section, meth.symbol)
for meth in node.static_methods:
append_symbol(section, meth.symbol)
+ elif isinstance(node, ast.DocSection):
+ section = new_section(None, node.name)
return SectionsFile(sections)
diff --git a/giscanner/utils.py b/giscanner/utils.py
index e8c246dd..e3396c6e 100644
--- a/giscanner/utils.py
+++ b/giscanner/utils.py
@@ -255,7 +255,7 @@ def get_system_data_dirs():
If any changes are made to that function they'll need to be copied here.
'''
xdg_data_dirs = [x for x in os.environ.get('XDG_DATA_DIRS', '').split(os.pathsep)]
- if not xdg_data_dirs and os.name != 'nt':
+ if not any(xdg_data_dirs) and os.name != 'nt':
xdg_data_dirs.append('/usr/local/share')
xdg_data_dirs.append('/usr/share')
diff --git a/gobject-introspection-1.0.pc.in b/gobject-introspection-1.0.pc.in
deleted file mode 100644
index 1036f90c..00000000
--- a/gobject-introspection-1.0.pc.in
+++ /dev/null
@@ -1,24 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-bindir=@bindir@
-datarootdir=@datarootdir@
-datadir=@datadir@
-includedir=@includedir@
-
-g_ir_scanner=${bindir}/g-ir-scanner
-g_ir_compiler=${bindir}/g-ir-compiler@EXEEXT@
-g_ir_generate=${bindir}/g-ir-generate@EXEEXT@
-gidatadir=${datadir}/gobject-introspection-1.0
-girdir=@GIR_PC_DIR@
-typelibdir=${libdir}/girepository-1.0
-
-Cflags: -I${includedir}/gobject-introspection-1.0 @FFI_PC_CFLAGS@
-Requires: glib-2.0 gobject-2.0
-Requires.private: gmodule-2.0 @FFI_PC_PACKAGES@
-Libs: -L${libdir} -lgirepository-1.0
-Libs.private: @FFI_PC_LIBS@
-
-Name: gobject-introspection
-Description: GObject Introspection
-Version: @VERSION@
diff --git a/gobject-introspection-no-export-1.0.pc.in b/gobject-introspection-no-export-1.0.pc.in
deleted file mode 100644
index bde4faf6..00000000
--- a/gobject-introspection-no-export-1.0.pc.in
+++ /dev/null
@@ -1,23 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-bindir=@bindir@
-datarootdir=@datarootdir@
-datadir=@datadir@
-includedir=@includedir@
-
-g_ir_scanner=${bindir}/g-ir-scanner
-g_ir_compiler=${bindir}/g-ir-compiler@EXEEXT@
-g_ir_generate=${bindir}/g-ir-generate@EXEEXT@
-girdir=@GIR_PC_DIR@
-typelibdir=${libdir}/girepository-1.0
-
-Cflags: -I${includedir}/gobject-introspection-1.0 @FFI_PC_CFLAGS@
-Requires: glib-2.0 gobject-2.0
-Requires.private: gmodule-no-export-2.0 @FFI_PC_PACKAGES@
-Libs: -L${libdir} -lgirepository-1.0
-Libs.private: @FFI_PC_LIBS@
-
-Name: gobject-introspection
-Description: GObject Introspection
-Version: @VERSION@
diff --git a/gobject-introspection.doap b/gobject-introspection.doap
index 0da06245..6e59acc5 100644
--- a/gobject-introspection.doap
+++ b/gobject-introspection.doap
@@ -13,7 +13,7 @@
<description xml:lang="en">GObject introspection provides tools and libraries to help manage its common metadata format for representing GObject-based C APIs, designed for bindings, documentation tools and API verification.</description>
- <homepage rdf:resource="http://live.gnome.org/GObjectIntrospection" />
+ <homepage rdf:resource="https://gi.readthedocs.io/" />
<license rdf:resource="http://usefulinc.com/doap/licenses/lgpl" />
<bug-database rdf:resource="https://gitlab.gnome.org/GNOME/gobject-introspection/issues/" />
<mailing-list rdf:resource="mailto:gtk-devel-list@gnome.org" />
diff --git a/meson.build b/meson.build
index 3d22dd55..9a1589ba 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
project('gobject-introspection', 'c',
- version: '1.64.1',
+ version: '1.66.0',
meson_version: '>= 0.50.1',
default_options: [
'warning_level=1',
@@ -9,6 +9,8 @@ project('gobject-introspection', 'c',
host_system = host_machine.system()
gi_versions = meson.project_version().split('.')
+build_root = meson.current_build_dir()
+source_root = meson.current_source_dir()
configinc = include_directories('.')
@@ -142,16 +144,22 @@ gmodule_dep = dependency('gmodule-2.0', version : glib_version,
if host_system != 'windows'
giounix_dep = dependency('gio-unix-2.0', version : glib_version,
fallback: ['glib', 'libgiounix_dep'])
+ giowin_dep = dependency('', required : false)
else
# Don't even try to look for gio-unix-2.0 on Windows because Meson will
# fruitlessly try to find it in the glib subproject even when we don't want
# it to look in the subproject at all. Just use a not-found dependency.
giounix_dep = dependency('', required : false)
# XXX: Autotools doesn't build girs for gio-win32-2.0, but maybe we should?
+ giowin_dep = dependency('gio-windows-2.0', version : glib_version,
+ fallback: ['glib', 'libgiowin32_dep'])
endif
libffi_dep = dependency('libffi',
fallback : ['libffi', 'ffi_dep'])
+# python headers
+cc.check_header('Python.h', dependencies: [python.dependency()], required: true)
+
# cairo
cairo_option = get_option('cairo')
if cc.get_id() == 'msvc'
@@ -223,44 +231,65 @@ endif
install_data('Makefile.introspection', install_dir: join_paths(get_option('datadir'), 'gobject-introspection-1.0'))
install_data('m4/introspection.m4', install_dir: join_paths(get_option('datadir'), 'aclocal'))
-prefix = join_paths(get_option('prefix'))
-pkgconfig_conf = configuration_data()
-pkgconfig_conf.set('prefix', prefix)
-pkgconfig_conf.set('exec_prefix', '${prefix}')
-pkgconfig_conf.set('bindir', join_paths('${exec_prefix}', get_option('bindir')))
-pkgconfig_conf.set('libdir', join_paths('${exec_prefix}', get_option('libdir')))
-pkgconfig_conf.set('datarootdir', join_paths('${prefix}', get_option('datadir')))
-pkgconfig_conf.set('datadir', '${datarootdir}')
-pkgconfig_conf.set('includedir', join_paths('${prefix}', get_option('includedir')))
-pkgconfig_conf.set('GIR_PC_DIR', join_paths(gir_dir_pc_prefix, 'gir-1.0'))
+pkg = import('pkgconfig')
+
+# We must put in the '.exe' extension for .exe executables
+exe_ext = ''
+
if host_system == 'windows' or host_system == 'cygwin'
- pkgconfig_conf.set('EXEEXT', '.exe')
-else
- pkgconfig_conf.set('EXEEXT', '')
-endif
-pkgconfig_conf.set('VERSION', meson.project_version())
-pkgconfig_conf.set('FFI_PC_PACKAGES', 'libffi')
-if libffi_dep.type_name() == 'pkgconfig'
- prog_pkgconfig = find_program('pkg-config')
- pkgconfig_conf.set('FFI_PC_CFLAGS', run_command(prog_pkgconfig, ['libffi', '--cflags-only-I']).stdout())
- pkgconfig_conf.set('FFI_PC_LIBS', run_command(prog_pkgconfig, ['libffi', '--libs-only-l']).stdout())
-else
- # XXX: We can't know the correct values for these, needs meson API. Maybe we
- # should use meson's pkgconfig module to generate the whole file.
- pkgconfig_conf.set('FFI_PC_CFLAGS', '')
- pkgconfig_conf.set('FFI_PC_LIBS', '-lffi')
+ exe_ext = '.exe'
endif
-configure_file(
- input: 'gobject-introspection-no-export-1.0.pc.in',
- output: 'gobject-introspection-no-export-1.0.pc',
- configuration: pkgconfig_conf,
- install_dir: join_paths(get_option('libdir'), 'pkgconfig'),
+pkgconfig_variables = [
+ 'datadir=' + '${prefix}' / get_option('datadir'),
+ 'bindir=' + '${prefix}' / get_option('bindir'),
+ 'g_ir_scanner=${bindir}/g-ir-scanner',
+ 'g_ir_compiler=${bindir}/g-ir-compiler@0@'.format(exe_ext),
+ 'g_ir_generate=${bindir}/g-ir-generate@0@'.format(exe_ext),
+ 'gidatadir=${datadir}/gobject-introspection-1.0',
+ 'girdir=' + gir_dir_pc_prefix / 'gir-1.0',
+ 'typelibdir=${libdir}/girepository-1.0',
+]
+
+pkg.generate(girepo_lib,
+ name : 'gobject-introspection',
+ filebase : 'gobject-introspection-1.0',
+ description : 'GObject Introspection',
+ subdirs: ['gobject-introspection-1.0'],
+ variables : pkgconfig_variables,
+ libraries : [glib_dep, gobject_dep],
)
-configure_file(
- input: 'gobject-introspection-1.0.pc.in',
- output: 'gobject-introspection-1.0.pc',
- configuration: pkgconfig_conf,
- install_dir: join_paths(get_option('libdir'), 'pkgconfig'),
+# This is legacy for backward compat. It is identical to the pc file generated
+# above because we actually never had a pc file that has `-Wl,--export-dynamic`.
+# The reason is `gmodule-2.0` was in `Requires.private` so its libs flags are
+# only included when doing `pkg-config gobject-introspection-1.0 --libs --static`
+# which makes no sense since we don't even build static girepository library.
+# Users who need `-Wl,--export-dynamic` can add `gmodule-2.0` explicitly in their
+# dependencies in addition to `gobject-introspection-1.0`.
+pkg.generate(
+ name : 'gobject-introspection',
+ filebase : 'gobject-introspection-no-export-1.0',
+ description : 'GObject Introspection',
+ subdirs: ['gobject-introspection-1.0'],
+ variables : pkgconfig_variables,
+ libraries : [girepo_lib, glib_dep, gobject_dep],
)
+
+# Dependency object used by Meson's GNOME module. This dependency variable must
+# be named girepo_dep for backward compatibility with projects that where already
+# using that name as fallback: dependency('gobject-introspection-1.0',
+# fallback : ['gobject-introspection', 'girepo_dep'])
+# FIXME: meson.override_dependency() and declare_dependency()'s variable arguments
+# are new in Meson 0.54.0, older versions of Meson won't be able to use g-i as
+# subproject anyway
+if meson.version().version_compare('>=0.54.0')
+ girepo_dep = declare_dependency(
+ sources: typelibs,
+ dependencies: girepo_dep,
+ variables: {
+ 'girdir': meson.current_build_dir() / 'gir',
+ },
+ )
+ meson.override_dependency('gobject-introspection-1.0', girepo_dep)
+endif
diff --git a/meson_options.txt b/meson_options.txt
index 20ccc3b9..dff9be8e 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -26,8 +26,8 @@ option('gir_dir_prefix', type: 'string',
description: 'Intermediate prefix for gir installation under ${prefix}'
)
-option('gi_cross_use_host_gi', type: 'boolean', value : false,
- description: 'Use gobject introspection tools installed in the host system (useful when cross-compiling)'
+option('gi_cross_use_prebuilt_gi', type: 'boolean', value : false,
+ description: 'Use gobject introspection tools installed in the build system (useful when cross-compiling)'
)
option('gi_cross_binary_wrapper', type: 'string',
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index cff2dcb0..53c17818 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -4584,6 +4584,33 @@ gi_marshalling_tests_object_vfunc_one_out_parameter (GIMarshallingTestsObject *s
}
/**
+ * gi_marshalling_tests_object_vfunc_one_inout_parameter:
+ * @a: (inout):
+ */
+void
+gi_marshalling_tests_object_vfunc_one_inout_parameter (GIMarshallingTestsObject *self, gfloat *a)
+{
+ /* make sure that local variables don't get smashed */
+ gulong local = 0x12345678;
+ GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_one_inout_parameter (self, a);
+ g_assert_cmpint (local, ==, 0x12345678);
+}
+
+/**
+ * gi_marshalling_tests_object_vfunc_multiple_inout_parameters:
+ * @a: (inout):
+ * @b: (inout):
+ */
+void
+gi_marshalling_tests_object_vfunc_multiple_inout_parameters (GIMarshallingTestsObject *self, gfloat *a, gfloat *b)
+{
+ /* make sure that local variables don't get smashed */
+ gulong local = 0x12345678;
+ GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_multiple_inout_parameters (self, a, b);
+ g_assert_cmpint (local, ==, 0x12345678);
+}
+
+/**
* gi_marshalling_tests_object_vfunc_multiple_out_parameters:
* @a: (out):
* @b: (out):
@@ -4652,6 +4679,37 @@ glong
}
/**
+ * gi_marshalling_tests_object_vfunc_return_value_and_one_inout_parameter:
+ * @a: (inout):
+ */
+glong gi_marshalling_tests_object_vfunc_return_value_and_one_inout_parameter (GIMarshallingTestsObject *self, glong *a)
+{
+ /* make sure that local variables don't get smashed */
+ gulong return_value;
+ gulong local = 0x12345678;
+ return_value = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_value_and_one_inout_parameter (self, a);
+ g_assert_cmpint (local, ==, 0x12345678);
+ return return_value;
+}
+
+/**
+ * gi_marshalling_tests_object_vfunc_return_value_and_multiple_inout_parameters:
+ * @a: (inout):
+ * @b: (inout):
+ */
+glong
+ gi_marshalling_tests_object_vfunc_return_value_and_multiple_inout_parameters
+ (GIMarshallingTestsObject *self, glong *a, glong *b)
+{
+ gulong return_value;
+ gulong local = 0x12345678;
+ return_value =
+ GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_value_and_multiple_inout_parameters (self, a, b);
+ g_assert_cmpint (local, ==, 0x12345678);
+ return return_value;
+}
+
+/**
* gi_marshalling_tests_callback_owned_boxed:
* @callback: (scope call) (closure callback_data):
* @callback_data: (allow-none):
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index d5357ec9..747a075d 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -1410,6 +1410,19 @@ struct _GIMarshallingTestsObjectClass
void (* vfunc_multiple_out_parameters) (GIMarshallingTestsObject *self, gfloat *a, gfloat *b);
/**
+ * GIMarshallingTestsObjectClass::vfunc_one_inout_parameter:
+ * @a: (inout):
+ */
+ void (* vfunc_one_inout_parameter) (GIMarshallingTestsObject *self, gfloat *a);
+
+ /**
+ * GIMarshallingTestsObjectClass::vfunc_multiple_inout_parameters:
+ * @a: (inout):
+ * @b: (inout):
+ */
+ void (* vfunc_multiple_inout_parameters) (GIMarshallingTestsObject *self, gfloat *a, gfloat *b);
+
+ /**
* GIMarshallingTestsObjectClass::vfunc_caller_allocated_out_parameter:
* @a: (out):
*/
@@ -1435,6 +1448,19 @@ struct _GIMarshallingTestsObjectClass
glong (* vfunc_return_value_and_multiple_out_parameters) (GIMarshallingTestsObject *self, glong *a, glong *b);
/**
+ * GIMarshallingTestsObjectClass::vfunc_return_value_and_one_inout_parameter:
+ * @a: (inout):
+ */
+ glong (* vfunc_return_value_and_one_inout_parameter) (GIMarshallingTestsObject *self, glong *a);
+
+ /**
+ * GIMarshallingTestsObjectClass::vfunc_return_value_and_multiple_inout_parameters:
+ * @a: (inout):
+ * @b: (inout):
+ */
+ glong (* vfunc_return_value_and_multiple_inout_parameters) (GIMarshallingTestsObject *self, glong *a, glong *b);
+
+ /**
* GIMarshallingTestsObjectClass::vfunc_meth_with_err:
* @x:
* @error: A #GError
@@ -1561,6 +1587,12 @@ _GI_TEST_EXTERN
void gi_marshalling_tests_object_vfunc_multiple_out_parameters (GIMarshallingTestsObject *self, gfloat *a, gfloat *b);
_GI_TEST_EXTERN
+void gi_marshalling_tests_object_vfunc_one_inout_parameter (GIMarshallingTestsObject *self, gfloat *a);
+
+_GI_TEST_EXTERN
+void gi_marshalling_tests_object_vfunc_multiple_inout_parameters (GIMarshallingTestsObject *self, gfloat *a, gfloat *b);
+
+_GI_TEST_EXTERN
void gi_marshalling_tests_object_vfunc_caller_allocated_out_parameter (GIMarshallingTestsObject *self, GValue *a);
_GI_TEST_EXTERN
@@ -1573,6 +1605,12 @@ _GI_TEST_EXTERN
glong gi_marshalling_tests_object_vfunc_return_value_and_multiple_out_parameters (GIMarshallingTestsObject *self, glong *a, glong *b);
_GI_TEST_EXTERN
+glong gi_marshalling_tests_object_vfunc_return_value_and_one_inout_parameter (GIMarshallingTestsObject *self, glong *a);
+
+_GI_TEST_EXTERN
+glong gi_marshalling_tests_object_vfunc_return_value_and_multiple_inout_parameters (GIMarshallingTestsObject *self, glong *a, glong *b);
+
+_GI_TEST_EXTERN
gboolean gi_marshalling_tests_object_vfunc_meth_with_error (GIMarshallingTestsObject *object, gint x, GError **error);
diff --git a/tests/meson.build b/tests/meson.build
index f4c57ed7..b240749e 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -115,8 +115,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--warn-all',
'--warn-error',
'--namespace=Everything',
@@ -141,8 +141,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--warn-all',
'--warn-error',
'--namespace=GIMarshallingTests',
@@ -163,7 +163,7 @@ if glib_dep.type_name() == 'pkgconfig'
output: '@BASENAME@.typelib',
depends: [gobject_gir, ],
command: [gircompiler, '-o', '@OUTPUT@', '@INPUT@',
- '--includedir', join_paths(meson.build_root(), 'gir'),
+ '--includedir', join_paths(build_root, 'gir'),
'--includedir', meson.current_build_dir()
],
)
diff --git a/tests/repository/meson.build b/tests/repository/meson.build
index 497ab106..17445381 100644
--- a/tests/repository/meson.build
+++ b/tests/repository/meson.build
@@ -10,17 +10,17 @@ if glib_dep.type_name() == 'pkgconfig'
repository_test_env = environment()
repository_test_env.prepend(
'GI_TYPELIB_PATH',
- join_paths(meson.build_root(), 'gir'),
- join_paths(meson.build_root(), 'tests'),
- join_paths(meson.build_root(), 'tests', 'scanner'),
+ join_paths(build_root, 'gir'),
+ join_paths(build_root, 'tests'),
+ join_paths(build_root, 'tests', 'scanner'),
)
repository_test_env.prepend(
'LD_LIBRARY_PATH',
- join_paths(meson.build_root(), 'tests', 'scanner'),
+ join_paths(build_root, 'tests', 'scanner'),
)
if host_system == 'windows'
repository_test_env.prepend(
- 'PATH', join_paths(meson.build_root(), 'tests', 'scanner'))
+ 'PATH', join_paths(build_root, 'tests', 'scanner'))
endif
custom_c_args = cc.get_supported_arguments([
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.AnnotationFields-field4.page b/tests/scanner/Regress-1.0-C-expected/Regress.AnnotationFields-field4.page
new file mode 100644
index 00000000..163d420f
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.AnnotationFields-field4.page
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<page id="Regress.AnnotationFields-field4"
+ type="topic"
+ style="field"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.AnnotationFields" group="field" type="guide"/>
+ </info>
+ <title>Regress.AnnotationFields->field4</title>
+ <p>A new field, breaking ABI is fun!</p>
+ <p>Since 1.4</p>
+</page>
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.standalone_section.page b/tests/scanner/Regress-1.0-C-expected/Regress.standalone_section.page
new file mode 100644
index 00000000..76a55515
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.standalone_section.page
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<page id="Regress.standalone_section"
+ type="topic"
+ style="default"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="index" group="default" type="guide"/>
+ </info>
+ <title>Regress.standalone_section</title>
+ <p>This documentation section isn't associated with an object
+in particular, but it should be serialized in the gir nevertheless.</p>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationBitfield.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationBitfield.page
index 355066b2..6f96ddb2 100644
--- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationBitfield.page
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationBitfield.page
@@ -20,6 +20,10 @@
<title><code>AnnotationBitfield.BAR</code></title>
</item>
+<item>
+<title><code>AnnotationBitfield.FOOBAR</code></title>
+
+</item>
</terms>
<links type="topic" ui:expanded="true"
api:type="function" api:mime="text/x-gjs"
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationFields-field4.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationFields-field4.page
new file mode 100644
index 00000000..e60c59bc
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationFields-field4.page
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<page id="Regress.AnnotationFields-field4"
+ type="topic"
+ style="field"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.AnnotationFields" group="field" type="guide"/>
+ <title type="link" role="topic">field4</title>
+ </info>
+ <title>Regress.AnnotationFields.field4</title>
+ <synopsis><code mime="text/x-gjs">
+AnnotationFields.field4: Number(guint) (Read / Write)
+ </code></synopsis>
+ <p>A new field, breaking ABI is fun!</p>
+ <p>Since 1.4</p>
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationFields.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationFields.page
index 585a97c1..7cd55257 100644
--- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationFields.page
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationFields.page
@@ -16,6 +16,7 @@ let annotationFields = new Regress.AnnotationFields({
<link xref='Regress.AnnotationFields-field1'>field1</link>: value
<link xref='Regress.AnnotationFields-arr'>arr</link>: value
<link xref='Regress.AnnotationFields-len'>len</link>: value
+ <link xref='Regress.AnnotationFields-field4'>field4</link>: value
});
</code></synopsis>
<p>This is a struct for testing field documentation and annotations</p>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.standalone_section.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.standalone_section.page
new file mode 100644
index 00000000..76a55515
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.standalone_section.page
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<page id="Regress.standalone_section"
+ type="topic"
+ style="default"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="index" group="default" type="guide"/>
+ </info>
+ <title>Regress.standalone_section</title>
+ <p>This documentation section isn't associated with an object
+in particular, but it should be serialized in the gir nevertheless.</p>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.AnnotationBitfield.page b/tests/scanner/Regress-1.0-Python-expected/Regress.AnnotationBitfield.page
index fa303bb4..a9003221 100644
--- a/tests/scanner/Regress-1.0-Python-expected/Regress.AnnotationBitfield.page
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.AnnotationBitfield.page
@@ -20,6 +20,10 @@
<title><code>AnnotationBitfield.BAR</code></title>
</item>
+<item>
+<title><code>AnnotationBitfield.FOOBAR</code></title>
+
+</item>
</terms>
</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.AnnotationFields-field4.page b/tests/scanner/Regress-1.0-Python-expected/Regress.AnnotationFields-field4.page
new file mode 100644
index 00000000..163d420f
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.AnnotationFields-field4.page
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<page id="Regress.AnnotationFields-field4"
+ type="topic"
+ style="field"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.AnnotationFields" group="field" type="guide"/>
+ </info>
+ <title>Regress.AnnotationFields->field4</title>
+ <p>A new field, breaking ABI is fun!</p>
+ <p>Since 1.4</p>
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.standalone_section.page b/tests/scanner/Regress-1.0-Python-expected/Regress.standalone_section.page
new file mode 100644
index 00000000..76a55515
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.standalone_section.page
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<page id="Regress.standalone_section"
+ type="topic"
+ style="default"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="index" group="default" type="guide"/>
+ </info>
+ <title>Regress.standalone_section</title>
+ <p>This documentation section isn't associated with an object
+in particular, but it should be serialized in the gir nevertheless.</p>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index cef3b124..3a1764e8 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -58,7 +58,7 @@ and/or use gtk-doc annotations. -->
<constant name="ANNOTATION_CALCULATED_DEFINE"
value="100"
c:type="REGRESS_ANNOTATION_CALCULATED_DEFINE">
- <source-position filename="annotation.h" line="282"/>
+ <source-position filename="annotation.h" line="295"/>
<type name="gint" c:type="gint"/>
</constant>
<constant name="ANNOTATION_CALCULATED_LARGE"
@@ -67,8 +67,8 @@ and/or use gtk-doc annotations. -->
version="1.4">
<doc xml:space="preserve"
filename="annotation.h"
- line="284">Constant to define a calculated large value</doc>
- <source-position filename="annotation.h" line="291"/>
+ line="297">Constant to define a calculated large value</doc>
+ <source-position filename="annotation.h" line="304"/>
<type name="gint" c:type="gint"/>
</constant>
<constant name="ANNOTATION_CALCULATED_LARGE_DIV"
@@ -76,8 +76,8 @@ and/or use gtk-doc annotations. -->
c:type="REGRESS_ANNOTATION_CALCULATED_LARGE_DIV">
<doc xml:space="preserve"
filename="annotation.h"
- line="293">Constant to define a calculated large value</doc>
- <source-position filename="annotation.h" line="298"/>
+ line="306">Constant to define a calculated large value</doc>
+ <source-position filename="annotation.h" line="311"/>
<type name="gint" c:type="gint"/>
</constant>
<enumeration name="ATestError"
@@ -112,28 +112,33 @@ and/or use gtk-doc annotations. -->
</union>
</record>
<bitfield name="AnnotationBitfield" c:type="RegressAnnotationBitfield">
- <source-position filename="annotation.h" line="12"/>
+ <source-position filename="annotation.h" line="18"/>
<member name="foo" value="1" c:identifier="ANN_FLAG_FOO">
</member>
<member name="bar" value="2" c:identifier="ANN_FLAG_BAR">
</member>
+ <member name="foobar"
+ value="3"
+ c:identifier="ANN_FLAG_FOOBAR"
+ version="1.4">
+ </member>
</bitfield>
<callback name="AnnotationCallback" c:type="RegressAnnotationCallback">
<doc xml:space="preserve"
filename="annotation.h"
- line="14">This is a callback.</doc>
- <source-position filename="annotation.h" line="21"/>
+ line="20">This is a callback.</doc>
+ <source-position filename="annotation.h" line="27"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="annotation.h"
- line="19">array of ints</doc>
+ line="25">array of ints</doc>
<type name="gint" c:type="const gint*"/>
</return-value>
<parameters>
<parameter name="in" transfer-ownership="none">
<doc xml:space="preserve"
filename="annotation.h"
- line="16">array of ints</doc>
+ line="22">array of ints</doc>
<type name="gint" c:type="const gint*"/>
</parameter>
</parameters>
@@ -141,18 +146,18 @@ and/or use gtk-doc annotations. -->
<record name="AnnotationFields" c:type="RegressAnnotationFields">
<doc xml:space="preserve"
filename="annotation.h"
- line="246">This is a struct for testing field documentation and annotations</doc>
- <source-position filename="annotation.h" line="259"/>
+ line="252">This is a struct for testing field documentation and annotations</doc>
+ <source-position filename="annotation.h" line="273"/>
<field name="field1" writable="1">
<doc xml:space="preserve"
filename="annotation.h"
- line="248">Some documentation</doc>
+ line="254">Some documentation</doc>
<type name="gint" c:type="int"/>
</field>
<field name="arr" writable="1">
<doc xml:space="preserve"
filename="annotation.h"
- line="249">an array of length @len</doc>
+ line="255">an array of length @len</doc>
<array length="2" zero-terminated="0" c:type="guchar*">
<type name="guint8" c:type="guchar"/>
</array>
@@ -160,13 +165,19 @@ and/or use gtk-doc annotations. -->
<field name="len" writable="1">
<doc xml:space="preserve"
filename="annotation.h"
- line="250">the length of array</doc>
+ line="256">the length of array</doc>
<type name="gulong" c:type="gulong"/>
</field>
+ <field name="field4" version="1.4" writable="1">
+ <doc xml:space="preserve"
+ filename="annotation.h"
+ line="265">A new field, breaking ABI is fun!</doc>
+ <type name="guint" c:type="guint"/>
+ </field>
</record>
<callback name="AnnotationForeachFunc"
c:type="RegressAnnotationForeachFunc">
- <source-position filename="annotation.h" line="49"/>
+ <source-position filename="annotation.h" line="55"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -190,12 +201,12 @@ and/or use gtk-doc annotations. -->
c:type="RegressAnnotationListCallback">
<doc xml:space="preserve"
filename="annotation.h"
- line="23">This is a callback taking a list.</doc>
- <source-position filename="annotation.h" line="30"/>
+ line="29">This is a callback taking a list.</doc>
+ <source-position filename="annotation.h" line="36"/>
<return-value transfer-ownership="container">
<doc xml:space="preserve"
filename="annotation.h"
- line="28">list of strings</doc>
+ line="34">list of strings</doc>
<type name="GLib.List" c:type="GList*">
<type name="utf8"/>
</type>
@@ -204,7 +215,7 @@ and/or use gtk-doc annotations. -->
<parameter name="in" transfer-ownership="none">
<doc xml:space="preserve"
filename="annotation.h"
- line="25">list of strings</doc>
+ line="31">list of strings</doc>
<type name="GLib.List" c:type="GList*">
<type name="utf8"/>
</type>
@@ -214,9 +225,9 @@ and/or use gtk-doc annotations. -->
<callback name="AnnotationNotifyFunc" c:type="RegressAnnotationNotifyFunc">
<doc xml:space="preserve"
filename="annotation.h"
- line="32">This is a callback with a 'closure' argument that is not named
+ line="38">This is a callback with a 'closure' argument that is not named
'user_data' and hence has to be annotated.</doc>
- <source-position filename="annotation.h" line="39"/>
+ <source-position filename="annotation.h" line="45"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -228,7 +239,7 @@ and/or use gtk-doc annotations. -->
closure="0">
<doc xml:space="preserve"
filename="annotation.h"
- line="34">The user data</doc>
+ line="40">The user data</doc>
<type name="gpointer" c:type="gpointer"/>
</parameter>
</parameters>
@@ -243,11 +254,11 @@ and/or use gtk-doc annotations. -->
<attribute name="org.example.Test" value="cows"/>
<doc xml:space="preserve"
filename="annotation.h"
- line="41">This is an object used to test annotations.</doc>
- <source-position filename="annotation.h" line="61"/>
+ line="47">This is an object used to test annotations.</doc>
+ <source-position filename="annotation.h" line="67"/>
<method name="allow_none"
c:identifier="regress_annotation_object_allow_none">
- <source-position filename="annotation.h" line="77"/>
+ <source-position filename="annotation.h" line="83"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="annotation.c"
@@ -274,7 +285,7 @@ and/or use gtk-doc annotations. -->
<doc xml:space="preserve"
filename="annotation.c"
line="296">This is a test for out arguments; GObject defaults to transfer</doc>
- <source-position filename="annotation.h" line="100"/>
+ <source-position filename="annotation.h" line="106"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="annotation.c"
@@ -304,7 +315,7 @@ and/or use gtk-doc annotations. -->
<doc xml:space="preserve"
filename="annotation.c"
line="312">This is a test for out arguments, one transferred, other not</doc>
- <source-position filename="annotation.h" line="104"/>
+ <source-position filename="annotation.h" line="110"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="annotation.c"
@@ -343,7 +354,7 @@ and/or use gtk-doc annotations. -->
<doc xml:space="preserve"
filename="annotation.c"
line="422">Test taking a zero-terminated array</doc>
- <source-position filename="annotation.h" line="128"/>
+ <source-position filename="annotation.h" line="134"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -369,7 +380,7 @@ and/or use gtk-doc annotations. -->
<doc xml:space="preserve"
filename="annotation.c"
line="436">Test taking an array with length parameter</doc>
- <source-position filename="annotation.h" line="133"/>
+ <source-position filename="annotation.h" line="139"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -402,7 +413,7 @@ and/or use gtk-doc annotations. -->
<doc xml:space="preserve"
filename="annotation.c"
line="453">Test taking a zero-terminated array with length parameter</doc>
- <source-position filename="annotation.h" line="138"/>
+ <source-position filename="annotation.h" line="144"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -435,7 +446,7 @@ are zero-terminated</doc>
<doc xml:space="preserve"
filename="annotation.c"
line="396">Test returning a caller-owned object</doc>
- <source-position filename="annotation.h" line="74"/>
+ <source-position filename="annotation.h" line="80"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="annotation.c"
@@ -456,7 +467,7 @@ are zero-terminated</doc>
deprecated="1"
deprecated-version="0.12">
<doc-deprecated xml:space="preserve">Use regress_annotation_object_create_object() instead.</doc-deprecated>
- <source-position filename="annotation.h" line="174"/>
+ <source-position filename="annotation.h" line="180"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="annotation.c"
@@ -475,7 +486,7 @@ are zero-terminated</doc>
<method name="extra_annos"
c:identifier="regress_annotation_object_extra_annos">
<attribute name="org.foobar" value="testvalue"/>
- <source-position filename="annotation.h" line="213"/>
+ <source-position filename="annotation.h" line="219"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -489,7 +500,7 @@ are zero-terminated</doc>
<doc xml:space="preserve"
filename="annotation.c"
line="502">Test taking a call-scoped callback</doc>
- <source-position filename="annotation.h" line="152"/>
+ <source-position filename="annotation.h" line="158"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -527,7 +538,7 @@ are zero-terminated</doc>
filename="annotation.c"
line="349">This is a test for returning a hash table mapping strings to
objects.</doc>
- <source-position filename="annotation.h" line="112"/>
+ <source-position filename="annotation.h" line="118"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="annotation.c"
@@ -553,7 +564,7 @@ objects.</doc>
line="378">This is a test for returning a list of objects.
The list itself should be freed, but not the internal objects,
intentionally similar example to gtk_container_get_children</doc>
- <source-position filename="annotation.h" line="119"/>
+ <source-position filename="annotation.h" line="125"/>
<return-value transfer-ownership="container">
<doc xml:space="preserve"
filename="annotation.c"
@@ -577,7 +588,7 @@ intentionally similar example to gtk_container_get_children</doc>
filename="annotation.c"
line="331">This is a test for returning a list of strings, where
each string needs to be freed.</doc>
- <source-position filename="annotation.h" line="109"/>
+ <source-position filename="annotation.h" line="115"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="annotation.c"
@@ -597,7 +608,7 @@ each string needs to be freed.</doc>
</method>
<method name="hidden_self"
c:identifier="regress_annotation_object_hidden_self">
- <source-position filename="annotation.h" line="188"/>
+ <source-position filename="annotation.h" line="194"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -614,7 +625,7 @@ each string needs to be freed.</doc>
<doc xml:space="preserve"
filename="annotation.c"
line="232">This is a test for in arguments</doc>
- <source-position filename="annotation.h" line="96"/>
+ <source-position filename="annotation.h" line="102"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="annotation.c"
@@ -640,7 +651,7 @@ each string needs to be freed.</doc>
<doc xml:space="preserve"
filename="annotation.c"
line="248">This is a test for out arguments</doc>
- <source-position filename="annotation.h" line="84"/>
+ <source-position filename="annotation.h" line="90"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="annotation.c"
@@ -669,7 +680,7 @@ each string needs to be freed.</doc>
<doc xml:space="preserve"
filename="annotation.c"
line="263">This is a second test for out arguments</doc>
- <source-position filename="annotation.h" line="88"/>
+ <source-position filename="annotation.h" line="94"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="annotation.c"
@@ -698,7 +709,7 @@ each string needs to be freed.</doc>
<doc xml:space="preserve"
filename="annotation.c"
line="279">This is a 3th test for out arguments</doc>
- <source-position filename="annotation.h" line="92"/>
+ <source-position filename="annotation.h" line="98"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="annotation.c"
@@ -726,7 +737,7 @@ each string needs to be freed.</doc>
</parameters>
</method>
<method name="method" c:identifier="regress_annotation_object_method">
- <source-position filename="annotation.h" line="67"/>
+ <source-position filename="annotation.h" line="73"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="annotation.c"
@@ -743,7 +754,7 @@ each string needs to be freed.</doc>
</parameters>
</method>
<method name="notrans" c:identifier="regress_annotation_object_notrans">
- <source-position filename="annotation.h" line="81"/>
+ <source-position filename="annotation.h" line="87"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="annotation.c"
@@ -763,7 +774,7 @@ each string needs to be freed.</doc>
<doc xml:space="preserve"
filename="annotation.c"
line="216">This is a test for out arguments</doc>
- <source-position filename="annotation.h" line="70"/>
+ <source-position filename="annotation.h" line="76"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="annotation.c"
@@ -793,7 +804,7 @@ each string needs to be freed.</doc>
<doc xml:space="preserve"
filename="annotation.c"
line="470">Test taking a zero-terminated array with length parameter</doc>
- <source-position filename="annotation.h" line="143"/>
+ <source-position filename="annotation.h" line="149"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -831,7 +842,7 @@ each string needs to be freed.</doc>
<doc xml:space="preserve"
filename="annotation.c"
line="518">Test taking a guchar * with a length.</doc>
- <source-position filename="annotation.h" line="158"/>
+ <source-position filename="annotation.h" line="164"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -863,7 +874,7 @@ each string needs to be freed.</doc>
<doc xml:space="preserve"
filename="annotation.c"
line="534">Test taking a gchar * with a length.</doc>
- <source-position filename="annotation.h" line="163"/>
+ <source-position filename="annotation.h" line="169"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -896,7 +907,7 @@ each string needs to be freed.</doc>
filename="annotation.c"
line="550">Test taking a gchar * with a length, overriding the array element
type.</doc>
- <source-position filename="annotation.h" line="168"/>
+ <source-position filename="annotation.h" line="174"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -928,7 +939,7 @@ type.</doc>
<doc xml:space="preserve"
filename="annotation.c"
line="486">Test returning a string as an out parameter</doc>
- <source-position filename="annotation.h" line="148"/>
+ <source-position filename="annotation.h" line="154"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="annotation.c"
@@ -955,7 +966,7 @@ type.</doc>
</method>
<method name="use_buffer"
c:identifier="regress_annotation_object_use_buffer">
- <source-position filename="annotation.h" line="123"/>
+ <source-position filename="annotation.h" line="129"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -979,7 +990,7 @@ type.</doc>
filename="annotation.c"
line="606">This is here just for the sake of being overriden by its
regress_annotation_object_watch_full().</doc>
- <source-position filename="annotation.h" line="177"/>
+ <source-position filename="annotation.h" line="183"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1014,7 +1025,7 @@ regress_annotation_object_watch_full().</doc>
<doc xml:space="preserve"
filename="annotation.c"
line="622">Test overriding via the "Rename To" annotation.</doc>
- <source-position filename="annotation.h" line="182"/>
+ <source-position filename="annotation.h" line="188"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1055,7 +1066,7 @@ regress_annotation_object_watch_full().</doc>
</method>
<method name="with_voidp"
c:identifier="regress_annotation_object_with_voidp">
- <source-position filename="annotation.h" line="115"/>
+ <source-position filename="annotation.h" line="121"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1196,7 +1207,7 @@ it says it's pointer but it's actually a string.</doc>
<record name="AnnotationObjectClass"
c:type="RegressAnnotationObjectClass"
glib:is-gtype-struct-for="AnnotationObject">
- <source-position filename="annotation.h" line="61"/>
+ <source-position filename="annotation.h" line="67"/>
<field name="parent_class">
<type name="GObject.ObjectClass" c:type="GObjectClass"/>
</field>
@@ -1204,8 +1215,8 @@ it says it's pointer but it's actually a string.</doc>
<record name="AnnotationStruct" c:type="RegressAnnotationStruct">
<doc xml:space="preserve"
filename="annotation.h"
- line="236">This is a test of an array of object in an field of a struct.</doc>
- <source-position filename="annotation.h" line="244"/>
+ line="242">This is a test of an array of object in an field of a struct.</doc>
+ <source-position filename="annotation.h" line="250"/>
<field name="objects" writable="1">
<array zero-terminated="0" fixed-size="10">
<type name="AnnotationObject" c:type="RegressAnnotationObject*"/>
@@ -1865,13 +1876,13 @@ it says it's pointer but it's actually a string.</doc>
c:identifier="regress_foo_object_get_default">
<doc xml:space="preserve"
filename="foo.c"
- line="330">This function is intended to match clutter_stage_get_default which
+ line="337">This function is intended to match clutter_stage_get_default which
uses a C sugar return type.</doc>
<source-position filename="foo.h" line="205"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="foo.c"
- line="336">The global #RegressFooSubobject</doc>
+ line="343">The global #RegressFooSubobject</doc>
<type name="FooSubobject" c:type="RegressFooObject*"/>
</return-value>
</function>
@@ -1885,22 +1896,22 @@ uses a C sugar return type.</doc>
<virtual-method name="read_fn" invoker="read">
<doc xml:space="preserve"
filename="foo.c"
- line="291">Read some stuff.</doc>
+ line="298">Read some stuff.</doc>
<source-position filename="foo.h" line="117"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
<parameters>
<instance-parameter name="object" transfer-ownership="none">
- <doc xml:space="preserve" filename="foo.c" line="293">obj</doc>
+ <doc xml:space="preserve" filename="foo.c" line="300">obj</doc>
<type name="FooObject" c:type="RegressFooObject*"/>
</instance-parameter>
<parameter name="offset" transfer-ownership="none">
- <doc xml:space="preserve" filename="foo.c" line="294">offset</doc>
+ <doc xml:space="preserve" filename="foo.c" line="301">offset</doc>
<type name="gint" c:type="int"/>
</parameter>
<parameter name="length" transfer-ownership="none">
- <doc xml:space="preserve" filename="foo.c" line="295">length</doc>
+ <doc xml:space="preserve" filename="foo.c" line="302">length</doc>
<type name="gint" c:type="int"/>
</parameter>
</parameters>
@@ -1923,7 +1934,7 @@ uses a C sugar return type.</doc>
c:identifier="regress_foo_object_append_new_stack_layer">
<doc xml:space="preserve"
filename="foo.c"
- line="779">This shouldn't be scanned as a constructor.</doc>
+ line="786">This shouldn't be scanned as a constructor.</doc>
<source-position filename="foo.h" line="581"/>
<return-value transfer-ownership="none">
<type name="FooOtherObject" c:type="RegressFooOtherObject*"/>
@@ -1954,14 +1965,14 @@ uses a C sugar return type.</doc>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="foo.c"
- line="240">%NULL always</doc>
+ line="247">%NULL always</doc>
<type name="Utility.Object" c:type="UtilityObject*"/>
</return-value>
<parameters>
<instance-parameter name="object" transfer-ownership="none">
<doc xml:space="preserve"
filename="foo.c"
- line="238">a #RegressFooObject</doc>
+ line="245">a #RegressFooObject</doc>
<type name="FooObject" c:type="RegressFooObject*"/>
</instance-parameter>
</parameters>
@@ -2012,7 +2023,7 @@ uses a C sugar return type.</doc>
introspectable="0">
<doc xml:space="preserve"
filename="foo.c"
- line="266">Not sure why this test is here...</doc>
+ line="273">Not sure why this test is here...</doc>
<source-position filename="foo.h" line="152"/>
<return-value transfer-ownership="none">
<type name="FooObjectCookie" c:type="RegressFooObjectCookie"/>
@@ -2029,22 +2040,22 @@ uses a C sugar return type.</doc>
<method name="read" c:identifier="regress_foo_object_read">
<doc xml:space="preserve"
filename="foo.c"
- line="291">Read some stuff.</doc>
+ line="298">Read some stuff.</doc>
<source-position filename="foo.h" line="176"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
<parameters>
<instance-parameter name="object" transfer-ownership="none">
- <doc xml:space="preserve" filename="foo.c" line="293">obj</doc>
+ <doc xml:space="preserve" filename="foo.c" line="300">obj</doc>
<type name="FooObject" c:type="RegressFooObject*"/>
</instance-parameter>
<parameter name="offset" transfer-ownership="none">
- <doc xml:space="preserve" filename="foo.c" line="294">offset</doc>
+ <doc xml:space="preserve" filename="foo.c" line="301">offset</doc>
<type name="gint" c:type="int"/>
</parameter>
<parameter name="length" transfer-ownership="none">
- <doc xml:space="preserve" filename="foo.c" line="295">length</doc>
+ <doc xml:space="preserve" filename="foo.c" line="302">length</doc>
<type name="gint" c:type="int"/>
</parameter>
</parameters>
@@ -2054,14 +2065,14 @@ uses a C sugar return type.</doc>
introspectable="0">
<doc xml:space="preserve"
filename="foo.c"
- line="305">This is only useful from C.</doc>
+ line="312">This is only useful from C.</doc>
<source-position filename="foo.h" line="184"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
<parameters>
<instance-parameter name="object" transfer-ownership="none">
- <doc xml:space="preserve" filename="foo.c" line="307">obj</doc>
+ <doc xml:space="preserve" filename="foo.c" line="314">obj</doc>
<type name="FooObject" c:type="RegressFooObject*"/>
</instance-parameter>
</parameters>
@@ -2187,19 +2198,19 @@ uses a C sugar return type.</doc>
</return-value>
<parameters>
<parameter name="object" transfer-ownership="none">
- <doc xml:space="preserve" filename="foo.c" line="293">obj</doc>
+ <doc xml:space="preserve" filename="foo.c" line="300">obj</doc>
<type name="FooObject" c:type="RegressFooObject*"/>
</parameter>
<parameter name="offset" transfer-ownership="none">
<doc xml:space="preserve"
filename="foo.c"
- line="294">offset</doc>
+ line="301">offset</doc>
<type name="gint" c:type="int"/>
</parameter>
<parameter name="length" transfer-ownership="none">
<doc xml:space="preserve"
filename="foo.c"
- line="295">length</doc>
+ line="302">length</doc>
<type name="gint" c:type="int"/>
</parameter>
</parameters>
@@ -2252,13 +2263,13 @@ uses a C sugar return type.</doc>
transfer-ownership="full">
<doc xml:space="preserve"
filename="foo.c"
- line="559">add to this rect</doc>
+ line="566">add to this rect</doc>
<type name="FooRectangle" c:type="RegressFooRectangle*"/>
</instance-parameter>
<parameter name="r2" transfer-ownership="none">
<doc xml:space="preserve"
filename="foo.c"
- line="560">source rectangle</doc>
+ line="567">source rectangle</doc>
<type name="FooRectangle" c:type="const RegressFooRectangle*"/>
</parameter>
</parameters>
@@ -2268,7 +2279,7 @@ uses a C sugar return type.</doc>
introspectable="0">
<doc xml:space="preserve"
filename="foo.c"
- line="540">This is a C convenience constructor; we have to (skip)
+ line="547">This is a C convenience constructor; we have to (skip)
it because it's not a boxed type.</doc>
<source-position filename="foo.h" line="357"/>
<return-value>
@@ -5648,7 +5659,7 @@ the introspection client langage.</doc>
</function>
<function name="annotation_attribute_func"
c:identifier="regress_annotation_attribute_func">
- <source-position filename="annotation.h" line="229"/>
+ <source-position filename="annotation.h" line="235"/>
<return-value transfer-ownership="none">
<attribute name="some.other.annotation" value="value2"/>
<attribute name="yet.another.annotation" value="another_value"/>
@@ -5680,7 +5691,7 @@ the introspection client langage.</doc>
filename="annotation.c"
line="719">Test messing up the heuristic of closure/destroy-notification
detection, and fixing it via annotations.</doc>
- <source-position filename="annotation.h" line="217"/>
+ <source-position filename="annotation.h" line="223"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -5712,7 +5723,7 @@ detection, and fixing it via annotations.</doc>
</function>
<function name="annotation_get_source_file"
c:identifier="regress_annotation_get_source_file">
- <source-position filename="annotation.h" line="222"/>
+ <source-position filename="annotation.h" line="228"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="annotation.c"
@@ -5721,7 +5732,7 @@ detection, and fixing it via annotations.</doc>
</return-value>
</function>
<function name="annotation_init" c:identifier="regress_annotation_init">
- <source-position filename="annotation.h" line="192"/>
+ <source-position filename="annotation.h" line="198"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -5750,7 +5761,7 @@ detection, and fixing it via annotations.</doc>
</function>
<function name="annotation_invalid_regress_annotation"
c:identifier="regress_annotation_invalid_regress_annotation">
- <source-position filename="annotation.h" line="234"/>
+ <source-position filename="annotation.h" line="240"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -5765,7 +5776,7 @@ detection, and fixing it via annotations.</doc>
</function>
<function name="annotation_ptr_array"
c:identifier="regress_annotation_ptr_array">
- <source-position filename="annotation.h" line="263"/>
+ <source-position filename="annotation.h" line="276"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -5782,7 +5793,7 @@ detection, and fixing it via annotations.</doc>
</function>
<function name="annotation_return_array"
c:identifier="regress_annotation_return_array">
- <source-position filename="annotation.h" line="196"/>
+ <source-position filename="annotation.h" line="202"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="annotation.c"
@@ -5805,7 +5816,7 @@ detection, and fixing it via annotations.</doc>
</function>
<function name="annotation_return_filename"
c:identifier="regress_annotation_return_filename">
- <source-position filename="annotation.h" line="275"/>
+ <source-position filename="annotation.h" line="288"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="annotation.c"
@@ -5815,7 +5826,7 @@ detection, and fixing it via annotations.</doc>
</function>
<function name="annotation_set_source_file"
c:identifier="regress_annotation_set_source_file">
- <source-position filename="annotation.h" line="225"/>
+ <source-position filename="annotation.h" line="231"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -5833,14 +5844,14 @@ detection, and fixing it via annotations.</doc>
<doc xml:space="preserve"
filename="annotation.c"
line="805">Explicitly test having a space after the ** here.</doc>
- <source-position filename="annotation.h" line="271"/>
+ <source-position filename="annotation.h" line="284"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
</function>
<function name="annotation_string_array_length"
c:identifier="regress_annotation_string_array_length">
- <source-position filename="annotation.h" line="209"/>
+ <source-position filename="annotation.h" line="215"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -5857,7 +5868,7 @@ detection, and fixing it via annotations.</doc>
</function>
<function name="annotation_string_zero_terminated"
c:identifier="regress_annotation_string_zero_terminated">
- <source-position filename="annotation.h" line="202"/>
+ <source-position filename="annotation.h" line="208"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="annotation.c"
@@ -5869,7 +5880,7 @@ detection, and fixing it via annotations.</doc>
</function>
<function name="annotation_string_zero_terminated_out"
c:identifier="regress_annotation_string_zero_terminated_out">
- <source-position filename="annotation.h" line="205"/>
+ <source-position filename="annotation.h" line="211"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -5889,7 +5900,7 @@ detection, and fixing it via annotations.</doc>
<doc xml:space="preserve"
filename="annotation.c"
line="791">See https://bugzilla.gnome.org/show_bug.cgi?id=630862</doc>
- <source-position filename="annotation.h" line="267"/>
+ <source-position filename="annotation.h" line="280"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="annotation.c"
@@ -5899,7 +5910,7 @@ detection, and fixing it via annotations.</doc>
</function>
<function name="annotation_transfer_floating"
c:identifier="regress_annotation_transfer_floating">
- <source-position filename="annotation.h" line="279"/>
+ <source-position filename="annotation.h" line="292"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="annotation.c"
@@ -5918,7 +5929,7 @@ detection, and fixing it via annotations.</doc>
<function name="annotation_versioned"
c:identifier="regress_annotation_versioned"
version="0.6">
- <source-position filename="annotation.h" line="199"/>
+ <source-position filename="annotation.h" line="205"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -6060,7 +6071,7 @@ detection, and fixing it via annotations.</doc>
c:identifier="regress_foo_not_a_constructor_new">
<doc xml:space="preserve"
filename="foo.c"
- line="792">This should be scanned as a top-level function, and shouldn't cause
+ line="799">This should be scanned as a top-level function, and shouldn't cause
a "Can't find matching type for constructor" warning.</doc>
<source-position filename="foo.h" line="221"/>
<return-value transfer-ownership="none">
@@ -6073,7 +6084,7 @@ a "Can't find matching type for constructor" warning.</doc>
introspectable="0">
<doc xml:space="preserve"
filename="foo.c"
- line="540">This is a C convenience constructor; we have to (skip)
+ line="547">This is a C convenience constructor; we have to (skip)
it because it's not a boxed type.</doc>
<source-position filename="foo.h" line="357"/>
<return-value>
@@ -6099,7 +6110,7 @@ it because it's not a boxed type.</doc>
introspectable="0">
<doc xml:space="preserve"
filename="foo.c"
- line="719">Does something that's only interesting from C and should not be
+ line="726">Does something that's only interesting from C and should not be
exposed to language bindings.</doc>
<source-position filename="foo.h" line="556"/>
<return-value transfer-ownership="none">
@@ -6109,7 +6120,7 @@ exposed to language bindings.</doc>
<parameter name="fs" transfer-ownership="none">
<doc xml:space="preserve"
filename="foo.c"
- line="721">a #RegressFooSkippable</doc>
+ line="728">a #RegressFooSkippable</doc>
<type name="FooSkippable" c:type="RegressFooSkippable"/>
</parameter>
</parameters>
@@ -6434,6 +6445,12 @@ libgnome-keyring.</doc>
</parameter>
</parameters>
</function>
+ <docsection name="standalone_section">
+ <doc xml:space="preserve"
+ filename="foo.c"
+ line="8">This documentation section isn't associated with an object
+in particular, but it should be serialized in the gir nevertheless.</doc>
+ </docsection>
<function name="test_abc_error_quark"
c:identifier="regress_test_abc_error_quark"
moved-to="TestABCError.quark">
diff --git a/tests/scanner/Regress-1.0-sections-expected.txt b/tests/scanner/Regress-1.0-sections-expected.txt
index b35b3a9a..a5d8f64d 100644
--- a/tests/scanner/Regress-1.0-sections-expected.txt
+++ b/tests/scanner/Regress-1.0-sections-expected.txt
@@ -389,3 +389,6 @@ RegressTestWi8021xClass
regress_test_wi_802_1x_get_testbool
regress_test_wi_802_1x_set_testbool
regress_test_wi_802_1x_static_method
+
+<SECTION>
+<TITLE>standalone_section</TITLE>
diff --git a/tests/scanner/annotation.h b/tests/scanner/annotation.h
index 92c0b6bd..5c23d77c 100644
--- a/tests/scanner/annotation.h
+++ b/tests/scanner/annotation.h
@@ -8,7 +8,13 @@
typedef enum /*< flags,prefix=ANN >*/
{
ANN_FLAG_FOO = 1,
- ANN_FLAG_BAR = 2
+ ANN_FLAG_BAR = 2,
+ /**
+ * ANN_FLAG_FOOBAR:
+ *
+ * Since: 1.4
+ */
+ ANN_FLAG_FOOBAR = 3,
} RegressAnnotationBitfield;
/**
@@ -256,9 +262,16 @@ struct RegressAnnotationFields
int field1;
guchar *arr;
gulong len;
+ /**
+ * RegressAnnotationFields.field4:
+ *
+ * A new field, breaking ABI is fun!
+ *
+ * Since: 1.4
+ */
+ guint field4;
};
-
_GI_TEST_EXTERN
void regress_annotation_ptr_array (GPtrArray *array);
diff --git a/tests/scanner/annotationparser/gi/identifier_section.xml b/tests/scanner/annotationparser/gi/identifier_section.xml
index fad2b2ed..380ab87b 100644
--- a/tests/scanner/annotationparser/gi/identifier_section.xml
+++ b/tests/scanner/annotationparser/gi/identifier_section.xml
@@ -329,4 +329,38 @@ returns nothing.</description>
*/</output>
</test>
+
+<test>
+ <!--
+ Section name in different case styles
+ See https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/350
+ -->
+ <input>/**
+ * SECTION:Meep-App
+ * @short_description: module for gtk-doc unit test
+ *
+ * This file contains non-sense code for the sole purpose of testing the docs.
+ */</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>SECTION:meepapp</name>
+ </identifier>
+ <parameters>
+ <parameter>
+ <name>short_description</name>
+ <description>module for gtk-doc unit test</description>
+ </parameter>
+ </parameters>
+ <description>This file contains non-sense code for the sole purpose of testing the docs.</description>
+ </docblock>
+ </parser>
+ <output>/**
+ * SECTION:meepapp
+ * @short_description: module for gtk-doc unit test
+ *
+ * This file contains non-sense code for the sole purpose of testing the docs.
+ */</output>
+</test>
+
</tests>
diff --git a/tests/scanner/annotationparser/test_patterns.py b/tests/scanner/annotationparser/test_patterns.py
index 131d6282..68db9870 100644
--- a/tests/scanner/annotationparser/test_patterns.py
+++ b/tests/scanner/annotationparser/test_patterns.py
@@ -33,7 +33,7 @@ import unittest
from giscanner.annotationparser import (COMMENT_BLOCK_START_RE, COMMENT_BLOCK_END_RE,
COMMENT_ASTERISK_RE, INDENTATION_RE, EMPTY_LINE_RE,
- SECTION_RE, SYMBOL_RE, PROPERTY_RE,
+ SECTION_RE, SYMBOL_RE, PROPERTY_RE, ACTION_RE,
SIGNAL_RE, PARAMETER_RE, TAG_RE,
TAG_VALUE_VERSION_RE, TAG_VALUE_STABILITY_RE)
@@ -663,6 +663,157 @@ identifier_signal_tests = [
'delimiter': ':',
'fields': '(type GLib.List(GLib.List(utf8))) (transfer full)'})]
+identifier_action_tests = [
+ (ACTION_RE, 'GtkWidget|group.action (skip)',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.action',
+ 'delimiter': '',
+ 'fields': '(skip)'}),
+ (ACTION_RE, 'GtkWidget|group.action',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.action',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, ' GtkWidget |group.action',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.action',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, 'GtkWidget| group.action ',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.action',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, ' GtkWidget | group.action ',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.action',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, 'GtkWidget|group.action:',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.action',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, 'GtkWidget|group.action: ',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.action',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, ' GtkWidget|group.action:',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.action',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, 'Something|group.action:',
+ {'class_name': 'Something',
+ 'action_name': 'group.action',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, 'Something|group.action: ',
+ {'class_name': 'Something',
+ 'action_name': 'group.action',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, ' Something|group.action:',
+ {'class_name': 'Something',
+ 'action_name': 'group.action',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, 'Weird-thing|name:',
+ None),
+ (ACTION_RE, 'really-weird_thing|name:',
+ None),
+ (ACTION_RE, 'GWin32InputStream|group.action:',
+ {'class_name': 'GWin32InputStream',
+ 'action_name': 'group.action',
+ 'delimiter': ':',
+ 'fields': ''}),
+ # properties: action name that contains a dash
+ (ACTION_RE, 'GtkWidget|group.double-buffered (skip)',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': '',
+ 'fields': '(skip)'}),
+ (ACTION_RE, 'GtkWidget|group.double-buffered',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, ' GtkWidget |group.double-buffered',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, 'GtkWidget| group.double-buffered ',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, ' GtkWidget | group.double-buffered ',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, 'GtkWidget|group.double-buffered:',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, 'GtkWidget|group.double-buffered: ',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, ' GtkWidget|group.double-buffered:',
+ {'class_name': 'GtkWidget',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, 'Something|group.double-buffered:',
+ {'class_name': 'Something',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, 'Something|group.double-buffered: ',
+ {'class_name': 'Something',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, ' Something|group.double-buffered:',
+ {'class_name': 'Something',
+ 'action_name': 'group.double-buffered',
+ 'delimiter': ':',
+ 'fields': ''}),
+ (ACTION_RE, 'Weird-thing|double-buffered:',
+ None),
+ (ACTION_RE, 'really-weird_thing|double-buffered:',
+ None),
+ (ACTION_RE, ' GMemoryOutputStream|group.realloc-function: (skip)',
+ {'class_name': 'GMemoryOutputStream',
+ 'action_name': 'group.realloc-function',
+ 'delimiter': ':',
+ 'fields': '(skip)'}),
+ (ACTION_RE, 'Something|group-double.double-buffered',
+ {'class_name': 'Something',
+ 'action_name': 'group-double.double-buffered',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, 'Something| group-double.double-buffered',
+ {'class_name': 'Something',
+ 'action_name': 'group-double.double-buffered',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, 'Something |group-double.double-buffered',
+ {'class_name': 'Something',
+ 'action_name': 'group-double.double-buffered',
+ 'delimiter': '',
+ 'fields': ''}),
+ (ACTION_RE, 'Something | group-double.double-buffered',
+ {'class_name': 'Something',
+ 'action_name': 'group-double.double-buffered',
+ 'delimiter': '',
+ 'fields': ''})]
+
parameter_tests = [
(PARAMETER_RE, '@Short_description: Base class for all widgets ',
{'parameter_name': 'Short_description',
@@ -908,6 +1059,7 @@ def create_test_cases():
('TestIdentifierSymbol', identifier_symbol_tests),
('TestIdentifierProperty', identifier_property_tests),
('TestIdentifierSignal', identifier_signal_tests),
+ ('TestIdentifierAction', identifier_action_tests),
('TestParameter', parameter_tests),
('TestTag', tag_tests),
('TestTagValueVersion', tag_value_version_tests),
diff --git a/tests/scanner/foo.c b/tests/scanner/foo.c
index 19bf848b..e409e0a3 100644
--- a/tests/scanner/foo.c
+++ b/tests/scanner/foo.c
@@ -5,6 +5,13 @@
#include "foo.h"
+/**
+ * SECTION:standalone_section
+ *
+ * This documentation section isn't associated with an object
+ * in particular, but it should be serialized in the gir nevertheless.
+ */
+
/* A hidden type not exposed publicly, similar to GUPNP's XML wrapper
object */
typedef struct _RegressFooHidden RegressFooHidden;
diff --git a/tests/scanner/meson.build b/tests/scanner/meson.build
index 50ca5a2b..fa7f7eca 100644
--- a/tests/scanner/meson.build
+++ b/tests/scanner/meson.build
@@ -106,7 +106,7 @@ python_path = run_command(python, ['-c', 'import sys; sys.stdout.write(sys.execu
gircompiler_command = [
gircompiler, '-o', '@OUTPUT@', '@INPUT@',
- '--includedir', join_paths(meson.build_root(), 'gir'),
+ '--includedir', join_paths(build_root, 'gir'),
'--includedir', meson.current_build_dir(),
]
@@ -122,8 +122,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--warn-all',
'--warn-error',
'--namespace=Typedefs',
@@ -162,8 +162,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--warn-all',
'--warn-error',
'--namespace=Bar',
@@ -173,7 +173,7 @@ if glib_dep.type_name() == 'pkgconfig'
'--library=barapp-1.0',
'--accept-unprefixed',
'-L', meson.current_build_dir(),
- '-L', join_paths(meson.build_root(), 'girepository'),
+ '-L', join_paths(build_root, 'girepository'),
'-I', meson.current_source_dir(),
'-I', join_paths(meson.current_source_dir(), '..'),
extra_giscanner_args,
@@ -201,8 +201,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--warn-all',
'--warn-error',
'--namespace=SLetter',
@@ -239,8 +239,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--namespace=WarnLib',
'--nsversion=1.0',
'--include=Gio-2.0',
@@ -275,8 +275,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--warn-all',
'--warn-error',
'--namespace=Utility',
@@ -313,8 +313,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--warn-all',
'--warn-error',
'--namespace=GtkFrob',
@@ -352,8 +352,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--namespace=GetType',
'--nsversion=1.0',
'--identifier-prefix=GetType',
@@ -483,8 +483,8 @@ if glib_dep.type_name() == 'pkgconfig'
'--output=@OUTPUT@',
'--no-libtool',
'--reparse-validate',
- '--add-include-path', join_paths(meson.source_root(), 'gir'),
- '--add-include-path', join_paths(meson.build_root(), 'gir'),
+ '--add-include-path', join_paths(source_root, 'gir'),
+ '--add-include-path', join_paths(build_root, 'gir'),
'--add-include-path', meson.current_build_dir(),
'--namespace=Regress',
'--nsversion=1.0',
@@ -542,7 +542,7 @@ if has_girdoctool and glib_dep.type_name() == 'pkgconfig'
output: 'Regress-1.0-' + language,
command: [
python, girdoctool,
- '--add-include-path=' + join_paths(meson.build_root(), 'gir'),
+ '--add-include-path=' + join_paths(build_root, 'gir'),
'--add-include-path=' + meson.current_build_dir(),
'--language', language,
'@INPUT@', '-o', '@OUTPUT@'],
@@ -570,7 +570,7 @@ if has_girdoctool and glib_dep.type_name() == 'pkgconfig'
output: 'Regress-1.0-sections.txt',
command: [
python, girdoctool,
- '--add-include-path=' + join_paths(meson.build_root(), 'gir'),
+ '--add-include-path=' + join_paths(build_root, 'gir'),
'--add-include-path=' + meson.current_build_dir(),
'--write-sections-file',
'@INPUT@', '-o', '@OUTPUT@'],
diff --git a/tests/warn/meson.build b/tests/warn/meson.build
index 1f144e70..9641787f 100644
--- a/tests/warn/meson.build
+++ b/tests/warn/meson.build
@@ -21,12 +21,12 @@ warn_tests = [
]
warn_test_env = environment()
-warn_test_env.set('UNINSTALLED_INTROSPECTION_SRCDIR', meson.source_root())
-warn_test_env.set('TOP_BUILDDIR', meson.build_root())
+warn_test_env.set('UNINSTALLED_INTROSPECTION_SRCDIR', source_root)
+warn_test_env.set('TOP_BUILDDIR', build_root)
warn_test_env.set(
'PYTHONPATH',
- meson.build_root(),
- join_paths(meson.build_root(), 'giscanner'))
+ build_root,
+ join_paths(build_root, 'giscanner'))
# FIXME: Glib as a subproject (used on Windows mostly).
if glib_dep.type_name() == 'pkgconfig'
diff --git a/tools/g-ir-tool-template.in b/tools/g-ir-tool-template.in
index c4a10a28..75bf759c 100755
--- a/tools/g-ir-tool-template.in
+++ b/tools/g-ir-tool-template.in
@@ -53,14 +53,9 @@ if not os.path.isdir(os.path.join(datadir, 'gir-1.0')):
builtins.__dict__['DATADIR'] = datadir
-# Respect gir_dir_prefix for meson and autotools
+# Respect gir_dir_prefix
girdir = ''
-# for meson
-if '@gir_dir_prefix@' and not '@gir_dir_prefix@'.startswith('@'):
- girdir = os.path.abspath(os.path.join(filedir, '..', '@gir_dir_prefix@'))
-# for autotools
-elif '@GIR_DIR@' and not '@GIR_DIR@'.startswith('@'):
- girdir = os.path.dirname(os.path.abspath('@GIR_DIR@'))
+girdir = os.path.abspath(os.path.join(filedir, '..', '@gir_dir_prefix@'))
builtins.__dict__['GIRDIR'] = [girdir]
# Again, relative paths first so that the installation prefix is relocatable
diff --git a/tools/meson.build b/tools/meson.build
index 103480c4..f272c955 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -22,7 +22,6 @@ foreach tool : tools
tools_conf.set('datarootdir', datadir_abs)
tools_conf.set('gir_dir_prefix', gir_dir_prefix)
tools_conf.set('PYTHON_CMD', python_cmd)
- tools_conf.set('GIR_DIR', girdir)
tools_conf.set('TOOL_MODULE', tool[1])
tools_conf.set('TOOL_FUNCTION', tool[2])
@@ -34,7 +33,9 @@ foreach tool : tools
)
tool_output += tool_bin
# Provide tools for others when we're a subproject and they use the Meson GNOME module
- meson.override_find_program(tool[0], tool_bin)
+ if not get_option('gi_cross_use_prebuilt_gi')
+ meson.override_find_program(tool[0], tool_bin)
+ endif
endforeach
girscanner = tool_output[0]
@@ -58,7 +59,6 @@ gircompiler = executable('g-ir-compiler', 'compiler.c',
install: true,
c_args: custom_c_args,
)
-meson.override_find_program('g-ir-compiler', gircompiler)
girgenerate = executable('g-ir-generate', 'generate.c',
dependencies: [
@@ -68,11 +68,15 @@ girgenerate = executable('g-ir-generate', 'generate.c',
install: true,
c_args: custom_c_args,
)
-meson.override_find_program('g-ir-generate', girgenerate)
girinspect = executable('g-ir-inspect', 'g-ir-inspect.c',
dependencies: girepo_dep,
install: true,
c_args: custom_c_args,
)
-meson.override_find_program('g-ir-inspect', girinspect) \ No newline at end of file
+
+if not get_option('gi_cross_use_prebuilt_gi')
+ meson.override_find_program('g-ir-compiler', gircompiler)
+ meson.override_find_program('g-ir-generate', girgenerate)
+ meson.override_find_program('g-ir-inspect', girinspect)
+endif