1swipl(1) General Commands Manual swipl(1)
2
3
4
6 swipl - SWI-Prolog 7.6.4
7
9 swipl [--help|--version|--arch|--dump-runtime-variables]
10 swipl [options] prolog-file ... [--] [arg ...]
11 swipl [options] [-o output] -c file ...
12 swipl [options] [-o output] -b initfile ...
13
14 The first version provides information about the system and exits imme‐
15 diately. The second version is the primary way to call Prolog on one or
16 more Prolog source file(s) and provide arguments to the application
17 that can be requested using current_prolog_flag(argv, Argv). The third
18 version is used to create a saved state while the last version is used
19 for boot-compilation of the Prolog parts of the system.
20
21
23 SWI-Prolog is a comprehensive and stable implementation of the Prolog
24 language with a large set of libraries. Among its distinguishing fea‐
25 tures are mature support for multi-threading, a mature embedded web-
26 server library, graphical development tools (debugger, profiler, cross-
27 referencer, editor), an embedded efficient RDF store, support for
28 XML/SGML/HTML and Unicode. More widely supported features are support
29 for constraint programming, atom garbage collection, interfaces to
30 databases (ODBC), C, C++ and Java (JPL).
31
32 SWI-Prolog implements the ISO core standard. Many of its extensions are
33 largely compatible to YAP and SICStus Prolog.
34
35 This manual page only lists the commandline options. Full documenta‐
36 tion is available on-line as well as in HTML and PDF format from the
37 WWW home page at http://www.swi-prolog.org
38
39
41 SWI-Prolog is distributed under the LGPL (GNU Lesser General Public
42 License) for maximal compatibility with the Free Software movement,
43 while allowing for use with proprietary software components. See the
44 SWI-Prolog home page at http://www.swi-prolog.org for details.
45
46
48 --help Gives a summary of the most important options.
49
50 --version
51 Displays version and architecture information.
52
53 --arch Prints the architecture identifier.
54
55 --dump-runtime-variables[=format]
56 Dump information that is generally useful for installation
57 scripts in a form defined by format. Defines formats are sh
58 (default, bourne shell) and cmd (Windows CMD). This option is
59 used by swipl-ld (1) to fetch necessary information about Pro‐
60 log. It is normally invoked as eval `swipl -dump-runtime-vari‐
61 ables`, which assigns the following shell variables:
62
63 CC The C- compiler used to compile SWI-Prolog.
64
65 PLBASE The home directory of SWI-Prolog. This is the same value
66 as returned by the current_prolog_flag home.
67
68 PLARCH The architecture identifier used. Together with PLBASE
69 this defines the location of various components. For
70 example, the library for embedding is in
71 $PLBASE/lib/$PLARCH/libswipl.a
72
73 PLLIB CC identifier to link to SWI-Prolog. Typically -lswipl
74
75 PLLIBS Additional libraries needed for linking PLLIB
76
77 PLCFLAGS
78 Flags that need to be passed to the C-compiler to gener‐
79 ate compatible code.
80
81 PLLDFLAGS
82 Flags that need to be passed to the C-linker for linking
83 embedded executables.
84
85 PLSOEXT
86 Extension used by the hosting operating system for shared
87 objects. On most Unix systems this is "so"; on MS-Windows
88 it is "dll". AIX uses "o", HPUX "sl".
89
90 PLSOPATH
91 Environment variable used by the hosting operating system
92 to extend the search path for shared objects. For exam‐
93 ple, on ELF systems this is "LD_LIBRARY_PATH" and on MS-
94 Windows it is "PATH".
95
96 PLVERSION
97 Numeric representation of the SWI-Prolog version.
98
99 PLVERSIONTAG
100 If present, a version tag such as "rc1".
101
102 PLSHARED
103 Has the value yes if Prolog supports linking shared
104 libraries using load_foreign_library/[1,2] and no other‐
105 wise.
106
107 PLTHREADS
108 Has the value yes if Prolog was compiled for multi-
109 threading and no otherwise.
110
111 -Gsize[kmg]
112 Sets the global stack size to size. The default is 128 Mbytes
113 (64-bit machines: 256 Mbytes). The global stack is used to store
114 compound terms, floating point numbers, big integers and
115 strings. See also the -L option.
116
117 -Lsize[kmg]
118 Sets the local stack size to size. The default unit is Kbytes.
119 The local stack is used to store environment frames, choice‐
120 points and foreign-language term-references. SWI-Prolog performs
121 last-call optimisation to minimize the local stack requirements.
122 If the argument ends in m , the argument is interpreted in
123 Mbytes. A g suffix is interpreted in Gbytes (64-bit machines
124 only). This flag sets the maximum value to which the stack is
125 allowed to grow (default 128 Mbytes for the 32-bit version and
126 256 Mbytes for the 64-bit version). A maximum is useful to pre‐
127 vent buggy programs from claiming all the memory resources. -L0
128 sets the limit to the highest possible value.
129
130 -O Optimised compilation. See set_prolog_flag/3 in the SWI-Prolog
131 Reference Manual.
132
133 -Tsize[kmg]
134 Sets the trail stack size to size K bytes. The default is 128
135 Mbytes (64-bit machines: 256 Mbytes). See -L for more details.
136
137 -b initfile ... -c file ...
138 Boot compilation. initfile ... are compiled by the C written
139 bootstrap compiler, file ... by the normal Prolog compiler into
140 an intermediate code file. This option is for system maintenance
141 and is given for reference only.
142
143 -c file ...
144 Compiles file ... into an intermediate code file.
145
146 -d level
147 Set debug level to level. This option is for system maintenance
148 and is given for reference only.
149
150 -f file
151 Use file as initialisation file instead of `.swiplrc'. `-f none'
152 stops SWI-Prolog from searching for an initialisation file.
153
154 -F file
155 Select startup script from the SWI-Prolog home directory. file
156 Specifies the base-name of the script. The extension is .rc.
157 The default script is deduced from the basename of the exe‐
158 cutable, taking all leading alphanumerical (letters, digits and
159 underscore) from the program name. Thus if the program is named
160 swi-2.0 it will try to load the file swi.rc from the SWI-Prolog
161 home directory. If the file does not exist, or the user has no
162 read-access to it, the script is silently not loaded.
163
164 -s file
165 Load file as a script. This option may be used from the shell
166 to make Prolog load a file before entering the toplevel. It is
167 also used to turn a file into an executable Prolog script on
168 Unix systems using the following first line
169
170 #!/usr/bin/swipl option ... -s
171
172 -l file
173 Load file as a script. This is a synonym for -s that is compat‐
174 ible with several other Prolog implementations. If multiple -s
175 or -l arguments are provided, all specified files are loaded in
176 the order in which they appear on the argument list.
177
178 --quiet -q
179 Operate silently. This option suppresses all informational mes‐
180 sages.
181
182 -g goal
183 Goal is executed just before entering the top level. This option
184 may appear multiple times. Goals are executed in the order of
185 appearance. Possible choice points are pruned. If a goal fails
186 an error is printed (depending on the -q flag) and the process
187 stops with exit code 1. If a goal raises an exception the error
188 is printed and the process stops with exit code 2. In no goal
189 is present version/0 is called to write the welcome message.
190 The welcome message can thus be suppressed by giving -g true.
191 goal can be a complex term. In this case, quotes are normally
192 needed to protect it from being expanded by the Unix shell.
193
194 -o output
195 Used in combination with -b or -c to determine the output file
196 for compilation.
197
198 -p alias=pathlist
199 Define a path alias for file_search_path/2. pathlist is a ":"
200 separated list of values for the alias. See file_search_path/2
201 in the SWI-Prolog Reference Manual.
202
203 -t goal
204 Use goal as an interactive top level instead of the default goal
205 prolog/0. goal can be a complex term. If the top level goal
206 succeeds, SWI-Prolog exits with status 0. If it fails, the exit
207 status is 1. This flag also determines the goal started by
208 break/0 and abort/0. If you want to stop the user from entering
209 interactive mode, start the application with `-g goal' and give
210 `halt' as the top level.
211
212 -x bootfile
213 Start from an intermediate code file resulting from a Prolog
214 compilation using the -b or -c option, or created using
215 qsave_program/[1,2].
216
217 [+|-]tty
218 Switches tty control (using ioctl(2)) on (+tty) or off (-tty).
219 Normally tty control is switched on. This default depends on the
220 installation. You may wish to switch tty control off if SWI-Pro‐
221 log is used from an editor such as GNU Emacs. If switched off,
222 get_single_char/1 and the tracer will wait for a carriage
223 return.
224
225 --nosignals
226 Disable handling of signals. Often used if SWI-Prolog is embed‐
227 ded in another application on Unix systems.
228
229 --sigalert= NUM
230 Use NUM for unblocking system calls. Default is SIGUSR2. Using
231 0 disables installing a signal handler, delaying the delivery of
232 thread signals until the blocking system call completes.
233
234 -- Stops scanning for more arguments.
235
237 SWI_HOME_DIR
238 Location for finding the startup file boot64.prc and the
239 libraries. Normally discovered from the executable or config‐
240 ured default location. Providing the value through the environ‐
241 ment may be needed if SWI-Prolog is embedded into another exe‐
242 cutable.
243
245 SWI-Prolog has on-line help. This provides a fast lookup and browsing
246 facility to the SWI-Prolog Reference manual. The on-line manual can
247 show predicate definitions as well as entire sections of the manual.
248
249 help Equivalent to help(help/1).
250
251 help(+What)
252 Show a specified part of the manual. What is one of:
253
254 Name/Arity
255 give help on the specified predicate
256
257 Name give help on the named predicate with any arity or a C
258 interface function with that name.
259
260 Section
261 display the specified section of the SWI-Prolog Reference
262 Manual. Section numbers are dash separated numbers: e.g.
263 2-3 refers to section 2.3 of the manual.
264
265 If Prolog is used together with the GUI tool XPCE, these predi‐
266 cates start a graphical interface, providing a coherent inter‐
267 face to help/1, apropos/1 and explain/1.
268
270 This installation of SWI-Prolog has been configured using the configure
271 option --prefix=/usr. If the files listed below are not at the indi‐
272 cated place, the installation has probably been moved. Use
273
274 ?- current_prolog_flag(home, Home).
275
276 to find the local installation directory of SWI-Prolog.
277
278 ~/.swiplrc
279 Personal initialisation files consulted by SWI-Prolog on
280 startup. If both exist .swiplrc is used.
281
283 The SWI-Prolog web-home at http://www.swi-prolog.org
284
285 Jan Wielemaker SWI-Prolog Reference Manual at http://www.swi-pro‐
286 log.org/pldoc/index.html
287
288 William F. Clocksin & Christopher S. Mellish, Programming in Prolog,
289 fourth edition, Springer Verlag, Berlin 1994.
290
291 swipl-rc(1) and swipl-ld(1)
292
294 The software is provided as is, without warranty of any kind, express
295 or implied, including but not limited to the warranties of mer‐
296 chantability, fitness for a particular purpose and non infringement. In
297 no event shall the author or his employer be liable for any claim, dam‐
298 ages or other liability, whether in an action of contract, tort or oth‐
299 erwise, arising from, out of or in connection with the software or the
300 use or other dealings in the software.
301
303 SWI-Prolog is distributed under the LGPL (GNU Lesser General Public
304 License). The license terms are in the file COPYING or on the GNU web‐
305 site at http://www.gnu.org.
306
308 Copyright (c) 1986-2015 University of Amsterdam, VU University Amster‐
309 dam
310
312 Jan Wielemaker
313
314
315
316SWI-Prolog 7 Apr 10, 2015 swipl(1)