diff --git a/Makefile b/Makefile
index 1cefaba..1448d25 100644
--- a/Makefile
+++ b/Makefile
@@ -74,12 +74,24 @@ debug:
demo: build
${MAKE} -C libc3 demo
+demo_asan: asan
+ ${MAKE} -C libc3 demo_asan
+
+demo_cov: cov
+ ${MAKE} -C libc3 demo_cov
+
demo_debug: debug
${MAKE} -C libc3 demo_debug
demo_gl: build
${MAKE} -C libc3 demo_gl
+demo_gl_asan: asan
+ ${MAKE} -C libc3 demo_gl_asan
+
+demo_gl_cov: cov
+ ${MAKE} -C libc3 demo_gl_cov
+
demo_gl_debug: debug
${MAKE} -C libc3 demo_gl_debug
@@ -190,27 +202,21 @@ test_gcovr:
${MAKE} gcovr
test_ic3: build
-test_ic3:
${MAKE} -C test test_ic3
test_ic3_asan: asan
-test_ic3_asan:
${MAKE} -C test test_ic3_asan
test_ic3_cov: cov
-test_ic3_cov:
${MAKE} -C test test_ic3_cov
test_ic3_debug: debug
-test_ic3_debug:
${MAKE} -C test test_ic3_debug
test_libc3: build
-test_libc3:
${MAKE} -C test test_libc3
test_libc3_cov: cov
-test_libc3_cov:
${MAKE} -C test test_libc3_cov
test_libc3_debug:
@@ -220,12 +226,20 @@ test_libc3_debug:
.PHONY: \
all \
asan \
+ build \
c3s \
cov \
clean \
clean_cov \
debug \
demo \
+ demo_asan \
+ demo_cov \
+ demo_debug \
+ demo_gl \
+ demo_gl_asan \
+ demo_gl_cov \
+ demo_gl_debug \
dist \
gcovr \
ic3 \
diff --git a/libc3/Makefile b/libc3/Makefile
index 1f4797b..57fb5d8 100644
--- a/libc3/Makefile
+++ b/libc3/Makefile
@@ -52,12 +52,24 @@ debug:
demo: build
${MAKE} -C window demo
+demo_asan: asan
+ ${MAKE} -C window demo_asan
+
+demo_cov: cov
+ ${MAKE} -C window demo_cov
+
demo_debug: debug
${MAKE} -C window demo_debug
demo_gl: build
${MAKE} -C window demo_gl
+demo_gl_asan: asan
+ ${MAKE} -C window demo_gl_asan
+
+demo_gl_cov: cov
+ ${MAKE} -C window demo_gl_cov
+
demo_gl_debug: debug
${MAKE} -C window demo_gl_debug
@@ -97,7 +109,30 @@ test:
update_sources:
./update_sources
-.PHONY: all asan build clean cov debug distclean gdb_demo gen install lldb_demo test update_sources
+.PHONY: \
+ all \
+ asan \
+ build \
+ clean \
+ cov \
+ debug \
+ demo \
+ demo_asan \
+ demo_cov \
+ demo_debug \
+ demo_gl \
+ demo_gl_asan \
+ demo_gl_cov \
+ demo_gl_debug \
+ distclean \
+ gdb_demo \
+ gdb_demo_gl \
+ gen \
+ install \
+ lldb_demo \
+ lldb_demo_gl \
+ test \
+ update_sources \
include config.mk
include sources.mk
diff --git a/libc3/sequence.c b/libc3/sequence.c
index aab9017..e5864de 100644
--- a/libc3/sequence.c
+++ b/libc3/sequence.c
@@ -12,16 +12,24 @@
*/
#include <assert.h>
#include "sequence.h"
+#include "tag.h"
-s_sequence * sequence_init (s_sequence *sequence, f64 duration,
+void sequence_clean (s_sequence *seq)
+{
+ tag_clean(&seq->tag);
+}
+
+s_sequence * sequence_init (s_sequence *seq, f64 duration,
const s8 *title, f_sequence_load load,
f_sequence_render render)
{
- assert(sequence);
- sequence->t = 0.0;
- sequence->duration = duration;
- sequence->title = title;
- sequence->load = load;
- sequence->render = render;
- return sequence;
+ assert(seq);
+ seq->dt = 0.0;
+ seq->t = 0.0;
+ seq->duration = duration;
+ seq->title = title;
+ seq->load = load;
+ seq->render = render;
+ tag_init_void(&seq->tag);
+ return seq;
}
diff --git a/libc3/sequence.h b/libc3/sequence.h
index d4a2c53..f150359 100644
--- a/libc3/sequence.h
+++ b/libc3/sequence.h
@@ -15,6 +15,9 @@
#include "types.h"
+/* Stack-allocation compatible functions, call sequence_clean after
+ use. */
+void sequence_clean (s_sequence *seq);
s_sequence * sequence_init (s_sequence *sequence, f64 duration,
const s8 *title, f_sequence_load load,
f_sequence_render render);
diff --git a/libc3/window/Makefile b/libc3/window/Makefile
index f9a3a5b..14505c2 100644
--- a/libc3/window/Makefile
+++ b/libc3/window/Makefile
@@ -47,12 +47,24 @@ debug:
demo: build
if ${HAVE_CAIRO}; then ${MAKE} -C cairo demo; fi
+demo_asan: asan
+ if ${HAVE_CAIRO}; then ${MAKE} -C cairo demo_asan; fi
+
+demo_cov: cov
+ if ${HAVE_CAIRO}; then ${MAKE} -C cairo demo_cov; fi
+
demo_debug: debug
if ${HAVE_CAIRO}; then ${MAKE} -C cairo demo_debug; fi
demo_gl: build
if ${HAVE_SDL2}; then ${MAKE} -C sdl2 demo; fi
+demo_gl_asan: asan
+ if ${HAVE_SDL2}; then ${MAKE} -C sdl2 demo_asan; fi
+
+demo_gl_cov: cov
+ if ${HAVE_SDL2}; then ${MAKE} -C sdl2 demo_cov; fi
+
demo_gl_debug: debug
if ${HAVE_SDL2}; then ${MAKE} -C sdl2 demo_debug; fi
@@ -100,8 +112,19 @@ update_sources:
cov \
debug \
demo \
+ demo_asan \
+ demo_cov \
+ demo_debug \
+ demo_gl \
+ demo_gl_asan \
+ demo_gl_cov \
+ demo_gl_debug \
distclean \
+ gdb_demo \
+ gdb_demo_gl \
install \
+ lldb_demo \
+ lldb_demo_gl \
test \
update_sources
diff --git a/libc3/window/cairo/Makefile b/libc3/window/cairo/Makefile
index b00677a..daf6400 100644
--- a/libc3/window/cairo/Makefile
+++ b/libc3/window/cairo/Makefile
@@ -57,6 +57,12 @@ debug:
demo: build
if ${HAVE_COCOA}; then ${MAKE} -C quartz demo; else if ${HAVE_WIN32}; then ${MAKE} -C win32 demo; else if ${HAVE_XCB}; then ${MAKE} -C xcb demo; fi; fi; fi
+demo_asan: asan
+ if ${HAVE_COCOA}; then ${MAKE} -C quartz demo_asan; else if ${HAVE_WIN32}; then ${MAKE} -C win32 demo_asan; else if ${HAVE_XCB}; then ${MAKE} -C xcb demo_asan; fi; fi; fi
+
+demo_cov: cov
+ if ${HAVE_COCOA}; then ${MAKE} -C quartz demo_cov; else if ${HAVE_WIN32}; then ${MAKE} -C win32 demo_cov; else if ${HAVE_XCB}; then ${MAKE} -C xcb demo_cov; fi; fi; fi
+
demo_debug: debug
if ${HAVE_COCOA}; then ${MAKE} -C quartz demo_debug; else if ${HAVE_WIN32}; then ${MAKE} -C win32 demo_debug; else if ${HAVE_XCB}; then ${MAKE} -C xcb demo_debug; fi; fi; fi
@@ -106,9 +112,13 @@ update_sources:
cov \
debug \
demo \
+ demo_asan \
+ demo_cov \
+ demo_debug \
distclean \
gdb_demo \
install \
+ lldb_demo \
test \
update_sources
diff --git a/libc3/window/cairo/window_cairo.c b/libc3/window/cairo/window_cairo.c
index 67dd84d..8f7823a 100644
--- a/libc3/window/cairo/window_cairo.c
+++ b/libc3/window/cairo/window_cairo.c
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <xkbcommon/xkbcommon.h>
#include <libc3/tag.h>
+#include "../window.h"
#include "window_cairo.h"
void c3_window_cairo_clean (void)
@@ -24,6 +25,11 @@ void c3_window_cairo_init (void)
{
}
+void window_cairo_clean (s_window_cairo *window)
+{
+ window_clean((s_window *) window);
+}
+
s_window_cairo * window_cairo_init (s_window_cairo *window,
sw x, sw y, uw w, uw h,
const s8 *title,
@@ -118,6 +124,7 @@ s_sequence * window_cairo_sequence_init
f_window_cairo_sequence_render render)
{
assert(seq);
+ seq->dt = 0.0;
seq->t = 0.0;
seq->duration = duration;
seq->title = title;
diff --git a/libc3/window/cairo/window_cairo.h b/libc3/window/cairo/window_cairo.h
index 76e03fe..be868c2 100644
--- a/libc3/window/cairo/window_cairo.h
+++ b/libc3/window/cairo/window_cairo.h
@@ -20,18 +20,23 @@
void c3_window_cairo_clean (void);
void c3_window_cairo_init (void);
+/* Stack-allocation compatible functions, call window_cairo_clean
+ after use. */
+void window_cairo_clean (s_window_cairo *window);
s_window_cairo * window_cairo_init (s_window_cairo *window,
sw x, sw y, uw w, uw h,
const s8 *title,
uw sequence_count);
bool window_cairo_run (s_window_cairo *window);
+/* Stack-allocation compatible functions, call sequence_clean
+ after use. */
s_sequence * window_cairo_sequence_init
(s_sequence *sequence, f64 duration, const s8 *title,
f_window_cairo_sequence_load load,
f_window_cairo_sequence_render render);
-/* callbacks */
+/* Callbacks. */
bool window_cairo_button_default (s_window_cairo *window, u8 button,
sw x, sw y);
bool window_cairo_key_default (s_window_cairo *window, uw keysym);
diff --git a/libc3/window/cairo/xcb/Makefile b/libc3/window/cairo/xcb/Makefile
index 69807db..0cfa050 100644
--- a/libc3/window/cairo/xcb/Makefile
+++ b/libc3/window/cairo/xcb/Makefile
@@ -51,6 +51,15 @@ debug:
demo: build
${MAKE} -C demo demo
+demo_asan: asan
+ ${MAKE} -C demo demo_asan
+
+demo_cov: cov
+ ${MAKE} -C demo demo_cov
+
+demo_debug: debug
+ ${MAKE} -C demo demo_debug
+
distclean:
rm -rf ${DISTCLEANFILES}
${MAKE} -C demo distclean
@@ -80,10 +89,14 @@ update_sources:
cov \
debug \
demo \
+ demo_asan \
+ demo_cov \
+ demo_debug \
distclean \
gdb_demo \
gen \
install \
+ lldb_demo \
test \
update_sources
diff --git a/libc3/window/cairo/xcb/demo/Makefile b/libc3/window/cairo/xcb/demo/Makefile
index 6565300..49f6ea1 100644
--- a/libc3/window/cairo/xcb/demo/Makefile
+++ b/libc3/window/cairo/xcb/demo/Makefile
@@ -27,7 +27,8 @@ all:
${MAKE} debug
if ${HAVE_ASAN}; then ${MAKE} asan; fi
-asan: ${PROG_ASAN}
+asan:
+ ${MAKE} ${PROG_ASAN}
clean:
rm -rf ${CLEANFILES}
@@ -35,13 +36,28 @@ clean:
clean_cov:
rm -rf ${CLEANFILES_COV}
-cov: ${PROG_COV}
+cov:
+ ${MAKE} ${PROG_COV}
-debug: ${PROG_DEBUG}
+debug:
+ ${MAKE} ${PROG_DEBUG}
-demo: ${PROG}
+demo:
+ ${MAKE} ${PROG}
time ./${PROG}
+demo_asan:
+ ${MAKE} ${PROG_ASAN}
+ time ./${PROG_ASAN}
+
+demo_cov:
+ ${MAKE} ${PROG_COV}
+ time ./${PROG_COV}
+
+demo_debug:
+ ${MAKE} ${PROG_DEBUG}
+ time ./${PROG_DEBUG}
+
distclean:
rm -rf ${DISTCLEANFILES}
@@ -55,6 +71,12 @@ install:
install -m 755 -d ${prefix}/bin
install -m 755 ${PROG} ${prefix}/bin/${PROG}
+lldb_demo: debug
+ if [ -f ${PROG_DEBUG}.core ]; then lldb .libs/${PROG_DEBUG} ${PROG_DEBUG}.core; else lldb .libs/${PROG_DEBUG}; fi
+
+update_sources:
+ ./update_sources
+
.PHONY: \
all \
asan \
@@ -64,9 +86,14 @@ install:
cov \
debug \
demo \
+ demo_asan \
+ demo_cov \
+ demo_debug \
distclean \
gdb_demo \
- install
+ install \
+ lldb_demo \
+ update_sources \
include config.mk
include sources.mk
diff --git a/libc3/window/cairo/xcb/demo/window_cairo_xcb_demo.c b/libc3/window/cairo/xcb/demo/window_cairo_xcb_demo.c
index 9cf1feb..779d09e 100644
--- a/libc3/window/cairo/xcb/demo/window_cairo_xcb_demo.c
+++ b/libc3/window/cairo/xcb/demo/window_cairo_xcb_demo.c
@@ -38,7 +38,7 @@ int main (int argc, char **argv)
c3_clean(NULL);
return g_c3_exit_code;
}
- c3_window_cairo_clean();
+ window_cairo_clean(&window);
c3_clean(NULL);
return 0;
}
diff --git a/libc3/window/window.c b/libc3/window/window.c
index e95fd38..76d7cc9 100644
--- a/libc3/window/window.c
+++ b/libc3/window/window.c
@@ -42,6 +42,18 @@ bool window_animate (s_window *window)
return true;
}
+void window_clean (s_window *window)
+{
+ uw i;
+ assert(window);
+ i = 0;
+ while (i < window->sequence_count) {
+ sequence_clean(window->sequence + i);
+ i++;
+ }
+ free(window->sequence);
+}
+
bool window_set_sequence_pos (s_window *window, uw sequence_pos)
{
s_sequence *seq;
diff --git a/libc3/window/window.h b/libc3/window/window.h
index 716498f..90338ca 100644
--- a/libc3/window/window.h
+++ b/libc3/window/window.h
@@ -16,6 +16,10 @@
#include <libc3/types.h>
#include "types.h"
+/* Stack-allocation compatible functions, call window_clean
+ after use. */
+void window_clean (s_window *window);
+
bool window_animate (s_window *window);
bool window_set_sequence_pos (s_window *window, uw sequence_pos);