[PD-dev] broken msgs cause Tcl traces, how to debug it?

Mathieu Bouchard matju at artengine.ca
Mon Jan 23 18:42:05 CET 2012


Le 2012-01-22 à 21:54:00, Miller Puckette a écrit :
> On Mon, Jan 23, 2012 at 12:45:09AM -0500, Mathieu Bouchard wrote:
>> That's called a newline... not preceded by a backslash. The thing
>> with fconfigure -buffering line is that it doesn't care about
>> backslashes, whereas eval does, and if you use both together, you
>> need to account for that difference.

Sorry, the problem is indeed more complex than just looking for 
backslashes before newlines. It has to do with counting braces. The most 
efficient way to do it would be a parser that keeps its own state so that 
after returning from [info complete] you don't need to call it again from 
scratch, but that does not exist in Tcl (it's possible that there's a Tcl 
extension that you could compile for that, but I wouldn't know about it).

The way Pd is designed, sys_gui has never any obligation to contain a 
whole statement, so there isn't much that you could do in sys_gui to help 
the situation for all externals at once. If it were the case, you could 
for example use nul-terminators ('\0' aka (char)0) to make the parsing 
much easier on the receiving end.

However, if you make the assumption that any statement started within a 
wb-function must be terminated in the same wb-function, then the caller of 
the wb-function can call some kind of cleanup that adds a nul-terminator 
iff number of bytes written by sys_gui >= 0 (since last termination). Same 
goes with t_guicallbackfn.

But there are a number of cases of sys_gui being called from elsewhere. 
Considering end of t_clock run and end of t_pollfn run as being ends of 
statement could help, as well as _setup function. Is there any other case 
that wouldn't be covered by that ?

  ______________________________________________________________________
| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC


More information about the Pd-dev mailing list