Commit 190a6c1e authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

added member to t_dataslot and renamed ds_arraytemplate in preparation for "canvas" data type

parent 50c34f99
......@@ -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
......
......@@ -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_arraytemplate;
t_symbol *arraytemplatesym = template->t_vec[i].ds_fieldtemplate;
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_arraytemplate;
t_symbol *arraytemplatesym = template->t_vec[i].ds_fieldtemplate;
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_arraytemplate;
t_symbol *arraytemplatesym = ds->ds_fieldtemplate;
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_arraytemplate;
t_symbol *arraytemplatesym = ds->ds_fieldtemplate;
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_arraytemplate->s_name + 3));
gensym(template->t_vec[j].ds_fieldtemplate->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_arraytemplate->s_name + 3));
gensym(template->t_vec[j].ds_fieldtemplate->s_name + 3));
else binbuf_addv(b, "ss", type, template->t_vec[j].ds_name);
}
binbuf_addsemi(b);
......
......@@ -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_arraytemplate, gp);
wp->w_array = array_new(datatypes->ds_fieldtemplate, 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_arraytemplate);
elemtemplate = template_findbyname(datatypes->ds_fieldtemplate);
if (!(elemtemplate))
{
t_object *ob = template_getstruct(template);
pd_error(ob, "%s: no such template",
datatypes->ds_arraytemplate->s_name);
datatypes->ds_fieldtemplate->s_name);
return (-1);
}
else if (elemtemplate->t_sym == structname)
{
t_object *ob = template_getstruct(template);
pd_error(ob, "%s: circular dependency",
datatypes->ds_arraytemplate->s_name);
datatypes->ds_fieldtemplate->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_arraytemplate == elemtemplate->t_sym)
if (d->ds_fieldtemplate == 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_arraytemplate),
template_findbyname(d->ds_fieldtemplate),
elemtemplate);
}
}
......
......@@ -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_arraytemplate == ds2->ds_arraytemplate));
ds1->ds_fieldtemplate == ds2->ds_fieldtemplate));
}
/* -- 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_arraytemplate = newarraytemplate;
x->t_vec[oldn].ds_fieldtemplate = 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_arraytemplate;
*p_arraytype = x->t_vec[i].ds_fieldtemplate;
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_arraytemplate;
t_symbol *arraytemplate = ds->ds_fieldtemplate;
if (arraytemplate == tfrom->t_sym ||
arraytemplate == tto->t_sym)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment