aboutsummaryrefslogtreecommitdiff
path: root/pd/src/m_class.c
diff options
context:
space:
mode:
Diffstat (limited to 'pd/src/m_class.c')
-rw-r--r--pd/src/m_class.c20
1 files changed, 18 insertions, 2 deletions
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 <string.h>
#include <stdio.h>
+#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));