Update of /cvsroot/pure-data/externals/zexy/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27121/src
Modified Files:
list2symbol.c
Log Message:
changed [l2s] argument incompatibly: the argument is now the delimiter
(analogous to [s2l]) instead of the default list to be converted.
while this is an incompatible change, i noticed that the argument handling
was broken anyhow (produced rather random results, even in the help-file!)
and since nobody noticed i guess the arguments are not used anyhow....
Index: list2symbol.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/list2symbol.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** list2symbol.c 5 Apr 2006 11:27:26 -0000 1.8
--- list2symbol.c 28 Jun 2006 15:53:01 -0000 1.9
***************
*** 33,36 ****
--- 33,38 ----
t_atom *ap;
t_symbol *s,*connector;
+ t_inlet *x_inlet2;
+ t_outlet*x_outlet;
} t_list2symbol;
***************
*** 49,55 ****
char connlen=0;
char*buffer = (char*)getbytes(MAXPDSTRING*sizeof(char));
! if(x->connector)connector=x->connector->s_name;
! if(connector)connlen=strlen(connector);
!
/* 1st get the length of the symbol */
if(x->s)length+=strlen(x->s->s_name);
--- 51,59 ----
char connlen=0;
char*buffer = (char*)getbytes(MAXPDSTRING*sizeof(char));
! if(x->connector){
! connector=x->connector->s_name;
! connlen=strlen(connector);
! }
!
/* 1st get the length of the symbol */
if(x->s)length+=strlen(x->s->s_name);
***************
*** 80,87 ****
if (x->s){
char *buf = x->s->s_name;
! strcpy(result+len, buf);
! len+=strlen(buf);
if(i && connector){
! strcpy(result+len, connector);
len += connlen;
}
--- 84,92 ----
if (x->s){
char *buf = x->s->s_name;
! int buflen=strlen(buf);
! strncpy(result+len, buf, length-len);
! len+=buflen;
if(i && connector){
! strncpy(result+len, connector, length-len);
len += connlen;
}
***************
*** 91,104 ****
while(i--){
if(A_SYMBOL==argv->a_type){
! strcpy(result+len, argv->a_w.w_symbol->s_name);
len+= strlen(argv->a_w.w_symbol->s_name);
} else {
atom_string(argv, buffer, MAXPDSTRING);
! strcpy(result+len, buffer);
len += strlen(buffer);
}
argv++;
if(i && connector){
! strcpy(result+len, connector);
len += connlen;
}
--- 96,109 ----
while(i--){
if(A_SYMBOL==argv->a_type){
! strncpy(result+len, argv->a_w.w_symbol->s_name, length-len);
len+= strlen(argv->a_w.w_symbol->s_name);
} else {
atom_string(argv, buffer, MAXPDSTRING);
! strncpy(result+len, buffer, length-len);
len += strlen(buffer);
}
argv++;
if(i && connector){
! strncpy(result+len, connector, length-len);
len += connlen;
}
***************
*** 113,120 ****
static void list2symbol_anything(t_list2symbol *x, t_symbol *s, int argc, t_atom *argv)
{
x->s =s;
x->ac=argc;
! x->ap=argv;
!
list2symbol_bang(x);
}
--- 118,136 ----
static void list2symbol_anything(t_list2symbol *x, t_symbol *s, int argc, t_atom *argv)
{
+ if(x->ap){
+ freebytes(x->ap, x->ac*sizeof(t_atom));
+ x->ap=0;
+ }
+
x->s =s;
x->ac=argc;
!
! x->ap=(t_atom*)getbytes(x->ac*sizeof(t_atom));
! if(x->ap){
! t_atom*ap=x->ap;
! while(argc--){
! *ap++=*argv++;
! }
! }
list2symbol_bang(x);
}
***************
*** 122,126 ****
static void list2symbol_list(t_list2symbol *x, t_symbol *s, int argc, t_atom *argv)
{
- ZEXY_USEVAR(s);
list2symbol_anything(x, 0, argc, argv);
}
--- 138,141 ----
***************
*** 128,137 ****
{
t_list2symbol *x = (t_list2symbol *)pd_new(list2symbol_class);
- ZEXY_USEVAR(s);
! outlet_new(&x->x_obj, 0);
! inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("symbol"), gensym(""));
x->connector = gensym(" ");
list2symbol_anything(x, 0, argc, argv);
return (x);
--- 143,159 ----
{
t_list2symbol *x = (t_list2symbol *)pd_new(list2symbol_class);
! x->x_outlet=outlet_new(&x->x_obj, 0);
! x->x_inlet2=inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("symbol"), gensym(""));
!
! #if 0
! /* old behaviour: the argument list is used as the list-to-be-converted */
x->connector = gensym(" ");
list2symbol_anything(x, 0, argc, argv);
+ #else
+ /* new behaviour: set the delimiter with the argument */
+ list2symbol_connector(x, (argc)?atom_getsymbol(argv):gensym(" "));
+ #endif
+
return (x);
***************
*** 140,144 ****
static void list2symbol_free(t_list2symbol *x)
{
! ZEXY_USEVAR(x);
}
--- 162,171 ----
static void list2symbol_free(t_list2symbol *x)
{
! if(x->ap){
! freebytes(x->ap, x->ac*sizeof(t_atom));
! x->ap=0;
! }
! outlet_free(x->x_outlet);
! inlet_free(x->x_inlet2);
}
***************
*** 147,151 ****
{
list2symbol_class = class_new(gensym("list2symbol"), (t_newmethod)list2symbol_new,
! (t_method)list2symbol_free, sizeof(t_list2symbol), 0, A_GIMME, 0);
class_addcreator((t_newmethod)list2symbol_new, gensym("l2s"), A_GIMME, 0);
--- 174,179 ----
{
list2symbol_class = class_new(gensym("list2symbol"), (t_newmethod)list2symbol_new,
! (t_method)list2symbol_free, sizeof(t_list2symbol), 0,
! A_GIMME, 0);
class_addcreator((t_newmethod)list2symbol_new, gensym("l2s"), A_GIMME, 0);