48 val resources = new Resources(sessions_structure, base, command_timings = command_timings0) |
48 val resources = new Resources(sessions_structure, base, command_timings = command_timings0) |
49 val session = |
49 val session = |
50 new Session(options, resources) { |
50 new Session(options, resources) { |
51 override val xml_cache: XML.Cache = store.xml_cache |
51 override val xml_cache: XML.Cache = store.xml_cache |
52 override val xz_cache: XZ.Cache = store.xz_cache |
52 override val xz_cache: XZ.Cache = store.xz_cache |
|
53 } |
|
54 def make_rendering(snapshot: Document.Snapshot): Rendering = |
|
55 new Rendering(snapshot, options, session) { |
|
56 override def model: Document.Model = ??? |
53 } |
57 } |
54 |
58 |
55 object Build_Session_Errors |
59 object Build_Session_Errors |
56 { |
60 { |
57 private val promise: Promise[List[String]] = Future.promise |
61 private val promise: Promise[List[String]] = Future.promise |
158 } |
162 } |
159 |
163 |
160 session.finished_theories += Session.Consumer[Document.Snapshot]("finished_theories") |
164 session.finished_theories += Session.Consumer[Document.Snapshot]("finished_theories") |
161 { |
165 { |
162 case snapshot => |
166 case snapshot => |
|
167 val rendering = make_rendering(snapshot) |
|
168 |
163 def export(name: String, xml: XML.Body) |
169 def export(name: String, xml: XML.Body) |
164 { |
170 { |
165 val theory_name = snapshot.node_name.theory |
171 val theory_name = snapshot.node_name.theory |
166 val args = Protocol.Export.Args(theory_name = theory_name, name = name) |
172 val args = Protocol.Export.Args(theory_name = theory_name, name = name) |
167 export_consumer(session_name, args, Bytes(YXML.string_of_body(xml))) |
173 val bytes = Bytes(YXML.string_of_body(xml)) |
168 } |
174 if (!bytes.is_empty) export_consumer(session_name, args, bytes) |
|
175 } |
|
176 def export_text(name: String, text: String): Unit = |
|
177 export(name, List(XML.Text(text))) |
|
178 |
169 export(Export.MARKUP, snapshot.xml_markup()) |
179 export(Export.MARKUP, snapshot.xml_markup()) |
170 export(Export.MESSAGES, snapshot.messages.map(_._1)) |
180 export(Export.MESSAGES, snapshot.messages.map(_._1)) |
|
181 |
|
182 val citations = Library.distinct(rendering.citations(Text.Range.full).map(_.info)) |
|
183 export_text(Export.CITATIONS, cat_lines(citations)) |
171 } |
184 } |
172 |
185 |
173 session.all_messages += Session.Consumer[Any]("build_session_output") |
186 session.all_messages += Session.Consumer[Any]("build_session_output") |
174 { |
187 { |
175 case msg: Prover.Output => |
188 case msg: Prover.Output => |