author | wenzelm |
Tue, 07 Nov 2023 15:59:02 +0100 | |
changeset 78911 | 81dab48582c6 |
parent 78909 | 65acbafc70e5 |
child 78915 | 90756ad4d8d7 |
permissions | -rw-r--r-- |
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
1 |
/* Title: Pure/System/options.scala |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
2 |
Author: Makarius |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
3 |
|
51945 | 4 |
System options with external string representation. |
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
5 |
*/ |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
6 |
|
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
7 |
package isabelle |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
8 |
|
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
9 |
|
75393 | 10 |
object Options { |
77624 | 11 |
val empty: Options = new Options() |
48421 | 12 |
|
77626
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
13 |
object Spec { |
78911 | 14 |
val syntax: Outer_Syntax = Outer_Syntax.empty + "=" + "," |
15 |
||
16 |
def parse(content: String): List[Spec] = { |
|
17 |
val parser = Parsers.repsep(Parsers.option_spec, Parsers.$$$(",")) |
|
18 |
val reader = Token.reader(Token.explode(syntax.keywords, content), Token.Pos.none) |
|
19 |
Parsers.parse_all(parser, reader) match { |
|
20 |
case Parsers.Success(result, _) => result |
|
21 |
case bad => error(bad.toString) |
|
22 |
} |
|
23 |
} |
|
24 |
||
77626
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
25 |
def make(s: String): Spec = |
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
26 |
s match { |
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
27 |
case Properties.Eq(a, b) => Spec(a, Some(b)) |
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
28 |
case _ => Spec(s) |
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
29 |
} |
77628 | 30 |
|
31 |
def ISABELLE_BUILD_OPTIONS: List[Spec] = |
|
32 |
Word.explode(Isabelle_System.getenv("ISABELLE_BUILD_OPTIONS")).map(make) |
|
78560 | 33 |
|
34 |
def print_value(s: String): String = |
|
35 |
s match { |
|
36 |
case Value.Boolean(_) => s |
|
37 |
case Value.Long(_) => s |
|
38 |
case Value.Double(_) => s |
|
78911 | 39 |
case _ => Token.quote_name(syntax.keywords, s) |
78560 | 40 |
} |
41 |
||
42 |
def print(name: String, value: String): String = Properties.Eq(name, print_value(value)) |
|
78908
f38153e58f21
proper Option.Spec.toString for bash script: avoid Token.quote_name of Options.Spec.print_value (amending 3d1746a716fa, see also 39f6f180008d);
wenzelm
parents:
78614
diff
changeset
|
43 |
|
f38153e58f21
proper Option.Spec.toString for bash script: avoid Token.quote_name of Options.Spec.print_value (amending 3d1746a716fa, see also 39f6f180008d);
wenzelm
parents:
78614
diff
changeset
|
44 |
def bash_strings(opts: Iterable[Spec]): String = |
f38153e58f21
proper Option.Spec.toString for bash script: avoid Token.quote_name of Options.Spec.print_value (amending 3d1746a716fa, see also 39f6f180008d);
wenzelm
parents:
78614
diff
changeset
|
45 |
opts.iterator.map(opt => "-o " + Bash.string(opt.toString)).mkString(" ", " ", " ") |
77626
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
46 |
} |
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
47 |
|
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
48 |
sealed case class Spec(name: String, value: Option[String] = None, permissive: Boolean = false) { |
77625 | 49 |
override def toString: String = name + if_proper(value, "=" + value.get) |
78909 | 50 |
def print: String = |
51 |
value match { |
|
52 |
case None => name |
|
53 |
case Some(v) => Spec.print(name, v) |
|
54 |
} |
|
77625 | 55 |
} |
48421 | 56 |
|
77623 | 57 |
sealed case class Change(name: String, value: String, unknown: Boolean) { |
77626
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
58 |
def spec: Spec = Spec(name, Some(value)) |
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
59 |
|
77623 | 60 |
def print_prefs: String = |
61 |
name + " = " + Outer_Syntax.quote_string(value) + |
|
62 |
if_proper(unknown, " (* unknown *)") + "\n" |
|
63 |
} |
|
64 |
||
48421 | 65 |
|
75847 | 66 |
/* typed access */ |
75842 | 67 |
|
75846 | 68 |
abstract class Access[A](val options: Options) { |
75842 | 69 |
def apply(name: String): A |
70 |
def update(name: String, x: A): Options |
|
75847 | 71 |
def change(name: String, f: A => A): Options = update(name, f(apply(name))) |
75842 | 72 |
} |
73 |
||
75847 | 74 |
class Access_Variable[A]( |
75 |
val options: Options_Variable, |
|
76 |
val pure_access: Options => Access[A] |
|
77 |
) { |
|
78 |
def apply(name: String): A = pure_access(options.value)(name) |
|
79 |
def update(name: String, x: A): Unit = |
|
80 |
options.change(options => pure_access(options).update(name, x)) |
|
81 |
def change(name: String, f: A => A): Unit = update(name, f(apply(name))) |
|
75842 | 82 |
} |
83 |
||
84 |
||
48421 | 85 |
/* representation */ |
86 |
||
75393 | 87 |
sealed abstract class Type { |
56599 | 88 |
def print: String = Word.lowercase(toString) |
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
89 |
} |
49246 | 90 |
case object Bool extends Type |
91 |
case object Int extends Type |
|
92 |
case object Real extends Type |
|
93 |
case object String extends Type |
|
94 |
case object Unknown extends Type |
|
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
95 |
|
77611 | 96 |
val TAG_CONTENT = "content" // formal theory content |
97 |
val TAG_DOCUMENT = "document" // document preparation |
|
98 |
val TAG_BUILD = "build" // relavant for "isabelle build" |
|
99 |
val TAG_UPDATE = "update" // relevant for "isabelle update" |
|
100 |
val TAG_CONNECTION = "connection" // private information about connections (password etc.) |
|
77612 | 101 |
val TAG_COLOR_DIALOG = "color_dialog" // special color selection dialog |
77603 | 102 |
|
77605 | 103 |
case class Entry( |
56465 | 104 |
public: Boolean, |
105 |
pos: Position.T, |
|
106 |
name: String, |
|
107 |
typ: Type, |
|
108 |
value: String, |
|
109 |
default_value: String, |
|
74827
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
110 |
standard_value: Option[String], |
77603 | 111 |
tags: List[String], |
56465 | 112 |
description: String, |
75393 | 113 |
section: String |
114 |
) { |
|
74827
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
115 |
private def print_value(x: String): String = if (typ == Options.String) quote(x) else x |
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
116 |
private def print_standard: String = |
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
117 |
standard_value match { |
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
118 |
case None => "" |
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
119 |
case Some(s) if s == default_value => " (standard)" |
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
120 |
case Some(s) => " (standard " + print_value(s) + ")" |
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
121 |
} |
75393 | 122 |
private def print(default: Boolean): String = { |
49289 | 123 |
val x = if (default) default_value else value |
74827
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
124 |
"option " + name + " : " + typ.print + " = " + print_value(x) + print_standard + |
77504 | 125 |
if_proper(description, "\n -- " + quote(description)) |
49289 | 126 |
} |
127 |
||
128 |
def print: String = print(false) |
|
129 |
def print_default: String = print(true) |
|
49247 | 130 |
|
75393 | 131 |
def title(strip: String = ""): String = { |
56600 | 132 |
val words = Word.explode('_', name) |
49270 | 133 |
val words1 = |
134 |
words match { |
|
135 |
case word :: rest if word == strip => rest |
|
136 |
case _ => words |
|
137 |
} |
|
78614 | 138 |
Word.implode(words1.map(Word.perhaps_capitalized)) |
49270 | 139 |
} |
76579 | 140 |
def title_jedit: String = title("jedit") |
49270 | 141 |
|
48860 | 142 |
def unknown: Boolean = typ == Unknown |
77603 | 143 |
|
77617 | 144 |
def for_tag(tag: String): Boolean = tags.contains(tag) |
145 |
def for_content: Boolean = for_tag(TAG_CONTENT) |
|
146 |
def for_document: Boolean = for_tag(TAG_DOCUMENT) |
|
147 |
def for_color_dialog: Boolean = for_tag(TAG_COLOR_DIALOG) |
|
148 |
||
149 |
def session_content: Boolean = for_content || for_document |
|
48860 | 150 |
} |
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
151 |
|
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
152 |
|
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
153 |
/* parsing */ |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
154 |
|
49270 | 155 |
private val SECTION = "section" |
52065
78f2475aa126
explicit notion of public options, which are shown in the editor options dialog;
wenzelm
parents:
51945
diff
changeset
|
156 |
private val PUBLIC = "public" |
48795
bece259ee055
clarified format of etc/options: only declarations, not re-definitions;
wenzelm
parents:
48718
diff
changeset
|
157 |
private val OPTION = "option" |
74827
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
158 |
private val STANDARD = "standard" |
77603 | 159 |
private val FOR = "for" |
48807 | 160 |
private val OPTIONS = Path.explode("etc/options") |
67845 | 161 |
private val PREFS = Path.explode("$ISABELLE_HOME_USER/etc/preferences") |
48713
de26cf3191a3
more token markers, based on actual outer syntax;
wenzelm
parents:
48693
diff
changeset
|
162 |
|
71601 | 163 |
val options_syntax: Outer_Syntax = |
74827
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
164 |
Outer_Syntax.empty + ":" + "=" + "--" + "(" + ")" + |
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
165 |
Symbol.comment + Symbol.comment_decoded + |
63441 | 166 |
(SECTION, Keyword.DOCUMENT_HEADING) + |
167 |
(PUBLIC, Keyword.BEFORE_COMMAND) + |
|
74827
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
168 |
(OPTION, Keyword.THY_DECL) + |
77603 | 169 |
STANDARD + FOR |
49270 | 170 |
|
71601 | 171 |
val prefs_syntax: Outer_Syntax = Outer_Syntax.empty + "=" |
48713
de26cf3191a3
more token markers, based on actual outer syntax;
wenzelm
parents:
48693
diff
changeset
|
172 |
|
75405 | 173 |
trait Parsers extends Parse.Parsers { |
71601 | 174 |
val option_name: Parser[String] = atom("option name", _.is_name) |
175 |
val option_type: Parser[String] = atom("option type", _.is_name) |
|
176 |
val option_value: Parser[String] = |
|
48807 | 177 |
opt(token("-", tok => tok.is_sym_ident && tok.content == "-")) ~ atom("nat", _.is_nat) ^^ |
178 |
{ case s ~ n => if (s.isDefined) "-" + n else n } | |
|
179 |
atom("option value", tok => tok.is_name || tok.is_float) |
|
74827
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
180 |
val option_standard: Parser[Option[String]] = |
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
181 |
$$$("(") ~! $$$(STANDARD) ~ opt(option_value) ~ $$$(")") ^^ { case _ ~ _ ~ a ~ _ => a } |
77603 | 182 |
val option_tag: Parser[String] = atom("option tag", _.is_name) |
183 |
val option_tags: Parser[List[String]] = |
|
184 |
$$$(FOR) ~! rep(option_tag) ^^ { case _ ~ x => x } | success(Nil) |
|
78407
b262ecc98319
more operations for independent "inline" options;
wenzelm
parents:
77668
diff
changeset
|
185 |
val option_spec: Parser[Spec] = |
b262ecc98319
more operations for independent "inline" options;
wenzelm
parents:
77668
diff
changeset
|
186 |
option_name ~ opt($$$("=") ~! option_value ^^ { case _ ~ x => x }) ^^ |
b262ecc98319
more operations for independent "inline" options;
wenzelm
parents:
77668
diff
changeset
|
187 |
{ case x ~ y => Options.Spec(x, y) } |
62968 | 188 |
} |
48807 | 189 |
|
75405 | 190 |
private object Parsers extends Parsers { |
61579 | 191 |
def comment_marker: Parser[String] = |
192 |
$$$("--") | $$$(Symbol.comment) | $$$(Symbol.comment_decoded) |
|
193 |
||
75393 | 194 |
val option_entry: Parser[Options => Options] = { |
49270 | 195 |
command(SECTION) ~! text ^^ |
49295 | 196 |
{ case _ ~ a => (options: Options) => options.set_section(a) } | |
60133
a90982bbe8b4
clarified keywords for quasi-command spans and Sidekick structure;
wenzelm
parents:
59811
diff
changeset
|
197 |
opt($$$(PUBLIC)) ~ command(OPTION) ~! (position(option_name) ~ $$$(":") ~ option_type ~ |
77603 | 198 |
$$$("=") ~ option_value ~ opt(option_standard) ~ option_tags ~ |
74827
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
199 |
(comment_marker ~! text ^^ { case _ ~ x => x } | success(""))) ^^ |
77603 | 200 |
{ case a ~ _ ~ ((b, pos) ~ _ ~ c ~ _ ~ d ~ e ~ f ~ g) => |
201 |
(options: Options) => options.declare(a.isDefined, pos, b, c, d, e, f, g) } |
|
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
202 |
} |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
203 |
|
75393 | 204 |
val prefs_entry: Parser[Options => Options] = { |
58908 | 205 |
option_name ~ ($$$("=") ~! option_value) ^^ |
77626
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
206 |
{ case a ~ (_ ~ b) => (options: Options) => |
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
207 |
options + Options.Spec(a, Some(b), permissive = true) } |
48807 | 208 |
} |
209 |
||
75393 | 210 |
def parse_file( |
211 |
options: Options, |
|
212 |
file_name: String, |
|
213 |
content: String, |
|
67845 | 214 |
syntax: Outer_Syntax = options_syntax, |
75393 | 215 |
parser: Parser[Options => Options] = option_entry |
216 |
): Options = { |
|
67845 | 217 |
val toks = Token.explode(syntax.keywords, content) |
48807 | 218 |
val ops = |
67845 | 219 |
parse_all(rep(parser), Token.reader(toks, Token.Pos.file(file_name))) match { |
48807 | 220 |
case Success(result, _) => result |
221 |
case bad => error(bad.toString) |
|
222 |
} |
|
73359 | 223 |
try { ops.foldLeft(options.set_section("")) { case (opts, op) => op(opts) } } |
73166 | 224 |
catch { case ERROR(msg) => error(msg + Position.here(Position.File(file_name))) } |
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
225 |
} |
67845 | 226 |
|
227 |
def parse_prefs(options: Options, content: String): Options = |
|
69366 | 228 |
parse_file(options, PREFS.file_name, content, syntax = prefs_syntax, parser = prefs_entry) |
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
229 |
} |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
230 |
|
67845 | 231 |
def read_prefs(file: Path = PREFS): String = |
232 |
if (file.is_file) File.read(file) else "" |
|
64186
49816908ae42
support for separate sub-system options, independent of main Isabelle options;
wenzelm
parents:
64151
diff
changeset
|
233 |
|
78407
b262ecc98319
more operations for independent "inline" options;
wenzelm
parents:
77668
diff
changeset
|
234 |
def inline(content: String): Options = Parsers.parse_file(empty, "inline", content) |
b262ecc98319
more operations for independent "inline" options;
wenzelm
parents:
77668
diff
changeset
|
235 |
|
77628 | 236 |
def init(prefs: String = read_prefs(file = PREFS), specs: List[Spec] = Nil): Options = { |
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
237 |
var options = empty |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
238 |
for { |
73815 | 239 |
dir <- Components.directories() |
48548 | 240 |
file = dir + OPTIONS if file.is_file |
75405 | 241 |
} { options = Parsers.parse_file(options, file.implode, File.read(file)) } |
77628 | 242 |
Parsers.parse_prefs(options, prefs) ++ specs |
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
243 |
} |
48457 | 244 |
|
77609 | 245 |
def init0(): Options = init(prefs = "") |
246 |
||
48457 | 247 |
|
62832 | 248 |
/* Isabelle tool wrapper */ |
48693
ceeea46bdeba
"isabelle options" prints Isabelle system options;
wenzelm
parents:
48605
diff
changeset
|
249 |
|
72763 | 250 |
val isabelle_tool = Isabelle_Tool("options", "print Isabelle system options", |
75394 | 251 |
Scala_Project.here, |
252 |
{ args => |
|
253 |
var build_options = false |
|
254 |
var get_option = "" |
|
255 |
var list_options = false |
|
77616 | 256 |
var list_tags = List.empty[String] |
75394 | 257 |
var export_file = "" |
62437 | 258 |
|
75394 | 259 |
val getopts = Getopts(""" |
62437 | 260 |
Usage: isabelle options [OPTIONS] [MORE_OPTIONS ...] |
48693
ceeea46bdeba
"isabelle options" prints Isabelle system options;
wenzelm
parents:
48605
diff
changeset
|
261 |
|
62437 | 262 |
Options are: |
263 |
-b include $ISABELLE_BUILD_OPTIONS |
|
264 |
-g OPTION get value of OPTION |
|
265 |
-l list options |
|
77616 | 266 |
-t TAGS restrict list to given tags (comma-separated) |
62437 | 267 |
-x FILE export options to FILE in YXML format |
268 |
||
269 |
Report Isabelle system options, augmented by MORE_OPTIONS given as |
|
270 |
arguments NAME=VAL or NAME. |
|
271 |
""", |
|
75394 | 272 |
"b" -> (_ => build_options = true), |
273 |
"g:" -> (arg => get_option = arg), |
|
274 |
"l" -> (_ => list_options = true), |
|
77616 | 275 |
"t:" -> (arg => list_tags = space_explode(',', arg)), |
75394 | 276 |
"x:" -> (arg => export_file = arg)) |
52737
7b396ef36af6
clarified meaning of options for "isabelle options";
wenzelm
parents:
52735
diff
changeset
|
277 |
|
75394 | 278 |
val more_options = getopts(args) |
279 |
if (get_option == "" && !list_options && export_file == "") getopts.usage() |
|
52737
7b396ef36af6
clarified meaning of options for "isabelle options";
wenzelm
parents:
52735
diff
changeset
|
280 |
|
75394 | 281 |
val options = { |
282 |
val options0 = Options.init() |
|
283 |
val options1 = |
|
77628 | 284 |
if (build_options) options0 ++ Options.Spec.ISABELLE_BUILD_OPTIONS else options0 |
75394 | 285 |
more_options.foldLeft(options1)(_ + _) |
286 |
} |
|
48693
ceeea46bdeba
"isabelle options" prints Isabelle system options;
wenzelm
parents:
48605
diff
changeset
|
287 |
|
77613 | 288 |
if (get_option != "") { |
75394 | 289 |
Output.writeln(options.check_name(get_option).value, stdout = true) |
77613 | 290 |
} |
62437 | 291 |
|
77613 | 292 |
if (export_file != "") { |
75394 | 293 |
File.write(Path.explode(export_file), YXML.string_of_body(options.encode)) |
77613 | 294 |
} |
62437 | 295 |
|
77613 | 296 |
if (get_option == "" && export_file == "") { |
77616 | 297 |
val filter: Options.Entry => Boolean = |
298 |
if (list_tags.isEmpty) (_ => true) |
|
77617 | 299 |
else opt => list_tags.exists(opt.for_tag) |
77616 | 300 |
Output.writeln(options.print(filter = filter), stdout = true) |
77613 | 301 |
} |
75394 | 302 |
}) |
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
303 |
} |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
304 |
|
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
305 |
|
49270 | 306 |
final class Options private( |
77605 | 307 |
options: Map[String, Options.Entry] = Map.empty, |
75393 | 308 |
val section: String = "" |
309 |
) { |
|
78407
b262ecc98319
more operations for independent "inline" options;
wenzelm
parents:
77668
diff
changeset
|
310 |
def defined(name: String): Boolean = options.isDefinedAt(name) |
b262ecc98319
more operations for independent "inline" options;
wenzelm
parents:
77668
diff
changeset
|
311 |
|
77605 | 312 |
def iterator: Iterator[Options.Entry] = options.valuesIterator |
75844
7d27944d7141
clarified signature: avoid public representation;
wenzelm
parents:
75843
diff
changeset
|
313 |
|
77605 | 314 |
override def toString: String = iterator.mkString("Options(", ",", ")") |
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
315 |
|
77605 | 316 |
private def print_entry(opt: Options.Entry): String = |
77614 | 317 |
if_proper(opt.public, "public ") + opt.print |
54347 | 318 |
|
77616 | 319 |
def print(filter: Options.Entry => Boolean = _ => true): String = |
320 |
cat_lines(iterator.filter(filter).toList.sortBy(_.name).map(print_entry)) |
|
48693
ceeea46bdeba
"isabelle options" prints Isabelle system options;
wenzelm
parents:
48605
diff
changeset
|
321 |
|
49245
cb70157293c0
manage Isabelle/jEdit options as Isabelle/Scala options (with persistent preferences);
wenzelm
parents:
48992
diff
changeset
|
322 |
def description(name: String): String = check_name(name).description |
cb70157293c0
manage Isabelle/jEdit options as Isabelle/Scala options (with persistent preferences);
wenzelm
parents:
48992
diff
changeset
|
323 |
|
78559 | 324 |
def spec(name: String): Options.Spec = |
325 |
Options.Spec(name, Some(check_name(name).value)) |
|
326 |
||
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
327 |
|
48370 | 328 |
/* check */ |
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
329 |
|
77605 | 330 |
def get(name: String): Option[Options.Entry] = options.get(name) |
75844
7d27944d7141
clarified signature: avoid public representation;
wenzelm
parents:
75843
diff
changeset
|
331 |
|
77605 | 332 |
def check_name(name: String): Options.Entry = |
75844
7d27944d7141
clarified signature: avoid public representation;
wenzelm
parents:
75843
diff
changeset
|
333 |
get(name) match { |
48860 | 334 |
case Some(opt) if !opt.unknown => opt |
335 |
case _ => error("Unknown option " + quote(name)) |
|
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
336 |
} |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
337 |
|
77605 | 338 |
private def check_type(name: String, typ: Options.Type): Options.Entry = { |
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
339 |
val opt = check_name(name) |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
340 |
if (opt.typ == typ) opt |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
341 |
else error("Ill-typed option " + quote(name) + " : " + opt.typ.print + " vs. " + typ.print) |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
342 |
} |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
343 |
|
48370 | 344 |
|
345 |
/* basic operations */ |
|
346 |
||
75843 | 347 |
private def put(name: String, typ: Options.Type, value: String): Options = { |
48370 | 348 |
val opt = check_type(name, typ) |
49270 | 349 |
new Options(options + (name -> opt.copy(value = value)), section) |
48370 | 350 |
} |
351 |
||
75393 | 352 |
private def get[A](name: String, typ: Options.Type, parse: String => Option[A]): A = { |
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
353 |
val opt = check_type(name, typ) |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
354 |
parse(opt.value) match { |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
355 |
case Some(x) => x |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
356 |
case None => |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
357 |
error("Malformed value for option " + quote(name) + |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
358 |
" : " + typ.print + " =\n" + quote(opt.value)) |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
359 |
} |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
360 |
} |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
361 |
|
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
362 |
|
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
363 |
/* internal lookup and update */ |
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
364 |
|
75846 | 365 |
val bool: Options.Access[Boolean] = |
366 |
new Options.Access[Boolean](this) { |
|
367 |
def apply(name: String): Boolean = get(name, Options.Bool, Value.Boolean.unapply) |
|
368 |
def update(name: String, x: Boolean): Options = put(name, Options.Bool, Value.Boolean(x)) |
|
369 |
} |
|
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
370 |
|
75846 | 371 |
val int: Options.Access[Int] = |
372 |
new Options.Access[Int](this) { |
|
373 |
def apply(name: String): Int = get(name, Options.Int, Value.Int.unapply) |
|
374 |
def update(name: String, x: Int): Options = put(name, Options.Int, Value.Int(x)) |
|
375 |
} |
|
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
376 |
|
75846 | 377 |
val real: Options.Access[Double] = |
378 |
new Options.Access[Double](this) { |
|
379 |
def apply(name: String): Double = get(name, Options.Real, Value.Double.unapply) |
|
380 |
def update(name: String, x: Double): Options = put(name, Options.Real, Value.Double(x)) |
|
381 |
} |
|
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
382 |
|
75846 | 383 |
val string: Options.Access[String] = |
384 |
new Options.Access[String](this) { |
|
385 |
def apply(name: String): String = get(name, Options.String, Some(_)) |
|
386 |
def update(name: String, x: String): Options = put(name, Options.String, x) |
|
387 |
} |
|
48370 | 388 |
|
69073 | 389 |
def seconds(name: String): Time = Time.seconds(real(name)) |
50207 | 390 |
|
48370 | 391 |
|
48807 | 392 |
/* external updates */ |
48370 | 393 |
|
75393 | 394 |
private def check_value(name: String): Options = { |
48370 | 395 |
val opt = check_name(name) |
396 |
opt.typ match { |
|
397 |
case Options.Bool => bool(name); this |
|
398 |
case Options.Int => int(name); this |
|
399 |
case Options.Real => real(name); this |
|
400 |
case Options.String => string(name); this |
|
48860 | 401 |
case Options.Unknown => this |
48370 | 402 |
} |
403 |
} |
|
404 |
||
56465 | 405 |
def declare( |
406 |
public: Boolean, |
|
407 |
pos: Position.T, |
|
408 |
name: String, |
|
409 |
typ_name: String, |
|
410 |
value: String, |
|
74827
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
411 |
standard: Option[Option[String]], |
77603 | 412 |
tags: List[String], |
75393 | 413 |
description: String |
414 |
): Options = { |
|
75844
7d27944d7141
clarified signature: avoid public representation;
wenzelm
parents:
75843
diff
changeset
|
415 |
get(name) match { |
56465 | 416 |
case Some(other) => |
417 |
error("Duplicate declaration of option " + quote(name) + Position.here(pos) + |
|
418 |
Position.here(other.pos)) |
|
48370 | 419 |
case None => |
420 |
val typ = |
|
421 |
typ_name match { |
|
422 |
case "bool" => Options.Bool |
|
423 |
case "int" => Options.Int |
|
424 |
case "real" => Options.Real |
|
425 |
case "string" => Options.String |
|
56465 | 426 |
case _ => |
427 |
error("Unknown type for option " + quote(name) + " : " + quote(typ_name) + |
|
428 |
Position.here(pos)) |
|
48370 | 429 |
} |
74827
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
430 |
val standard_value = |
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
431 |
standard match { |
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
432 |
case None => None |
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
433 |
case Some(_) if typ == Options.Bool => |
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
434 |
error("Illegal standard value for option " + quote(name) + " : " + typ_name + |
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
435 |
Position.here) |
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
436 |
case Some(s) => Some(s.getOrElse(value)) |
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
437 |
} |
c1b5d6e6ff74
clarified system option standard values: avoid oddities like "isabelle build -o document_output" producing directories named "true";
wenzelm
parents:
74144
diff
changeset
|
438 |
val opt = |
77605 | 439 |
Options.Entry( |
77603 | 440 |
public, pos, name, typ, value, value, standard_value, tags, description, section) |
49270 | 441 |
(new Options(options + (name -> opt), section)).check_value(name) |
48370 | 442 |
} |
443 |
} |
|
444 |
||
77626
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
445 |
def + (spec: Options.Spec): Options = { |
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
446 |
val name = spec.name |
78407
b262ecc98319
more operations for independent "inline" options;
wenzelm
parents:
77668
diff
changeset
|
447 |
if (spec.permissive && !defined(name)) { |
77626
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
448 |
val value = spec.value.getOrElse("") |
77603 | 449 |
val opt = |
77605 | 450 |
Options.Entry(false, Position.none, name, Options.Unknown, value, value, None, Nil, "", "") |
56465 | 451 |
new Options(options + (name -> opt), section) |
452 |
} |
|
77626
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
453 |
else { |
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
454 |
val opt = check_name(name) |
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
455 |
def put(value: String): Options = |
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
456 |
(new Options(options + (name -> opt.copy(value = value)), section)).check_value(name) |
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
457 |
spec.value orElse opt.standard_value match { |
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
458 |
case Some(value) => put(value) |
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
459 |
case None if opt.typ == Options.Bool => put("true") |
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
460 |
case None => error("Missing value for option " + quote(name) + " : " + opt.typ.print) |
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
461 |
} |
48370 | 462 |
} |
463 |
} |
|
464 |
||
77626
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
465 |
def + (s: String): Options = this + Options.Spec.make(s) |
48456
d8ff14f44a40
added ML version of stand-alone options, with XML.encode/decode operations (unidirectional from Scala to ML);
wenzelm
parents:
48421
diff
changeset
|
466 |
|
77626
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
467 |
def ++ (specs: List[Options.Spec]): Options = specs.foldLeft(this)(_ + _) |
48807 | 468 |
|
48456
d8ff14f44a40
added ML version of stand-alone options, with XML.encode/decode operations (unidirectional from Scala to ML);
wenzelm
parents:
48421
diff
changeset
|
469 |
|
49270 | 470 |
/* sections */ |
471 |
||
472 |
def set_section(new_section: String): Options = |
|
473 |
new Options(options, new_section) |
|
474 |
||
77605 | 475 |
def sections: List[(String, List[Options.Entry])] = |
49270 | 476 |
options.groupBy(_._2.section).toList.map({ case (a, opts) => (a, opts.toList.map(_._2)) }) |
477 |
||
478 |
||
48456
d8ff14f44a40
added ML version of stand-alone options, with XML.encode/decode operations (unidirectional from Scala to ML);
wenzelm
parents:
48421
diff
changeset
|
479 |
/* encode */ |
d8ff14f44a40
added ML version of stand-alone options, with XML.encode/decode operations (unidirectional from Scala to ML);
wenzelm
parents:
48421
diff
changeset
|
480 |
|
75393 | 481 |
def encode: XML.Body = { |
48860 | 482 |
val opts = |
56465 | 483 |
for ((_, opt) <- options.toList; if !opt.unknown) |
484 |
yield (opt.pos, (opt.name, (opt.typ.print, opt.value))) |
|
48860 | 485 |
|
56465 | 486 |
import XML.Encode.{string => string_, _} |
487 |
list(pair(properties, pair(string_, pair(string_, string_))))(opts) |
|
48456
d8ff14f44a40
added ML version of stand-alone options, with XML.encode/decode operations (unidirectional from Scala to ML);
wenzelm
parents:
48421
diff
changeset
|
488 |
} |
48807 | 489 |
|
490 |
||
77622
f458547b4f0f
clarified signature (again, see also 8c64e51d9dde and 268bf61631ec);
wenzelm
parents:
77621
diff
changeset
|
491 |
/* changed options */ |
f458547b4f0f
clarified signature (again, see also 8c64e51d9dde and 268bf61631ec);
wenzelm
parents:
77621
diff
changeset
|
492 |
|
f458547b4f0f
clarified signature (again, see also 8c64e51d9dde and 268bf61631ec);
wenzelm
parents:
77621
diff
changeset
|
493 |
def changed( |
f458547b4f0f
clarified signature (again, see also 8c64e51d9dde and 268bf61631ec);
wenzelm
parents:
77621
diff
changeset
|
494 |
defaults: Options = Options.init0(), |
f458547b4f0f
clarified signature (again, see also 8c64e51d9dde and 268bf61631ec);
wenzelm
parents:
77621
diff
changeset
|
495 |
filter: Options.Entry => Boolean = _ => true |
77623 | 496 |
): List[Options.Change] = { |
77622
f458547b4f0f
clarified signature (again, see also 8c64e51d9dde and 268bf61631ec);
wenzelm
parents:
77621
diff
changeset
|
497 |
List.from( |
f458547b4f0f
clarified signature (again, see also 8c64e51d9dde and 268bf61631ec);
wenzelm
parents:
77621
diff
changeset
|
498 |
for { |
f458547b4f0f
clarified signature (again, see also 8c64e51d9dde and 268bf61631ec);
wenzelm
parents:
77621
diff
changeset
|
499 |
(name, opt2) <- options.iterator |
f458547b4f0f
clarified signature (again, see also 8c64e51d9dde and 268bf61631ec);
wenzelm
parents:
77621
diff
changeset
|
500 |
opt1 = defaults.get(name) |
f458547b4f0f
clarified signature (again, see also 8c64e51d9dde and 268bf61631ec);
wenzelm
parents:
77621
diff
changeset
|
501 |
if (opt1.isEmpty || opt1.get.value != opt2.value) && filter(opt2) |
77668
5cb7fd36223b
proper sorting of result (amending f458547b4f0f);
wenzelm
parents:
77628
diff
changeset
|
502 |
} yield Options.Change(name, opt2.value, opt1.isEmpty)).sortBy(_.name) |
77622
f458547b4f0f
clarified signature (again, see also 8c64e51d9dde and 268bf61631ec);
wenzelm
parents:
77621
diff
changeset
|
503 |
} |
f458547b4f0f
clarified signature (again, see also 8c64e51d9dde and 268bf61631ec);
wenzelm
parents:
77621
diff
changeset
|
504 |
|
f458547b4f0f
clarified signature (again, see also 8c64e51d9dde and 268bf61631ec);
wenzelm
parents:
77621
diff
changeset
|
505 |
|
77608 | 506 |
/* preferences */ |
48807 | 507 |
|
77603 | 508 |
def make_prefs( |
77609 | 509 |
defaults: Options = Options.init0(), |
77605 | 510 |
filter: Options.Entry => Boolean = _ => true |
77622
f458547b4f0f
clarified signature (again, see also 8c64e51d9dde and 268bf61631ec);
wenzelm
parents:
77621
diff
changeset
|
511 |
): String = changed(defaults = defaults, filter = filter).map(_.print_prefs).mkString |
77374
268bf61631ec
more robust options in "prefs" format: avoid odd control character;
wenzelm
parents:
77366
diff
changeset
|
512 |
|
77609 | 513 |
def save_prefs(file: Path = Options.PREFS, defaults: Options = Options.init0()): Unit = { |
77374
268bf61631ec
more robust options in "prefs" format: avoid odd control character;
wenzelm
parents:
77366
diff
changeset
|
514 |
val prefs = make_prefs(defaults = defaults) |
72375 | 515 |
Isabelle_System.make_directory(file.dir) |
67845 | 516 |
File.write_backup(file, "(* generated by Isabelle " + Date.now() + " *)\n\n" + prefs) |
48807 | 517 |
} |
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
diff
changeset
|
518 |
} |
49245
cb70157293c0
manage Isabelle/jEdit options as Isabelle/Scala options (with persistent preferences);
wenzelm
parents:
48992
diff
changeset
|
519 |
|
cb70157293c0
manage Isabelle/jEdit options as Isabelle/Scala options (with persistent preferences);
wenzelm
parents:
48992
diff
changeset
|
520 |
|
75393 | 521 |
class Options_Variable(init_options: Options) { |
75846 | 522 |
private var _options = init_options |
49245
cb70157293c0
manage Isabelle/jEdit options as Isabelle/Scala options (with persistent preferences);
wenzelm
parents:
48992
diff
changeset
|
523 |
|
75846 | 524 |
def value: Options = synchronized { _options } |
525 |
def change(f: Options => Options): Unit = synchronized { _options = f(_options) } |
|
77626
af8ac22d97f0
clarified signature: more explicit type Options.Spec, which incorporates all variants of Options.+;
wenzelm
parents:
77625
diff
changeset
|
526 |
def += (name: String, x: String): Unit = change(options => options + Options.Spec(name, Some(x))) |
49245
cb70157293c0
manage Isabelle/jEdit options as Isabelle/Scala options (with persistent preferences);
wenzelm
parents:
48992
diff
changeset
|
527 |
|
75846 | 528 |
val bool: Options.Access_Variable[Boolean] = |
75847 | 529 |
new Options.Access_Variable[Boolean](this, _.bool) |
49245
cb70157293c0
manage Isabelle/jEdit options as Isabelle/Scala options (with persistent preferences);
wenzelm
parents:
48992
diff
changeset
|
530 |
|
75846 | 531 |
val int: Options.Access_Variable[Int] = |
75847 | 532 |
new Options.Access_Variable[Int](this, _.int) |
49245
cb70157293c0
manage Isabelle/jEdit options as Isabelle/Scala options (with persistent preferences);
wenzelm
parents:
48992
diff
changeset
|
533 |
|
75846 | 534 |
val real: Options.Access_Variable[Double] = |
75847 | 535 |
new Options.Access_Variable[Double](this, _.real) |
49245
cb70157293c0
manage Isabelle/jEdit options as Isabelle/Scala options (with persistent preferences);
wenzelm
parents:
48992
diff
changeset
|
536 |
|
75846 | 537 |
val string: Options.Access_Variable[String] = |
75847 | 538 |
new Options.Access_Variable[String](this, _.string) |
50207 | 539 |
|
69073 | 540 |
def seconds(name: String): Time = value.seconds(name) |
49245
cb70157293c0
manage Isabelle/jEdit options as Isabelle/Scala options (with persistent preferences);
wenzelm
parents:
48992
diff
changeset
|
541 |
} |