From 619bf2d74ef3e5431cb6057698f324590368122b Mon Sep 17 00:00:00 2001 From: Miller Puckette Date: Thu, 22 May 2008 18:25:27 +0000 Subject: 0.42-0 test 01. No real work yet, just bug fixes and updates. svn path=/trunk/; revision=9867 --- pd/src/m_class.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'pd/src/m_class.c') diff --git a/pd/src/m_class.c b/pd/src/m_class.c index ab0b86be..aa44022d 100644 --- a/pd/src/m_class.c +++ b/pd/src/m_class.c @@ -18,6 +18,10 @@ #include #include +#ifdef _MSC_VER /* This is only for Microsoft's compiler, not cygwin, e.g. */ +#define snprintf sprintf_s +#endif + static t_symbol *class_loadsym; /* name under which an extern is invoked */ static void pd_defaultfloat(t_pd *x, t_float f); static void pd_defaultlist(t_pd *x, t_symbol *s, int argc, t_atom *argv); @@ -149,7 +153,6 @@ static void pd_defaultlist(t_pd *x, t_symbol *s, int argc, t_atom *argv) argument form, one for the multiple one; see select_setup() to find out how this is handled. */ -extern t_widgetbehavior text_widgetbehavior; extern void text_save(t_gobj *z, t_binbuf *b); t_class *class_new(t_symbol *s, t_newmethod newmethod, t_method freemethod, @@ -168,7 +171,7 @@ t_class *class_new(t_symbol *s, t_newmethod newmethod, t_method freemethod, { if (count == MAXPDARG) { - error("class %s: sorry: only %d creation args allowed", + error("class %s: sorry: only %d args typechecked; use A_GIMME", s->s_name, MAXPDARG); break; } @@ -300,6 +303,19 @@ void class_addmethod(t_class *c, t_method fn, t_symbol *sel, } else { + int i; + for (i = 0; i < c->c_nmethod; i++) + if (c->c_methods[i].me_name == sel) + { + char nbuf[80]; + snprintf(nbuf, 80, "%s_aliased", sel->s_name); + c->c_methods[i].me_name = gensym(nbuf); + if (c == pd_objectmaker) + post("warning: class '%s' overwritten; old one renamed '%s'", + sel->s_name, nbuf); + else post("warning: old method '%s' for class '%s' renamed '%s'", + sel->s_name, c->c_name->s_name, nbuf); + } c->c_methods = t_resizebytes(c->c_methods, c->c_nmethod * sizeof(*c->c_methods), (c->c_nmethod + 1) * sizeof(*c->c_methods)); -- cgit v1.2.1