src/Pure/PIDE/session.scala
changeset 72692 22aeec526ffd
parent 72217 e35997591c5b
child 72721 79f5e843e5ec
equal deleted inserted replaced
72691:2126cf946086 72692:22aeec526ffd
   179   }
   179   }
   180 
   180 
   181 
   181 
   182   /* outlets */
   182   /* outlets */
   183 
   183 
       
   184   val finished_theories = new Session.Outlet[Command.State](dispatcher)
   184   val command_timings = new Session.Outlet[Session.Command_Timing](dispatcher)
   185   val command_timings = new Session.Outlet[Session.Command_Timing](dispatcher)
   185   val theory_timings = new Session.Outlet[Session.Theory_Timing](dispatcher)
   186   val theory_timings = new Session.Outlet[Session.Theory_Timing](dispatcher)
   186   val runtime_statistics = new Session.Outlet[Session.Runtime_Statistics](dispatcher)
   187   val runtime_statistics = new Session.Outlet[Session.Runtime_Statistics](dispatcher)
   187   val task_statistics = new Session.Outlet[Session.Task_Statistics](dispatcher)
   188   val task_statistics = new Session.Outlet[Session.Task_Statistics](dispatcher)
   188   val global_options = new Session.Outlet[Session.Global_Options](dispatcher)
   189   val global_options = new Session.Outlet[Session.Global_Options](dispatcher)
   473 
   474 
   474       def change_command(f: Document.State => (Command.State, Document.State))
   475       def change_command(f: Document.State => (Command.State, Document.State))
   475       {
   476       {
   476         try {
   477         try {
   477           val st = global_state.change_result(f)
   478           val st = global_state.change_result(f)
   478           change_buffer.invoke(false, Nil, List(st.command))
   479           if (!st.command.span.is_theory) {
       
   480             change_buffer.invoke(false, Nil, List(st.command))
       
   481           }
   479         }
   482         }
   480         catch { case _: Document.State.Fail => bad_output() }
   483         catch { case _: Document.State.Fail => bad_output() }
   481       }
   484       }
   482 
   485 
   483       output match {
   486       output match {
   499               case Protocol.Export(args)
   502               case Protocol.Export(args)
   500               if args.id.isDefined && Value.Long.unapply(args.id.get).isDefined =>
   503               if args.id.isDefined && Value.Long.unapply(args.id.get).isDefined =>
   501                 val id = Value.Long.unapply(args.id.get).get
   504                 val id = Value.Long.unapply(args.id.get).get
   502                 val export = Export.make_entry("", args, msg.bytes, cache = xz_cache)
   505                 val export = Export.make_entry("", args, msg.bytes, cache = xz_cache)
   503                 change_command(_.add_export(id, (args.serial, export)))
   506                 change_command(_.add_export(id, (args.serial, export)))
       
   507 
       
   508               case Protocol.Loading_Theory(node_name, id) =>
       
   509                 try { global_state.change(_.begin_theory(node_name, id, msg.text)) }
       
   510                 catch { case _: Document.State.Fail => bad_output() }
       
   511 
       
   512               case Markup.Finished_Theory(theory) =>
       
   513                 try {
       
   514                   val st = global_state.change_result(_.end_theory(theory))
       
   515                   finished_theories.post(st)
       
   516                 }
       
   517                 catch { case _: Document.State.Fail => bad_output() }
   504 
   518 
   505               case List(Markup.Commands_Accepted.PROPERTY) =>
   519               case List(Markup.Commands_Accepted.PROPERTY) =>
   506                 msg.text match {
   520                 msg.text match {
   507                   case Protocol.Commands_Accepted(ids) =>
   521                   case Protocol.Commands_Accepted(ids) =>
   508                     ids.foreach(id =>
   522                     ids.foreach(id =>