[PD-cvs] externals/OSCx/src OSCroute.c,1.4,1.5

Frank Barknecht fbar at users.sourceforge.net
Tue Jun 28 20:38:01 CEST 2005


Update of /cvsroot/pure-data/externals/OSCx/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12620

Modified Files:
	OSCroute.c 
Log Message:


Added back a test against "/*" which will strip off the first element in a
OSC-message.


Index: OSCroute.c
===================================================================
RCS file: /cvsroot/pure-data/externals/OSCx/src/OSCroute.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** OSCroute.c	19 Aug 2004 22:01:38 -0000	1.4
--- OSCroute.c	28 Jun 2005 18:37:59 -0000	1.5
***************
*** 31,34 ****
--- 31,35 ----
  
    	Match a pattern against a pattern?
+       [Done: Only Slash-Star is allowed, see MyPatternMatch.]
    	Declare outlet types / distinguish leaf nodes from other children
    	More sophisticated (2-pass?) allmessages scheme
***************
*** 71,74 ****
--- 72,89 ----
  */
  
+ static Boolean MyPatternMatch (const char *pattern, const char *test)
+ {
+     // This allows the special case of "OSCroute /* " to be an outlet that
+     // matches anything; i.e., it always outputs the input with the first level
+     // of the address stripped off. 
+     
+     if (test[0] == '*' && test[1] == '\0') {
+         return 1;
+     } else {
+         return PatternMatch(pattern, test);
+     }
+ }
+ 
+ 
  static t_class *OSCroute_class;
  
***************
*** 311,315 ****
      
      for (i = 0; i < x->x_num; ++i) {
!       if (PatternMatch(pattern+1, x->x_prefixes[i]+1)) {
  	++matchedAnything;
  	
--- 326,330 ----
      
      for (i = 0; i < x->x_num; ++i) {
!       if (MyPatternMatch(pattern+1, x->x_prefixes[i]+1)) {
  	++matchedAnything;
  	
***************
*** 352,356 ****
      
      for (i = 0; i < x->x_num; ++i) {
!       if (PatternMatch(patternBegin, x->x_prefixes[i]+1)) {
  	++matchedAnything;
  	if (restOfPattern == 0) {
--- 367,371 ----
      
      for (i = 0; i < x->x_num; ++i) {
!       if (MyPatternMatch(patternBegin, x->x_prefixes[i]+1)) {
  	++matchedAnything;
  	if (restOfPattern == 0) {





More information about the Pd-cvs mailing list