t_symbol *plustag_rootname(t_symbol *tag, int validate, t_pd *caller) { if (!validate || tag->s_name == plustag_name) return (((t_plusstub *)tag)->sb_bob->bob_root->tp_name); else if (plustag_isvalid(tag, caller)) /* print the error there */ loudbug_bug("plustag_rootname"); return (0); }
/* returns tagged +bob if valid, null otherwise (silent if caller is empty) */ t_plusbob *plustag_validroot(t_symbol *tag, t_symbol *rname, t_pd *caller) { if (tag->s_name == plustag_name) { t_plusbob *bob = ((t_plusstub *)tag)->sb_bob; if (bob->bob_root->tp_name == rname) return (bob); else if (caller) { t_symbol *s = bob->bob_root->tp_name; loud_error((caller == PLUSBOB_OWNER ? bob->bob_owner : caller), "invalid base type '%s' ('%s' expected)", (s ? s->s_name : "<unknown>"), (rname ? rname->s_name : "<unknown>")); } } else if (plustag_isvalid(tag, caller)) /* print the error there */ loudbug_bug("plustag_validroot"); return (0); }
static void plusproxy_qlist_symbol(t_plusproxy_qlist *pp, t_symbol *s) { t_plustot_qlist *x = pp->pp_master; Tcl_Interp *interp = 0; if (plustag_isvalid(s, 0)) { t_plustin *tin; Tcl_Obj *ob; if ((tin = plustag_tobtin(s, PLUSBOB_OWNER)) && (ob = plustob_getvalue((t_plustob *)s))) { t_binbuf *bb; if (bb = plustot_qlist_usurp(x)) { int nlists; Tcl_Obj **lists; interp = plustin_getinterp(tin); if (Tcl_ListObjGetElements(interp, ob, &nlists, &lists) == TCL_OK) { int lc; Tcl_Obj **lp; binbuf_clear(bb); for (lc = 0, lp = lists; lc < nlists; lc++, lp++) { int natoms; Tcl_Obj **atoms; if (Tcl_ListObjGetElements(interp, *lp, &natoms, &atoms) == TCL_OK) { int ac; Tcl_Obj **ap; for (ac = 0, ap = atoms; ac < natoms; ac++, ap++) { double d; int len; char *ptr; Tcl_IncrRefCount(*ap); if (Tcl_GetDoubleFromObj(interp, *ap, &d) == TCL_OK) { t_atom at; SETFLOAT(&at, (float)d); binbuf_add(bb, 1, &at); } else if ((ptr = Tcl_GetStringFromObj(*ap, &len)) && len) { t_atom at; if (ptr[len - 1]) { char buf[MAXPDSTRING]; if (len > MAXPDSTRING - 1) len = MAXPDSTRING - 1; strncpy(buf, ptr, len); buf[len] = 0; ptr = buf; } SETSYMBOL(&at, gensym(ptr)); binbuf_add(bb, 1, &at); } /* FIXME else */ Tcl_DecrRefCount(*ap); } binbuf_addsemi(bb); } else { binbuf_clear(bb); goto notalist; } } } else goto notalist; } } } return; notalist: if (interp) plusloud_tclerror((t_pd *)x, interp, "not a list"); }