src/Pure/Thy/thy_load.scala
changeset 44953 cdfe42f1267c
parent 44616 4beeaf2a226d
child 46737 09ab89658a5d
     1.1 --- a/src/Pure/Thy/thy_load.scala	Sat Sep 17 17:05:31 2011 +0200
     1.2 +++ b/src/Pure/Thy/thy_load.scala	Sat Sep 17 17:55:39 2011 +0200
     1.3 @@ -6,11 +6,34 @@
     1.4  
     1.5  package isabelle
     1.6  
     1.7 -abstract class Thy_Load
     1.8 +
     1.9 +import java.io.File
    1.10 +
    1.11 +
    1.12 +
    1.13 +class Thy_Load
    1.14  {
    1.15 -  def register_thy(thy_name: String)
    1.16 -  def is_loaded(thy_name: String): Boolean
    1.17 -  def append(dir: String, path: Path): String
    1.18 -  def check_thy(node_name: Document.Node.Name): Thy_Header
    1.19 +  /* loaded theories provided by prover */
    1.20 +
    1.21 +  private var loaded_theories: Set[String] = Set()
    1.22 +
    1.23 +  def register_thy(thy_name: String): Unit =
    1.24 +    synchronized { loaded_theories += thy_name }
    1.25 +
    1.26 +  def is_loaded(thy_name: String): Boolean =
    1.27 +    synchronized { loaded_theories.contains(thy_name) }
    1.28 +
    1.29 +
    1.30 +  /* file-system operations */
    1.31 +
    1.32 +  def append(dir: String, source_path: Path): String =
    1.33 +    (Path.explode(dir) + source_path).implode
    1.34 +
    1.35 +  def check_thy(name: Document.Node.Name): Thy_Header =
    1.36 +  {
    1.37 +    val file = new File(name.node)
    1.38 +    if (!file.exists || !file.isFile) error("No such file: " + quote(file.toString))
    1.39 +    Thy_Header.read(file)
    1.40 +  }
    1.41  }
    1.42