From 22d9ae409b4a0a3489b7ceb2a6349cff5934b1cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 4 Mar 2020 15:35:58 +0100 Subject: [PATCH] multifor: extended libraries with 'define for' --- tests/multifor/Makefile | 37 +++++++++++++++++++++++++++++++++ tests/multifor/multifor-help.pd | 7 +++++++ tests/multifor/multifor-meta.pd | 9 ++++++++ tests/multifor/multiforA.c | 13 ++++++++++++ tests/multifor/multiforB.c | 13 ++++++++++++ 5 files changed, 79 insertions(+) create mode 100644 tests/multifor/Makefile create mode 100644 tests/multifor/multifor-help.pd create mode 100644 tests/multifor/multifor-meta.pd create mode 100644 tests/multifor/multiforA.c create mode 100644 tests/multifor/multiforB.c diff --git a/tests/multifor/Makefile b/tests/multifor/Makefile new file mode 100644 index 0000000..3f44d67 --- /dev/null +++ b/tests/multifor/Makefile @@ -0,0 +1,37 @@ +# Makefile to build class 'multifor' for Pure Data. +# Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build +# settings and rules. + +# library name +lib.name = multifor + +# input source file (class name == source file basename) +class.sources = multiforA.c + +# additional classes +define forLinux + class.sources += multiforB.c +endef +define forDarwin + class.sources += multiforB.c +endef +define forWindows + class.sources += multiforB.c +endef + +# all extra files to be included in binary distribution of the library +datafiles = multifor-help.pd multifor-meta.pd + +# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' +PDLIBBUILDER_DIR=../.. +include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder + +# simplistic tests whether all expected files have been produced/installed +buildcheck: all + test -e multiforA.$(extension) + test -e multiforB.$(extension) +installcheck: install + test -e $(installpath)/multiforA.$(extension) + test -e $(installpath)/multiforB.$(extension) + test -e $(installpath)/multifor-help.pd + test -e $(installpath)/multifor-meta.pd diff --git a/tests/multifor/multifor-help.pd b/tests/multifor/multifor-help.pd new file mode 100644 index 0000000..05d9e93 --- /dev/null +++ b/tests/multifor/multifor-help.pd @@ -0,0 +1,7 @@ +#N canvas 335 160 450 300 12; +#X msg 143 93 7; +#X obj 143 125 multiforA; +#X obj 223 125 multiforB; +#X msg 223 93 12; +#X connect 0 0 1 0; +#X connect 3 0 2 0; diff --git a/tests/multifor/multifor-meta.pd b/tests/multifor/multifor-meta.pd new file mode 100644 index 0000000..2c696e3 --- /dev/null +++ b/tests/multifor/multifor-meta.pd @@ -0,0 +1,9 @@ +#N canvas 966 322 200 200 10; +#N canvas 19 51 420 300 META 0; +#X text 10 10 META this is a prototype of a libdir meta file; +#X text 10 51 AUTHOR IOhannes m zmolnig; +#X text 10 110 VERSION 1.0.0; +#X text 10 90 LICENSE CC0; +#X text 10 70 DESCRIPTION Example "multifor" external.; +#X text 10 30 NAME multifor; +#X restore 10 10 pd META; diff --git a/tests/multifor/multiforA.c b/tests/multifor/multiforA.c new file mode 100644 index 0000000..c52f68c --- /dev/null +++ b/tests/multifor/multiforA.c @@ -0,0 +1,13 @@ +#include +t_class*multiforA_class; +static void multiforA_float(t_object*x, t_float f1) { + pd_error(x, "%s got %f", __FUNCTION__, f1); +} +static void*multiforA_new(void) { + return pd_new(multiforA_class); +} +void multiforA_setup(void) { + post("%s", __FUNCTION__); + multiforA_class = class_new(gensym("multiforA"), multiforA_new, 0, sizeof(t_object), 0, A_NULL); + class_addfloat(multiforA_class, multiforA_float); +} diff --git a/tests/multifor/multiforB.c b/tests/multifor/multiforB.c new file mode 100644 index 0000000..74618ea --- /dev/null +++ b/tests/multifor/multiforB.c @@ -0,0 +1,13 @@ +#include +t_class*multiforB_class; +static void multiforB_float(t_object*x, t_float f1) { + pd_error(x, "%s got %f", __FUNCTION__, f1); +} +static void*multiforB_new(void) { + return pd_new(multiforB_class); +} +void multiforB_setup(void) { + post("%s", __FUNCTION__); + multiforB_class = class_new(gensym("multiforB"), multiforB_new, 0, sizeof(t_object), 0, A_NULL); + class_addfloat(multiforB_class, multiforB_float); +}