[Gridflow-cvs] [svn] commit: r3545 - in /trunk/base: grid.h main.c

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Tue Apr 15 23:25:24 EDT 2008


Author: matju
Date: Tue Apr 15 23:25:24 2008
New Revision: 3545

Log:
added pd_oprint(ostream&,int,t_atom*) and pd_post(int,t_atom*)

Modified:
    trunk/base/grid.h
    trunk/base/main.c

Modified: trunk/base/grid.h
==============================================================================
--- trunk/base/grid.h (original)
+++ trunk/base/grid.h Tue Apr 15 23:25:24 2008
@@ -905,6 +905,8 @@
 extern std::vector<string> gf_data_path;
 string gf_find_file (string x);
 void pd_oprintf (std::ostream &o, const char *s, int argc, t_atom *argv);
+void pd_oprint (std::ostream &o, int argc, t_atom *argv);
+void pd_post (const char *s, int argc, t_atom *argv);
 
 inline void set_atom (t_atom *a, uint8     v) {SETFLOAT(a,(float)v);}
 inline void set_atom (t_atom *a, int16     v) {SETFLOAT(a,(float)v);}

Modified: trunk/base/main.c
==============================================================================
--- trunk/base/main.c (original)
+++ trunk/base/main.c Tue Apr 15 23:25:24 2008
@@ -60,6 +60,27 @@
     buf[1023]=0;
     va_end(ap);
     text = strdup(buf);
+}
+
+void pd_oprint (std::ostream &o, int argc, t_atom *argv) {
+	for (int i=0; i<argc; i++) {
+		t_atomtype t = argv[i].a_type;
+		if (t==A_FLOAT) o << argv[i].a_w.w_float;
+		if (t==A_SYMBOL) o << argv[i].a_w.w_symbol->s_name;
+		if (t==A_POINTER) o << "(pointer)";
+		if (t==A_LIST) {
+			t_binbuf *b = (t_binbuf *)argv[i].a_w.w_gpointer;
+			pd_oprint(o,binbuf_getnatom(b),binbuf_getvec(b));
+		}
+		if (i!=argc-1) o << " ";
+	}
+}
+
+void pd_post (const char *s, int argc, t_atom *argv) {
+	std::ostringstream os;
+	if (s) os << s << ": ";
+	pd_oprint(os,argc,argv);
+	post("%s",os.str().data());
 }
 
 void pd_oprintf (std::ostream &o, const char *s, int argc, t_atom *argv) {



More information about the Gridflow-cvs mailing list