Oleg,
Thanks for your help.
I tried the following after modifying the peekpike as follow (ugly but to
have an idea) :
PeekPipe=: 3 : 0
smoutput 'peekpipe'
avail=. ,_1
if.0=PeekNamedPipe y;0;0;0;avail;0 do.''return.end.
smoutput {.avail
{.avail
)
and then I had :
p=:'jtask' conew~'c:\arion\arion.exe'
write__p 'help',LF
1
wait__p 20
peekpipe
0
peekpipe
0
peekpipe
0
peekpipe
0
peekpipe
0
peekpipe
0
peekpipe
0
peekpipe
0
peekpipe
0
peekpipe
0
0
read__p ''
peekpipe
0
the 'help' is a valid command for the arion.exe which started (as I see in
the Windows task manager ).
That program prompts the user with 'Arion>' similar to a 'Ready'. Could it
be possible to ReadFile and "suspend" that thread as soon as such a string
is received ?
Anyway I think that the wait might be also useful in my case because there
is a parameter in arion which specify the maximum time for a calculation of
a chess move.
JC Coez
----- Original Message -----
From: "Oleg Kobchenko" <[EMAIL PROTECTED]>
To: "Programming forum" <[email protected]>
Sent: Tuesday, April 03, 2007 12:21 PM
Subject: Re: [Jprogramming] stdin/stdout
There is a version of interactive task enhancement
at http://www.jsoftware.com/jwiki/OlegKobchenko/Interactive_Task
It uses "naive" wait, which nevertheless works
with Windows "more" command. (A more correct approach
would require overlapped IO.)
However, I believe this should be worth a try.
The wait timeouts should be calibrated for
particular application. Wait should be done
and return non-zero before any read.
Try something simple first and see how it goes.
--- JC Coez <[EMAIL PROTECTED]> wrote:
It seems to be exactly what happened in my case wth the Arion chess
engine.
When you will have some time to solve that please let me know.
JC Coez
----- Original Message -----
From: "Raul Miller" <[EMAIL PROTECTED]>
To: "Programming forum" <[email protected]>
Sent: Monday, April 02, 2007 9:33 PM
Subject: Re: [Jprogramming] stdin/stdout
>I downloaded and installed arasan 9.5 from
> http://www.arasanchess.org/downld.html
>
> I ran arasan.exe, and the gui worked.
>
> I ran arasanx.exe, and the stdio interface worked (I was able to enter
> commands like
> e7e6 and e2e4, and get plausible responses).
>
> In J, I defined:
> spawnio=:3 :0
> require'task'
> cocurrent 'jtask'
> 'or ow'=.CreatePipe 1
> 'ir iw'=.CreatePipe 2
> ph=.(ow,ir) CreateProcess y
> if.1>ph do.
> CloseHandle or,ow,ir,iw
> assert.0
> end.
> CloseHandle ow,ir
> iw,or
> )
>
> arasanx=:3 :0
> spawnio (2!:5'APPDATA'),'\arasanx.exe'
> )
>
> rd=:ReadAll_jtask_
> wr=:WriteAll_jtask_
>
> Then, I tried:
> arasanx''
> 548 424
> rd 424
>
> At this point, my J session "froze". I then went to the OS, and ended
> the
> arasanx process. As soon as I did this, J returned the text of the
> first
> line
> from arasanx:
>
> Arasan 9.5 Copyright 1994-2006 by Jon Dart
>
> If I wanted to make this work, I'd have to figure out how to read and
> write lines. (task.ijs does not include a ReadLine verb.)
>
> I think I know how to make this work (actually, I have several ideas
> I could try), but I don't have time to mess with this right now.
>
> --
> Raul
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
---------------------------------------------------------------------------------------
Orange vous informe que cet e-mail a ete controle par l'anti-virus mail.
Aucun virus connu a ce jour par nos services n'a ete detecte.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm