aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/flext/source')
-rw-r--r--externals/grill/flext/source/flbase.h31
-rwxr-xr-xexternals/grill/flext/source/fllib.cpp68
-rw-r--r--externals/grill/flext/source/flstdc.h11
-rw-r--r--externals/grill/flext/source/flsupport.cpp4
-rw-r--r--externals/grill/flext/source/flsupport.h2
5 files changed, 79 insertions, 37 deletions
diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h
index b636dd1b..85633f20 100644
--- a/externals/grill/flext/source/flbase.h
+++ b/externals/grill/flext/source/flbase.h
@@ -2,7 +2,7 @@
flext - C++ layer for Max/MSP and pd (pure data) externals
-Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net)
+Copyright (c) 2001-2004 Thomas Grill (xovo@gmx.net)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
@@ -411,9 +411,12 @@ fts_module_t __##NAME##_module = {#NAME,#NAME,__##NAME##_initfun,0,0};
#define FLEXTTPN_PTR A_POINTER
#else
#define FLEXTTPN_INT A_INT
+ #define FLEXTTPN_DEFINT A_DEFINT
#endif
#define FLEXTTPN_FLOAT A_FLOAT
+ #define FLEXTTPN_DEFFLOAT A_DEFFLOAT
#define FLEXTTPN_SYM A_SYMBOL
+ #define FLEXTTPN_DEFSYM A_DEFSYMBOL
#define FLEXTTPN_VAR A_GIMME
#else
#define FLEXTTPN_NULL 0
@@ -422,29 +425,37 @@ fts_module_t __##NAME##_module = {#NAME,#NAME,__##NAME##_initfun,0,0};
#define FLEXTTPN_FLOAT 3
#define FLEXTTPN_SYM 4
#define FLEXTTPN_VAR 5
+ #define FLEXTTPN_DEFINT 6
+ #define FLEXTTPN_DEFFLOAT 7
+ #define FLEXTTPN_DEFSYM 8
#endif
// Shortcuts for PD/Max type arguments
#define FLEXTTYPE_void FLEXTTPN_NULL
#define CALLBTYPE_void void
#define FLEXTTYPE_float FLEXTTPN_FLOAT
+#define FLEXTTYPE_float0 FLEXTTPN_DEFFLOAT
#define CALLBTYPE_float float
#define FLEXTTYPE_t_float FLEXTTPN_FLOAT
#define CALLBTYPE_t_float t_float
#if FLEXT_SYS == FLEXT_SYS_PD
#define FLEXTTYPE_int FLEXTTPN_FLOAT
+#define FLEXTTYPE_int0 FLEXTTPN_DEFFLOAT
#define CALLBTYPE_int float
#elif FLEXT_SYS == FLEXT_SYS_MAX || FLEXT_SYS == FLEXT_SYS_JMAX
#define FLEXTTYPE_int FLEXTTPN_INT
+#define FLEXTTYPE_int0 FLEXTTPN_DEFINT
#define CALLBTYPE_int int
#else
#error
#endif
#define FLEXTTYPE_t_symptr FLEXTTPN_SYM
+#define FLEXTTYPE_t_symptr0 FLEXTTPN_DEFSYM
#define CALLBTYPE_t_symptr t_symptr
-#define FLEXTTYPE_t_symtype FLEXTTPN_SYM
+#define FLEXTTYPE_t_symtype FLEXTTYPE_t_symptr
+#define FLEXTTYPE_t_symtype0 FLEXTTYPE_t_symptr0
#define CALLBTYPE_t_symtype t_symptr
#define FLEXTTYPE_t_ptrtype FLEXTTPN_PTR
#define CALLBTYPE_t_ptrtype t_ptrtype
@@ -454,10 +465,14 @@ fts_module_t __##NAME##_module = {#NAME,#NAME,__##NAME##_initfun,0,0};
#define ARGMEMBER_int(a) GetInt(a)
+#define ARGMEMBER_int0(a) ARGMEMBER_int(a)
#define ARGMEMBER_float(a) GetFloat(a)
+#define ARGMEMBER_float0(a) ARGMEMBER_float(a)
#define ARGMEMBER_t_symptr(a) GetSymbol(a)
-#define ARGMEMBER_t_symtype(a) GetSymbol(a)
-#define ARGCAST(arg,tp) ARGMEMBER_##tp(arg)
+#define ARGMEMBER_t_symptr0(a) ARGMEMBER_t_symptr(a)
+#define ARGMEMBER_t_symtype(a) ARGMEMBER_t_symptr(a)
+#define ARGMEMBER_t_symtype0(a) ARGMEMBER_t_symptr0(a)
+#define ARGCAST(a,tp) ARGMEMBER_##tp(a)
#define REAL_NEW(NAME,NEW_CLASS,DSP,LIB) \
@@ -483,7 +498,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB)
#define REAL_NEW_1(NAME,NEW_CLASS,DSP,LIB, TYPE1) \
-flext_obj *NEW_CLASS::__init__(int ,t_atom *argv) \
+flext_obj *NEW_CLASS::__init__(int,t_atom *argv) \
{ \
return new NEW_CLASS(ARGCAST(argv[0],TYPE1)); \
} \
@@ -494,7 +509,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB)
#define REAL_NEW_2(NAME,NEW_CLASS,DSP,LIB, TYPE1,TYPE2) \
-flext_obj *NEW_CLASS::__init__(int ,t_atom *argv) \
+flext_obj *NEW_CLASS::__init__(int,t_atom *argv) \
{ \
return new NEW_CLASS(ARGCAST(argv[0],TYPE1),ARGCAST(argv[1],TYPE2)); \
} \
@@ -505,7 +520,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB)
#define REAL_NEW_3(NAME,NEW_CLASS,DSP,LIB, TYPE1, TYPE2, TYPE3) \
-flext_obj *NEW_CLASS::__init__(int ,t_atom *argv) \
+flext_obj *NEW_CLASS::__init__(int,t_atom *argv) \
{ \
return new NEW_CLASS(ARGCAST(argv[0],TYPE1),ARGCAST(argv[1],TYPE2),ARGCAST(argv[2],TYPE3)); \
} \
@@ -516,7 +531,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB)
#define REAL_NEW_4(NAME,NEW_CLASS,DSP,LIB, TYPE1,TYPE2, TYPE3, TYPE4) \
-flext_obj *NEW_CLASS::__init__(int ,t_atom *argv) \
+flext_obj *NEW_CLASS::__init__(int,t_atom *argv) \
{ \
return new NEW_CLASS(ARGCAST(argv[0],TYPE1),ARGCAST(argv[1],TYPE2),ARGCAST(argv[2],TYPE3),ARGCAST(argv[3],TYPE4)); \
} \
diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp
index 203d65e3..203f4aa9 100755
--- a/externals/grill/flext/source/fllib.cpp
+++ b/externals/grill/flext/source/fllib.cpp
@@ -324,38 +324,50 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv)
if(lo->argc > FLEXT_MAXNEWARGS) { ERRINTERNAL(); ok = false; }
#endif
- if(argc == lo->argc) {
- for(int i = 0; /*ok &&*/ i < lo->argc; ++i) {
- switch(lo->argv[i]) {
+ int misnum = 0;
+ if(argc > lo->argc) { ok = false; misnum = 1; }
+
+ for(int i = 0; ok && i < lo->argc; ++i) {
+ switch(lo->argv[i]) {
#if FLEXT_SYS != FLEXT_SYS_PD
- case FLEXTTPN_INT:
- if(IsInt(argv[i])) args[i] = argv[i];
- else if(flext::IsFloat(argv[i])) flext::SetInt(args[i],(int)flext::GetFloat(argv[i]));
- else ok = false;
- break;
+ case FLEXTTPN_INT:
+ case FLEXTTPN_DEFINT:
+ if(i >= argc)
+ if(lo->argv[i] == FLEXTTPN_DEFINT) SetInt(args[i],0);
+ else { misnum = -1,ok = false; break; }
+ else if(IsInt(argv[i])) args[i] = argv[i];
+ else if(IsFloat(argv[i])) SetInt(args[i],(int)GetFloat(argv[i]));
+ else ok = false;
+ break;
#endif
- case FLEXTTPN_FLOAT:
- if(IsInt(argv[i])) flext::SetFloat(args[i],(float)flext::GetInt(argv[i]));
- else if(flext::IsFloat(argv[i])) args[i] = argv[i];
- else ok = false;
- break;
- case FLEXTTPN_SYM:
- // \todo shall we analyze the patcher args????... should already be done!
- if(IsSymbol(argv[i]))
+ case FLEXTTPN_FLOAT:
+ case FLEXTTPN_DEFFLOAT:
+ if(i >= argc)
+ if(lo->argv[i] == FLEXTTPN_DEFFLOAT) SetFloat(args[i],0);
+ else { misnum = -1,ok = false; break; }
+ else if(IsInt(argv[i])) SetFloat(args[i],(float)GetInt(argv[i]));
+ else if(IsFloat(argv[i])) args[i] = argv[i];
+ else ok = false;
+ break;
+ case FLEXTTPN_SYM:
+ case FLEXTTPN_DEFSYM:
+ // \todo shall we analyze the patcher args????... should already be done!
+ if(i >= argc)
+ if(lo->argv[i] == FLEXTTPN_DEFSYM) SetSymbol(args[i],sym__);
+ else { misnum = -1,ok = false; break; }
+ else if(IsSymbol(argv[i]))
// SetSymbol(args[i],GetParamSym(GetSymbol(argv[i]),NULL));
- args[i] = argv[i];
- else ok = false;
- break;
- }
- }
-
- if(!ok)
- post("%s: Creation arguments do not match",GetString(s));
- }
- else {
- error("%s: %s creation arguments",GetString(s),argc < lo->argc?"Not enough":"Too many");
- ok = false;
+ args[i] = argv[i];
+ else ok = false;
+ break;
+ }
}
+
+ if(!ok)
+ if(misnum)
+ error("%s: %s creation arguments",GetString(s),misnum < 0?"Not enough":"Too many");
+ else
+ error("%s: Creation arguments do not match",GetString(s));
}
if(ok) {
diff --git a/externals/grill/flext/source/flstdc.h b/externals/grill/flext/source/flstdc.h
index 402ce01a..13ac68b5 100644
--- a/externals/grill/flext/source/flstdc.h
+++ b/externals/grill/flext/source/flstdc.h
@@ -2,7 +2,7 @@
flext - C++ layer for Max/MSP and pd (pure data) externals
-Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net)
+Copyright (c) 2001-2004 Thomas Grill (xovo@gmx.net)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
@@ -77,6 +77,7 @@ typedef t_clock t_qelem;
#define A_NOTHING A_NULL
#define A_FLINT A_FLOAT
#define A_DEFFLINT A_DEFFLOAT
+#define A_DEFSYMBOL A_DEFSYM
#elif FLEXT_SYS == FLEXT_SYS_MAX
@@ -135,10 +136,18 @@ typedef void t_binbuf;
#define A_INT A_LONG
#endif
+#ifndef A_DEFINT
+#define A_DEFINT A_DEFLONG
+#endif
+
#ifndef A_SYMBOL
#define A_SYMBOL A_SYM
#endif
+#ifndef A_DEFSYMBOL
+#define A_DEFSYMBOL A_DEFSYM
+#endif
+
#elif FLEXT_SYS == FLEXT_SYS_JMAX
diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp
index b322731f..abec1994 100644
--- a/externals/grill/flext/source/flsupport.cpp
+++ b/externals/grill/flext/source/flsupport.cpp
@@ -23,6 +23,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define snprintf _snprintf
#endif
+const t_symbol *flext::sym__ = NULL;
const t_symbol *flext::sym_float = NULL;
const t_symbol *flext::sym_symbol = NULL;
const t_symbol *flext::sym_bang = NULL;
@@ -50,6 +51,7 @@ void flext::Setup()
else issetup = true;
#if FLEXT_SYS == FLEXT_SYS_PD
+ sym__ = gensym("");
sym_anything = gensym("anything");
sym_pointer = gensym("pointer");
sym_float = gensym("float");
@@ -59,6 +61,7 @@ void flext::Setup()
sym_signal = gensym("signal");
sym_int = gensym("int");
#elif FLEXT_SYS == FLEXT_SYS_MAX
+ sym__ = gensym("");
sym_int = gensym("int");
sym_float = gensym("float");
sym_symbol = gensym("symbol");
@@ -66,6 +69,7 @@ void flext::Setup()
sym_list = gensym("list");
sym_anything = gensym("anything");
#elif FLEXT_SYS == FLEXT_SYS_JMAX
+ sym__ = fts_new_symbol("");; // is there a static symbol for that?
sym_int = fts_s_int;
sym_float = fts_s_float;
sym_symbol = fts_s_symbol;
diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h
index fca7535e..feff1fa3 100644
--- a/externals/grill/flext/source/flsupport.h
+++ b/externals/grill/flext/source/flsupport.h
@@ -289,6 +289,8 @@ public:
@{
*/
+ //! Symbol constant for ""
+ static const t_symbol *sym__;
//! Symbol constant for "float"
static const t_symbol *sym_float;
//! Symbol constant for "symbol"