[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] [commit] prArrayMultiChanExpand : excluding strings from flop



I've committed a change to PyrListPrim.cpp, prArrayMultiChanExpand so that
flop does not expand strings anymore. The reason that it did was that string is a sequenceablecollection, so flop was done by SequenceableCollection-flop instead of the primitive.


this means that

[5, 6, "flop"].flop;
returns [ [ 5, 6, flop ] ]
and
[[1, 2, 3], 6, "flop"].flop;
returns
[ [ 1, 6, flop ], [ 2, 6, flop ], [ 3, 6, flop ] ]

so that strings may be used in event streams now:

Pbind(\instrument, "default");



Index: PyrListPrim.cpp
===================================================================
RCS file: /cvsroot/supercollider/SuperCollider3/source/lang/LangPrimSource/PyrListPrim.cpp,v
retrieving revision 1.16
diff -p -b -B -r1.16 PyrListPrim.cpp
*** PyrListPrim.cpp     18 Jun 2004 17:10:22 -0000      1.16
--- PyrListPrim.cpp     5 Dec 2004 16:40:17 -0000
*************** int prArrayMultiChanExpand(struct VMGlob
*** 67,73 ****
                        if (slot->uo->classptr == class_array) {
                                len = slot->uo->size;
                                maxlen = len > maxlen ? len : maxlen;
! } else if (isKindOf(slot->uo, class_sequenceable_collection)) { return errFailed; // this primitive only handles Arrays.
                        }
                }
--- 67,73 ----
                        if (slot->uo->classptr == class_array) {
                                len = slot->uo->size;
                                maxlen = len > maxlen ? len : maxlen;
! } else if (isKindOf(slot->uo, class_sequenceable_collection) && (slot->uo->classptr != class_string)) { return errFailed; // this primitive only handles Arrays.
                        }
                }
--








.