--- a/src/Pure/Thy/thy_load.scala Thu Mar 01 14:48:32 2012 +0100
+++ b/src/Pure/Thy/thy_load.scala Thu Mar 01 15:16:20 2012 +0100
@@ -53,9 +53,8 @@
}
}
- def check_thy(name: Document.Node.Name): Document.Node.Deps =
+ def check_header(name: Document.Node.Name, header: Thy_Header): Document.Node.Deps =
{
- val header = read_header(name)
val name1 = header.name
val imports = header.imports.map(import_name(name.dir, _))
val uses = header.uses.map(p => (append(name.dir, Path.explode(p._1)), p._2))
@@ -63,5 +62,8 @@
error("Bad file name " + thy_path(Path.basic(name.theory)) + " for theory " + quote(name1))
Document.Node.Deps(imports, uses)
}
+
+ def check_thy(name: Document.Node.Name): Document.Node.Deps =
+ check_header(name, read_header(name))
}
--- a/src/Tools/jEdit/src/document_model.scala Thu Mar 01 14:48:32 2012 +0100
+++ b/src/Tools/jEdit/src/document_model.scala Thu Mar 01 15:16:20 2012 +0100
@@ -63,9 +63,12 @@
def node_header(): Document.Node_Header =
{
Swing_Thread.require()
- if (Isabelle.jedit_buffer(name.node) == Some(buffer))
- Exn.capture { Isabelle.thy_load.check_thy(name) }
- else Exn.Exn(ERROR("Bad theory header")) // FIXME odd race condition!?
+ Isabelle.buffer_lock(buffer) {
+ Exn.capture {
+ Isabelle.thy_load.check_header(name,
+ Thy_Header.read(buffer.getSegment(0, buffer.getLength)))
+ }
+ }
}