/usr/lib/swi-prolog/doc/Manual/runtime.html is in swi-prolog-nox 5.10.4-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>SWI-Prolog 5.11.18 Reference Manual</TITLE><LINK REL=home HREF="index.html">
<LINK REL=contents HREF="Contents.html">
<LINK REL=index HREF="DocIndex.html">
<LINK REL=summary HREF="summary.html">
<LINK REL=previous HREF="foreignnotes.html">
<LINK REL=next HREF="qsavelimits.html">
<STYLE type="text/css">
/* Style sheet for SWI-Prolog latex2html
*/
dd.defbody
{ margin-bottom: 1em;
}
dt.pubdef
{ background-color: #c5e1ff;
}
dt.multidef
{ background-color: #c8ffc7;
}
.bib dd
{ margin-bottom: 1em;
}
.bib dt
{ float: left;
margin-right: 1.3ex;
}
pre.code
{ margin-left: 1.5em;
margin-right: 1.5em;
border: 1px dotted;
padding-top: 5px;
padding-left: 5px;
padding-bottom: 5px;
background-color: #f8f8f8;
}
div.navigate
{ text-align: center;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
}
div.title
{ text-align: center;
padding-bottom: 1em;
font-size: 200%;
font-weight: bold;
}
div.author
{ text-align: center;
font-style: italic;
}
div.abstract
{ margin-top: 2em;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
margin-left: 10%; margin-right:10%;
}
div.abstract-title
{ text-align: center;
padding: 5px;
font-size: 120%;
font-weight: bold;
}
div.toc-h1
{ font-size: 200%;
font-weight: bold;
}
div.toc-h2
{ font-size: 120%;
font-weight: bold;
margin-left: 2em;
}
div.toc-h3
{ font-size: 100%;
font-weight: bold;
margin-left: 4em;
}
div.toc-h4
{ font-size: 100%;
margin-left: 6em;
}
span.sec-nr
{
}
span.sec-title
{
}
span.pred-ext
{ font-weight: bold;
}
span.pred-tag
{ float: right;
padding-top: 0.2em;
font-size: 80%;
font-style: italic;
color: #202020;
}
/* Footnotes */
sup.fn { color: blue; text-decoration: underline; }
span.fn-text { display: none; }
sup.fn span {display: none;}
sup:hover span
{ display: block !important;
position: absolute; top: auto; left: auto; width: 80%;
color: #000; background: white;
border: 2px solid;
padding: 5px; margin: 10px; z-index: 100;
font-size: smaller;
}
</STYLE>
</HEAD>
<BODY BGCOLOR="white">
<DIV class="navigate"><A class="nav" href="index.html"><IMG SRC="home.gif" BORDER=0 ALT="Home"></A>
<A class="nav" href="Contents.html"><IMG SRC="index.gif" BORDER=0 ALT="Contents"></A>
<A class="nav" href="DocIndex.html"><IMG SRC="yellow_pages.gif" BORDER=0 ALT="Index"></A>
<A class="nav" href="summary.html"><IMG SRC="info.gif" BORDER=0 ALT="Summary"></A>
<A class="nav" href="foreignnotes.html"><IMG SRC="prev.gif" BORDER=0 ALT="Previous"></A>
<A class="nav" href="qsavelimits.html"><IMG SRC="next.gif" BORDER=0 ALT="Next"></A>
</DIV>
<H1><A NAME="sec:10"><SPAN class="sec-nr">10</SPAN> <SPAN class="sec-title">Generating
Runtime Applications</SPAN></A></H1>
<A NAME="sec:runtime"></A>
<P>This chapter describes the features of SWI-Prolog for delivering
applications that can run without the development version of the system
installed.
<P>A SWI-Prolog runtime executable is a file consisting of two parts.
The first part is the <EM>emulator</EM>, which is machine dependent. The
second part is the <EM>resource archive</EM>, which contains the
compiled program in a machine-independent format, startup options and
possibly user-defined <EM>resources</EM>, see <A NAME="idx:resource3:1527"></A><A class="pred" href="useresource.html#resource/3">resource/3</A>
and
<A NAME="idx:openresource3:1528"></A><A class="pred" href="useresource.html#open_resource/3">open_resource/3</A>.
<P>These two parts can be connected in various different ways. The most
common way for distributed runtime applications is to <EM>concatenate</EM>
the two parts. This can be achieved using external commands (Unix:
<B>cat</B>, Windows: <B>copy</B>), or using the
<CODE>stand_alone</CODE> option to <A NAME="idx:qsaveprogram2:1529"></A><A class="pred" href="runtime.html#qsave_program/2">qsave_program/2</A>.
The second option is to attach a startup script in front of the resource
that starts the emulator with the proper options. This is the default
under Unix. Finally, an emulator can be told to use a specified resource
file using the <STRONG>-x</STRONG> command-line switch.
<DL class="latex">
<DT class="pubdef"><A NAME="qsave_program/2"><STRONG>qsave_program</STRONG>(<VAR>+File,
+ListOfOptions</VAR>)</A></DT>
<DD class="defbody">
Saves the current state of the program to the file <VAR>File</VAR>. The
result is a resource archive containing a saved-state that expresses all
Prolog data from the running program and all user-defined resources.
Depending on the <CODE>stand_alone</CODE> option, the resource is headed
by the emulator, a Unix shell-script or nothing.
<P><VAR>ListOfOptions</VAR> is a list of <VAR><<VAR>Key</VAR>> = <<VAR>Value</VAR>></VAR>
or <VAR><<VAR>Key</VAR>>(<<VAR>Value</VAR>>)</VAR> pairs.
The available keys are described in <A class="tab" href="runtime.html#tab:qsave-options">table
8</A>.
<P>
<CENTER>
<TABLE BORDER=2 FRAME=box RULES=groups>
<TR VALIGN=top><TD><B>Key</B></TD><TD ALIGN=center><B>Option</B></TD><TD ALIGN=center><B>Type</B></TD><TD><B>Description </B></TD></TR>
<TBODY>
<TR VALIGN=top><TD>local</TD><TD ALIGN=center><B>-L</B></TD><TD ALIGN=center>K-bytes</TD><TD>Size
(Limit) of local stack </TD></TR>
<TR VALIGN=top><TD>global</TD><TD ALIGN=center><B>-G</B></TD><TD ALIGN=center>K-bytes</TD><TD>Size
(Limit) of global stack </TD></TR>
<TR VALIGN=top><TD>trail</TD><TD ALIGN=center><B>-T</B></TD><TD ALIGN=center>K-bytes</TD><TD>Size
(Limit) of trail stack </TD></TR>
<TR VALIGN=top><TD>argument</TD><TD ALIGN=center><B>-A</B></TD><TD ALIGN=center>K-bytes</TD><TD>Size
(Limit) of argument stack </TD></TR>
<TR VALIGN=top><TD>goal</TD><TD ALIGN=center><B>-g</B></TD><TD ALIGN=center>atom</TD><TD>Initialisation
goal </TD></TR>
<TR VALIGN=top><TD>toplevel</TD><TD ALIGN=center><B>-t</B></TD><TD ALIGN=center>atom</TD><TD>Prolog
top-level goal </TD></TR>
<TR VALIGN=top><TD>init_file</TD><TD ALIGN=center><B>-f</B></TD><TD ALIGN=center>atom</TD><TD>Personal
initialisation file </TD></TR>
<TBODY>
<TR VALIGN=top><TD>class</TD><TD ALIGN=center></TD><TD ALIGN=center>atom</TD><TD>If <CODE>runtime</CODE>,
only read resources from the state (default). If <CODE>kernel</CODE>,
lock all predicates as system predicates If <CODE>development</CODE>,
save the predicates in their current state and keep reading resources
from their source (if present). See also <A NAME="idx:resource3:1530"></A><A class="pred" href="useresource.html#resource/3">resource/3</A>. </TD></TR>
<TR VALIGN=top><TD>autoload</TD><TD ALIGN=center></TD><TD ALIGN=center>bool</TD><TD>If
true, run <A NAME="idx:autoload0:1531"></A><A class="pred" href="runtime.html#autoload/0">autoload/0</A>
first </TD></TR>
<TR VALIGN=top><TD>map</TD><TD ALIGN=center></TD><TD ALIGN=center>file</TD><TD>File
to write info on dump </TD></TR>
<TR VALIGN=top><TD>op</TD><TD ALIGN=center></TD><TD ALIGN=center><TT>save/standard</TT></TD><TD>Save
operator declarations? </TD></TR>
<TR VALIGN=top><TD>stand_alone</TD><TD ALIGN=center></TD><TD ALIGN=center>bool</TD><TD>Include
the emulator in the state </TD></TR>
<TR VALIGN=top><TD>emulator</TD><TD ALIGN=center></TD><TD ALIGN=center>file</TD><TD>Emulator
attached to the (stand-alone) executable. Default is the running
emulator. </TD></TR>
</TABLE>
</CENTER>
<TABLE ALIGN=center WIDTH="75%"><TR><TD>
<B>Table 8 : </B><<VAR>Key</VAR>> = <<VAR>Value</VAR>> pairs
for <A NAME="idx:qsaveprogram2:1532"></A><A class="pred" href="runtime.html#qsave_program/2">qsave_program/2</A></TABLE>
<A NAME="tab:qsave-options"></A>
<P>Before writing the data to file, <A NAME="idx:qsaveprogram2:1533"></A><A class="pred" href="runtime.html#qsave_program/2">qsave_program/2</A>
will run <A NAME="idx:autoload0:1534"></A><A class="pred" href="runtime.html#autoload/0">autoload/0</A>
to all required autoloading the system can discover. See <A NAME="idx:autoload0:1535"></A><A class="pred" href="runtime.html#autoload/0">autoload/0</A>.
<P>Provided the application does not require any of the Prolog libraries
to be loaded at runtime, the only file from the SWI-Prolog development
environment required is the emulator itself. The emulator may be built
in two flavours. The default is the <EM>development emulator</EM>. The
<EM>runtime emulator</EM> is similar, but lacks the tracer.
<P>If the option <CODE>stand_alone(true)</CODE> is present, the emulator
is the first part of the state. If the emulator is started it will test
whether a boot-file (state) is attached to the emulator itself and load
this state. Provided the application has all libraries loaded, the
resulting executable is completely independent of the runtime
environment or location where it was build.
<P>See also <A class="sec" href="compilation.html">section 2.10.2.4</A>.</DD>
<DT class="pubdef"><A NAME="qsave_program/1"><STRONG>qsave_program</STRONG>(<VAR>+File</VAR>)</A></DT>
<DD class="defbody">
Equivalent to <CODE>qsave_program(File, [])</CODE>.</DD>
<DT class="pubdef"><A NAME="autoload/0"><STRONG>autoload</STRONG></A></DT>
<DD class="defbody">
Check the current Prolog program for predicates that are referred to,
are undefined and have a definition in the Prolog library. Load the
appropriate libraries.
<P>This predicate is used by <A NAME="idx:qsaveprogram12:1536"></A><A class="pred" href="runtime.html#qsave_program/1">qsave_program/[1,2]</A>
to ensure the saved state will not depend on one of the libraries. The
predicate <A NAME="idx:autoload0:1537"></A><A class="pred" href="runtime.html#autoload/0">autoload/0</A>
will find all <STRONG>direct</STRONG> references to predicates. It does
not find predicates referenced via meta-predicates. The predicate log/2
is defined in the library(quintus) to provide a quintus compatible means
to compute the natural logarithm of a number. The following program will
behave correctly if its state is executed in an environment where the
library(quintus) is not available:
<PRE class="code">
logtable(From, To) :-
From > To, !.
logtable(From, To) :-
log(From, Value),
format('~d~t~8|~2f~n', [From, Value]),
F is From + 1,
logtable(F, To).
</PRE>
<P>However, the following implementation refers to log/2 through the
meta-predicate <A NAME="idx:maplist3:1538"></A><A class="pred" href="apply.html#maplist/3">maplist/3</A>.
Autoload will not be able to find the reference. This problem may be
fixed either by loading the module library(quintus) explicitly or use <A NAME="idx:require1:1539"></A><A class="pred" href="consulting.html#require/1">require/1</A>
to tell the system that the predicate log/2 is required by this module.
<PRE class="code">
logtable(From, To) :-
findall(X, between(From, To, X), Xlist),
maplist(log, Xlist, SineList),
write_table(Xlist, SineList).
write_table([], []).
write_table([I|IT], [V|VT]) :-
format('~d~t~8|~2f~n', [I, V]),
write_table(IT, VT).
</PRE>
</DD>
<DT class="pubdef"><A NAME="volatile/1"><STRONG>volatile</STRONG> <VAR>+Name/Arity, \ldots</VAR></A></DT>
<DD class="defbody">
Declare that the clauses of specified predicates should <STRONG>not</STRONG>
be saved to the program. The volatile declaration is normally used to
avoid that the clauses of dynamic predicates that represent data for the
current session is saved in the state file.
</DD>
</DL>
<P>
<HR>
<CENTER>
<H2>Section Index</H2>
</CENTER>
<HR>
<DIV class="toc">
<DIV class="toc-h2"><A class="sec" href="qsavelimits.html"><SPAN class="sec-nr">10.1</SPAN> <SPAN class="sec-title">Limitations
of qsave_program</SPAN></A></DIV>
<DIV class="toc-h2"><A class="sec" href="qsaveforeign.html"><SPAN class="sec-nr">10.2</SPAN> <SPAN class="sec-title">Runtimes
and Foreign Code</SPAN></A></DIV>
<DIV class="toc-h2"><A class="sec" href="useresource.html"><SPAN class="sec-nr">10.3</SPAN> <SPAN class="sec-title">Using
program resources</SPAN></A></DIV>
<DIV class="toc-h3"><A class="sec" href="useresource.html#sec:10.3.1"><SPAN class="sec-nr">10.3.1</SPAN> <SPAN class="sec-title">Predicates
Definitions</SPAN></A></DIV>
<DIV class="toc-h3"><A class="sec" href="useresource.html#sec:10.3.2"><SPAN class="sec-nr">10.3.2</SPAN> <SPAN class="sec-title">The <B>swipl-rc</B>
program</SPAN></A></DIV>
<DIV class="toc-h2"><A class="sec" href="findappfile.html"><SPAN class="sec-nr">10.4</SPAN> <SPAN class="sec-title">Finding
Application files</SPAN></A></DIV>
<DIV class="toc-h3"><A class="sec" href="findappfile.html#sec:10.4.1"><SPAN class="sec-nr">10.4.1</SPAN> <SPAN class="sec-title">Passing
a path to the application</SPAN></A></DIV>
</DIV>
</BODY></HTML>
|