[PD-cvs] externals/grill/py/source pysymbol.cpp,1.7,1.8

Thomas Grill xovo at users.sourceforge.net
Tue Mar 27 19:16:19 CEST 2007


Update of /cvsroot/pure-data/externals/grill/py/source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5770/source

Modified Files:
	pysymbol.cpp 
Log Message:
improved symbol comparison
more meaningful comparison function for symbols


Index: pysymbol.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/pysymbol.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** pysymbol.cpp	7 Mar 2007 13:40:14 -0000	1.7
--- pysymbol.cpp	27 Mar 2007 17:16:17 -0000	1.8
***************
*** 3,7 ****
  py/pyext - python script object for PD and Max/MSP
  
! Copyright (c)2002-2005 Thomas Grill (gr at grrrr.org)
  For information on usage and redistribution, and for a DISCLAIMER OF ALL
  WARRANTIES, see the file, "license.txt," in this distribution.  
--- 3,7 ----
  py/pyext - python script object for PD and Max/MSP
  
! Copyright (c)2002-2007 Thomas Grill (gr at grrrr.org)
  For information on usage and redistribution, and for a DISCLAIMER OF ALL
  WARRANTIES, see the file, "license.txt," in this distribution.  
***************
*** 63,74 ****
          const t_symbol *asym = pySymbol_AS_SYMBOL(a);
          const t_symbol *bsym = pySymbol_AS_SYMBOL(b);
          bool ret;
          switch(cmp) {
!             case Py_LT: ret = asym < bsym; break;
!             case Py_LE: ret = asym <= bsym; break;
!             case Py_EQ: ret = asym == bsym; break;
!             case Py_NE: ret = asym != bsym; break;
!             case Py_GT: ret = asym > bsym; break;
!             case Py_GE: ret = asym >= bsym; break;
          }
          return PyBool_FromLong(ret);
--- 63,79 ----
          const t_symbol *asym = pySymbol_AS_SYMBOL(a);
          const t_symbol *bsym = pySymbol_AS_SYMBOL(b);
+ 
+ 		int res = asym == bsym?0:strcmp(flext::GetString(asym),flext::GetString(bsym));
+ 		
          bool ret;
          switch(cmp) {
!             case Py_LT: ret = res < 0; break;
!             case Py_LE: ret = res <= 0; break;
!             case Py_EQ: ret = res == 0; break;
!             case Py_NE: ret = res != 0; break;
!             case Py_GE: ret = res >= 0; break;
!             case Py_GT: ret = res > 0; break;
! 			default:
! 				FLEXT_ASSERT(false);
          }
          return PyBool_FromLong(ret);





More information about the Pd-cvs mailing list