src/Tools/jEdit/src/prover/Prover.scala
changeset 34460 cc5b9f02fbea
parent 34404 98155c35d252
child 34462 fefbd0421e4e
equal deleted inserted replaced
34406:f81cd75ae331 34460:cc5b9f02fbea
    35   var document = null : Document
    35   var document = null : Document
    36 
    36 
    37   def fireChange(c : Command) =
    37   def fireChange(c : Command) =
    38     inUIThread(() => commandInfo.fire(new CommandChangeInfo(c)))
    38     inUIThread(() => commandInfo.fire(new CommandChangeInfo(c)))
    39 
    39 
    40   var workerThread = new Thread("isabelle.Prover: worker") {
    40   val worker_thread = new Thread("isabelle.Prover: worker") {
    41     override def run() : Unit = {
    41     override def run() : Unit = {
    42       while (true) {
    42       while (true) {
    43         val r = process.get_result
    43         val r = process.get_result
    44         
    44         
    45         val id = if (r.props != null) r.props.getProperty("id") else null
    45         val id = if (r.props != null) r.props.getProperty("id") else null
   112       }
   112       }
   113     }
   113     }
   114   }
   114   }
   115   
   115   
   116   def handleResult(st : Command, r : Result, tree : XML.Tree) {
   116   def handleResult(st : Command, r : Result, tree : XML.Tree) {
   117     //TODO: this is just for testing
   117 
   118     allInfo.fire(r)
       
   119     
       
   120     r.kind match {
   118     r.kind match {
   121       case IsabelleProcess.Kind.ERROR => 
   119       case IsabelleProcess.Kind.ERROR => 
   122         if (st.phase != Phase.REMOVED && st.phase != Phase.REMOVE)
   120         if (st.phase != Phase.REMOVED && st.phase != Phase.REMOVE)
   123           st.phase = Phase.FAILED
   121           st.phase = Phase.FAILED
   124         st.addResult(tree)
   122         st.addResult(tree)
   147   
   145   
   148   def start(logic : String) {
   146   def start(logic : String) {
   149     if (logic != null)
   147     if (logic != null)
   150       _logic = logic
   148       _logic = logic
   151     process = new IsabelleProcess("-m", "xsymbols", _logic)
   149     process = new IsabelleProcess("-m", "xsymbols", _logic)
   152     workerThread.start
   150     worker_thread.start
   153   }
   151   }
   154 
   152 
   155   def stop() {
   153   def stop() {
   156     process.kill
   154     process.kill
   157   }
   155   }
   198     cmd.phase = Phase.UNPROCESSED
   196     cmd.phase = Phase.UNPROCESSED
   199   }
   197   }
   200   
   198   
   201   def remove(cmd : Command) {
   199   def remove(cmd : Command) {
   202     cmd.phase = Phase.REMOVE
   200     cmd.phase = Phase.REMOVE
   203     process.output_sync("Isar.remove " + encode_string(cmd.idString))
   201       process.output_sync("Isar.remove " + encode_string(cmd.idString))
       
   202 
   204   }
   203   }
   205 }
   204 }