From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 9C7097EEE9 for ; Thu, 23 Mar 2017 10:37:31 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=paul.lachat@edu.univ-fcomte.fr; spf=SoftFail smtp.mailfrom=paul.lachat@edu.univ-fcomte.fr; spf=None smtp.helo=postmaster@ufc-sortie.univ-fcomte.fr Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of paul.lachat@edu.univ-fcomte.fr) identity=pra; client-ip=194.57.91.199; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="paul.lachat@edu.univ-fcomte.fr"; x-sender="paul.lachat@edu.univ-fcomte.fr"; x-conformance=sidf_compatible Received-SPF: SoftFail (mail3-smtp-sop.national.inria.fr: domain of paul.lachat@edu.univ-fcomte.fr is inclined to not designate 194.57.91.199 as permitted sender) identity=mailfrom; client-ip=194.57.91.199; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="paul.lachat@edu.univ-fcomte.fr"; x-sender="paul.lachat@edu.univ-fcomte.fr"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@ufc-sortie.univ-fcomte.fr) identity=helo; client-ip=194.57.91.199; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="paul.lachat@edu.univ-fcomte.fr"; x-sender="postmaster@ufc-sortie.univ-fcomte.fr"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3Ad1w4qhYXJeL3dRWVux099mj/LSx+4OfEezUN459i?= =?us-ascii?q?sYplN5qZoMq5bnLW6fgltlLVR4KTs6sC0LuK9fi4EUU7or+5+EgYd5JNUxJXwe?= =?us-ascii?q?43pCcH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3KqTX5EeB++ZpJ+CHZIYJkDvxNr444f/w?= =?us-ascii?q?yHEynloBcO+nx8hEIEukF+hrdh3KKUHnhc0MRD8H?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AvDgBiltNYh8dbOcJdHAEBCgEBBAEBG?= =?us-ascii?q?AELAQUBgkOBRIEKB4NbiwKQO5d1HwEChgCDIkQTAQEBAQEBAQEBAQESAQEBCgs?= =?us-ascii?q?JCCgvgjMggmwEZAExGQJbMolvmkmQBoFsOopuiFuKPBWCSgWJJZMwhnuNSVSBC?= =?us-ascii?q?4cihjOTYTeBJF2EWgEBCAIBVIFwdIh0AYEMAQEB?= X-IPAS-Result: =?us-ascii?q?A0AvDgBiltNYh8dbOcJdHAEBCgEBBAEBGAELAQUBgkOBRIE?= =?us-ascii?q?KB4NbiwKQO5d1HwEChgCDIkQTAQEBAQEBAQEBAQESAQEBCgsJCCgvgjMggmwEZ?= =?us-ascii?q?AExGQJbMolvmkmQBoFsOopuiFuKPBWCSgWJJZMwhnuNSVSBC4cihjOTYTeBJF2?= =?us-ascii?q?EWgEBCAIBVIFwdIh0AYEMAQEB?= X-IronPort-AV: E=Sophos;i="5.36,209,1486422000"; d="scan'208,217";a="217731819" Received: from ufc-sortie.univ-fcomte.fr ([194.57.91.199]) by mail3-smtp-sop.national.inria.fr with ESMTP; 23 Mar 2017 10:37:30 +0100 Received: from ufc204.univ-fcomte.fr (ufc204.univ-fcomte.fr [194.57.91.204]) by ufc-sortie.univ-fcomte.fr (Postfix) with ESMTP id 59370608B6 for ; Thu, 23 Mar 2017 10:37:30 +0100 (CET) Received: from zstore04.univ-fcomte.fr (localhost.localdomain [127.0.0.1]) by ufc204.univ-fcomte.fr (Postfix) with ESMTP id 40E2D8B8F for ; Thu, 23 Mar 2017 10:37:30 +0100 (CET) Date: Thu, 23 Mar 2017 10:37:30 +0100 (CET) From: paul.lachat@edu.univ-fcomte.fr To: caml-list@inria.fr Message-ID: <1590236478.9253508.1490261850094.JavaMail.zimbra@edu.univ-fcomte.fr> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_9253507_1476104947.1490261850091" X-Originating-IP: [194.167.45.25] X-Mailer: Zimbra 8.6.0_GA_1200 (ZimbraWebClient - FF52 (Linux)/8.6.0_GA_1200) Thread-Topic: Loading .ml in memory to interact with them. Thread-Index: W1IlD+/YpYOkD3jhTl+ip5Vc01R2ag== Subject: [Caml-list] [Question] Loading .ml in memory to interact with them. ------=_Part_9253507_1476104947.1490261850091 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Hello, I need to find a way to put Ocaml program in memory so I could interact with the program (call function, get result, find information about the variables, ...) without always reading the file. That what append when we use the directive #use "file.ml";; in the interactive shell (the toplevel, when you type the command ocaml in a shell). The instruction need to come from a Matlab function. So, I was thinking to create a process who run the ocaml command, redirect his standard input in a named pipe, redirect his standard output in another named pipe, so I could send instructions and received responses. But when I send the first instruction (ex : #use "file.ml";;\n), the ocaml process send back the response and stop. ____ file.ml : let x = 10;; ____ "#use "file.ml";;\n" Matlab -- /tmp/pipe_in --> ocaml "val x : int = 10" Matlab <-- /tmp/pipe_out -- ocaml then ocaml stop... ___ So I would like to know if you think it's a good solution and if it is, do someone know how could I make it work ? _ I've tried another solution. I use Unix.fork() and launch, in the son process, the ocaml command then I send instructions from the father process to the son process with anonym pipe (Unix.pipe()). But here I have trouble with blocking read, I send an instruction, read the answer but even if I've read all char of the answer, it's wait to read more but there is no more to read... I have tried to use Unix.set_nonblock() and catch EAGAIN, but then I don't get anything at all in the buffer given to Unix.read(). If someone could help, I would be grateful ! Lachat Paul ------=_Part_9253507_1476104947.1490261850091 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hello,
<= br data-mce-bogus=3D"1">
I need to find a way to put Ocaml progra= m in memory so I could interact with the program
(call function, = get result, find information about the variables, ...) without always readi= ng the file.

That what append when we use the directive #use "file.ml";; in the= interactive shell (the toplevel, when you type the command ocaml in a shel= l).

= The instruction need to come from a Matlab function. So, I was thinking to = create a process who run the ocaml command,
redirect his standard= input in a named pipe, redirect his standard output in another named pipe,= so I could send instructions and received responses.

But when I send the first= instruction (ex : #use "file.ml";;\n), the ocaml process send back the res= ponse and stop.

____

file.ml :
let x =3D 10;;

____

 = ;            &n= bsp;     "#use "file.ml";;\n"
<= /div>
Matlab --   /tmp/pipe_in  -->   ocaml=

&nb= sp;            =       "val x : int =3D 10"
Matlab <-- /tmp/pipe_out --    ocaml
        =             &nb= sp;            =             &nb= sp;    then ocaml stop...

___


So= I would like to know if you think it's a good solution and if it is, do so= meone know how could I make it work ?
_

I've tried another solution. I use Unix.for= k() and launch, in the son process, the ocaml command then
I send= instructions from the father process to the son process with anonym pipe (= Unix.pipe()).

<= /div>
But here I have trouble with blocking read, I send an instruction= , read the answer but even if I've read all char of the answer, it's wait t= o read
more but there is no more to read...

I have tried to use Unix.set_nonblock() and catch = EAGAIN, but then I don't get anything at all in the buffer given to Unix.re= ad().

If someone could help, I would be grateful !
Lachat Paul

= ------=_Part_9253507_1476104947.1490261850091--