aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/deljoin
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2002-12-28 04:37:42 +0000
committerThomas Grill <xovo@users.sourceforge.net>2002-12-28 04:37:42 +0000
commit562dcc336797951b2a8707413aa44177484c9f2a (patch)
tree162adc736d99b6edf4c03e50061831006ac0f5c4 /externals/grill/deljoin
parent7b0d76e0a6c7b58f6a7a373755c46bde52ebea79 (diff)
""
svn path=/trunk/; revision=309
Diffstat (limited to 'externals/grill/deljoin')
-rwxr-xr-xexternals/grill/deljoin/main.cpp77
1 files changed, 43 insertions, 34 deletions
diff --git a/externals/grill/deljoin/main.cpp b/externals/grill/deljoin/main.cpp
index b52303cb..5dfdff5f 100755
--- a/externals/grill/deljoin/main.cpp
+++ b/externals/grill/deljoin/main.cpp
@@ -10,8 +10,8 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <flext.h>
-#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
-#error You need at least flext version 0.4.0
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error You need at least flext version 0.4.1
#endif
#include <string.h>
@@ -26,7 +26,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define C char
#define BL bool
-#define VERSION "0.1.1"
+#define VERSION "0.1.2"
#ifdef __MWERKS__
#define STD std
@@ -38,7 +38,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class deljoin:
public flext_base
{
- FLEXT_HEADER(deljoin,flext_base)
+ FLEXT_HEADER_S(deljoin,flext_base,Setup)
public:
deljoin(I argc,const t_atom *argv);
@@ -53,6 +53,8 @@ protected:
virtual void m_assist(long /*msg*/,long /*arg*/,char * /*s*/);
private:
+ static V Setup(t_class *c);
+
FLEXT_CALLBACK_A(m_list)
FLEXT_CALLBACK_S(m_del)
};
@@ -60,6 +62,12 @@ private:
FLEXT_NEW_V("deljoin",deljoin)
+V deljoin::Setup(t_class *c)
+{
+ FLEXT_CADDMETHOD_A(c,0,m_list);
+ FLEXT_CADDMETHOD(c,1,m_del);
+}
+
deljoin::deljoin(I argc,const t_atom *argv):
delim(NULL)
{
@@ -67,9 +75,6 @@ deljoin::deljoin(I argc,const t_atom *argv):
AddInSymbol();
AddOutSymbol();
- FLEXT_ADDMETHOD_A(0,m_list);
- FLEXT_ADDMETHOD(1,m_del);
-
if(argc && IsSymbol(argv[0])) delim = GetSymbol(argv[0]);
}
@@ -104,36 +109,40 @@ V deljoin::m_assist(long msg,long arg,char *s)
*/
V deljoin::m_list(const t_symbol *s,int argc,const t_atom *argv)
{
- C tmp[1024],*t = tmp;
- const C *sdel = GetString(delim);
- I ldel = strlen(sdel);
-
- if(s && s != sym_list && s != sym_float && s != sym_int) {
- strcpy(t,GetString(s));
- t += strlen(t);
- }
-
- for(int i = 0; i < argc; ++i) {
- if(t != tmp) {
- strcpy(t,sdel);
- t += ldel;
- }
-
- const t_atom &a = argv[i];
- if(IsSymbol(a))
- strcpy(t,GetString(a));
- else if(IsInt(a)) {
- STD::sprintf(t,"%i",GetInt(a),10);
+ if(delim) {
+ C tmp[1024],*t = tmp;
+ const C *sdel = GetString(delim);
+ I ldel = strlen(sdel);
+
+ if(s && s != sym_list && s != sym_float && s != sym_int) {
+ strcpy(t,GetString(s));
+ t += strlen(t);
}
- else if(IsFloat(a)) {
- STD::sprintf(t,"%f",GetFloat(a),10);
+
+ for(int i = 0; i < argc; ++i) {
+ if(t != tmp) {
+ strcpy(t,sdel);
+ t += ldel;
+ }
+
+ const t_atom &a = argv[i];
+ if(IsSymbol(a))
+ strcpy(t,GetString(a));
+ else if(IsInt(a)) {
+ STD::sprintf(t,"%i",GetInt(a),10);
+ }
+ else if(IsFloat(a)) {
+ STD::sprintf(t,"%f",GetFloat(a),10);
+ }
+ // else do nothing
+
+ t += strlen(t);
}
-// else do nothing
-
- t += strlen(t);
+
+ ToOutString(0,tmp);
}
-
- ToOutString(0,tmp);
+ else
+ post("%s - No delimiter defined",thisName());
}
V deljoin::m_del(const t_symbol *s)