clarified signature, e.g. for re-use by other servers;
--- a/src/Pure/Tools/server.scala Thu Dec 13 15:32:54 2018 +0100
+++ b/src/Pure/Tools/server.scala Thu Dec 13 16:36:26 2018 +0100
@@ -307,8 +307,29 @@
/* server info */
- sealed case class Info(name: String, port: Int, password: String)
+ def print_socket(port: Int): String = "127.0.0.1:" + port
+
+ def print(port: Int, password: String): String =
+ print_socket(port) + " (password " + quote(password) + ")"
+
+ object Info
{
+ private val Pattern = """server "([^"]*)" = 127\.0\.0\.1:(\d+) \(password "([^"]*)"\)""".r
+
+ def unapply(s: String): Option[Info] =
+ s match {
+ case Pattern(name, Value.Int(port), password) => Some(Info(name, port, password))
+ case _ => None
+ }
+
+ def apply(name: String, port: Int, password: String): Info =
+ new Info(name, port, password)
+ }
+
+ class Info private(val name: String, val port: Int, val password: String)
+ {
+ def socket_name: String = print_socket(port)
+
override def toString: String =
"server " + quote(name) + " = " + print(port, password)
@@ -342,9 +363,6 @@
val default_name = "isabelle"
- def print(port: Int, password: String): String =
- "127.0.0.1:" + port + " (password " + quote(password) + ")"
-
object Data
{
val database = Path.explode("$ISABELLE_HOME_USER/servers.db")