public abstract class SubprocessEngine extends AbstractPrologEngine
Modifier and Type | Class and Description |
---|---|
static class |
SubprocessEngine.OutputDumper
Useful for testing
|
Modifier and Type | Field and Description |
---|---|
static byte |
ctrl_c |
static byte[] |
ctrlc |
firstJavaMessageName, interPrologFileLoaded, nl, prologBinDirectoryOrCommand
MAX_INT_VALUE, MIN_INT_VALUE, version
Modifier and Type | Method and Description |
---|---|
void |
abortEngine()
Assumes the engine is in a break state
|
void |
addPrologOutputListener(PrologOutputListener client)
Add a PrologOutputListener to this engine.
|
void |
addPrologStderrListener(OutputListener l) |
void |
addPrologStdoutListener(OutputListener client)
Add a OutputListener to get output from Prolog's standard output.
|
void |
breakEngine()
Pause the computation and enter a break (sub shell) state
|
Object[] |
deterministicGoal(String G,
String OVar,
Object[] objectsP,
String RVars)
Synchronously calls a Prolog goal.
|
String |
getCharset()
Current engine stream charset name
|
boolean |
isAvailable()
Prolog is thought to be idle
|
boolean |
isDetectErrorMessages() |
void |
printPrologOutputToConsole()
For debugging purposes only
|
void |
printPrologOutputToFile(String F)
For debugging purposes only
e.g.: ipPrologEngine(E), java(E,printPrologOutputToFile(string('/MyDir/xsb-output.txt'))).
|
boolean |
realCommand(String s)
This implementation may get stuck if the command includes variables, because the Prolog
top level interpreter may offer to compute more solutions; use variables prefixed with '_'
|
void |
removePrologOutputListener(PrologOutputListener client) |
void |
removePrologStderrListener(OutputListener l) |
void |
removePrologStdoutListener(OutputListener l) |
void |
resumeEngine()
Assumes the engine is in a break state
|
void |
sendAndFlush(String s)
Sends a String to Prolog's input.
|
void |
sendAndFlushLn(String s) |
void |
setCharset(String charsetName)
Set the character set to be assumed decoding Prolog's stream output, e.g.
|
void |
setDebug(boolean debug)
Show (or hide) debug messages, both Java and Prolog side, cf.
|
void |
setDetectErrorMessages(boolean detectErrorMessages)
Some Prolog errors during deterministicGoal are not caught as exceptions, e.g.
|
void |
setEngineStarted() |
void |
setSlowWindowsShutdown() |
void |
shutdown()
Shuts down the background Prolog process as well as the dependent Java threads.
|
void |
waitUntilAvailable()
This method blocks until
isAvailable() returns true. |
abortTasks, add_lib_dir, addPrologEngineListener, addSoftwareLibrary, addSoftwareLibrary, assignableType, command, command, command, consultAbsolute, consultAbsolute, consultFromPackage, consultFromPackage, consultRelative, createTempDirectory, currentTimeSecs, deleteAll, deleteTempFiles, deterministicGoal, deterministicGoal, deterministicGoal, deterministicGoal, deterministicGoalJSON, doCallback, endAllTasks, exec, executingOnJavaSide, findConstructor, findMethod, firstJavaMessage, getImplementationPeer, getInterprologPath, getJarDirectory, getJarDirectory, getLoadFromJar, getPrologBaseDirectory, getPrologNumericVersion, getPrologVersion, getRealJavaObject, getRealJavaObject, getRealJavaObject, getThePrologListener, goal, goal, handleCallback, hasPrologExtension, inPrologShell, interrupt, interruptTasks, is64WindowsOS, isAllowSimultaneousThreads, isDebug, isIdle, isLinuxOS, isMacOS, isPaused, isProfiling, isSerializable, isShutingDown, isThreadedCallbacks, isWindowsOS, lastSolutionUndefined, load_dynAbsolute, load_dynRelative, loop, loop2, makeInvisible, printAllStackTraces, printAllStackTraces, printBindings, printStackTrace, profilingMessage, progressMessage, progressMessage, prologBinToBaseDirectory, prologCanWork, prologEnteredBreak, prologResumedComputation, prologReturnedToTopLevel, registerJavaObject, removePrologEngineListener, serverFileSeparatorChar, serverIsWindows, setAllowSimultaneousThreads, setProfiling, setThreadedCallbacks, setTimedCallIntervall, shortClassName, stop, teachMoreObjects, teachMoreObjects, teachMoreObjects, teachOneObject, toString, unescapedFilePath, unregisterJavaObject, unregisterJavaObject, unregisterJavaObjects, waitUntilIdle
public boolean isDetectErrorMessages()
public void setDetectErrorMessages(boolean detectErrorMessages)
detectErrorMessages
- false if you want to disable textual detection of errorspublic void addPrologOutputListener(PrologOutputListener client)
client
- An object interested in receiving messages depicting Prolog's progressPrologOutputListener
public void removePrologOutputListener(PrologOutputListener client)
public void addPrologStdoutListener(OutputListener client)
client
- An object interested in Prolog's standard outputOutputListener
public void addPrologStderrListener(OutputListener l)
public void removePrologStdoutListener(OutputListener l)
public void removePrologStderrListener(OutputListener l)
public void setCharset(String charsetName)
charsetName
- Charset
public String getCharset()
public void printPrologOutputToConsole()
public void printPrologOutputToFile(String F) throws FileNotFoundException
FileNotFoundException
public void setEngineStarted()
public void setDebug(boolean debug)
AbstractPrologEngine
setDebug
in interface PrologEngine
setDebug
in class AbstractPrologEngine
public boolean isAvailable()
isAvailable
in interface PrologEngine
isAvailable
in class AbstractPrologEngine
public void waitUntilAvailable()
PrologEngine
isAvailable()
returns true.waitUntilAvailable
in interface PrologEngine
waitUntilAvailable
in class AbstractPrologEngine
public void shutdown()
shutdown
in interface PrologEngine
shutdown
in class AbstractPrologEngine
public void setSlowWindowsShutdown()
public void sendAndFlush(String s)
public void sendAndFlushLn(String s)
public void breakEngine()
public void resumeEngine()
public void abortEngine()
public boolean realCommand(String s)
realCommand
in class AbstractPrologEngine
AbstractPrologEngine.command(String)
public Object[] deterministicGoal(String G, String OVar, Object[] objectsP, String RVars)
AbstractPrologEngine
deterministicGoal
in interface PrologEngine
deterministicGoal
in class AbstractPrologEngine
G
- Prolog goal termOVar
- Prolog variable that will be bound to objectsP arrayobjectsP
- Array of Java objects to pass to Prolog goal; nonserializable objects are encapsulated in InvisibleObject references, changing this arrayRVars
- Prolog list with object specifications, typically containing variables occurring in g.
If null a single binding will be returned, containing a TermModel object representing the goal term solutionAbstractPrologEngine.deterministicGoal(String)
,
AbstractPrologEngine.deterministicGoal(String,String)
,
AbstractPrologEngine.deterministicGoal(String,String,Object[])