[Ecls-list] new ECL list member/ ECL project

Goffioul Michael goffioul at imec.be
Tue Jan 24 01:25:00 UTC 2006


> Hi Dustin,
> 
> congratulations for you nice application. First of all, 
> regarding the complaints some people had about the navigation 
> panel, you can solve it by fixing the width in pixels of the 
> text in the "body" element from the stylesheet.
> 
> As for your intro, it is quite well explained. There is one 
> point you mention, which is input/output of data from the 
> lisp code. You should know that input and output are by 
> default directed to the stdin/stdout of your C program. 
> Windows programs sometimes have these streams closed and 
> therefore ECL will fail to produce output.
> 
> A simple fix is to redirect all interaction to a null stream:
> 	(setf *terminal-io* (make-broadcast-stream))
> 
> More than a solution this can be characterized as a hack, 
> because at some point your lisp will run on some error and it 
> will need some interaction on your side.
> 
> If you do not want your program to be interactive, you can 
> handle all errors using cl_safe_eval(). But if you want to 
> allow for some responses from the user, you should then build 
> Gray streams using something like Julian Stecklina's code in 
> Xchat. At some point one should add a simple applet to 
> examples/ showing how to do it.

This also a problem I had when embedding ECL into MATLAB under Windows.
The problem is that in windows mode, standard streams are not defined
and
it made MATLAB crashes when ECL tried to print on stdout. To work around
the problem, I used a 2-steps process:
1) at very early stage (just after cl_boot), I redefine *terminal-io*
and
*error-output* to dummy streams (I use string-streams)
2) after everything is setup correctly, I redefines those 2 streams
using
application-defined gray streams that allow the ECL output to be
redirected
to MATLAB window
The step 1 was needed because if anything went wrong during the
initialization
(even a simple warning message) and before the correct redefinition
using
gray streams, it made the whole app to crash. Using string-streams in
step 1
also allow to catch the ECL output during initialization.

Michael.




More information about the ecl-devel mailing list