Update of /cvsroot/pure-data/externals/grill/flext/source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29382/source
Modified Files:
flout.cpp
Log Message:
""
Index: flout.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flout.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** flout.cpp 21 Jun 2004 13:58:19 -0000 1.16
--- flout.cpp 31 Aug 2004 04:01:13 -0000 1.17
***************
*** 68,251 ****
// digest inlist
! {
! xlet *xi;
! incnt = 0;
! for(xi = inlist; xi; xi = xi->nxt) ++incnt;
! xlet::type *list = new xlet::type[incnt];
! int i;
! for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp;
!
#if FLEXT_SYS == FLEXT_SYS_MAX
! // copy inlet descriptions
! indesc = new char *[incnt];
! for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) {
! int l = xi->desc?strlen(xi->desc):0;
! if(l) {
! indesc[i] = new char[l+1];
! memcpy(indesc[i],xi->desc,l);
! indesc[i][l] = 0;
! }
! else
! indesc[i] = NULL;
}
#endif
- delete inlist; inlist = NULL;
-
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
! inlets = new px_object *[incnt];
! for(i = 0; i < incnt; ++i) inlets[i] = NULL;
#endif
!
! // type info is now in list array
#if FLEXT_SYS == FLEXT_SYS_PD
! {
! int cnt = 0;
! if(incnt >= 1) {
! switch(list[0]) {
! case xlet::tp_sig:
! ++insigs;
! break;
! default:
! // leftmost inlet is already there...
! break;
! }
! ++cnt;
! }
! for(int ix = 1; ix < incnt; ++ix,++cnt) {
! switch(list[ix]) {
! case xlet::tp_float:
! case xlet::tp_int: {
! char sym[] = "ft??";
! if(ix >= 10) {
! if(compatibility) {
! // Max allows max. 9 inlets
! post("%s: Only 9 float/int inlets allowed in compatibility mode",thisName());
! ok = false;
! }
! else {
! if(ix > 99)
! post("%s: Inlet index > 99 not allowed for float/int inlets",thisName());
! sym[2] = '0'+ix/10,sym[3] = '0'+ix%10;
! }
! }
! else
! sym[2] = '0'+ix,sym[3] = 0;
! if(ok) inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_float, gensym(sym));
! break;
! }
! case xlet::tp_sym:
! (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
! inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_symbol, (t_symbol *)sym_symbol);
! break;
! case xlet::tp_list:
! (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
! inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_list, (t_symbol *)sym_list);
! break;
! case xlet::tp_any:
! (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
! inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, 0, 0);
! break;
! case xlet::tp_sig:
! if(compatibility && list[ix-1] != xlet::tp_sig) {
! post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
ok = false;
}
else {
! // pd doesn't seem to be able to handle signals and messages into the same inlet...
!
! inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_signal, (t_symbol *)sym_signal);
! ++insigs;
}
! break;
! default:
! error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
ok = false;
! }
! }
! incnt = cnt;
}
#elif FLEXT_SYS == FLEXT_SYS_MAX
! {
! int ix,cnt;
! // count leftmost signal inlets
! while(insigs < incnt && list[insigs] == xlet::tp_sig) ++insigs;
!
! for(cnt = 0,ix = incnt-1; ix >= insigs; --ix,++cnt) {
! if(ix == 0) {
! if(list[ix] != xlet::tp_any) {
! error("%s: Leftmost inlet must be of type signal or anything",thisName());
! ok = false;
! }
! }
! else {
! switch(list[ix]) {
! case xlet::tp_sig:
! error("%s: All signal inlets must be left-aligned",thisName());
! ok = false;
! break;
! case xlet::tp_float:
! if(ix >= 10) {
! post("%s: Only 9 float inlets possible",thisName());
! ok = false;
! }
! else
! floatin(x_obj,ix);
! break;
! case xlet::tp_int:
! if(ix >= 10) {
! post("%s: Only 9 int inlets possible",thisName());
! ok = false;
! }
! else
! intin(x_obj,ix);
! break;
! case xlet::tp_any: // non-leftmost
! case xlet::tp_sym:
! case xlet::tp_list:
! inlets[ix] = (px_object *)proxy_new(x_obj,ix,&((flext_hdr *)x_obj)->curinlet);
! break;
! default:
! error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
! ok = false;
! }
}
}
!
! // incnt = cnt;
!
! if(insigs)
! // dsp_setup(thisHdr(),insigs); // signal inlets
! dsp_setupbox(thisHdr(),insigs); // signal inlets
! }
! #elif FLEXT_SYS == FLEXT_SYS_JMAX
! {
! t_class *cl = thisClass();
! int cnt = 0;
! for(int ix = 0; ix < incnt; ++ix,++cnt) {
switch(list[ix]) {
- case xlet::tp_float:
- case xlet::tp_int:
- // fts_class_inlet_number(cl, ix, jmax_proxy);
- break;
- case xlet::tp_sym:
- // fts_class_inlet_symbol(cl, ix, jmax_proxy);
- break;
case xlet::tp_sig:
! if(compatibility && list[ix-1] != xlet::tp_sig) {
! post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
ok = false;
}
! else {
! if(!insigs) fts_dsp_declare_inlet(cl,0);
! ++insigs;
}
! // no break -> let a signal inlet also accept any messages
case xlet::tp_list:
! case xlet::tp_any:
! // fts_class_inlet_varargs(cl,ix, jmax_proxy);
break;
default:
--- 68,223 ----
// digest inlist
!
! xlet *xi;
! incnt = 0;
! for(xi = inlist; xi; xi = xi->nxt) ++incnt;
! xlet::type *list = new xlet::type[incnt];
! int i;
! for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp;
!
#if FLEXT_SYS == FLEXT_SYS_MAX
! // copy inlet descriptions
! indesc = new char *[incnt];
! for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) {
! int l = xi->desc?strlen(xi->desc):0;
! if(l) {
! indesc[i] = new char[l+1];
! memcpy(indesc[i],xi->desc,l);
! indesc[i][l] = 0;
}
+ else
+ indesc[i] = NULL;
+ }
#endif
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
! inlets = new px_object *[incnt];
! for(i = 0; i < incnt; ++i) inlets[i] = NULL;
#endif
!
! // type info is now in list array
#if FLEXT_SYS == FLEXT_SYS_PD
! {
! int cnt = 0;
! xi = inlist; // points to first inlet
! if(incnt >= 1) {
! switch(list[0]) {
! case xlet::tp_sig:
! ++insigs;
! break;
! default:
! // leftmost inlet is already there...
! break;
! }
! ++cnt;
! #if PD_MINOR_VERSION >= 37 && defined(PD_DEVEL_VERSION)
! // set tooltip
! if(xi->desc && *xi->desc) class_settip(thisClass(),gensym(xi->desc));
! #endif
! }
!
! for(int ix = 1; ix < incnt; ++ix,++cnt) {
! xi = xi->nxt; // points to next inlet
!
! t_inlet *in = NULL;
! switch(list[ix]) {
! case xlet::tp_float:
! case xlet::tp_int: {
! char sym[] = "ft??";
! if(ix >= 10) {
! if(compatibility) {
! // Max allows max. 9 inlets
! post("%s: Only 9 float/int inlets allowed in compatibility mode",thisName());
ok = false;
}
else {
! if(ix > 99)
! post("%s: Inlet index > 99 not allowed for float/int inlets",thisName());
! sym[2] = '0'+ix/10,sym[3] = '0'+ix%10;
}
! }
! else
! sym[2] = '0'+ix,sym[3] = 0;
! if(ok) in = inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_float, gensym(sym));
! break;
! }
! case xlet::tp_sym:
! (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
! in = inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_symbol, (t_symbol *)sym_symbol);
! break;
! case xlet::tp_list:
! (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
! in = inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_list, (t_symbol *)sym_list);
! break;
! case xlet::tp_any:
! (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
! in = inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, 0, 0);
! break;
! case xlet::tp_sig:
! if(compatibility && list[ix-1] != xlet::tp_sig) {
! post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
ok = false;
! }
! else {
! // pd doesn't seem to be able to handle signals and messages into the same inlet...
!
! in = inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_signal, (t_symbol *)sym_signal);
! ++insigs;
! }
! break;
! default:
! error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
! ok = false;
! }
! #if PD_MINOR_VERSION >= 37 && defined(PD_DEVEL_VERSION)
! // set tooltip
! if(in && xi->desc && *xi->desc) inlet_settip(in,gensym(xi->desc));
! #endif
}
+
+ incnt = cnt;
+ }
#elif FLEXT_SYS == FLEXT_SYS_MAX
! {
! int ix,cnt;
! // count leftmost signal inlets
! while(insigs < incnt && list[insigs] == xlet::tp_sig) ++insigs;
!
! for(cnt = 0,ix = incnt-1; ix >= insigs; --ix,++cnt) {
! if(ix == 0) {
! if(list[ix] != xlet::tp_any) {
! error("%s: Leftmost inlet must be of type signal or anything",thisName());
! ok = false;
}
}
! else {
switch(list[ix]) {
case xlet::tp_sig:
! error("%s: All signal inlets must be left-aligned",thisName());
! ok = false;
! break;
! case xlet::tp_float:
! if(ix >= 10) {
! post("%s: Only 9 float inlets possible",thisName());
ok = false;
}
! else
! floatin(x_obj,ix);
! break;
! case xlet::tp_int:
! if(ix >= 10) {
! post("%s: Only 9 int inlets possible",thisName());
! ok = false;
}
! else
! intin(x_obj,ix);
! break;
! case xlet::tp_any: // non-leftmost
! case xlet::tp_sym:
case xlet::tp_list:
! inlets[ix] = (px_object *)proxy_new(x_obj,ix,&((flext_hdr *)x_obj)->curinlet);
break;
default:
***************
*** 254,268 ****
}
}
! incnt = cnt;
! fts_object_set_inlets_number((fts_object_t *)thisHdr(), incnt);
}
#else
#error
#endif
! delete[] list;
! }
return ok;
--- 226,281 ----
}
}
+ }
! // incnt = cnt;
! if(insigs)
! // dsp_setup(thisHdr(),insigs); // signal inlets
! dsp_setupbox(thisHdr(),insigs); // signal inlets
! }
! #elif FLEXT_SYS == FLEXT_SYS_JMAX
! {
! t_class *cl = thisClass();
! int cnt = 0;
! for(int ix = 0; ix < incnt; ++ix,++cnt) {
! switch(list[ix]) {
! case xlet::tp_float:
! case xlet::tp_int:
! // fts_class_inlet_number(cl, ix, jmax_proxy);
! break;
! case xlet::tp_sym:
! // fts_class_inlet_symbol(cl, ix, jmax_proxy);
! break;
! case xlet::tp_sig:
! if(compatibility && list[ix-1] != xlet::tp_sig) {
! post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
! ok = false;
! }
! else {
! if(!insigs) fts_dsp_declare_inlet(cl,0);
! ++insigs;
! }
! // no break -> let a signal inlet also accept any messages
! case xlet::tp_list:
! case xlet::tp_any:
! // fts_class_inlet_varargs(cl,ix, jmax_proxy);
! break;
! default:
! error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
! ok = false;
! }
}
+
+ incnt = cnt;
+
+ fts_object_set_inlets_number((fts_object_t *)thisHdr(), incnt);
+ }
#else
#error
#endif
! delete inlist; inlist = NULL;
!
! delete[] list;
return ok;
***************
*** 313,318 ****
#endif
- delete outlist; outlist = NULL;
-
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
outlets = new outlet *[outcnt+(procattr?1:0)];
--- 326,329 ----
***************
*** 401,404 ****
--- 412,417 ----
#endif
+ delete outlist; outlist = NULL;
+
return ok;
}