different behaviors between Unix and Windows versions

Bapst Frédéric <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <[email protected]>
Hi,

We are trying to write an Eclipse plugin for Eclipse dedicated to GNU prolog programming. In this context, I start GNU prolog as a separate process, writing commands to the interpreter (e.g. compilations with consult(...)), and reading the results (e.g. parsing error messages). I'm working on Windows, so I set the LINEDIT environment variable to "gui=no".

It works for simple commands. But under Windows, there is a difference in the behavior of gprolog between an interactive command-line and a non-interactive process: when there is multiple answers, I get an endless loop with this prompt:

Action (; for next solution, a for all solutions, RET to stop) ?

while I do not send any character on the pipe.

Any hint about that problem would be welcome.

Here
is a small Java program as an illustration of my problem.

Note that the prob
lem only happens on Windows; on Solaris, it works fine
(but the "| ?-" prompt also disappears...why ?).

Thanks in advance.

--------------------------------------------------------------------------
-------------------- Java program
--------------------------------------------------------------------------
import java.io.*;
public class CallingProlog {
static InputStreamReader fromProlog;
static OutputStream toProlog;
// ----------------------------------------------------------------------
public static void main (String [] args) throws IOException{
startProlog();
while(true) {
if (fromProlog.ready()) { // something to read from gprolog process
System.out.write( (char)(f
romProlog.read()));
System.out.flush();
&
nbsp; }
if (System.in.available()>0) { // something to read from stdin
toProlog.write((char)(System.in.read()));
toProlog.flush();
}
}
}
// ----------------------------------------------------------------------
public static void startProlog() throws IOException {
String Cmd = "gprolog";
Process prcss = Runtime.getRuntime().exec(Cmd);
fromProlog = new InputStreamReader(prcss.getInputStream());
toProlog = prcss.getOutputStream();
}
}

--------------------------------------------------------------------------
-------------------- Execution
--------------------------------------------------------------------------
E:\jav
a CallingProlog
GNU Prolog 1.2.16
By Daniel Diaz
Copyright (C) 1999-2002
Daniel Diaz
append([],A,[]).

A = []

yes
append(A,B,C).

A = []
C = B ?
Action (; for next solution, a for all solutions, RET to stop) ?
Action (; for next solution, a for all solutions, RET to stop) ?
Action (; for next solution, a for all solutions, RET to stop) ?
...

-----------------------------------------------------

Romandie Annonces : http://annonces.romandie.com

Petites annonces 100% gratuites entre romands

-----------------------------------------------------

_______________________________________________
Users-prolog mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/users-prolog
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.