[Gridflow-cvs] [svn] commit: r3968 - /trunk/base/flow_objects.c

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Fri Jul 4 15:20:06 EDT 2008


Author: matju
Date: Fri Jul  4 15:20:06 2008
New Revision: 3968

Log:
added [list.==]

Modified:
    trunk/base/flow_objects.c

Modified: trunk/base/flow_objects.c
==============================================================================
--- trunk/base/flow_objects.c (original)
+++ trunk/base/flow_objects.c Fri Jul  4 15:20:06 2008
@@ -466,7 +466,7 @@
 		type *foo = NEWBUF(type,nd*size); \
 		long i=0; \
 		switch (size) { \
-		case 1: for (; i<nd&-4; i+=4, foo+=4) { \
+		case 1: for (; i<(nd&-4); i+=4, foo+=4) { \
 			foo[0] = p[v[i+0]]; \
 			foo[1] = p[v[i+1]]; \
 			foo[2] = p[v[i+2]]; \
@@ -2981,6 +2981,33 @@
 }
 \end class {install("class_exists",1,1);}
 
+typedef t_binbuf t_list;
+
+static t_list *list_new (int argc, t_atom *argv) {
+	t_list *b = binbuf_new();
+	binbuf_add(b,argc,argv);
+	return b;
+}
+static void list_free (t_list *self) {binbuf_free(self);}
+
+\class ListEqual : FObject {
+	t_list *list;
+	\constructor (...) {list=0; _1_list(argc,argv);}
+	\decl 0 list (...);
+	\decl 1 list (...);
+};
+\def 1 list (...) {
+	if (list) list_free(list);
+	list = list_new(argc,argv);
+}
+\def 0 list (...) {
+	if (binbuf_getnatom(list) != argc) {outlet_float(bself->outlets[0],0); return;}
+	t_atom2 *at = (t_atom2 *)binbuf_getvec(list);
+	for (int i=0; i<argc; i++) if (!atom_eq(at[i],argv[i])) {outlet_float(bself->outlets[0],0); return;}
+	outlet_float(bself->outlets[0],1);
+}
+\end class {install("list.==",2,1);}
+
 //****************************************************************
 //#ifdef UNISTD
 #include <sys/types.h>



More information about the Gridflow-cvs mailing list