def execute(source: String,
solve_all: Boolean = false,
prove: Boolean = false,
max_solutions: Int = Int.MaxValue,
cleanup_inst: Boolean = false,
timeout: Time = Time.zero,
max_threads: Int = 0
): Result = { /* executor */
val pool_size = Multithreading.max_threads(value = max_threads) val executor: ThreadPoolExecutor = new ThreadPoolExecutor(pool_size, pool_size, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue[Runnable], new ThreadPoolExecutor.CallerRunsPolicy)
val executor_killed = Synchronized(false) def executor_kill(): Unit =
executor_killed.change(b => if (b) b else { Isabelle_Thread.fork() { executor.shutdownNow() }; true })
/* system context */
class Exit extends Exception("EXIT")
class Exec_Context extends Context { privatevar rc = Process_Result.RC.ok privateval out = new StringBuilder privateval err = new StringBuilder
try { val lexer = new KodkodiLexer(new ANTLRInputStream(Bytes(source).stream())) val parser =
KodkodiParser.create(context, executor, false, solve_all, prove, max_solutions, cleanup_inst, lexer)
val timeout_request = if (timeout.is_zero) None else {
Some(Event_Timer.request(Time.now() + timeout) {
context.error("Ran out of time")
context.return_code(Process_Result.RC.failure)
executor_kill()
})
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.