diff --git a/pd/src/g_traversal.c b/pd/src/g_traversal.c index 4617eecf10d51c2cbdf387eb7360530c7321e0a6..bdf0d2047500db6a4181ad67c834581179747734 100644 --- a/pd/src/g_traversal.c +++ b/pd/src/g_traversal.c @@ -816,7 +816,7 @@ typedef struct _getsize static void *getsize_new(t_symbol *templatesym, t_symbol *fieldsym) { t_getsize *x = (t_getsize *)pd_new(getsize_class); - x->x_templatesym = canvas_makebindsym(templatesym); + x->x_templatesym = template_getbindsym(templatesym); x->x_fieldsym = fieldsym; outlet_new(&x->x_obj, &s_float); return (x); @@ -824,44 +824,49 @@ static void *getsize_new(t_symbol *templatesym, t_symbol *fieldsym) static void getsize_set(t_getsize *x, t_symbol *templatesym, t_symbol *fieldsym) { - x->x_templatesym = canvas_makebindsym(templatesym); + x->x_templatesym = template_getbindsym(templatesym); x->x_fieldsym = fieldsym; } static void getsize_pointer(t_getsize *x, t_gpointer *gp) { - int onset, type; - t_symbol *templatesym = x->x_templatesym, *fieldsym = x->x_fieldsym, - *elemtemplatesym; - t_template *template = template_findbyname(templatesym); + int nitems, onset, type; + t_symbol *templatesym, *fieldsym = x->x_fieldsym, *elemtemplatesym; + t_template *template; t_word *w; t_array *array; + int elemsize; t_gstub *gs = gp->gp_stub; - if (!template) + if (!gpointer_check(gp, 0)) { - pd_error(x, "getsize: couldn't find template %s", templatesym->s_name); + pd_error(x, "get: stale or empty pointer"); return; } - if (!template_find_field(template, fieldsym, - &onset, &type, &elemtemplatesym)) + if (*x->x_templatesym->s_name) { - pd_error(x, "getsize: couldn't find array field %s", fieldsym->s_name); - return; + if ((templatesym = x->x_templatesym) != + gpointer_gettemplatesym(gp)) + { + pd_error(x, "elem %s: got wrong template (%s)", + templatesym->s_name, gpointer_gettemplatesym(gp)->s_name); + return; + } } - if (type != DT_ARRAY) + else templatesym = gpointer_gettemplatesym(gp); + if (!(template = template_findbyname(templatesym))) { - pd_error(x, "getsize: field %s not of type array", fieldsym->s_name); + pd_error(x, "elem: couldn't find template %s", templatesym->s_name); return; } - if (!gpointer_check(gp, 0)) + if (!template_find_field(template, fieldsym, + &onset, &type, &elemtemplatesym)) { - pd_error(x, "get: stale or empty pointer"); + pd_error(x, "getsize: couldn't find array field %s", fieldsym->s_name); return; } - if (gpointer_gettemplatesym(gp) != x->x_templatesym) + if (type != DT_ARRAY) { - pd_error(x, "getsize %s: got wrong template (%s)", - x->x_templatesym->s_name, gpointer_gettemplatesym(gp)->s_name); + pd_error(x, "getsize: field %s not of type array", fieldsym->s_name); return; } if (gs->gs_which == GP_ARRAY) w = gp->gp_un.gp_w;