src/Pure/Thy/export.scala
author wenzelm
Fri, 11 Jan 2019 22:35:04 +0100
changeset 69635 95dc926fa39c
parent 69634 70f1994988d4
child 69671 2486792eaf61
permissions -rw-r--r--
clarified output (again);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
     1
/*  Title:      Pure/Thy/export.scala
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
     3
68102
813b5d0904c6 clarified signature;
wenzelm
parents: 68101
diff changeset
     4
Manage theory exports: compressed blobs.
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
     5
*/
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
     6
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
     7
package isabelle
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
     8
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
     9
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    10
import scala.annotation.tailrec
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    11
import scala.util.matching.Regex
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    12
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    13
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    14
object Export
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    15
{
69634
70f1994988d4 more operations;
wenzelm
parents: 69630
diff changeset
    16
  /* structured name */
70f1994988d4 more operations;
wenzelm
parents: 69630
diff changeset
    17
70f1994988d4 more operations;
wenzelm
parents: 69630
diff changeset
    18
  val sep_char: Char = '/'
70f1994988d4 more operations;
wenzelm
parents: 69630
diff changeset
    19
  val sep: String = sep_char.toString
70f1994988d4 more operations;
wenzelm
parents: 69630
diff changeset
    20
70f1994988d4 more operations;
wenzelm
parents: 69630
diff changeset
    21
  def explode_name(s: String): List[String] = space_explode(sep_char, s)
70f1994988d4 more operations;
wenzelm
parents: 69630
diff changeset
    22
  def implode_name(elems: Iterable[String]): String = elems.mkString(sep)
70f1994988d4 more operations;
wenzelm
parents: 69630
diff changeset
    23
70f1994988d4 more operations;
wenzelm
parents: 69630
diff changeset
    24
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    25
  /* SQL data model */
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    26
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    27
  object Data
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    28
  {
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    29
    val session_name = SQL.Column.string("session_name").make_primary_key
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    30
    val theory_name = SQL.Column.string("theory_name").make_primary_key
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    31
    val name = SQL.Column.string("name").make_primary_key
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    32
    val compressed = SQL.Column.bool("compressed")
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    33
    val body = SQL.Column.bytes("body")
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    34
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    35
    val table =
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    36
      SQL.Table("isabelle_exports", List(session_name, theory_name, name, compressed, body))
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    37
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    38
    def where_equal(session_name: String, theory_name: String = "", name: String = ""): SQL.Source =
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    39
      "WHERE " + Data.session_name.equal(session_name) +
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    40
        (if (theory_name == "") "" else " AND " + Data.theory_name.equal(theory_name)) +
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    41
        (if (name == "") "" else " AND " + Data.name.equal(name))
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    42
  }
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    43
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    44
  def read_name(db: SQL.Database, session_name: String, theory_name: String, name: String): Boolean =
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    45
  {
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    46
    val select =
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    47
      Data.table.select(List(Data.name), Data.where_equal(session_name, theory_name, name))
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    48
    db.using_statement(select)(stmt => stmt.execute_query().next())
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    49
  }
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    50
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    51
  def read_names(db: SQL.Database, session_name: String, theory_name: String): List[String] =
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    52
  {
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    53
    val select = Data.table.select(List(Data.name), Data.where_equal(session_name, theory_name))
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    54
    db.using_statement(select)(stmt =>
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    55
      stmt.execute_query().iterator(res => res.string(Data.name)).toList)
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    56
  }
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    57
68222
3c1a716e7f59 tuned queries;
wenzelm
parents: 68221
diff changeset
    58
  def read_theory_names(db: SQL.Database, session_name: String): List[String] =
3c1a716e7f59 tuned queries;
wenzelm
parents: 68221
diff changeset
    59
  {
3c1a716e7f59 tuned queries;
wenzelm
parents: 68221
diff changeset
    60
    val select =
3c1a716e7f59 tuned queries;
wenzelm
parents: 68221
diff changeset
    61
      Data.table.select(List(Data.theory_name), Data.where_equal(session_name), distinct = true)
3c1a716e7f59 tuned queries;
wenzelm
parents: 68221
diff changeset
    62
    db.using_statement(select)(stmt =>
3c1a716e7f59 tuned queries;
wenzelm
parents: 68221
diff changeset
    63
      stmt.execute_query().iterator(_.string(Data.theory_name)).toList)
3c1a716e7f59 tuned queries;
wenzelm
parents: 68221
diff changeset
    64
  }
3c1a716e7f59 tuned queries;
wenzelm
parents: 68221
diff changeset
    65
3c1a716e7f59 tuned queries;
wenzelm
parents: 68221
diff changeset
    66
  def read_theory_exports(db: SQL.Database, session_name: String): List[(String, String)] =
68115
23c6ae3dd3a0 more efficient query;
wenzelm
parents: 68104
diff changeset
    67
  {
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    68
    val select = Data.table.select(List(Data.theory_name, Data.name), Data.where_equal(session_name))
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    69
    db.using_statement(select)(stmt =>
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    70
      stmt.execute_query().iterator(res =>
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    71
        (res.string(Data.theory_name), res.string(Data.name))).toList)
68115
23c6ae3dd3a0 more efficient query;
wenzelm
parents: 68104
diff changeset
    72
  }
23c6ae3dd3a0 more efficient query;
wenzelm
parents: 68104
diff changeset
    73
68104
wenzelm
parents: 68103
diff changeset
    74
  def message(msg: String, theory_name: String, name: String): String =
wenzelm
parents: 68103
diff changeset
    75
    msg + " " + quote(name) + " for theory " + quote(theory_name)
wenzelm
parents: 68103
diff changeset
    76
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    77
  def compound_name(a: String, b: String): String = a + ":" + b
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
    78
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    79
  sealed case class Entry(
68103
c5764b8b2a87 more robust (synchronous) management of Export.Entry: Future.fork happens inside the data structure;
wenzelm
parents: 68102
diff changeset
    80
    session_name: String,
c5764b8b2a87 more robust (synchronous) management of Export.Entry: Future.fork happens inside the data structure;
wenzelm
parents: 68102
diff changeset
    81
    theory_name: String,
c5764b8b2a87 more robust (synchronous) management of Export.Entry: Future.fork happens inside the data structure;
wenzelm
parents: 68102
diff changeset
    82
    name: String,
68167
327bb0f5f768 clarified implicit compression;
wenzelm
parents: 68166
diff changeset
    83
    body: Future[(Boolean, Bytes)])
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    84
  {
69635
95dc926fa39c clarified output (again);
wenzelm
parents: 69634
diff changeset
    85
    override def toString: String = name
69630
aaa0b5f571e8 clarified output;
wenzelm
parents: 69629
diff changeset
    86
69634
70f1994988d4 more operations;
wenzelm
parents: 69630
diff changeset
    87
    val name_elems: List[String] = explode_name(name)
70f1994988d4 more operations;
wenzelm
parents: 69630
diff changeset
    88
70f1994988d4 more operations;
wenzelm
parents: 69630
diff changeset
    89
    def name_extends(elems: List[String]): Boolean =
70f1994988d4 more operations;
wenzelm
parents: 69630
diff changeset
    90
      name_elems.startsWith(elems) && name_elems != elems
70f1994988d4 more operations;
wenzelm
parents: 69630
diff changeset
    91
69630
aaa0b5f571e8 clarified output;
wenzelm
parents: 69629
diff changeset
    92
    def text: String = uncompressed().text
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
    93
69629
wenzelm
parents: 68924
diff changeset
    94
    def uncompressed(cache: XZ.Cache = XZ.cache()): Bytes =
wenzelm
parents: 68924
diff changeset
    95
    {
wenzelm
parents: 68924
diff changeset
    96
      val (compressed, bytes) = body.join
wenzelm
parents: 68924
diff changeset
    97
      if (compressed) bytes.uncompress(cache = cache) else bytes
wenzelm
parents: 68924
diff changeset
    98
    }
wenzelm
parents: 68924
diff changeset
    99
wenzelm
parents: 68924
diff changeset
   100
    def uncompressed_yxml(cache: XZ.Cache = XZ.cache()): XML.Body =
wenzelm
parents: 68924
diff changeset
   101
      YXML.parse_body(UTF8.decode_permissive(uncompressed(cache = cache)))
wenzelm
parents: 68924
diff changeset
   102
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   103
    def write(db: SQL.Database)
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   104
    {
68167
327bb0f5f768 clarified implicit compression;
wenzelm
parents: 68166
diff changeset
   105
      val (compressed, bytes) = body.join
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   106
      db.using_statement(Data.table.insert())(stmt =>
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   107
      {
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   108
        stmt.string(1) = session_name
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   109
        stmt.string(2) = theory_name
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   110
        stmt.string(3) = name
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   111
        stmt.bool(4) = compressed
68103
c5764b8b2a87 more robust (synchronous) management of Export.Entry: Future.fork happens inside the data structure;
wenzelm
parents: 68102
diff changeset
   112
        stmt.bytes(5) = bytes
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   113
        stmt.execute()
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   114
      })
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   115
    }
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   116
  }
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   117
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   118
  def make_regex(pattern: String): Regex =
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   119
  {
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   120
    @tailrec def make(result: List[String], depth: Int, chs: List[Char]): Regex =
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   121
      chs match {
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   122
        case '*' :: '*' :: rest => make("[^:]*" :: result, depth, rest)
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   123
        case '*' :: rest => make("[^:/]*" :: result, depth, rest)
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   124
        case '?' :: rest => make("[^:/]" :: result, depth, rest)
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   125
        case '\\' :: c :: rest => make(("\\" + c) :: result, depth, rest)
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   126
        case '{' :: rest => make("(" :: result, depth + 1, rest)
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   127
        case ',' :: rest if depth > 0 => make("|" :: result, depth, rest)
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   128
        case '}' :: rest if depth > 0 => make(")" :: result, depth - 1, rest)
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   129
        case c :: rest if ".+()".contains(c) => make(("\\" + c) :: result, depth, rest)
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   130
        case c :: rest => make(c.toString :: result, depth, rest)
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   131
        case Nil => result.reverse.mkString.r
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   132
      }
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   133
    make(Nil, 0, pattern.toList)
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   134
  }
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   135
68151
wenzelm
parents: 68116
diff changeset
   136
  def make_matcher(pattern: String): (String, String) => Boolean =
wenzelm
parents: 68116
diff changeset
   137
  {
wenzelm
parents: 68116
diff changeset
   138
    val regex = make_regex(pattern)
wenzelm
parents: 68116
diff changeset
   139
    (theory_name: String, name: String) =>
wenzelm
parents: 68116
diff changeset
   140
      regex.pattern.matcher(compound_name(theory_name, name)).matches
wenzelm
parents: 68116
diff changeset
   141
  }
wenzelm
parents: 68116
diff changeset
   142
68166
021c6fecaf5c tuned -- use XZ.Cache;
wenzelm
parents: 68151
diff changeset
   143
  def make_entry(session_name: String, args: Markup.Export.Args, body: Bytes,
021c6fecaf5c tuned -- use XZ.Cache;
wenzelm
parents: 68151
diff changeset
   144
    cache: XZ.Cache = XZ.cache()): Entry =
68101
0699a0bacc50 store exports within PIDE command state;
wenzelm
parents: 68092
diff changeset
   145
  {
68167
327bb0f5f768 clarified implicit compression;
wenzelm
parents: 68166
diff changeset
   146
    Entry(session_name, args.theory_name, args.name,
327bb0f5f768 clarified implicit compression;
wenzelm
parents: 68166
diff changeset
   147
      if (args.compress) Future.fork(body.maybe_compress(cache = cache))
327bb0f5f768 clarified implicit compression;
wenzelm
parents: 68166
diff changeset
   148
      else Future.value((false, body)))
68101
0699a0bacc50 store exports within PIDE command state;
wenzelm
parents: 68092
diff changeset
   149
  }
0699a0bacc50 store exports within PIDE command state;
wenzelm
parents: 68092
diff changeset
   150
68202
a99180ad3441 clarified signature;
wenzelm
parents: 68171
diff changeset
   151
  def read_entry(db: SQL.Database, session_name: String, theory_name: String, name: String)
a99180ad3441 clarified signature;
wenzelm
parents: 68171
diff changeset
   152
    : Option[Entry] =
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   153
  {
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   154
    val select =
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   155
      Data.table.select(List(Data.compressed, Data.body),
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   156
        Data.where_equal(session_name, theory_name, name))
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   157
    db.using_statement(select)(stmt =>
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   158
    {
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   159
      val res = stmt.execute_query()
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   160
      if (res.next()) {
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   161
        val compressed = res.bool(Data.compressed)
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   162
        val body = res.bytes(Data.body)
68202
a99180ad3441 clarified signature;
wenzelm
parents: 68171
diff changeset
   163
        Some(Entry(session_name, theory_name, name, Future.value(compressed, body)))
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   164
      }
68202
a99180ad3441 clarified signature;
wenzelm
parents: 68171
diff changeset
   165
      else None
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   166
    })
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   167
  }
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   168
68831
a6c69599ab99 Export.Provider for "isabelle dump" output_dir;
wenzelm
parents: 68418
diff changeset
   169
  def read_entry(dir: Path, session_name: String, theory_name: String, name: String): Option[Entry] =
a6c69599ab99 Export.Provider for "isabelle dump" output_dir;
wenzelm
parents: 68418
diff changeset
   170
  {
a6c69599ab99 Export.Provider for "isabelle dump" output_dir;
wenzelm
parents: 68418
diff changeset
   171
    val path = dir + Path.basic(theory_name) + Path.explode(name)
a6c69599ab99 Export.Provider for "isabelle dump" output_dir;
wenzelm
parents: 68418
diff changeset
   172
    if (path.is_file) {
a6c69599ab99 Export.Provider for "isabelle dump" output_dir;
wenzelm
parents: 68418
diff changeset
   173
      val uncompressed = Bytes.read(path)
a6c69599ab99 Export.Provider for "isabelle dump" output_dir;
wenzelm
parents: 68418
diff changeset
   174
      Some(Entry(session_name, theory_name, name, Future.value((false, uncompressed))))
a6c69599ab99 Export.Provider for "isabelle dump" output_dir;
wenzelm
parents: 68418
diff changeset
   175
    }
a6c69599ab99 Export.Provider for "isabelle dump" output_dir;
wenzelm
parents: 68418
diff changeset
   176
    else None
a6c69599ab99 Export.Provider for "isabelle dump" output_dir;
wenzelm
parents: 68418
diff changeset
   177
  }
a6c69599ab99 Export.Provider for "isabelle dump" output_dir;
wenzelm
parents: 68418
diff changeset
   178
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   179
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   180
  /* database consumer thread */
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   181
68289
c29fc61fb1b1 clarified cache;
wenzelm
parents: 68288
diff changeset
   182
  def consumer(db: SQL.Database, cache: XZ.Cache = XZ.cache()): Consumer = new Consumer(db, cache)
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   183
68289
c29fc61fb1b1 clarified cache;
wenzelm
parents: 68288
diff changeset
   184
  class Consumer private[Export](db: SQL.Database, cache: XZ.Cache)
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   185
  {
68924
wenzelm
parents: 68832
diff changeset
   186
    private val errors = Synchronized[List[String]](Nil)
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   187
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   188
    private val consumer =
68103
c5764b8b2a87 more robust (synchronous) management of Export.Entry: Future.fork happens inside the data structure;
wenzelm
parents: 68102
diff changeset
   189
      Consumer_Thread.fork(name = "export")(consume = (entry: Entry) =>
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   190
        {
68103
c5764b8b2a87 more robust (synchronous) management of Export.Entry: Future.fork happens inside the data structure;
wenzelm
parents: 68102
diff changeset
   191
          entry.body.join
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   192
          db.transaction {
68115
23c6ae3dd3a0 more efficient query;
wenzelm
parents: 68104
diff changeset
   193
            if (read_name(db, entry.session_name, entry.theory_name, entry.name)) {
68924
wenzelm
parents: 68832
diff changeset
   194
              val msg = message("Duplicate export", entry.theory_name, entry.name)
wenzelm
parents: 68832
diff changeset
   195
              errors.change(msg :: _)
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   196
            }
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   197
            else entry.write(db)
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   198
          }
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   199
          true
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   200
        })
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   201
68103
c5764b8b2a87 more robust (synchronous) management of Export.Entry: Future.fork happens inside the data structure;
wenzelm
parents: 68102
diff changeset
   202
    def apply(session_name: String, args: Markup.Export.Args, body: Bytes): Unit =
68289
c29fc61fb1b1 clarified cache;
wenzelm
parents: 68288
diff changeset
   203
      consumer.send(make_entry(session_name, args, body, cache = cache))
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   204
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   205
    def shutdown(close: Boolean = false): List[String] =
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   206
    {
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   207
      consumer.shutdown()
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   208
      if (close) db.close()
68924
wenzelm
parents: 68832
diff changeset
   209
      errors.value.reverse
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   210
    }
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   211
  }
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   212
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   213
68418
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   214
  /* abstract provider */
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   215
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   216
  object Provider
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   217
  {
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   218
    def database(db: SQL.Database, session_name: String, theory_name: String): Provider =
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   219
      new Provider {
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   220
        def apply(export_name: String): Option[Entry] =
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   221
          read_entry(db, session_name, theory_name, export_name)
68832
9b9fc9ea9dd1 tuned output;
wenzelm
parents: 68831
diff changeset
   222
9b9fc9ea9dd1 tuned output;
wenzelm
parents: 68831
diff changeset
   223
        override def toString: String = db.toString
68418
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   224
      }
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   225
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   226
    def snapshot(snapshot: Document.Snapshot): Provider =
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   227
      new Provider {
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   228
        def apply(export_name: String): Option[Entry] =
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   229
          snapshot.exports_map.get(export_name)
68832
9b9fc9ea9dd1 tuned output;
wenzelm
parents: 68831
diff changeset
   230
9b9fc9ea9dd1 tuned output;
wenzelm
parents: 68831
diff changeset
   231
        override def toString: String = snapshot.toString
68418
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   232
      }
68831
a6c69599ab99 Export.Provider for "isabelle dump" output_dir;
wenzelm
parents: 68418
diff changeset
   233
a6c69599ab99 Export.Provider for "isabelle dump" output_dir;
wenzelm
parents: 68418
diff changeset
   234
    def directory(dir: Path, session_name: String, theory_name: String): Provider =
a6c69599ab99 Export.Provider for "isabelle dump" output_dir;
wenzelm
parents: 68418
diff changeset
   235
      new Provider {
a6c69599ab99 Export.Provider for "isabelle dump" output_dir;
wenzelm
parents: 68418
diff changeset
   236
        def apply(export_name: String): Option[Entry] =
a6c69599ab99 Export.Provider for "isabelle dump" output_dir;
wenzelm
parents: 68418
diff changeset
   237
          read_entry(dir, session_name, theory_name, export_name)
68832
9b9fc9ea9dd1 tuned output;
wenzelm
parents: 68831
diff changeset
   238
9b9fc9ea9dd1 tuned output;
wenzelm
parents: 68831
diff changeset
   239
        override def toString: String = dir.toString
68831
a6c69599ab99 Export.Provider for "isabelle dump" output_dir;
wenzelm
parents: 68418
diff changeset
   240
      }
68418
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   241
  }
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   242
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   243
  trait Provider
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   244
  {
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   245
    def apply(export_name: String): Option[Entry]
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   246
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   247
    def uncompressed_yxml(export_name: String, cache: XZ.Cache = XZ.cache()): XML.Body =
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   248
      apply(export_name) match {
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   249
        case Some(entry) => entry.uncompressed_yxml(cache = cache)
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   250
        case None => Nil
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   251
      }
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   252
  }
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   253
366e43cddd20 more abstract Export.Provider;
wenzelm
parents: 68331
diff changeset
   254
68288
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   255
  /* export to file-system */
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   256
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   257
  def export_files(
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   258
    store: Sessions.Store,
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   259
    session_name: String,
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   260
    export_dir: Path,
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   261
    progress: Progress = No_Progress,
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   262
    export_list: Boolean = false,
68291
1e1877cb9b3a clarified output;
wenzelm
parents: 68290
diff changeset
   263
    export_patterns: List[String] = Nil,
1e1877cb9b3a clarified output;
wenzelm
parents: 68290
diff changeset
   264
    export_prefix: String = "")
68288
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   265
  {
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   266
    using(store.open_database(session_name))(db =>
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   267
    {
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   268
      db.transaction {
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   269
        val export_names = read_theory_exports(db, session_name)
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   270
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   271
        // list
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   272
        if (export_list) {
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   273
          (for ((theory_name, name) <- export_names) yield compound_name(theory_name, name)).
68291
1e1877cb9b3a clarified output;
wenzelm
parents: 68290
diff changeset
   274
            sorted.foreach(progress.echo(_))
68288
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   275
        }
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   276
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   277
        // export
68290
f1f5ccc85b25 support multiple patterns;
wenzelm
parents: 68289
diff changeset
   278
        if (export_patterns.nonEmpty) {
f1f5ccc85b25 support multiple patterns;
wenzelm
parents: 68289
diff changeset
   279
          val exports =
f1f5ccc85b25 support multiple patterns;
wenzelm
parents: 68289
diff changeset
   280
            (for {
f1f5ccc85b25 support multiple patterns;
wenzelm
parents: 68289
diff changeset
   281
              export_pattern <- export_patterns.iterator
f1f5ccc85b25 support multiple patterns;
wenzelm
parents: 68289
diff changeset
   282
              matcher = make_matcher(export_pattern)
f1f5ccc85b25 support multiple patterns;
wenzelm
parents: 68289
diff changeset
   283
              (theory_name, name) <- export_names if matcher(theory_name, name)
f1f5ccc85b25 support multiple patterns;
wenzelm
parents: 68289
diff changeset
   284
            } yield (theory_name, name)).toSet
68288
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   285
          for {
68290
f1f5ccc85b25 support multiple patterns;
wenzelm
parents: 68289
diff changeset
   286
            (theory_name, group) <- exports.toList.groupBy(_._1).toList.sortBy(_._1)
f1f5ccc85b25 support multiple patterns;
wenzelm
parents: 68289
diff changeset
   287
            name <- group.map(_._2).sorted
68288
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   288
            entry <- read_entry(db, session_name, theory_name, name)
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   289
          } {
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   290
            val path = export_dir + Path.basic(theory_name) + Path.explode(name)
68291
1e1877cb9b3a clarified output;
wenzelm
parents: 68290
diff changeset
   291
            progress.echo(export_prefix + "export " + path)
68288
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   292
            Isabelle_System.mkdirs(path.dir)
68289
c29fc61fb1b1 clarified cache;
wenzelm
parents: 68288
diff changeset
   293
            Bytes.write(path, entry.uncompressed(cache = store.xz_cache))
68288
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   294
          }
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   295
        }
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   296
      }
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   297
    })
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   298
  }
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   299
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   300
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   301
  /* Isabelle tool wrapper */
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   302
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   303
  val default_export_dir = Path.explode("export")
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   304
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   305
  val isabelle_tool = Isabelle_Tool("export", "retrieve theory exports", args =>
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   306
  {
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   307
    /* arguments */
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   308
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   309
    var export_dir = default_export_dir
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   310
    var dirs: List[Path] = Nil
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   311
    var export_list = false
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   312
    var no_build = false
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   313
    var options = Options.init()
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   314
    var system_mode = false
68290
f1f5ccc85b25 support multiple patterns;
wenzelm
parents: 68289
diff changeset
   315
    var export_patterns: List[String] = Nil
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   316
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   317
    val getopts = Getopts("""
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   318
Usage: isabelle export [OPTIONS] SESSION
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   319
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   320
  Options are:
68314
2acbf8129d8b clarified option -O: avoid conflict with build/dump option -D;
wenzelm
parents: 68305
diff changeset
   321
    -O DIR       output directory for exported files (default: """ + default_export_dir + """)
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   322
    -d DIR       include session directory
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   323
    -l           list exports
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   324
    -n           no build of session
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   325
    -o OPTION    override Isabelle system OPTION (via NAME=VAL or NAME)
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   326
    -s           system build mode for session image
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   327
    -x PATTERN   extract files matching pattern (e.g. "*:**" for all)
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   328
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   329
  List or export theory exports for SESSION: named blobs produced by
68290
f1f5ccc85b25 support multiple patterns;
wenzelm
parents: 68289
diff changeset
   330
  isabelle build. Option -l or -x is required; option -x may be repeated.
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   331
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   332
  The PATTERN language resembles glob patterns in the shell, with ? and *
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   333
  (both excluding ":" and "/"), ** (excluding ":"), and [abc] or [^abc],
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   334
  and variants {pattern1,pattern2,pattern3}.
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   335
""",
68314
2acbf8129d8b clarified option -O: avoid conflict with build/dump option -D;
wenzelm
parents: 68305
diff changeset
   336
      "O:" -> (arg => export_dir = Path.explode(arg)),
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   337
      "d:" -> (arg => dirs = dirs ::: List(Path.explode(arg))),
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   338
      "l" -> (_ => export_list = true),
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   339
      "n" -> (_ => no_build = true),
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   340
      "o:" -> (arg => options = options + arg),
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   341
      "s" -> (_ => system_mode = true),
68290
f1f5ccc85b25 support multiple patterns;
wenzelm
parents: 68289
diff changeset
   342
      "x:" -> (arg => export_patterns ::= arg))
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   343
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   344
    val more_args = getopts(args)
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   345
    val session_name =
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   346
      more_args match {
68290
f1f5ccc85b25 support multiple patterns;
wenzelm
parents: 68289
diff changeset
   347
        case List(session_name) if export_list || export_patterns.nonEmpty => session_name
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   348
        case _ => getopts.usage()
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   349
      }
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   350
68305
5321218147d3 clarified signature;
wenzelm
parents: 68291
diff changeset
   351
    val progress = new Console_Progress()
5321218147d3 clarified signature;
wenzelm
parents: 68291
diff changeset
   352
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   353
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   354
    /* build */
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   355
68305
5321218147d3 clarified signature;
wenzelm
parents: 68291
diff changeset
   356
    if (!no_build) {
5321218147d3 clarified signature;
wenzelm
parents: 68291
diff changeset
   357
      val rc =
68331
7eaaa8f48331 clarified outermost progress.interrupt_handler;
wenzelm
parents: 68314
diff changeset
   358
        progress.interrupt_handler {
7eaaa8f48331 clarified outermost progress.interrupt_handler;
wenzelm
parents: 68314
diff changeset
   359
          Build.build_logic(options, session_name, progress = progress,
7eaaa8f48331 clarified outermost progress.interrupt_handler;
wenzelm
parents: 68314
diff changeset
   360
            dirs = dirs, system_mode = system_mode)
7eaaa8f48331 clarified outermost progress.interrupt_handler;
wenzelm
parents: 68314
diff changeset
   361
        }
68305
5321218147d3 clarified signature;
wenzelm
parents: 68291
diff changeset
   362
      if (rc != 0) sys.exit(rc)
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   363
    }
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   364
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   365
68288
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   366
    /* export files */
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   367
68209
aeffd8f1f079 support Store with options;
wenzelm
parents: 68205
diff changeset
   368
    val store = Sessions.store(options, system_mode)
68288
d20770229f99 tuned signature;
wenzelm
parents: 68222
diff changeset
   369
    export_files(store, session_name, export_dir, progress = progress,
68290
f1f5ccc85b25 support multiple patterns;
wenzelm
parents: 68289
diff changeset
   370
      export_list = export_list, export_patterns = export_patterns)
68116
ac82ee617a75 command-line tool "isabelle export";
wenzelm
parents: 68115
diff changeset
   371
  })
68092
888d35a19866 store exports in session database, with asynchronous / parallel compression;
wenzelm
parents:
diff changeset
   372
}