1swipl(1) General Commands Manual swipl(1)
2
3
4
6 swipl - SWI-Prolog 9.0.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 --help Give a summary of the most important options.
42
43 --version
44 Display version and architecture information.
45
46 --abi-version
47 Display ABI version key. This key indicates binary compatibil‐
48 ity of various interfaces.
49
50 --arch Print the architecture identifier.
51
52 --dump-runtime-variables[=format]
53 Dump information that is generally useful for installation
54 scripts in a form defined by format. Defines formats are sh
55 (default, bourne shell) and cmd (Windows CMD). This option is
56 used by swipl-ld (1) to fetch necessary information about Pro‐
57 log. It is normally invoked as eval `swipl --dump-runtime-vari‐
58 ables`, which assigns the following shell variables:
59
60 CC The C- compiler used to compile SWI-Prolog.
61
62 PLBASE The home directory of SWI-Prolog. This is the same value
63 as returned by the current_prolog_flag home.
64
65 PLARCH The architecture identifier used. Together with PLBASE
66 this defines the location of various components. For ex‐
67 ample, the library for embedding is in
68 $PLBASE/lib/$PLARCH/libswipl.a
69
70 PLBITS Address bits for VM. Either 32 or 64.
71
72 PLLIB CC identifier to link to SWI-Prolog. Typically -lswipl
73
74 PLLIBSWIPL
75 Full path name to the shared object (DLL) that provides
76 the Prolog core.
77
78 PLLIBS Additional libraries needed for linking PLLIB
79
80 PLCFLAGS
81 Flags that need to be passed to the C-compiler to gener‐
82 ate compatible code.
83
84 PLLDFLAGS
85 Flags that need to be passed to the C-linker for linking
86 embedded executables.
87
88 PLSOEXT
89 Extension used by the hosting operating system for shared
90 objects. On most Unix systems this is "so"; on MS-Windows
91 it is "dll". AIX uses "o", HPUX "sl".
92
93 PLSOPATH
94 Environment variable used by the hosting operating system
95 to extend the search path for shared objects. For exam‐
96 ple, on ELF systems this is "LD_LIBRARY_PATH" and on MS-
97 Windows it is "PATH".
98
99 PLVERSION
100 Numeric representation of the SWI-Prolog version.
101
102 PLVERSIONTAG
103 If present, a version tag such as "rc1".
104
105 PLSHARED
106 Has the value yes if Prolog supports linking shared li‐
107 braries using load_foreign_library/[1,2] and no other‐
108 wise.
109
110 PLTHREADS
111 Has the value yes if Prolog was compiled for multi-
112 threading and no otherwise.
113
114 --home=DIR
115 Use DIR as home directory.
116
117 --stack-limit=size[bkmg]
118 Set the combined stack limit to size bytes. The suffix is case
119 insensitive and defines the unit as b (bytes), k (Kbytes), m
120 (Mbytes) or g (Gbytes).
121
122 --table-space=size[bkmg]
123 Set the table space limit for SLG resolution (tabling) to size
124 bytes. The suffixes are the same as for the --stack-limit op‐
125 tion.
126
127 --shared-table-space=size[bkmg]
128 Set the table space limit for shared tabling to size bytes. The
129 suffixes are the same as for the --stack-limit option.
130
131 -O Optimised compilation. See set_prolog_flag/2 in the SWI-Prolog
132 Reference Manual.
133
134 -b initfile ... -c file ...
135 Boot compilation. initfile ... are compiled by the C written
136 bootstrap compiler, file ... by the normal Prolog compiler into
137 an intermediate code file. This option is for system maintenance
138 and is given for reference only.
139
140 -c file ...
141 Compile file ... into an intermediate code file.
142
143 -d level
144 Set debug level to level. This option is for system maintenance
145 and is given for reference only.
146
147 --packs[=bool]
148 Disable attaching extension packs (add-ons).
149
150 --pce[=bool]
151 Disable the XPCE GUI subsystem.
152
153 --pldoc[=port]
154 Start the PlDoc documentation system on a free network port and
155 launch the user's browser on http://localhost:port. If port is
156 specified, the server is started at the given port but the
157 browser is not launched.
158
159 -f file
160 Use file as initialisation file instead of `init.pl'. `-f none'
161 stops SWI-Prolog from searching for an initialisation file.
162
163 -F file
164 Select startup script from the SWI-Prolog home directory. file
165 Specifies the base-name of the script. The extension is .rc.
166 The default script is deduced from the basename of the exe‐
167 cutable, taking all leading alphanumerical (letters, digits and
168 underscore) from the program name. Thus if the program is named
169 swi-2.0 it will try to load the file swi.rc from the SWI-Prolog
170 home directory. If the file does not exist, or the user has no
171 read-access to it, the script is silently not loaded.
172
173 -s file
174 Load file as a script. This option may be used from the shell
175 to make Prolog load a file before entering the toplevel. Depre‐
176 cated as file names with a Prolog extension (.pl or .qlf) are
177 used to load the program.
178
179 -l file
180 Load file as a script. This is a synonym for -s that is compat‐
181 ible with several other Prolog implementations. If multiple -s
182 or -l arguments are provided, all specified files are loaded in
183 the order in which they appear on the argument list.
184
185 --quiet[=bool] -q
186 Operate silently. This option suppresses all informational mes‐
187 sages.
188
189 --debug[=bool]
190 Disable generating code that can be debugged using trace/0,
191 spy/1, etc.
192
193 --debug-on-interrupt[=bool]
194 Immediately start handling SIGINT (Control-C) to start the de‐
195 bugger. By default this is enabled when the interactive
196 toplevel is entered.
197
198 --on-error=style
199 How to handle on a (printed) error message. Default is print
200 which causes errors to be printed while execution continues.
201 Using status execution continues as with print, but halt/0
202 causes the process to exit with status 1 and halt causes the
203 process to exit with status 1 on the first error.
204
205 --on-warning=style
206 Similar to --on-error, but for warning messages.
207
208 -g goal
209 Goal is executed just before entering the top level. This option
210 may appear multiple times. Goals are executed in the order of
211 appearance. Possible choice points are pruned. If a goal fails
212 an error is printed (depending on the -q flag) and the process
213 stops with exit code 1. If a goal raises an exception the error
214 is printed and the process stops with exit code 2. In no goal
215 is present version/0 is called to write the welcome message.
216 The welcome message can thus be suppressed by giving -g true.
217 goal can be a complex term. In this case, quotes are normally
218 needed to protect it from being expanded by the Unix shell.
219
220 -o output
221 Used in combination with -b or -c to determine the output file
222 for compilation.
223
224 -p alias=pathlist
225 Define a path alias for file_search_path/2. pathlist is a ":"
226 separated list of values for the alias. See file_search_path/2
227 in the SWI-Prolog Reference Manual.
228
229 -t goal
230 Use goal as an interactive top level instead of the default goal
231 prolog/0. goal can be a complex term. If the top level goal
232 succeeds, SWI-Prolog exits with status 0. If it fails, the exit
233 status is 1. This flag also determines the goal started by
234 break/0 and abort/0. If you want to stop the user from entering
235 interactive mode, start the application with `-g goal' and give
236 `halt' as the top level.
237
238 -x bootfile
239 Start from an intermediate code file resulting from a Prolog
240 compilation using the -b or -c option, or created using
241 qsave_program/[1,2].
242
243 --tty[=bool]
244 Switches tty control (using ioctl(2)). Normally tty control is
245 switched on. This default depends on the installation. You may
246 wish to switch tty control off if SWI-Prolog is used from an ed‐
247 itor such as GNU Emacs. If switched off, get_single_char/1 and
248 the tracer will wait for a carriage return.
249
250 --win-app
251 This option is available only in swipl-win.exe. The Start menu
252 shortcut uses this option to change the working directory to
253 ...\Documents\Prolog. The Prolog subdirectory will be created
254 if it does not exist.
255
256 --signals[=bool]
257 Disable handling of signals. Often used if SWI-Prolog is embed‐
258 ded in another application on Unix systems.
259
260 --sigalert=NUM
261 Use NUM for unblocking system calls. Default is SIGUSR2. Using
262 0 disables installing a signal handler, delaying the delivery of
263 thread signals until the blocking system call completes.
264
265 --threads[=bool]
266 Disable creating threads in the multi-threaded version. This
267 notably prevents running global garbage collection on a separate
268 thread and may be used for situations where multiple threads are
269 not desirable.
270
271 --traditional
272 Disable SWI-Prolog version 7 extensions that are incompatible
273 with earlier versions.
274
275 -- Stop scanning for more arguments.
276
278 SWI_HOME_DIR
279 Location for finding the startup file and the libraries. Nor‐
280 mally discovered from the executable or configured default loca‐
281 tion. Providing the value through the environment may be needed
282 if SWI-Prolog is embedded into another executable.
283
285 SWI-Prolog has on-line help. This provides a fast lookup and browsing
286 facility to the SWI-Prolog Reference manual. The on-line manual can
287 show predicate definitions as well as entire sections of the manual.
288
289 help Equivalent to help(help/1).
290
291 help(+What)
292 Show a specified part of the manual. What is one of:
293
294 Name/Arity
295 give help on the specified predicate
296
297 Name give help on the named predicate with any arity or a C
298 interface function with that name.
299
300 Section
301 display the specified section of the SWI-Prolog Reference
302 Manual. Section numbers are dash separated numbers: e.g.
303 2-3 refers to section 2.3 of the manual.
304
305 If Prolog is used together with the GUI tool XPCE, these predi‐
306 cates start a graphical interface, providing a coherent inter‐
307 face to help/1, apropos/1 and explain/1.
308
310 This installation of SWI-Prolog has been configured using the configure
311 option --prefix=/usr. If the files listed below are not at the indi‐
312 cated place, the installation has probably been moved. Use
313
314 ?- current_prolog_flag(home, Home).
315
316 to find the local installation directory of SWI-Prolog.
317
318 ~/.config/swi-prolog/init.pl
319 Personal initialisation files consulted by SWI-Prolog on
320 startup. The exact location depends on the OS.
321
323 The SWI-Prolog web-home at http://www.swi-prolog.org
324
325 Jan Wielemaker SWI-Prolog Reference Manual at http://www.swi-pro‐
326 log.org/pldoc/index.html
327
328 William F. Clocksin & Christopher S. Mellish, Programming in Prolog,
329 fourth edition, Springer Verlag, Berlin 1994.
330
331 swipl-ld(1)
332
334 The software is provided as is, without warranty of any kind, express
335 or implied, including but not limited to the warranties of mer‐
336 chantability, fitness for a particular purpose and non infringement. In
337 no event shall the author or his employer be liable for any claim, dam‐
338 ages or other liability, whether in an action of contract, tort or oth‐
339 erwise, arising from, out of or in connection with the software or the
340 use or other dealings in the software.
341
343 SWI-Prolog is distributed under the Simplified BSD or BSD-2 License. A
344 particular configuration may contain components that are subject to
345 other license conditions. Use license/0 to find components with less
346 permissive license conditions. See the SWI-Prolog license page at
347 http://www.swi-prolog.org/license.html for details.
348
350 Copyright (c) 1986-2020 University of Amsterdam, VU University Amster‐
351 dam
352
354 Jan Wielemaker
355
356
357
358SWI-Prolog 8 Oct 10, 2020 swipl(1)