- Documentation
- Reference manual
- Foreign Language Interface
- The Foreign Include File
- Argument Passing and Control
- Atoms and functors
- Analysing Terms via the Foreign Interface
- Constructing Terms
- Unifying data
- Convenient functions to generate Prolog exceptions
- Foreign language wrapper support functions
- Serializing and deserializing Prolog terms
- BLOBS: Using atoms to store arbitrary binary data
- Exchanging GMP numbers
- Calling Prolog from C
- Discarding Data
- String buffering
- Foreign Code and Modules
- Prolog exceptions in foreign code
- Catching Signals (Software Interrupts)
- Miscellaneous
- Errors and warnings
- Environment Control from Foreign Code
- Querying Prolog
- Registering Foreign Predicates
- Foreign Code Hooks
- Storing foreign data
- Embedding SWI-Prolog in other applications
- The Foreign Include File
- Foreign Language Interface
- Packages
- Reference manual
. The argument (an PL_ACTION_HALT Halt Prolog execution. This action should be called rather than Unix
exit() to give Prolog the opportunity to clean up. This call does not
return. The argument (an
PL_ACTION_ABORT Generate a Prolog abort (abort/0).
This call does not return. Requires no arguments.
PL_ACTION_BREAK Create a standard Prolog break environment (break/0).
Returns after the user types the end-of-file character. Requires no
arguments.
PL_ACTION_GUIAPP Windows: Used to indicate to the kernel that the application is a GUI
application if the argument is not 0, and a console application if the
argument is 0. If a fatal error occurs, the system uses a windows
messagebox to report this on a GUI application, and otherwise simply
prints the error and exits.
PL_ACTION_TRADITIONAL Same effect as using --traditional. Must be called
before PL_initialise().
PL_ACTION_WRITE Write the argument, a
PL_ACTION_FLUSH Flush the current output stream. Requires no arguments.
PL_ACTION_ATTACH_CONSOLE Attach a console to a thread if it does not have one. See
attach_console/0.
PL_GMP_SET_ALLOC_FUNCTIONS Takes an integer argument. If
unsigned int PL_version_info(int
key) Query version information. This function may be called before
PL_initialise().
If the key is unknown the function returns 0. See section
2.22 for a more in-depth discussion on binary compatibility.
Versions upto SWI-Prolog 8.5.2 defined this function as PL_version().
It was renamed to avoid a conflict with Perl affecting
Yaswi.
PL_version() is provided as a macro for compatibility. Defined
keys are:
int
)
is the number of frames printed.
int
) is the exit code. See halt/1.char *
to the current output stream.TRUE
, the GMP allocations are
immediately bound to the Prolog functions. If FALSE
,
SWI-Prolog will never rebind the GMP allocation functions. See
mp_set_memory_functions() in the GMP documentation. The action returns
FALSE
if there is no GMP support or GMP is already
initialised.- PL_VERSION_SYSTEM
- SWI-Prolog version as 10,000 × major + 100 × minor + patch.
- PL_VERSION_FLI
- Incremented if the foreign interface defined in this chapter changes in a way that breaks backward compatibility.
- PL_VERSION_REC
- Incremented if the binary representation of terms as used by PL_record_external() and fast_write/2 changes.
- PL_VERSION_QLF
- Incremented if the QLF file format changes.
- PL_VERSION_QLF_LOAD
- Represents the oldest loadable QLF file format version.
- PL_VERSION_VM
- A hash that represents the VM instructions and their arguments.
- PL_VERSION_BUILT_IN
- A hash that represents the names, arities and properties of all built-in predicates defined in C. If this function is called before PL_initialise() it returns 0.
12.4.21 Querying Prolog
- long PL_query(int)
- Obtain status information on the Prolog system. The actual argument type
depends on the information required. int describes what
information is wanted.231Returning
pointers and integers as a long is bad style. The signature of this
function should be changed. The options are given in table
9.
PL_QUERY_ARGC
Return an integer holding the number of arguments given to Prolog from Unix. PL_QUERY_ARGV
Return a char **
holding the argument vector given to Prolog from Unix.PL_QUERY_SYMBOLFILE
Return a char *
holding the current symbol file of the running process.PL_MAX_INTEGER
Return a long, representing the maximal integer value represented by a Prolog integer. PL_MIN_INTEGER
Return a long, representing the minimal integer value. PL_QUERY_VERSION
Return a long, representing the version as 10,000 × M + 100 × m + p, where M is the major, m the minor version number and p the patch level. For example, 20717
means2.7.17
.PL_QUERY_ENCODING