On Tue, 2011-12-20 at 21:35 +0300, Noor Ahmed wrote:
>
> Hello,
>
> I have a few questions about your package. The setup instructions are
> not clear. I am using WIN-Prolog, and want to connect it to an
> interface created in Java.
> In WIN-Prolog I have to write "read_words" to run the program, which
> takes a line of string -that comes from the interface- for processing.
>
> So this is the code I wrote, I'm very sure it's wrong because it's not
> working properly:
> "
>
> Environment en = new Environment();
>
> en.ensureLoaded(AtomTerm.get("/Users/NetBeansProjects/e-Q/src/pkginterface/
code.pl"));
>
> Interpreter intr;
> AtomTerm ans = null;
>
> intr = en.createInterpreter();
>
>
> VariableTerm str = new VariableTerm(label.getText()".");
>
> Term[] args = {str};
>
> CompoundTerm goalTerm = new CompoundTerm("read_words(A).", args);
>
> en.runInitialization(intr);
> try {
> intr.runOnce(goalTerm);
> } catch (PrologException ex) {
>
> Logger.getLogger(checkBalance.class.getName()).log(Level.SEVERE, null,
> ex);
> }
>
> ans = (AtomTerm) goalTerm.dereference();
>
> String check = ans.toString();
> "
>
> Please can you reply soon. Thank you.
>
>
> Regards.
>