aboutsummaryrefslogtreecommitdiff
path: root/src/iemlib2/obsolete
diff options
context:
space:
mode:
authormusil <tmusil@users.sourceforge.net>2006-11-07 17:15:37 +0000
committermusil <tmusil@users.sourceforge.net>2006-11-07 17:15:37 +0000
commitee18c8469c8ca5f458f903f5b5c5b79a7406185d (patch)
treec1b57f39176940ee0c729f3b8d40af49fded68ac /src/iemlib2/obsolete
parentdc2fd29b378aae1597fdc1954da0e01f75816bd4 (diff)
moved tho old *_kernel objects to obsolete folder
new objects handle with proxy inlet svn path=/trunk/externals/iemlib/; revision=6222
Diffstat (limited to 'src/iemlib2/obsolete')
-rw-r--r--src/iemlib2/obsolete/iem_anything_kernel.c148
-rw-r--r--src/iemlib2/obsolete/iem_append_kernel.c350
-rw-r--r--src/iemlib2/obsolete/iem_prepend_kernel.c258
-rw-r--r--src/iemlib2/obsolete/iem_receive_kernel.c155
-rw-r--r--src/iemlib2/obsolete/iem_send_kernel.c140
-rw-r--r--src/iemlib2/obsolete/prepend_kernel.c351
6 files changed, 1402 insertions, 0 deletions
diff --git a/src/iemlib2/obsolete/iem_anything_kernel.c b/src/iemlib2/obsolete/iem_anything_kernel.c
new file mode 100644
index 0000000..d2a675b
--- /dev/null
+++ b/src/iemlib2/obsolete/iem_anything_kernel.c
@@ -0,0 +1,148 @@
+/* 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 _MSC_VER
+#pragma warning( disable : 4244 )
+#pragma warning( disable : 4305 )
+#endif
+
+#include "m_pd.h"
+#include "g_canvas.h"
+#include "iemlib.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <math.h>
+
+EXTERN void canvas_getargs(int *argcp, t_atom **argvp);
+
+/* ------------------------ iem_anything_kernel ---------------------------- */
+
+static t_class *iem_anything_kernel_class;
+
+typedef struct _iem_anything_kernel
+{
+ t_object x_obj;
+ int x_inlet_select;
+ int x_size;
+ int x_ac;
+ t_atom *x_at;
+ t_symbol *x_sym;
+} t_iem_anything_kernel;
+
+static void iem_anything_kernel_atcopy(t_atom *src, t_atom *dst, int n)
+{
+ while(n--)
+ *dst++ = *src++;
+}
+
+static void iem_anything_kernel_inlet_select(t_iem_anything_kernel *x, t_floatarg in_sel_01)
+{
+ x->x_inlet_select = (int)in_sel_01;
+}
+
+static void iem_anything_kernel_anything(t_iem_anything_kernel *x, t_symbol *s, int ac, t_atom *av)
+{
+ if((ac == 0)&&(s == &s_bang))
+ {
+ if(x->x_inlet_select)
+ {
+ x->x_ac = ac;
+ x->x_sym = s;
+ }
+ else
+ outlet_anything(x->x_obj.ob_outlet, x->x_sym, x->x_ac, x->x_at);
+ }
+ else
+ {
+ if(ac > x->x_size)
+ {
+ x->x_at = (t_atom *)resizebytes(x->x_at, x->x_size*sizeof(t_atom), ac*sizeof(t_atom));
+ x->x_size = ac;
+ }
+ x->x_ac = ac;
+ x->x_sym = s;
+ iem_anything_kernel_atcopy(av, x->x_at, ac);
+ if(!x->x_inlet_select)
+ outlet_anything(x->x_obj.ob_outlet, s, ac, av);
+ }
+}
+
+static void iem_anything_kernel_free(t_iem_anything_kernel *x)
+{
+ if(x->x_at)
+ freebytes(x->x_at, x->x_size * sizeof(t_atom));
+}
+
+static void *iem_anything_kernel_new(void)
+{
+ t_iem_anything_kernel *x = (t_iem_anything_kernel *)pd_new(iem_anything_kernel_class);
+ t_glist *glist = (t_glist *)canvas_getcurrent();
+ t_canvas *canvas=glist_getcanvas(glist);
+ int ac=0;
+ t_atom *av;
+
+ canvas_setcurrent(canvas);
+ canvas_getargs(&ac, &av);
+ canvas_unsetcurrent(canvas);
+
+ if(!ac)
+ {
+ x->x_sym = &s_bang;
+ x->x_size = 10;
+ x->x_ac = 0;
+ x->x_at = (t_atom *)getbytes(x->x_size * sizeof(t_atom));
+ }
+ else if(ac == 1)
+ {
+ x->x_size = 10;
+ x->x_at = (t_atom *)getbytes(x->x_size * sizeof(t_atom));
+ if(IS_A_SYMBOL(av,0))
+ {
+ x->x_sym = atom_getsymbol(av);
+ x->x_ac = 0;
+ }
+ else
+ {
+ x->x_sym = &s_list;
+ x->x_ac = 1;
+ x->x_at[0] = *av;
+ }
+ }
+ else /* ac > 1 */
+ {
+ if(IS_A_SYMBOL(av,0))
+ {
+ x->x_sym = atom_getsymbol(av++);
+ ac--;
+ }
+ else
+ x->x_sym = &s_list;
+ if(ac < 10)
+ x->x_size = 10;
+ else
+ x->x_size = ac;
+ x->x_ac = ac;
+ x->x_at = (t_atom *)getbytes(x->x_size * sizeof(t_atom));
+ iem_anything_kernel_atcopy(av, x->x_at, ac);
+ }
+ x->x_inlet_select = 1;
+ outlet_new(&x->x_obj, &s_list);
+ return (x);
+}
+
+void iem_anything_kernel_setup(void)
+{
+ char str[2];
+
+ str[0] = 1;/*inlet-sym = "\0x01"*/
+ str[1] = 0;
+ iem_anything_kernel_class = class_new(gensym("iem_anything_kernel"),
+ (t_newmethod)iem_anything_kernel_new, (t_method)iem_anything_kernel_free,
+ sizeof(t_iem_anything_kernel), 0, 0);
+ class_addmethod(iem_anything_kernel_class, (t_method)iem_anything_kernel_inlet_select, gensym(str), A_FLOAT, 0);
+ class_addanything(iem_anything_kernel_class, iem_anything_kernel_anything);
+ class_sethelpsymbol(iem_anything_kernel_class, gensym("iemhelp/help-iem_anything"));
+}
diff --git a/src/iemlib2/obsolete/iem_append_kernel.c b/src/iemlib2/obsolete/iem_append_kernel.c
new file mode 100644
index 0000000..959a3ab
--- /dev/null
+++ b/src/iemlib2/obsolete/iem_append_kernel.c
@@ -0,0 +1,350 @@
+/* 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 _MSC_VER
+#pragma warning( disable : 4244 )
+#pragma warning( disable : 4305 )
+#endif
+
+#include "m_pd.h"
+#include "g_canvas.h"
+#include "iemlib.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <math.h>
+
+EXTERN void canvas_getargs(int *argcp, t_atom **argvp);
+
+
+/* ------------------------ iem_append_kernel ---------------------------- */
+static t_class *iem_append_kernel_class;
+
+typedef struct _iem_append_kernel
+{
+ t_object x_obj;
+ int x_inlet_select;
+ int x_size12;
+ int x_size2;
+ int x_ac1;
+ int x_ac2;
+ t_atom *x_at12;
+ t_atom *x_at2;
+ t_symbol *x_sym1;
+ t_symbol *x_sym2;
+ t_atomtype x_type1;
+ t_atomtype x_type2;
+} t_iem_append_kernel;
+
+static void iem_append_kernel_atcopy(t_atom *src, t_atom *dst, int n)
+{
+ while(n--)
+ *dst++ = *src++;
+}
+
+static void iem_append_kernel_merge(t_iem_append_kernel *x, int off)
+{
+ if((x->x_ac1+x->x_ac2+1) > x->x_size12)
+ {
+ x->x_at12 = (t_atom *)resizebytes(x->x_at12, x->x_size12*sizeof(t_atom), 2*(x->x_ac1+x->x_ac2+1)*sizeof(t_atom));
+ x->x_size12 = 2*(x->x_ac1+x->x_ac2+1);
+ }
+ if(off)
+ SETSYMBOL(x->x_at12 + x->x_ac1, x->x_sym2);
+ iem_append_kernel_atcopy(x->x_at2, x->x_at12 + x->x_ac1 + off, x->x_ac2);
+}
+
+static void iem_append_kernel_out(t_iem_append_kernel *x)
+{
+ int off=0;
+
+ if(x->x_type1 == A_GIMME)
+ {
+ if(x->x_type2 == A_COMMA)
+ off = 1;
+ else
+ off = 0;
+ iem_append_kernel_merge(x, off);
+ outlet_list(x->x_obj.ob_outlet, &s_list, x->x_ac1+x->x_ac2+off, x->x_at12);
+ }
+ else if(x->x_type1 == A_COMMA)
+ {
+ if(x->x_type2 == A_COMMA)
+ off = 1;
+ else
+ off = 0;
+ iem_append_kernel_merge(x, off);
+ outlet_anything(x->x_obj.ob_outlet, x->x_sym1, x->x_ac1+x->x_ac2+off, x->x_at12);
+ }
+ else if(x->x_type1 == A_NULL)/*depends on 2.part*/
+ {
+ iem_append_kernel_merge(x, 0);
+ if(x->x_type2 == A_GIMME)
+ outlet_list(x->x_obj.ob_outlet, &s_list, x->x_ac2, x->x_at12);
+ else if(x->x_type2 == A_COMMA)
+ outlet_anything(x->x_obj.ob_outlet, x->x_sym2, x->x_ac2, x->x_at12);
+ else if(x->x_type2 == A_FLOAT)
+ outlet_float(x->x_obj.ob_outlet, atom_getfloat(x->x_at12));
+ else if(x->x_type2 == A_SYMBOL)
+ outlet_symbol(x->x_obj.ob_outlet, atom_getsymbol(x->x_at12));
+ else if(x->x_type2 == A_NULL)
+ outlet_bang(x->x_obj.ob_outlet);
+ else if(x->x_type2 == A_POINTER)
+ outlet_pointer(x->x_obj.ob_outlet, (t_gpointer *)x->x_at12->a_w.w_gpointer);
+ }
+ else
+ {
+ if(x->x_type2 == A_COMMA)
+ off = 1;
+ else
+ off = 0;
+ iem_append_kernel_merge(x, off);
+ if(x->x_type2 == A_NULL)
+ {
+ if(x->x_type1 == A_FLOAT)
+ outlet_float(x->x_obj.ob_outlet, atom_getfloat(x->x_at12));
+ else if(x->x_type1 == A_SYMBOL)
+ outlet_symbol(x->x_obj.ob_outlet, atom_getsymbol(x->x_at12));
+ else if(x->x_type1 == A_POINTER)
+ outlet_pointer(x->x_obj.ob_outlet, (t_gpointer *)x->x_at12->a_w.w_gpointer);
+ }
+ else
+ outlet_list(x->x_obj.ob_outlet, &s_list, x->x_ac1+x->x_ac2+off, x->x_at12);
+ }
+}
+
+static void iem_append_kernel_inlet_select(t_iem_append_kernel *x, t_floatarg fin_sel_01)
+{
+ x->x_inlet_select = (int)fin_sel_01;
+}
+
+static void iem_append_kernel_bang(t_iem_append_kernel *x)
+{
+ if(x->x_inlet_select) /* if 2nd inlet */
+ {
+ x->x_ac2 = 0;
+ x->x_type2 = A_NULL;
+ x->x_sym2 = &s_list;
+ }
+ else /* if 1st inlet */
+ {
+ x->x_ac1 = 0;
+ x->x_type1 = A_NULL;
+ iem_append_kernel_out(x);
+ }
+}
+
+static void iem_append_kernel_float(t_iem_append_kernel *x, t_float f)
+{
+ if(x->x_inlet_select) /* if 2nd inlet */
+ {
+ x->x_ac2 = 1;
+ x->x_type2 = A_FLOAT;
+ SETFLOAT(x->x_at2, f);
+ x->x_sym2 = &s_list;
+ }
+ else /* if 1st inlet */
+ {
+ x->x_ac1 = 1;
+ x->x_type1 = A_FLOAT;
+ SETFLOAT(x->x_at12, f);
+ iem_append_kernel_out(x);
+ }
+}
+
+static void iem_append_kernel_symbol(t_iem_append_kernel *x, t_symbol *s)
+{
+ if(x->x_inlet_select) /* if 2nd inlet */
+ {
+ x->x_ac2 = 1;
+ x->x_type2 = A_SYMBOL;
+ SETSYMBOL(x->x_at2, s);
+ x->x_sym2 = &s_list;
+ }
+ else /* if 1st inlet */
+ {
+ x->x_ac1 = 1;
+ x->x_type1 = A_SYMBOL;
+ SETSYMBOL(x->x_at12, s);
+ iem_append_kernel_out(x);
+ }
+}
+
+static void iem_append_kernel_pointer(t_iem_append_kernel *x, t_gpointer *gp)
+{
+ if(x->x_inlet_select) /* if 2nd inlet */
+ {
+ x->x_ac2 = 1;
+ x->x_type2 = A_POINTER;
+ SETPOINTER(x->x_at2, gp);
+ x->x_sym2 = &s_list;
+ }
+ else /* if 1st inlet */
+ {
+ x->x_ac1 = 1;
+ x->x_type1 = A_POINTER;
+ SETPOINTER(x->x_at12, gp);
+ iem_append_kernel_out(x);
+ }
+}
+
+static void iem_append_kernel_list(t_iem_append_kernel *x, t_symbol *s, int ac, t_atom *av)
+{
+ if(x->x_inlet_select) /* if 2nd inlet */
+ {
+ if(ac > x->x_size2)
+ {
+ x->x_at2 = (t_atom *)resizebytes(x->x_at2, x->x_size2*sizeof(t_atom), 2*ac*sizeof(t_atom));
+ x->x_size2 = 2*ac;
+ }
+ x->x_ac2 = ac;
+ x->x_type2 = A_GIMME;
+ x->x_sym2 = &s_list;
+ iem_append_kernel_atcopy(av, x->x_at2, ac);
+ }
+ else /* if 1st inlet */
+ {
+ if((x->x_size2+ac) > x->x_size12)
+ {
+ x->x_at12 = (t_atom *)resizebytes(x->x_at12, x->x_size12*sizeof(t_atom), 2*(x->x_size2+ac)*sizeof(t_atom));
+ x->x_size12 = 2*(x->x_size2+ac);
+ }
+ x->x_ac1 = ac;
+ x->x_type1 = A_GIMME;
+ iem_append_kernel_atcopy(av, x->x_at12, ac);
+ x->x_sym1 = &s_list;
+ iem_append_kernel_out(x);
+ }
+}
+
+static void iem_append_kernel_anything(t_iem_append_kernel *x, t_symbol *s, int ac, t_atom *av)
+{
+ if(x->x_inlet_select) /* if 2nd inlet */
+ {
+ if((ac+1) > x->x_size2)
+ {
+ x->x_at2 = (t_atom *)resizebytes(x->x_at2, x->x_size2*sizeof(t_atom), 2*ac*sizeof(t_atom));
+ x->x_size2 = 2*ac;
+ }
+ x->x_ac2 = ac;
+ x->x_type2 = A_COMMA;
+ x->x_sym2 = s;
+ iem_append_kernel_atcopy(av, x->x_at2, ac);
+ }
+ else /* if 1st inlet */
+ {
+ if((x->x_size2+ac+1) > x->x_size12)
+ {
+ x->x_at12 = (t_atom *)resizebytes(x->x_at12, x->x_size12*sizeof(t_atom), 2*(x->x_size2+ac+1)*sizeof(t_atom));
+ x->x_size12 = 2*(x->x_size2+ac+1);
+ }
+ x->x_ac1 = ac;
+ x->x_type1 = A_COMMA;
+ iem_append_kernel_atcopy(av, x->x_at12, ac);
+ x->x_sym1 = s;
+ iem_append_kernel_out(x);
+ }
+}
+
+static void iem_append_kernel_free(t_iem_append_kernel *x)
+{
+ if(x->x_at12)
+ freebytes(x->x_at12, x->x_size12 * sizeof(t_atom));
+ if(x->x_at2)
+ freebytes(x->x_at2, x->x_size2 * sizeof(t_atom));
+}
+
+static void *iem_append_kernel_new(void)
+{
+ t_iem_append_kernel *x = (t_iem_append_kernel *)pd_new(iem_append_kernel_class);
+ t_glist *glist = (t_glist *)canvas_getcurrent();
+ t_canvas *canvas=glist_getcanvas(glist);
+ int ac=0;
+ t_atom *av;
+
+ canvas_setcurrent(canvas);
+ canvas_getargs(&ac, &av);
+ canvas_unsetcurrent(canvas);
+
+ x->x_type1 = A_NULL;
+ x->x_sym1 = &s_list;
+ x->x_size2 = 10;
+ if(ac > 5)
+ x->x_size2 = 2*ac;
+ x->x_at2 = (t_atom *)getbytes(x->x_size2 * sizeof(t_atom));
+ x->x_size12 = x->x_size2 + 10;
+ x->x_at12 = (t_atom *)getbytes(x->x_size12 * sizeof(t_atom));
+ x->x_ac1 = 0;
+ x->x_inlet_select = 1;
+ if(ac <= 0)
+ {
+ x->x_type2 = A_NULL;
+ x->x_ac2 = 0;
+ x->x_sym2 = &s_list;
+ }
+ else
+ {
+ if(IS_A_FLOAT(av, 0))
+ {
+ if(ac == 1)
+ iem_append_kernel_float(x, atom_getfloat(av));
+ else
+ iem_append_kernel_list(x, &s_list, ac, av);
+ }
+ else if(IS_A_SYMBOL(av, 0))
+ {
+ t_symbol *xsym=atom_getsymbol(av);
+
+ if(xsym == gensym("symbol"))
+ {
+ if(ac > 1)
+ iem_append_kernel_symbol(x, atom_getsymbol(av+1));
+ else
+ iem_append_kernel_symbol(x, gensym(""));
+ }
+ else if(xsym == gensym("float"))
+ {
+ if(ac > 1)
+ {
+ if(IS_A_FLOAT(av, 1))
+ iem_append_kernel_float(x, atom_getfloat(av+1));
+ else
+ iem_append_kernel_float(x, 0.0f);
+ }
+ else
+ iem_append_kernel_float(x, 0.0f);
+ }
+ else if(xsym == gensym("list"))
+ {
+ iem_append_kernel_list(x, &s_list, ac-1, av+1);
+ }
+ else
+ {
+ iem_append_kernel_anything(x, xsym, ac-1, av+1);
+ }
+ }
+ }
+ outlet_new(&x->x_obj, &s_list);
+ return (x);
+}
+
+void iem_append_kernel_setup(void)
+{
+ char str[2];
+
+ str[0] = 1;
+ str[1] = 0;
+ iem_append_kernel_class = class_new(gensym("iem_append_kernel"),
+ (t_newmethod)iem_append_kernel_new, (t_method)iem_append_kernel_free,
+ sizeof(t_iem_append_kernel), 0, 0);
+ class_addbang(iem_append_kernel_class, (t_method)iem_append_kernel_bang);
+ class_addpointer(iem_append_kernel_class, iem_append_kernel_pointer);
+ class_addfloat(iem_append_kernel_class, (t_method)iem_append_kernel_float);
+ class_addsymbol(iem_append_kernel_class, iem_append_kernel_symbol);
+ class_addlist(iem_append_kernel_class, iem_append_kernel_list);
+ class_addmethod(iem_append_kernel_class, (t_method)iem_append_kernel_inlet_select, gensym(str), A_FLOAT, 0);
+ class_addanything(iem_append_kernel_class, iem_append_kernel_anything);
+ class_sethelpsymbol(iem_append_kernel_class, gensym("iemhelp/help-merge_any"));
+}
diff --git a/src/iemlib2/obsolete/iem_prepend_kernel.c b/src/iemlib2/obsolete/iem_prepend_kernel.c
new file mode 100644
index 0000000..8f899d2
--- /dev/null
+++ b/src/iemlib2/obsolete/iem_prepend_kernel.c
@@ -0,0 +1,258 @@
+/* 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 - 2004 */
+
+#ifdef _MSC_VER
+#pragma warning( disable : 4244 )
+#pragma warning( disable : 4305 )
+#endif
+
+#include "m_pd.h"
+#include "g_canvas.h"
+#include "iemlib.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <math.h>
+
+EXTERN void canvas_getargs(int *argcp, t_atom **argvp);
+
+
+/* ------------------------ iem_prepend_kernel ---------------------------- */
+static t_class *iem_prepend_kernel_class;
+
+typedef struct _iem_prepend_kernel
+{
+ t_object x_obj;
+ int x_inlet_select;
+ int x_size;
+ int x_ac;
+ t_atom *x_at;
+ t_symbol *x_sym;
+ t_atomtype x_type;
+} t_iem_prepend_kernel;
+
+static void iem_prepend_kernel_atcopy(t_atom *src, t_atom *dst, int n)
+{
+ while(n--)
+ *dst++ = *src++;
+}
+
+static void iem_prepend_kernel_inlet_select(t_iem_prepend_kernel *x, t_floatarg fin_sel_01)
+{
+ x->x_inlet_select = (int)fin_sel_01;
+}
+
+static void iem_prepend_kernel_bang(t_iem_prepend_kernel *x)
+{
+ if(x->x_inlet_select) /* if 2nd inlet */
+ {
+ x->x_ac = 0;
+ x->x_type = A_NULL;
+ x->x_sym = &s_bang;
+ }
+ else /* if 1st inlet */
+ {
+ outlet_anything(x->x_obj.ob_outlet, x->x_sym, x->x_ac, x->x_at);
+ }
+}
+
+static void iem_prepend_kernel_float(t_iem_prepend_kernel *x, t_float f)
+{
+ if(x->x_inlet_select) /* if 2nd inlet */
+ {
+ x->x_ac = 1;
+ x->x_type = A_FLOAT;
+ SETFLOAT(x->x_at, f);
+ x->x_sym = &s_list;
+ }
+ else /* if 1st inlet */
+ {
+ if(x->x_type == A_NULL)
+ {
+ outlet_float(x->x_obj.ob_outlet, f);
+ }
+ else
+ {
+ SETFLOAT(x->x_at+x->x_ac, f);
+ outlet_anything(x->x_obj.ob_outlet, x->x_sym, x->x_ac+1, x->x_at);
+ }
+ }
+}
+
+static void iem_prepend_kernel_symbol(t_iem_prepend_kernel *x, t_symbol *s)
+{
+ if(x->x_inlet_select) /* if 2nd inlet */
+ {
+ x->x_ac = 1;
+ x->x_type = A_SYMBOL;
+ SETSYMBOL(x->x_at, s);
+ x->x_sym = &s_list;
+ }
+ else /* if 1st inlet */
+ {
+ if(x->x_type == A_NULL)
+ {
+ outlet_symbol(x->x_obj.ob_outlet, s);
+ }
+ else
+ {
+ SETSYMBOL(x->x_at+x->x_ac, s);
+ outlet_anything(x->x_obj.ob_outlet, x->x_sym, x->x_ac+1, x->x_at);
+ }
+ }
+}
+
+static void iem_prepend_kernel_pointer(t_iem_prepend_kernel *x, t_gpointer *gp)
+{
+ if(x->x_inlet_select) /* if 2nd inlet */
+ {
+ x->x_ac = 1;
+ x->x_type = A_POINTER;
+ SETPOINTER(x->x_at, gp);
+ x->x_sym = &s_list;
+ }
+ else /* if 1st inlet */
+ {
+ if(x->x_type == A_NULL)
+ {
+ outlet_pointer(x->x_obj.ob_outlet, gp);
+ }
+ else
+ {
+ SETPOINTER(x->x_at+x->x_ac, gp);
+ outlet_anything(x->x_obj.ob_outlet, x->x_sym, x->x_ac+1, x->x_at);
+ }
+ }
+}
+
+static void iem_prepend_kernel_list(t_iem_prepend_kernel *x, t_symbol *s, int ac, t_atom *av)
+{
+ if(x->x_inlet_select) /* if 2nd inlet */
+ {
+ if((ac+10) > x->x_size)
+ {
+ x->x_at = (t_atom *)resizebytes(x->x_at, x->x_size*sizeof(t_atom), 2*(ac+10)*sizeof(t_atom));
+ x->x_size = 2*(ac+10);
+ }
+ x->x_ac = ac;
+ x->x_type = A_GIMME;
+ x->x_sym = &s_list;
+ iem_prepend_kernel_atcopy(av, x->x_at, ac);
+ }
+ else /* if 1st inlet */
+ {
+ if((ac+x->x_ac+1) > x->x_size)
+ {
+ x->x_at = (t_atom *)resizebytes(x->x_at, x->x_size*sizeof(t_atom), 2*(ac+x->x_ac+1)*sizeof(t_atom));
+ x->x_size = 2*(ac+x->x_ac+1);
+ }
+ if(x->x_type == A_NULL)
+ {
+ outlet_anything(x->x_obj.ob_outlet, &s_list, ac, av);
+ }
+ else
+ {
+ iem_prepend_kernel_atcopy(av, x->x_at + x->x_ac, ac);
+ outlet_anything(x->x_obj.ob_outlet, x->x_sym, x->x_ac+ac, x->x_at);
+ }
+ }
+}
+
+static void iem_prepend_kernel_anything(t_iem_prepend_kernel *x, t_symbol *s, int ac, t_atom *av)
+{
+ if(x->x_inlet_select) /* if 2nd inlet */
+ {
+ if((ac+10) > x->x_size)
+ {
+ x->x_at = (t_atom *)resizebytes(x->x_at, x->x_size*sizeof(t_atom), 2*(ac+10)*sizeof(t_atom));
+ x->x_size = 2*(ac+10);
+ }
+ x->x_ac = ac;
+ x->x_type = A_COMMA;
+ x->x_sym = s;
+ iem_prepend_kernel_atcopy(av, x->x_at, ac);
+ }
+ else /* if 1st inlet */
+ {
+ if((ac+x->x_ac+1) > x->x_size)
+ {
+ x->x_at = (t_atom *)resizebytes(x->x_at, x->x_size*sizeof(t_atom), 2*(ac+x->x_ac+1)*sizeof(t_atom));
+ x->x_size = 2*(ac+x->x_ac+1);
+ }
+ if(x->x_type == A_NULL)
+ {
+ outlet_anything(x->x_obj.ob_outlet, s, ac, av);
+ }
+ else
+ {
+ SETSYMBOL(x->x_at + x->x_ac, s);
+ iem_prepend_kernel_atcopy(av, x->x_at+x->x_ac+1, ac);
+ outlet_anything(x->x_obj.ob_outlet, x->x_sym, x->x_ac+ac+1, x->x_at);
+ }
+ }
+}
+
+static void iem_prepend_kernel_free(t_iem_prepend_kernel *x)
+{
+ if(x->x_at)
+ freebytes(x->x_at, x->x_size * sizeof(t_atom));
+}
+
+static void *iem_prepend_kernel_new(void)
+{
+ t_iem_prepend_kernel *x = (t_iem_prepend_kernel *)pd_new(iem_prepend_kernel_class);
+ t_glist *glist = (t_glist *)canvas_getcurrent();
+ t_canvas *canvas=glist_getcanvas(glist);
+ int ac=0;
+ t_atom *av;
+
+ canvas_setcurrent(canvas);
+ canvas_getargs(&ac, &av);
+ canvas_unsetcurrent(canvas);
+
+ x->x_size = 30;
+ if(ac > 5)
+ x->x_size = 2*(ac+10);
+ x->x_at = (t_atom *)getbytes(x->x_size * sizeof(t_atom));
+ x->x_inlet_select = 1;
+ if(ac <= 0)
+ {
+ x->x_type = A_NULL;
+ x->x_ac = 0;
+ x->x_sym = &s_bang;
+ }
+ else
+ {
+ if(IS_A_FLOAT(av, 0))
+ {
+ iem_prepend_kernel_list(x, &s_list, ac, av);
+ }
+ else if(IS_A_SYMBOL(av, 0))
+ {
+ iem_prepend_kernel_anything(x, atom_getsymbol(av), ac-1, av+1);
+ }
+ }
+ outlet_new(&x->x_obj, &s_list);
+ return(x);
+}
+
+void iem_prepend_kernel_setup(void)
+{
+ char str[2];
+
+ str[0] = 1;
+ str[1] = 0;
+ iem_prepend_kernel_class = class_new(gensym("iem_prepend_kernel"),
+ (t_newmethod)iem_prepend_kernel_new, (t_method)iem_prepend_kernel_free,
+ sizeof(t_iem_prepend_kernel), 0, 0);
+ class_addbang(iem_prepend_kernel_class, (t_method)iem_prepend_kernel_bang);
+ class_addpointer(iem_prepend_kernel_class, iem_prepend_kernel_pointer);
+ class_addfloat(iem_prepend_kernel_class, (t_method)iem_prepend_kernel_float);
+ class_addsymbol(iem_prepend_kernel_class, iem_prepend_kernel_symbol);
+ class_addlist(iem_prepend_kernel_class, iem_prepend_kernel_list);
+ class_addmethod(iem_prepend_kernel_class, (t_method)iem_prepend_kernel_inlet_select, gensym(str), A_FLOAT, 0);
+ class_addanything(iem_prepend_kernel_class, iem_prepend_kernel_anything);
+ class_sethelpsymbol(iem_prepend_kernel_class, gensym("iemhelp/help-merge_any"));
+}
diff --git a/src/iemlib2/obsolete/iem_receive_kernel.c b/src/iemlib2/obsolete/iem_receive_kernel.c
new file mode 100644
index 0000000..bc0d642
--- /dev/null
+++ b/src/iemlib2/obsolete/iem_receive_kernel.c
@@ -0,0 +1,155 @@
+/* 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 - 2004 */
+
+#ifdef _MSC_VER
+#pragma warning( disable : 4244 )
+#pragma warning( disable : 4305 )
+#endif
+
+#include "m_pd.h"
+#include "g_canvas.h"
+#include "iemlib.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <math.h>
+
+EXTERN void canvas_getargs(int *argcp, t_atom **argvp);
+
+/* ------------------------ iem_receive_kernel ---------------------------- */
+
+static t_class *iem_receive_kernel_class;
+
+typedef struct _iem_receive_kernel
+{
+ t_object x_obj;
+ t_symbol *x_sym;
+} t_iem_receive_kernel;
+
+void iem_receive_kernel_copy_at(t_atom *src, t_atom *dst, int n)
+{
+ while(n--)
+ *dst++ = *src++;
+}
+
+static void iem_receive_kernel_set_name(t_iem_receive_kernel *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if((argc > 0)&&((IS_A_SYMBOL(argv,0))||(IS_A_FLOAT(argv,0))))
+ {
+ if(x->x_sym)
+ pd_unbind(&x->x_obj.ob_pd, x->x_sym);
+ if(IS_A_SYMBOL(argv,0))
+ x->x_sym = atom_getsymbol(argv);
+ else if(IS_A_FLOAT(argv,0))
+ {
+ char str[100];
+
+ sprintf(str, "%g", atom_getfloat(argv));
+ x->x_sym = gensym(str);
+ }
+ pd_bind(&x->x_obj.ob_pd, x->x_sym);
+ }
+}
+
+static void iem_receive_kernel_clear(t_iem_receive_kernel *x)
+{
+ if(x->x_sym)
+ pd_unbind(&x->x_obj.ob_pd, x->x_sym);
+ x->x_sym = 0;
+}
+
+static void iem_receive_kernel_bang(t_iem_receive_kernel *x)
+{
+ outlet_bang(x->x_obj.ob_outlet);
+}
+
+static void iem_receive_kernel_float(t_iem_receive_kernel *x, t_float f)
+{
+ outlet_float(x->x_obj.ob_outlet, f);
+}
+
+static void iem_receive_kernel_symbol(t_iem_receive_kernel *x, t_symbol *s)
+{
+ outlet_symbol(x->x_obj.ob_outlet, s);
+}
+
+static void iem_receive_kernel_pointer(t_iem_receive_kernel *x, t_gpointer *gp)
+{
+ outlet_pointer(x->x_obj.ob_outlet, gp);
+}
+
+static void iem_receive_kernel_list(t_iem_receive_kernel *x, t_symbol *s, int argc, t_atom *argv)
+{
+ outlet_list(x->x_obj.ob_outlet, &s_list, argc, argv);
+}
+
+static void iem_receive_kernel_anything(t_iem_receive_kernel *x, t_symbol *s, int argc, t_atom *argv)
+{
+ outlet_anything(x->x_obj.ob_outlet, s, argc, argv);
+}
+
+static void iem_receive_kernel_free(t_iem_receive_kernel *x)
+{
+ if(x->x_sym)
+ pd_unbind(&x->x_obj.ob_pd, x->x_sym);
+}
+
+static void *iem_receive_kernel_new(void)
+{
+ t_iem_receive_kernel *x = (t_iem_receive_kernel *)pd_new(iem_receive_kernel_class);
+ t_glist *glist = (t_glist *)canvas_getcurrent();
+ t_canvas *canvas=glist_getcanvas(glist);
+ int ac=0;
+ t_atom *av;
+
+ canvas_setcurrent(canvas);
+ canvas_getargs(&ac, &av);
+ canvas_unsetcurrent(canvas);
+
+ if(ac > 0)
+ {
+ if(IS_A_SYMBOL(av,0))
+ {
+ x->x_sym = atom_getsymbol(av);
+ pd_bind(&x->x_obj.ob_pd, x->x_sym);
+ }
+ else if(IS_A_FLOAT(av,0))
+ {
+ char str[100];
+
+ sprintf(str, "%g", atom_getfloat(av));
+ x->x_sym = gensym(str);
+ pd_bind(&x->x_obj.ob_pd, x->x_sym);
+ }
+ else
+ x->x_sym = 0;
+ }
+ else
+ x->x_sym = 0;
+
+ outlet_new(&x->x_obj, &s_list);
+ return (x);
+}
+
+void iem_receive_kernel_setup(void)
+{
+ char str[2];
+
+ str[1] = 0;
+ iem_receive_kernel_class = class_new(gensym("iem_receive_kernel"), (t_newmethod)iem_receive_kernel_new,
+ (t_method)iem_receive_kernel_free, sizeof(t_iem_receive_kernel), 0, 0);
+ class_addbang(iem_receive_kernel_class, iem_receive_kernel_bang);
+ class_addfloat(iem_receive_kernel_class, iem_receive_kernel_float);
+ class_addsymbol(iem_receive_kernel_class, iem_receive_kernel_symbol);
+ class_addpointer(iem_receive_kernel_class, iem_receive_kernel_pointer);
+ class_addlist(iem_receive_kernel_class, iem_receive_kernel_list);
+ class_addanything(iem_receive_kernel_class, iem_receive_kernel_anything);
+ // class_addmethod(iem_receive_kernel_class, (t_method)iem_receive_kernel_set, gensym("set"), A_GIMME, 0);
+ str[0] = 1;/*inlet-sym = "\0x01"*/
+ class_addmethod(iem_receive_kernel_class, (t_method)iem_receive_kernel_set_name, gensym(str), A_GIMME, 0);
+ str[0] = 2;/*inlet-sym = "\0x02"*/
+ class_addmethod(iem_receive_kernel_class, (t_method)iem_receive_kernel_clear, gensym(str), 0);
+ class_sethelpsymbol(iem_receive_kernel_class, gensym("iemhelp/help-iem_receive"));
+}
diff --git a/src/iemlib2/obsolete/iem_send_kernel.c b/src/iemlib2/obsolete/iem_send_kernel.c
new file mode 100644
index 0000000..72a1a7b
--- /dev/null
+++ b/src/iemlib2/obsolete/iem_send_kernel.c
@@ -0,0 +1,140 @@
+/* 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 - 2004 */
+
+#ifdef _MSC_VER
+#pragma warning( disable : 4244 )
+#pragma warning( disable : 4305 )
+#endif
+
+#include "m_pd.h"
+#include "g_canvas.h"
+#include "iemlib.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <math.h>
+
+EXTERN void canvas_getargs(int *argcp, t_atom **argvp);
+
+/* -------------------- iem_send_kernel ------------------------------ */
+
+static t_class *iem_send_kernel_class;
+
+typedef struct _iem_send_kernel
+{
+ t_object x_obj;
+ t_symbol *x_sym;
+} t_iem_send_kernel;
+
+static void iem_send_kernel_set_name(t_iem_send_kernel *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if((argc > 0)&&((IS_A_SYMBOL(argv,0))||(IS_A_FLOAT(argv,0))))
+ {
+ if(IS_A_SYMBOL(argv,0))
+ x->x_sym = atom_getsymbol(argv);
+ else if(IS_A_FLOAT(argv,0))
+ {
+ char str[100];
+
+ sprintf(str, "%g", atom_getfloat(argv));
+ x->x_sym = gensym(str);
+ }
+ }
+}
+
+static void iem_send_kernel_clear(t_iem_send_kernel *x)
+{
+ x->x_sym = 0;
+}
+
+static void iem_send_kernel_bang(t_iem_send_kernel *x)
+{
+ if(x->x_sym->s_thing)
+ pd_bang(x->x_sym->s_thing);
+}
+
+static void iem_send_kernel_float(t_iem_send_kernel *x, t_float f)
+{
+ if(x->x_sym->s_thing)
+ pd_float(x->x_sym->s_thing, f);
+}
+
+static void iem_send_kernel_symbol(t_iem_send_kernel *x, t_symbol *s)
+{
+ if(x->x_sym->s_thing)
+ pd_symbol(x->x_sym->s_thing, s);
+}
+
+static void iem_send_kernel_pointer(t_iem_send_kernel *x, t_gpointer *gp)
+{
+ if(x->x_sym->s_thing)
+ pd_pointer(x->x_sym->s_thing, gp);
+}
+
+static void iem_send_kernel_list(t_iem_send_kernel *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(x->x_sym->s_thing)
+ pd_list(x->x_sym->s_thing, s, argc, argv);
+}
+
+static void iem_send_kernel_anything(t_iem_send_kernel *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(x->x_sym->s_thing)
+ typedmess(x->x_sym->s_thing, s, argc, argv);
+}
+
+static void *iem_send_kernel_new(void)
+{
+ t_iem_send_kernel *x = (t_iem_send_kernel *)pd_new(iem_send_kernel_class);
+ t_glist *glist = (t_glist *)canvas_getcurrent();
+ t_canvas *canvas=glist_getcanvas(glist);
+ int ac=0;
+ t_atom *av;
+
+ canvas_setcurrent(canvas);
+ canvas_getargs(&ac, &av);
+ canvas_unsetcurrent(canvas);
+
+ if(ac > 0)
+ {
+ if(IS_A_SYMBOL(av,0))
+ {
+ x->x_sym = atom_getsymbol(av);
+ }
+ else if(IS_A_FLOAT(av,0))
+ {
+ char str[100];
+
+ sprintf(str, "%g", atom_getfloat(av));
+ x->x_sym = gensym(str);
+ }
+ else
+ x->x_sym = 0;
+ }
+ else
+ x->x_sym = 0;
+ return (x);
+}
+
+void iem_send_kernel_setup(void)
+{
+ char str[2];
+
+ str[1] = 0;
+ iem_send_kernel_class = class_new(gensym("iem_send_kernel"), (t_newmethod)iem_send_kernel_new, 0,
+ sizeof(t_iem_send_kernel), 0, 0);
+ class_addcreator((t_newmethod)iem_send_kernel_new, gensym("s"), A_DEFSYM, 0);
+ class_addbang(iem_send_kernel_class, iem_send_kernel_bang);
+ class_addfloat(iem_send_kernel_class, iem_send_kernel_float);
+ class_addsymbol(iem_send_kernel_class, iem_send_kernel_symbol);
+ class_addpointer(iem_send_kernel_class, iem_send_kernel_pointer);
+ class_addlist(iem_send_kernel_class, iem_send_kernel_list);
+ class_addanything(iem_send_kernel_class, iem_send_kernel_anything);
+ str[0] = 1;/*inlet-sym = "\0x01"*/
+ class_addmethod(iem_send_kernel_class, (t_method)iem_send_kernel_set_name, gensym(str), A_GIMME, 0);
+ str[0] = 2;/*inlet-sym = "\0x02"*/
+ class_addmethod(iem_send_kernel_class, (t_method)iem_send_kernel_clear, gensym(str), 0);
+ class_sethelpsymbol(iem_send_kernel_class, gensym("iemhelp/help-iem_send"));
+}
diff --git a/src/iemlib2/obsolete/prepend_kernel.c b/src/iemlib2/obsolete/prepend_kernel.c
new file mode 100644
index 0000000..a26780b
--- /dev/null
+++ b/src/iemlib2/obsolete/prepend_kernel.c
@@ -0,0 +1,351 @@
+/* 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 - 2004 */
+
+#ifdef _MSC_VER
+#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>
+
+
+/* ------------------------ prepend_kernel ---------------------------- */
+static t_class *prepend_kernel_class;
+
+typedef struct _prepend_kernel
+{
+ t_object x_obj;
+ int x_inlet_select;
+ int x_size12;
+ int x_size1;
+ int x_size2;
+ int x_ac1;
+ int x_ac2;
+ t_atom *x_at12;
+ t_atom *x_at1;
+ t_atom *x_at2;
+ t_symbol *x_sym1;
+ t_symbol *x_sym2;
+ t_atomtype x_type1;
+ t_atomtype x_type2;
+} t_prepend_kernel;
+
+static void prepend_kernel_atcopy(t_atom *src, t_atom *dst, int n)
+{
+ while(n--)
+ *dst++ = *src++;
+}
+
+static void prepend_kernel_merge(t_prepend_kernel *x, int off)
+{
+ if((x->x_ac1+x->x_ac2) > x->x_size1)
+ {
+ x->x_at1 = (t_atom *)resizebytes(x->x_at1, x->x_size1*sizeof(t_atom), 2*(x->x_ac1+x->x_ac2)*sizeof(t_atom));
+ x->x_size1 = 2*(x->x_ac1+x->x_ac2);
+ }
+ if(off)
+ SETSYMBOL(x->x_at1 + x->x_ac1, x->x_sym2);
+ prepend_kernel_atcopy(x->x_at2, x->x_at1 + x->x_ac1 + off, x->x_ac2);
+}
+
+static void prepend_kernel_out(t_prepend_kernel *x)
+{
+ int off=0;
+
+ if(x->x_type1 == A_GIMME)
+ {
+ if(x->x_type2 == A_COMMA)
+ off = 1;
+ else
+ off = 0;
+ prepend_kernel_merge(x, off);
+ outlet_list(x->x_obj.ob_outlet, &s_list, x->x_ac1+x->x_ac2+off, x->x_at1);
+ }
+ else if(x->x_type1 == A_COMMA)
+ {
+ if(x->x_type2 == A_COMMA)
+ off = 1;
+ else
+ off = 0;
+ prepend_kernel_merge(x, off);
+ outlet_anything(x->x_obj.ob_outlet, x->x_sym1, x->x_ac1+x->x_ac2+off, x->x_at1);
+ }
+ else if(x->x_type1 == A_NULL)/*depends on 2.part*/
+ {
+ prepend_kernel_merge(x, 0);
+ if(x->x_type2 == A_GIMME)
+ outlet_list(x->x_obj.ob_outlet, &s_list, x->x_ac2, x->x_at1);
+ else if(x->x_type2 == A_COMMA)
+ outlet_anything(x->x_obj.ob_outlet, x->x_sym2, x->x_ac2, x->x_at1);
+ else if(x->x_type2 == A_FLOAT)
+ outlet_float(x->x_obj.ob_outlet, atom_getfloat(x->x_at1));
+ else if(x->x_type2 == A_SYMBOL)
+ outlet_symbol(x->x_obj.ob_outlet, atom_getsymbol(x->x_at1));
+ else if(x->x_type2 == A_NULL)
+ outlet_bang(x->x_obj.ob_outlet);
+ else if(x->x_type2 == A_POINTER)
+ outlet_pointer(x->x_obj.ob_outlet, (t_gpointer *)x->x_at1->a_w.w_gpointer);
+ }
+ else
+ {
+ if(x->x_type2 == A_COMMA)
+ off = 1;
+ else
+ off = 0;
+ prepend_kernel_merge(x, off);
+ if(x->x_type2 == A_NULL)
+ {
+ if(x->x_type1 == A_FLOAT)
+ outlet_float(x->x_obj.ob_outlet, atom_getfloat(x->x_at1));
+ else if(x->x_type1 == A_SYMBOL)
+ outlet_symbol(x->x_obj.ob_outlet, atom_getsymbol(x->x_at1));
+ else if(x->x_type1 == A_POINTER)
+ outlet_pointer(x->x_obj.ob_outlet, (t_gpointer *)x->x_at1->a_w.w_gpointer);
+ }
+ else
+ outlet_list(x->x_obj.ob_outlet, &s_list, x->x_ac1+x->x_ac2+off, x->x_at1);
+ }
+}
+
+static void prepend_kernel_inlet_select(t_prepend_kernel *x, t_floatarg fin_sel_01)
+{
+ x->x_inlet_select = (int)fin_sel_01;
+}
+
+static void prepend_kernel_bang(t_prepend_kernel *x)
+{
+ if(!x->x_inlet_select) /* if 2nd inlet */
+ {
+ x->x_ac2 = 0;
+ x->x_type2 = A_NULL;
+ x->x_sym2 = &s_list;
+ }
+ else /* if 1st inlet */
+ {
+ x->x_ac1 = 0;
+ x->x_type1 = A_NULL;
+ prepend_kernel_out(x);
+ }
+}
+
+static void prepend_kernel_float(t_prepend_kernel *x, t_float f)
+{
+ if(!x->x_inlet_select) /* if 2nd inlet */
+ {
+ x->x_ac2 = 1;
+ x->x_type2 = A_FLOAT;
+ SETFLOAT(x->x_at2, f);
+ x->x_sym2 = &s_list;
+ }
+ else /* if 1st inlet */
+ {
+ x->x_ac1 = 1;
+ x->x_type1 = A_FLOAT;
+ SETFLOAT(x->x_at1, f);
+ prepend_kernel_out(x);
+ }
+}
+
+static void prepend_kernel_symbol(t_prepend_kernel *x, t_symbol *s)
+{
+ if(!x->x_inlet_select) /* if 2nd inlet */
+ {
+ x->x_ac2 = 1;
+ x->x_type2 = A_SYMBOL;
+ SETSYMBOL(x->x_at2, s);
+ x->x_sym2 = &s_list;
+ }
+ else /* if 1st inlet */
+ {
+ x->x_ac1 = 1;
+ x->x_type1 = A_SYMBOL;
+ SETSYMBOL(x->x_at12, s);
+ prepend_kernel_out(x);
+ }
+}
+
+static void prepend_kernel_pointer(t_prepend_kernel *x, t_gpointer *gp)
+{
+ if(x->x_inlet_select) /* if 2nd inlet */
+ {
+ x->x_ac2 = 1;
+ x->x_type2 = A_POINTER;
+ SETPOINTER(x->x_at2, gp);
+ x->x_sym2 = &s_list;
+ }
+ else /* if 1st inlet */
+ {
+ x->x_ac1 = 1;
+ x->x_type1 = A_POINTER;
+ SETPOINTER(x->x_at12, gp);
+ prepend_kernel_out(x);
+ }
+}
+
+static void prepend_kernel_list(t_prepend_kernel *x, t_symbol *s, int ac, t_atom *av)
+{
+ if(x->x_inlet_select) /* if 2nd inlet */
+ {
+ if(ac > x->x_size2)
+ {
+ x->x_at2 = (t_atom *)resizebytes(x->x_at2, x->x_size2*sizeof(t_atom), 2*ac*sizeof(t_atom));
+ x->x_size2 = 2*ac;
+ }
+ x->x_ac2 = ac;
+ x->x_type2 = A_GIMME;
+ x->x_sym2 = &s_list;
+ prepend_kernel_atcopy(av, x->x_at2, ac);
+ }
+ else /* if 1st inlet */
+ {
+ if((x->x_ac1+ac) > x->x_size12)
+ {
+ x->x_at12 = (t_atom *)resizebytes(x->x_at12, x->x_size12*sizeof(t_atom), 2*(x->x_ac1+ac)*sizeof(t_atom));
+ x->x_size12 = 2*(x->x_ac1+ac);
+ }
+ x->x_ac1 = ac;
+ x->x_type1 = A_GIMME;
+ prepend_kernel_atcopy(av, x->x_at12, ac);
+ x->x_sym1 = &s_list;
+ prepend_kernel_out(x);
+ }
+}
+
+static void prepend_kernel_anything(t_prepend_kernel *x, t_symbol *s, int ac, t_atom *av)
+{
+ if(x->x_inlet_select) /* if 2nd inlet */
+ {
+ if((ac+1) > x->x_size2)
+ {
+ x->x_at2 = (t_atom *)resizebytes(x->x_at2, x->x_size2*sizeof(t_atom), 2*ac*sizeof(t_atom));
+ x->x_size2 = 2*ac;
+ }
+ SETSYMBOL(x->x_at2, s);
+ x->x_ac2 = ac;
+ x->x_type2 = A_COMMA;
+ x->x_sym2 = s;
+ prepend_kernel_atcopy(av, x->x_at2, ac);
+ }
+ else /* if 1st inlet */
+ {
+ if((x->x_ac1+ac) > x->x_size12)
+ {
+ x->x_at12 = (t_atom *)resizebytes(x->x_at12, x->x_size12*sizeof(t_atom), (2*x->x_ac1+ac)*sizeof(t_atom));
+ x->x_size12 = (2*x->x_ac1+ac);
+ }
+ x->x_ac1 = ac;
+ x->x_type1 = A_COMMA;
+ prepend_kernel_atcopy(av, x->x_at12, ac);
+ x->x_sym1 = s;
+ prepend_kernel_out(x);
+ }
+}
+
+static void prepend_kernel_free(t_prepend_kernel *x)
+{
+ if(x->x_at1)
+ freebytes(x->x_at1, x->x_size1 * sizeof(t_atom));
+}
+
+static void *prepend_kernel_new(void)
+{
+ t_prepend_kernel *x = (t_prepend_kernel *)pd_new(prepend_kernel_class);
+ t_glist *glist = (t_glist *)canvas_getcurrent();
+ t_canvas *canvas=(t_canvas*)glist_getcanvas(glist);
+ int ac=0;
+ t_atom *av;
+
+ x->x_type2 = A_NULL;
+ x->x_sym2 = &s_list;
+ x->x_ac2 = 0;
+
+ canvas_setcurrent(canvas);
+ canvas_getargs(&ac, &av);
+ canvas_unsetcurrent(canvas);
+
+ x->x_type1 = A_NULL;
+ if(!ac)
+ {
+ x->x_type1 = A_NULL;
+ x->x_sym1 = &s_bang;
+ x->x_size1 = 10;
+ x->x_ac1 = 0;
+ x->x_at1 = (t_atom *)getbytes(x->x_size1 * sizeof(t_atom));
+ }
+ else if(ac == 1)
+ {
+ if(IS_A_SYMBOL(av,0))
+ {
+ x->x_type1 = A_COMMA;
+ x->x_sym1 = atom_getsymbol(av);
+ x->x_size1 = 10;
+ x->x_ac1 = 0;
+ x->x_at1 = (t_atom *)getbytes(x->x_size1 * sizeof(t_atom));
+ }
+ else
+ {
+ if(IS_A_FLOAT(av,0))
+ {
+ x->x_type1 = A_FLOAT;
+ x->x_sym1 = &s_float;
+ }
+ else if(IS_A_POINTER(av,0))
+ {
+ x->x_type1 = A_POINTER;
+ x->x_sym1 = &s_pointer;
+ }
+ x->x_size1 = 11;
+ x->x_ac1 = 1;
+ x->x_at1 = (t_atom *)getbytes(x->x_size1 * sizeof(t_atom));
+ x->x_at1[0] = *av;
+ }
+ }
+ else /* ac > 1 */
+ {
+ if(IS_A_SYMBOL(av,0))
+ {
+ x->x_type1 = A_COMMA;/*for anything*/
+ x->x_sym1 = atom_getsymbol(av++);
+ ac--;
+ }
+ else
+ {
+ x->x_type1 = A_GIMME;
+ x->x_sym1 = &s_list;
+ }
+ x->x_size1 = ac + 10;
+ x->x_ac1 = ac;
+ x->x_at1 = (t_atom *)getbytes(x->x_size1 * sizeof(t_atom));
+ prepend_kernel_atcopy(av, x->x_at1, ac);
+ }
+
+ x->x_inlet_select = 1;
+ outlet_new(&x->x_obj, &s_list);
+ return (x);
+}
+
+void prepend_kernel_setup(void)
+{
+ char str[2];
+
+ str[0] = 1;
+ str[1] = 0;
+ prepend_kernel_class = class_new(gensym("prepend_kernel"),
+ (t_newmethod)prepend_kernel_new, (t_method)prepend_kernel_free,
+ sizeof(t_prepend_kernel), 0, 0);
+ class_addbang(prepend_kernel_class, (t_method)prepend_kernel_bang);
+ class_addpointer(prepend_kernel_class, prepend_kernel_pointer);
+ class_addfloat(prepend_kernel_class, (t_method)prepend_kernel_float);
+ class_addsymbol(prepend_kernel_class, prepend_kernel_symbol);
+ class_addlist(prepend_kernel_class, prepend_kernel_list);
+ class_addmethod(prepend_kernel_class, (t_method)prepend_kernel_inlet_select, gensym(str), A_FLOAT, 0);
+ class_addanything(prepend_kernel_class, prepend_kernel_anything);
+ class_sethelpsymbol(prepend_kernel_class, gensym("iemhelp/help-merge_any"));
+}