author | wenzelm |
Sun, 15 Jun 2025 22:46:45 +0200 | |
changeset 82720 | 956ecf2c07a0 |
parent 82709 | 1008b8e7c78d |
permissions | -rw-r--r-- |
66732 | 1 |
(*:maxLineLen=78:*) |
61575 | 2 |
|
62640 | 3 |
theory Environment |
43564
9864182c6bad
document antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents:
41955
diff
changeset
|
4 |
imports Base |
28215 | 5 |
begin |
6 |
||
58618 | 7 |
chapter \<open>The Isabelle system environment\<close> |
28215 | 8 |
|
61575 | 9 |
text \<open> |
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
10 |
This manual describes Isabelle together with related tools as seen from a |
76987 | 11 |
system oriented view. See also the \<^emph>\<open>Isabelle/Isar Reference Manual\<close> \<^cite>\<open>"isabelle-isar-ref"\<close> for the actual Isabelle input language and related |
12 |
concepts, and \<^emph>\<open>The Isabelle/Isar Implementation Manual\<close> \<^cite>\<open>"isabelle-implementation"\<close> for the main concepts of the underlying |
|
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
13 |
implementation in Isabelle/ML. |
58618 | 14 |
\<close> |
28215 | 15 |
|
16 |
||
58618 | 17 |
section \<open>Isabelle settings \label{sec:settings}\<close> |
28215 | 18 |
|
58618 | 19 |
text \<open> |
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
20 |
Isabelle executables may depend on the \<^emph>\<open>Isabelle settings\<close> within the |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
21 |
process environment. This is a statically scoped collection of environment |
62013 | 22 |
variables, such as @{setting ISABELLE_HOME}, @{setting ML_SYSTEM}, @{setting |
82720
956ecf2c07a0
more flexible ML_Settings in Isabelle/Scala, depending on system options and some default settings;
wenzelm
parents:
82709
diff
changeset
|
23 |
POLYML_HOME}. These variables are \<^emph>\<open>not\<close> intended to be set directly from the |
75161 | 24 |
shell, but are provided by Isabelle \<^emph>\<open>components\<close> within their \<^emph>\<open>settings |
25 |
files\<close>, as explained below. |
|
58618 | 26 |
\<close> |
28215 | 27 |
|
28 |
||
58618 | 29 |
subsection \<open>Bootstrapping the environment \label{sec:boot}\<close> |
28215 | 30 |
|
61575 | 31 |
text \<open> |
32 |
Isabelle executables need to be run within a proper settings environment. |
|
33 |
This is bootstrapped as described below, on the first invocation of one of |
|
34 |
the outer wrapper scripts (such as @{executable_ref isabelle}). This happens |
|
35 |
only once for each process tree, i.e.\ the environment is passed to |
|
36 |
subprocesses according to regular Unix conventions. |
|
37 |
||
38 |
\<^enum> The special variable @{setting_def ISABELLE_HOME} is determined |
|
39 |
automatically from the location of the binary that has been run. |
|
28215 | 40 |
|
61575 | 41 |
You should not try to set @{setting ISABELLE_HOME} manually. Also note |
42 |
that the Isabelle executables either have to be run from their original |
|
43 |
location in the distribution directory, or via the executable objects |
|
44 |
created by the @{tool install} tool. Symbolic links are admissible, but a |
|
63680 | 45 |
plain copy of the \<^dir>\<open>$ISABELLE_HOME/bin\<close> files will not work! |
61575 | 46 |
|
63680 | 47 |
\<^enum> The file \<^file>\<open>$ISABELLE_HOME/etc/settings\<close> is run as a @{executable_ref |
48 |
bash} shell script with the auto-export option for variables enabled. |
|
28238 | 49 |
|
61575 | 50 |
This file holds a rather long list of shell variable assignments, thus |
51 |
providing the site-wide default settings. The Isabelle distribution |
|
52 |
already contains a global settings file with sensible defaults for most |
|
82720
956ecf2c07a0
more flexible ML_Settings in Isabelle/Scala, depending on system options and some default settings;
wenzelm
parents:
82709
diff
changeset
|
53 |
variables. |
61575 | 54 |
|
69593 | 55 |
\<^enum> The file \<^path>\<open>$ISABELLE_HOME_USER/etc/settings\<close> (if it |
61575 | 56 |
exists) is run in the same way as the site default settings. Note that the |
57 |
variable @{setting ISABELLE_HOME_USER} has already been set before --- |
|
81740 | 58 |
usually to something like \<^verbatim>\<open>$USER_HOME/.isabelle/Isabelle2025\<close>. |
61458 | 59 |
|
61575 | 60 |
Thus individual users may override the site-wide defaults. Typically, a |
61 |
user settings file contains only a few lines, with some assignments that |
|
63680 | 62 |
are actually changed. Never copy the central |
63 |
\<^file>\<open>$ISABELLE_HOME/etc/settings\<close> file! |
|
28215 | 64 |
|
61575 | 65 |
Since settings files are regular GNU @{executable_def bash} scripts, one may |
66 |
use complex shell commands, such as \<^verbatim>\<open>if\<close> or \<^verbatim>\<open>case\<close> statements to set |
|
67 |
variables depending on the system architecture or other environment |
|
68 |
variables. Such advanced features should be added only with great care, |
|
69 |
though. In particular, external environment references should be kept at a |
|
28215 | 70 |
minimum. |
71 |
||
61406 | 72 |
\<^medskip> |
68514 | 73 |
A few variables are somewhat special, e.g.\ @{setting_def ISABELLE_TOOL} is |
68219 | 74 |
set automatically to the absolute path name of the @{executable isabelle} |
75 |
executables. |
|
28215 | 76 |
|
61406 | 77 |
\<^medskip> |
61575 | 78 |
Note that the settings environment may be inspected with the @{tool getenv} |
79 |
tool. This might help to figure out the effect of complex settings scripts. |
|
80 |
\<close> |
|
28215 | 81 |
|
82 |
||
58618 | 83 |
subsection \<open>Common variables\<close> |
28215 | 84 |
|
58618 | 85 |
text \<open> |
61575 | 86 |
This is a reference of common Isabelle settings variables. Note that the |
87 |
list is somewhat open-ended. Third-party utilities or interfaces may add |
|
88 |
their own selection. Variables that are special in some sense are marked |
|
89 |
with \<open>\<^sup>*\<close>. |
|
28215 | 90 |
|
61575 | 91 |
\<^descr>[@{setting_def USER_HOME}\<open>\<^sup>*\<close>] Is the cross-platform user home directory. |
92 |
On Unix systems this is usually the same as @{setting HOME}, but on Windows |
|
93 |
it is the regular home directory of the user, not the one of within the |
|
94 |
Cygwin root file-system.\<^footnote>\<open>Cygwin itself offers another choice whether its |
|
69593 | 95 |
HOME should point to the \<^path>\<open>/home\<close> directory tree or the Windows user |
63669 | 96 |
home.\<close> |
47661
012a887997f3
USER_HOME settings variable points to cross-platform user home directory;
wenzelm
parents:
45028
diff
changeset
|
97 |
|
61575 | 98 |
\<^descr>[@{setting_def ISABELLE_HOME}\<open>\<^sup>*\<close>] is the location of the top-level |
99 |
Isabelle distribution directory. This is automatically determined from the |
|
100 |
Isabelle executable that has been invoked. Do not attempt to set @{setting |
|
101 |
ISABELLE_HOME} yourself from the shell! |
|
50182 | 102 |
|
61575 | 103 |
\<^descr>[@{setting_def ISABELLE_HOME_USER}] is the user-specific counterpart of |
69593 | 104 |
@{setting ISABELLE_HOME}. The default value is relative to \<^path>\<open>$USER_HOME/.isabelle\<close>, under rare circumstances this may be changed in the |
61575 | 105 |
global setting file. Typically, the @{setting ISABELLE_HOME_USER} directory |
106 |
mimics @{setting ISABELLE_HOME} to some extend. In particular, site-wide |
|
107 |
defaults may be overridden by a private \<^verbatim>\<open>$ISABELLE_HOME_USER/etc/settings\<close>. |
|
108 |
||
109 |
\<^descr>[@{setting_def ISABELLE_PLATFORM_FAMILY}\<open>\<^sup>*\<close>] is automatically set to the |
|
73671 | 110 |
general platform family (\<^verbatim>\<open>linux\<close>, \<^verbatim>\<open>macos\<close>, \<^verbatim>\<open>windows\<close>). Note that |
50182 | 111 |
platform-dependent tools usually need to refer to the more specific |
68003 | 112 |
identification according to @{setting ISABELLE_PLATFORM64}, @{setting |
73671 | 113 |
ISABELLE_WINDOWS_PLATFORM64}, @{setting ISABELLE_APPLE_PLATFORM64}. |
66732 | 114 |
|
73671 | 115 |
\<^descr>[@{setting_def ISABELLE_PLATFORM64}\<open>\<^sup>*\<close>] indicates the standard Posix |
116 |
platform (\<^verbatim>\<open>x86_64\<close>, \<^verbatim>\<open>arm64\<close>), together with a symbolic name for the |
|
117 |
operating system (\<^verbatim>\<open>linux\<close>, \<^verbatim>\<open>darwin\<close>, \<^verbatim>\<open>cygwin\<close>). |
|
36196
cbb9ee265cdd
added ISABELLE_PLATFORM and ISABELLE_PLATFORM64 -- NB: ML and JVM may have a different idea;
wenzelm
parents:
33952
diff
changeset
|
118 |
|
68003 | 119 |
\<^descr>[@{setting_def ISABELLE_WINDOWS_PLATFORM64}\<open>\<^sup>*\<close>, @{setting_def |
73671 | 120 |
ISABELLE_WINDOWS_PLATFORM32}\<open>\<^sup>*\<close>] indicate the native Windows platform: both |
121 |
64\,bit and 32\,bit executables are supported here. |
|
47823 | 122 |
|
66732 | 123 |
In GNU bash scripts, a preference for native Windows platform variants may |
68003 | 124 |
be specified like this (first 64 bit, second 32 bit): |
66732 | 125 |
|
68003 | 126 |
@{verbatim [display] \<open>"${ISABELLE_WINDOWS_PLATFORM64:-${ISABELLE_WINDOWS_PLATFORM32:- |
73671 | 127 |
$ISABELLE_PLATFORM64}}"\<close>} |
128 |
||
129 |
\<^descr>[@{setting_def ISABELLE_APPLE_PLATFORM64}\<open>\<^sup>*\<close>] indicates the native Apple |
|
130 |
Silicon platform (\<^verbatim>\<open>arm64-darwin\<close> if available), instead of Intel emulation |
|
131 |
via Rosetta (\<^verbatim>\<open>ISABELLE_PLATFORM64=x86_64-darwin\<close>). |
|
36196
cbb9ee265cdd
added ISABELLE_PLATFORM and ISABELLE_PLATFORM64 -- NB: ML and JVM may have a different idea;
wenzelm
parents:
33952
diff
changeset
|
132 |
|
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
133 |
\<^descr>[@{setting ISABELLE_TOOL}\<open>\<^sup>*\<close>] is automatically set to the full path name |
66787 | 134 |
of the @{executable isabelle} executable. |
28215 | 135 |
|
61575 | 136 |
\<^descr>[@{setting_def ISABELLE_IDENTIFIER}\<open>\<^sup>*\<close>] refers to the name of this |
81740 | 137 |
Isabelle distribution, e.g.\ ``\<^verbatim>\<open>Isabelle2025\<close>''. |
61575 | 138 |
|
82720
956ecf2c07a0
more flexible ML_Settings in Isabelle/Scala, depending on system options and some default settings;
wenzelm
parents:
82709
diff
changeset
|
139 |
\<^descr>[@{setting ML_OPTIONS}, @{setting ML_OPTIONS32}, @{setting ML_OPTIONS64}] |
956ecf2c07a0
more flexible ML_Settings in Isabelle/Scala, depending on system options and some default settings;
wenzelm
parents:
82709
diff
changeset
|
140 |
provide command-line options to the underlying ML system of Isabelle. |
956ecf2c07a0
more flexible ML_Settings in Isabelle/Scala, depending on system options and some default settings;
wenzelm
parents:
82709
diff
changeset
|
141 |
@{setting ML_OPTIONS} is empty by default, but if a proper value is provided |
956ecf2c07a0
more flexible ML_Settings in Isabelle/Scala, depending on system options and some default settings;
wenzelm
parents:
82709
diff
changeset
|
142 |
(e.g.\ via user settings) that takes precedence. Otherwise, @{setting |
956ecf2c07a0
more flexible ML_Settings in Isabelle/Scala, depending on system options and some default settings;
wenzelm
parents:
82709
diff
changeset
|
143 |
ML_OPTIONS32} or @{setting ML_OPTIONS64} will be used, depending on the |
956ecf2c07a0
more flexible ML_Settings in Isabelle/Scala, depending on system options and some default settings;
wenzelm
parents:
82709
diff
changeset
|
144 |
system option @{system_option_ref ML_system_64}. |
47823 | 145 |
|
66733 | 146 |
\<^descr>[@{setting_def ISABELLE_JDK_HOME}] points to a full JDK (Java Development |
147 |
Kit) installation with \<^verbatim>\<open>javac\<close> and \<^verbatim>\<open>jar\<close> executables. Note that |
|
148 |
conventional \<^verbatim>\<open>JAVA_HOME\<close> points to the JRE (Java Runtime Environment), not |
|
149 |
the JDK. |
|
150 |
||
151 |
\<^descr>[@{setting_def ISABELLE_JAVA_PLATFORM}] identifies the hardware and |
|
152 |
operating system platform for the Java installation of Isabelle. That is |
|
66906 | 153 |
always the (native) 64 bit variant: \<^verbatim>\<open>x86_64-linux\<close>, \<^verbatim>\<open>x86_64-darwin\<close>, |
66733 | 154 |
\<^verbatim>\<open>x86_64-windows\<close>. |
61575 | 155 |
|
68523
ccacc84e0251
clarified settings -- avoid hard-wired directories;
wenzelm
parents:
68514
diff
changeset
|
156 |
\<^descr>[@{setting_def ISABELLE_BROWSER_INFO}] is the directory where HTML and PDF |
ccacc84e0251
clarified settings -- avoid hard-wired directories;
wenzelm
parents:
68514
diff
changeset
|
157 |
browser information is stored (see also \secref{sec:info}); its default is |
69593 | 158 |
\<^path>\<open>$ISABELLE_HOME_USER/browser_info\<close>. For ``system build mode'' (see |
68523
ccacc84e0251
clarified settings -- avoid hard-wired directories;
wenzelm
parents:
68514
diff
changeset
|
159 |
\secref{sec:tool-build}), @{setting_def ISABELLE_BROWSER_INFO_SYSTEM} is |
69593 | 160 |
used instead; its default is \<^path>\<open>$ISABELLE_HOME/browser_info\<close>. |
68523
ccacc84e0251
clarified settings -- avoid hard-wired directories;
wenzelm
parents:
68514
diff
changeset
|
161 |
|
ccacc84e0251
clarified settings -- avoid hard-wired directories;
wenzelm
parents:
68514
diff
changeset
|
162 |
\<^descr>[@{setting_def ISABELLE_HEAPS}] is the directory where session heap images, |
77554
4465d9dff448
clarified terminology of "session build database", while "build database" is the one underlying Build_Process;
wenzelm
parents:
76987
diff
changeset
|
163 |
log files, and session build databases are stored; its default is |
69854
cc0b3e177b49
system option "system_heaps" supersedes various command-line options for "system build mode";
wenzelm
parents:
69593
diff
changeset
|
164 |
\<^path>\<open>$ISABELLE_HOME_USER/heaps\<close>. If @{system_option system_heaps} is |
cc0b3e177b49
system option "system_heaps" supersedes various command-line options for "system build mode";
wenzelm
parents:
69593
diff
changeset
|
165 |
\<^verbatim>\<open>true\<close>, @{setting_def ISABELLE_HEAPS_SYSTEM} is used instead; its default |
cc0b3e177b49
system option "system_heaps" supersedes various command-line options for "system build mode";
wenzelm
parents:
69593
diff
changeset
|
166 |
is \<^path>\<open>$ISABELLE_HOME/heaps\<close>. See also \secref{sec:tool-build}. |
61575 | 167 |
|
168 |
\<^descr>[@{setting_def ISABELLE_LOGIC}] specifies the default logic to load if none |
|
80161 | 169 |
is given explicitly by the user. The default value is \<^verbatim>\<open>HOL\<close>. |
61575 | 170 |
|
62562
905a5db3932d
back to external line editor, due to problems of JLine with multithreading of in vs. out;
wenzelm
parents:
62559
diff
changeset
|
171 |
\<^descr>[@{setting_def ISABELLE_LINE_EDITOR}] specifies the line editor for the |
905a5db3932d
back to external line editor, due to problems of JLine with multithreading of in vs. out;
wenzelm
parents:
62559
diff
changeset
|
172 |
@{tool_ref console} interface. |
905a5db3932d
back to external line editor, due to problems of JLine with multithreading of in vs. out;
wenzelm
parents:
62559
diff
changeset
|
173 |
|
73741 | 174 |
\<^descr>[@{setting_def ISABELLE_PDFLATEX}, @{setting_def ISABELLE_LUALATEX}, |
175 |
@{setting_def ISABELLE_BIBTEX}, @{setting_def ISABELLE_MAKEINDEX}] refer to |
|
176 |
{\LaTeX}-related tools for Isabelle document preparation (see also |
|
177 |
\secref{sec:tool-document}). |
|
61575 | 178 |
|
179 |
\<^descr>[@{setting_def ISABELLE_TOOLS}] is a colon separated list of directories |
|
180 |
that are scanned by @{executable isabelle} for external utility programs |
|
181 |
(see also \secref{sec:isabelle-tool}). |
|
50197
b385d134926d
eval PDF_VIEWER/DVI_VIEWER command line, which allows additional quotes for program name, for example;
wenzelm
parents:
50182
diff
changeset
|
182 |
|
61575 | 183 |
\<^descr>[@{setting_def ISABELLE_DOCS}] is a colon separated list of directories |
184 |
with documentation files. |
|
185 |
||
186 |
\<^descr>[@{setting_def PDF_VIEWER}] specifies the program to be used for displaying |
|
187 |
\<^verbatim>\<open>pdf\<close> files. |
|
54683
cf48ddc266e5
clarified "isabelle display" and 'display_drafts': re-use file and program instance, open asynchronously via desktop environment;
wenzelm
parents:
52746
diff
changeset
|
188 |
|
61575 | 189 |
\<^descr>[@{setting_def ISABELLE_TMP_PREFIX}\<open>\<^sup>*\<close>] is the prefix from which any |
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
190 |
running Isabelle ML process derives an individual directory for temporary |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
191 |
files. |
68477 | 192 |
|
193 |
\<^descr>[@{setting_def ISABELLE_TOOL_JAVA_OPTIONS}] is passed to the \<^verbatim>\<open>java\<close> |
|
68514 | 194 |
executable when running Isabelle tools (e.g.\ @{tool build}). This is |
68477 | 195 |
occasionally helpful to provide more heap space, via additional options like |
196 |
\<^verbatim>\<open>-Xms1g -Xmx4g\<close>. |
|
58618 | 197 |
\<close> |
28215 | 198 |
|
199 |
||
58618 | 200 |
subsection \<open>Additional components \label{sec:components}\<close> |
32323 | 201 |
|
61575 | 202 |
text \<open> |
203 |
Any directory may be registered as an explicit \<^emph>\<open>Isabelle component\<close>. The |
|
204 |
general layout conventions are that of the main Isabelle distribution |
|
205 |
itself, and the following two files (both optional) have a special meaning: |
|
32323 | 206 |
|
61575 | 207 |
\<^item> \<^verbatim>\<open>etc/settings\<close> holds additional settings that are initialized when |
208 |
bootstrapping the overall Isabelle environment, cf.\ \secref{sec:boot}. As |
|
64509 | 209 |
usual, the content is interpreted as a GNU bash script. It may refer to |
210 |
the component's enclosing directory via the \<^verbatim>\<open>COMPONENT\<close> shell variable. |
|
32323 | 211 |
|
61575 | 212 |
For example, the following setting allows to refer to files within the |
213 |
component later on, without having to hardwire absolute paths: |
|
214 |
@{verbatim [display] \<open>MY_COMPONENT_HOME="$COMPONENT"\<close>} |
|
32323 | 215 |
|
61575 | 216 |
Components can also add to existing Isabelle settings such as |
217 |
@{setting_def ISABELLE_TOOLS}, in order to provide component-specific |
|
218 |
tools that can be invoked by end-users. For example: |
|
219 |
@{verbatim [display] \<open>ISABELLE_TOOLS="$ISABELLE_TOOLS:$COMPONENT/lib/Tools"\<close>} |
|
32323 | 220 |
|
61575 | 221 |
\<^item> \<^verbatim>\<open>etc/components\<close> holds a list of further sub-components of the same |
222 |
structure. The directory specifications given here can be either absolute |
|
223 |
(with leading \<^verbatim>\<open>/\<close>) or relative to the component's main directory. |
|
32323 | 224 |
|
61575 | 225 |
The root of component initialization is @{setting ISABELLE_HOME} itself. |
226 |
After initializing all of its sub-components recursively, @{setting |
|
227 |
ISABELLE_HOME_USER} is included in the same manner (if that directory |
|
71904 | 228 |
exists). This allows to install private components via |
229 |
\<^path>\<open>$ISABELLE_HOME_USER/etc/components\<close>, although it is often more |
|
230 |
convenient to do that programmatically via the |
|
231 |
\<^bash_function>\<open>init_component\<close> shell function in the \<^verbatim>\<open>etc/settings\<close> |
|
232 |
script of \<^verbatim>\<open>$ISABELLE_HOME_USER\<close> (or any other component directory). For |
|
233 |
example: |
|
66947 | 234 |
@{verbatim [display] \<open>init_component "$HOME/screwdriver-2.0"\<close>} |
48838
623ba165d059
direct support for component forests via init_components;
wenzelm
parents:
48813
diff
changeset
|
235 |
|
61575 | 236 |
This is tolerant wrt.\ missing component directories, but might produce a |
237 |
warning. |
|
48838
623ba165d059
direct support for component forests via init_components;
wenzelm
parents:
48813
diff
changeset
|
238 |
|
61406 | 239 |
\<^medskip> |
61575 | 240 |
More complex situations may be addressed by initializing components listed |
241 |
in a given catalog file, relatively to some base directory: |
|
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
242 |
@{verbatim [display] \<open>init_components "$HOME/my_component_store" "some_catalog_file"\<close>} |
48838
623ba165d059
direct support for component forests via init_components;
wenzelm
parents:
48813
diff
changeset
|
243 |
|
61575 | 244 |
The component directories listed in the catalog file are treated as relative |
245 |
to the given base directory. |
|
48844 | 246 |
|
61575 | 247 |
See also \secref{sec:tool-components} for some tool-support for resolving |
248 |
components that are formally initialized but not installed yet. |
|
58618 | 249 |
\<close> |
32323 | 250 |
|
251 |
||
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
252 |
section \<open>The Isabelle tool wrapper \label{sec:isabelle-tool}\<close> |
28215 | 253 |
|
58618 | 254 |
text \<open> |
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
255 |
The main \<^emph>\<open>Isabelle tool wrapper\<close> provides a generic startup environment for |
64509 | 256 |
Isabelle-related utilities, user interfaces, add-on applications etc. Such |
257 |
tools automatically benefit from the settings mechanism |
|
258 |
(\secref{sec:settings}). Moreover, this is the standard way to invoke |
|
259 |
Isabelle/Scala functionality as a separate operating-system process. |
|
260 |
Isabelle command-line tools are run uniformly via a common wrapper --- |
|
261 |
@{executable_ref isabelle}: |
|
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
262 |
@{verbatim [display] |
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
263 |
\<open>Usage: isabelle TOOL [ARGS ...] |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
264 |
|
62829
4141c2a8458b
clarified Isabelle tool wrapper: bash, Scala, no perl, no ML;
wenzelm
parents:
62677
diff
changeset
|
265 |
Start Isabelle TOOL with ARGS; pass "-?" for tool-specific help. |
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
266 |
|
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
267 |
Available tools: |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
268 |
...\<close>} |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
269 |
|
64509 | 270 |
Tools may be implemented in Isabelle/Scala or as stand-alone executables |
271 |
(usually as GNU bash scripts). In the invocation of ``@{executable |
|
272 |
isabelle}~\<open>tool\<close>'', the named \<open>tool\<close> is resolved as follows (and in the |
|
273 |
given order). |
|
274 |
||
275 |
\<^enum> An external tool found on the directories listed in the @{setting |
|
276 |
ISABELLE_TOOLS} settings variable (colon-separated list in standard POSIX |
|
75642
bb048086468a
discontinued Isabelle tools implemented as .scala scripts;
wenzelm
parents:
75291
diff
changeset
|
277 |
notation). It is invoked as stand-alone program with the command-line |
bb048086468a
discontinued Isabelle tools implemented as .scala scripts;
wenzelm
parents:
75291
diff
changeset
|
278 |
arguments provided as \<^verbatim>\<open>argv\<close> array. |
64509 | 279 |
|
75642
bb048086468a
discontinued Isabelle tools implemented as .scala scripts;
wenzelm
parents:
75291
diff
changeset
|
280 |
\<^enum> An internal tool that is declared via class |
bb048086468a
discontinued Isabelle tools implemented as .scala scripts;
wenzelm
parents:
75291
diff
changeset
|
281 |
\<^scala_type>\<open>isabelle.Isabelle_Scala_Tools\<close> and registered via |
bb048086468a
discontinued Isabelle tools implemented as .scala scripts;
wenzelm
parents:
75291
diff
changeset
|
282 |
\<^verbatim>\<open>services\<close> in \<^path>\<open>etc/build.props\<close>. See \secref{sec:scala-build} for |
bb048086468a
discontinued Isabelle tools implemented as .scala scripts;
wenzelm
parents:
75291
diff
changeset
|
283 |
more details. |
64509 | 284 |
|
72252 | 285 |
There are also various administrative tools that are available from a bare |
64509 | 286 |
repository clone of Isabelle, but not in regular distributions. |
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
287 |
\<close> |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
288 |
|
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
289 |
|
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
290 |
subsubsection \<open>Examples\<close> |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
291 |
|
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
292 |
text \<open> |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
293 |
Show the list of available documentation of the Isabelle distribution: |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
294 |
@{verbatim [display] \<open>isabelle doc\<close>} |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
295 |
|
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
296 |
View a certain document as follows: |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
297 |
@{verbatim [display] \<open>isabelle doc system\<close>} |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
298 |
|
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
299 |
Query the Isabelle settings environment: |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
300 |
@{verbatim [display] \<open>isabelle getenv ISABELLE_HOME_USER\<close>} |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
301 |
\<close> |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
302 |
|
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
303 |
|
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
304 |
section \<open>The raw Isabelle ML process\<close> |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
305 |
|
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
306 |
subsection \<open>Batch mode \label{sec:tool-process}\<close> |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
307 |
|
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
308 |
text \<open> |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
309 |
The @{tool_def process} tool runs the raw ML process in batch mode: |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
310 |
@{verbatim [display] |
62634
aa3b47b32100
less physical "logic" argument, with option -l like "isabelle console" etc.;
wenzelm
parents:
62588
diff
changeset
|
311 |
\<open>Usage: isabelle process [OPTIONS] |
28215 | 312 |
|
313 |
Options are: |
|
62677 | 314 |
-T THEORY load theory |
62639 | 315 |
-d DIR include session directory |
62506 | 316 |
-e ML_EXPR evaluate ML expression on startup |
317 |
-f ML_FILE evaluate ML file on startup |
|
62634
aa3b47b32100
less physical "logic" argument, with option -l like "isabelle console" etc.;
wenzelm
parents:
62588
diff
changeset
|
318 |
-l NAME logic session name (default ISABELLE_LOGIC="HOL") |
28215 | 319 |
-m MODE add print mode for output |
52056 | 320 |
-o OPTION override Isabelle system OPTION (via NAME=VAL or NAME) |
28215 | 321 |
|
62634
aa3b47b32100
less physical "logic" argument, with option -l like "isabelle console" etc.;
wenzelm
parents:
62588
diff
changeset
|
322 |
Run the raw Isabelle ML process in batch mode.\<close>} |
28215 | 323 |
|
62643 | 324 |
\<^medskip> |
62506 | 325 |
Options \<^verbatim>\<open>-e\<close> and \<^verbatim>\<open>-f\<close> allow to evaluate ML code, before the ML process is |
326 |
started. The source is either given literally or taken from a file. Multiple |
|
327 |
\<^verbatim>\<open>-e\<close> and \<^verbatim>\<open>-f\<close> options are evaluated in the given order. Errors lead to |
|
75161 | 328 |
a premature exit of the ML process with return code 1. |
28215 | 329 |
|
61406 | 330 |
\<^medskip> |
62677 | 331 |
Option \<^verbatim>\<open>-T\<close> loads a specified theory file. This is a wrapper for \<^verbatim>\<open>-e\<close> with |
69593 | 332 |
a suitable \<^ML>\<open>use_thy\<close> invocation. |
62677 | 333 |
|
334 |
\<^medskip> |
|
62639 | 335 |
Option \<^verbatim>\<open>-l\<close> specifies the logic session name. Option \<^verbatim>\<open>-d\<close> specifies |
336 |
additional directories for session roots, see also \secref{sec:tool-build}. |
|
62634
aa3b47b32100
less physical "logic" argument, with option -l like "isabelle console" etc.;
wenzelm
parents:
62588
diff
changeset
|
337 |
|
aa3b47b32100
less physical "logic" argument, with option -l like "isabelle console" etc.;
wenzelm
parents:
62588
diff
changeset
|
338 |
\<^medskip> |
61575 | 339 |
The \<^verbatim>\<open>-m\<close> option adds identifiers of print modes to be made active for this |
62573 | 340 |
session. For example, \<^verbatim>\<open>-m ASCII\<close> prefers ASCII replacement syntax over |
341 |
mathematical Isabelle symbols. |
|
28215 | 342 |
|
61406 | 343 |
\<^medskip> |
61575 | 344 |
Option \<^verbatim>\<open>-o\<close> allows to override Isabelle system options for this process, |
62573 | 345 |
see also \secref{sec:system-options}. |
58618 | 346 |
\<close> |
28215 | 347 |
|
348 |
||
68275 | 349 |
subsubsection \<open>Examples\<close> |
28215 | 350 |
|
58618 | 351 |
text \<open> |
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
352 |
The subsequent example retrieves the \<^verbatim>\<open>Main\<close> theory value from the theory |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
353 |
loader within ML: |
62634
aa3b47b32100
less physical "logic" argument, with option -l like "isabelle console" etc.;
wenzelm
parents:
62588
diff
changeset
|
354 |
@{verbatim [display] \<open>isabelle process -e 'Thy_Info.get_theory "Main"'\<close>} |
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
355 |
|
64509 | 356 |
Observe the delicate quoting rules for the GNU bash shell vs.\ ML. The |
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
357 |
Isabelle/ML and Scala libraries provide functions for that, but here we need |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
358 |
to do it manually. |
68275 | 359 |
|
360 |
\<^medskip> |
|
361 |
This is how to invoke a function body with proper return code and printing |
|
362 |
of errors, and without printing of a redundant \<^verbatim>\<open>val it = (): unit\<close> result: |
|
71632 | 363 |
@{verbatim [display] \<open>isabelle process -e 'Command_Line.tool (fn () => writeln "OK")'\<close>} |
364 |
@{verbatim [display] \<open>isabelle process -e 'Command_Line.tool (fn () => error "Bad")'\<close>} |
|
58618 | 365 |
\<close> |
28238 | 366 |
|
367 |
||
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
368 |
subsection \<open>Interactive mode\<close> |
28238 | 369 |
|
58618 | 370 |
text \<open> |
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
371 |
The @{tool_def console} tool runs the raw ML process with interactive |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
372 |
console and line editor: |
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
373 |
@{verbatim [display] |
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
374 |
\<open>Usage: isabelle console [OPTIONS] |
28238 | 375 |
|
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
376 |
Options are: |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
377 |
-d DIR include session directory |
68541 | 378 |
-i NAME include session in name-space of theories |
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
379 |
-l NAME logic session name (default ISABELLE_LOGIC) |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
380 |
-m MODE add print mode for output |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
381 |
-n no build of session image on startup |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
382 |
-o OPTION override Isabelle system OPTION (via NAME=VAL or NAME) |
62643 | 383 |
-r bootstrap from raw Poly/ML |
28238 | 384 |
|
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
385 |
Build a logic session image and run the raw Isabelle ML process |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
386 |
in interactive mode, with line editor ISABELLE_LINE_EDITOR.\<close>} |
28238 | 387 |
|
62643 | 388 |
\<^medskip> |
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
389 |
Option \<^verbatim>\<open>-l\<close> specifies the logic session name. By default, its heap image is |
62643 | 390 |
checked and built on demand, but the option \<^verbatim>\<open>-n\<close> skips that. |
28238 | 391 |
|
68541 | 392 |
Option \<^verbatim>\<open>-i\<close> includes additional sessions into the name-space of theories: |
393 |
multiple occurrences are possible. |
|
394 |
||
62643 | 395 |
Option \<^verbatim>\<open>-r\<close> indicates a bootstrap from the raw Poly/ML system, which is |
396 |
relevant for Isabelle/Pure development. |
|
397 |
||
398 |
\<^medskip> |
|
62639 | 399 |
Options \<^verbatim>\<open>-d\<close>, \<^verbatim>\<open>-m\<close>, \<^verbatim>\<open>-o\<close> have the same meaning as for @{tool process} |
400 |
(\secref{sec:tool-process}). |
|
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
401 |
|
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
402 |
\<^medskip> |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
403 |
The Isabelle/ML process is run through the line editor that is specified via |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
404 |
the settings variable @{setting ISABELLE_LINE_EDITOR} (e.g.\ |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
405 |
@{executable_def rlwrap} for GNU readline); the fall-back is to use plain |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
406 |
standard input/output. |
28238 | 407 |
|
62588
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
408 |
The user is connected to the raw ML toplevel loop: this is neither |
cd266473b81b
isabelle_process is superseded by "isabelle process" tool;
wenzelm
parents:
62576
diff
changeset
|
409 |
Isabelle/Isar nor Isabelle/ML within the usual formal context. The most |
69593 | 410 |
relevant ML commands at this stage are \<^ML>\<open>use\<close> (for ML files) and |
411 |
\<^ML>\<open>use_thy\<close> (for theory files). |
|
58618 | 412 |
\<close> |
28215 | 413 |
|
62451 | 414 |
|
63995 | 415 |
section \<open>The raw Isabelle Java process \label{sec:isabelle-java}\<close> |
416 |
||
417 |
text \<open> |
|
418 |
The @{executable_ref isabelle_java} executable allows to run a Java process |
|
419 |
within the name space of Java and Scala components that are bundled with |
|
420 |
Isabelle, but \<^emph>\<open>without\<close> the Isabelle settings environment |
|
421 |
(\secref{sec:settings}). |
|
422 |
||
423 |
After such a JVM cold-start, the Isabelle environment can be accessed via |
|
424 |
\<^verbatim>\<open>Isabelle_System.getenv\<close> as usual, but the underlying process environment |
|
425 |
remains clean. This is e.g.\ relevant when invoking other processes that |
|
426 |
should remain separate from the current Isabelle installation. |
|
427 |
||
428 |
\<^medskip> |
|
429 |
Note that under normal circumstances, Isabelle command-line tools are run |
|
430 |
\<^emph>\<open>within\<close> the settings environment, as provided by the @{executable |
|
431 |
isabelle} wrapper (\secref{sec:isabelle-tool} and \secref{sec:tool-java}). |
|
432 |
\<close> |
|
433 |
||
434 |
||
435 |
subsubsection \<open>Example\<close> |
|
436 |
||
437 |
text \<open> |
|
438 |
The subsequent example creates a raw Java process on the command-line and |
|
439 |
invokes the main Isabelle application entry point: |
|
75291 | 440 |
@{verbatim [display] \<open>isabelle_java -Djava.awt.headless=false isabelle.jedit.JEdit_Main\<close>} |
63995 | 441 |
\<close> |
442 |
||
443 |
||
80178
438d583ab378
more documentation on "isabelle build -H" and underlying system registry tables "host" and "cluster";
wenzelm
parents:
80168
diff
changeset
|
444 |
section \<open>System registry via TOML \label{sec:system-registry}\<close> |
80168
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
445 |
|
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
446 |
text \<open> |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
447 |
Tools implemented in Isabelle/Scala may refer to a global registry of |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
448 |
hierarchically structured values, which is based on a collection of TOML |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
449 |
files. TOML is conceptually similar to JSON, but aims at human-readable |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
450 |
syntax. |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
451 |
|
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
452 |
The recursive structure of a TOML \<^emph>\<open>value\<close> is defined as follows: |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
453 |
\<^enum> atom: string, integer, float, bool, date (ISO-8601) |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
454 |
\<^enum> array: sequence of \<^emph>\<open>values\<close> \<open>t\<close>, written \<^verbatim>\<open>[\<close>\<open>t\<^sub>1\<close>\<^verbatim>\<open>,\<close>\<open>\<dots>\<close>\<^verbatim>\<open>,\<close>\<open>t\<^sub>n\<close>\<^verbatim>\<open>]\<close> |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
455 |
\<^enum> table: mapping from \<^emph>\<open>names\<close> \<open>a\<close> to \<^emph>\<open>values\<close> \<open>t\<close>, written |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
456 |
\<^verbatim>\<open>{\<close>\<open>a\<^sub>1\<close>\<^verbatim>\<open>=\<close>\<open>t\<^sub>1\<close>\<^verbatim>\<open>,\<close>\<open>\<dots>\<close>\<^verbatim>\<open>,\<close>\<open>a\<^sub>n\<close>\<^verbatim>\<open>=\<close>\<open>t\<^sub>n\<close>\<^verbatim>\<open>}\<close> |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
457 |
|
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
458 |
There are various alternative syntax forms for convenience, e.g. to |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
459 |
construct a table of tables, using \<^emph>\<open>header syntax\<close> that resembles |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
460 |
traditional \<^verbatim>\<open>.INI\<close>-file notation. For example: |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
461 |
@{verbatim [display, indent = 2] |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
462 |
\<open>[point.A] |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
463 |
x = 1 |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
464 |
y = 1 |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
465 |
description = "one point" |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
466 |
|
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
467 |
[point.B] |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
468 |
x = 2 |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
469 |
y = -2 |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
470 |
description = "another point" |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
471 |
|
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
472 |
[point.C] |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
473 |
x = 3 |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
474 |
y = 7 |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
475 |
description = "yet another point" |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
476 |
\<close>} |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
477 |
|
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
478 |
Or alternatively like this: |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
479 |
@{verbatim [display, indent = 2] |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
480 |
\<open>point.A.x = 1 |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
481 |
point.A.y = 1 |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
482 |
point.A.description = "one point" |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
483 |
|
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
484 |
point.B.x = 2 |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
485 |
point.B.y = -2 |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
486 |
point.B.description = "another point" |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
487 |
|
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
488 |
point.C.x = 3 |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
489 |
point.C.y = 7 |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
490 |
point.C.description = "yet another point" |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
491 |
\<close>} |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
492 |
|
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
493 |
The TOML website\<^footnote>\<open>\<^url>\<open>https://toml.io/en/v1.0.0\<close>\<close> provides many examples, |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
494 |
together with the full language specification. Note that the Isabelle/Scala |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
495 |
implementation of TOML uses the default ISO date/time format of |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
496 |
Java.\<^footnote>\<open>\<^url>\<open>https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/format/DateTimeFormatter.html\<close>\<close> |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
497 |
|
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
498 |
\<^medskip> |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
499 |
The overall system registry is collected from \<^verbatim>\<open>registry.toml\<close> files in |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
500 |
directories specified via the settings variable @{setting |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
501 |
"ISABELLE_REGISTRY"}: this refers to \<^path>\<open>$ISABELLE_HOME\<close> and |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
502 |
\<^path>\<open>$ISABELLE_HOME_USER\<close> by default, but further directories may be |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
503 |
specified via the GNU bash function \<^bash_function>\<open>isabelle_registry\<close> |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
504 |
within \<^path>\<open>etc/settings\<close> of Isabelle components. |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
505 |
|
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
506 |
The result is available as Isabelle/Scala object |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
507 |
\<^scala>\<open>isabelle.Registry.global\<close>. That is empty by default, unless users |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
508 |
populate \<^path>\<open>$ISABELLE_HOME_USER/etc/registry.toml\<close> or provide other |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
509 |
component \<^path>\<open>etc/registry.toml\<close> files. |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
510 |
\<close> |
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
511 |
|
007e6af8a020
more documentation on "System registry via TOML";
wenzelm
parents:
80161
diff
changeset
|
512 |
|
67904 | 513 |
section \<open>YXML versus XML \label{sec:yxml-vs-xml}\<close> |
62451 | 514 |
|
515 |
text \<open> |
|
516 |
Isabelle tools often use YXML, which is a simple and efficient syntax for |
|
517 |
untyped XML trees. The YXML format is defined as follows. |
|
518 |
||
519 |
\<^enum> The encoding is always UTF-8. |
|
520 |
||
521 |
\<^enum> Body text is represented verbatim (no escaping, no special treatment of |
|
522 |
white space, no named entities, no CDATA chunks, no comments). |
|
523 |
||
524 |
\<^enum> Markup elements are represented via ASCII control characters \<open>\<^bold>X = 5\<close> |
|
525 |
and \<open>\<^bold>Y = 6\<close> as follows: |
|
526 |
||
527 |
\begin{tabular}{ll} |
|
528 |
XML & YXML \\\hline |
|
529 |
\<^verbatim>\<open><\<close>\<open>name attribute\<close>\<^verbatim>\<open>=\<close>\<open>value \<dots>\<close>\<^verbatim>\<open>>\<close> & |
|
530 |
\<open>\<^bold>X\<^bold>Yname\<^bold>Yattribute\<close>\<^verbatim>\<open>=\<close>\<open>value\<dots>\<^bold>X\<close> \\ |
|
531 |
\<^verbatim>\<open></\<close>\<open>name\<close>\<^verbatim>\<open>>\<close> & \<open>\<^bold>X\<^bold>Y\<^bold>X\<close> \\ |
|
532 |
\end{tabular} |
|
533 |
||
534 |
There is no special case for empty body text, i.e.\ \<^verbatim>\<open><foo/>\<close> is treated |
|
535 |
like \<^verbatim>\<open><foo></foo>\<close>. Also note that \<open>\<^bold>X\<close> and \<open>\<^bold>Y\<close> may never occur in |
|
536 |
well-formed XML documents. |
|
537 |
||
538 |
Parsing YXML is pretty straight-forward: split the text into chunks |
|
539 |
separated by \<open>\<^bold>X\<close>, then split each chunk into sub-chunks separated by \<open>\<^bold>Y\<close>. |
|
540 |
Markup chunks start with an empty sub-chunk, and a second empty sub-chunk |
|
541 |
indicates close of an element. Any other non-empty chunk consists of plain |
|
63680 | 542 |
text. For example, see \<^file>\<open>~~/src/Pure/PIDE/yxml.ML\<close> or |
543 |
\<^file>\<open>~~/src/Pure/PIDE/yxml.scala\<close>. |
|
62451 | 544 |
|
545 |
YXML documents may be detected quickly by checking that the first two |
|
546 |
characters are \<open>\<^bold>X\<^bold>Y\<close>. |
|
547 |
\<close> |
|
548 |
||
67399 | 549 |
end |