125 |
125 |
126 class Session(_session_options: => Options, val resources: Resources) extends Document.Session |
126 class Session(_session_options: => Options, val resources: Resources) extends Document.Session |
127 { |
127 { |
128 session => |
128 session => |
129 |
129 |
130 val xml_cache: XML.Cache = XML.Cache.make() |
130 val cache: XML.Cache = XML.Cache.make() |
131 val xz_cache: XZ.Cache = XZ.Cache.make() |
|
132 |
131 |
133 def build_blobs_info(name: Document.Node.Name): Command.Blobs_Info = |
132 def build_blobs_info(name: Document.Node.Name): Command.Blobs_Info = |
134 Command.Blobs_Info.none |
133 Command.Blobs_Info.none |
135 |
134 |
136 |
135 |
494 if (!handled) { |
493 if (!handled) { |
495 msg.properties match { |
494 msg.properties match { |
496 case Protocol.Command_Timing(props, state_id, timing) if prover.defined => |
495 case Protocol.Command_Timing(props, state_id, timing) if prover.defined => |
497 command_timings.post(Session.Command_Timing(props)) |
496 command_timings.post(Session.Command_Timing(props)) |
498 val message = XML.elem(Markup.STATUS, List(XML.Elem(Markup.Timing(timing), Nil))) |
497 val message = XML.elem(Markup.STATUS, List(XML.Elem(Markup.Timing(timing), Nil))) |
499 change_command(_.accumulate(state_id, xml_cache.elem(message), xml_cache)) |
498 change_command(_.accumulate(state_id, cache.elem(message), cache)) |
500 |
499 |
501 case Markup.Theory_Timing(props) => |
500 case Markup.Theory_Timing(props) => |
502 theory_timings.post(Session.Theory_Timing(props)) |
501 theory_timings.post(Session.Theory_Timing(props)) |
503 |
502 |
504 case Markup.Task_Statistics(props) => |
503 case Markup.Task_Statistics(props) => |
505 task_statistics.post(Session.Task_Statistics(props)) |
504 task_statistics.post(Session.Task_Statistics(props)) |
506 |
505 |
507 case Protocol.Export(args) |
506 case Protocol.Export(args) |
508 if args.id.isDefined && Value.Long.unapply(args.id.get).isDefined => |
507 if args.id.isDefined && Value.Long.unapply(args.id.get).isDefined => |
509 val id = Value.Long.unapply(args.id.get).get |
508 val id = Value.Long.unapply(args.id.get).get |
510 val export = Export.make_entry("", args, msg.bytes, cache = xz_cache) |
509 val export = Export.make_entry("", args, msg.bytes, cache) |
511 change_command(_.add_export(id, (args.serial, export))) |
510 change_command(_.add_export(id, (args.serial, export))) |
512 |
511 |
513 case Protocol.Loading_Theory(node_name, id) => |
512 case Protocol.Loading_Theory(node_name, id) => |
514 val blobs_info = build_blobs_info(node_name) |
513 val blobs_info = build_blobs_info(node_name) |
515 try { global_state.change(_.begin_theory(node_name, id, msg.text, blobs_info)) } |
514 try { global_state.change(_.begin_theory(node_name, id, msg.text, blobs_info)) } |
517 |
516 |
518 case List(Markup.Commands_Accepted.PROPERTY) => |
517 case List(Markup.Commands_Accepted.PROPERTY) => |
519 msg.text match { |
518 msg.text match { |
520 case Protocol.Commands_Accepted(ids) => |
519 case Protocol.Commands_Accepted(ids) => |
521 ids.foreach(id => |
520 ids.foreach(id => |
522 change_command(_.accumulate(id, Protocol.Commands_Accepted.message, xml_cache))) |
521 change_command(_.accumulate(id, Protocol.Commands_Accepted.message, cache))) |
523 case _ => bad_output() |
522 case _ => bad_output() |
524 } |
523 } |
525 |
524 |
526 case List(Markup.Assign_Update.PROPERTY) => |
525 case List(Markup.Assign_Update.PROPERTY) => |
527 msg.text match { |
526 msg.text match { |
552 } |
551 } |
553 } |
552 } |
554 case _ => |
553 case _ => |
555 output.properties match { |
554 output.properties match { |
556 case Position.Id(state_id) => |
555 case Position.Id(state_id) => |
557 change_command(_.accumulate(state_id, output.message, xml_cache)) |
556 change_command(_.accumulate(state_id, output.message, cache)) |
558 |
557 |
559 case _ if output.is_init => |
558 case _ if output.is_init => |
560 val init_ok = |
559 val init_ok = |
561 try { |
560 try { |
562 Isabelle_System.make_services(classOf[Session.Protocol_Handler]) |
561 Isabelle_System.make_services(classOf[Session.Protocol_Handler]) |