[Gridflow-cvs] [svn] commit: r4160 - /trunk/gridflow.c

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Tue Apr 28 15:09:41 EDT 2009


Author: matju
Date: Tue Apr 28 15:09:40 2009
New Revision: 4160

Log:
add method "else" in class canvas... creates an object only when previous object had "couldn't create" (also deletes the nonworking box)

Modified:
    trunk/gridflow.c

Modified: trunk/gridflow.c
==============================================================================
--- trunk/gridflow.c (original)
+++ trunk/gridflow.c Tue Apr 28 15:09:40 2009
@@ -847,6 +847,20 @@
   for (int i=0; i<nSize; i++) fprintf(stderr,"%d: %s\n",i,symbols[i]);
   free(symbols);
 #endif
+}
+
+static t_gobj *canvas_last (t_canvas *self) {
+	t_gobj *g = self->gl_list;
+	while (g->g_next) g=g->g_next;
+	return g;
+}
+
+static void canvas_else (t_canvas *self, t_symbol *s, int argc, t_atom *argv) {
+	t_gobj *g = canvas_last(self);
+	if (pd_newest()) return;
+	glist_delete(self,g);
+	if (argc<1 || argv[0].a_type!=A_SYMBOL) {error("$1 must be a symbol"); return;}
+	pd_typedmess((t_pd *)self,argv[0].a_w.w_symbol,argc-1,argv+1);
 }
 
 // those are not really leaks but deleting them make them disappear from valgrind
@@ -902,4 +916,5 @@
     signal(SIGABRT,SIG_DFL);
     signal(SIGBUS, SIG_DFL);
     atexit(gridflow_unsetup);
-}
+    class_addmethod(canvas_class,(t_method)canvas_else,gensym("else"),A_GIMME,0);
+}



More information about the Gridflow-cvs mailing list