Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2052
Modified Files: Tag: desiredata desire.c m_pd.h Log Message: introducing verror() which is like error() but with a va_list
Index: m_pd.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v retrieving revision 1.4.4.11.2.33.2.52 retrieving revision 1.4.4.11.2.33.2.53 diff -C2 -d -r1.4.4.11.2.33.2.52 -r1.4.4.11.2.33.2.53 *** m_pd.h 18 Jul 2007 08:28:13 -0000 1.4.4.11.2.33.2.52 --- m_pd.h 18 Jul 2007 16:12:18 -0000 1.4.4.11.2.33.2.53 *************** *** 52,55 **** --- 52,57 ---- #endif
+ #include <stdarg.h> + #define MAXPDSTRING 1000 /* use this for anything you want */ #define MAXPDARG 5 /* max number of args we can typecheck today */ *************** *** 540,543 **** --- 542,546 ---- EXTERN void endpost(void); EXTERN void error(const char *fmt, ...); + EXTERN void verror(const char *fmt, va_list args); EXTERN void verbose(int level, const char *fmt, ...); EXTERN void bug(const char *fmt, ...);
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.217.2.160 retrieving revision 1.1.2.217.2.161 diff -C2 -d -r1.1.2.217.2.160 -r1.1.2.217.2.161 *** desire.c 17 Jul 2007 23:54:56 -0000 1.1.2.217.2.160 --- desire.c 18 Jul 2007 16:12:15 -0000 1.1.2.217.2.161 *************** *** 7518,7532 **** void endpost () {dopost("\n");}
! void error(const char *fmt, ...) { char *buf; - va_list ap; dopost("error: "); - va_start(ap,fmt); vasprintf(&buf,fmt,ap); - va_end(ap); strcat(buf, "\n"); dopost(buf); free(buf); }
void verbose(int level, const char *fmt, ...) { --- 7518,7536 ---- void endpost () {dopost("\n");}
! static t_pd *error_object; ! static char error_string[MAXPDSTRING]; ! void canvas_finderror(void *object); ! ! void verror(const char *fmt, va_list ap) { char *buf; dopost("error: "); vasprintf(&buf,fmt,ap); strcat(buf, "\n"); dopost(buf); free(buf); + error_object = pd_stackn ? pd_stack[pd_stackn-1].self : 0; } + void error( const char *fmt, ...) {va_list ap; va_start(ap,fmt); verror(fmt,ap); va_end(ap);} + void pd_error(void *moot, const char *fmt, ...) {va_list ap; va_start(ap,fmt); verror(fmt,ap); va_end(ap);}
void verbose(int level, const char *fmt, ...) { *************** *** 7544,7568 **** }
- /* here's the good way to log errors -- keep a pointer to the - offending or offended object around so the user can search for it - later. */ - - static t_pd *error_object; - static char error_string[MAXPDSTRING]; - void canvas_finderror(void *object); - - void pd_error(void *object, const char *fmt, ...) { - char buf[MAXPDSTRING]; - va_list ap; - dopost("error: "); - va_start(ap, fmt); - vsnprintf(buf, MAXPDSTRING-1, fmt, ap); - va_end(ap); - strcat(buf, "\n"); - dopost(buf); - strcpy(error_string,buf); - error_object = (t_pd *)object; - } - /* this proc is a big bug (hint: error string is uninitialized _and_ never initialized). who did this? what is it supposed to be? */ --- 7548,7551 ----