aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--externals/grill/delsplit/delsplit-help.pd11
-rwxr-xr-xexternals/grill/delsplit/main.cpp57
2 files changed, 46 insertions, 22 deletions
diff --git a/externals/grill/delsplit/delsplit-help.pd b/externals/grill/delsplit/delsplit-help.pd
index 3ed32b9e..2f641921 100644
--- a/externals/grill/delsplit/delsplit-help.pd
+++ b/externals/grill/delsplit/delsplit-help.pd
@@ -1,13 +1,16 @@
-#N canvas 300 90 458 286 12;
+#N canvas 300 90 462 290 12;
#X msg 264 133 symbol -;
#X msg 232 57 list;
#X msg 242 84 list +;
#X obj 105 229 print;
-#X obj 43 69 tosymbol;
-#X msg 42 42 ask+asd-ssds;
+#X obj 39 78 tosymbol;
+#X msg 29 22 ask+asd-ssds;
#X symbolatom 251 111 10 0 0 0 - - -;
#X obj 105 203 delsplit;
#X text 273 54 space;
+#X msg 31 152 a-b c+d e-f+g;
+#X msg 58 47 a b c+d e-f+g;
+#X text 29 130 any messages will work;
#X connect 0 0 7 1;
#X connect 1 0 7 1;
#X connect 2 0 7 1;
@@ -15,3 +18,5 @@
#X connect 5 0 4 0;
#X connect 6 0 7 1;
#X connect 7 0 3 0;
+#X connect 9 0 7 0;
+#X connect 10 0 4 0;
diff --git a/externals/grill/delsplit/main.cpp b/externals/grill/delsplit/main.cpp
index bf65a6b7..3c718afb 100755
--- a/externals/grill/delsplit/main.cpp
+++ b/externals/grill/delsplit/main.cpp
@@ -22,7 +22,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <ctype.h>
-#define VERSION "0.1.4"
+#define VERSION "0.1.5"
#ifdef __MWERKS__
#define STD std
@@ -40,7 +40,7 @@ public:
delsplit(int argc,const t_atom *argv);
protected:
- void m_list(const t_symbol *s);
+ void m_any(const t_symbol *s,int argc,const t_atom *argv);
void m_del(const t_symbol *s,int argc,const t_atom *argv);
const t_symbol *delim;
@@ -51,7 +51,7 @@ private:
static const t_symbol *sym__space;
- FLEXT_CALLBACK_S(m_list)
+ FLEXT_CALLBACK_A(m_any)
FLEXT_CALLBACK_A(m_del)
FLEXT_ATTRVAR_S(delim)
};
@@ -65,7 +65,7 @@ void delsplit::Setup(t_classid c)
{
sym__space = MakeSymbol(" ");
- FLEXT_CADDMETHOD(c,0,m_list);
+ FLEXT_CADDMETHOD(c,0,m_any);
FLEXT_CADDMETHOD(c,1,m_del);
FLEXT_CADDATTR_VAR1(c,"del",delim);
}
@@ -127,7 +127,7 @@ void delsplit::SetAtom(t_atom &l,const char *s)
SetFloat(l,(float)atof(s));
}
-void delsplit::m_list(const t_symbol *sym)
+void delsplit::m_any(const t_symbol *sym,int argc,const t_atom *argv)
{
FLEXT_ASSERT(delim);
@@ -135,21 +135,40 @@ void delsplit::m_list(const t_symbol *sym)
int cnt = 0;
const char *sdel = GetString(delim);
int ldel = strlen(sdel);
- char str[1024];
- strcpy(str,GetString(sym));
-
- for(const char *s = str; *s; ) {
- char *e = strstr(s,sdel);
- if(!e) {
- SetAtom(lst[cnt++],s);
- break;
- }
- else {
- *e = 0;
- SetAtom(lst[cnt++],s);
- s = e+ldel;
+
+ for(int i = -1; i < argc; ++i) {
+ char str[1024];
+ if(i < 0) {
+ if(
+ sym != sym_list && sym != sym_float && sym != sym_symbol && sym != sym_bang
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ && sym != sym_int
+#endif
+ )
+ strcpy(str,GetString(sym));
+ else
+ str[0] = 0;
}
- }
+ else if(IsString(argv[i]))
+ strcpy(str,GetString(argv[i]));
+ else if(CanbeFloat(argv[i]))
+ sprintf(str,"%e",GetAFloat(argv[i]));
+ else
+ str[0] = 0;
+
+ for(const char *s = str; *s; ) {
+ char *e = strstr(s,sdel);
+ if(!e) {
+ SetAtom(lst[cnt++],s);
+ break;
+ }
+ else {
+ *e = 0;
+ SetAtom(lst[cnt++],s);
+ s = e+ldel;
+ }
+ }
+ }
ToOutList(0,cnt,lst);
}