aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/py
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2007-03-27 17:16:17 +0000
committerThomas Grill <xovo@users.sourceforge.net>2007-03-27 17:16:17 +0000
commit93d255bfad2846c9bd96503a1fcc54fefe025794 (patch)
tree01343c43c8718fe9b859f894bdbc186effe10e37 /externals/grill/py
parentf882da3800c2af9bbf07c98c2ed466bb1759ad72 (diff)
improved symbol comparison
more meaningful comparison function for symbols svn path=/trunk/; revision=7518
Diffstat (limited to 'externals/grill/py')
-rw-r--r--externals/grill/py/source/pysymbol.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/externals/grill/py/source/pysymbol.cpp b/externals/grill/py/source/pysymbol.cpp
index f907cc45..a78c39ce 100644
--- a/externals/grill/py/source/pysymbol.cpp
+++ b/externals/grill/py/source/pysymbol.cpp
@@ -2,7 +2,7 @@
py/pyext - python script object for PD and Max/MSP
-Copyright (c)2002-2005 Thomas Grill (gr@grrrr.org)
+Copyright (c)2002-2007 Thomas Grill (gr@grrrr.org)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
@@ -62,14 +62,19 @@ static PyObject *symbol_richcompare(PyObject *a,PyObject *b,int cmp)
if(pySymbol_Check(a) && pySymbol_Check(b)) {
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 = 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;
+ 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);
}