From e9a803f42a15025ff8eed59e4ae4d8a8ab3645e0 Mon Sep 17 00:00:00 2001 From: Bryan Jurish Date: Wed, 21 Jan 2009 13:39:15 +0000 Subject: + added mooPdUtils.h and some MOO_UNUSED macros svn path=/trunk/externals/moocow/; revision=10582 --- autoreconf.sh | 18 +++++++++++++----- common/mooPdUtils.h | 18 ++++++++++++++++++ deque/src/Makefile.am | 1 + deque/src/Makefile.in | 1 + deque/src/dsqueue.c | 8 +++++--- deque/src/mooPdUtils.h | 1 + extended/Makefile | 2 +- flite/Makefile.am | 2 +- flite/Makefile.in | 2 +- flite/config/.cvsignore | 1 + flite/flite.c | 5 +++-- flite/mooPdUtils.h | 1 + sprinkler/Makefile.am | 2 +- sprinkler/Makefile.in | 2 +- sprinkler/mooPdUtils.h | 1 + sprinkler/sprinkler.c | 7 ++++--- weightmap/src/Makefile.am | 2 +- weightmap/src/Makefile.in | 2 +- weightmap/src/mooPdUtils.h | 1 + weightmap/src/weightmap.c | 10 ++++------ 20 files changed, 61 insertions(+), 26 deletions(-) create mode 100644 common/mooPdUtils.h create mode 120000 deque/src/mooPdUtils.h create mode 120000 flite/mooPdUtils.h create mode 120000 sprinkler/mooPdUtils.h create mode 120000 weightmap/src/mooPdUtils.h diff --git a/autoreconf.sh b/autoreconf.sh index d5f1a65..e69220e 100755 --- a/autoreconf.sh +++ b/autoreconf.sh @@ -1,15 +1,23 @@ #!/bin/sh +subdirs=(deque flite gfsm pdstring readdir sprinkler weightmap) + if test -n "$*" ; then dirs=("$@") elif test "`basename \"$PWD\"`" = "moocow" ; then - dirs=(deque flite gfsm pdstring readdir sprinkler weightmap) + for d in "${subdirs[@]}"; do + $0 "$d" + done elif test "`basename \"$PWD\"`" = "extended" ; then - dirs=(../deque ../flite ../gfsm ../pdstring ../readdir ../sprinkler ../weightmap) + for d in "${subdirs[@]}"; do + $0 "../$d" + done else dirs=(.) fi -echo "$0: dirs=(${dirs[@]})" -exec autoreconf --install --force --verbose "${dirs[@]}" -#--symlink +if test -n "$dirs"; then + echo "$0: dirs=(${dirs[@]})" + exec autoreconf --install --force --verbose "${dirs[@]}" + #--symlink +fi diff --git a/common/mooPdUtils.h b/common/mooPdUtils.h new file mode 100644 index 0000000..4917e7d --- /dev/null +++ b/common/mooPdUtils.h @@ -0,0 +1,18 @@ +/*=============================================================================*\ + * File: mooPdUtils.h + * Author: Bryan Jurish + * Description: some generic utilities for pd externals + *=============================================================================*/ + +#ifndef _MOO_PD_UTILS_H +#define _MOO_PD_UTILS_H + +/*-- MOO_UNUSED : macro for unused attributes; to avoid compiler warnings */ +#ifdef __GNUC__ +# define MOO_UNUSED __attribute__((unused)) +#else +# define MOO_UNUSED +#endif + + +#endif /* _MOO_PD_UTILS_H */ diff --git a/deque/src/Makefile.am b/deque/src/Makefile.am index 6d30870..25d9982 100644 --- a/deque/src/Makefile.am +++ b/deque/src/Makefile.am @@ -44,6 +44,7 @@ pddoc_DATA = deque-help.pd #----------------------------------------------------------------------- deque_SOURCES = \ + mooPdUtils.h \ squeue.c squeue.h \ dsqueue.c dsqueue.h \ deque.c diff --git a/deque/src/Makefile.in b/deque/src/Makefile.in index 3ae1625..d3d93e9 100644 --- a/deque/src/Makefile.in +++ b/deque/src/Makefile.in @@ -202,6 +202,7 @@ pddoc_DATA = deque-help.pd # sources #----------------------------------------------------------------------- deque_SOURCES = \ + mooPdUtils.h \ squeue.c squeue.h \ dsqueue.c dsqueue.h \ deque.c diff --git a/deque/src/dsqueue.c b/deque/src/dsqueue.c index e328af0..b48916c 100644 --- a/deque/src/dsqueue.c +++ b/deque/src/dsqueue.c @@ -16,6 +16,8 @@ #include "dsqueue.h" #include "squeue.h" +#include "mooPdUtils.h" + /*---------------------------------------------------------------------- * Creation / Deletion *----------------------------------------------------------------------*/ @@ -151,7 +153,7 @@ dsqueue_iter_t dsqueue_iter_last(dsqueue_t *dsq) { /// Returns an iterator for the next datum in the queue, or /// NULL if already at end-of-queue. -dsqueue_iter_t dsqueue_iter_next(dsqueue_t *dsq, dsqueue_iter_t dsqi) { +dsqueue_iter_t dsqueue_iter_next(MOO_UNSUED dsqueue_t *dsq, dsqueue_iter_t dsqi) { while (dsqi.block) { dsqi.sqi = squeue_iter_next(dsqi.block->sq, dsqi.sqi); if (dsqi.sqi) break; @@ -162,7 +164,7 @@ dsqueue_iter_t dsqueue_iter_next(dsqueue_t *dsq, dsqueue_iter_t dsqi) { /// Returns an iterator for the previous datum in the queue, /// or NULL if already at beginning-of-queue. -dsqueue_iter_t dsqueue_iter_prev(dsqueue_t *dsq, dsqueue_iter_t dsqi) { +dsqueue_iter_t dsqueue_iter_prev(MOO_UNSUED dsqueue_t *dsq, dsqueue_iter_t dsqi) { while (dsqi.block) { dsqi.sqi = squeue_iter_prev(dsqi.block->sq, dsqi.sqi); if (dsqi.sqi) break; @@ -172,7 +174,7 @@ dsqueue_iter_t dsqueue_iter_prev(dsqueue_t *dsq, dsqueue_iter_t dsqi) { } /// Returns a true value if p is a valid iterator value, false otherwise. -char dsqueue_iter_valid(dsqueue_t *dsq, dsqueue_iter_t dsqi) { +char dsqueue_iter_valid(MOO_UNSUED dsqueue_t *dsq, dsqueue_iter_t dsqi) { return (dsqi.block && dsqi.sqi && squeue_iter_valid(dsqi.block->sq, dsqi.sqi)); } diff --git a/deque/src/mooPdUtils.h b/deque/src/mooPdUtils.h new file mode 120000 index 0000000..0bb3280 --- /dev/null +++ b/deque/src/mooPdUtils.h @@ -0,0 +1 @@ +../../common/mooPdUtils.h \ No newline at end of file diff --git a/extended/Makefile b/extended/Makefile index 78fd7a5..093e1e8 100644 --- a/extended/Makefile +++ b/extended/Makefile @@ -35,7 +35,7 @@ CONFIGURE_ARGS=\ # --with-pd-extdir="$(MOOCOW_BUILD)/externs" ##-- defaults -CFLAGS ?= -g -O2 +CFLAGS ?= -g -O2 -Wall -Winline -W pd_src ?= $(CURDIR)/../../../pd diff --git a/flite/Makefile.am b/flite/Makefile.am index 5e8bb7b..1cec8f7 100644 --- a/flite/Makefile.am +++ b/flite/Makefile.am @@ -45,7 +45,7 @@ data_DATA = flite-help.pd #----------------------------------------------------------------------- # sources #----------------------------------------------------------------------- -flite_SOURCES = flite.c +flite_SOURCES = flite.c mooPdUtils.h #----------------------------------------------------------------------- # external compilation : flags diff --git a/flite/Makefile.in b/flite/Makefile.in index b0ea121..8c4d25d 100644 --- a/flite/Makefile.in +++ b/flite/Makefile.in @@ -221,7 +221,7 @@ data_DATA = flite-help.pd #----------------------------------------------------------------------- # sources #----------------------------------------------------------------------- -flite_SOURCES = flite.c +flite_SOURCES = flite.c mooPdUtils.h AM_CPPFLAGS = $(DEFS) $(IFLAGS) $(DFLAGS) AM_CFLAGS = $(OFLAGS) $(WFLAGS) $(AFLAGS) flite_LDFLAGS = $(LFLAGS) diff --git a/flite/config/.cvsignore b/flite/config/.cvsignore index 851da47..61ed900 100644 --- a/flite/config/.cvsignore +++ b/flite/config/.cvsignore @@ -4,6 +4,7 @@ *.pd_linux .deps .libs +Makefile autom4te.cache config.log config.status diff --git a/flite/flite.c b/flite/flite.c index a3bb662..3fbefc1 100644 --- a/flite/flite.c +++ b/flite/flite.c @@ -10,6 +10,7 @@ #include +#include "mooPdUtils.h" /* black magic */ #ifdef NT @@ -23,7 +24,7 @@ #include #include -#include "flite/cst_wave.h" +#include /*-------------------------------------------------------------------- * DEBUG @@ -133,7 +134,7 @@ void flite_synth(t_flite *x) { /*-------------------------------------------------------------------- * flite_text : set text-buffer *--------------------------------------------------------------------*/ -void flite_text(t_flite *x, t_symbol *s, int argc, t_atom *argv) { +void flite_text(t_flite *x, MOO_UNUSED t_symbol *s, int argc, t_atom *argv) { int i, alen, buffered; t_symbol *asym; diff --git a/flite/mooPdUtils.h b/flite/mooPdUtils.h new file mode 120000 index 0000000..677b39d --- /dev/null +++ b/flite/mooPdUtils.h @@ -0,0 +1 @@ +../common/mooPdUtils.h \ No newline at end of file diff --git a/sprinkler/Makefile.am b/sprinkler/Makefile.am index af90188..26a718e 100644 --- a/sprinkler/Makefile.am +++ b/sprinkler/Makefile.am @@ -143,7 +143,7 @@ pddoc_DATA = sprinkler-help.pd #----------------------------------------------------------------------- sprinkler_SOURCES = \ - sprinkler.c + sprinkler.c mooPdUtils.h #----------------------------------------------------------------------- # external compilation : flags diff --git a/sprinkler/Makefile.in b/sprinkler/Makefile.in index 57e56c8..ab82719 100644 --- a/sprinkler/Makefile.in +++ b/sprinkler/Makefile.in @@ -266,7 +266,7 @@ pddoc_DATA = sprinkler-help.pd # sources #----------------------------------------------------------------------- sprinkler_SOURCES = \ - sprinkler.c + sprinkler.c mooPdUtils.h AM_CPPFLAGS = $(IFLAGS) $(DFLAGS) AM_CFLAGS = $(OFLAGS) $(WFLAGS) $(AFLAGS) diff --git a/sprinkler/mooPdUtils.h b/sprinkler/mooPdUtils.h new file mode 120000 index 0000000..677b39d --- /dev/null +++ b/sprinkler/mooPdUtils.h @@ -0,0 +1 @@ +../common/mooPdUtils.h \ No newline at end of file diff --git a/sprinkler/sprinkler.c b/sprinkler/sprinkler.c index a6fd458..619f41e 100644 --- a/sprinkler/sprinkler.c +++ b/sprinkler/sprinkler.c @@ -11,7 +11,7 @@ * + formerly 'forward.c' * * - * Copyright (c) 2002,2004 Bryan Jurish. + * Copyright (c) 2002-2009 Bryan Jurish. * * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. @@ -34,6 +34,7 @@ *=============================================================================*/ #include +#include "mooPdUtils.h" /* black magic */ #ifdef NT @@ -144,7 +145,7 @@ static void sprinkler_anything(t_sprinkler *x, t_symbol *dst, int argc, t_atom * outlet_anything(x->x_thru, dst, argc, argv); } -static void sprinkler_list(t_sprinkler *x, t_symbol *s, int argc, t_atom *argv) +static void sprinkler_list(t_sprinkler *x, MOO_UNUSED t_symbol *s, int argc, t_atom *argv) { #ifdef SPRINKLER_DEBUG post("sprinkler_debug : sprinkler_list : argc=%d", argc); @@ -156,7 +157,7 @@ static void sprinkler_list(t_sprinkler *x, t_symbol *s, int argc, t_atom *argv) /*-------------------------------------------------------------------- * newmethod, freemethod */ -void *sprinkler_new(t_symbol *s) +void *sprinkler_new(MOO_UNUSED t_symbol *s) { t_sprinkler *x = (t_sprinkler *)pd_new(sprinkler_class); x->x_thru = outlet_new(&x->x_obj, &s_anything); diff --git a/weightmap/src/Makefile.am b/weightmap/src/Makefile.am index 5d64322..7e6a420 100644 --- a/weightmap/src/Makefile.am +++ b/weightmap/src/Makefile.am @@ -45,7 +45,7 @@ pddoc_DATA = weightmap-help.pd #----------------------------------------------------------------------- weightmap_SOURCES = \ - weightmap.c + weightmap.c mooPdUtils.h #----------------------------------------------------------------------- # external compilation : flags diff --git a/weightmap/src/Makefile.in b/weightmap/src/Makefile.in index 4f70773..48b4353 100644 --- a/weightmap/src/Makefile.in +++ b/weightmap/src/Makefile.in @@ -202,7 +202,7 @@ pddoc_DATA = weightmap-help.pd # sources #----------------------------------------------------------------------- weightmap_SOURCES = \ - weightmap.c + weightmap.c mooPdUtils.h AM_CPPFLAGS = $(IFLAGS) $(DFLAGS) AM_CFLAGS = $(OFLAGS) $(WFLAGS) $(AFLAGS) diff --git a/weightmap/src/mooPdUtils.h b/weightmap/src/mooPdUtils.h new file mode 120000 index 0000000..0bb3280 --- /dev/null +++ b/weightmap/src/mooPdUtils.h @@ -0,0 +1 @@ +../../common/mooPdUtils.h \ No newline at end of file diff --git a/weightmap/src/weightmap.c b/weightmap/src/weightmap.c index 1406ddc..7e33dfd 100644 --- a/weightmap/src/weightmap.c +++ b/weightmap/src/weightmap.c @@ -6,9 +6,7 @@ * * - inspired in part by Yves Degoyon's 'probalizer' object * - - * - * Copyright (c) 2002-2006 Bryan Jurish. + * Copyright (c) 2002-2009 Bryan Jurish. * * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. @@ -32,6 +30,7 @@ #include +#include "mooPdUtils.h" /* black magic */ #ifdef NT @@ -108,7 +107,7 @@ void weightmap_float(t_weightmap *x, t_floatarg f) { /*-------------------------------------------------------------------- * map : set selected values (no resize) *--------------------------------------------------------------------*/ -void weightmap_map(t_weightmap *x, t_symbol *s, int argc, t_atom *argv) { +void weightmap_map(t_weightmap *x, MOO_UNUSED t_symbol *s, int argc, t_atom *argv) { int i, idx; float wt; @@ -154,9 +153,8 @@ void weightmap_zero(t_weightmap *x) { /*-------------------------------------------------------------------- * set : set the entire weight-vector in one go (with possible resize) *--------------------------------------------------------------------*/ -void weightmap_set(t_weightmap *x, t_symbol *s, int argc, t_atom *argv) { +void weightmap_set(t_weightmap *x, MOO_UNUSED t_symbol *s, int argc, t_atom *argv) { int i; - float wt; if (x->x_nvalues != argc) { // set number of elements -- cgit v1.2.1