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
David MacDonald
purr-data
Commits
190a6c1e
Commit
190a6c1e
authored
Aug 16, 2015
by
Jonathan Wilkes
Browse files
added member to t_dataslot and renamed ds_arraytemplate in preparation for "canvas" data type
parent
50c34f99
Changes
4
Hide whitespace changes
Inline
Side-by-side
pd/src/g_canvas.h
View file @
190a6c1e
...
...
@@ -252,7 +252,8 @@ typedef struct _dataslot
{
int
ds_type
;
t_symbol
*
ds_name
;
t_symbol
*
ds_arraytemplate
;
/* filled in for arrays only */
t_symbol
*
ds_fieldtemplate
;
/* filled in for arrays only */
t_binbuf
*
ds_canvas
;
/* binbuf of an abstraction to be loaded */
}
t_dataslot
;
typedef
struct
_template
...
...
pd/src/g_readwrite.c
View file @
190a6c1e
...
...
@@ -71,7 +71,7 @@ static void glist_readatoms(t_glist *x, int natoms, t_atom *vec,
{
t_array
*
a
=
w
[
i
].
w_array
;
int
elemsize
=
a
->
a_elemsize
,
nitems
=
0
;
t_symbol
*
arraytemplatesym
=
template
->
t_vec
[
i
].
ds_
array
template
;
t_symbol
*
arraytemplatesym
=
template
->
t_vec
[
i
].
ds_
field
template
;
t_template
*
arraytemplate
=
template_findbyname
(
arraytemplatesym
);
if
(
!
arraytemplate
)
...
...
@@ -420,7 +420,7 @@ void canvas_writescalar(t_symbol *templatesym, t_word *w, t_binbuf *b,
int
j
;
t_array
*
a
=
w
[
i
].
w_array
;
int
elemsize
=
a
->
a_elemsize
,
nitems
=
a
->
a_n
;
t_symbol
*
arraytemplatesym
=
template
->
t_vec
[
i
].
ds_
array
template
;
t_symbol
*
arraytemplatesym
=
template
->
t_vec
[
i
].
ds_
field
template
;
for
(
j
=
0
;
j
<
nitems
;
j
++
)
canvas_writescalar
(
arraytemplatesym
,
(
t_word
*
)(((
char
*
)
a
->
a_vec
)
+
elemsize
*
j
),
b
,
1
);
...
...
@@ -467,7 +467,7 @@ static void canvas_addtemplatesforscalar(t_symbol *templatesym,
int
j
;
t_array
*
a
=
w
->
w_array
;
int
elemsize
=
a
->
a_elemsize
,
nitems
=
a
->
a_n
;
t_symbol
*
arraytemplatesym
=
ds
->
ds_
array
template
;
t_symbol
*
arraytemplatesym
=
ds
->
ds_
field
template
;
canvas_doaddtemplate
(
arraytemplatesym
,
p_ntemplates
,
p_templatevec
);
for
(
j
=
0
;
j
<
nitems
;
j
++
)
canvas_addtemplatesforscalar
(
arraytemplatesym
,
...
...
@@ -492,7 +492,7 @@ static void canvas_addtemplatesforstruct(t_template *template,
{
if
(
ds
->
ds_type
==
DT_ARRAY
)
{
t_symbol
*
arraytemplatesym
=
ds
->
ds_
array
template
;
t_symbol
*
arraytemplatesym
=
ds
->
ds_
field
template
;
t_template
*
arraytemplate
=
template_findbyname
(
arraytemplatesym
);
if
(
arraytemplate
)
{
...
...
@@ -562,7 +562,7 @@ t_binbuf *glist_writetobinbuf(t_glist *x, int wholething)
}
if
(
template
->
t_vec
[
j
].
ds_type
==
DT_ARRAY
)
binbuf_addv
(
b
,
"sss;"
,
type
,
template
->
t_vec
[
j
].
ds_name
,
gensym
(
template
->
t_vec
[
j
].
ds_
array
template
->
s_name
+
3
));
gensym
(
template
->
t_vec
[
j
].
ds_
field
template
->
s_name
+
3
));
else
binbuf_addv
(
b
,
"ss;"
,
type
,
template
->
t_vec
[
j
].
ds_name
);
}
binbuf_addsemi
(
b
);
...
...
@@ -737,7 +737,7 @@ static void canvas_savetemplatesto(t_canvas *x, t_binbuf *b, int wholething)
}
if
(
template
->
t_vec
[
j
].
ds_type
==
DT_ARRAY
)
binbuf_addv
(
b
,
"sss"
,
type
,
template
->
t_vec
[
j
].
ds_name
,
gensym
(
template
->
t_vec
[
j
].
ds_
array
template
->
s_name
+
3
));
gensym
(
template
->
t_vec
[
j
].
ds_
field
template
->
s_name
+
3
));
else
binbuf_addv
(
b
,
"ss"
,
type
,
template
->
t_vec
[
j
].
ds_name
);
}
binbuf_addsemi
(
b
);
...
...
pd/src/g_scalar.c
View file @
190a6c1e
...
...
@@ -29,7 +29,7 @@ void word_init(t_word *wp, t_template *template, t_gpointer *gp)
wp
->
w_symbol
=
&
s_symbol
;
else
if
(
type
==
DT_ARRAY
)
{
wp
->
w_array
=
array_new
(
datatypes
->
ds_
array
template
,
gp
);
wp
->
w_array
=
array_new
(
datatypes
->
ds_
field
template
,
gp
);
}
else
if
(
type
==
DT_LIST
)
{
...
...
@@ -167,19 +167,19 @@ int template_check_array_fields(t_symbol *structname, t_template *template)
{
if
(
datatypes
->
ds_type
==
DT_ARRAY
)
{
elemtemplate
=
template_findbyname
(
datatypes
->
ds_
array
template
);
elemtemplate
=
template_findbyname
(
datatypes
->
ds_
field
template
);
if
(
!
(
elemtemplate
))
{
t_object
*
ob
=
template_getstruct
(
template
);
pd_error
(
ob
,
"%s: no such template"
,
datatypes
->
ds_
array
template
->
s_name
);
datatypes
->
ds_
field
template
->
s_name
);
return
(
-
1
);
}
else
if
(
elemtemplate
->
t_sym
==
structname
)
{
t_object
*
ob
=
template_getstruct
(
template
);
pd_error
(
ob
,
"%s: circular dependency"
,
datatypes
->
ds_
array
template
->
s_name
);
datatypes
->
ds_
field
template
->
s_name
);
return
(
0
);
}
else
...
...
@@ -276,7 +276,7 @@ int template_has_elemtemplate(t_template *t, t_template *elemtemplate)
{
if
(
d
->
ds_type
==
DT_ARRAY
)
{
if
(
d
->
ds_
array
template
==
elemtemplate
->
t_sym
)
if
(
d
->
ds_
field
template
==
elemtemplate
->
t_sym
)
{
returnval
=
1
;
break
;
...
...
@@ -284,7 +284,7 @@ int template_has_elemtemplate(t_template *t, t_template *elemtemplate)
else
{
returnval
=
template_has_elemtemplate
(
template_findbyname
(
d
->
ds_
array
template
),
template_findbyname
(
d
->
ds_
field
template
),
elemtemplate
);
}
}
...
...
pd/src/g_template.c
View file @
190a6c1e
...
...
@@ -58,7 +58,7 @@ static int dataslot_matches(t_dataslot *ds1, t_dataslot *ds2,
return ((!nametoo || ds1->ds_name == ds2->ds_name) &&
ds1->ds_type == ds2->ds_type &&
(ds1->ds_type != DT_ARRAY ||
ds1->ds_
array
template == ds2->ds_
array
template));
ds1->ds_
field
template == ds2->ds_
field
template));
}
/* -- templates, the active ingredient in gtemplates defined below. ------- */
...
...
@@ -108,7 +108,7 @@ t_template *template_new(t_symbol *templatesym, int argc, t_atom *argv)
x->t_n = newn;
x->t_vec[oldn].ds_type = newtype;
x->t_vec[oldn].ds_name = newname;
x->t_vec[oldn].ds_
array
template = newarraytemplate;
x->t_vec[oldn].ds_
field
template = newarraytemplate;
bad:
argc -= 2; argv += 2;
}
...
...
@@ -141,7 +141,7 @@ int template_find_field(t_template *x, t_symbol *name, int *p_onset,
{
*p_onset = i * sizeof(t_word);
*p_type = x->t_vec[i].ds_type;
*p_arraytype = x->t_vec[i].ds_
array
template;
*p_arraytype = x->t_vec[i].ds_
field
template;
return (1);
}
return (0);
...
...
@@ -329,7 +329,7 @@ static t_scalar *template_conformscalar(t_template *tfrom, t_template *tto,
}
else if (ds->ds_type == DT_ARRAY)
{
t_symbol *arraytemplate = ds->ds_
array
template;
t_symbol *arraytemplate = ds->ds_
field
template;
if (arraytemplate == tfrom->t_sym ||
arraytemplate == tto->t_sym)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment