summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/src/s_print.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/s_print.c')
-rw-r--r--apps/plugins/pdbox/PDa/src/s_print.c149
1 files changed, 0 insertions, 149 deletions
diff --git a/apps/plugins/pdbox/PDa/src/s_print.c b/apps/plugins/pdbox/PDa/src/s_print.c
index 1ef0eb6926..d3020782d5 100644
--- a/apps/plugins/pdbox/PDa/src/s_print.c
+++ b/apps/plugins/pdbox/PDa/src/s_print.c
@@ -148,153 +148,4 @@ void sys_ouch(void)
148 if (*errobject) error("%s: %s", errobject, errstring); 148 if (*errobject) error("%s: %s", errobject, errstring);
149 else error("%s", errstring); 149 else error("%s", errstring);
150} 150}
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. */
154
155#include "m_pd.h"
156#include <stdlib.h>
157#include <stdio.h>
158#include <stdarg.h>
159#include <string.h>
160#include <errno.h>
161
162void post(char *fmt, ...)
163{
164 va_list ap;
165 t_int arg[8];
166 int i;
167 va_start(ap, fmt);
168 vfprintf(stderr, fmt, ap);
169 va_end(ap);
170 putc('\n', stderr);
171}
172
173void startpost(char *fmt, ...)
174{
175 va_list ap;
176 t_int arg[8];
177 int i;
178 va_start(ap, fmt);
179
180 for (i = 0 ; i < 8; i++) arg[i] = va_arg(ap, t_int);
181 va_end(ap);
182 fprintf(stderr, fmt, arg[0], arg[1], arg[2], arg[3],
183 arg[4], arg[5], arg[6], arg[7]);
184}
185
186void poststring(char *s)
187{
188 fprintf(stderr, " %s", s);
189}
190
191void postatom(int argc, t_atom *argv)
192{
193 int i;
194 for (i = 0; i < argc; i++)
195 {
196 char buf[80];
197 atom_string(argv+i, buf, 80);
198 poststring(buf);
199 }
200}
201
202void postfloat(float f)
203{
204 char buf[80];
205 t_atom a;
206 SETFLOAT(&a, f);
207 postatom(1, &a);
208}
209
210void endpost(void)
211{
212 fprintf(stderr, "\n");
213}
214
215void error(char *fmt, ...)
216{
217 va_list ap;
218 t_int arg[8];
219 int i;
220 va_start(ap, fmt);
221 fprintf(stderr, "error: ");
222 vfprintf(stderr, fmt, ap);
223 va_end(ap);
224 putc('\n', stderr);
225}
226 151
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
229 later. */
230
231static void *error_object;
232static char error_string[256];
233void canvas_finderror(void *object);
234
235void pd_error(void *object, char *fmt, ...)
236{
237 va_list ap;
238 t_int arg[8];
239 int i;
240 static int saidit = 0;
241 va_start(ap, fmt);
242 vsprintf(error_string, fmt, ap);
243 va_end(ap);
244 fprintf(stderr, "error: %s\n", error_string);
245 error_object = object;
246 if (!saidit)
247 {
248 post("... you might be able to track this down from the Find menu.");
249 saidit = 1;
250 }
251}
252
253void glob_finderror(t_pd *dummy)
254{
255 if (!error_object)
256 post("no findable error yet.");
257 else
258 {
259 post("last trackable error:");
260 post("%s", error_string);
261 canvas_finderror(error_object);
262 }
263}
264
265void bug(char *fmt, ...)
266{
267 va_list ap;
268 t_int arg[8];
269 int i;
270 va_start(ap, fmt);
271
272 for (i = 0 ; i < 8; i++) arg[i] = va_arg(ap, t_int);
273 va_end(ap);
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]);
277 putc('\n', stderr);
278}
279
280 /* this isn't worked out yet. */
281static char *errobject;
282static char *errstring;
283
284void sys_logerror(char *object, char *s)
285{
286 errobject = object;
287 errstring = s;
288}
289
290void sys_unixerror(char *object)
291{
292 errobject = object;
293 errstring = strerror(errno);
294}
295
296void sys_ouch(void)
297{
298 if (*errobject) error("%s: %s", errobject, errstring);
299 else error("%s", errstring);
300}