[beast: 17/57] SFI: provide Bse::assertion_failed() and Bse::assertion_failed_hook()
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 17/57] SFI: provide Bse::assertion_failed() and Bse::assertion_failed_hook()
- Date: Sun, 23 Jul 2017 09:59:13 +0000 (UTC)
commit 3bfea5a01323903f9b83dd0a816c397610619208
Author: Tim Janik <timj gnu org>
Date: Mon Jul 17 11:05:27 2017 +0200
SFI: provide Bse::assertion_failed() and Bse::assertion_failed_hook()
Signed-off-by: Tim Janik <timj gnu org>
sfi/glib-extra.cc | 13 +++++++++++++
sfi/glib-extra.hh | 12 +++++++++---
2 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/sfi/glib-extra.cc b/sfi/glib-extra.cc
index 95a0149..42aa277 100644
--- a/sfi/glib-extra.cc
+++ b/sfi/glib-extra.cc
@@ -1028,9 +1028,22 @@ g_scanner_new64 (const GScannerConfig *config_templ)
#include "../config/config.h"
+#include <rapicorn-core.hh>
namespace Bse {
+void
+assertion_failed (const char *file, uint line, const char *expr)
+{
+ return Rapicorn::Aida::assertion_failed (file, line, expr);
+}
+
+void
+assertion_failed_hook (const std::function<void()> &hook)
+{
+ return Rapicorn::Aida::assertion_failed_hook (hook);
+}
+
// == BSE_INSTALLPATH ==
static String installpath_topdir;
diff --git a/sfi/glib-extra.hh b/sfi/glib-extra.hh
index 760f168..eaafefc 100644
--- a/sfi/glib-extra.hh
+++ b/sfi/glib-extra.hh
@@ -5,6 +5,7 @@
#include <glib.h>
#include <glib-object.h>
#include <string>
+#include <functional>
typedef int64_t int64; ///< A 64-bit unsigned integer, use PRI*64 in format strings.
@@ -55,9 +56,9 @@ void g_object_disconnect_any (gpointer object,
gpointer data); /* workaorund for g_object_disconnect() */
// == printf variants ==
-#define g_intern_format(...) g_intern_string (Rapicorn::string_format (__VA_ARGS__).c_str())
-#define g_string_add_format(gstr, ...) g_string_append (gstr, Rapicorn::string_format
(__VA_ARGS__).c_str())
-#define g_strdup_format(...) g_strdup (Rapicorn::string_format (__VA_ARGS__).c_str())
+#define g_intern_format(...) g_intern_string (::Bse::string_format (__VA_ARGS__).c_str())
+#define g_string_add_format(gstr, ...) g_string_append (gstr, ::Bse::string_format (__VA_ARGS__).c_str())
+#define g_strdup_format(...) g_strdup (::Bse::string_format (__VA_ARGS__).c_str())
/* --- string functions --- */
gchar** g_straddv (gchar **str_array,
@@ -359,6 +360,11 @@ void installpath_override (const std::string &topdir);
/// Provide a string containing the BSE library version number.
std::string version ();
+/// Function used internally to print an error message for failing assertions.
+void assertion_failed (const char *file, uint line, const char *expr);
+/// Install hook function to be called after assertion_failed().
+void assertion_failed_hook (const std::function<void()> &hook);
+
// == Translate i18n strings ==
const char* bse_gettext_domain ();
const char* (_) (const char *string) __attribute__ ((__format_arg__ (1)));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]