equal
deleted
inserted
replaced
339 /* raw edits */ |
339 /* raw edits */ |
340 |
340 |
341 def handle_raw_edits(doc_blobs: Document.Blobs, edits: List[Document.Edit_Text]) |
341 def handle_raw_edits(doc_blobs: Document.Blobs, edits: List[Document.Edit_Text]) |
342 //{{{ |
342 //{{{ |
343 { |
343 { |
|
344 require(prover.isDefined) |
|
345 |
344 prover.get.discontinue_execution() |
346 prover.get.discontinue_execution() |
345 |
347 |
346 val previous = global_state.value.history.tip.version |
348 val previous = global_state.value.history.tip.version |
347 val version = Future.promise[Document.Version] |
349 val version = Future.promise[Document.Version] |
348 global_state.change(_.continue_history(previous, edits, version)) |
350 global_state.change(_.continue_history(previous, edits, version)) |
356 /* resulting changes */ |
358 /* resulting changes */ |
357 |
359 |
358 def handle_change(change: Session.Change) |
360 def handle_change(change: Session.Change) |
359 //{{{ |
361 //{{{ |
360 { |
362 { |
|
363 require(prover.isDefined) |
|
364 |
361 def id_command(command: Command) |
365 def id_command(command: Command) |
362 { |
366 { |
363 for { |
367 for { |
364 digest <- command.blobs_digests |
368 digest <- command.blobs_digests |
365 if !global_state.value.defined_blob(digest) |
369 if !global_state.value.defined_blob(digest) |
416 output match { |
420 output match { |
417 case msg: Prover.Protocol_Output => |
421 case msg: Prover.Protocol_Output => |
418 val handled = _protocol_handlers.invoke(msg) |
422 val handled = _protocol_handlers.invoke(msg) |
419 if (!handled) { |
423 if (!handled) { |
420 msg.properties match { |
424 msg.properties match { |
421 case Markup.Protocol_Handler(name) => |
425 case Markup.Protocol_Handler(name) if prover.isDefined => |
422 _protocol_handlers = _protocol_handlers.add(prover.get, name) |
426 _protocol_handlers = _protocol_handlers.add(prover.get, name) |
423 |
427 |
424 case Protocol.Command_Timing(state_id, timing) => |
428 case Protocol.Command_Timing(state_id, timing) if prover.isDefined => |
425 val message = XML.elem(Markup.STATUS, List(XML.Elem(Markup.Timing(timing), Nil))) |
429 val message = XML.elem(Markup.STATUS, List(XML.Elem(Markup.Timing(timing), Nil))) |
426 accumulate(state_id, prover.get.xml_cache.elem(message)) |
430 accumulate(state_id, prover.get.xml_cache.elem(message)) |
427 |
431 |
428 case Markup.Assign_Update => |
432 case Markup.Assign_Update => |
429 msg.text match { |
433 msg.text match { |
493 phase = Session.Startup |
497 phase = Session.Startup |
494 prover = Some(resources.start_prover(receiver.invoke _, name, args)) |
498 prover = Some(resources.start_prover(receiver.invoke _, name, args)) |
495 } |
499 } |
496 |
500 |
497 case Stop => |
501 case Stop => |
498 if (phase == Session.Ready) { |
502 if (prover.isDefined && is_ready) { |
499 _protocol_handlers = _protocol_handlers.stop(prover.get) |
503 _protocol_handlers = _protocol_handlers.stop(prover.get) |
500 global_state.change(_ => Document.State.init) // FIXME event bus!? |
504 global_state.change(_ => Document.State.init) // FIXME event bus!? |
501 phase = Session.Shutdown |
505 phase = Session.Shutdown |
502 prover.get.terminate |
506 prover.get.terminate |
503 prover = None |
507 prover = None |