info-gnuprologjava
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Info-gnuprologjava] few questions about your package


From: Noor Ahmed
Subject: [Info-gnuprologjava] few questions about your package
Date: Tue, 20 Dec 2011 21:35:14 +0300


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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]