Well, the hook I found in devel includes stdargs.h right into m_pd.h, which I think is a serious portability problem (cellphones migth not implement stdargs :) -- and anyway, it seems like the hook should go _after_ the formatting step, not before it. In my copy right now (too unstable to check into anything!) I've got a new low-level function:
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 { (messy code to send it to the GUI layer) } }
... which lets the user choose whether to spit it to the GUI layer, to standard error, or to any function you put in "sys_printhook".
I'll release all this once I can decide what I think is the most portable way to get the GUI to start Pd up (which seems to be necessary if you don't want a "console" window popping up on MSW or Mac). Yuck...
Miller
On Sat, Jul 31, 2004 at 07:36:14PM -0400, Mathieu Bouchard wrote:
On Fri, 30 Jul 2004, Miller Puckette wrote:
Another situation comes up often, that someone makes a feature that is clearly needed, but which I think should be implemented differently. An example is the "print" hook in devel... I like it, but I want to do it in a way that I think is cleaner...
Would you please care to explain what's wrong with the print hook and how you do intend to fix it?
Mathieu Bouchard http://artengine.ca/matju