diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2005-06-02 18:25:00 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2005-06-02 18:25:00 +0000 |
commit | 0c9b89b1018eb7760708ee5b080cd96846861328 (patch) | |
tree | f43a2b20292bba90931fe84e67aca8fb0013a984 /src/iemlib2/wrap.c | |
parent | d56ec9d039c904e9230137254ff2fe281320eed9 (diff) |
updated to release-1.16
svn path=/trunk/externals/iemlib/; revision=3102
Diffstat (limited to 'src/iemlib2/wrap.c')
-rw-r--r-- | src/iemlib2/wrap.c | 136 |
1 files changed, 67 insertions, 69 deletions
diff --git a/src/iemlib2/wrap.c b/src/iemlib2/wrap.c index b594998..69feefc 100644 --- a/src/iemlib2/wrap.c +++ b/src/iemlib2/wrap.c @@ -1,69 +1,67 @@ -/* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. - -iemlib2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2003 */ - -#ifdef NT -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif - -#include "m_pd.h" -#include "iemlib.h" -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <math.h> - -/* ---- wrap - float=int or list of float=symbol concaternat to int=float ----- */ - - - -typedef struct _wrap -{ - t_object x_obj; - float x_f; -} t_wrap; - -static t_class *wrap_class; - -static void wrap_bang(t_wrap *x) -{ - outlet_float(x->x_obj.ob_outlet, x->x_f); -} - -static void wrap_float(t_wrap *x, t_float f) -{ - int i=(int)f; - - if(f > 0.0) - x->x_f = f - (float)i; - else - x->x_f = f - (float)(i - 1); - wrap_bang(x); -} - -static void wrap_list(t_wrap *x, t_symbol *s, int argc, t_atom *argv) -{ - if((argc > 0) && (IS_A_FLOAT(argv, 0))) - wrap_float(x, atom_getfloat(argv)); -} - -static void *wrap_new(void) -{ - t_wrap *x = (t_wrap *)pd_new(wrap_class); - - outlet_new(&x->x_obj, &s_float); - x->x_f = 0.0; - return (x); -} - -void wrap_setup(void) -{ - wrap_class = class_new(gensym("wrap"), (t_newmethod)wrap_new, 0, - sizeof(t_wrap), 0, 0); - class_addbang(wrap_class, (t_method)wrap_bang); - class_addfloat(wrap_class, (t_method)wrap_float); - class_addlist(wrap_class, (t_method)wrap_list); - class_sethelpsymbol(wrap_class, gensym("iemhelp/help-wrap")); -} +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iemlib2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2005 */
+
+#ifdef NT
+#pragma warning( disable : 4244 )
+#pragma warning( disable : 4305 )
+#endif
+
+#include "m_pd.h"
+#include "iemlib.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+/* ------------------------ wrap ----------------- */
+/* -- leave the fractal part of a float message -- */
+
+typedef struct _wrap
+{
+ t_object x_obj;
+ float x_f;
+} t_wrap;
+
+static t_class *wrap_class;
+
+static void wrap_bang(t_wrap *x)
+{
+ outlet_float(x->x_obj.ob_outlet, x->x_f);
+}
+
+static void wrap_float(t_wrap *x, t_float f)
+{
+ int i=(int)f;
+
+ if(f > 0.0)
+ x->x_f = f - (float)i;
+ else
+ x->x_f = f - (float)(i - 1);
+ wrap_bang(x);
+}
+
+static void wrap_list(t_wrap *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if((argc > 0) && (IS_A_FLOAT(argv, 0)))
+ wrap_float(x, atom_getfloat(argv));
+}
+
+static void *wrap_new(void)
+{
+ t_wrap *x = (t_wrap *)pd_new(wrap_class);
+
+ outlet_new(&x->x_obj, &s_float);
+ x->x_f = 0.0;
+ return (x);
+}
+
+void wrap_setup(void)
+{
+ wrap_class = class_new(gensym("wrap"), (t_newmethod)wrap_new, 0,
+ sizeof(t_wrap), 0, 0);
+ class_addbang(wrap_class, (t_method)wrap_bang);
+ class_addfloat(wrap_class, (t_method)wrap_float);
+ class_addlist(wrap_class, (t_method)wrap_list);
+ class_sethelpsymbol(wrap_class, gensym("iemhelp/help-wrap"));
+}
|