diff --git a/.gitignore b/.gitignore
index a12f5a3..8389829 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,13 +1,20 @@
*.a
/cli/rtbuf
+/cli/rtbuf_asan
+/cli/rtbuf_cov
+/cli/rtbuf_debug
config.mk
/doc/
.gdb_history
*.gcda
*.gcno
-/gtk3/rtbuf-gtk3
+/gtk3/rtbuf_gtk3
+/gtk3/rtbuf_gtk3_asan
+/gtk3/rtbuf_gtk3_cov
+/gtk3/rtbuf_gtk3_debug
/gtk3/rtbuf_gtk3_resources.c
*.la
+*.lai
/lib/.*.log
/lib/*/.*.log
/lib/*_type
diff --git a/Makefile b/Makefile
index 8d969e6..60114eb 100644
--- a/Makefile
+++ b/Makefile
@@ -29,6 +29,12 @@ clean:
${MAKE} -C ${PWD}/cli clean
${MAKE} -C ${PWD}/gtk3 clean
+debug:
+ ${MAKE} -C ${PWD}/librtbuf debug
+ ${MAKE} -C ${PWD}/lib debug
+ ${MAKE} -C ${PWD}/cli debug
+ ${MAKE} -C ${PWD}/gtk3 debug
+
doc:
doxygen doxygen.conf
@@ -38,11 +44,17 @@ install:
${MAKE} -C ${PWD}/cli install
${MAKE} -C ${PWD}/gtk3 install
+install-debug:
+ ${MAKE} -C ${PWD}/librtbuf install-debug
+ ${MAKE} -C ${PWD}/lib install-debug
+ ${MAKE} -C ${PWD}/cli install-debug
+ ${MAKE} -C ${PWD}/gtk3 install-debug
+
licence:
update_header config.subr ${RTBUF_CONFIGURES}
update_header Makefile ${RTBUF_MAKEFILES}
update_header librtbuf/rtbuf.h ${RTBUF_C_SOURCES}
-.PHONY: all build clean doc install
+.PHONY: all build clean doc install install-debug
include config.mk
diff --git a/cli/rtbuf_cli_main.c b/cli/rtbuf_cli_main.c
index 469ee70..142d9f9 100644
--- a/cli/rtbuf_cli_main.c
+++ b/cli/rtbuf_cli_main.c
@@ -12,6 +12,7 @@
* THIS SOFTWARE.
*/
#include <assert.h>
+#include <stdio.h>
#include "../librtbuf/rtbuf.h"
#include "rtbuf_cli.h"
diff --git a/cli/rtbuf_debug b/cli/rtbuf_debug
deleted file mode 100755
index b489544..0000000
Binary files a/cli/rtbuf_debug and /dev/null differ
diff --git a/config.subr b/config.subr
index 8118a92..7d6bc3f 100644
--- a/config.subr
+++ b/config.subr
@@ -29,6 +29,10 @@ lo_rule() {
ext_rule .lo "$1"
}
+prog_ext_rule() {
+ { o_rule "$2" || exit 1; } | sed -e "s/[.]o:/$1:/"
+}
+
prog_rule() {
{ o_rule "$1" || exit 1; } | sed -e 's/[.]o:/:/'
}
@@ -261,6 +265,7 @@ rtbuf_library() {
echo "RTBUF_LIBRARY_LIBDIR = $RTBUF_LIBRARY_LIBDIR" >> ${CONFIG_MK}
LIBRARIES=
+ LIBRARIES_DEBUG=
for SRC in $SOURCES; do
SRC_LO="$(c2ext .main.lo "$SRC")"
@@ -272,12 +277,25 @@ rtbuf_library() {
echo "$SRC_LA: $SRC_LO" >> ${CONFIG_MK}
echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -no-undefined -module \${LDFLAGS} $SRC_LO \${LIBS} -o $SRC_LA -rpath ${RTBUF_LIBRARY_LIBDIR}" >> ${CONFIG_MK}
LIBRARIES="$LIBRARIES $SRC_LA"
- done
+
+ SRC_LO="$(c2ext .debug.lo "$SRC")"
+ echo >> ${CONFIG_MK}
+ ext_rule .debug.lo "$SRC" >> ${CONFIG_MK}
+ echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_DEBUG} -c $SRC -o $SRC_LO" >> ${CONFIG_MK}
+ SRC_LA="$(c2ext _debug.la "$SRC")"
+ echo >> ${CONFIG_MK}
+ echo "$SRC_LA: $SRC_LO" >> ${CONFIG_MK}
+ echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -no-undefined -module \${LDFLAGS} $SRC_LO \${LIBS_DEBUG} -o $SRC_LA -rpath ${RTBUF_LIBRARY_LIBDIR}" >> ${CONFIG_MK}
+ LIBRARIES_DEBUG="$LIBRARIES_DEBUG $SRC_LA"
+done
echo >> ${CONFIG_MK}
echo "libraries:${LIBRARIES}" >> ${CONFIG_MK}
echo >> ${CONFIG_MK}
+ echo "libraries-debug:${LIBRARIES_DEBUG}" >> ${CONFIG_MK}
+
+ echo >> ${CONFIG_MK}
echo "install:${LIBRARIES}" >> ${CONFIG_MK}
for LIB in $LIBRARIES; do
echo " \${INSTALL} -o \${OWNER} -g \${GROUP} -m 0755 -d \${RTBUF_LIBRARY_LIBDIR}" >> ${CONFIG_MK}
diff --git a/gtk3/rtbuf_gtk3 b/gtk3/rtbuf_gtk3
deleted file mode 100755
index 92df277..0000000
--- a/gtk3/rtbuf_gtk3
+++ /dev/null
@@ -1,210 +0,0 @@
-#! /bin/sh
-
-# rtbuf_gtk3 - temporary wrapper script for .libs/rtbuf_gtk3
-# Generated by libtool (GNU libtool) 2.4.2
-#
-# The rtbuf_gtk3 program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
-#
-# This wrapper script should never be moved out of the build directory.
-# If it is, it will not operate correctly.
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-relink_command=""
-
-# This environment variable determines our operation mode.
-if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then
- # install mode needs the following variables:
- generated_by_libtool_version='2.4.2'
- notinst_deplibs=' /home/dx/c/rtbuf/rtbuf/lib/librtbuf_signal.la /home/dx/c/rtbuf/rtbuf/cli/librtbuf_cli.la /home/dx/c/rtbuf/rtbuf/librtbuf/librtbuf.la'
-else
- # When we are sourced in execute mode, $file and $ECHO are already set.
- if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
- file="$0"
-
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
- eval 'cat <<_LTECHO_EOF
-$1
-_LTECHO_EOF'
-}
- ECHO="print -r --"
- fi
-
-# Very basic option parsing. These options are (a) specific to
-# the libtool wrapper, (b) are identical between the wrapper
-# /script/ and the wrapper /executable/ which is used only on
-# windows platforms, and (c) all begin with the string --lt-
-# (application programs are unlikely to have options which match
-# this pattern).
-#
-# There are only two supported options: --lt-debug and
-# --lt-dump-script. There is, deliberately, no --lt-help.
-#
-# The first argument to this parsing function should be the
-# script's /usr/local/bin/libtool value, followed by no.
-lt_option_debug=
-func_parse_lt_options ()
-{
- lt_script_arg0=$0
- shift
- for lt_opt
- do
- case "$lt_opt" in
- --lt-debug) lt_option_debug=1 ;;
- --lt-dump-script)
- lt_dump_D=`$ECHO "X$lt_script_arg0" | /usr/bin/sed -e 's/^X//' -e 's%/[^/]*$%%'`
- test "X$lt_dump_D" = "X$lt_script_arg0" && lt_dump_D=.
- lt_dump_F=`$ECHO "X$lt_script_arg0" | /usr/bin/sed -e 's/^X//' -e 's%^.*/%%'`
- cat "$lt_dump_D/$lt_dump_F"
- exit 0
- ;;
- --lt-*)
- $ECHO "Unrecognized --lt- option: '$lt_opt'" 1>&2
- exit 1
- ;;
- esac
- done
-
- # Print the debug banner immediately:
- if test -n "$lt_option_debug"; then
- echo "rtbuf_gtk3:rtbuf_gtk3:${LINENO}: libtool wrapper (GNU libtool) 2.4.2" 1>&2
- fi
-}
-
-# Used when --lt-debug. Prints its arguments to stdout
-# (redirection is the responsibility of the caller)
-func_lt_dump_args ()
-{
- lt_dump_args_N=1;
- for lt_arg
- do
- $ECHO "rtbuf_gtk3:rtbuf_gtk3:${LINENO}: newargv[$lt_dump_args_N]: $lt_arg"
- lt_dump_args_N=`expr $lt_dump_args_N + 1`
- done
-}
-
-# Core function for launching the target application
-func_exec_program_core ()
-{
-
- if test -n "$lt_option_debug"; then
- $ECHO "rtbuf_gtk3:rtbuf_gtk3:${LINENO}: newargv[0]: $progdir/$program" 1>&2
- func_lt_dump_args ${1+"$@"} 1>&2
- fi
- exec "$progdir/$program" ${1+"$@"}
-
- $ECHO "$0: cannot exec $program $*" 1>&2
- exit 1
-}
-
-# A function to encapsulate launching the target application
-# Strips options in the --lt-* namespace from $@ and
-# launches target application with the remaining arguments.
-func_exec_program ()
-{
- case " $* " in
- *\ --lt-*)
- for lt_wr_arg
- do
- case $lt_wr_arg in
- --lt-*) ;;
- *) set x "$@" "$lt_wr_arg"; shift;;
- esac
- shift
- done ;;
- esac
- func_exec_program_core ${1+"$@"}
-}
-
- # Parse options
- func_parse_lt_options "$0" ${1+"$@"}
-
- # Find the directory that this script lives in.
- thisdir=`$ECHO "$file" | /usr/bin/sed 's%/[^/]*$%%'`
- test "x$thisdir" = "x$file" && thisdir=.
-
- # Follow symbolic links until we get to the real thisdir.
- file=`ls -ld "$file" | /usr/bin/sed -n 's/.*-> //p'`
- while test -n "$file"; do
- destdir=`$ECHO "$file" | /usr/bin/sed 's%/[^/]*$%%'`
-
- # If there was a directory component, then change thisdir.
- if test "x$destdir" != "x$file"; then
- case "$destdir" in
- [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;;
- *) thisdir="$thisdir/$destdir" ;;
- esac
- fi
-
- file=`$ECHO "$file" | /usr/bin/sed 's%^.*/%%'`
- file=`ls -ld "$thisdir/$file" | /usr/bin/sed -n 's/.*-> //p'`
- done
-
- # Usually 'no', except on cygwin/mingw when embedded into
- # the cwrapper.
- WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no
- if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then
- # special case for '.'
- if test "$thisdir" = "."; then
- thisdir=`pwd`
- fi
- # remove .libs from thisdir
- case "$thisdir" in
- *[\\/].libs ) thisdir=`$ECHO "$thisdir" | /usr/bin/sed 's%[\\/][^\\/]*$%%'` ;;
- .libs ) thisdir=. ;;
- esac
- fi
-
- # Try to get the absolute directory name.
- absdir=`cd "$thisdir" && pwd`
- test -n "$absdir" && thisdir="$absdir"
-
- program='rtbuf_gtk3'
- progdir="$thisdir/.libs"
-
-
- if test -f "$progdir/$program"; then
- # Add our own library path to LD_LIBRARY_PATH
- LD_LIBRARY_PATH="/usr/local/lib:/usr/X11R6/lib:/home/dx/c/rtbuf/rtbuf/lib/.libs:/home/dx/c/rtbuf/rtbuf/cli/.libs:/home/dx/c/rtbuf/rtbuf/librtbuf/.libs:$LD_LIBRARY_PATH"
-
- # Some systems cannot cope with colon-terminated LD_LIBRARY_PATH
- # The second colon is a workaround for a bug in BeOS R4 sed
- LD_LIBRARY_PATH=`$ECHO "$LD_LIBRARY_PATH" | /usr/bin/sed 's/::*$//'`
-
- export LD_LIBRARY_PATH
-
- if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
- # Run the actual program with our arguments.
- func_exec_program ${1+"$@"}
- fi
- else
- # The program doesn't exist.
- $ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2
- $ECHO "This script is just a wrapper for $program." 1>&2
- $ECHO "See the libtool documentation for more information." 1>&2
- exit 1
- fi
-fi
diff --git a/gtk3/rtbuf_gtk3.c b/gtk3/rtbuf_gtk3.c
index 2fa2778..f010d16 100644
--- a/gtk3/rtbuf_gtk3.c
+++ b/gtk3/rtbuf_gtk3.c
@@ -48,6 +48,8 @@ GtkWidget *drag_widget = NULL;
gint drag_x = 0;
gint drag_y = 0;
+void rtbuf_gtk_err_cb (const char *msg);
+
void rtbuf_gtk_drag_connection_end (RtbufInputWidget *input_widget)
{
if (drag_connection) {
@@ -146,6 +148,7 @@ void rtbuf_gtk_new (gchar *library, const gint x, const gint y)
fprintf(stderr, "rtbuf-gtk new rtbuf_new failed: %s\n", library);
return;
}
+ rtbuf_print(g_rtbuf + i);
}
void rtbuf_gtk_library_menu_activate (GtkMenuItem *menuitem,
@@ -154,9 +157,9 @@ void rtbuf_gtk_library_menu_activate (GtkMenuItem *menuitem,
gchar *proc;
gchar *library = (gchar*) data;
g_object_get(menuitem, "label", &proc, NULL);
- rtbuf_gtk_new(library, rtbuf_x, rtbuf_y);
rtbuf_x = 100;
rtbuf_y = 100;
+ rtbuf_gtk_new(library, rtbuf_x, rtbuf_y);
g_free(proc);
}
@@ -469,6 +472,21 @@ void rtbuf_gtk_unlock ()
g_mutex_unlock(&g_mutex);
}
+void rtbuf_gtk_new_cb (s_rtbuf *rtbuf)
+{
+ s_rtbuf_gtk_rtbuf_info *info;
+ assert(rtbuf);
+ rtbuf_print(rtbuf);
+ info = rtbuf_gtk_rtbuf_info_new();
+ assert(info);
+ rtbuf->user_ptr = info;
+ info->x = 10;
+ info->y = 10;
+ rtbuf_gtk_lock();
+ rtbuf_gtk_modular_layout_new(rtbuf);
+ rtbuf_gtk_unlock();
+}
+
void rtbuf_gtk_position_cb (s_rtbuf *rtbuf, short x, short y)
{
s_rtbuf_gtk_rtbuf_info *info =
@@ -605,6 +623,8 @@ int main (int argc, char *argv[])
{
g_mutex_init(&g_mutex);
symbols_init();
+ g_rtbuf_err_cb = rtbuf_gtk_err_cb;
+ g_rtbuf_new_cb = rtbuf_gtk_new_cb;
g_rtbuf_position_cb = rtbuf_gtk_position_cb;
g_rtbuf_delete_cb = rtbuf_gtk_delete_cb;
g_rtbuf_bind_cb = rtbuf_gtk_bind_cb;
@@ -624,8 +644,7 @@ int main (int argc, char *argv[])
return 0;
}
-extern int rtbuf_err (const char *msg)
+void rtbuf_gtk_err_cb (const char *msg)
{
fprintf(stderr, "rtbuf-gtk: %s\n", msg);
- return -1;
}
diff --git a/gtk3/rtbuf_gtk3_input_widget.c b/gtk3/rtbuf_gtk3_input_widget.c
index 98cbd05..59220df 100644
--- a/gtk3/rtbuf_gtk3_input_widget.c
+++ b/gtk3/rtbuf_gtk3_input_widget.c
@@ -79,7 +79,7 @@ rtbuf_input_widget_class_init (RtbufInputWidgetClass *klass)
G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties(gobject_class, LAST_PROP, rtbuf_input_widget_props);
gtk_widget_class_set_template_from_resource(widget_class,
- "/rtbuf/rtbuf_input_widget.ui");
+ "/rtbuf/rtbuf_gtk3_input_widget.ui");
gtk_widget_class_bind_template_child_private(widget_class,
RtbufInputWidget, check);
gtk_widget_class_bind_template_child_private(widget_class,
diff --git a/gtk3/rtbuf_gtk3_output_widget.c b/gtk3/rtbuf_gtk3_output_widget.c
index e555039..a6f8ddd 100644
--- a/gtk3/rtbuf_gtk3_output_widget.c
+++ b/gtk3/rtbuf_gtk3_output_widget.c
@@ -68,7 +68,7 @@ rtbuf_output_widget_class_init (RtbufOutputWidgetClass *klass)
G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties(gobject_class, LAST_PROP, rtbuf_output_widget_props);
gtk_widget_class_set_template_from_resource(widget_class,
- "/rtbuf/rtbuf_output_widget.ui");
+ "/rtbuf/rtbuf_gtk3_output_widget.ui");
gtk_widget_class_bind_template_child_private(widget_class,
RtbufOutputWidget, check);
gtk_widget_class_bind_template_child_private(widget_class,
diff --git a/gtk3/rtbuf_gtk3_widget.c b/gtk3/rtbuf_gtk3_widget.c
index a2b929b..3441e52 100644
--- a/gtk3/rtbuf_gtk3_widget.c
+++ b/gtk3/rtbuf_gtk3_widget.c
@@ -71,7 +71,7 @@ rtbuf_widget_class_init (RtbufWidgetClass *klass)
G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties(gobject_class, LAST_PROP, rtbuf_widget_props);
gtk_widget_class_set_template_from_resource(widget_class,
- "/rtbuf/rtbuf_widget.ui");
+ "/rtbuf/rtbuf_gtk3_widget.ui");
gtk_widget_class_bind_template_child_private(widget_class,
RtbufWidget, event_box);
gtk_widget_class_bind_template_child_private(widget_class,
diff --git a/lib/Makefile b/lib/Makefile
index 6a045d0..c50ac7f 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -13,13 +13,25 @@
CLEANFILES = .libs *.o *.lo *.la *.gcno *.gcna *.gcda
-all: types libraries subdirs
+build: types libraries subdirs
+
+all: build
clean: subdirs-clean
rm -rf ${CLEANFILES}
+debug: types libraries-debug subdirs-debug
+
install: libraries-install subdirs-install
+libraries: types
+
+libraries-debug: types
+
.PHONY: all clean libraries subdirs subdirs-clean subdirs-install
+subdirs: libraries
+
+subdirs-debug: libraries-debug
+
include config.mk
diff --git a/lib/configure b/lib/configure
index c2b2daa..28c6be5 100755
--- a/lib/configure
+++ b/lib/configure
@@ -41,16 +41,19 @@ config_sndio
CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
LDFLAGS_ASAN="$LDFLAGS"
LIBS_ASAN="$LIBS"
+LIBS_ASAN="$LIBS_ASAN $SRC_TOP/librtbuf/librtbuf_asan.la"
# Coverage config
CFLAGS_COV="$CFLAGS -ftest-coverage -fprofile-arcs"
LDFLAGS_COV="$LDFLAGS"
LIBS_COV="$LIBS"
+LIBS_COV="$LIBS_COV $SRC_TOP/librtbuf/librtbuf_cov.la"
# Debug config
CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -ggdb"
LDFLAGS_DEBUG="$LDFLAGS"
LIBS_DEBUG="$LIBS"
+LIBS_DEBUG="$LIBS_DEBUG $SRC_TOP/librtbuf/librtbuf_debug.la"
# Main config
if [ "x$ENV_CFLAGS" = "x" ]; then
@@ -102,6 +105,7 @@ type_prog synth
echo "types:${TYPES}" >> ${CONFIG_MK}
LIBRARIES=
+LIBRARIES_DEBUG=
for SRC in $SOURCES; do
SRC_LO="$(c2ext .main.lo "$SRC")"
@@ -114,12 +118,26 @@ for SRC in $SOURCES; do
echo "$SRC_LA: $SRC_LO" >> ${CONFIG_MK}
echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS} $SRC_LO \${LIBS} -o $SRC_LA -rpath \${LIBDIR}" >> ${CONFIG_MK}
LIBRARIES="$LIBRARIES $SRC_LA"
+
+ SRC_LO="$(c2ext .debug.lo "$SRC")"
+ echo >> ${CONFIG_MK}
+ ext_rule .debug.lo "$SRC" >> ${CONFIG_MK}
+ echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_DEBUG} -c $SRC -o $SRC_LO" >> ${CONFIG_MK}
+
+ SRC_LA="librtbuf_$(c2ext _debug.la "$SRC")"
+ echo >> ${CONFIG_MK}
+ echo "$SRC_LA: $SRC_LO" >> ${CONFIG_MK}
+ echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_DEBUG} $SRC_LO \${LIBS_DEBUG} -o $SRC_LA -rpath \${LIBDIR}" >> ${CONFIG_MK}
+ LIBRARIES_DEBUG="$LIBRARIES_DEBUG $SRC_LA"
done
echo >> ${CONFIG_MK}
echo "libraries:${LIBRARIES} ${TYPES}" >> ${CONFIG_MK}
echo >> ${CONFIG_MK}
+echo "libraries-debug:${LIBRARIES_DEBUG} ${TYPES}" >> ${CONFIG_MK}
+
+echo >> ${CONFIG_MK}
echo "libraries-install: ${LIBRARIES}" >> ${CONFIG_MK}
for LIB in $LIBRARIES; do
echo " \${LIBTOOL} --tag=CC --mode=install \${INSTALL} -o \${OWNER} -g \${GROUP} -m 0755 $LIB \${LIBDIR}" >> ${CONFIG_MK}
@@ -138,6 +156,12 @@ for DIR in $DIRS; do
done
echo >> ${CONFIG_MK}
+echo "subdirs-debug:" >> ${CONFIG_MK}
+for DIR in $DIRS; do
+ echo " \${MAKE} -C $DIR debug" >> ${CONFIG_MK}
+done
+
+echo >> ${CONFIG_MK}
echo "subdirs-install: libraries" >> ${CONFIG_MK}
for DIR in $DIRS; do
echo " \${MAKE} -C $DIR install" >> ${CONFIG_MK}
@@ -154,6 +178,6 @@ for TYPE_SRC in $TYPE_SOURCES; do
done
echo >> ${CONFIG_MK}
-echo ".PHONY: types libraries install subdirs subdirs-clean subdirs-install" >> ${CONFIG_MK}
+echo ".PHONY: types libraries libraries-debug install subdirs subdirs-clean subdirs-debug subdirs-install" >> ${CONFIG_MK}
update_config_mk
diff --git a/lib/dynamic/Makefile b/lib/dynamic/Makefile
index 4f5818b..f64ee79 100644
--- a/lib/dynamic/Makefile
+++ b/lib/dynamic/Makefile
@@ -11,11 +11,16 @@
## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
## THIS SOFTWARE.
-all: libraries
+build: libraries
+
+all: build debug
clean:
- rm -rf .libs *.o *.lo *.la
+ rm -rf .libs *.o *.lo *.la *.gcno *.gcna *.gcda
+
+debug: libraries-debug
-.PHONY: all clean libraries
+.PHONY: all clean debug libraries libraries-debug
include config.mk
+include sources.mk
diff --git a/lib/dynamic/configure b/lib/dynamic/configure
index 99b624c..025d5f3 100755
--- a/lib/dynamic/configure
+++ b/lib/dynamic/configure
@@ -33,30 +33,34 @@ CPPFLAGS="$CPPFLAGS -DRTBUF_LIBDIR=\\\"${RTBUF_LIBDIR}\\\""
CPPFLAGS="$CPPFLAGS -DVER=\\\"${VER}\\\""
config_asan
config_gnu
-pkg_config libbsd-overlay
-pkg_config libffi
-pkg_config libmd
# Address Sanitizer config
CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
LDFLAGS_ASAN="$LDFLAGS"
LIBS_ASAN="$LIBS"
+LIBS_ASAN="$LIBS_ASAN $SRC_TOP/lib/librtbuf_signal_asan.la"
+LIBS_ASAN="$LIBS_ASAN $SRC_TOP/librtbuf/librtbuf_asan.la"
# Coverage config
CFLAGS_COV="$CFLAGS -ftest-coverage -fprofile-arcs"
LDFLAGS_COV="$LDFLAGS"
LIBS_COV="$LIBS"
+LIBS_COV="$LIBS_COV $SRC_TOP/lib/librtbuf_signal_cov.la"
+LIBS_COV="$LIBS_COV $SRC_TOP/librtbuf/librtbuf_cov.la"
# Debug config
CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -ggdb"
LDFLAGS_DEBUG="$LDFLAGS"
LIBS_DEBUG="$LIBS"
+LIBS_DEBUG="$LIBS_DEBUG $SRC_TOP/lib/librtbuf_signal_debug.la"
+LIBS_DEBUG="$LIBS_DEBUG $SRC_TOP/librtbuf/librtbuf_debug.la"
# Main config
if [ "x$ENV_CFLAGS" = "x" ]; then
CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
fi
CFLAGS="$CFLAGS -DNDEBUG"
+LIBS="$LIBS"
LIBS="$LIBS $SRC_TOP/lib/librtbuf_signal.la"
LIBS="$LIBS $SRC_TOP/librtbuf/librtbuf.la"
diff --git a/lib/glfw3/Makefile b/lib/glfw3/Makefile
index 8f3e573..a1b7196 100644
--- a/lib/glfw3/Makefile
+++ b/lib/glfw3/Makefile
@@ -11,11 +11,16 @@
## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
## THIS SOFTWARE.
-all: libraries
+build: libraries
+
+all: build debug
clean:
rm -rf .libs *.o *.lo *.la *.gcno *.gcna *.gcda
-.PHONY: all clean libraries
+debug: libraries-debug
+
+.PHONY: all clean libraries libraries-debug
include config.mk
+include sources.mk
diff --git a/lib/portaudio/Makefile b/lib/portaudio/Makefile
index 8f3e573..f64ee79 100644
--- a/lib/portaudio/Makefile
+++ b/lib/portaudio/Makefile
@@ -11,11 +11,16 @@
## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
## THIS SOFTWARE.
-all: libraries
+build: libraries
+
+all: build debug
clean:
rm -rf .libs *.o *.lo *.la *.gcno *.gcna *.gcda
-.PHONY: all clean libraries
+debug: libraries-debug
+
+.PHONY: all clean debug libraries libraries-debug
include config.mk
+include sources.mk
diff --git a/lib/reverb/Makefile b/lib/reverb/Makefile
index 8f3e573..f64ee79 100644
--- a/lib/reverb/Makefile
+++ b/lib/reverb/Makefile
@@ -11,11 +11,16 @@
## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
## THIS SOFTWARE.
-all: libraries
+build: libraries
+
+all: build debug
clean:
rm -rf .libs *.o *.lo *.la *.gcno *.gcna *.gcda
-.PHONY: all clean libraries
+debug: libraries-debug
+
+.PHONY: all clean debug libraries libraries-debug
include config.mk
+include sources.mk
diff --git a/lib/signal/Makefile b/lib/signal/Makefile
index 8f3e573..f64ee79 100644
--- a/lib/signal/Makefile
+++ b/lib/signal/Makefile
@@ -11,11 +11,16 @@
## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
## THIS SOFTWARE.
-all: libraries
+build: libraries
+
+all: build debug
clean:
rm -rf .libs *.o *.lo *.la *.gcno *.gcna *.gcda
-.PHONY: all clean libraries
+debug: libraries-debug
+
+.PHONY: all clean debug libraries libraries-debug
include config.mk
+include sources.mk
diff --git a/lib/sndio/Makefile b/lib/sndio/Makefile
index 8f3e573..f64ee79 100644
--- a/lib/sndio/Makefile
+++ b/lib/sndio/Makefile
@@ -11,11 +11,16 @@
## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
## THIS SOFTWARE.
-all: libraries
+build: libraries
+
+all: build debug
clean:
rm -rf .libs *.o *.lo *.la *.gcno *.gcna *.gcda
-.PHONY: all clean libraries
+debug: libraries-debug
+
+.PHONY: all clean debug libraries libraries-debug
include config.mk
+include sources.mk
diff --git a/lib/synth/Makefile b/lib/synth/Makefile
index 8f3e573..f64ee79 100644
--- a/lib/synth/Makefile
+++ b/lib/synth/Makefile
@@ -11,11 +11,16 @@
## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
## THIS SOFTWARE.
-all: libraries
+build: libraries
+
+all: build debug
clean:
rm -rf .libs *.o *.lo *.la *.gcno *.gcna *.gcda
-.PHONY: all clean libraries
+debug: libraries-debug
+
+.PHONY: all clean debug libraries libraries-debug
include config.mk
+include sources.mk
diff --git a/librtbuf/rtbuf.c b/librtbuf/rtbuf.c
index 2545685..402f907 100644
--- a/librtbuf/rtbuf.c
+++ b/librtbuf/rtbuf.c
@@ -38,6 +38,7 @@ unsigned int g_rtbuf_sort = 0;
unsigned int g_rtbuf_sorted[RTBUF_MAX];
unsigned int g_rtbuf_sorted_n = 0;
+f_rtbuf_err_cb g_rtbuf_err_cb = 0;
f_rtbuf_new_cb g_rtbuf_new_cb = 0;
f_rtbuf_delete_cb g_rtbuf_delete_cb = 0;
f_rtbuf_bind_cb g_rtbuf_bind_cb = 0;
@@ -68,6 +69,20 @@ void librtbuf_shutdown ()
libdata_shutdown();
}
+int rtbuf_err (const char *msg)
+{
+ if (g_rtbuf_err_cb)
+ g_rtbuf_err_cb(msg);
+ else
+ rtbuf_err_default(msg);
+ return -1;
+}
+
+void rtbuf_err_default (const char *msg)
+{
+ fprintf(stderr, "rtbuf: %s\n", msg);
+}
+
int rtbuf_new (s_rtbuf_proc *rp)
{
return rtbuf_new_ptr(rp, NULL);
@@ -563,6 +578,7 @@ int rtbuf_out_int (s_rtbuf *rtb, unsigned int out, int default_value)
void rtbuf_print (const s_rtbuf *rtbuf)
{
unsigned int i;
+ assert(rtbuf);
if (rtbuf >= g_rtbuf &&
(i = rtbuf - g_rtbuf) < RTBUF_MAX)
printf("#<rtbuf %i %s>\n", i, rtbuf->proc->lib->name);
@@ -596,7 +612,7 @@ void rtbuf_print_long (const s_rtbuf *rtbuf)
s_rtbuf_proc *proc;
int i;
unsigned int j = 0;
- assert(i < RTBUF_MAX);
+ assert(rtbuf);
proc = rtbuf->proc;
if (rtbuf >= g_rtbuf &&
(i = rtbuf - g_rtbuf) < RTBUF_MAX)
@@ -646,12 +662,6 @@ double clamp (double inf, double x, double sup)
return max(inf, min(x, sup));
}
-int rtbuf_err (const char *msg)
-{
- fprintf(stderr, "%s\n", msg);
- return -1;
-}
-
double * rtbuf_in_unbound_value (s_rtbuf *rtb, unsigned int in)
{
unsigned int offset;
diff --git a/librtbuf/rtbuf.h b/librtbuf/rtbuf.h
index 76b2253..6a00531 100644
--- a/librtbuf/rtbuf.h
+++ b/librtbuf/rtbuf.h
@@ -110,6 +110,11 @@ extern int g_rtbuf_run;
extern int g_rtbuf_running;
/**
+ * @brief Callback function for rtbuf_err.
+ */
+typedef void (*f_rtbuf_err_cb) (const char *msg);
+
+/**
* @brief Callback function for rtbuf_new.
*/
typedef void (*f_rtbuf_new_cb) (s_rtbuf *rtb);
@@ -132,6 +137,11 @@ typedef void (*f_rtbuf_unbind_cb) (s_rtbuf *src, unsigned int out,
s_rtbuf *dest, unsigned int in);
/**
+ * @brief Callback function for rtbuf_err.
+ */
+extern f_rtbuf_err_cb g_rtbuf_err_cb;
+
+/**
* @brief Callback function for rtbuf_new.
*/
extern f_rtbuf_new_cb g_rtbuf_new_cb;
@@ -172,6 +182,8 @@ void librtbuf_shutdown ();
int rtbuf_err (const char *msg);
+void rtbuf_err_default (const char *msg);
+
/**
* @brief Create a new real time buffer.
*
diff --git a/test/sinus b/test/sinus
index 1c3f238..5c654fd 100644
--- a/test/sinus
+++ b/test/sinus
@@ -1,6 +1,6 @@
load signal/sinus
-let sinus00 = new signal/sinus
+let sinus00 = new signal/sinus 10 10
load portaudio/output
-let output00 = new portaudio/output
+let output00 = new portaudio/output 200 400
bind sinus00 signal output00 left
bind sinus00 signal output00 right