[Gridflow-cvs] [svn] commit: r6049 - /trunk/src/classes2.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Thu Aug 12 21:22:02 EDT 2010


Author: matju
Date: Thu Aug 12 21:22:00 2010
New Revision: 6049

Log:
(re)introducing [#sprintf], a near exact copy of [gf/sprintf] producing a grid instead of a symbol. also has a method 'cast'

Modified:
    trunk/src/classes2.cxx

Modified: trunk/src/classes2.cxx
==============================================================================
--- trunk/src/classes2.cxx (original)
+++ trunk/src/classes2.cxx Thu Aug 12 21:22:00 2010
@@ -771,6 +771,27 @@
 	}
 };
 \end class {install("gf/sprintf",1,1);}
+\class GridSprintf : FObject {
+	string format;
+	\attr NumberTypeE cast;
+	\constructor (...) {
+		std::ostringstream o;
+		char buf[MAXPDSTRING];
+		for (int i=0; i<argc; i++) {atom_string(&argv[i],buf,MAXPDSTRING); o << buf; if (i!=argc-1) o << ' ';}
+		format = o.str();
+		cast = int32_e;
+	}
+	\decl 0 bang   ()          {_0_list(0,0);}
+	\decl 0 float  (t_atom2 a) {_0_list(1,&a);}
+	\decl 0 symbol (t_atom2 a) {_0_list(1,&a);}
+	\decl 0 list (...) {
+		std::ostringstream o;
+		pd_oprintf(o,format.data(),argc,argv);
+		string s = o.str();
+		GridOutlet out(this,0,Dim(s.size()),cast); out.send(s.size(),(uint8 *)s.data());
+	}
+};
+\end class {install("#sprintf",1,1);}
 
 \class ForEach : FObject {
 	\constructor () {}



More information about the Gridflow-cvs mailing list