swipl(1)

NAME
swipl - SWI-Prolog 9.3.0

SYNOPSIS
swipl [--help|--version|--arch|--dump-runtime-variables]
swipl [options] prolog-file ... [--] [arg ...]
swipl [options] [-o output] -c file ...
swipl [options] [-o output] -b initfile ... The first version provides information about the system and exits immediately. The second version is the primary way to call Prolog on one or more Prolog source file(s) and provide arguments to the application that can be requested using current_prolog_flag(argv, Argv). The third version is used to create a saved state while the last version is used for boot-compilation of the Prolog parts of the system.

DESCRIPTION
SWI-Prolog is a comprehensive and stable implementation of the Prolog language with a large set of libraries. Among its distinguishing features are mature support for multi-threading, a mature embedded web-server library, graphical development tools (debugger, profiler, cross-referencer, editor), an embedded efficient RDF store, support for XML/SGML/HTML and Unicode. More widely supported features are support for constraint programming, atom garbage collection, interfaces to databases (ODBC), C, C++ and Java (JPL). SWI-Prolog implements the ISO core standard. Many of its extensions are largely compatible to YAP and SICStus Prolog. This manual page only lists the commandline options. Full documentation is available on-line as well as in HTML and PDF format from the WWW home page at http://www.swi-prolog.org

OPTIONS

--help
    Give a summary of the most important options.

--version
    Display version and architecture information.

--abi-version
    Display ABI version key. This key indicates binary compatibility of various interfaces.

--arch
    Print the architecture identifier.

--dump-runtime-variables[=format]
    Dump information that is generally useful for installation scripts in a form defined by format. Defines formats are sh (default, bourne shell) and cmd (Windows CMD). This option is used by swipl-ld (1) to fetch necessary information about Prolog. It is normally invoked as eval `swipl --dump-runtime-variables`, which assigns the following shell variables:

    CC  The C- compiler used to compile SWI-Prolog.

    PLBASE
        The home directory of SWI-Prolog. This is the same value as returned by the current_prolog_flag home.

    PLARCH
        The architecture identifier used. Together with PLBASE this defines the location of various components. For example, the library for embedding is in $PLBASE/lib/$PLARCH/libswipl.a

    PLBITS
        Address bits for VM. Either 32 or 64.

    PLLIB
        CC identifier to link to SWI-Prolog. Typically -lswipl

    PLLIBSWIPL
        Full path name to the shared object (DLL) that provides the Prolog core.

    PLLIBS
        Additional libraries needed for linking PLLIB

    PLCFLAGS
        Flags that need to be passed to the C-compiler to generate compatible code.

    PLLDFLAGS
        Flags that need to be passed to the C-linker for linking embedded executables.

    PLSOEXT
        Extension used by the hosting operating system for shared objects. On most Unix systems this is "so"; on MS-Windows it is "dll". AIX uses "o", HPUX "sl".

    PLSOPATH
        Environment variable used by the hosting operating system to extend the search path for shared objects. For example, on ELF systems this is "LD_LIBRARY_PATH" and on MS-Windows it is "PATH".

    PLVERSION
        Numeric representation of the SWI-Prolog version.

    PLVERSIONTAG
        If present, a version tag such as "rc1".

    PLSHARED
        Has the value yes if Prolog supports linking shared libraries using load_foreign_library/[1,2] and no otherwise.

    PLTHREADS
        Has the value yes if Prolog was compiled for multi-threading and no otherwise.

--home=DIR
    Use DIR as home directory.

--stack-limit=size[bkmg]
    Set the combined stack limit to size bytes. The suffix is case insensitive and defines the unit as b (bytes), k (Kbytes), m (Mbytes) or g (Gbytes).

--table-space=size[bkmg]
    Set the table space limit for SLG resolution (tabling) to size bytes. The suffixes are the same as for the --stack-limit option.

--shared-table-space=size[bkmg]
    Set the table space limit for shared tabling to size bytes. The suffixes are the same as for the --stack-limit option.

-O  Optimised compilation. See set_prolog_flag/2 in the SWI-Prolog Reference Manual.

-b initfile ... -c file ...
    Boot compilation. initfile ... are compiled by the C written bootstrap compiler, file ... by the normal Prolog compiler into an intermediate code file. This option is for system maintenance and is given for reference only.

-c file ...
    Compile file ... into an intermediate code file.

-d level
    Set debug level to level. This option is for system maintenance and is given for reference only.

--packs[=bool]
    Disable attaching extension packs (add-ons).

--pce[=bool]
    Disable the XPCE GUI subsystem.

--pldoc[=port]
    Start the PlDoc documentation system on a free network port and launch the user's browser on http://localhost:port. If port is specified, the server is started at the given port but the browser is not launched.

-f file
    Use file as initialisation file instead of `init.pl'. `-f none' stops SWI-Prolog from searching for an initialisation file.

-F file
    Select startup script from the SWI-Prolog home directory. file Specifies the base-name of the script. The extension is .rc. The default script is deduced from the basename of the executable, taking all leading alphanumerical (letters, digits and underscore) from the program name. Thus if the program is named swi-2.0 it will try to load the file swi.rc from the SWI-Prolog home directory. If the file does not exist, or the user has no read-access to it, the script is silently not loaded.

-s file
    Load file as a script. This option may be used from the shell to make Prolog load a file before entering the toplevel. Deprecated as file names with a Prolog extension (.pl or .qlf) are used to load the program.

-l file
    Load file as a script. This is a synonym for -s that is compatible with several other Prolog implementations. If multiple -s or -l arguments are provided, all specified files are loaded in the order in which they appear on the argument list.

--quiet[=bool] -q
    Operate silently. This option suppresses all informational messages.

--debug[=bool]
    Disable generating code that can be debugged using trace/0, spy/1, etc.

--debug-on-interrupt[=bool]
    Immediately start handling SIGINT (Control-C) to start the debugger. By default this is enabled when the interactive toplevel is entered.

--on-error=style
    How to handle on a (printed) error message. Default is print which causes errors to be printed while execution continues. Using status execution continues as with print, but halt/0 causes the process to exit with status 1 and halt causes the process to exit with status 1 on the first error.

--on-warning=style
    Similar to --on-error, but for warning messages.

-g goal
    Goal is executed just before entering the top level. This option may appear multiple times. Goals are executed in the order of appearance. Possible choice points are pruned. If a goal fails an error is printed (depending on the -q flag) and the process stops with exit code 1. If a goal raises an exception the error is printed and the process stops with exit code 2. In no goal is present version/0 is called to write the welcome message. The welcome message can thus be suppressed by giving -g true. goal can be a complex term. In this case, quotes are normally needed to protect it from being expanded by the Unix shell.

-o output
    Used in combination with -b or -c to determine the output file for compilation.

-p alias=pathlist
    Define a path alias for file_search_path/2. pathlist is a ":" separated list of values for the alias. See file_search_path/2 in the SWI-Prolog Reference Manual.

-t goal
    Use goal as an interactive top level instead of the default goal prolog/0. goal can be a complex term. If the top level goal succeeds, SWI-Prolog exits with status 0. If it fails, the exit status is 1. This flag also determines the goal started by break/0 and abort/0. If you want to stop the user from entering interactive mode, start the application with `-g goal' and give `halt' as the top level.

-x bootfile
    Start from an intermediate code file resulting from a Prolog compilation using the -b or -c option, or created using qsave_program/[1,2].

--tty[=bool]
    Switches tty control (using ioctl(2)). Normally tty control is switched on. This default depends on the installation. You may wish to switch tty control off if SWI-Prolog is used from an editor such as GNU Emacs. If switched off, get_single_char/1 and the tracer will wait for a carriage return.

--win-app
    This option is available only in swipl-win.exe. The Start menu shortcut uses this option to change the working directory to ...\Documents\Prolog. The Prolog subdirectory will be created if it does not exist.

--signals[=bool]
    Disable handling of signals. Often used if SWI-Prolog is embedded in another application on Unix systems.

--sigalert=NUM
    Use NUM for unblocking system calls. Default is SIGUSR2. Using 0 disables installing a signal handler, delaying the delivery of thread signals until the blocking system call completes.

--threads[=bool]
    Disable creating threads in the multi-threaded version. This notably prevents running global garbage collection on a separate thread and may be used for situations where multiple threads are not desirable.

--traditional
    Disable SWI-Prolog version 7 extensions that are incompatible with earlier versions.

--  Stop scanning for more arguments.

ENVIRONMENT VARIABLES

SWI_HOME_DIR
    Location for finding the startup file and the libraries. Normally discovered from the executable or configured default location. Providing the value through the environment may be needed if SWI-Prolog is embedded into another executable.

ON-LINE HELP
SWI-Prolog has on-line help. This provides a fast lookup and browsing facility to the SWI-Prolog Reference manual. The on-line manual can show predicate definitions as well as entire sections of the manual.

help
    Equivalent to help(help/1).

help(+What)
    Show a specified part of the manual. What is one of:

    Name/Arity
        give help on the specified predicate

    Name
        give help on the named predicate with any arity or a C interface function with that name.

    Section
        display the specified section of the SWI-Prolog Reference Manual. Section numbers are dash separated numbers: e.g. 2-3 refers to section 2.3 of the manual.

    If Prolog is used together with the GUI tool XPCE, these predicates start a graphical interface, providing a coherent interface to help/1, apropos/1 and explain/1.

FILES
This installation of SWI-Prolog has been configured using the configure option --prefix=/opt/local. If the files listed below are not at the indicated place, the installation has probably been moved. Use

?- current_prolog_flag(home, Home).

to find the local installation directory of SWI-Prolog.

~/.config/swi-prolog/init.pl
    Personal initialisation files consulted by SWI-Prolog on startup. The exact location depends on the OS.

/opt/local/lib/swipl-9.3.0/bin//
    Location for the executables.

/opt/local/lib/swipl-9.3.0/include/
    Location for the include files. If writable, SWI-Prolog.h is also copied to /opt/local/include/SWI-Prolog.h.

/opt/local/lib/swipl-9.3.0/library/
    SWI-Prolog user libraries.

/opt/local/lib/swipl-9.3.0/boot/
    SWI-Prolog kernel parts written in Prolog. The startup file /opt/local/lib/swipl-9.3.0/ may be recreated using the command from the directory /opt/local/lib/swipl-9.3.0:

    bin//swipl -O -o  -b boot/init.pl

/opt/local/lib/swipl-9.3.0/doc/packages
    HTML and/or PDF documentation on the installed add-ons.

/opt/local/lib/swipl-9.3.0/
    Default startup file. This is a `intermediate code' file containing precompiled code from the boot directory. The -xbootfile option may be used to select a different file.

/opt/local/lib/swipl-9.3.0/runtime//libpl.a
    SWI-Prolog library for embedding. See also plld(1).

SEE ALSO

The SWI-Prolog web-home at http://www.swi-prolog.org

Jan Wielemaker SWI-Prolog Reference Manual at http://www.swi-prolog.org/pldoc/index.html

Documentation on the add-on packages in /opt/local/lib/swipl-9.3.0/boot/doc

William F. Clocksin & Christopher S. Mellish, Programming in Prolog, fourth edition, Springer Verlag, Berlin 1994.

swipl-ld(1)

WARRANTY
The software is provided as is, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and non infringement. In no event shall the author or his employer be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

LICENSE INFORMATION
SWI-Prolog is distributed under the Simplified BSD or BSD-2 License. A particular configuration may contain components that are subject to other license conditions. Use license/0 to find components with less permissive license conditions. See the SWI-Prolog license page at http://www.swi-prolog.org/license.html for details.

COPYRIGHT
Copyright (c) 1986-2020 University of Amsterdam, VU University Amsterdam

AUTHOR
Jan Wielemaker