Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5546
Modified Files: Tag: devel_0_39 SConscript desire.c Log Message: copypaste all of s_print.c to desire.c
Index: SConscript =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/SConscript,v retrieving revision 1.1.4.37 retrieving revision 1.1.4.38 diff -C2 -d -r1.1.4.37 -r1.1.4.38 *** SConscript 29 Nov 2005 08:34:22 -0000 1.1.4.37 --- SConscript 3 Dec 2005 06:40:36 -0000 1.1.4.38 *************** *** 62,70 **** d_mayer_fft.c d_misc.c d_osc.c d_resample.c d_soundfile.c d_ugen.c
m_atom.c m_binbuf.c m_class.c m_conf.c m_fifo.c m_glob.c m_memory.c m_obj.c m_pd.c m_sched.c m_simd.c
s_audio.c s_file.c s_inter.c s_loader.c ! s_main.c s_midi.c s_path.c s_print.c
x_acoustics.c x_arithmetic.c x_connective.c x_gui.c x_interface.c --- 62,72 ---- d_mayer_fft.c d_misc.c d_osc.c d_resample.c d_soundfile.c d_ugen.c
+ g_rtext.c + m_atom.c m_binbuf.c m_class.c m_conf.c m_fifo.c m_glob.c m_memory.c m_obj.c m_pd.c m_sched.c m_simd.c
s_audio.c s_file.c s_inter.c s_loader.c ! s_main.c s_midi.c s_path.c
x_acoustics.c x_arithmetic.c x_connective.c x_gui.c x_interface.c *************** *** 74,78 **** if pdenv['desire']: sources += Split(""" ! desire.c g_rtext.c """) else: --- 76,80 ---- if pdenv['desire']: sources += Split(""" ! desire.c """) else: *************** *** 80,86 **** g_bang.c g_hdial.c g_hslider.c g_mycanvas.c g_numbox.c g_vdial.c g_vslider.c g_vumeter.c ! g_text.c g_toggle.c g_rtext.c g_all_guis.c g_array.c g_canvas.c g_editor.c g_graph.c g_guiconnect.c g_readwrite.c g_io.c g_scalar.c g_template.c g_traversal.c """)
--- 82,90 ---- g_bang.c g_hdial.c g_hslider.c g_mycanvas.c g_numbox.c g_vdial.c g_vslider.c g_vumeter.c ! g_text.c g_toggle.c g_all_guis.c g_array.c g_canvas.c g_editor.c g_graph.c g_guiconnect.c g_readwrite.c g_io.c g_scalar.c g_template.c g_traversal.c + + s_print.c """)
*************** *** 475,478 **** --- 479,483 ---- if pdenv['wall']: cflags += " -Wall" + #cflags += " -Wall -ansi -pedantic"
if pdenv['plusplus']:
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.62 retrieving revision 1.1.2.63 diff -C2 -d -r1.1.2.62 -r1.1.2.63 *** desire.c 30 Nov 2005 13:36:57 -0000 1.1.2.62 --- desire.c 3 Dec 2005 06:40:36 -0000 1.1.2.63 *************** *** 12785,12789 **** void wire_free(t_canvas *x) { ! t_gobj *y;
if (x->gl_env) --- 12785,12789 ---- void wire_free(t_canvas *x) { ! //t_gobj *y;
if (x->gl_env) *************** *** 12943,12944 **** --- 12943,13153 ---- #undef S } + + + /* ---------------------------------------------------------------- */ + /* formerly s_print.c */ + + /* + #include "m_pd.h" + #include <stdlib.h> + #include <stdio.h> + #include <stdarg.h> + #include <string.h> + #include "s_stuff.h" + */ + #include <errno.h> + + t_printhook sys_printhook; + int sys_printtostderr; + + static void dopost(const char *s) + { + if (sys_printhook) + (*sys_printhook)(s); + else if (sys_printtostderr) + fprintf(stderr, "%s", s); + else + { + char upbuf[MAXPDSTRING]; + int ptin = 0, ptout = 0, len = strlen(s); + static int heldcr = 0; + if (heldcr) + upbuf[ptout++] = '\n', heldcr = 0; + for (; ptin < len && ptout < MAXPDSTRING-3; + ptin++, ptout++) + { + int c = s[ptin]; + if (c == '\' || c == '{' || c == '}' || c == ';') + upbuf[ptout++] = '\'; + upbuf[ptout] = s[ptin]; + } + if (ptout && upbuf[ptout-1] == '\n') + upbuf[--ptout] = 0, heldcr = 1; + upbuf[ptout] = 0; + sys_vgui("pdtk_post {%s}\n", upbuf); + } + } + + void post(const char *fmt, ...) + { + char buf[MAXPDSTRING]; + va_list ap; + t_int arg[8]; + int i; + va_start(ap, fmt); + vsnprintf(buf, MAXPDSTRING-1, fmt, ap); + va_end(ap); + strcat(buf, "\n"); + dopost(buf); + } + + void startpost(const char *fmt, ...) + { + char buf[MAXPDSTRING]; + va_list ap; + t_int arg[8]; + int i; + va_start(ap, fmt); + vsnprintf(buf, MAXPDSTRING-1, fmt, ap); + va_end(ap); + dopost(buf); + } + + void poststring(const char *s) + { + dopost(" "); + dopost(s); + } + + void postatom(int argc, t_atom *argv) + { + int i; + for (i = 0; i < argc; i++) + { + char buf[80]; + atom_string(argv+i, buf, 80); + poststring(buf); + } + } + + void postfloat(float f) + { + char buf[80]; + t_atom a; + SETFLOAT(&a, f); + postatom(1, &a); + } + + void endpost(void) + { + dopost("\n"); + } + + void error(const char *fmt, ...) + { + char buf[MAXPDSTRING]; + va_list ap; + t_int arg[8]; + int i; + dopost("error: "); + va_start(ap, fmt); + vsnprintf(buf, MAXPDSTRING-1, fmt, ap); + va_end(ap); + strcat(buf, "\n"); + dopost(buf); + } + + void verbose(int level, const char *fmt, ...) + { + char buf[MAXPDSTRING]; + va_list ap; + t_int arg[8]; + int i; + if(level>sys_verbose)return; + dopost("verbose("); + postfloat((float)level); + dopost("):"); + + va_start(ap, fmt); + vsnprintf(buf, MAXPDSTRING-1, fmt, ap); + va_end(ap); + strcat(buf, "\n"); + dopost(buf); + } + + /* 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 void *error_object; + static char error_string[256]; + void canvas_finderror(void *object); + + void pd_error(void *object, const char *fmt, ...) + { + char buf[MAXPDSTRING]; + va_list ap; + t_int arg[8]; + int i; + static int saidit; + dopost("error: "); + va_start(ap, fmt); + vsnprintf(buf, MAXPDSTRING-1, fmt, ap); + va_end(ap); + strcat(buf, "\n"); + dopost(buf); + error_object = object; + if (!saidit) + { + post("... you might be able to track this down from the Find menu."); + saidit = 1; + } + } + + void glob_finderror(t_pd *dummy) + { + if (!error_object) + post("no findable error yet."); + else + { + post("last trackable error:"); + post("%s", error_string); + canvas_finderror(error_object); + } + } + + void bug(const char *fmt, ...) + { + char buf[MAXPDSTRING]; + va_list ap; + t_int arg[8]; + int i; + dopost("consistency check failed: "); + va_start(ap, fmt); + vsnprintf(buf, MAXPDSTRING-1, fmt, ap); + va_end(ap); + strcat(buf, "\n"); + dopost(buf); + } + + /* this isn't worked out yet. */ + static const char *errobject; + static const char *errstring; + + void sys_logerror(const char *object, const char *s) + { + errobject = object; + errstring = s; + } + + void sys_unixerror(const char *object) + { + errobject = object; + errstring = strerror(errno); + } + + void sys_ouch(void) + { + if (*errobject) error("%s: %s", errobject, errstring); + else error("%s", errstring); + }