aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flatom.cpp
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-07-05 02:32:45 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-07-05 02:32:45 +0000
commit3955eeee449327250522c12721b8c37250752a18 (patch)
treee279a66505391732ac9a27017f12e55601301b37 /externals/grill/flext/source/flatom.cpp
parenta7bde0ac21a716bc1cbf08e1bc1545cce898b3fe (diff)
""
svn path=/trunk/; revision=746
Diffstat (limited to 'externals/grill/flext/source/flatom.cpp')
-rw-r--r--externals/grill/flext/source/flatom.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/externals/grill/flext/source/flatom.cpp b/externals/grill/flext/source/flatom.cpp
index 0e7eb544..45739e66 100644
--- a/externals/grill/flext/source/flatom.cpp
+++ b/externals/grill/flext/source/flatom.cpp
@@ -14,6 +14,32 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "flext.h"
+#if FLEXT_SYS != FLEXT_SYS_JMAX
+int flext::CmpAtom(const t_atom &a,const t_atom &b)
+{
+ if(GetType(a) == GetType(b)) {
+ switch(GetType(a)) {
+ case A_FLOAT: return GetFloat(a) == GetFloat(b)?0:(GetFloat(a) < GetFloat(b)?-1:1);
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ case A_INT: return GetInt(a) == GetInt(b)?0:(GetInt(a) < GetInt(b)?-1:1);
+#endif
+ case A_SYMBOL: return GetSymbol(a) == GetSymbol(b)?0:(GetSymbol(a) < GetSymbol(b)?-1:1);
+#if FLEXT_SYS == FLEXT_SYS_PD
+ case A_POINTER: return GetPointer(a) == GetPointer(b)?0:(GetPointer(a) < GetPointer(b)?-1:1);
+#endif
+ default:
+ // can't be compared.....
+ FLEXT_ASSERT(false);
+ return 0;
+ }
+ }
+ else
+ return GetType(a) < GetType(b)?-1:1;
+}
+#else
+#error Not implemented
+#endif
+
t_atom *flext::CopyList(int argc,const t_atom *argv)
{
int i;
@@ -52,6 +78,19 @@ flext::AtomList &flext::AtomList::Set(int argc,const t_atom *argv,int offs,bool
return *this;
}
+int flext::AtomList::Compare(const AtomList &a) const
+{
+ if(Count() == a.Count()) {
+ for(int i = 0; i < Count(); ++i) {
+ int cmp = CmpAtom((*this)[i],a[i]);
+ if(cmp) return cmp;
+ }
+ return 0;
+ }
+ else
+ return Count() < a.Count()?-1:1;
+}
+
#if FLEXT_SYS != FLEXT_SYS_JMAX
// not for jmax as long as t_symbol * == char *