[Ecls-list] Calling "load" from si_safe_eval

Greg Santucci thecodewitch at gmail.com
Mon Jul 13 13:09:24 UTC 2009


Unfortunately, to enjoy the benefit of that, I need to redirect the terminal
io, which I am also having trouble with. Based on the example of eclgui, I
am attempting it this way:

cl_def_c_function(cl_intern(1,
make_simple_base_string("%TERM-IO-WRITE-CHAR%"")), (void *)termIOWriteChar,
1);
cl_def_c_function(cl_intern(1, make_simple_base_string("%TERM-IO-FLUSH%")),
(void *)termIOFlush, 0);

(The following is executed with si_safe_eval - I omit my wrapper for
clarity, and show you the output in the repl I have in my app)

(defclass %term-io% (gray:fundamental-character-output-stream) (last-char))
#<The STANDARD-CLASS %TERM-IO%>


(defmethod gray:stream-write-char ((stream %term-io%) c) (
%TERM-IO-WRITE-CHAR% c))
#<STANDARD-METHOD STREAM-WRITE-CHAR (#<The STANDARD-CLASS %TERM-IO%>

#<The BUILT-IN-CLASS T>)>

(defmethod gray:stream-force-output ((stream %term-io%)) ( %TERM-IO-FLUSH% )
t)

#<STANDARD-METHOD STREAM-FORCE-OUTPUT (#<The STANDARD-CLASS %TERM-IO%>)>


(setq *terminal-io* (make-two-way-stream (make-string-input-stream \"\")
(make-instance '%term-io%)))

#<two-way stream 0a04b320>


(setq *error-output* (two-way-stream-output-stream *terminal-io*))

#<a %TERM-IO%>


 I'm expecting the function termIOWriteChar and termIOFlush to be called -
they are not.




On Mon, Jul 13, 2009 at 6:04 PM, Juan Jose Garcia-Ripoll <
juanjose.garciaripoll at googlemail.com> wrote:

> On Mon, Jul 13, 2009 at 6:07 AM, Greg Santucci<thecodewitch at gmail.com>
> wrote:
> > I have embedded ECL into my C++ simulation, and I'd like to be able to
> call
> > "load" from the si_safe_eval function.
> > When I try the following, the error symbol is returned:
> >
> > cl_object form = c_string_to_object("(load \"test.lsp\"");
> > cl_object result = si_safe_eval(3, form, Cnil, g_evalErrorSymbol);
>
> Be creative
>
> cl_object form = c_string_to_object("
> (handler-case (load \"test.lsp\")
>   (error (c) (princ c) (print c)))
> ");
>
> or if you want to debug it
>
> cl_object form = c_string_to_object("
> (handler-case (load \"test.lsp\")
>   (error (c) (invoke-debugger c)))
> ");
>
>
> --
> Instituto de Física Fundamental, CSIC
> c/ Serrano, 113b, Madrid 28006 (Spain)
> http://juanjose.garciaripoll.googlepages.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20090713/c362ba7d/attachment.html>


More information about the ecl-devel mailing list