[Gridflow-cvs] [svn] commit: r4037 - in /trunk: gridflow.c gridflow.h

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Thu Jul 17 11:38:43 EDT 2008


Author: matju
Date: Thu Jul 17 11:38:42 2008
New Revision: 4037

Log:
added BFObject::binbuf_string in order to improve error messages back to what it was in 0.9.1

Modified:
    trunk/gridflow.c
    trunk/gridflow.h

Modified: trunk/gridflow.c
==============================================================================
--- trunk/gridflow.c (original)
+++ trunk/gridflow.c Thu Jul 17 11:38:42 2008
@@ -175,8 +175,8 @@
 		((int32*)out)[2] = ((int32*)in)[2];
 		((int32*)out)[3] = ((int32*)in)[3];
 	}
-	for (; n>4; in+=4, out+=4, n-=4) { *(int32*)out = *(int32*)in; }
-	for (; n; in++, out++, n--) { *out = *in; }
+	for (; n>4; in+=4, out+=4, n-=4) *(int32*)out = *(int32*)in;
+	for (; n; in++, out++, n--) *out=*in;
 }
 
 //----------------------------------------------------------------
@@ -699,6 +699,16 @@
 		while (noutlets>n) outlet_free(outlets[--noutlets]);
 	}
 	if (draw) BFObject_redraw(this);
+}
+
+string BFObject::binbuf_string () {
+	if (!te_binbuf) return "[???]";
+	std::ostringstream s;
+	int n = binbuf_getnatom(te_binbuf);
+	t_atom *at = binbuf_getvec(te_binbuf);
+	for (int i=0; i<n; i++) s << (i ? " " : "[") << at[i];
+	s << "]";
+	return s.str();
 }
 
 void add_creator2(FClass *fclass, const char *name) {

Modified: trunk/gridflow.h
==============================================================================
--- trunk/gridflow.h (original)
+++ trunk/gridflow.h Thu Jul 17 11:38:42 2008
@@ -821,6 +821,7 @@
 	t_canvas *mom;
 	void  ninlets_set(int n, bool draw=true);
 	void noutlets_set(int n, bool draw=true);
+	string binbuf_string ();
 };
 
 // represents objects that have inlets/outlets
@@ -843,7 +844,7 @@
 extern "C" void Init_gridflow ();
 extern Numop *op_add,*op_sub,*op_mul,*op_div,*op_mod,*op_shl,*op_and,*op_put;
 
-#define ARGS(OBJ) "(some object...)"
+#define ARGS(OBJ) (OBJ->bself->binbuf_string().data())
 #define NOTEMPTY(_a_) if (!(_a_)) RAISE("in [%s], '%s' is empty",ARGS(this), #_a_);
 #define SAME_TYPE(_a_,_b_) \
 	if ((_a_)->nt != (_b_)->nt) RAISE("%s: same type please (%s has %s; %s has %s)", ARGS(this), \
@@ -921,4 +922,6 @@
     va_end(args);
 }
 
+std::ostream &operator << (std::ostream &self, t_atom &a);
+
 #endif // __GF_GRID_H



More information about the Gridflow-cvs mailing list