[Scilab-Dev] Redirecting input and output streams

Sylvain Corlay sylvain.corlay at gmail.com
Sat Mar 2 09:15:15 CET 2019


Hi Antoine,

Thank you for your quick response. This is exactly what I was looking for!

Cheers,

On Sat, Mar 2, 2019 at 9:05 AM Antoine ELIAS <
antoine.elias at scilab-enterprises.com> wrote:

> Hello Sylvain,
>
> You can get Scilab outputs by setting your own output function.
>
> void scilab_print(const char *text)
> {
>      std::cout << text << std::endl;
> }
>
> //redirect output to your own function:
> setScilabOutputMethod(&scilab_print);
>
> Commands send to call_scilab by SendScilabJob are muted ( execstr("cmd",
> "errcatch"); ), so to show outputs you need to explicitly call "disp"
> function in your code or
> use another mechanism to put your commands directly in queue of
> execution by using StoreConsoleCommand function.
>
> See attached file as example.
> Have a good weekend.
> Antoine
> Le 02/03/2019 à 00:41, SylvainCorlay a écrit :
> > Hello everyone,
> >
> > This is my first post on this mailing list. I hope that I am not breaking
> > any rule!
> >
> > I am interested in embedding the scilab interpreter in a C++ application.
> > The `call_scilab` API appears to be the wayt to go for simple code
> > execution, however I wonder it is possible to capture / redirect output
> > streams? The motivation is to create a kernel for Jupyter. I am aware of
> the
> > existing pexpect-based kernel but I would like to create a new kernel
> that
> > would be running in-process and not rely on piping to capture textual
> > output.
> >
> > Note: this is something that we have already done for other languages.
> > /xeus-cling/ is a  C++ kernel
> > <
> https://blog.jupyter.org/interactive-workflows-for-c-with-jupyter-fe9b54227d92
> >
> > based on the cling C++ interpreter from CERN. /xeus-python/ is an
> > alternative Python kernel. Both are based on the xeus C++ implementation
> of
> > the Jupyter protocol, support auto-complete, quick help, rich output
> > display, interactive widgets.
> >
> > I would like to know how far we could go with the `call_scilab` API with
> > respect to redirection, and whether there would be some means to access
> > lower-level control on the interpreter (for e.g. inspection,
> auto-complete
> > requests, getting a handle on the last value returned).
> >
> > Looking forward to hearing from you, although I will be travelling in the
> > next few days.
> >
> > Best,
> >
> >
> >
> > --
> > Sent from:
> http://mailinglists.scilab.org/Scilab-developers-Mailing-Lists-Archives-f2574944.html
> > _______________________________________________
> > dev mailing list
> > dev at lists.scilab.org
> > http://lists.scilab.org/mailman/listinfo/dev
>
> _______________________________________________
> dev mailing list
> dev at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20190302/26ec2593/attachment.htm>


More information about the dev mailing list