[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
different behaviors between Unix and Windows versions
From: |
Bapst Frédéric |
Subject: |
different behaviors between Unix and Windows versions |
Date: |
Tue, 29 Aug 2006 08:57:00 +0200 |
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)(fromProlog.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:\java 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
-----------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- different behaviors between Unix and Windows versions,
Bapst Frédéric <=