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