src/Tools/jEdit/src/proofdocument/session.scala
author wenzelm
Wed, 30 Dec 2009 17:48:58 +0100
changeset 34813 f0107bc96961
parent 34810 9ad3431a34a5
child 34815 6bae73cd8e33
permissions -rw-r--r--
more explicit modeling of Command and Command_State as Session.Entity; misc tuning;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34777
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
     1
/*
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
     2
 * Isabelle session, potentially with running prover
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
     3
 *
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
     4
 * @author Makarius
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
     5
 */
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
     6
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
     7
package isabelle.proofdocument
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
     8
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
     9
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
    10
import scala.actors.Actor._
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
    11
34791
b97d5b38dea4 explicit object Session.Global_Settings;
wenzelm
parents: 34780
diff changeset
    12
object Session
b97d5b38dea4 explicit object Session.Global_Settings;
wenzelm
parents: 34780
diff changeset
    13
{
34813
f0107bc96961 more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents: 34810
diff changeset
    14
  /* events */
f0107bc96961 more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents: 34810
diff changeset
    15
34791
b97d5b38dea4 explicit object Session.Global_Settings;
wenzelm
parents: 34780
diff changeset
    16
  case object Global_Settings
34813
f0107bc96961 more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents: 34810
diff changeset
    17
f0107bc96961 more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents: 34810
diff changeset
    18
f0107bc96961 more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents: 34810
diff changeset
    19
  /* managed entities */
f0107bc96961 more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents: 34810
diff changeset
    20
f0107bc96961 more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents: 34810
diff changeset
    21
  type Entity_ID = String
f0107bc96961 more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents: 34810
diff changeset
    22
f0107bc96961 more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents: 34810
diff changeset
    23
  trait Entity
f0107bc96961 more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents: 34810
diff changeset
    24
  {
f0107bc96961 more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents: 34810
diff changeset
    25
    val id: Entity_ID
f0107bc96961 more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents: 34810
diff changeset
    26
    def consume(session: Session, message: XML.Tree): Unit
f0107bc96961 more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents: 34810
diff changeset
    27
  }
34791
b97d5b38dea4 explicit object Session.Global_Settings;
wenzelm
parents: 34780
diff changeset
    28
}
b97d5b38dea4 explicit object Session.Global_Settings;
wenzelm
parents: 34780
diff changeset
    29
34777
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
    30
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
    31
class Session(system: Isabelle_System)
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
    32
{
34809
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    33
  /* pervasive event buses */
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    34
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    35
  val global_settings = new Event_Bus[Session.Global_Settings.type]
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    36
  val raw_results = new Event_Bus[Isabelle_Process.Result]
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    37
  val results = new Event_Bus[Command]
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    38
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    39
  val command_change = new Event_Bus[Command]
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    40
  val document_change = new Event_Bus[Proof_Document]
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    41
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    42
34778
8eccd35e975e removed unused Session.prover_logic;
wenzelm
parents: 34777
diff changeset
    43
  /* unique ids */
8eccd35e975e removed unused Session.prover_logic;
wenzelm
parents: 34777
diff changeset
    44
8eccd35e975e removed unused Session.prover_logic;
wenzelm
parents: 34777
diff changeset
    45
  private var id_count: BigInt = 0
34813
f0107bc96961 more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents: 34810
diff changeset
    46
  def create_id(): Session.Entity_ID = synchronized { id_count += 1; "j" + id_count }
34778
8eccd35e975e removed unused Session.prover_logic;
wenzelm
parents: 34777
diff changeset
    47
8eccd35e975e removed unused Session.prover_logic;
wenzelm
parents: 34777
diff changeset
    48
34810
9ad3431a34a5 tuned caret_listener/selected_command;
wenzelm
parents: 34809
diff changeset
    49
  /* document state information -- owned by session_actor */
34809
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    50
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    51
  @volatile private var outer_syntax = new Outer_Syntax(system.symbols)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    52
  def syntax(): Outer_Syntax = outer_syntax
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    53
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    54
  @volatile private var states = Map[Isar_Document.State_ID, Command_State]()
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    55
  @volatile private var commands = Map[Isar_Document.Command_ID, Command]()
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    56
  @volatile private var documents = Map[Isar_Document.Document_ID, Proof_Document]()
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    57
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    58
  def state(id: Isar_Document.State_ID): Option[Command_State] = states.get(id)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    59
  def command(id: Isar_Document.Command_ID): Option[Command] = commands.get(id)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    60
  def document(id: Isar_Document.Document_ID): Option[Proof_Document] = documents.get(id)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    61
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    62
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    63
  /** main actor **/
34777
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
    64
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34778
diff changeset
    65
  private case class Start(args: List[String])
34777
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
    66
  private case object Stop
34808
e462572536e9 eliminated global Session.document_0 -- did not work due to hardwired id;
wenzelm
parents: 34807
diff changeset
    67
  private case class Begin_Document(path: String)
34777
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
    68
34809
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    69
  private val session_actor = actor {
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    70
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    71
    var prover: Isabelle_Process with Isar_Document = null
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    72
    var prover_ready = false
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    73
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    74
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    75
    /* document changes */
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    76
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    77
    def handle_change(change: Change)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    78
    {
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    79
      val old = document(change.parent.get.id).get
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    80
      val (doc, changes) = old.text_changed(this, change)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    81
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    82
      val id_changes = changes map {
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    83
        case (c1, c2) =>
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    84
          (c1.map(_.id).getOrElse(""),
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    85
           c2 match {
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    86
              case None => None
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    87
              case Some(command) =>  // FIXME clarify -- may reuse existing commands!??
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    88
                commands += (command.id -> command)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    89
                prover.define_command(command.id, system.symbols.encode(command.content))
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    90
                Some(command.id)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    91
            })
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    92
      }
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    93
      documents += (doc.id -> doc)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    94
      prover.edit_document(old.id, doc.id, id_changes)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    95
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    96
      document_change.event(doc)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    97
    }
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    98
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
    99
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   100
    /* prover results */
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   101
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   102
    def handle_result(result: Isabelle_Process.Result)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   103
    {
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   104
      raw_results.event(result)
34799
0330a4284a9b just one variable for outer syntax keywords and completion;
wenzelm
parents: 34795
diff changeset
   105
34813
f0107bc96961 more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents: 34810
diff changeset
   106
      val target: Option[Session.Entity] =
34809
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   107
        Position.id_of(result.props) match {
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   108
          case None => None
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   109
          case Some(id) => commands.get(id) orElse states.get(id) orElse None
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   110
        }
34813
f0107bc96961 more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents: 34810
diff changeset
   111
      if (target.isDefined) target.get.consume(this, result.message)
34809
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   112
      else if (result.kind == Isabelle_Process.Kind.STATUS) {
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   113
        //{{{ global status message
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   114
        for (elem <- result.body) {
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   115
          elem match {
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   116
            // document edits
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   117
            case XML.Elem(Markup.EDITS, (Markup.ID, doc_id) :: _, edits) =>
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   118
              document(doc_id) match {
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   119
                case None =>  // FIXME clarify
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   120
                case Some(doc) =>
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   121
                  for {
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   122
                    XML.Elem(Markup.EDIT, (Markup.ID, cmd_id) :: (Markup.STATE, state_id) :: _, _)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   123
                    <- edits }
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   124
                  {
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   125
                    commands.get(cmd_id) match {
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   126
                      case Some(cmd) =>
34813
f0107bc96961 more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents: 34810
diff changeset
   127
                        val state = new Command_State(state_id, cmd)
34809
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   128
                        states += (state_id -> state)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   129
                        doc.states += (cmd -> state)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   130
                        command_change.event(cmd)   // FIXME really!?
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   131
                      case None =>
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   132
                    }
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   133
                  }
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   134
              }
34777
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   135
34809
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   136
            // command and keyword declarations
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   137
            case XML.Elem(Markup.COMMAND_DECL, (Markup.NAME, name) :: (Markup.KIND, kind) :: _, _) =>
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   138
              outer_syntax += (name, kind)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   139
            case XML.Elem(Markup.KEYWORD_DECL, (Markup.NAME, name) :: _, _) =>
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   140
              outer_syntax += name
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   141
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   142
            // process ready (after initialization)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   143
            case XML.Elem(Markup.READY, _, _) => prover_ready = true
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   144
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   145
          case _ =>
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   146
          }
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   147
        }
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   148
        //}}}
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   149
      }
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   150
      else if (result.kind == Isabelle_Process.Kind.EXIT)
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   151
        prover = null
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   152
    }
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   153
34795
c97335b7e8c3 cache results;
wenzelm
parents: 34792
diff changeset
   154
    val xml_cache = new XML.Cache(131071)
34809
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   155
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   156
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   157
    /* main loop */
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   158
34777
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   159
    loop {
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   160
      react {
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34778
diff changeset
   161
        case Start(args) =>
34777
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   162
          if (prover == null) {
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34778
diff changeset
   163
            prover = new Isabelle_Process(system, self, args:_*) with Isar_Document
34777
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   164
            reply(())
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   165
          }
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   166
34807
wenzelm
parents: 34802
diff changeset
   167
        case Stop =>  // FIXME clarify
34777
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   168
          if (prover != null)
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   169
            prover.kill
34778
8eccd35e975e removed unused Session.prover_logic;
wenzelm
parents: 34777
diff changeset
   170
          prover_ready = false
34808
e462572536e9 eliminated global Session.document_0 -- did not work due to hardwired id;
wenzelm
parents: 34807
diff changeset
   171
e462572536e9 eliminated global Session.document_0 -- did not work due to hardwired id;
wenzelm
parents: 34807
diff changeset
   172
        case Begin_Document(path: String) if prover_ready =>
e462572536e9 eliminated global Session.document_0 -- did not work due to hardwired id;
wenzelm
parents: 34807
diff changeset
   173
          val id = create_id()
e462572536e9 eliminated global Session.document_0 -- did not work due to hardwired id;
wenzelm
parents: 34807
diff changeset
   174
          val doc = Proof_Document.empty(id)
e462572536e9 eliminated global Session.document_0 -- did not work due to hardwired id;
wenzelm
parents: 34807
diff changeset
   175
          documents += (id -> doc)
e462572536e9 eliminated global Session.document_0 -- did not work due to hardwired id;
wenzelm
parents: 34807
diff changeset
   176
          prover.begin_document(id, path)
e462572536e9 eliminated global Session.document_0 -- did not work due to hardwired id;
wenzelm
parents: 34807
diff changeset
   177
          reply(doc)
34809
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   178
34777
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   179
        case change: Change if prover_ready =>
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   180
          handle_change(change)
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   181
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   182
        case result: Isabelle_Process.Result =>
34795
c97335b7e8c3 cache results;
wenzelm
parents: 34792
diff changeset
   183
          handle_result(result.cache(xml_cache))
34777
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   184
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   185
        case bad if prover_ready =>
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   186
          System.err.println("session_actor: ignoring bad message " + bad)
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   187
      }
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   188
    }
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   189
  }
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   190
34809
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   191
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   192
  /* main methods */
0fed930f2992 misc tuning;
wenzelm
parents: 34808
diff changeset
   193
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34778
diff changeset
   194
  def start(args: List[String]) { session_actor !? Start(args) }
34777
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   195
  def stop() { session_actor ! Stop }
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   196
  def input(change: Change) { session_actor ! change }
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   197
34808
e462572536e9 eliminated global Session.document_0 -- did not work due to hardwired id;
wenzelm
parents: 34807
diff changeset
   198
  def begin_document(path: String): Proof_Document =
e462572536e9 eliminated global Session.document_0 -- did not work due to hardwired id;
wenzelm
parents: 34807
diff changeset
   199
    (session_actor !? Begin_Document(path)).asInstanceOf[Proof_Document]
34777
91d6089cef88 class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff changeset
   200
}