src/Pure/PIDE/protocol.scala
author wenzelm
Wed Apr 02 20:22:12 2014 +0200 (2014-04-02)
changeset 56372 fadb0fef09d7
parent 56359 bca016a9a18d
child 56387 d92eb5c3960d
permissions -rw-r--r--
more explicit iterator terminology, in accordance to Scala 2.8 library;
clarified Graph.keys_iterator vs. Graph.keys, with subtle change of semantics;
tuned output;
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@56359
    50
      var failed = false
wenzelm@56359
    51
      var forks = 0
wenzelm@56359
    52
      var runs = 0
wenzelm@56359
    53
      for (markup <- markup_iterator) {
wenzelm@56359
    54
        markup.name match {
wenzelm@56359
    55
          case Markup.ACCEPTED => accepted = true
wenzelm@56359
    56
          case Markup.FORKED => touched = true; forks += 1
wenzelm@56359
    57
          case Markup.JOINED => forks -= 1
wenzelm@56359
    58
          case Markup.RUNNING => touched = true; runs += 1
wenzelm@56359
    59
          case Markup.FINISHED => runs -= 1
wenzelm@56359
    60
          case Markup.FAILED => failed = true
wenzelm@56359
    61
          case _ =>
wenzelm@56359
    62
        }
wenzelm@56359
    63
      }
wenzelm@56359
    64
      Status(touched, accepted, failed, forks, runs)
wenzelm@56359
    65
    }
wenzelm@56359
    66
wenzelm@56359
    67
    val empty = make(Iterator.empty)
wenzelm@56359
    68
wenzelm@56359
    69
    def merge(status_iterator: Iterator[Status]): Status =
wenzelm@56359
    70
      if (status_iterator.hasNext) {
wenzelm@56359
    71
        val status0 = status_iterator.next
wenzelm@56359
    72
        (status0 /: status_iterator)(_ + _)
wenzelm@56359
    73
      }
wenzelm@56359
    74
      else empty
wenzelm@56359
    75
  }
wenzelm@56359
    76
wenzelm@46166
    77
  sealed case class Status(
wenzelm@56352
    78
    private val touched: Boolean,
wenzelm@56352
    79
    private val accepted: Boolean,
wenzelm@56352
    80
    private val failed: Boolean,
wenzelm@56352
    81
    forks: Int,
wenzelm@56352
    82
    runs: Int)
wenzelm@38567
    83
  {
wenzelm@56359
    84
    def + (that: Status): Status =
wenzelm@56359
    85
      Status(touched || that.touched, accepted || that.accepted, failed || that.failed,
wenzelm@56359
    86
        forks + that.forks, runs + that.runs)
wenzelm@56359
    87
wenzelm@49036
    88
    def is_unprocessed: Boolean = accepted && !failed && (!touched || (forks != 0 && runs == 0))
wenzelm@49036
    89
    def is_running: Boolean = runs != 0
wenzelm@49039
    90
    def is_finished: Boolean = !failed && touched && forks == 0 && runs == 0
wenzelm@49036
    91
    def is_failed: Boolean = failed
wenzelm@46166
    92
  }
wenzelm@46166
    93
wenzelm@55820
    94
  val command_status_elements =
wenzelm@55820
    95
    Document.Elements(Markup.ACCEPTED, Markup.FORKED, Markup.JOINED, Markup.RUNNING,
wenzelm@55646
    96
      Markup.FINISHED, Markup.FAILED)
wenzelm@55646
    97
wenzelm@55820
    98
  val status_elements =
wenzelm@55646
    99
    command_status_elements + Markup.WARNING + Markup.ERROR
wenzelm@55646
   100
wenzelm@46209
   101
wenzelm@51818
   102
  /* command timing */
wenzelm@51818
   103
wenzelm@51818
   104
  object Command_Timing
wenzelm@51818
   105
  {
wenzelm@52531
   106
    def unapply(props: Properties.T): Option[(Document_ID.Generic, isabelle.Timing)] =
wenzelm@51818
   107
      props match {
wenzelm@51818
   108
        case (Markup.FUNCTION, Markup.COMMAND_TIMING) :: args =>
wenzelm@51818
   109
          (args, args) match {
wenzelm@51818
   110
            case (Position.Id(id), Markup.Timing_Properties(timing)) => Some((id, timing))
wenzelm@51818
   111
            case _ => None
wenzelm@51818
   112
          }
wenzelm@51818
   113
        case _ => None
wenzelm@51818
   114
      }
wenzelm@51818
   115
  }
wenzelm@51818
   116
wenzelm@51818
   117
wenzelm@46209
   118
  /* node status */
wenzelm@46209
   119
wenzelm@46688
   120
  sealed case class Node_Status(
wenzelm@46688
   121
    unprocessed: Int, running: Int, finished: Int, warned: Int, failed: Int)
wenzelm@44866
   122
  {
wenzelm@46688
   123
    def total: Int = unprocessed + running + finished + warned + failed
wenzelm@44866
   124
  }
wenzelm@44613
   125
wenzelm@44613
   126
  def node_status(
wenzelm@44613
   127
    state: Document.State, version: Document.Version, node: Document.Node): Node_Status =
wenzelm@44613
   128
  {
wenzelm@44613
   129
    var unprocessed = 0
wenzelm@44613
   130
    var running = 0
wenzelm@44613
   131
    var finished = 0
wenzelm@46688
   132
    var warned = 0
wenzelm@44613
   133
    var failed = 0
wenzelm@56356
   134
    for (command <- node.commands.iterator) {
wenzelm@56355
   135
      val states = state.command_states(version, command)
wenzelm@56359
   136
      val status = Status.merge(states.iterator.map(_.protocol_status))
wenzelm@56355
   137
wenzelm@56299
   138
      if (status.is_running) running += 1
wenzelm@56299
   139
      else if (status.is_finished) {
wenzelm@56372
   140
        val warning = states.exists(st => st.results.iterator.exists(p => is_warning(p._2)))
wenzelm@56306
   141
        if (warning) warned += 1 else finished += 1
wenzelm@56299
   142
      }
wenzelm@56299
   143
      else if (status.is_failed) failed += 1
wenzelm@56299
   144
      else unprocessed += 1
wenzelm@56299
   145
    }
wenzelm@46688
   146
    Node_Status(unprocessed, running, finished, warned, failed)
wenzelm@44613
   147
  }
wenzelm@44613
   148
wenzelm@38887
   149
wenzelm@51533
   150
  /* node timing */
wenzelm@51533
   151
wenzelm@51533
   152
  sealed case class Node_Timing(total: Double, commands: Map[Command, Double])
wenzelm@51533
   153
wenzelm@51533
   154
  val empty_node_timing = Node_Timing(0.0, Map.empty)
wenzelm@51533
   155
wenzelm@51533
   156
  def node_timing(
wenzelm@51533
   157
    state: Document.State,
wenzelm@51533
   158
    version: Document.Version,
wenzelm@51533
   159
    node: Document.Node,
wenzelm@51533
   160
    threshold: Double): Node_Timing =
wenzelm@51533
   161
  {
wenzelm@51533
   162
    var total = 0.0
wenzelm@51533
   163
    var commands = Map.empty[Command, Double]
wenzelm@51533
   164
    for {
wenzelm@51533
   165
      command <- node.commands.iterator
wenzelm@56299
   166
      st <- state.command_states(version, command)
wenzelm@56356
   167
    } {
wenzelm@56356
   168
      val command_timing =
wenzelm@51533
   169
        (0.0 /: st.status)({
wenzelm@51533
   170
          case (timing, Markup.Timing(t)) => timing + t.elapsed.seconds
wenzelm@51533
   171
          case (timing, _) => timing
wenzelm@51533
   172
        })
wenzelm@51533
   173
      total += command_timing
wenzelm@51533
   174
      if (command_timing >= threshold) commands += (command -> command_timing)
wenzelm@51533
   175
    }
wenzelm@51533
   176
    Node_Timing(total, commands)
wenzelm@51533
   177
  }
wenzelm@51533
   178
wenzelm@51533
   179
wenzelm@39441
   180
  /* result messages */
wenzelm@39439
   181
wenzelm@55820
   182
  private val clean_elements =
wenzelm@55820
   183
    Document.Elements(Markup.REPORT, Markup.NO_REPORT)
wenzelm@50450
   184
wenzelm@39439
   185
  def clean_message(body: XML.Body): XML.Body =
wenzelm@49445
   186
    body filter {
wenzelm@55646
   187
      case XML.Wrapped_Elem(Markup(name, _), _, _) => !clean_elements(name)
wenzelm@55646
   188
      case XML.Elem(Markup(name, _), _) => !clean_elements(name)
wenzelm@49445
   189
      case _ => true
wenzelm@49650
   190
    } map {
wenzelm@49650
   191
      case XML.Wrapped_Elem(markup, body, ts) => XML.Wrapped_Elem(markup, body, clean_message(ts))
wenzelm@49650
   192
      case XML.Elem(markup, ts) => XML.Elem(markup, clean_message(ts))
wenzelm@49650
   193
      case t => t
wenzelm@49650
   194
    }
wenzelm@39439
   195
wenzelm@49445
   196
  def message_reports(props: Properties.T, body: XML.Body): List[XML.Elem] =
wenzelm@49445
   197
    body flatMap {
wenzelm@50450
   198
      case XML.Wrapped_Elem(Markup(Markup.REPORT, ps), body, ts) =>
wenzelm@50450
   199
        List(XML.Wrapped_Elem(Markup(Markup.REPORT, props ::: ps), body, ts))
wenzelm@50201
   200
      case XML.Elem(Markup(Markup.REPORT, ps), ts) =>
wenzelm@50201
   201
        List(XML.Elem(Markup(Markup.REPORT, props ::: ps), ts))
wenzelm@49650
   202
      case XML.Wrapped_Elem(_, _, ts) => message_reports(props, ts)
wenzelm@49445
   203
      case XML.Elem(_, ts) => message_reports(props, ts)
wenzelm@39441
   204
      case XML.Text(_) => Nil
wenzelm@39441
   205
    }
wenzelm@39441
   206
wenzelm@39439
   207
wenzelm@39511
   208
  /* specific messages */
wenzelm@39511
   209
wenzelm@50500
   210
  def is_inlined(msg: XML.Tree): Boolean =
wenzelm@50500
   211
    !(is_result(msg) || is_tracing(msg) || is_state(msg))
wenzelm@50500
   212
wenzelm@50500
   213
  def is_result(msg: XML.Tree): Boolean =
wenzelm@50500
   214
    msg match {
wenzelm@50500
   215
      case XML.Elem(Markup(Markup.RESULT, _), _) => true
wenzelm@50500
   216
      case _ => false
wenzelm@50500
   217
    }
wenzelm@50500
   218
wenzelm@50157
   219
  def is_tracing(msg: XML.Tree): Boolean =
wenzelm@39622
   220
    msg match {
wenzelm@50201
   221
      case XML.Elem(Markup(Markup.TRACING, _), _) => true
wenzelm@50201
   222
      case XML.Elem(Markup(Markup.TRACING_MESSAGE, _), _) => true
wenzelm@39622
   223
      case _ => false
wenzelm@39622
   224
    }
wenzelm@39622
   225
wenzelm@52650
   226
  def is_writeln_markup(msg: XML.Tree, name: String): Boolean =
wenzelm@50500
   227
    msg match {
wenzelm@50500
   228
      case XML.Elem(Markup(Markup.WRITELN, _),
wenzelm@52650
   229
        List(XML.Elem(markup, _))) => markup.name == name
wenzelm@50500
   230
      case XML.Elem(Markup(Markup.WRITELN_MESSAGE, _),
wenzelm@52650
   231
        List(XML.Elem(markup, _))) => markup.name == name
wenzelm@50500
   232
      case _ => false
wenzelm@50500
   233
    }
wenzelm@50500
   234
wenzelm@52650
   235
  def is_state(msg: XML.Tree): Boolean = is_writeln_markup(msg, Markup.STATE)
wenzelm@52650
   236
  def is_information(msg: XML.Tree): Boolean = is_writeln_markup(msg, Markup.INFORMATION)
wenzelm@52650
   237
wenzelm@39511
   238
  def is_warning(msg: XML.Tree): Boolean =
wenzelm@39511
   239
    msg match {
wenzelm@50201
   240
      case XML.Elem(Markup(Markup.WARNING, _), _) => true
wenzelm@50201
   241
      case XML.Elem(Markup(Markup.WARNING_MESSAGE, _), _) => true
wenzelm@39511
   242
      case _ => false
wenzelm@39511
   243
    }
wenzelm@39511
   244
wenzelm@39511
   245
  def is_error(msg: XML.Tree): Boolean =
wenzelm@39511
   246
    msg match {
wenzelm@50201
   247
      case XML.Elem(Markup(Markup.ERROR, _), _) => true
wenzelm@50201
   248
      case XML.Elem(Markup(Markup.ERROR_MESSAGE, _), _) => true
wenzelm@39511
   249
      case _ => false
wenzelm@39511
   250
    }
wenzelm@38887
   251
wenzelm@50500
   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@39170
   289
wenzelm@39511
   290
wenzelm@39511
   291
  /* reported positions */
wenzelm@39511
   292
wenzelm@55646
   293
  private val position_elements =
wenzelm@55820
   294
    Document.Elements(Markup.BINDING, Markup.ENTITY, Markup.REPORT, Markup.POSITION)
wenzelm@39441
   295
wenzelm@55433
   296
  def message_positions(
wenzelm@56295
   297
    valid_id: Document_ID.Generic => Boolean,
wenzelm@55433
   298
    chunk: Command.Chunk,
wenzelm@55433
   299
    message: XML.Elem): Set[Text.Range] =
wenzelm@38887
   300
  {
wenzelm@55433
   301
    def elem_positions(props: Properties.T, set: Set[Text.Range]): Set[Text.Range] =
wenzelm@55433
   302
      props match {
wenzelm@55884
   303
        case Position.Reported(id, file_name, symbol_range)
wenzelm@56295
   304
        if valid_id(id) && file_name == chunk.file_name =>
wenzelm@55884
   305
          chunk.incorporate(symbol_range) match {
wenzelm@55822
   306
            case Some(range) => set + range
wenzelm@55548
   307
            case _ => set
wenzelm@55548
   308
          }
wenzelm@55433
   309
        case _ => set
wenzelm@55433
   310
      }
wenzelm@50157
   311
wenzelm@39441
   312
    def positions(set: Set[Text.Range], tree: XML.Tree): Set[Text.Range] =
wenzelm@38887
   313
      tree match {
wenzelm@55433
   314
        case XML.Wrapped_Elem(Markup(name, props), _, body) =>
wenzelm@55646
   315
          body.foldLeft(if (position_elements(name)) elem_positions(props, set) else set)(positions)
wenzelm@55433
   316
        case XML.Elem(Markup(name, props), body) =>
wenzelm@55646
   317
          body.foldLeft(if (position_elements(name)) elem_positions(props, set) else set)(positions)
wenzelm@55433
   318
        case XML.Text(_) => set
wenzelm@38887
   319
      }
wenzelm@50157
   320
wenzelm@39441
   321
    val set = positions(Set.empty, message)
wenzelm@55433
   322
    if (set.isEmpty) elem_positions(message.markup.properties, set)
wenzelm@39042
   323
    else set
wenzelm@38887
   324
  }
wenzelm@38412
   325
}
wenzelm@38412
   326
wenzelm@38412
   327
wenzelm@45709
   328
trait Protocol extends Isabelle_Process
wenzelm@38412
   329
{
wenzelm@54519
   330
  /* inlined files */
wenzelm@54519
   331
wenzelm@56335
   332
  def define_blob(digest: SHA1.Digest, bytes: Bytes): Unit =
wenzelm@56335
   333
    protocol_command_raw("Document.define_blob", Bytes(digest.toString), bytes)
wenzelm@54519
   334
wenzelm@54519
   335
wenzelm@38412
   336
  /* commands */
wenzelm@38412
   337
wenzelm@44644
   338
  def define_command(command: Command): Unit =
wenzelm@54519
   339
  {
wenzelm@54519
   340
    val blobs_yxml =
wenzelm@54519
   341
    { import XML.Encode._
wenzelm@54519
   342
      val encode_blob: T[Command.Blob] =
wenzelm@54519
   343
        variant(List(
wenzelm@54526
   344
          { case Exn.Res((a, b)) =>
wenzelm@55431
   345
              (Nil, pair(string, option(string))((a.node, b.map(p => p._1.toString)))) },
wenzelm@54526
   346
          { case Exn.Exn(e) => (Nil, string(Exn.message(e))) }))
wenzelm@54519
   347
      YXML.string_of_body(list(encode_blob)(command.blobs))
wenzelm@54519
   348
    }
wenzelm@52582
   349
    protocol_command("Document.define_command",
wenzelm@54519
   350
      Document_ID(command.id), encode(command.name), blobs_yxml, encode(command.source))
wenzelm@54519
   351
  }
wenzelm@38412
   352
wenzelm@38412
   353
wenzelm@52931
   354
  /* execution */
wenzelm@52931
   355
wenzelm@52931
   356
  def discontinue_execution(): Unit =
wenzelm@52931
   357
    protocol_command("Document.discontinue_execution")
wenzelm@38412
   358
wenzelm@52931
   359
  def cancel_exec(id: Document_ID.Exec): Unit =
wenzelm@52931
   360
    protocol_command("Document.cancel_exec", Document_ID(id))
wenzelm@52931
   361
wenzelm@52931
   362
wenzelm@52931
   363
  /* document versions */
wenzelm@47343
   364
wenzelm@52530
   365
  def update(old_id: Document_ID.Version, new_id: Document_ID.Version,
wenzelm@44383
   366
    edits: List[Document.Edit_Command])
wenzelm@38412
   367
  {
wenzelm@44157
   368
    val edits_yxml =
wenzelm@43767
   369
    { import XML.Encode._
wenzelm@44383
   370
      def id: T[Command] = (cmd => long(cmd.id))
wenzelm@46737
   371
      def encode_edit(name: Document.Node.Name)
wenzelm@52849
   372
          : T[Document.Node.Edit[Command.Edit, Command.Perspective]] =
wenzelm@44979
   373
        variant(List(
wenzelm@44979
   374
          { case Document.Node.Edits(a) => (Nil, list(pair(option(id), option(id)))(a)) },
wenzelm@48707
   375
          { case Document.Node.Deps(header) =>
wenzelm@54515
   376
              val master_dir = Isabelle_System.posix_path(name.master_dir)
wenzelm@48707
   377
              val imports = header.imports.map(_.node)
wenzelm@50128
   378
              val keywords = header.keywords.map({ case (a, b, _) => (a, b) })
wenzelm@44979
   379
              (Nil,
wenzelm@48707
   380
                pair(Encode.string, pair(Encode.string, pair(list(Encode.string),
wenzelm@48864
   381
                  pair(list(pair(Encode.string,
wenzelm@48864
   382
                    option(pair(pair(Encode.string, list(Encode.string)), list(Encode.string))))),
wenzelm@51294
   383
                  list(Encode.string)))))(
wenzelm@54515
   384
                (master_dir, (name.theory, (imports, (keywords, header.errors)))))) },
wenzelm@52849
   385
          { case Document.Node.Perspective(a, b, c) =>
wenzelm@52849
   386
              (bool_atom(a) :: b.commands.map(cmd => long_atom(cmd.id)),
wenzelm@52862
   387
                list(pair(id, pair(Encode.string, list(Encode.string))))(c.dest)) }))
wenzelm@48705
   388
      def encode_edits: T[List[Document.Edit_Command]] = list((node_edit: Document.Edit_Command) =>
wenzelm@44979
   389
      {
wenzelm@44979
   390
        val (name, edit) = node_edit
wenzelm@46737
   391
        pair(string, encode_edit(name))(name.node, edit)
wenzelm@44979
   392
      })
wenzelm@48705
   393
      YXML.string_of_body(encode_edits(edits)) }
wenzelm@52582
   394
    protocol_command("Document.update", Document_ID(old_id), Document_ID(new_id), edits_yxml)
wenzelm@38412
   395
  }
wenzelm@43748
   396
wenzelm@44673
   397
  def remove_versions(versions: List[Document.Version])
wenzelm@44673
   398
  {
wenzelm@44673
   399
    val versions_yxml =
wenzelm@44673
   400
      { import XML.Encode._
wenzelm@44673
   401
        YXML.string_of_body(list(long)(versions.map(_.id))) }
wenzelm@52582
   402
    protocol_command("Document.remove_versions", versions_yxml)
wenzelm@44673
   403
  }
wenzelm@44673
   404
wenzelm@43748
   405
wenzelm@50498
   406
  /* dialog via document content */
wenzelm@50498
   407
wenzelm@52931
   408
  def dialog_result(serial: Long, result: String): Unit =
wenzelm@52582
   409
    protocol_command("Document.dialog_result", Properties.Value.Long(serial), result)
wenzelm@38412
   410
}