On Sat, 31 Jul 2004, Miller Puckette wrote:
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 :)
Implementing <stdio.h> requires using <stdarg.h>, so either cellphones implement <stdarg.h> or nothing runs on it.
Other possibilities are that they'd only implement <varargs.h> instead (obsolete) or that they have printf() implemented in assembler (obsolete too). Those are more likely to happen when porting to vintage hardware using old-fashioned compilers not updated since 1989 or so. It's not the case for cellphones or even a recent GameBoy-type system.
In short, I don't think it's a valid rationale.
-- 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:
Ok, that's another way to do it. Actually I don't really care how it's done as long as it's sent to the GUI console correctly and that buffer overflows are handled properly.
if (sys_printhook) (*sys_printhook)(s); else if (sys_printtostderr) fprintf(stderr, "%s", s); else { (messy code to send it to the GUI layer) }
Actually drop the "messy", and the last "else{}" block altogether. I'm using a printhook to send to the gui layer. What is the point for the gui console _not_ to use the printhook? who will use the printhook then?
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...
Why yuck? I think it's a feature Pd should have.
On a related note, I also think that commandline options should be replaced by ";pd"-type messages.
________________________________________________________________ Mathieu Bouchard http://artengine.ca/matju