<div dir="ltr">Hi Antoine,<div><br></div><div>Thank you for your quick response. This is exactly what I was looking for!</div><div><br></div><div>Cheers,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 2, 2019 at 9:05 AM Antoine ELIAS <<a href="mailto:antoine.elias@scilab-enterprises.com">antoine.elias@scilab-enterprises.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello Sylvain,<br>
<br>
You can get Scilab outputs by setting your own output function.<br>
<br>
void scilab_print(const char *text)<br>
{<br>
     std::cout << text << std::endl;<br>
}<br>
<br>
//redirect output to your own function:<br>
setScilabOutputMethod(&scilab_print);<br>
<br>
Commands send to call_scilab by SendScilabJob are muted ( execstr("cmd", <br>
"errcatch"); ), so to show outputs you need to explicitly call "disp" <br>
function in your code or<br>
use another mechanism to put your commands directly in queue of <br>
execution by using StoreConsoleCommand function.<br>
<br>
See attached file as example.<br>
Have a good weekend.<br>
Antoine<br>
Le 02/03/2019 à 00:41, SylvainCorlay a écrit :<br>
> Hello everyone,<br>
><br>
> This is my first post on this mailing list. I hope that I am not breaking<br>
> any rule!<br>
><br>
> I am interested in embedding the scilab interpreter in a C++ application.<br>
> The `call_scilab` API appears to be the wayt to go for simple code<br>
> execution, however I wonder it is possible to capture / redirect output<br>
> streams? The motivation is to create a kernel for Jupyter. I am aware of the<br>
> existing pexpect-based kernel but I would like to create a new kernel that<br>
> would be running in-process and not rely on piping to capture textual<br>
> output.<br>
><br>
> Note: this is something that we have already done for other languages.<br>
> /xeus-cling/ is a  C++ kernel<br>
> <<a href="https://blog.jupyter.org/interactive-workflows-for-c-with-jupyter-fe9b54227d92" rel="noreferrer" target="_blank">https://blog.jupyter.org/interactive-workflows-for-c-with-jupyter-fe9b54227d92</a>><br>
> based on the cling C++ interpreter from CERN. /xeus-python/ is an<br>
> alternative Python kernel. Both are based on the xeus C++ implementation of<br>
> the Jupyter protocol, support auto-complete, quick help, rich output<br>
> display, interactive widgets.<br>
><br>
> I would like to know how far we could go with the `call_scilab` API with<br>
> respect to redirection, and whether there would be some means to access<br>
> lower-level control on the interpreter (for e.g. inspection, auto-complete<br>
> requests, getting a handle on the last value returned).<br>
><br>
> Looking forward to hearing from you, although I will be travelling in the<br>
> next few days.<br>
><br>
> Best,<br>
><br>
><br>
><br>
> --<br>
> Sent from: <a href="http://mailinglists.scilab.org/Scilab-developers-Mailing-Lists-Archives-f2574944.html" rel="noreferrer" target="_blank">http://mailinglists.scilab.org/Scilab-developers-Mailing-Lists-Archives-f2574944.html</a><br>
> _______________________________________________<br>
> dev mailing list<br>
> <a href="mailto:dev@lists.scilab.org" target="_blank">dev@lists.scilab.org</a><br>
> <a href="http://lists.scilab.org/mailman/listinfo/dev" rel="noreferrer" target="_blank">http://lists.scilab.org/mailman/listinfo/dev</a><br>
<br>
_______________________________________________<br>
dev mailing list<br>
<a href="mailto:dev@lists.scilab.org" target="_blank">dev@lists.scilab.org</a><br>
<a href="http://lists.scilab.org/mailman/listinfo/dev" rel="noreferrer" target="_blank">http://lists.scilab.org/mailman/listinfo/dev</a><br>
</blockquote></div>