[Gridflow-cvs] [svn] commit: r5953 - in /trunk: doc/flow_classes/route2-help.pd doc/flow_classes/route3-help.pd src/classes2.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Wed Aug 4 18:41:08 EDT 2010


Author: matju
Date: Wed Aug  4 18:41:06 2010
New Revision: 5953

Log:
adding [route3] and more doc for [route2]

Added:
    trunk/doc/flow_classes/route3-help.pd
Modified:
    trunk/doc/flow_classes/route2-help.pd
    trunk/src/classes2.cxx

Modified: trunk/doc/flow_classes/route2-help.pd
==============================================================================
--- trunk/doc/flow_classes/route2-help.pd (original)
+++ trunk/doc/flow_classes/route2-help.pd Wed Aug  4 18:41:06 2010
@@ -1,33 +1,71 @@
-#N canvas 412 190 632 485 10;
+#N canvas 412 69 632 597 10;
 #X obj 11 140 route2 blah foo bar;
-#X msg 29 39 blah blah blah;
-#X msg 29 62 foo 42;
-#X msg 29 86 bar 3.14159;
-#X obj 140 160 display;
-#X obj 97 180 display;
-#X obj 54 200 display;
-#X obj 12 220 display;
-#X msg 29 114 pas rapport;
-#X text 176 29 just like [route];
-#X text 177 46 but preserves message as-is;
+#X msg 27 39 blah blah blah;
+#X msg 32 58 foo 42;
+#X msg 37 77 bar 3.14159;
+#X obj 122 159 display;
+#X msg 42 96 pas rapport;
 #X obj 0 0 doc_h;
 #X obj 3 253 doc_c n;
-#X obj 3 313 doc_i 1;
-#X obj 3 373 doc_o n;
-#X obj 14 343 doc_ii 0;
-#X obj 14 403 doc_oo nonlast;
-#X obj 14 426 doc_oo last;
+#X obj 3 341 doc_i 1;
+#X obj 3 442 doc_o n;
+#X obj 14 371 doc_ii 0;
+#X obj 14 472 doc_oo nonlast;
+#X obj 14 501 doc_oo last;
 #X obj 14 283 doc_cc any;
-#X obj 0 456 doc_f;
-#X obj 97 402 doc_m ononlast <any>;
-#X obj 97 426 doc_m olast <any>;
-#X obj 97 343 doc_m i0 <any>;
+#X obj 0 563 doc_f;
+#X obj 97 471 doc_m ononlast <any>;
+#X obj 97 501 doc_m olast <any>;
+#X obj 97 371 doc_m i0 <any>;
 #X obj 97 283 doc_m cany symbol;
-#X connect 0 0 7 0;
-#X connect 0 1 6 0;
-#X connect 0 2 5 0;
+#X obj 3 543 doc_also;
+#X obj 85 179 display;
+#X obj 48 199 display;
+#X obj 11 219 display;
+#X text 232 283 selectors to select for. note that [route2] does not
+"normalise" any selectors \, such as "bang" including implicitly 0-argument
+"list" messages and such.;
+#X obj 103 543 route3;
+#X text 177 29 almost like [route] \, but preserves message as-is \,
+and uses the true selector.;
+#X obj 151 543 gf/selector;
+#X obj 11 120 t a;
+#X obj 353 81 t a a;
+#X obj 353 100 shunt 4;
+#X obj 401 81 gf/selector;
+#X text 232 501 rejected messages;
+#X obj 392 127 display;
+#X obj 379 147 display;
+#X obj 366 167 display;
+#X obj 353 187 display;
+#X obj 401 100 listfind blah foo bar;
+#X text 322 64 it's basically the same as this;
+#X text 232 371 message will be checked for true selector as [gf/selector]
+does \, then that selector is checked against a list of selectors and
+the unaltered message is output by the appropriate outlet.;
+#X text 232 471 accepted messages (outlets are in the same order as
+the object's arguments). exact input selector is output as-is.;
+#X connect 0 0 22 0;
+#X connect 0 1 21 0;
+#X connect 0 2 20 0;
 #X connect 0 3 4 0;
-#X connect 1 0 0 0;
-#X connect 2 0 0 0;
-#X connect 3 0 0 0;
-#X connect 8 0 0 0;
+#X connect 1 0 27 0;
+#X connect 2 0 27 0;
+#X connect 3 0 27 0;
+#X connect 5 0 27 0;
+#X connect 15 1 39 0;
+#X connect 16 1 31 0;
+#X connect 17 1 38 0;
+#X connect 18 1 23 0;
+#X connect 19 1 24 0;
+#X connect 19 1 26 0;
+#X connect 27 0 0 0;
+#X connect 27 0 28 0;
+#X connect 28 0 29 0;
+#X connect 28 1 30 0;
+#X connect 29 0 35 0;
+#X connect 29 1 34 0;
+#X connect 29 2 33 0;
+#X connect 29 3 32 0;
+#X connect 30 0 36 0;
+#X connect 36 0 29 1;

Modified: trunk/src/classes2.cxx
==============================================================================
--- trunk/src/classes2.cxx (original)
+++ trunk/src/classes2.cxx Wed Aug  4 18:41:06 2010
@@ -963,23 +963,39 @@
 	t_symbol **sels;
 	~Route2() {if (sels) delete[] sels;}
 	\constructor (...) {nsels=0; sels=0; _1_list(argc,argv); noutlets_set(1+nsels);}
-	\decl void anything(...);
-	\decl 1 list(...);
-};
-\def void anything(...) {
-	t_symbol *sel = gensym(argv[0].a_symbol->s_name+3);
-	int i=0;
-	for (i=0; i<nsels; i++) if (sel==sels[i]) break;
-	outlet_anything(outlets[i],sel,argc-1,argv+1);
-}
-\def 1 list(...) {
-	for (int i=0; i<argc; i++) if (argv[i].a_type!=A_SYMBOL) {delete[] sels; RAISE("$%d: expected symbol",i+1);}
-	if (sels) delete[] sels;
-	nsels = argc;
-	sels = new t_symbol*[argc];
-	for (int i=0; i<argc; i++) sels[i] = argv[i].a_symbol;
-}
+	\decl void anything(...) {
+		t_symbol *sel = gensym(argv[0].a_symbol->s_name+3);
+		int i=0; for (i=0; i<nsels; i++) if (sel==sels[i]) break;
+		outlet_anything(outlets[i],sel,argc-1,argv+1);
+	}
+	\decl 1 list(...) {
+		for (int i=0; i<argc; i++) if (argv[i].a_type!=A_SYMBOL) {delete[] sels; RAISE("$%d: expected symbol",i+1);}
+		if (sels) delete[] sels;
+		nsels = argc; sels = new t_symbol*[argc];
+		for (int i=0; i<argc; i++) sels[i] = argv[i].a_symbol;
+	}
+};
 \end class {install("route2",1,1);}
+
+\class Route3 : FObject {
+	int nsels;
+	t_symbol **sels;
+	~Route3() {if (sels) delete[] sels;}
+	\constructor (...) {nsels=0; sels=0; _1_list(argc,argv); noutlets_set(1+nsels);}
+	\decl void anything(...) {
+		t_symbol *sel = gensym(argv[0].a_symbol->s_name+3);
+		int i=0; for (i=0; i<nsels; i++) if (sel==sels[i]) break;
+		if (sel!=&s_bang && sel!=&s_float && sel!=&s_symbol && sel!=&s_pointer) sel=&s_list;
+		outlet_anything(outlets[i],sel,argc-1,argv+1);
+	}
+	\decl 1 list(...) {
+		for (int i=0; i<argc; i++) if (argv[i].a_type!=A_SYMBOL) {delete[] sels; RAISE("$%d: expected symbol",i+1);}
+		if (sels) delete[] sels;
+		nsels = argc; sels = new t_symbol*[argc];
+		for (int i=0; i<argc; i++) sels[i] = argv[i].a_symbol;
+	}
+};
+\end class {install("route3",1,1);}
 
 template <class T> int sgn(T a, T b=0) {return a<b?-1:a>b;}
 



More information about the Gridflow-cvs mailing list