diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h index e023963ed82ab660244dce2b1b53d987fa77b7b9..45bcb3ed94525ad2f35a752cd30686a3821dd7c8 100644 --- a/pd/src/m_pd.h +++ b/pd/src/m_pd.h @@ -292,7 +292,17 @@ typedef struct _text t_object; typedef void (*t_method)(void); typedef void *(*t_newmethod)( void); + +/* in ARM 64 a varargs prototype generates a different function call sequence +from a fixed one, so in that special case we make a more restrictive +definition for t_gotfn. This will break some code in the "chaos" package +in Pd extended. (that code will run incorrectly anyhow so why not catch it +at compile time anyhow.) */ +#if defined(__APPLE__) && defined(__aarch64__) +typedef void (*t_gotfn)(void *x); +#else typedef void (*t_gotfn)(void *x, ...); +#endif /* ---------------- pre-defined objects and symbols --------------*/ EXTERN t_pd pd_objectmaker; /* factory for creating "object" boxes */ @@ -320,12 +330,27 @@ EXTERN t_gotfn zgetfn(t_pd *x, t_symbol *s); EXTERN t_gotfn zcheckgetfn(t_pd *x, t_symbol *s, t_atomtype arg1, ...); EXTERN void nullfn(void); EXTERN void pd_vmess(t_pd *x, t_symbol *s, char *fmt, ...); + +/* the following macros are for sending non-type-checkable mesages, i.e., +using function lookup but circumventing type checking on arguments. Only +use for internal messaging protected by A_CANT so that the message can't +be generated at patch level. */ #define mess0(x, s) ((*getfn((x), (s)))((x))) -#define mess1(x, s, a) ((*getfn((x), (s)))((x), (a))) -#define mess2(x, s, a,b) ((*getfn((x), (s)))((x), (a),(b))) -#define mess3(x, s, a,b,c) ((*getfn((x), (s)))((x), (a),(b),(c))) -#define mess4(x, s, a,b,c,d) ((*getfn((x), (s)))((x), (a),(b),(c),(d))) -#define mess5(x, s, a,b,c,d,e) ((*getfn((x), (s)))((x), (a),(b),(c),(d),(e))) +typedef void (*t_gotfn1)(void *x, void *arg1); +#define mess1(x, s, a) ((*(t_gotfn1)getfn((x), (s)))((x), (a))) +typedef void (*t_gotfn2)(void *x, void *arg1, void *arg2); +#define mess2(x, s, a,b) ((*(t_gotfn2)getfn((x), (s)))((x), (a),(b))) +typedef void (*t_gotfn3)(void *x, void *arg1, void *arg2, void *arg3); +#define mess3(x, s, a,b,c) ((*(t_gotfn3)getfn((x), (s)))((x), (a),(b),(c))) +typedef void (*t_gotfn4)(void *x, + void *arg1, void *arg2, void *arg3, void *arg4); +#define mess4(x, s, a,b,c,d) \ + ((*(t_gotfn4)getfn((x), (s)))((x), (a),(b),(c),(d))) +typedef void (*t_gotfn5)(void *x, + void *arg1, void *arg2, void *arg3, void *arg4, void *arg5); +#define mess5(x, s, a,b,c,d,e) \ + ((*(t_gotfn5)getfn((x), (s)))((x), (a),(b),(c),(d),(e))) + EXTERN void obj_list(t_object *x, t_symbol *s, int argc, t_atom *argv); EXTERN t_pd *pd_newest(void); diff --git a/pd/src/x_interface.c b/pd/src/x_interface.c index e498b5bfad50b1103ec87841a814669c9e4462a5..af2b3c3d4b5016f7526befe246f3ed4fad6ea0e0 100644 --- a/pd/src/x_interface.c +++ b/pd/src/x_interface.c @@ -372,7 +372,7 @@ void info_print(t_text *te) t_methodentry *m; for(i = c->c_nmethod, m = c->c_methods; i; i--, m++) if(m->me_name != gensym("print")) - (m->me_fun)(te, m->me_name, 0, 0); + ((t_gotfn3)(m->me_fun))(te, m->me_name, 0, 0); /* not sure why this doesn't work... */ /* pd_forwardmess(te->te_pd, 0, 0); */ info_to_console = 0;