sane default for class Thy_Load;
authorwenzelm
Sat, 17 Sep 2011 17:55:39 +0200
changeset 44953 cdfe42f1267c
parent 44952 28a11f5fd3b8
child 44954 b536b1144eb3
sane default for class Thy_Load;
src/Pure/System/session.scala
src/Pure/Thy/thy_load.scala
src/Tools/jEdit/src/jedit_thy_load.scala
--- a/src/Pure/System/session.scala	Sat Sep 17 17:05:31 2011 +0200
+++ b/src/Pure/System/session.scala	Sat Sep 17 17:55:39 2011 +0200
@@ -36,7 +36,7 @@
 }
 
 
-class Session(thy_load: Thy_Load)
+class Session(thy_load: Thy_Load = new Thy_Load)
 {
   /* real time parameters */  // FIXME properties or settings (!?)
 
--- a/src/Pure/Thy/thy_load.scala	Sat Sep 17 17:05:31 2011 +0200
+++ b/src/Pure/Thy/thy_load.scala	Sat Sep 17 17:55:39 2011 +0200
@@ -6,11 +6,34 @@
 
 package isabelle
 
-abstract class Thy_Load
+
+import java.io.File
+
+
+
+class Thy_Load
 {
-  def register_thy(thy_name: String)
-  def is_loaded(thy_name: String): Boolean
-  def append(dir: String, path: Path): String
-  def check_thy(node_name: Document.Node.Name): Thy_Header
+  /* loaded theories provided by prover */
+
+  private var loaded_theories: Set[String] = Set()
+
+  def register_thy(thy_name: String): Unit =
+    synchronized { loaded_theories += thy_name }
+
+  def is_loaded(thy_name: String): Boolean =
+    synchronized { loaded_theories.contains(thy_name) }
+
+
+  /* file-system operations */
+
+  def append(dir: String, source_path: Path): String =
+    (Path.explode(dir) + source_path).implode
+
+  def check_thy(name: Document.Node.Name): Thy_Header =
+  {
+    val file = new File(name.node)
+    if (!file.exists || !file.isFile) error("No such file: " + quote(file.toString))
+    Thy_Header.read(file)
+  }
 }
 
--- a/src/Tools/jEdit/src/jedit_thy_load.scala	Sat Sep 17 17:05:31 2011 +0200
+++ b/src/Tools/jEdit/src/jedit_thy_load.scala	Sat Sep 17 17:55:39 2011 +0200
@@ -18,21 +18,6 @@
 
 class JEdit_Thy_Load extends Thy_Load
 {
-  /* loaded theories provided by prover */
-
-  private var loaded_theories: Set[String] = Set()
-
-  override def register_thy(thy_name: String)
-  {
-    synchronized { loaded_theories += thy_name }
-  }
-
-  override def is_loaded(thy_name: String): Boolean =
-    synchronized { loaded_theories.contains(thy_name) }
-
-
-  /* file-system operations */
-
   override def append(dir: String, source_path: Path): String =
   {
     val path = source_path.expand