privatelazyval command_table: Map[String, Command] =
Isabelle_System.make_services(classOf[Commands]).flatMap(_.entries).
foldLeft(Map.empty[String, Command]) { case (cmds, cmd) => val name = cmd.command_name if (cmds.isDefinedAt(name)) error("Duplicate Isabelle server command: " + quote(name)) else cmds + (name -> cmd)
}
/* output reply */
class Error(val message: String, val json: JSON.Object.T = JSON.Object.empty) extends RuntimeException(message)
def json_error(exn: Throwable): JSON.Object.T =
exn match { case e: Error => Reply.error_message(e.message) ++ e.json case ERROR(msg) => Reply.error_message(msg) case _ if Exn.is_interrupt(exn) => Reply.error_message(Exn.message(exn)) case _ => JSON.Object.empty
}
def set_timeout(t: Time): Unit = socket.setSoTimeout(t.ms.toInt)
privateval in = new BufferedInputStream(socket.getInputStream) privateval out = new BufferedOutputStream(socket.getOutputStream) privateval out_lock: AnyRef = newObject
def tty_loop(): TTY_Loop = new TTY_Loop( new OutputStreamWriter(out), new InputStreamReader(in),
writer_lock = out_lock)
object Base { val name = SQL.Column.string("name").make_primary_key val port = SQL.Column.int("port") val password = SQL.Column.string("password") val table = SQL.Table("isabelle_servers", List(name, port, password))
}
def list(db: SQLite.Database): List[Info] = if (db.exists_table(Base.table)) {
db.execute_query_statement(Base.table.select(),
List.from[Info],
{ res => val name = res.string(Base.name) val port = res.int(Base.port) val password = res.string(Base.password)
Info(name, port, password)
}
).sortBy(_.name)
} else Nil
def exit(name: String = default_name): Boolean = {
using(SQLite.open_database(private_data.database)) { db =>
private_data.transaction_lock(db) {
private_data.find(db, name) match { case Some(server_info) =>
using(server_info.connection())(_.write_line_message("shutdown")) while(server_info.active) { Time.seconds(0.05).sleep() } true case None => false
}
}
}
}
/* Isabelle tool wrapper */
val isabelle_tool =
Isabelle_Tool("server", "manage resident Isabelle servers", Scala_Project.here,
{ args => var console = false var log_file: Option[Path] = None var operation_list = false var operation_exit = false var name = default_name var port = 0 var existing_server = false
val getopts = Getopts("""
Usage: isabelle server [OPTIONS]
Options are:
-L FILE logging on FILE
-c console interaction with specified server
-l list servers (alternative operation)
-n NAME explicit server name (default: """ + default_name + """)
-p PORT explicit server port
-s assume existing server, no implicit startup
-x exit specified server (alternative operation)
var finished = false while (!finished) {
connection.read_line_message() match { case None => finished = true case Some("") => context.notify("Command 'help' provides list of commands") case Some(msg) => val (name, argument) = Server.Argument.split(msg)
Server.command_table.get(name) match { case Some(cmd) =>
argument match { case Server.Argument(arg) => if (cmd.command_body.isDefinedAt((context, arg))) {
Exn.capture { cmd.command_body((context, arg)) } match { case Exn.Res(task: Server.Task) =>
connection.reply_ok(JSON.Object(task.ident))
task.start() case Exn.Res(res) => connection.reply_ok(res) case Exn.Exn(exn) => val err = Server.json_error(exn) if (err.isEmpty) throw exn else connection.reply_error(err)
}
} else {
connection.reply_error_message( "Bad argument for command " + Library.single_quote(name), "argument" -> argument)
} case _ =>
connection.reply_error_message( "Malformed argument for command " + Library.single_quote(name), "argument" -> argument)
} case None => connection.reply_error("Bad command " + Library.single_quote(name))
}
}
}
}
}
}
Messung V0.5 in Prozent
¤ 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.0.13Bemerkung:
(vorverarbeitet am 2026-04-30)
¤
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 und die Messung sind noch experimentell.