src/Pure/PIDE/protocol.scala
author wenzelm
Sat Oct 10 16:21:34 2015 +0200 (2015-10-10)
changeset 61381 ddca85598c65
parent 61376 93224745477f
child 63429 baedd4724f08
permissions -rw-r--r--
more explicit HTML.symbols;
tuned signature;
wenzelm@45709
     1
/*  Title:      Pure/PIDE/protocol.scala
wenzelm@38412
     2
    Author:     Makarius
wenzelm@38412
     3
wenzelm@45709
     4
Protocol message formats for interactive proof documents.
wenzelm@38412
     5
*/
wenzelm@38412
     6
wenzelm@38412
     7
package isabelle
wenzelm@38412
     8
wenzelm@38412
     9
wenzelm@45709
    10
object Protocol
wenzelm@38412
    11
{
wenzelm@38567
    12
  /* document editing */
wenzelm@38412
    13
wenzelm@52563
    14
  object Assign_Update
wenzelm@44476
    15
  {
wenzelm@52563
    16
    def unapply(text: String): Option[(Document_ID.Version, Document.Assign_Update)] =
wenzelm@44661
    17
      try {
wenzelm@44661
    18
        import XML.Decode._
wenzelm@44661
    19
        val body = YXML.parse_body(text)
wenzelm@52527
    20
        Some(pair(long, list(pair(long, list(long))))(body))
wenzelm@44661
    21
      }
wenzelm@44661
    22
      catch {
wenzelm@44661
    23
        case ERROR(_) => None
wenzelm@51987
    24
        case _: XML.Error => None
wenzelm@38412
    25
      }
wenzelm@38412
    26
  }
wenzelm@38567
    27
wenzelm@44676
    28
  object Removed
wenzelm@44676
    29
  {
wenzelm@52530
    30
    def unapply(text: String): Option[List[Document_ID.Version]] =
wenzelm@44676
    31
      try {
wenzelm@44676
    32
        import XML.Decode._
wenzelm@44676
    33
        Some(list(long)(YXML.parse_body(text)))
wenzelm@44676
    34
      }
wenzelm@44676
    35
      catch {
wenzelm@44676
    36
        case ERROR(_) => None
wenzelm@51987
    37
        case _: XML.Error => None
wenzelm@44676
    38
      }
wenzelm@44676
    39
  }
wenzelm@44676
    40
wenzelm@38567
    41
wenzelm@46209
    42
  /* command status */
wenzelm@38567
    43
wenzelm@56359
    44
  object Status
wenzelm@56359
    45
  {
wenzelm@56359
    46
    def make(markup_iterator: Iterator[Markup]): Status =
wenzelm@56359
    47
    {
wenzelm@56359
    48
      var touched = false
wenzelm@56359
    49
      var accepted = false
wenzelm@56395
    50
      var warned = false
wenzelm@56359
    51
      var failed = false
wenzelm@56359
    52
      var forks = 0
wenzelm@56359
    53
      var runs = 0
wenzelm@56359
    54
      for (markup <- markup_iterator) {
wenzelm@56359
    55
        markup.name match {
wenzelm@56359
    56
          case Markup.ACCEPTED => accepted = true
wenzelm@56359
    57
          case Markup.FORKED => touched = true; forks += 1
wenzelm@56359
    58
          case Markup.JOINED => forks -= 1
wenzelm@56359
    59
          case Markup.RUNNING => touched = true; runs += 1
wenzelm@56359
    60
          case Markup.FINISHED => runs -= 1
wenzelm@59203
    61
          case Markup.WARNING | Markup.LEGACY => warned = true
wenzelm@56395
    62
          case Markup.FAILED | Markup.ERROR => failed = true
wenzelm@56359
    63
          case _ =>
wenzelm@56359
    64
        }
wenzelm@56359
    65
      }
wenzelm@56395
    66
      Status(touched, accepted, warned, failed, forks, runs)
wenzelm@56359
    67
    }
wenzelm@56359
    68
wenzelm@56359
    69
    val empty = make(Iterator.empty)
wenzelm@56359
    70
wenzelm@56359
    71
    def merge(status_iterator: Iterator[Status]): Status =
wenzelm@56359
    72
      if (status_iterator.hasNext) {
wenzelm@56359
    73
        val status0 = status_iterator.next
wenzelm@56359
    74
        (status0 /: status_iterator)(_ + _)
wenzelm@56359
    75
      }
wenzelm@56359
    76
      else empty
wenzelm@56359
    77
  }
wenzelm@56359
    78
wenzelm@46166
    79
  sealed case class Status(
wenzelm@56352
    80
    private val touched: Boolean,
wenzelm@56352
    81
    private val accepted: Boolean,
wenzelm@56395
    82
    private val warned: Boolean,
wenzelm@56352
    83
    private val failed: Boolean,
wenzelm@56352
    84
    forks: Int,
wenzelm@56352
    85
    runs: Int)
wenzelm@38567
    86
  {
wenzelm@56359
    87
    def + (that: Status): Status =
wenzelm@56395
    88
      Status(
wenzelm@56395
    89
        touched || that.touched,
wenzelm@56395
    90
        accepted || that.accepted,
wenzelm@56395
    91
        warned || that.warned,
wenzelm@56395
    92
        failed || that.failed,
wenzelm@56395
    93
        forks + that.forks,
wenzelm@56395
    94
        runs + that.runs)
wenzelm@56359
    95
wenzelm@49036
    96
    def is_unprocessed: Boolean = accepted && !failed && (!touched || (forks != 0 && runs == 0))
wenzelm@49036
    97
    def is_running: Boolean = runs != 0
wenzelm@56474
    98
    def is_warned: Boolean = warned
wenzelm@56474
    99
    def is_failed: Boolean = failed
wenzelm@49039
   100
    def is_finished: Boolean = !failed && touched && forks == 0 && runs == 0
wenzelm@46166
   101
  }
wenzelm@46166
   102
wenzelm@56395
   103
  val proper_status_elements =
wenzelm@56743
   104
    Markup.Elements(Markup.ACCEPTED, Markup.FORKED, Markup.JOINED, Markup.RUNNING,
wenzelm@55646
   105
      Markup.FINISHED, Markup.FAILED)
wenzelm@55646
   106
wenzelm@56395
   107
  val liberal_status_elements =
wenzelm@59203
   108
    proper_status_elements + Markup.WARNING + Markup.LEGACY + Markup.ERROR
wenzelm@55646
   109
wenzelm@46209
   110
wenzelm@51818
   111
  /* command timing */
wenzelm@51818
   112
wenzelm@51818
   113
  object Command_Timing
wenzelm@51818
   114
  {
wenzelm@52531
   115
    def unapply(props: Properties.T): Option[(Document_ID.Generic, isabelle.Timing)] =
wenzelm@51818
   116
      props match {
wenzelm@51818
   117
        case (Markup.FUNCTION, Markup.COMMAND_TIMING) :: args =>
wenzelm@51818
   118
          (args, args) match {
wenzelm@51818
   119
            case (Position.Id(id), Markup.Timing_Properties(timing)) => Some((id, timing))
wenzelm@51818
   120
            case _ => None
wenzelm@51818
   121
          }
wenzelm@51818
   122
        case _ => None
wenzelm@51818
   123
      }
wenzelm@51818
   124
  }
wenzelm@51818
   125
wenzelm@51818
   126
wenzelm@46209
   127
  /* node status */
wenzelm@46209
   128
wenzelm@46688
   129
  sealed case class Node_Status(
wenzelm@56474
   130
    unprocessed: Int, running: Int, warned: Int, failed: Int, finished: Int)
wenzelm@44866
   131
  {
wenzelm@56474
   132
    def total: Int = unprocessed + running + warned + failed + finished
wenzelm@44866
   133
  }
wenzelm@44613
   134
wenzelm@44613
   135
  def node_status(
wenzelm@44613
   136
    state: Document.State, version: Document.Version, node: Document.Node): Node_Status =
wenzelm@44613
   137
  {
wenzelm@44613
   138
    var unprocessed = 0
wenzelm@44613
   139
    var running = 0
wenzelm@46688
   140
    var warned = 0
wenzelm@44613
   141
    var failed = 0
wenzelm@56474
   142
    var finished = 0
wenzelm@56356
   143
    for (command <- node.commands.iterator) {
wenzelm@56355
   144
      val states = state.command_states(version, command)
wenzelm@56359
   145
      val status = Status.merge(states.iterator.map(_.protocol_status))
wenzelm@56355
   146
wenzelm@56299
   147
      if (status.is_running) running += 1
wenzelm@57843
   148
      else if (status.is_failed) failed += 1
wenzelm@56395
   149
      else if (status.is_warned) warned += 1
wenzelm@56395
   150
      else if (status.is_finished) finished += 1
wenzelm@56299
   151
      else unprocessed += 1
wenzelm@56299
   152
    }
wenzelm@56474
   153
    Node_Status(unprocessed, running, warned, failed, finished)
wenzelm@44613
   154
  }
wenzelm@44613
   155
wenzelm@38887
   156
wenzelm@51533
   157
  /* node timing */
wenzelm@51533
   158
wenzelm@51533
   159
  sealed case class Node_Timing(total: Double, commands: Map[Command, Double])
wenzelm@51533
   160
wenzelm@51533
   161
  val empty_node_timing = Node_Timing(0.0, Map.empty)
wenzelm@51533
   162
wenzelm@51533
   163
  def node_timing(
wenzelm@51533
   164
    state: Document.State,
wenzelm@51533
   165
    version: Document.Version,
wenzelm@51533
   166
    node: Document.Node,
wenzelm@51533
   167
    threshold: Double): Node_Timing =
wenzelm@51533
   168
  {
wenzelm@51533
   169
    var total = 0.0
wenzelm@51533
   170
    var commands = Map.empty[Command, Double]
wenzelm@51533
   171
    for {
wenzelm@51533
   172
      command <- node.commands.iterator
wenzelm@56299
   173
      st <- state.command_states(version, command)
wenzelm@56356
   174
    } {
wenzelm@56356
   175
      val command_timing =
wenzelm@51533
   176
        (0.0 /: st.status)({
wenzelm@51533
   177
          case (timing, Markup.Timing(t)) => timing + t.elapsed.seconds
wenzelm@51533
   178
          case (timing, _) => timing
wenzelm@51533
   179
        })
wenzelm@51533
   180
      total += command_timing
wenzelm@51533
   181
      if (command_timing >= threshold) commands += (command -> command_timing)
wenzelm@51533
   182
    }
wenzelm@51533
   183
    Node_Timing(total, commands)
wenzelm@51533
   184
  }
wenzelm@51533
   185
wenzelm@51533
   186
wenzelm@39441
   187
  /* result messages */
wenzelm@39439
   188
wenzelm@50500
   189
  def is_result(msg: XML.Tree): Boolean =
wenzelm@50500
   190
    msg match {
wenzelm@50500
   191
      case XML.Elem(Markup(Markup.RESULT, _), _) => true
wenzelm@50500
   192
      case _ => false
wenzelm@50500
   193
    }
wenzelm@50500
   194
wenzelm@50157
   195
  def is_tracing(msg: XML.Tree): Boolean =
wenzelm@39622
   196
    msg match {
wenzelm@50201
   197
      case XML.Elem(Markup(Markup.TRACING, _), _) => true
wenzelm@50201
   198
      case XML.Elem(Markup(Markup.TRACING_MESSAGE, _), _) => true
wenzelm@39622
   199
      case _ => false
wenzelm@39622
   200
    }
wenzelm@39622
   201
wenzelm@59184
   202
  def is_state(msg: XML.Tree): Boolean =
wenzelm@50500
   203
    msg match {
wenzelm@59184
   204
      case XML.Elem(Markup(Markup.STATE, _), _) => true
wenzelm@59184
   205
      case XML.Elem(Markup(Markup.STATE_MESSAGE, _), _) => true
wenzelm@59184
   206
      case _ => false
wenzelm@59184
   207
    }
wenzelm@59184
   208
wenzelm@59184
   209
  def is_information(msg: XML.Tree): Boolean =
wenzelm@59184
   210
    msg match {
wenzelm@59184
   211
      case XML.Elem(Markup(Markup.INFORMATION, _), _) => true
wenzelm@59184
   212
      case XML.Elem(Markup(Markup.INFORMATION_MESSAGE, _), _) => true
wenzelm@50500
   213
      case _ => false
wenzelm@50500
   214
    }
wenzelm@50500
   215
wenzelm@39511
   216
  def is_warning(msg: XML.Tree): Boolean =
wenzelm@39511
   217
    msg match {
wenzelm@50201
   218
      case XML.Elem(Markup(Markup.WARNING, _), _) => true
wenzelm@50201
   219
      case XML.Elem(Markup(Markup.WARNING_MESSAGE, _), _) => true
wenzelm@39511
   220
      case _ => false
wenzelm@39511
   221
    }
wenzelm@39511
   222
wenzelm@59203
   223
  def is_legacy(msg: XML.Tree): Boolean =
wenzelm@59203
   224
    msg match {
wenzelm@59203
   225
      case XML.Elem(Markup(Markup.LEGACY, _), _) => true
wenzelm@59203
   226
      case XML.Elem(Markup(Markup.LEGACY_MESSAGE, _), _) => true
wenzelm@59203
   227
      case _ => false
wenzelm@59203
   228
    }
wenzelm@59203
   229
wenzelm@39511
   230
  def is_error(msg: XML.Tree): Boolean =
wenzelm@39511
   231
    msg match {
wenzelm@50201
   232
      case XML.Elem(Markup(Markup.ERROR, _), _) => true
wenzelm@50201
   233
      case XML.Elem(Markup(Markup.ERROR_MESSAGE, _), _) => true
wenzelm@39511
   234
      case _ => false
wenzelm@39511
   235
    }
wenzelm@38887
   236
wenzelm@56495
   237
  def is_inlined(msg: XML.Tree): Boolean =
wenzelm@56495
   238
    !(is_result(msg) || is_tracing(msg) || is_state(msg))
wenzelm@56495
   239
wenzelm@50500
   240
wenzelm@60882
   241
  /* breakpoints */
wenzelm@60882
   242
wenzelm@60882
   243
  object ML_Breakpoint
wenzelm@60882
   244
  {
wenzelm@60882
   245
    def unapply(tree: XML.Tree): Option[Long] =
wenzelm@60882
   246
    tree match {
wenzelm@60882
   247
      case XML.Elem(Markup(Markup.ML_BREAKPOINT, Markup.Serial(breakpoint)), _) => Some(breakpoint)
wenzelm@60882
   248
      case _ => None
wenzelm@60882
   249
    }
wenzelm@60882
   250
  }
wenzelm@60882
   251
wenzelm@60882
   252
wenzelm@50500
   253
  /* dialogs */
wenzelm@50500
   254
wenzelm@50500
   255
  object Dialog_Args
wenzelm@50500
   256
  {
wenzelm@52531
   257
    def unapply(props: Properties.T): Option[(Document_ID.Generic, Long, String)] =
wenzelm@50500
   258
      (props, props, props) match {
wenzelm@50500
   259
        case (Position.Id(id), Markup.Serial(serial), Markup.Result(result)) =>
wenzelm@50500
   260
          Some((id, serial, result))
wenzelm@50500
   261
        case _ => None
wenzelm@50500
   262
      }
wenzelm@50500
   263
  }
wenzelm@50500
   264
wenzelm@50500
   265
  object Dialog
wenzelm@50500
   266
  {
wenzelm@52531
   267
    def unapply(tree: XML.Tree): Option[(Document_ID.Generic, Long, String)] =
wenzelm@50500
   268
      tree match {
wenzelm@50500
   269
        case XML.Elem(Markup(Markup.DIALOG, Dialog_Args(id, serial, result)), _) =>
wenzelm@50500
   270
          Some((id, serial, result))
wenzelm@50500
   271
        case _ => None
wenzelm@50500
   272
      }
wenzelm@50500
   273
  }
wenzelm@50500
   274
wenzelm@50500
   275
  object Dialog_Result
wenzelm@50500
   276
  {
wenzelm@52531
   277
    def apply(id: Document_ID.Generic, serial: Long, result: String): XML.Elem =
wenzelm@50501
   278
    {
wenzelm@50501
   279
      val props = Position.Id(id) ::: Markup.Serial(serial)
wenzelm@50501
   280
      XML.Elem(Markup(Markup.RESULT, props), List(XML.Text(result)))
wenzelm@50501
   281
    }
wenzelm@50500
   282
wenzelm@50501
   283
    def unapply(tree: XML.Tree): Option[String] =
wenzelm@50500
   284
      tree match {
wenzelm@50501
   285
        case XML.Elem(Markup(Markup.RESULT, _), List(XML.Text(result))) => Some(result)
wenzelm@50500
   286
        case _ => None
wenzelm@50500
   287
      }
wenzelm@50500
   288
  }
wenzelm@38412
   289
}
wenzelm@38412
   290
wenzelm@38412
   291
wenzelm@57916
   292
trait Protocol
wenzelm@38412
   293
{
wenzelm@57916
   294
  /* text */
wenzelm@57916
   295
wenzelm@57916
   296
  def encode(s: String): String
wenzelm@57916
   297
  def decode(s: String): String
wenzelm@57916
   298
wenzelm@57916
   299
  object Encode
wenzelm@57916
   300
  {
wenzelm@57916
   301
    val string: XML.Encode.T[String] = (s => XML.Encode.string(encode(s)))
wenzelm@57916
   302
  }
wenzelm@57916
   303
wenzelm@57916
   304
wenzelm@57916
   305
  /* protocol commands */
wenzelm@57916
   306
wenzelm@57916
   307
  def protocol_command_bytes(name: String, args: Bytes*): Unit
wenzelm@57916
   308
  def protocol_command(name: String, args: String*): Unit
wenzelm@57916
   309
wenzelm@57916
   310
wenzelm@56387
   311
  /* options */
wenzelm@56387
   312
wenzelm@56387
   313
  def options(opts: Options): Unit =
wenzelm@56387
   314
    protocol_command("Prover.options", YXML.string_of_body(opts.encode))
wenzelm@56387
   315
wenzelm@56387
   316
wenzelm@56387
   317
  /* interned items */
wenzelm@54519
   318
wenzelm@56335
   319
  def define_blob(digest: SHA1.Digest, bytes: Bytes): Unit =
wenzelm@56387
   320
    protocol_command_bytes("Document.define_blob", Bytes(digest.toString), bytes)
wenzelm@38412
   321
wenzelm@59671
   322
  def define_command(command: Command)
wenzelm@54519
   323
  {
wenzelm@54519
   324
    val blobs_yxml =
wenzelm@61376
   325
    {
wenzelm@61376
   326
      import XML.Encode._
wenzelm@54519
   327
      val encode_blob: T[Command.Blob] =
wenzelm@54519
   328
        variant(List(
wenzelm@54526
   329
          { case Exn.Res((a, b)) =>
wenzelm@60879
   330
              (Nil, pair(Encode.string, option(string))((a.node, b.map(p => p._1.toString)))) },
wenzelm@60879
   331
          { case Exn.Exn(e) => (Nil, Encode.string(Exn.message(e))) }))
wenzelm@59085
   332
wenzelm@59685
   333
      YXML.string_of_body(pair(list(encode_blob), int)(command.blobs, command.blobs_index))
wenzelm@54519
   334
    }
wenzelm@59085
   335
wenzelm@59085
   336
    val toks = command.span.content
wenzelm@59085
   337
    val toks_yxml =
wenzelm@61376
   338
    {
wenzelm@61376
   339
      import XML.Encode._
wenzelm@59085
   340
      val encode_tok: T[Token] =
wenzelm@59085
   341
        (tok => pair(int, int)((tok.kind.id, Symbol.iterator(tok.source).length)))
wenzelm@59085
   342
      YXML.string_of_body(list(encode_tok)(toks))
wenzelm@59085
   343
    }
wenzelm@59085
   344
wenzelm@52582
   345
    protocol_command("Document.define_command",
wenzelm@59735
   346
      (Document_ID(command.id) :: encode(command.span.name) :: blobs_yxml :: toks_yxml ::
wenzelm@59085
   347
        toks.map(tok => encode(tok.source))): _*)
wenzelm@54519
   348
  }
wenzelm@38412
   349
wenzelm@38412
   350
wenzelm@52931
   351
  /* execution */
wenzelm@52931
   352
wenzelm@52931
   353
  def discontinue_execution(): Unit =
wenzelm@52931
   354
    protocol_command("Document.discontinue_execution")
wenzelm@38412
   355
wenzelm@52931
   356
  def cancel_exec(id: Document_ID.Exec): Unit =
wenzelm@52931
   357
    protocol_command("Document.cancel_exec", Document_ID(id))
wenzelm@52931
   358
wenzelm@52931
   359
wenzelm@52931
   360
  /* document versions */
wenzelm@47343
   361
wenzelm@52530
   362
  def update(old_id: Document_ID.Version, new_id: Document_ID.Version,
wenzelm@44383
   363
    edits: List[Document.Edit_Command])
wenzelm@38412
   364
  {
wenzelm@44157
   365
    val edits_yxml =
wenzelm@61376
   366
    {
wenzelm@61376
   367
      import XML.Encode._
wenzelm@44383
   368
      def id: T[Command] = (cmd => long(cmd.id))
wenzelm@46737
   369
      def encode_edit(name: Document.Node.Name)
wenzelm@52849
   370
          : T[Document.Node.Edit[Command.Edit, Command.Perspective]] =
wenzelm@44979
   371
        variant(List(
wenzelm@44979
   372
          { case Document.Node.Edits(a) => (Nil, list(pair(option(id), option(id)))(a)) },
wenzelm@48707
   373
          { case Document.Node.Deps(header) =>
wenzelm@60992
   374
              val master_dir = File.standard_url(name.master_dir)
wenzelm@56801
   375
              val theory = Long_Name.base_name(name.theory)
wenzelm@59695
   376
              val imports = header.imports.map({ case (a, _) => a.node })
wenzelm@50128
   377
              val keywords = header.keywords.map({ case (a, b, _) => (a, b) })
wenzelm@44979
   378
              (Nil,
wenzelm@48707
   379
                pair(Encode.string, pair(Encode.string, pair(list(Encode.string),
wenzelm@48864
   380
                  pair(list(pair(Encode.string,
wenzelm@48864
   381
                    option(pair(pair(Encode.string, list(Encode.string)), list(Encode.string))))),
wenzelm@51294
   382
                  list(Encode.string)))))(
wenzelm@56801
   383
                (master_dir, (theory, (imports, (keywords, header.errors)))))) },
wenzelm@52849
   384
          { case Document.Node.Perspective(a, b, c) =>
wenzelm@52849
   385
              (bool_atom(a) :: b.commands.map(cmd => long_atom(cmd.id)),
wenzelm@52862
   386
                list(pair(id, pair(Encode.string, list(Encode.string))))(c.dest)) }))
wenzelm@48705
   387
      def encode_edits: T[List[Document.Edit_Command]] = list((node_edit: Document.Edit_Command) =>
wenzelm@44979
   388
      {
wenzelm@44979
   389
        val (name, edit) = node_edit
wenzelm@60879
   390
        pair(Encode.string, encode_edit(name))(name.node, edit)
wenzelm@44979
   391
      })
wenzelm@48705
   392
      YXML.string_of_body(encode_edits(edits)) }
wenzelm@52582
   393
    protocol_command("Document.update", Document_ID(old_id), Document_ID(new_id), edits_yxml)
wenzelm@38412
   394
  }
wenzelm@43748
   395
wenzelm@44673
   396
  def remove_versions(versions: List[Document.Version])
wenzelm@44673
   397
  {
wenzelm@44673
   398
    val versions_yxml =
wenzelm@59364
   399
    { import XML.Encode._
wenzelm@59364
   400
      YXML.string_of_body(list(long)(versions.map(_.id))) }
wenzelm@52582
   401
    protocol_command("Document.remove_versions", versions_yxml)
wenzelm@44673
   402
  }
wenzelm@44673
   403
wenzelm@43748
   404
wenzelm@50498
   405
  /* dialog via document content */
wenzelm@50498
   406
wenzelm@52931
   407
  def dialog_result(serial: Long, result: String): Unit =
wenzelm@52582
   408
    protocol_command("Document.dialog_result", Properties.Value.Long(serial), result)
wenzelm@56616
   409
wenzelm@56616
   410
wenzelm@59364
   411
  /* build_theories */
wenzelm@56616
   412
wenzelm@59364
   413
  def build_theories(id: String, master_dir: Path, theories: List[(Options, List[Path])])
wenzelm@59364
   414
  {
wenzelm@61381
   415
    val symbol_codes_yxml =
wenzelm@61381
   416
    { import XML.Encode._
wenzelm@61381
   417
      YXML.string_of_body(list(pair(string, int))(Symbol.codes)) }
wenzelm@59364
   418
    val theories_yxml =
wenzelm@59364
   419
    { import XML.Encode._
wenzelm@59364
   420
      YXML.string_of_body(list(pair(Options.encode, list(Path.encode)))(theories)) }
wenzelm@59364
   421
    protocol_command("build_theories", id, master_dir.implode, theories_yxml)
wenzelm@59364
   422
  }
wenzelm@38412
   423
}