[Gridflow-cvs] [svn] commit: r6041 - /trunk/src/gridflow.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Wed Aug 11 22:36:32 EDT 2010


Author: matju
Date: Wed Aug 11 22:36:32 2010
New Revision: 6041

Log:
add %d

Modified:
    trunk/src/gridflow.cxx

Modified: trunk/src/gridflow.cxx
==============================================================================
--- trunk/src/gridflow.cxx (original)
+++ trunk/src/gridflow.cxx Wed Aug 11 22:36:32 2010
@@ -129,22 +129,25 @@
 	post("%s",os.str().data());
 }
 
+static float eatfloat (int argc, t_atom *argv, int &i) {
+	if (!argc) RAISE("not enough args");
+	if (argv[i].a_type != A_FLOAT) RAISE("expected float");
+	return argv[i++].a_float;
+}
+static t_symbol *eatsymbol (int &argc, t_atom *&argv, int &i) {
+	if (!argc) RAISE("not enough args");
+	if (argv[i].a_type != A_SYMBOL) RAISE("expected symbol");
+	return argv[i++].a_symbol;
+}
 void pd_oprintf (std::ostream &o, const char *s, int argc, t_atom *argv) {
 	int i=0;
 	for (; *s; s++) {
 		if (*s!='%') {o << (char)*s; continue;}
 		s++; // skip the %
 		switch (*s) {
-		  case 'f':
-			if (!argc) RAISE("not enough args");
-			if (argv[i].a_type != A_FLOAT) RAISE("expected float");
-			o << argv[i++].a_float;
-		  break;
-		  case 's':
-			if (!argc) RAISE("not enough args");
-			if (argv[i].a_type != A_SYMBOL) RAISE("expected symbol");
-			o << argv[i++].a_symbol->s_name;
-		  break;
+		  case 'd': o << long(eatfloat(argc,argv,i)); break;
+		  case 'f': o << eatfloat(argc,argv,i); break;
+		  case 's': o << eatsymbol(argc,argv,i)->s_name; break;
 		  case '_':
 			if (!argc) RAISE("not enough args");
 			char buf[MAXPDSTRING];
@@ -158,6 +161,7 @@
 			RAISE("sorry, the format character '%c' is not supported yet",*s);
 		}
 	}
+	return;
 }
 
 std::ostream &operator << (std::ostream &self, const t_atom &a) {



More information about the Gridflow-cvs mailing list