equal
deleted
inserted
replaced
61 |
61 |
62 /** buffered command changes (delay_first discipline) **/ |
62 /** buffered command changes (delay_first discipline) **/ |
63 |
63 |
64 private case object Stop |
64 private case object Stop |
65 |
65 |
66 private val command_change_buffer = Simple_Thread.actor("command_change_buffer", daemon = true) |
66 private val (_, command_change_buffer) = |
|
67 Simple_Thread.actor("command_change_buffer", daemon = true) |
67 //{{{ |
68 //{{{ |
68 { |
69 { |
69 import scala.compat.Platform.currentTime |
70 import scala.compat.Platform.currentTime |
70 |
71 |
71 var changed: Set[Command] = Set() |
72 var changed: Set[Command] = Set() |
116 def current_state(): Document.State = global_state.peek() |
117 def current_state(): Document.State = global_state.peek() |
117 |
118 |
118 private case class Edit_Version(edits: List[Document.Node_Text_Edit]) |
119 private case class Edit_Version(edits: List[Document.Node_Text_Edit]) |
119 private case class Started(timeout: Int, args: List[String]) |
120 private case class Started(timeout: Int, args: List[String]) |
120 |
121 |
121 private val session_actor = Simple_Thread.actor("session_actor", daemon = true) |
122 private val (_, session_actor) = Simple_Thread.actor("session_actor", daemon = true) |
122 { |
123 { |
123 var prover: Isabelle_Process with Isar_Document = null |
124 var prover: Isabelle_Process with Isar_Document = null |
124 |
125 |
125 |
126 |
126 /* document changes */ |
127 /* document changes */ |
200 case _ => if (!result.is_ready) bad_result(result) |
201 case _ => if (!result.is_ready) bad_result(result) |
201 } |
202 } |
202 } |
203 } |
203 else if (result.is_exit) prover = null // FIXME ?? |
204 else if (result.is_exit) prover = null // FIXME ?? |
204 else if (result.is_stdout) raw_output.event(result) |
205 else if (result.is_stdout) raw_output.event(result) |
205 else if (!result.is_system) bad_result(result) // FIXME syslog for system messages (!?) |
206 else if (!result.is_system) bad_result(result) |
206 } |
207 } |
207 } |
208 } |
208 //}}} |
209 //}}} |
209 |
210 |
210 |
211 |
214 { |
215 { |
215 val buf = new StringBuilder |
216 val buf = new StringBuilder |
216 while ( |
217 while ( |
217 receiveWithin(0) { |
218 receiveWithin(0) { |
218 case result: Isabelle_Process.Result => |
219 case result: Isabelle_Process.Result => |
219 if (result.is_stdout) { |
220 if (result.is_system) { |
220 for (text <- XML.content(result.message)) |
221 for (text <- XML.content(result.message)) |
221 buf.append(text) |
222 buf.append(text) |
222 } |
223 } |
223 true |
224 true |
224 case TIMEOUT => false |
225 case TIMEOUT => false |
270 |
271 |
271 case Started(timeout, args) => |
272 case Started(timeout, args) => |
272 if (prover == null) { |
273 if (prover == null) { |
273 prover = new Isabelle_Process(system, timeout, self, args:_*) with Isar_Document |
274 prover = new Isabelle_Process(system, timeout, self, args:_*) with Isar_Document |
274 val origin = sender |
275 val origin = sender |
275 val opt_err = prover_startup(timeout) |
276 val opt_err = prover_startup(timeout + 500) |
276 if (opt_err.isDefined) prover = null |
277 if (opt_err.isDefined) prover = null |
277 origin ! opt_err |
278 origin ! opt_err |
278 } |
279 } |
279 else reply(None) |
280 else reply(None) |
280 |
281 |