1 /* Copyright (c) 1997-1999 Miller Puckette.
2 * For information on usage and redistribution, and for a DISCLAIMER OF ALL
3 * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
12 void post(char *fmt
, ...)
18 vfprintf(stderr
, fmt
, ap
);
23 void startpost(char *fmt
, ...)
30 for (i
= 0 ; i
< 8; i
++) arg
[i
] = va_arg(ap
, t_int
);
32 fprintf(stderr
, fmt
, arg
[0], arg
[1], arg
[2], arg
[3],
33 arg
[4], arg
[5], arg
[6], arg
[7]);
36 void poststring(char *s
)
38 fprintf(stderr
, " %s", s
);
41 void postatom(int argc
, t_atom
*argv
)
44 for (i
= 0; i
< argc
; i
++)
47 atom_string(argv
+i
, buf
, 80);
52 void postfloat(float f
)
62 fprintf(stderr
, "\n");
65 void error(char *fmt
, ...)
71 fprintf(stderr
, "error: ");
72 vfprintf(stderr
, fmt
, ap
);
77 /* here's the good way to log errors -- keep a pointer to the
78 offending or offended object around so the user can search for it
81 static void *error_object
;
82 static char error_string
[256];
83 void canvas_finderror(void *object
);
85 void pd_error(void *object
, char *fmt
, ...)
90 static int saidit
= 0;
92 vsprintf(error_string
, fmt
, ap
);
94 fprintf(stderr
, "error: %s\n", error_string
);
95 error_object
= object
;
98 post("... you might be able to track this down from the Find menu.");
103 void glob_finderror(t_pd
*dummy
)
106 post("no findable error yet.");
109 post("last trackable error:");
110 post("%s", error_string
);
111 canvas_finderror(error_object
);
115 void bug(char *fmt
, ...)
122 for (i
= 0 ; i
< 8; i
++) arg
[i
] = va_arg(ap
, t_int
);
124 fprintf(stderr
, "Consistency check failed: ");
125 fprintf(stderr
, fmt
, arg
[0], arg
[1], arg
[2], arg
[3],
126 arg
[4], arg
[5], arg
[6], arg
[7]);
130 /* this isn't worked out yet. */
131 static char *errobject
;
132 static char *errstring
;
134 void sys_logerror(char *object
, char *s
)
140 void sys_unixerror(char *object
)
143 errstring
= strerror(errno
);
148 if (*errobject
) error("%s: %s", errobject
, errstring
);
149 else error("%s", errstring
);
151 /* Copyright (c) 1997-1999 Miller Puckette.
152 * For information on usage and redistribution, and for a DISCLAIMER OF ALL
153 * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
162 void post(char *fmt
, ...)
168 vfprintf(stderr
, fmt
, ap
);
173 void startpost(char *fmt
, ...)
180 for (i
= 0 ; i
< 8; i
++) arg
[i
] = va_arg(ap
, t_int
);
182 fprintf(stderr
, fmt
, arg
[0], arg
[1], arg
[2], arg
[3],
183 arg
[4], arg
[5], arg
[6], arg
[7]);
186 void poststring(char *s
)
188 fprintf(stderr
, " %s", s
);
191 void postatom(int argc
, t_atom
*argv
)
194 for (i
= 0; i
< argc
; i
++)
197 atom_string(argv
+i
, buf
, 80);
202 void postfloat(float f
)
212 fprintf(stderr
, "\n");
215 void error(char *fmt
, ...)
221 fprintf(stderr
, "error: ");
222 vfprintf(stderr
, fmt
, ap
);
227 /* here's the good way to log errors -- keep a pointer to the
228 offending or offended object around so the user can search for it
231 static void *error_object
;
232 static char error_string
[256];
233 void canvas_finderror(void *object
);
235 void pd_error(void *object
, char *fmt
, ...)
240 static int saidit
= 0;
242 vsprintf(error_string
, fmt
, ap
);
244 fprintf(stderr
, "error: %s\n", error_string
);
245 error_object
= object
;
248 post("... you might be able to track this down from the Find menu.");
253 void glob_finderror(t_pd
*dummy
)
256 post("no findable error yet.");
259 post("last trackable error:");
260 post("%s", error_string
);
261 canvas_finderror(error_object
);
265 void bug(char *fmt
, ...)
272 for (i
= 0 ; i
< 8; i
++) arg
[i
] = va_arg(ap
, t_int
);
274 fprintf(stderr
, "Consistency check failed: ");
275 fprintf(stderr
, fmt
, arg
[0], arg
[1], arg
[2], arg
[3],
276 arg
[4], arg
[5], arg
[6], arg
[7]);
280 /* this isn't worked out yet. */
281 static char *errobject
;
282 static char *errstring
;
284 void sys_logerror(char *object
, char *s
)
290 void sys_unixerror(char *object
)
293 errstring
= strerror(errno
);
298 if (*errobject
) error("%s: %s", errobject
, errstring
);
299 else error("%s", errstring
);