Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
nerrons
purr-data
Commits
7e270996
Commit
7e270996
authored
Jun 16, 2014
by
pokergaming
Browse files
more reformatting (tabs to spaces, lining up curly braces, explicit curly braces)
parent
bbe18fa6
Changes
5
Hide whitespace changes
Inline
Side-by-side
pd/src/m_class.c
View file @
7e270996
...
...
@@ -704,7 +704,7 @@ void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv)
int
narg
=
0
;
t_pd
*
bonzo
;
//fprintf(stderr,"\nstart %s %d\n", s->s_name, c->c_nmethod);
//fprintf(stderr,"\nstart %s %d\n", s->s_name, c->c_nmethod);
/* check for messages that are handled by fixed slots in the class
structure. We don't catch "pointer" though so that sending "pointer"
...
...
@@ -743,111 +743,116 @@ void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv)
return
;
}
for
(
i
=
c
->
c_nmethod
,
m
=
c
->
c_methods
;
i
--
;
m
++
)
//if (m->me_name == s)
if
(
m
&&
m
->
me_name
==
s
)
{
//fprintf(stderr,"me_name %s\n", m->me_name);
wp
=
m
->
me_arg
;
if
(
*
wp
==
A_GIMME
)
{
if
(
x
==
&
pd_objectmaker
)
newest
=
(
*
((
t_newgimme
)(
m
->
me_fun
)))(
s
,
argc
,
argv
);
else
(
*
((
t_messgimme
)(
m
->
me_fun
)))(
x
,
s
,
argc
,
argv
);
return
;
}
if
(
argc
>
MAXPDARG
)
argc
=
MAXPDARG
;
if
(
x
!=
&
pd_objectmaker
)
*
(
ap
++
)
=
(
t_int
)
x
,
narg
++
;
while
(
wanttype
=
*
wp
++
)
//if (m->me_name == s)
if
(
m
&&
m
->
me_name
==
s
)
{
switch
(
wanttype
)
//fprintf(stderr,"me_name %s\n", m->me_name);
wp
=
m
->
me_arg
;
if
(
*
wp
==
A_GIMME
)
{
case
A_POINTER
:
if
(
!
argc
)
goto
badarg
;
else
{
if
(
argv
->
a_type
==
A_POINTER
)
*
ap
=
(
t_int
)(
argv
->
a_w
.
w_gpointer
);
else
goto
badarg
;
argc
--
;
argv
++
;
}
narg
++
;
ap
++
;
break
;
case
A_FLOAT
:
if
(
!
argc
)
goto
badarg
;
case
A_DEFFLOAT
:
if
(
!
argc
)
*
dp
=
0
;
else
{
if
(
argv
->
a_type
==
A_FLOAT
)
*
dp
=
argv
->
a_w
.
w_float
;
else
goto
badarg
;
argc
--
;
argv
++
;
}
dp
++
;
break
;
case
A_BLOB
:
/* MP 20070106 blob type */
/*post("pd_typedmess A_BLOB");*/
if
(
!
argc
)
goto
badarg
;
if
(
argv
->
a_type
==
A_BLOB
)
{
/*post("argv->a_type == A_BLOB, argc = %d, narg= %d", argc, narg);*/
*
ap
=
(
t_int
)(
argv
->
a_w
.
w_blob
);
}
argc
--
;
argv
++
;
narg
++
;
ap
++
;
break
;
case
A_SYMBOL
:
if
(
!
argc
)
goto
badarg
;
case
A_DEFSYM
:
if
(
!
argc
)
*
ap
=
(
t_int
)(
&
s_
);
else
if
(
x
==
&
pd_objectmaker
)
newest
=
(
*
((
t_newgimme
)(
m
->
me_fun
)))(
s
,
argc
,
argv
);
else
(
*
((
t_messgimme
)(
m
->
me_fun
)))(
x
,
s
,
argc
,
argv
);
return
;
}
if
(
argc
>
MAXPDARG
)
argc
=
MAXPDARG
;
if
(
x
!=
&
pd_objectmaker
)
*
(
ap
++
)
=
(
t_int
)
x
,
narg
++
;
while
(
wanttype
=
*
wp
++
)
{
switch
(
wanttype
)
{
if
(
argv
->
a_type
==
A_SYMBOL
)
*
ap
=
(
t_int
)(
argv
->
a_w
.
w_symbol
);
/* if it's an unfilled "dollar" argument it appears
as zero here; cheat and bash it to the null
symbol. Unfortunately, this lets real zeros
pass as symbols too, which seems wrong... */
else
if
(
x
==
&
pd_objectmaker
&&
argv
->
a_type
==
A_FLOAT
&&
argv
->
a_w
.
w_float
==
0
)
*
ap
=
(
t_int
)(
&
s_
);
else
goto
badarg
;
case
A_POINTER
:
if
(
!
argc
)
goto
badarg
;
else
{
if
(
argv
->
a_type
==
A_POINTER
)
*
ap
=
(
t_int
)(
argv
->
a_w
.
w_gpointer
);
else
goto
badarg
;
argc
--
;
argv
++
;
}
narg
++
;
ap
++
;
break
;
case
A_FLOAT
:
if
(
!
argc
)
goto
badarg
;
case
A_DEFFLOAT
:
if
(
!
argc
)
*
dp
=
0
;
else
{
if
(
argv
->
a_type
==
A_FLOAT
)
*
dp
=
argv
->
a_w
.
w_float
;
else
goto
badarg
;
argc
--
;
argv
++
;
}
dp
++
;
break
;
case
A_BLOB
:
/* MP 20070106 blob type */
/*post("pd_typedmess A_BLOB");*/
if
(
!
argc
)
goto
badarg
;
if
(
argv
->
a_type
==
A_BLOB
)
{
/*post("argv->a_type == A_BLOB, argc = %d, narg= %d",
// argc, narg);*/
*
ap
=
(
t_int
)(
argv
->
a_w
.
w_blob
);
}
argc
--
;
argv
++
;
narg
++
;
ap
++
;
break
;
case
A_SYMBOL
:
if
(
!
argc
)
goto
badarg
;
case
A_DEFSYM
:
if
(
!
argc
)
*
ap
=
(
t_int
)(
&
s_
);
else
{
if
(
argv
->
a_type
==
A_SYMBOL
)
*
ap
=
(
t_int
)(
argv
->
a_w
.
w_symbol
);
/* if it's an unfilled "dollar" argument it
appears as zero here; cheat and bash it
to the null symbol. Unfortunately, this
lets real zeros pass as symbols too, which
seems wrong... */
else
if
(
x
==
&
pd_objectmaker
&&
argv
->
a_type
==
A_FLOAT
&&
argv
->
a_w
.
w_float
==
0
)
*
ap
=
(
t_int
)(
&
s_
);
else
goto
badarg
;
argc
--
;
argv
++
;
}
narg
++
;
ap
++
;
}
narg
++
;
ap
++
;
}
switch
(
narg
)
{
case
0
:
bonzo
=
(
*
(
t_fun0
)(
m
->
me_fun
))
(
ad
[
0
],
ad
[
1
],
ad
[
2
],
ad
[
3
],
ad
[
4
]);
break
;
case
1
:
bonzo
=
(
*
(
t_fun1
)(
m
->
me_fun
))
(
ai
[
0
],
ad
[
0
],
ad
[
1
],
ad
[
2
],
ad
[
3
],
ad
[
4
]);
break
;
case
2
:
bonzo
=
(
*
(
t_fun2
)(
m
->
me_fun
))
(
ai
[
0
],
ai
[
1
],
ad
[
0
],
ad
[
1
],
ad
[
2
],
ad
[
3
],
ad
[
4
]);
break
;
case
3
:
bonzo
=
(
*
(
t_fun3
)(
m
->
me_fun
))
(
ai
[
0
],
ai
[
1
],
ai
[
2
],
ad
[
0
],
ad
[
1
],
ad
[
2
],
ad
[
3
],
ad
[
4
]);
break
;
case
4
:
bonzo
=
(
*
(
t_fun4
)(
m
->
me_fun
))
(
ai
[
0
],
ai
[
1
],
ai
[
2
],
ai
[
3
],
ad
[
0
],
ad
[
1
],
ad
[
2
],
ad
[
3
],
ad
[
4
]);
break
;
case
5
:
bonzo
=
(
*
(
t_fun5
)(
m
->
me_fun
))
(
ai
[
0
],
ai
[
1
],
ai
[
2
],
ai
[
3
],
ai
[
4
],
ad
[
0
],
ad
[
1
],
ad
[
2
],
ad
[
3
],
ad
[
4
]);
break
;
case
6
:
bonzo
=
(
*
(
t_fun6
)(
m
->
me_fun
))
(
ai
[
0
],
ai
[
1
],
ai
[
2
],
ai
[
3
],
ai
[
4
],
ai
[
5
],
ad
[
0
],
ad
[
1
],
ad
[
2
],
ad
[
3
],
ad
[
4
]);
break
;
default:
bonzo
=
0
;
}
if
(
x
==
&
pd_objectmaker
)
newest
=
bonzo
;
return
;
}
switch
(
narg
)
{
case
0
:
bonzo
=
(
*
(
t_fun0
)(
m
->
me_fun
))
(
ad
[
0
],
ad
[
1
],
ad
[
2
],
ad
[
3
],
ad
[
4
]);
break
;
case
1
:
bonzo
=
(
*
(
t_fun1
)(
m
->
me_fun
))
(
ai
[
0
],
ad
[
0
],
ad
[
1
],
ad
[
2
],
ad
[
3
],
ad
[
4
]);
break
;
case
2
:
bonzo
=
(
*
(
t_fun2
)(
m
->
me_fun
))
(
ai
[
0
],
ai
[
1
],
ad
[
0
],
ad
[
1
],
ad
[
2
],
ad
[
3
],
ad
[
4
]);
break
;
case
3
:
bonzo
=
(
*
(
t_fun3
)(
m
->
me_fun
))
(
ai
[
0
],
ai
[
1
],
ai
[
2
],
ad
[
0
],
ad
[
1
],
ad
[
2
],
ad
[
3
],
ad
[
4
]);
break
;
case
4
:
bonzo
=
(
*
(
t_fun4
)(
m
->
me_fun
))
(
ai
[
0
],
ai
[
1
],
ai
[
2
],
ai
[
3
],
ad
[
0
],
ad
[
1
],
ad
[
2
],
ad
[
3
],
ad
[
4
]);
break
;
case
5
:
bonzo
=
(
*
(
t_fun5
)(
m
->
me_fun
))
(
ai
[
0
],
ai
[
1
],
ai
[
2
],
ai
[
3
],
ai
[
4
],
ad
[
0
],
ad
[
1
],
ad
[
2
],
ad
[
3
],
ad
[
4
]);
break
;
case
6
:
bonzo
=
(
*
(
t_fun6
)(
m
->
me_fun
))
(
ai
[
0
],
ai
[
1
],
ai
[
2
],
ai
[
3
],
ai
[
4
],
ai
[
5
],
ad
[
0
],
ad
[
1
],
ad
[
2
],
ad
[
3
],
ad
[
4
]);
break
;
default:
bonzo
=
0
;
}
if
(
x
==
&
pd_objectmaker
)
newest
=
bonzo
;
return
;
}
(
*
c
->
c_anymethod
)(
x
,
s
,
argc
,
argv
);
return
;
...
...
pd/src/m_conf.c
View file @
7e270996
...
...
@@ -88,7 +88,7 @@ void conf_init(void)
x_qlist_setup
();
x_gui_setup
();
x_list_setup
();
x_preset_setup
();
x_preset_setup
();
d_arithmetic_setup
();
d_array_setup
();
d_ctl_setup
();
...
...
pd/src/m_memory.c
View file @
7e270996
...
...
@@ -28,7 +28,7 @@ void *getbytes(size_t nbytes)
fprintf
(
stderr
,
"new %lx %d
\n
"
,
(
int
)
ret
,
nbytes
);
#endif
/* LOUD */
#ifdef DEBUGMEM
totalmem
+=
nbytes
;
#endif
if
(
!
ret
)
...
...
@@ -80,7 +80,7 @@ void freebytes(void *fatso, size_t nbytes)
totalmem
-=
nbytes
;
#endif
free
(
fatso
);
fatso
=
NULL
;
fatso
=
NULL
;
}
#ifdef DEBUGMEM
...
...
pd/src/m_obj.c
View file @
7e270996
...
...
@@ -337,15 +337,17 @@ struct _outconnect
{
struct
_outconnect
*
oc_next
;
t_pd
*
oc_to
;
int
oc_vis
;
// whether the connection should be visible
int
oc_vis
;
// whether the connection should be visible
};
int
outconnect_visible
(
t_outconnect
*
oc
)
{
return
oc
->
oc_vis
;
int
outconnect_visible
(
t_outconnect
*
oc
)
{
return
oc
->
oc_vis
;
}
void
outconnect_setvisible
(
t_outconnect
*
oc
,
int
vis
)
{
oc
->
oc_vis
=
vis
;
void
outconnect_setvisible
(
t_outconnect
*
oc
,
int
vis
)
{
oc
->
oc_vis
=
vis
;
}
struct
_outlet
...
...
@@ -482,16 +484,16 @@ void outlet_free(t_outlet *x)
t_outconnect
*
obj_connect
(
t_object
*
source
,
int
outno
,
t_object
*
sink
,
int
inno
)
{
//fprintf(stderr,"obj_connect\n");
//fprintf(stderr,"obj_connect\n");
t_inlet
*
i
;
t_outlet
*
o
;
t_pd
*
to
;
t_outconnect
*
oc
,
*
oc2
;
/* ignore attempts to connect to the same object
this occurs sometimes using undo/redo */
if
(
source
==
sink
)
return
(
0
);
/* ignore attempts to connect to the same object
this occurs sometimes using undo/redo */
if
(
source
==
sink
)
return
(
0
);
for
(
o
=
source
->
ob_outlet
;
o
&&
outno
;
o
=
o
->
o_next
,
outno
--
)
;
if
(
!
o
)
return
(
0
);
...
...
@@ -573,9 +575,9 @@ int obj_noutlets(t_object *x)
{
int
n
=
0
;
t_outlet
*
o
;
if
(
x
&&
x
->
ob_outlet
)
for
(
o
=
x
->
ob_outlet
,
n
=
0
;
o
;
o
=
o
->
o_next
)
n
++
;
return
(
n
);
if
(
x
&&
x
->
ob_outlet
)
for
(
o
=
x
->
ob_outlet
,
n
=
0
;
o
;
o
=
o
->
o_next
)
n
++
;
return
(
n
);
}
int
obj_ninlets
(
t_object
*
x
)
...
...
pd/src/m_pd.c
View file @
7e270996
...
...
@@ -20,12 +20,12 @@ extern t_redundant_mem *rm_end;
t_pd
*
pd_new
(
t_class
*
c
)
{
t_pd
*
x
=
NULL
;
t_pd
*
y
=
NULL
;
t_pd
*
y
=
NULL
;
if
(
!
c
)
bug
(
"pd_new: apparently called before setup routine"
);
x
=
(
t_pd
*
)
t_getbytes
(
c
->
c_size
);
x
=
(
t_pd
*
)
t_getbytes
(
c
->
c_size
);
*
x
=
c
;
if
(
c
->
c_patchable
)
{
...
...
@@ -68,7 +68,7 @@ typedef struct _bindelem
{
t_pd
*
e_who
;
struct
_bindelem
*
e_next
;
int
e_delayed_free
;
int
e_delayed_free
;
}
t_bindelem
;
typedef
struct
_bindlist
...
...
@@ -81,28 +81,28 @@ static int change_bindlist_via_graph = 0;
static
void
bindlist_cleanup
(
t_bindlist
*
x
)
{
//fprintf(stderr,"bindlist_cleanup\n");
t_bindelem
*
e
,
*
e2
;
//fprintf(stderr,"bindlist_cleanup\n");
t_bindelem
*
e
,
*
e2
;
if
(
x
->
b_list
->
e_delayed_free
==
1
)
{
e
=
x
->
b_list
;
e
=
x
->
b_list
;
x
->
b_list
=
e
->
e_next
;
freebytes
(
e
,
sizeof
(
t_bindelem
));
//fprintf(stderr,"success B1a\n");
//fprintf(stderr,"success B1a\n");
}
for
(
e
=
x
->
b_list
;
e2
=
e
->
e_next
;
e
=
e2
)
if
(
e2
->
e_delayed_free
==
1
)
{
e
->
e_next
=
e2
->
e_next
;
freebytes
(
e2
,
sizeof
(
t_bindelem
));
//fprintf(stderr,"success B1b\n");
//fprintf(stderr,"success B1b\n");
break
;
}
if
(
!
x
->
b_list
->
e_next
)
{
freebytes
(
x
->
b_list
,
sizeof
(
t_bindelem
));
pd_free
(
&
x
->
b_pd
);
//fprintf(stderr,"success B2\n");
//fprintf(stderr,"success B2\n");
}
}
...
...
@@ -110,48 +110,48 @@ static void bindlist_bang(t_bindlist *x)
{
t_bindelem
*
e
;
int
save
=
change_bindlist_via_graph
;
change_bindlist_via_graph
=
1
;
change_bindlist_via_graph
=
1
;
for
(
e
=
x
->
b_list
;
e
;
e
=
e
->
e_next
)
if
(
e
->
e_who
!=
NULL
)
pd_bang
(
e
->
e_who
);
if
(
change_bindlist_via_graph
>
1
)
bindlist_cleanup
(
x
);
change_bindlist_via_graph
=
save
;
if
(
change_bindlist_via_graph
>
1
)
bindlist_cleanup
(
x
);
change_bindlist_via_graph
=
save
;
}
static
void
bindlist_float
(
t_bindlist
*
x
,
t_float
f
)
{
t_bindelem
*
e
;
int
save
=
change_bindlist_via_graph
;
change_bindlist_via_graph
=
1
;
change_bindlist_via_graph
=
1
;
for
(
e
=
x
->
b_list
;
e
;
e
=
e
->
e_next
)
if
(
e
->
e_who
!=
NULL
)
pd_float
(
e
->
e_who
,
f
);
if
(
change_bindlist_via_graph
>
1
)
bindlist_cleanup
(
x
);
change_bindlist_via_graph
=
save
;
if
(
change_bindlist_via_graph
>
1
)
bindlist_cleanup
(
x
);
change_bindlist_via_graph
=
save
;
}
static
void
bindlist_symbol
(
t_bindlist
*
x
,
t_symbol
*
s
)
{
t_bindelem
*
e
;
int
save
=
change_bindlist_via_graph
;
change_bindlist_via_graph
=
1
;
change_bindlist_via_graph
=
1
;
for
(
e
=
x
->
b_list
;
e
;
e
=
e
->
e_next
)
if
(
e
->
e_who
!=
NULL
)
pd_symbol
(
e
->
e_who
,
s
);
if
(
change_bindlist_via_graph
>
1
)
bindlist_cleanup
(
x
);
change_bindlist_via_graph
=
save
;
if
(
change_bindlist_via_graph
>
1
)
bindlist_cleanup
(
x
);
change_bindlist_via_graph
=
save
;
}
static
void
bindlist_pointer
(
t_bindlist
*
x
,
t_gpointer
*
gp
)
{
t_bindelem
*
e
;
int
save
=
change_bindlist_via_graph
;
change_bindlist_via_graph
=
1
;
change_bindlist_via_graph
=
1
;
for
(
e
=
x
->
b_list
;
e
;
e
=
e
->
e_next
)
if
(
e
->
e_who
!=
NULL
)
pd_pointer
(
e
->
e_who
,
gp
);
if
(
change_bindlist_via_graph
>
1
)
bindlist_cleanup
(
x
);
change_bindlist_via_graph
=
save
;
if
(
change_bindlist_via_graph
>
1
)
bindlist_cleanup
(
x
);
change_bindlist_via_graph
=
save
;
}
static
void
bindlist_list
(
t_bindlist
*
x
,
t_symbol
*
s
,
...
...
@@ -159,12 +159,12 @@ static void bindlist_list(t_bindlist *x, t_symbol *s,
{
t_bindelem
*
e
;
int
save
=
change_bindlist_via_graph
;
change_bindlist_via_graph
=
1
;
change_bindlist_via_graph
=
1
;
for
(
e
=
x
->
b_list
;
e
;
e
=
e
->
e_next
)
if
(
e
->
e_who
!=
NULL
)
pd_list
(
e
->
e_who
,
s
,
argc
,
argv
);
if
(
change_bindlist_via_graph
>
1
)
bindlist_cleanup
(
x
);
change_bindlist_via_graph
=
save
;
if
(
change_bindlist_via_graph
>
1
)
bindlist_cleanup
(
x
);
change_bindlist_via_graph
=
save
;
}
static
void
bindlist_anything
(
t_bindlist
*
x
,
t_symbol
*
s
,
...
...
@@ -172,12 +172,12 @@ static void bindlist_anything(t_bindlist *x, t_symbol *s,
{
t_bindelem
*
e
;
int
save
=
change_bindlist_via_graph
;
change_bindlist_via_graph
=
1
;
change_bindlist_via_graph
=
1
;
for
(
e
=
x
->
b_list
;
e
;
e
=
e
->
e_next
)
if
(
e
->
e_who
!=
NULL
)
pd_typedmess
(
e
->
e_who
,
s
,
argc
,
argv
);
if
(
change_bindlist_via_graph
>
1
)
bindlist_cleanup
(
x
);
change_bindlist_via_graph
=
save
;
if
(
change_bindlist_via_graph
>
1
)
bindlist_cleanup
(
x
);
change_bindlist_via_graph
=
save
;
}
void
m_pd_setup
(
void
)
...
...
@@ -194,107 +194,118 @@ void m_pd_setup(void)
void
pd_bind
(
t_pd
*
x
,
t_symbol
*
s
)
{
//fprintf(stderr,"pd_bind %s\n", s->s_name);
//fprintf(stderr,"pd_bind %s\n", s->s_name);
if
(
s
->
s_thing
)
{
if
(
*
s
->
s_thing
==
bindlist_class
)
{
//fprintf(stderr,"pd_bind option 1A %lx\n", (t_int)x);
//fprintf(stderr,"pd_bind option 1A %lx\n", (t_int)x);
t_bindlist
*
b
=
(
t_bindlist
*
)
s
->
s_thing
;
t_bindelem
*
e
=
(
t_bindelem
*
)
getbytes
(
sizeof
(
t_bindelem
));
e
->
e_next
=
b
->
b_list
;
e
->
e_who
=
x
;
e
->
e_delayed_free
=
0
;
e
->
e_delayed_free
=
0
;
b
->
b_list
=
e
;
}
else
{
//fprintf(stderr,"pd_bind option 1B %lx\n", (t_int)x);
//fprintf(stderr,"pd_bind option 1B %lx\n", (t_int)x);
t_bindlist
*
b
=
(
t_bindlist
*
)
pd_new
(
bindlist_class
);
t_bindelem
*
e1
=
(
t_bindelem
*
)
getbytes
(
sizeof
(
t_bindelem
));
t_bindelem
*
e2
=
(
t_bindelem
*
)
getbytes
(
sizeof
(
t_bindelem
));
b
->
b_list
=
e1
;
e1
->
e_who
=
x
;
e1
->
e_next
=
e2
;
e1
->
e_delayed_free
=
0
;
e1
->
e_delayed_free
=
0
;
e2
->
e_who
=
s
->
s_thing
;
e2
->
e_next
=
0
;
e2
->
e_delayed_free
=
0
;
e2
->
e_delayed_free
=
0
;
s
->
s_thing
=
&
b
->
b_pd
;
}
}
else
{
//fprintf(stderr,"pd_bind option 2 %lx\n", (t_int)x);
s
->
s_thing
=
x
;
}
//fprintf(stderr,"pd_bind option 2 %lx\n", (t_int)x);
s
->
s_thing
=
x
;
}
}
void
pd_unbind
(
t_pd
*
x
,
t_symbol
*
s
)
{
//fprintf(stderr,"pd_unbind %s\n", s->s_name);
//fprintf(stderr,"pd_unbind %s\n", s->s_name);
if
(
s
->
s_thing
==
x
)
{
//fprintf(stderr,"pd_unbind option A %lx\n", (t_int)x);
s
->
s_thing
=
0
;
}
//fprintf(stderr,"pd_unbind option A %lx\n", (t_int)x);
s
->
s_thing
=
0
;
}
else
if
(
s
->
s_thing
&&
*
s
->
s_thing
==
bindlist_class
)
{
/* bindlists always have at least two elements... if the number
goes down to one, get rid of the bindlist and bind the symbol
straight to the remaining element. */
/* bindlists always have at least two elements... if the number
goes down to one, get rid of the bindlist and bind the symbol
straight to the remaining element. */
/* in pd-l2ork, we however also check whether changes to the bindlist
occur via graph (through code execution, e.g. dynamic change of
receives)
and if so, we do not deallocate memory until the entire
bindlist_<datatype>
function is complete with its execution, after
which we call
bindlist_cleanup(). we control the execution via
static int variable
change_bindlist_via_graph */
/* in pd-l2ork, we however also check whether changes to the bindlist
occur via graph (through code execution, e.g. dynamic change of
receives)
and if so, we do not deallocate memory until the entire
bindlist_<datatype>
function is complete with its execution, after
which we call
bindlist_cleanup(). we control the execution via
static int variable
change_bindlist_via_graph */
//fprintf(stderr,"pd_unbind option B %lx\n", (t_int)x);
//fprintf(stderr,"pd_unbind option B %lx\n", (t_int)x);
t_bindlist
*
b
=
(
t_bindlist
*
)
s
->
s_thing
;
t_bindelem
*
e
,
*
e2
;
if
((
e
=
b
->
b_list
)
->
e_who
==
x
)
{
if
(
change_bindlist_via_graph
)
{
change_bindlist_via_graph
++
;
e
->
e_delayed_free
=
1
;
}
else
{
b
->
b_list
=
e
->
e_next
;
freebytes
(
e
,
sizeof
(
t_bindelem
));
}
//fprintf(stderr,"success B1a\n");
if
(
change_bindlist_via_graph
)
{
change_bindlist_via_graph
++
;
e
->
e_delayed_free
=
1
;
}
else
{
b
->
b_list
=
e
->
e_next
;
freebytes
(
e
,
sizeof
(
t_bindelem
));
}
//fprintf(stderr,"success B1a\n");
}
else
for
(
e
=
b
->
b_list
;
e2
=
e
->
e_next
;
e
=
e2
)
if
(
e2
->
e_who
==
x
)
{
if
(
change_bindlist_via_graph
)
{
change_bindlist_via_graph
++
;
e2
->
e_delayed_free
=
1
;
}
else
{
e
->
e_next
=
e2
->
e_next
;
freebytes
(
e2
,
sizeof
(
t_bindelem
));
}
//fprintf(stderr,"success B1b\n");
break
;
if
(
e2
->
e_who
==
x
)
{
if
(
change_bindlist_via_graph
)
{
change_bindlist_via_graph
++
;
e2
->
e_delayed_free
=
1
;
}
else
{
e
->
e_next
=
e2
->
e_next
;
freebytes
(
e2
,
sizeof
(
t_bindelem
));
}
//fprintf(stderr,"success B1b\n");
break
;
}
}
int
count_valid
=
0
;
t_bindelem
*
e1
=
NULL
;
int
count_valid
=
0
;
t_bindelem
*
e1
=
NULL
;
for
(
e
=
b
->
b_list
;
e
;
e
=
e
->
e_next
)
{
if
(
e
->
e_who
!=
NULL
&&
!
e
->
e_delayed_free
)
{
count_valid
++
;
e1
=
e
;
}
if
(
e
->
e_who
!=
NULL
&&
!
e
->
e_delayed_free
)
{
count_valid
++
;