summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am11
-rw-r--r--bootstrap.conf2
-rw-r--r--configure.ac39
-rw-r--r--include/Makefile.am8
-rw-r--r--include/disfluid-gobject.h91
-rw-r--r--include/disfluid.h246
-rw-r--r--include/disfluid/cache_entry.h276
-rw-r--r--introspection/Makefile.am15
-rw-r--r--introspection/doc.toml12
-rw-r--r--po/POTFILES.in8
-rw-r--r--src/Makefile.am28
-rw-r--r--src/gobject/Makefile.am43
-rw-r--r--src/gobject/main.c74
-rw-r--r--src/libdisfluid/Makefile.am19
-rw-r--r--src/vala/Makefile.am14
-rw-r--r--tests/Makefile.am8
-rw-r--r--tests/run-unit-tests.c10
17 files changed, 753 insertions, 151 deletions
diff --git a/Makefile.am b/Makefile.am
index c775ef6..a7690ab 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = lib . po tests/libgnu
+SUBDIRS = lib introspection . po tests/libgnu
bin_PROGRAMS =
libexec_PROGRAMS =
@@ -9,11 +9,16 @@ dist_noinst_DATA =
check_PROGRAMS =
DISTCLEANFILES =
CLEANFILES =
-EXTRA_DIST = m4/gnulib-cache.m4 m4prog/gnulib-cache.m4
-ACLOCAL_AMFLAGS = -I m4 -I m4prog
+EXTRA_DIST = m4/gnulib-cache.m4
+ACLOCAL_AMFLAGS = -I m4
TESTS =
BUILT_SOURCES =
+INTROSPECTION_LISTS = %D%/Makefile.am
+INTROSPECTED_LIBS =
+INTROSPECTED_FILES =
+INTROSPECTION_SRC =
+
include %D%/include/Makefile.am
include %D%/src/Makefile.am
include %D%/icons/Makefile.am
diff --git a/bootstrap.conf b/bootstrap.conf
index 7178f85..e212745 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -78,4 +78,4 @@ gnulib_tool_option_extras='--makefile-name=Makefile.gnulib --with-tests --tests-
checkout_only_file=guix.scm
-po_download_command_format="git archive --format=tar translations | tar -x -C %s && echo %s" \ No newline at end of file
+po_download_command_format="git archive --format=tar translations | tar -x -C %s && echo %s"
diff --git a/configure.ac b/configure.ac
index c2b0444..21d89d1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,9 +22,17 @@ AM_PROG_AR
LT_INIT([win32-dll])
gl_INIT
AM_MISSING_PROG([CONVERT], [convert])
+AM_MISSING_PROG([G_IR_SCANNER], [g-ir-scanner])
+AM_MISSING_PROG([VAPIGEN], [vapigen])
GLIB_GSETTINGS
# Checks for libraries.
+AC_ARG_WITH([gobject],
+ [AS_HELP_STRING([--with-gobject],
+ [register types for the glib runtime @<:@default=check@:>@])],
+ [],
+ [: m4_divert_text([DEFAULTS], [with_gobject=check])])
+
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19])
PKG_CHECK_MODULES([LIBCHECK], [check], [
@@ -37,11 +45,25 @@ PKG_CHECK_MODULES([GNUTLS], [gnutls], [
CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
LIBS="$LIBS $GNUTLS_LIBS"
], [AC_MSG_WARN([pkg-config does not know the "gnutls" module])])
+AS_IF([test "x$with_gobject" != xno],
+ [PKG_CHECK_MODULES([GOBJECT], [gobject-2.0], [AC_MSG_WARN([pkg-config does not know the "gobject-2.0" module])])])
# Checks for header files.
AC_CHECK_HEADERS([check.h gnutls/gnutls.h gnutls/crypto.h],,
[AC_MSG_ERROR([Required library headers not found.])])
+SAVE_CPPFLAGS="$CPPFLAGS"
+SAVE_CFLAGS="$CFLAGS"
+CPPFLAGS="$CPPFLAGS $GOBJECT_CFLAGS"
+CFLAGS="$CFLAGS $GOBJECT_CFLAGS"
+AS_IF([test "x$with_gobject" != xno],
+ [AC_CHECK_HEADERS([glib-object.h],,
+ [AS_IF([test "x$with_gobject" = xcheck],
+ [with_gobject=no],
+ [AC_MSG_FAILURE([--with-gobject was given, but glib-object.h is not found.])])])])
+CPPFLAGS="$SAVE_CPPFLAGS"
+CFLAGS="$SAVE_CFLAGS"
+
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_C_RESTRICT
@@ -56,6 +78,15 @@ AC_SEARCH_LIBS([gnutls_hmac_init], [gnutls])
AC_CHECK_FUNCS([srunner_create gnutls_hmac_init],,
[AC_MSG_ERROR([Required library functions not found.])])
+SAVE_LIBS="$LIBS"
+LIBS="$LIBS $GOBJECT_LIBS"
+AS_IF([test "x$with_gobject" != xno],
+ [AC_CHECK_FUNCS([g_boxed_copy],,
+ [AS_IF([test "x$with_gobject" = xcheck],
+ [with_gobject=no],
+ [AC_MSG_FAILURE([--with-gobject was given, but g_boxed_copy is not found.])])])])
+LIBS="$SAVE_LIBS"
+
i_am_windows=no
case "$host_os" in
mingw* | cygwin*)
@@ -63,6 +94,7 @@ case "$host_os" in
esac
AM_CONDITIONAL([SHLIBS_IN_BINDIR], [test "x$i_am_windows" = "xyes"])
+AM_CONDITIONAL([BUILD_GOBJECT], [test "x$with_gobject" != "xno"])
case "$VERSION" in
*-*)
@@ -81,10 +113,13 @@ esac
AM_CONDITIONAL([DISFLUID_IS_NIGHTLY], [test "x$DISFLUID_IS_NIGHTLY" = "xyes"])
+AM_CONDITIONAL([RELOCATABLE_VIA_LD], [test "x$RELOCATABLE_LDFLAGS" != ''])
+
AC_CONFIG_FILES([
Makefile
- lib/Makefile libprog/Makefile
+ lib/Makefile
+ introspection/Makefile
po/Makefile.in
- tests/libgnu/Makefile tests/libprog/Makefile
+ tests/libgnu/Makefile
settings/eu.planete_kraus.Disfluid.gschema.xml])
AC_OUTPUT
diff --git a/include/Makefile.am b/include/Makefile.am
index ef55c6b..b857453 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -4,3 +4,11 @@ pkgincludedir = $(includedir)/disfluid
dist_pkginclude_HEADERS = \
%D%/disfluid/cache_entry.h
+
+if BUILD_GOBJECT
+include_HEADERS += %D%/disfluid-gobject.h
+endif
+
+INTROSPECTION_LISTS += %D%/Makefile.am
+INTROSPECTION_SRC += $(include_HEADERS) $(dist_pkginclude_HEADERS)
+INTROSPECTED_FILES += $(include_HEADERS) $(dist_pkginclude_HEADERS)
diff --git a/include/disfluid-gobject.h b/include/disfluid-gobject.h
new file mode 100644
index 0000000..f9aa28a
--- /dev/null
+++ b/include/disfluid-gobject.h
@@ -0,0 +1,91 @@
+#ifndef H_DISFLUID_GOBJECT_INCLUDED
+# define H_DISFLUID_GOBJECT_INCLUDED
+
+# include <stdlib.h>
+# include <stdio.h>
+# include <time.h>
+
+# include <glib.h>
+# include <glib-object.h>
+
+# if defined _WIN32 && !defined __CYGWIN__
+# define DISFLUID_G_DLL_MADNESS 1
+# else
+# define DISFLUID_G_DLL_MADNESS 0
+# endif
+
+# if BUILDING_LIBDISFLUID_GOBJECT && HAVE_VISIBILITY
+# define DISFLUID_G_DLL_EXPORTED __attribute__((__visibility__("default")))
+# elif BUILDING_LIBDISFLUID_GOBJECT && DISFLUID_G_DLL_MADNESS
+# define DISFLUID_G_DLL_EXPORTED __declspec(dllexport)
+# elif DISFLUID_G_DLL_MADNESS
+# define DISFLUID_G_DLL_EXPORTED __declspec(dllimport)
+# else
+# define DISFLUID_G_DLL_EXPORTED
+# endif
+
+# define DISFLUID_G_API \
+ DISFLUID_G_DLL_EXPORTED
+
+# ifdef __cplusplus
+extern "C"
+{
+# endif /* __cplusplus */
+
+ typedef struct disfluid_cache_entry DisfluidCacheEntry;
+
+# define DISFLUID_TYPE_CACHE_ENTRY (disfluid_cache_entry_get_type ())
+
+ /**
+ * disfluid_cache_entry_get_type:
+ *
+ * Query the type index used to register a cache entry.
+ * Returns: the type.
+ */
+ DISFLUID_G_API extern GType disfluid_cache_entry_get_type (void);
+
+ /**
+ * disfluid_cache_entry_set_request_gdate:
+ * @entry: (type DisfluidCacheEntry): the entry to modify.
+ * @request_date: the request date.
+ */
+ DISFLUID_G_API extern void
+ disfluid_cache_entry_set_request_gdate (struct disfluid_cache_entry
+ *entry, GDateTime * request_date);
+
+ /**
+ * disfluid_cache_entry_set_response_gdate:
+ * @entry: (type DisfluidCacheEntry): the entry to modify.
+ * @response_date: the response date.
+ */
+ DISFLUID_G_API extern void
+ disfluid_cache_entry_set_response_gdate (struct disfluid_cache_entry
+ *entry,
+ GDateTime * response_date);
+
+ /**
+ * disfluid_cache_entry_get_request_gdate:
+ * @entry: (type DisfluidCacheEntry): the entry to query.
+ * @date: (out) (transfer full): the request date.
+ */
+ DISFLUID_API extern void
+ disfluid_cache_entry_get_request_gdate (const struct disfluid_cache_entry
+ *entry, GDateTime ** date);
+
+ /**
+ * disfluid_cache_entry_get_response_gdate:
+ * @entry: (type DisfluidCacheEntry): the entry to query.
+ * @date: (out) (transfer full): the response date.
+ */
+ DISFLUID_API extern void
+ disfluid_cache_entry_get_response_gdate (const struct disfluid_cache_entry
+ *entry, GDateTime ** date);
+
+
+# ifdef __cplusplus
+}
+# endif /* __cplusplus */
+
+# include <disfluid/cache_entry.h>
+
+#endif /* not H_DISFLUID_GOBJECT_INCLUDED */
diff --git a/include/disfluid.h b/include/disfluid.h
index 52c6d95..b7e0211 100644
--- a/include/disfluid.h
+++ b/include/disfluid.h
@@ -6,151 +6,253 @@
# include <time.h>
# if defined _WIN32 && !defined __CYGWIN__
-# define LIBDISFLUID_DLL_MADNESS 1
+# define DISFLUID_DLL_MADNESS 1
# else
-# define LIBDISFLUID_DLL_MADNESS 0
+# define DISFLUID_DLL_MADNESS 0
# endif
# if BUILDING_LIBDISFLUID && HAVE_VISIBILITY
-# define LIBDISFLUID_DLL_EXPORTED __attribute__((__visibility__("default")))
-# elif BUILDING_LIBDISFLUID && LIBDISFLUID_DLL_MADNESS
-# define LIBDISFLUID_DLL_EXPORTED __declspec(dllexport)
-# elif LIBDISFLUID_DLL_MADNESS
-# define LIBDISFLUID_DLL_EXPORTED __declspec(dllimport)
+# define DISFLUID_DLL_EXPORTED __attribute__((__visibility__("default")))
+# elif BUILDING_LIBDISFLUID && DISFLUID_DLL_MADNESS
+# define DISFLUID_DLL_EXPORTED __declspec(dllexport)
+# elif DISFLUID_DLL_MADNESS
+# define DISFLUID_DLL_EXPORTED __declspec(dllimport)
# else
-# define LIBDISFLUID_DLL_EXPORTED
+# define DISFLUID_DLL_EXPORTED
# endif
-# define LIBDISFLUID_API \
- LIBDISFLUID_DLL_EXPORTED
+# define DISFLUID_API \
+ DISFLUID_DLL_EXPORTED
# ifdef ATTRIBUTE_DEALLOC
-# define LIBDISFLUID_DEALLOC_WITH ATTRIBUTE_DEALLOC
+# define DISFLUID_DEALLOC_WITH ATTRIBUTE_DEALLOC
# else
-# define LIBDISFLUID_DEALLOC_WITH(f, i)
+# define DISFLUID_DEALLOC_WITH(f, i)
# endif
# ifdef ATTRIBUTE_DEALLOC_FREE
-# define LIBDISFLUID_DEALLOC_WITH_FREE ATTRIBUTE_DEALLOC_FREE
+# define DISFLUID_DEALLOC_WITH_FREE ATTRIBUTE_DEALLOC_FREE
# else
-# define LIBDISFLUID_DEALLOC_WITH_FREE
+# define DISFLUID_DEALLOC_WITH_FREE
# endif
# ifdef ATTRIBUTE_CONST
-# define LIBDISFLUID_CONST ATTRIBUTE_CONST
+# define DISFLUID_CONST ATTRIBUTE_CONST
# else
-# define LIBDISFLUID_CONST
+# define DISFLUID_CONST
# endif
# ifdef ATTRIBUTE_PURE
-# define LIBDISFLUID_PURE ATTRIBUTE_PURE
+# define DISFLUID_PURE ATTRIBUTE_PURE
# else
-# define LIBDISFLUID_PURE
+# define DISFLUID_PURE
# endif
# ifdef NODISCARD
-# define LIBDISFLUID_NODISCARD NODISCARD
+# define DISFLUID_NODISCARD NODISCARD
# else
-# define LIBDISFLUID_NODISCARD
+# define DISFLUID_NODISCARD
# endif
# ifdef ATTRIBUTE_FD_ARG
-# define LIBDISFLUID_FD_ARG ATTRIBUTE_FD_ARG
+# define DISFLUID_FD_ARG ATTRIBUTE_FD_ARG
# else
-# define LIBDISFLUID_FD_ARG()
+# define DISFLUID_FD_ARG()
# endif
-# define LIBDISFLUID_FD_ARG_1 \
- LIBDISFLUID_FD_ARG (1)
+# define DISFLUID_FD_ARG_1 \
+ DISFLUID_FD_ARG (1)
# ifdef ATTRIBUTE_FD_ARG_READ
-# define LIBDISFLUID_FD_ARG_READ ATTRIBUTE_FD_ARG_READ
+# define DISFLUID_FD_ARG_READ ATTRIBUTE_FD_ARG_READ
# else
-# define LIBDISFLUID_FD_ARG_READ(i)
+# define DISFLUID_FD_ARG_READ(i)
# endif
-# define LIBDISFLUID_FD_ARG_READ_1 \
- LIBDISFLUID_FD_ARG_READ (1)
+# define DISFLUID_FD_ARG_READ_1 \
+ DISFLUID_FD_ARG_READ (1)
-# define LIBDISFLUID_FD_ARG_READ_2 \
- LIBDISFLUID_FD_ARG_READ (2)
+# define DISFLUID_FD_ARG_READ_2 \
+ DISFLUID_FD_ARG_READ (2)
# ifdef ATTRIBUTE_FD_ARG_WRITE
-# define LIBDISFLUID_FD_ARG_WRITE ATTRIBUTE_FD_ARG_WRITE
+# define DISFLUID_FD_ARG_WRITE ATTRIBUTE_FD_ARG_WRITE
# else
-# define LIBDISFLUID_FD_ARG_WRITE(i)
+# define DISFLUID_FD_ARG_WRITE(i)
# endif
-# define LIBDISFLUID_FD_ARG_WRITE_1 \
- LIBDISFLUID_FD_ARG_WRITE (1)
+# define DISFLUID_FD_ARG_WRITE_1 \
+ DISFLUID_FD_ARG_WRITE (1)
-# define LIBDISFLUID_FD_ARG_WRITE_2 \
- LIBDISFLUID_FD_ARG_WRITE (2)
+# define DISFLUID_FD_ARG_WRITE_2 \
+ DISFLUID_FD_ARG_WRITE (2)
-# define LIBDISFLUID_DEALLOC_AS_CACHE_ENTRY \
- LIBDISFLUID_DEALLOC_WITH (disfluid_cache_entry_free, 1)
+# define DISFLUID_DEALLOC_AS_CACHE_ENTRY \
+ DISFLUID_DEALLOC_WITH (disfluid_cache_entry_free, 1)
-# define LIBDISFLUID_DEALLOC_AS_CACHE \
- LIBDISFLUID_DEALLOC_WITH (disfluid_cache_free, 1)
+# define DISFLUID_DEALLOC_AS_CACHE \
+ DISFLUID_DEALLOC_WITH (disfluid_cache_free, 1)
# ifdef __cplusplus
extern "C"
{
# endif /* __cplusplus */
- LIBDISFLUID_CONST LIBDISFLUID_API extern const char
- *disfluid_version (void);
-
- LIBDISFLUID_CONST LIBDISFLUID_API extern int disfluid_is_nightly (void);
-
- LIBDISFLUID_CONST LIBDISFLUID_API extern const char
- *disfluid_whats_new (void);
-
- LIBDISFLUID_CONST LIBDISFLUID_API extern const char
+ /**
+ * disfluid_version:
+ *
+ * Returns: the version number.
+ */
+ DISFLUID_CONST DISFLUID_API extern const char *disfluid_version (void);
+
+ /**
+ * disfluid_is_nightly:
+ *
+ * Returns: (type boolean): whether disfluid is an unreleased snapshot.
+ */
+ DISFLUID_CONST DISFLUID_API extern int disfluid_is_nightly (void);
+
+ /**
+ * disfluid_whats_new:
+ *
+ * Returns: return the news.
+ */
+ DISFLUID_CONST DISFLUID_API extern const char *disfluid_whats_new (void);
+
+ /**
+ * disfluid_major_version:
+ *
+ * Returns: return the major version above which everything is
+ * considered new.
+ */
+ DISFLUID_CONST DISFLUID_API extern const char
*disfluid_major_version (void);
- LIBDISFLUID_CONST LIBDISFLUID_API extern const char
- *disfluid_website (void);
-
- /* Run the disfluid unit tests. The return value must be deallocated
- with free. */
- LIBDISFLUID_API LIBDISFLUID_DEALLOC_WITH_FREE char
+ /**
+ * disfluid_website:
+ *
+ * Returns: the website for disfluid.
+ */
+ DISFLUID_CONST DISFLUID_API extern const char *disfluid_website (void);
+
+ /**
+ * disfluid_run_tests:
+ * @n_tests: (out): the number of tests that have been run.
+ * @n_errors: (out): the number of tests that failed.
+ *
+ * Run the unit tests.
+ *
+ * Returns: (transfer full): the tests output.
+ */
+ DISFLUID_API DISFLUID_DEALLOC_WITH_FREE char
*disfluid_run_tests (size_t *n_tests, size_t *n_errors);
- LIBDISFLUID_CONST LIBDISFLUID_API extern size_t
- disfluid_count_authors (void);
-
- LIBDISFLUID_CONST LIBDISFLUID_API extern const char
+ /**
+ * disfluid_count_authors:
+ *
+ * Returns: the number of authors.
+ */
+ DISFLUID_CONST DISFLUID_API extern size_t disfluid_count_authors (void);
+
+ /**
+ * disfluid_author_name:
+ * @i: the author index.
+ *
+ * Returns: the name of author @i.
+ */
+ DISFLUID_CONST DISFLUID_API extern const char
*disfluid_author_name (size_t i);
- LIBDISFLUID_CONST LIBDISFLUID_API extern const char
+ /**
+ * disfluid_author_email:
+ * @i: the author index.
+ *
+ * Returns: (nullable): the optional email address of author @i.
+ */
+ DISFLUID_CONST DISFLUID_API extern const char
*disfluid_author_email (size_t i);
- LIBDISFLUID_CONST LIBDISFLUID_API extern const char
+ /**
+ * disfluid_author_uri:
+ * @i: the author index.
+ *
+ * Returns: (nullable): the optional web address of author @i.
+ */
+ DISFLUID_CONST DISFLUID_API extern const char
*disfluid_author_uri (size_t i);
- LIBDISFLUID_CONST LIBDISFLUID_API extern int
+ /**
+ * disfluid_author_is_developer:
+ * @i: the author index.
+ *
+ * Returns: (type boolean): whether @i is a developer.
+ */
+ DISFLUID_CONST DISFLUID_API extern int
disfluid_author_is_developer (size_t i);
- LIBDISFLUID_CONST LIBDISFLUID_API extern int
+ /**
+ * disfluid_author_is_designer:
+ * @i: the author index.
+ *
+ * Returns: (type boolean): whether @i is a designer.
+ */
+ DISFLUID_CONST DISFLUID_API extern int
disfluid_author_is_designer (size_t i);
- LIBDISFLUID_CONST LIBDISFLUID_API extern int
- disfluid_author_is_artist (size_t i);
-
- LIBDISFLUID_CONST LIBDISFLUID_API extern int
+ /**
+ * disfluid_author_is_artist:
+ * @i: the author index.
+ *
+ * Returns: (type boolean): whether @i is a artist.
+ */
+ DISFLUID_CONST DISFLUID_API extern int disfluid_author_is_artist (size_t i);
+
+ /**
+ * disfluid_author_is_documenter:
+ * @i: the author index.
+ *
+ * Returns: (type boolean): whether @i is a documenter.
+ */
+ DISFLUID_CONST DISFLUID_API extern int
disfluid_author_is_documenter (size_t i);
- LIBDISFLUID_CONST LIBDISFLUID_API const char
- *disfluid_translation_credits (void);
-
- LIBDISFLUID_API extern int
+ /**
+ * disfluid_translation_credits:
+ *
+ * Returns: the credits for translations of your language.
+ */
+ DISFLUID_CONST DISFLUID_API const char *disfluid_translation_credits (void);
+
+ /**
+ * disfluid_compute_cache_key:
+ * @request_scheme: the URI scheme for the request, such as 'https'.
+ * @request_header: the request header.
+ * @response_header: the header of the response that resulted from
+ * the request.
+ * @key: (array length=max_key) (element-type char): the destination
+ * cache key.
+ *
+ * Returns: 0 on success, or a negative error number.
+ */
+ DISFLUID_API extern int
disfluid_compute_cache_key (const char *request_scheme,
const char *request_header,
const char *response_header,
size_t max_key, char *key);
- LIBDISFLUID_API extern int
+ /**
+ * disfluid_hash_primary_cache_key:
+ * @method: the request method, such as 'GET'.
+ * @uri: the request URI.
+ * @password: (nullable) (array length=password_length)
+ * (element-type char): an optional password. If set, the hash
+ * cannot be figured out without it.
+ * @hash: (array length=max_hash) (element-type char): the
+ * destination hash.
+ *
+ * Returns: 0 on success, or a negative error number.
+ */
+ DISFLUID_API extern int
disfluid_hash_primary_cache_key (const char *method,
const char *uri,
const char *password,
diff --git a/include/disfluid/cache_entry.h b/include/disfluid/cache_entry.h
index 6004932..dddb92d 100644
--- a/include/disfluid/cache_entry.h
+++ b/include/disfluid/cache_entry.h
@@ -8,136 +8,344 @@ extern "C"
{
# endif /* __cplusplus */
+ /**
+ * disfluid_cache_entry: (rename-to DisfluidCacheEntry):
+ *
+ * One response header, body, sprinkled with metadata.
+ */
struct disfluid_cache_entry;
- LIBDISFLUID_API LIBDISFLUID_CONST extern size_t
+ /**
+ * disfluid_cache_entry_size:
+ * @max_key: the maximum number of bytes in the key.
+ * @max_header: the maximum number of bytes in the response header.
+ * @max_body: the maximum number of bytes in the response body.
+ *
+ * Compute the required memory size to hold an entire cache entry.
+ *
+ * Returns: the minimum number of bytes to allocate.
+ */
+ DISFLUID_API DISFLUID_CONST extern size_t
disfluid_cache_entry_size (size_t max_key,
size_t max_header, size_t max_body);
- LIBDISFLUID_API LIBDISFLUID_CONST extern size_t
+ /**
+ * disfluid_cache_entry_alignment:
+ *
+ * Compute the minimum alignment to hold a cache entry.
+ *
+ * Returns: the minimum alignment.
+ */
+ DISFLUID_API DISFLUID_CONST extern size_t
disfluid_cache_entry_alignment (void);
- LIBDISFLUID_API extern void
+ /**
+ * disfluid_cache_entry_init:
+ * @entry: (type DisfluidCacheEntry): an allocated memory region,
+ * with a large enough size and alignment.
+ * @max_key: the maximum number of bytes in the key.
+ * @max_header: the maximum number of bytes in the response header.
+ * @max_body: the maximum number of bytes in the response body.
+ *
+ * Prepare the cache entry.
+ */
+ DISFLUID_API extern void
disfluid_cache_entry_init (struct disfluid_cache_entry *entry,
size_t max_key,
size_t max_header, size_t max_body);
- LIBDISFLUID_API extern void
+ /**
+ * disfluid_cache_entry_minimum_size:
+ * @entry: (type DisfluidCacheEntry): a valid cache entry.
+ * @min_key: (out): the number of bytes in the key.
+ * @min_header: (out): the number of bytes in the response header.
+ * @min_body: (out): the number of bytes in the response body.
+ *
+ * Return the number of bytes used for the key, header and body.
+ */
+ DISFLUID_API extern void
disfluid_cache_entry_minimum_size (const struct disfluid_cache_entry
*entry, size_t *min_key,
size_t *min_header, size_t *min_body);
- /* -1: dest does not have enough allocated for the key, -2: for the
- header, -3: for the key and the header, -4: for the body, -5:
- for the key and the body, -6: for the header and the body, -7:
- for the key, header and body. */
- LIBDISFLUID_API extern int
+ /**
+ * disfluid_cache_entry_copy:
+ * @dest: (type DisfluidCacheEntry): an allocated cache entry.
+ * @src: (type DisfluidCacheEntry): a different allocated cache entry.
+ *
+ * Try and copy @dest to @src. It can fail if @dest is too small.
+ *
+ * Returns: 0 on success, -1 if @dest does not have enough allocated
+ * for the key, -2 for the header, -3 for the key and the header, -4
+ * for the body, -5 for the key and the body, -6 for the header and
+ * the body, -7 for the key, header and body.
+ */
+ DISFLUID_API extern int
disfluid_cache_entry_copy (struct disfluid_cache_entry *restrict dest,
const struct disfluid_cache_entry *restrict
src);
- LIBDISFLUID_NODISCARD LIBDISFLUID_API
+ /**
+ * disfluid_cache_entry_alloc: (constructor):
+ * @max_key: the maximum number of bytes in the key.
+ * @max_header: the maximum number of bytes in the response header.
+ * @max_body: the maximum number of bytes in the response body.
+ *
+ * Allocate a new cache entry.
+ *
+ * Returns: (nullable) (type DisfluidCacheEntry): a new cache entry.
+ */
+ DISFLUID_NODISCARD DISFLUID_API
extern struct disfluid_cache_entry
*disfluid_cache_entry_alloc (size_t max_key,
size_t max_header, size_t max_body);
- LIBDISFLUID_NODISCARD LIBDISFLUID_API
+ /**
+ * disfluid_cache_entry_dup: (constructor):
+ * @entry: (type DisfluidCacheEntry): the entry to copy.
+ *
+ * Allocate a new cache entry as a copy of @entry, keeping the same
+ * allocation limits.
+ *
+ * Returns: (nullable) (type DisfluidCacheEntry): a new cache entry.
+ */
+ DISFLUID_NODISCARD DISFLUID_API
extern struct disfluid_cache_entry
*disfluid_cache_entry_dup (const struct disfluid_cache_entry *entry);
- LIBDISFLUID_API extern void
+ /**
+ * disfluid_cache_entry_free: (skip):
+ * @entry: (type DisfluidCacheEntry): the entry to destroy.
+ *
+ * Destroy @entry.
+ */
+ DISFLUID_API extern void
disfluid_cache_entry_free (struct disfluid_cache_entry *entry);
- LIBDISFLUID_API extern void
+ /**
+ * disfluid_cache_entry_set_request_date: (skip):
+ * @entry: (type DisfluidCacheEntry): the entry to modify.
+ * @request_date: the request date.
+ */
+ DISFLUID_API extern void
disfluid_cache_entry_set_request_date (struct disfluid_cache_entry *entry,
const struct timespec
*request_date);
- LIBDISFLUID_API extern void
+ /**
+ * disfluid_cache_entry_set_response_date: (skip):
+ * @entry: (type DisfluidCacheEntry): the entry to modify.
+ * @response_date: the response date.
+ */
+ DISFLUID_API extern void
disfluid_cache_entry_set_response_date (struct disfluid_cache_entry
*entry,
const struct timespec
*response_date);
- LIBDISFLUID_API extern void
+ /**
+ * disfluid_cache_entry_set_invalidated:
+ * @entry: (type DisfluidCacheEntry): the entry to modify.
+ * @invalidated: (type boolean): whether it has been artificially invalidated.
+ */
+ DISFLUID_API extern void
disfluid_cache_entry_set_invalidated (struct disfluid_cache_entry *entry,
int invalidated);
- LIBDISFLUID_API extern void
+ /**
+ * disfluid_cache_entry_invalidate:
+ * @entry: (type DisfluidCacheEntry): the entry to modify.
+ */
+ DISFLUID_API extern void
disfluid_cache_entry_invalidate (struct disfluid_cache_entry *entry);
- LIBDISFLUID_API extern int
+ /**
+ * disfluid_cache_entry_set_key:
+ * @entry: (type DisfluidCacheEntry): the entry to modify.
+ * @key: the new key bytes.
+ *
+ * Returns: 0 if the @key fits, a negative value otherwise.
+ */
+ DISFLUID_API extern int
disfluid_cache_entry_set_key (struct disfluid_cache_entry *entry,
const char *key);
- LIBDISFLUID_API extern int
+ /**
+ * disfluid_cache_entry_set_response_header:
+ * @entry: (type DisfluidCacheEntry): the entry to modify.
+ * @header: the new response header bytes.
+ *
+ * Returns: 0 if the @header fits, a negative value otherwise.
+ */
+ DISFLUID_API extern int
disfluid_cache_entry_set_response_header (struct disfluid_cache_entry
*entry, const char *header);
- LIBDISFLUID_API extern int
+ /**
+ * disfluid_cache_entry_set_response_body:
+ * @entry: (type DisfluidCacheEntry): the entry to modify.
+ * @body: (array length=body_length) (element-type char): the new
+ * response body bytes.
+ *
+ * Returns: 0 if the @body fits, a negative value otherwise.
+ */
+ DISFLUID_API extern int
disfluid_cache_entry_set_response_body (struct disfluid_cache_entry
*entry,
size_t body_length,
const char *body);
- LIBDISFLUID_API extern void
+ /**
+ * disfluid_cache_entry_get_request_date: (skip):
+ * @entry: (type DisfluidCacheEntry): the entry to query.
+ * @date: the request date.
+ */
+ DISFLUID_API extern void
disfluid_cache_entry_get_request_date (const struct disfluid_cache_entry
*entry, struct timespec *date);
- LIBDISFLUID_API extern void
+ /**
+ * disfluid_cache_entry_get_response_date: (skip):
+ * @entry: (type DisfluidCacheEntry): the entry to query.
+ * @date: the response date.
+ */
+ DISFLUID_API extern void
disfluid_cache_entry_get_response_date (const struct disfluid_cache_entry
*entry, struct timespec *date);
- LIBDISFLUID_API LIBDISFLUID_PURE extern int
+ /**
+ * disfluid_cache_entry_is_invalidated:
+ * @entry: (type DisfluidCacheEntry): the entry to query.
+ *
+ * Returns: (type boolean): whether @entry has been artificially invalidated.
+ */
+ DISFLUID_API DISFLUID_PURE extern int
disfluid_cache_entry_is_invalidated (const struct disfluid_cache_entry
*entry);
- LIBDISFLUID_API extern size_t
+ /**
+ * disfluid_cache_entry_get_key:
+ * @entry: (type DisfluidCacheEntry): the entry to query.
+ * @start: the number of bytes of the key to skip.
+ * @key: (array length=max) (element-type char): the key bytes to fill.
+ *
+ * Returns: the total number of key bytes.
+ */
+ DISFLUID_API extern size_t
disfluid_cache_entry_get_key (const struct disfluid_cache_entry *entry,
size_t start, size_t max, char *key);
- LIBDISFLUID_API extern size_t
+ /**
+ * disfluid_cache_entry_get_header:
+ * @entry: (type DisfluidCacheEntry): the entry to query.
+ * @start: the number of bytes of the header to skip.
+ * @header: (array length=max) (element-type char): the header bytes to fill.
+ *
+ * Returns: the total number of response header bytes.
+ */
+ DISFLUID_API extern size_t
disfluid_cache_entry_get_header (const struct disfluid_cache_entry *entry,
size_t start, size_t max, char *header);
- LIBDISFLUID_API extern size_t
+ /**
+ * disfluid_cache_entry_get_body:
+ * @entry: (type DisfluidCacheEntry): the entry to query.
+ * @start: the number of bytes of the body to skip.
+ * @body: (array length=max) (element-type char): the body bytes to fill.
+ *
+ * Returns: the total number of response body bytes.
+ */
+ DISFLUID_API extern size_t
disfluid_cache_entry_get_body (const struct disfluid_cache_entry *entry,
size_t start, size_t max, char *body);
- LIBDISFLUID_NODISCARD LIBDISFLUID_API extern int
+ /**
+ * disfluid_cache_entry_load: (skip):
+ * @entry: (type DisfluidCacheEntry): the entry to initialize.
+ * @load_key: (type boolean): whether to actually load the key.
+ * @load_header: (type boolean): whether to actually load the response header.
+ * @load_body: (type boolean): whether to actually load the response body.
+ * @read_impl: how to read data.
+ * @skip: how to skip data.
+ *
+ * Returns: 0 on success, or a negative error code.
+ */
+ DISFLUID_NODISCARD DISFLUID_API extern int
disfluid_cache_entry_load (struct disfluid_cache_entry *entry,
int load_key,
int load_header,
int load_body,
- ssize_t (*read_impl) (void *context,
+ ssize_t (*read_impl) (void *user_data,
void *buffer,
size_t max_size),
int (*skip) (void *context, size_t size),
void *context);
- LIBDISFLUID_NODISCARD LIBDISFLUID_FD_ARG_READ_2 LIBDISFLUID_API
+ /**
+ * disfluid_cache_entry_read:
+ * @entry: (type DisfluidCacheEntry): the entry to initialize.
+ * @load_key: (type boolean): whether to actually load the key.
+ * @load_header: (type boolean): whether to actually load the response header.
+ * @load_body: (type boolean): whether to actually load the response body.
+ * @fd: the file descriptor to use.
+ *
+ * Returns: 0 on success, or a negative error code.
+ */
+ DISFLUID_NODISCARD DISFLUID_FD_ARG_READ_2 DISFLUID_API
extern int disfluid_cache_entry_read (struct disfluid_cache_entry *entry,
int load_key,
int load_header,
int load_body, int fd);
- LIBDISFLUID_NODISCARD LIBDISFLUID_API extern int
+ /**
+ * disfluid_cache_entry_fread: (skip):
+ * @entry: (type DisfluidCacheEntry): the entry to initialize.
+ * @load_key: (type boolean): whether to actually load the key.
+ * @load_header: (type boolean): whether to actually load the response header.
+ * @load_body: (type boolean): whether to actually load the response body.
+ * @f: the file handle to use.
+ *
+ * Returns: 0 on success, or a negative error code.
+ */
+ DISFLUID_NODISCARD DISFLUID_API extern int
disfluid_cache_entry_fread (struct disfluid_cache_entry *entry,
int load_key,
int load_header, int load_body, FILE * f);
- LIBDISFLUID_NODISCARD LIBDISFLUID_API extern int
+ /**
+ * disfluid_cache_entry_save:
+ * @entry: (type DisfluidCacheEntry): the entry to save.
+ * @write_impl: how to write data.
+ * @user_context: (closure write_impl): the closure data for the callback.
+ *
+ * Returns: 0 on success, or a negative error code.
+ */
+ DISFLUID_NODISCARD DISFLUID_API extern int
disfluid_cache_entry_save (const struct disfluid_cache_entry *entry,
ssize_t (*write_impl) (void *context,
const void *buffer,
size_t max_size),
- void *context);
-
- LIBDISFLUID_NODISCARD LIBDISFLUID_FD_ARG_WRITE_2 LIBDISFLUID_API
+ void *user_context);
+
+ /**
+ * disfluid_cache_entry_write:
+ * @entry: (type DisfluidCacheEntry): the entry to save.
+ * @fd: the file descriptor to use.
+ *
+ * Returns: 0 on success, or a negative error code.
+ */
+ DISFLUID_NODISCARD DISFLUID_FD_ARG_WRITE_2 DISFLUID_API
extern int disfluid_cache_entry_write (const struct disfluid_cache_entry
*entry, int fd);
- LIBDISFLUID_NODISCARD LIBDISFLUID_API extern int
+ /**
+ * disfluid_cache_entry_fwrite:
+ * @entry: (type DisfluidCacheEntry): the entry to save.
+ * @f: the file handle to use.
+ *
+ * Returns: 0 on success, or a negative error code.
+ */
+ DISFLUID_NODISCARD DISFLUID_API extern int
disfluid_cache_entry_fwrite (const struct disfluid_cache_entry *entry,
FILE * f);
diff --git a/introspection/Makefile.am b/introspection/Makefile.am
new file mode 100644
index 0000000..7f24bbb
--- /dev/null
+++ b/introspection/Makefile.am
@@ -0,0 +1,15 @@
+girdir = $(datarootdir)/gir-1.0
+
+dist_gir_DATA = %D%/Disfluid-$(DLL_VERSION).gir
+
+$(abs_top_srcdir)/src/introspection-files:
+ $(MAKE) $(AM_MAKEFLAGS) -C .. src/introspection-files
+
+$(abs_top_srcdir)/src/introspection-libraries:
+ $(MAKE) $(AM_MAKEFLAGS) -C .. src/introspection-libraries
+
+%D%/Disfluid-$(DLL_VERSION).gir: $(abs_top_srcdir)/src/introspection-files $(abs_top_srcdir)/src/introspection-libraries
+ $(MAKE) $(AM_MAKEFLAGS) -C .. $$(cat $(abs_top_srcdir)/src/introspection-libraries)
+ $(AM_V_GEN) (cd .. && $(G_IR_SCANNER) --warn-all --warn-error --strict --format=gir -i GLib-2.0 -I$(abs_top_srcdir)/include --c-include=disfluid --c-include=disfluid/cache_entry.h -n Disfluid --nsversion=$(DLL_VERSION) --symbol-prefix=disfluid_ --output=%D%/Disfluid-$(DLL_VERSION).gir-t $$(for lib in $$(cat $(abs_top_srcdir)/src/introspection-libraries) ; do echo "--library=$$lib" ; done) --cflags-begin $(GOBJECT_CFLAGS) --cflags-end $$(cat $(abs_top_srcdir)/src/introspection-files)) && mv ../%D%/Disfluid-$(DLL_VERSION).gir-t $(srcdir)/%D%/Disfluid-$(DLL_VERSION).gir
+
+EXTRA_DIST = %D%/doc.toml
diff --git a/introspection/doc.toml b/introspection/doc.toml
new file mode 100644
index 0000000..411cf09
--- /dev/null
+++ b/introspection/doc.toml
@@ -0,0 +1,12 @@
+[library]
+description = "Demanding Interoperability to Strengthen the Free/Libre Web: Introducing Disfluid"
+license = "AGPL3+"
+browse_url = "labo.planete-kraus.eu/disfluid.git"
+repository_url = "labo.planete-kraus.eu/disfluid.git"
+website = "disfluid.planete-kraus.eu"
+dependencies = [ "GObject-2.0" ]
+
+[dependencies."GObject-2.0"]
+name = "GObject"
+description = "The base type system library"
+docs_url = "https://docs.gtk.org/gobject/" \ No newline at end of file
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d48c195..bad10a8 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,13 +1,5 @@
desktop/eu.planete_kraus.Disfluid.Devel.desktop.in
desktop/eu.planete_kraus.Disfluid.desktop.in
-src/adwaita/disfluid-about.c
-src/adwaita/disfluid-application.c
-src/adwaita/disfluid-cache-entry.c
-src/adwaita/disfluid-cache-key-demo.c
-src/adwaita/disfluid-hash-key-demo.c
-src/adwaita/disfluid-menus.c
-src/adwaita/disfluid-tests-results.c
-src/disfluid/run-unit-tests.c
src/libdisfluid/disfluid-authors.h
src/libdisfluid/disfluid-tests.h
src/libdisfluid/disfluid-version.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 506c7a8..5bd97d6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1 +1,29 @@
+defexecdir = $(libdir)
+defexec_DATA =
+
+RELOCATABLE_LIBRARY_PATH = $(libdir)
+
include %D%/libdisfluid/Makefile.am
+include %D%/gobject/Makefile.am
+include %D%/vala/Makefile.am
+
+DISTCLEANFILES += $(defexec_DATA)
+
+EXTRA_DIST += %D%/introspection-files %D%/introspection-libraries
+
+if BUILD_GOBJECT
+
+%D%/introspection-files: $(INTROSPECTION_LISTS) $(INTROSPECTION_SRC)
+ $(AM_V_GEN) (for src in $(INTROSPECTED_FILES) ; do echo "$$src" ; done) > %D%/introspection-files-t && mv %D%/introspection-files-t $(srcdir)/%D%/introspection-files
+
+%D%/introspection-libraries: $(INTROSPECTION_LISTS) $(INTROSPECTION_SRC)
+ $(AM_V_GEN) (for lib in $(INTROSPECTED_LIBS) ; do echo "$$lib" ; done) > %D%/introspection-libraries-t && mv %D%/introspection-libraries-t %D%/introspection-libraries
+
+else # not BUILD_GOBJECT
+
+%D%/introspection-files: $(INTROSPECTION_LISTS) $(INTROSPECTION_SRC)
+ @(>&2 echo "The introspected files have changed, but gobject compilation is disabled." ; exit 1)
+%D%/introspection-libraries: $(INTROSPECTION_LISTS) $(INTROSPECTION_SRC)
+ @(>&2 echo "The introspected files have changed, but gobject compilation is disabled." ; exit 1)
+
+endif # not BUILD_GOBJECT
diff --git a/src/gobject/Makefile.am b/src/gobject/Makefile.am
new file mode 100644
index 0000000..5a879b8
--- /dev/null
+++ b/src/gobject/Makefile.am
@@ -0,0 +1,43 @@
+if BUILD_GOBJECT
+lib_LTLIBRARIES += %D%/libdisfluid-gobject.la
+
+%C%_libdisfluid_gobject_la_SOURCES = \
+ %D%/main.c
+
+%C%_libdisfluid_gobject_la_CPPFLAGS = \
+ -I lib -I $(srcdir)/lib \
+ -DBUILDING_LIBDISFLUID_GOBJECT \
+ -I include -I $(srcdir)/include \
+ -I %D% -I $(srcdir)/%D% \
+ $(GOBJECT_CFLAGS)
+
+%C%_libdisfluid_gobject_la_CFLAGS = $(CFLAG_VISIBILITY) $(GOBJECT_CFLAGS)
+%C%_libdisfluid_gobject_la_LIBADD = \
+ lib/libgnu.la \
+ src/libdisfluid/libdisfluid.la
+%C%_libdisfluid_gobject_la_LDFLAGS = \
+ -no-undefined \
+ -avoid-version \
+ $(CLOCK_TIME_LIB) \
+ $(GETRANDOM_LIB) \
+ $(LIBTHREAD) \
+ $(LTLIBINTL) \
+ $(SETLOCALE_LIB) \
+ $(SETLOCALE_NULL_LIB) \
+ @INTL_MACOSX_LIBS@ \
+ $(GOBJECT_LIBS)
+
+if HAVE_LD_OUTPUT_DEF
+%C%_libdisfluid_gobject_la_LDFLAGS += \
+ -Wl,--output-def,libdisfluid-gobject.def
+
+%D%/libdisfluid-gobject.def: %D%/libdisfluid-gobject.la
+
+defexec_DATA += \
+ %D%/libdisfluid-$(DLL_VERSION).def
+endif # BUILD_GOBJECT, HAVE_LD_OUTPUT_DEF
+endif # BUILD_GOBJECT
+
+INTROSPECTION_LISTS += %D%/Makefile.am
+INTROSPECTED_LIBS += %D%/libdisfluid-gobject.la
+INTROSPECTION_SRC += $(%C%_libdisfluid_gobject_la_SOURCES)
diff --git a/src/gobject/main.c b/src/gobject/main.c
new file mode 100644
index 0000000..ed1daf9
--- /dev/null
+++ b/src/gobject/main.c
@@ -0,0 +1,74 @@
+#include <config.h>
+
+#define STREQ(a, b) (strcmp ((a), (b)) == 0)
+#define STRNEQ(a, b) (! (STREQ (a, b)))
+
+#include <errno.h>
+#include <fcntl.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <unistd.h>
+#include "gettext.h"
+#include "relocatable.h"
+#include "attribute.h"
+#include <disfluid.h>
+#include <disfluid-gobject.h>
+
+#define _(String) dgettext (PACKAGE, (String))
+#define N_(String) (String)
+
+typedef struct disfluid_cache_entry DisfluidCacheEntry;
+
+/* *INDENT-OFF* */
+G_DEFINE_BOXED_TYPE (DisfluidCacheEntry,
+ disfluid_cache_entry,
+ disfluid_cache_entry_dup, disfluid_cache_entry_free)
+/* *INDENT-ON* */
+
+void
+disfluid_cache_entry_set_request_gdate (struct disfluid_cache_entry *entry,
+ GDateTime * request_date)
+{
+ struct timespec ts;
+ ts.tv_sec = g_date_time_to_unix (request_date);
+ ts.tv_nsec = g_date_time_get_microsecond (request_date) * 1000;
+ disfluid_cache_entry_set_request_date (entry, &ts);
+}
+
+void
+disfluid_cache_entry_set_response_gdate (struct disfluid_cache_entry *entry,
+ GDateTime * response_date)
+{
+ struct timespec ts;
+ ts.tv_sec = g_date_time_to_unix (response_date);
+ ts.tv_nsec = g_date_time_get_microsecond (response_date) * 1000;
+ disfluid_cache_entry_set_response_date (entry, &ts);
+}
+
+void
+disfluid_cache_entry_get_request_gdate (const struct disfluid_cache_entry
+ *entry, GDateTime ** date)
+{
+ struct timespec ts;
+ disfluid_cache_entry_get_request_date (entry, &ts);
+ GDateTime *gd = g_date_time_new_from_unix_utc (ts.tv_sec);
+ const double nsecs = ts.tv_nsec;
+ *date = g_date_time_add_seconds (gd, nsecs * 1e-9);
+ g_date_time_unref (gd);
+}
+
+void
+disfluid_cache_entry_get_response_gdate (const struct disfluid_cache_entry
+ *entry, GDateTime ** date)
+{
+ struct timespec ts;
+ disfluid_cache_entry_get_response_date (entry, &ts);
+ GDateTime *gd = g_date_time_new_from_unix_utc (ts.tv_sec);
+ const double nsecs = ts.tv_nsec;
+ *date = g_date_time_add_seconds (gd, nsecs * 1e-9);
+ g_date_time_unref (gd);
+}
diff --git a/src/libdisfluid/Makefile.am b/src/libdisfluid/Makefile.am
index 8eb2d3a..431fa2d 100644
--- a/src/libdisfluid/Makefile.am
+++ b/src/libdisfluid/Makefile.am
@@ -43,21 +43,10 @@ if HAVE_LD_OUTPUT_DEF
%D%/libdisfluid-$(DLL_VERSION).def: %D%/libdisfluid.la
-defexecdir = $(libdir)
-defexec_DATA = \
+defexec_DATA += \
%D%/libdisfluid-$(DLL_VERSION).def
-
-DISTCLEANFILES += $(defexec_DATA)
endif
-AM_V_SCAN = $(am__v_SCAN_@AM_V@)
-am__v_SCAN_ = $(am__v_SCAN_@AM_DEFAULT_V@)
-am__v_SCAN_0 = @echo " SCAN " $@;
-am__v_SCAN_1 =
-
-girdir = $(datarootdir)/gir-1.0
-
-dist_gir_DATA = %D%/Disfluid-$(DLL_VERSION).gir
-
-%D%/Disfluid-$(DLL_VERSION).gir: $(include_HEADERS) $(dist_pkginclude_HEADERS)
- $(AM_V_SCAN) ($(G_IR_SCANNER) --warn-all --strict --format=gir -I$(abs_top_srcdir)/include --c-include=disfluid.h --c-include=disfluid/cache_entry.h -n Disfluid --nsversion=$(DLL_VERSION) --symbol-prefix=disfluid_ --output=%D%/Disfluid-$(DLL_VERSION).gir-t $(include_HEADERS) $(dist_pkginclude_HEADERS) --program=echo && mv %D%/Disfluid-$(DLL_VERSION).gir-t $(srcdir)/%D%/Disfluid-$(DLL_VERSION).gir)
+INTROSPECTION_LISTS += %D%/Makefile.am
+INTROSPECTED_LIBS += %D%/libdisfluid.la
+INTROSPECTION_SRC += $(%C%_libdisfluid_la_SOURCES)
diff --git a/src/vala/Makefile.am b/src/vala/Makefile.am
new file mode 100644
index 0000000..acbb494
--- /dev/null
+++ b/src/vala/Makefile.am
@@ -0,0 +1,14 @@
+introspection/Disfluid-$(DLL_VERSION).gir:
+ $(MAKE) $(AM_MAKEFLAGS) -C introspection Disfluid-$(DLL_VERSION).gir
+
+vapidir = $(datarootdir)/vala/vapi
+
+dist_vapi_DATA = %D%/disfluid-$(DLL_VERSION).vapi
+
+AM_VAPIGEN = $(VAPIGEN_VERBOSE_@AM_V@)
+VAPIGEN_VERBOSE_ = $(VAPIGEN_VERBOSE_@AM_DEFAULT_V@)
+VAPIGEN_VERBOSE_1 = $(VAPIGEN)
+VAPIGEN_VERBOSE_0 = @echo " VAPIGEN " $@; $(VAPIGEN) --quiet
+
+%D%/disfluid-$(DLL_VERSION).vapi: introspection/Disfluid-$(DLL_VERSION).gir
+ $(AM_VAPIGEN) --library=disfluid-$(DLL_VERSION) -d $(srcdir)/%D% $(srcdir)/introspection/Disfluid-$(DLL_VERSION).gir
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8f2b116..7b5f349 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -10,13 +10,7 @@ check_PROGRAMS += %D%/run-unit-tests
-DGETTEXT_PACKAGE=\"$(PACKAGE)\"
%C%_run_unit_tests_LDADD = \
- libprog/libgnu.la \
- src/libdisfluid/libdisfluid.la \
- $(LIBTHREAD) \
- $(LTLIBINTL) \
- $(SETLOCALE_LIB) \
- $(SETLOCALE_NULL_LIB) \
- @INTL_MACOSX_LIBS@
+ src/libdisfluid/libdisfluid.la
EXTRA_DIST += %D%/valgrind.supp
diff --git a/tests/run-unit-tests.c b/tests/run-unit-tests.c
index 96fa35e..c6713fe 100644
--- a/tests/run-unit-tests.c
+++ b/tests/run-unit-tests.c
@@ -1,19 +1,11 @@
#include <config.h>
#include <disfluid.h>
-#include <locale.h>
-#include "gettext.h"
-#include "progname.h"
-#include "relocatable.h"
-
int
main (int argc, char *argv[])
{
(void) argc;
- set_program_name (argv[0]);
- setlocale (LC_ALL, "");
- bindtextdomain (PACKAGE, relocate (LOCALEDIR));
- textdomain (PACKAGE);
+ (void) argv;
size_t n_tests, n_failures;
char *output = disfluid_run_tests (&n_tests, &n_failures);
free (output);