src/Pure/System/session.scala
changeset 50117 32755e357a51
parent 49524 68796a77c42b
child 50201 c26369c9eda6
equal deleted inserted replaced
50116:88b971fca902 50117:32755e357a51
    20 object Session
    20 object Session
    21 {
    21 {
    22   /* events */
    22   /* events */
    23 
    23 
    24   //{{{
    24   //{{{
    25   case object Global_Options
    25   case class Global_Options(options: Options)
    26   case object Caret_Focus
    26   case object Caret_Focus
    27   case class Raw_Edits(edits: List[Document.Edit_Text])
    27   case class Raw_Edits(edits: List[Document.Edit_Text])
    28   case class Commands_Changed(
    28   case class Commands_Changed(
    29     assignment: Boolean, nodes: Set[Document.Node.Name], commands: Set[Command])
    29     assignment: Boolean, nodes: Set[Document.Node.Name], commands: Set[Command])
    30 
    30 
    56   def reparse_limit: Int = 0
    56   def reparse_limit: Int = 0
    57 
    57 
    58 
    58 
    59   /* pervasive event buses */
    59   /* pervasive event buses */
    60 
    60 
    61   val global_options = new Event_Bus[Session.Global_Options.type]
    61   val global_options = new Event_Bus[Session.Global_Options]
    62   val caret_focus = new Event_Bus[Session.Caret_Focus.type]
    62   val caret_focus = new Event_Bus[Session.Caret_Focus.type]
    63   val raw_edits = new Event_Bus[Session.Raw_Edits]
    63   val raw_edits = new Event_Bus[Session.Raw_Edits]
    64   val commands_changed = new Event_Bus[Session.Commands_Changed]
    64   val commands_changed = new Event_Bus[Session.Commands_Changed]
    65   val phase_changed = new Event_Bus[Session.Phase]
    65   val phase_changed = new Event_Bus[Session.Phase]
    66   val syslog_messages = new Event_Bus[Isabelle_Process.Output]
    66   val syslog_messages = new Event_Bus[Isabelle_Process.Output]
   395           }
   395           }
   396           finished = true
   396           finished = true
   397           receiver.cancel()
   397           receiver.cancel()
   398           reply(())
   398           reply(())
   399 
   399 
       
   400         case Session.Global_Options(options) if prover.isDefined =>
       
   401           prover.get.options(options)
       
   402 
   400         case Cancel_Execution if prover.isDefined =>
   403         case Cancel_Execution if prover.isDefined =>
   401           prover.get.cancel_execution()
   404           prover.get.cancel_execution()
   402 
   405 
   403         case raw @ Session.Raw_Edits(edits) if prover.isDefined =>
   406         case raw @ Session.Raw_Edits(edits) if prover.isDefined =>
   404           prover.get.discontinue_execution()
   407           prover.get.discontinue_execution()
   442 
   445 
   443 
   446 
   444   /* actions */
   447   /* actions */
   445 
   448 
   446   def start(args: List[String])
   449   def start(args: List[String])
   447   { session_actor ! Start(args) }
   450   {
   448 
   451     global_options += session_actor
   449   def stop() { commands_changed_buffer !? Stop; change_parser !? Stop; session_actor !? Stop }
   452     session_actor ! Start(args)
       
   453   }
       
   454 
       
   455   def stop()
       
   456   {
       
   457     global_options -= session_actor
       
   458     commands_changed_buffer !? Stop
       
   459     change_parser !? Stop
       
   460     session_actor !? Stop
       
   461   }
   450 
   462 
   451   def cancel_execution() { session_actor ! Cancel_Execution }
   463   def cancel_execution() { session_actor ! Cancel_Execution }
   452 
   464 
   453   def edit(edits: List[Document.Edit_Text])
   465   def edit(edits: List[Document.Edit_Text])
   454   { session_actor !? Session.Raw_Edits(edits) }
   466   { session_actor !? Session.Raw_Edits(edits) }