diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2005-12-21 09:15:20 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2005-12-21 09:15:20 +0000 |
commit | c1d165ffadfd5b254f5b2c8132ca008f7746da14 (patch) | |
tree | 08747b3c05111ab4f8b0f96b67a6fd058206714d | |
parent | aaa2e8470af5e67e13508f89b890823c1d4ae734 (diff) |
removed C99-define-magic for verbose output:
now we just make a static function z_verbose() that calls either verbose() or post()
svn path=/trunk/externals/zexy/; revision=4266
-rw-r--r-- | src/fifop.c | 4 | ||||
-rw-r--r-- | src/index.c | 6 | ||||
-rw-r--r-- | src/lifop.c | 2 | ||||
-rw-r--r-- | src/zexy.h | 22 |
4 files changed, 23 insertions, 11 deletions
diff --git a/src/fifop.c b/src/fifop.c index 308724c..f1c7c2e 100644 --- a/src/fifop.c +++ b/src/fifop.c @@ -106,7 +106,7 @@ static int add2fifo(t_fifop_prioritylist*fifoprio, int argc, t_atom *argv) t_fifop_list*entry=0; if(fifoprio==0){ - error("pfifo: no fifos available"); + error("pfifo: no fifos available"); return -1; } @@ -201,7 +201,7 @@ static void fifop_bang(t_fifop *x) } static void fifop_query(t_fifop*x) { - verbose(1, "%d elements in fifo", (int)x->counter); + z_verbose(1, "%d elements in fifo", (int)x->counter); outlet_float(x->x_infout, (t_float)x->counter); } diff --git a/src/index.c b/src/index.c index 51d19f4..1e8c5dc 100644 --- a/src/index.c +++ b/src/index.c @@ -148,7 +148,7 @@ static void index_add(t_index *x, t_symbol *s, t_float f) if(newentry>0){ newentry--; if(x->names[newentry]){ /* it is already taken! */ - verbose(1, "index :: couldn't add element '%s' at position %d (already taken)", s->s_name, newentry+1); + z_verbose(1, "index :: couldn't add element '%s' at position %d (already taken)", s->s_name, newentry+1); outlet_float(x->x_obj.ob_outlet, -1.f); return; } @@ -163,7 +163,7 @@ static void index_add(t_index *x, t_symbol *s, t_float f) } else error("index :: couldn't find any place for new entry"); } else error("index :: max number of elements (%d) reached !", x->maxentries); - } else verbose(1, "index :: element '%s' already exists", s->s_name); + } else z_verbose(1, "index :: element '%s' already exists", s->s_name); /* couldn't add the symbol to our index table */ outlet_float(x->x_obj.ob_outlet, -1.f); } @@ -190,7 +190,7 @@ static void index_delete(t_index *x, t_symbol *s, int argc, t_atom*argv) x->entries--; outlet_float(x->x_obj.ob_outlet, 0.0); } else { - verbose(1, "index :: couldn't find element"); + z_verbose(1, "index :: couldn't find element"); outlet_float(x->x_obj.ob_outlet, -1.0); } } diff --git a/src/lifop.c b/src/lifop.c index 941ff7d..8d63c63 100644 --- a/src/lifop.c +++ b/src/lifop.c @@ -184,7 +184,7 @@ static void lifop_bang(t_lifop *x) } static void lifop_query(t_lifop*x) { - verbose(1, "%d elements in lifo", (int)x->counter); + z_verbose(1, "%d elements in lifo", (int)x->counter); outlet_float(x->x_infout, (t_float)x->counter); } @@ -43,6 +43,7 @@ /* some defines, which turn on special compile-options * (like parallel-port) * the ifdef is here, to not break the externals/build-system + * (read: build-systems outside of zexy) */ # include "zexyconf.h" #endif @@ -50,6 +51,8 @@ #include "m_pd.h" #include <math.h> +#include <stdarg.h> + #define VERSION "2.1" /* these pragmas are only used for MSVC, not MinGW or Cygwin */ @@ -99,15 +102,24 @@ static void zexy_register(char*object){ static void zexy_register(char*object){} #endif /* ZEXY_LIBRARY */ +static void z_verbose(int level, char*fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + #if (defined PD_MAJOR_VERSION && defined PD_MINOR_VERSION) && (PD_MAJOR_VERSION > 0 || PD_MINOR_VERSION > 38) -/* pd>=0.39 has a verbose() function; older versions don't +/* + * pd>=0.39 has a verbose() function; older versions don't */ + verbose(level, fmt, ap); #else -/* this might not work on compilers other than gcc - * is it ISO-C99 or just a gnu-cpp thing ? - */ -# define verbose(level, format, ...) post(format, ## __VA_ARGS__) + /* + * fall back to a simple post... + */ + post(fmt, ap); #endif + va_end(ap); +} #endif /* INCLUDE_ZEXY_H__ */ |