From 619bf2d74ef3e5431cb6057698f324590368122b Mon Sep 17 00:00:00 2001 From: Miller Puckette Date: Thu, 22 May 2008 18:25:27 +0000 Subject: 0.42-0 test 01. No real work yet, just bug fixes and updates. svn path=/trunk/; revision=9867 --- pd/src/x_arithmetic.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'pd/src/x_arithmetic.c') diff --git a/pd/src/x_arithmetic.c b/pd/src/x_arithmetic.c index f64c8cbd..0dd19937 100644 --- a/pd/src/x_arithmetic.c +++ b/pd/src/x_arithmetic.c @@ -623,7 +623,6 @@ static void log_float(t_object *x, t_float f) outlet_float(x->ob_outlet, r); } - static t_class *exp_class; /* ----------- exp --------------- */ static void *exp_new(void) @@ -659,6 +658,20 @@ static void abs_float(t_object *x, t_float f) outlet_float(x->ob_outlet, fabsf(f)); } +static t_class *wrap_class; /* ----------- wrap --------------- */ + +static void *wrap_new(void) +{ + t_object *x = (t_object *)pd_new(wrap_class); + outlet_new(x, &s_float); + return (x); +} + +static void wrap_float(t_object *x, t_float f) +{ + outlet_float(x->ob_outlet, f - floor(f)); +} + /* ------------------------ misc ------------------------ */ static t_class *clip_class; @@ -898,6 +911,11 @@ void x_arithmetic_setup(void) class_addfloat(abs_class, (t_method)abs_float); class_sethelpsymbol(abs_class, math_sym); + wrap_class = class_new(gensym("wrap"), wrap_new, 0, + sizeof(t_object), 0, 0); + class_addfloat(wrap_class, (t_method)wrap_float); + class_sethelpsymbol(wrap_class, math_sym); + /* ------------------------ misc ------------------------ */ clip_setup(); -- cgit v1.2.1