clarified signature;
authorwenzelm
Sat, 18 Mar 2017 21:24:54 +0100
changeset 65315 c7097ccbffb7
parent 65314 944758d6462e
child 65316 c0fb8405416c
clarified signature;
src/Pure/PIDE/protocol_handlers.scala
src/Pure/PIDE/session.scala
src/Pure/Tools/build.scala
--- a/src/Pure/PIDE/protocol_handlers.scala	Sat Mar 18 20:57:15 2017 +0100
+++ b/src/Pure/PIDE/protocol_handlers.scala	Sat Mar 18 21:24:54 2017 +0100
@@ -20,7 +20,7 @@
   {
     def get(name: String): Option[Session.Protocol_Handler] = handlers.get(name)
 
-    def add(handler: Session.Protocol_Handler): State =
+    def init(handler: Session.Protocol_Handler): State =
     {
       val name = handler.getClass.getName
 
@@ -48,12 +48,12 @@
       copy(handlers = handlers2, functions = functions2)
     }
 
-    def add(name: String): State =
+    def init(name: String): State =
     {
       val new_handler =
         try { Some(Class.forName(name).newInstance.asInstanceOf[Session.Protocol_Handler]) }
         catch { case exn: Throwable => bad_handler(exn, name); None }
-      new_handler match { case Some(handler) => add(handler) case None => this }
+      new_handler match { case Some(handler) => init(handler) case None => this }
     }
 
     def invoke(msg: Prover.Protocol_Output): Boolean =
@@ -85,8 +85,8 @@
   private val state = Synchronized(Protocol_Handlers.State(session))
 
   def get(name: String): Option[Session.Protocol_Handler] = state.value.get(name)
-  def add(handler: Session.Protocol_Handler): Unit = state.change(_.add(handler))
-  def add(name: String): Unit = state.change(_.add(name))
+  def init(handler: Session.Protocol_Handler): Unit = state.change(_.init(handler))
+  def init(name: String): Unit = state.change(_.init(name))
   def invoke(msg: Prover.Protocol_Output): Boolean = state.value.invoke(msg)
   def exit(): Unit = state.change(_.exit())
 }
--- a/src/Pure/PIDE/session.scala	Sat Mar 18 20:57:15 2017 +0100
+++ b/src/Pure/PIDE/session.scala	Sat Mar 18 21:24:54 2017 +0100
@@ -288,17 +288,17 @@
   def get_protocol_handler(name: String): Option[Session.Protocol_Handler] =
     protocol_handlers.get(name)
 
-  def add_protocol_handler(handler: Session.Protocol_Handler): Unit =
-    protocol_handlers.add(handler)
+  def init_protocol_handler(handler: Session.Protocol_Handler): Unit =
+    protocol_handlers.init(handler)
 
-  def add_protocol_handler(name: String): Unit =
-    protocol_handlers.add(name)
+  def init_protocol_handler(name: String): Unit =
+    protocol_handlers.init(name)
 
 
   /* debugger */
 
   private val debugger_handler = new Debugger.Handler(this)
-  add_protocol_handler(debugger_handler)
+  init_protocol_handler(debugger_handler)
 
   def debugger: Debugger = debugger_handler.debugger
 
@@ -397,7 +397,7 @@
           if (!handled) {
             msg.properties match {
               case Markup.Protocol_Handler(name) if prover.defined =>
-                add_protocol_handler(name)
+                init_protocol_handler(name)
 
               case Protocol.Command_Timing(state_id, timing) if prover.defined =>
                 val message = XML.elem(Markup.STATUS, List(XML.Elem(Markup.Timing(timing), Nil)))
--- a/src/Pure/Tools/build.scala	Sat Mar 18 20:57:15 2017 +0100
+++ b/src/Pure/Tools/build.scala	Sat Mar 18 21:24:54 2017 +0100
@@ -223,7 +223,7 @@
           val resources = new Resources(deps(parent))
           val session = new Session(options, resources)
           val handler = new Handler(progress, session, name)
-          session.add_protocol_handler(handler)
+          session.init_protocol_handler(handler)
 
           val session_result = Future.promise[Int]