Ann: SWI-Prolog 9.1.12

Dear SWI-Prolog user,

I have uploaded SWI-Prolog 9.1.12. This versions comes with quite a few
additions and some changes. Highlights:

  • Fixed saved state handling for large integers and rationals for
    systems using LibBF (default MacOS binary).

  • is_absolute_file_name/1 on Windows incorrectly did not consider
    c:mydir an absolute path.

  • Several extensions to the C interface. Notably extensions to
    the blob interface, supporting operations on all keys of a dict
    and creating dicts using integer keys from C. Blobs where the
    application holds the data (PL_BLOB_NOCOPY) may now be freed
    explicitly. This releases the managed data immediately, leaving
    the blob itself around for GC.

  • Fixed various build and test dependencies.

The biggest change is the addition of the package swipy that
provides library(janus). Janus, referring to the Roman god of doors
is a library that allows calling Python from Prolog. This work was
started by Theresa Swift and Carl Anderson for XSB. The SWI-Prolog
version was build from the ground. I introduced some lessons I have
learned notably from the recent JavaScript interface. We now have
agreement on most of the differences and eventually we hope SWI-Prolog
and XSB will have a compatible interface to Python. The current
version must be considered alpha code. We’ll follow the usual
open source approach to release early and frequently while early
versions may get incompatible updates. For now, this is the
status:

  • For documentation, start at e.g., py_call/2.

  • Builds on Linux, MacOS and Windows.

  • Requires CMake 3.18 for the configuration and Python 3.8 or
    later. The source tar ball fails to build with older versions.
    You can give -DSWIPL_PACKAGES_PYTHON=OFF to build the rest.
    The GIT source supports older Python versions (probably 3.3)
    and drops the package if CMake is too old.

  • Included in the PPA build for Linux for “jammy” and “kinetic”.
    Older versions (“focal” and “bionic”) dropped the library
    for the above version problem. Note that you can build from
    source on “bionic”, but you must install the latest CMake from
    kitware. edit It was built, but no part of the package :frowning:

  • Included in the Windows 64 binary. Requires Python 3.11 installed
    in %PATH%.

  • Not included in the MacOS binary and the Linux snap package. On
    MacOS due to a lacking universal binary of libpython3 and for
    Snap due to old CMake and the question whether it would work
    from a confined snap anyway.

    Enjoy — Jan

SWI-Prolog Changelog since version 9.1.11

  • TEST: Avoid crash in unicode save/load test when pldoc is loaded. This
    is a work-around for an issue in PlDoc interacting with qcompile/1.

  • ADDED: Return value PL_S_NOT_INNER when acting on non-inner query
    This return code may be generated by PL_next_solution(), PL_cut_query()
    and PL_close_query(). This is a first step making the query interface
    more robust against misuse.

  • ENHANCED: use_foreign_library/2 to support options This patch provides
    standard option support for open_shared_object/3 and passes options
    from use_foreign_library/2 to this predicate. This allows for e.g.

    ?- use_foreign_library(foreign(mylib), [visibility(global)]).
    
  • DOC: Fixed is_absolute_file_name/1 docs

  • FIXED: is_absolute_file_name/1 and canonicalization on Windows. The
    Windows path “c:dir” is an absolute file name. It is now recognized
    as such and its canonical form is “c:/dir”.

  • ADDED: PL_free_blob() This may be used to remove the data from a
    PL_BLOB_NOCOPY typed blob, calling the release() function
    immediately.

  • MODIFIED: PL_call() now passes exceptions This function used to trap
    the debugger and discard the exception.

  • MODIFIED: PL_get_chars() and friends: use numbervars When using
    CVT_WRITE* option, the variables are numbered first if possible.
    That results in more compact, readable and reproducible output.

  • ADDED: Support functions for PL_put_dict() The functions
    _PL_cons_small_int() and _PL_unregister_keys() allow for (small)
    integer keys to dicts from C.

  • ADDED: PL_for_dict() API This API enumerates the key/value pairs of
    a dict using a callback. It has been in use internally since dicts
    were added to the system.

  • FIXED: Locale handling for error messages based on strerror() These
    strings are in the current locale and must thus be converted to
    Unicode for generating the Prolog exception.

  • FIXED: #1184 Load/save (qlf and saved states) for LibBF based bignums
    This patch provides QLF support for big integers and rational numbers
    when compiled with LibBF. The file format for the LibBF and GMP based
    versions is the same and therefore saved states and .qlf files that
    contain such numbers are portable between the two versions.

  • MODIFIED: Allow Prolog data manipulation from tracer callback

  • FIXED: #1185 read_term/3: comments are truncated on first 0-byte

  • PORT: LibBF: Support quick load format for big integers ans rationals.
    Big integers and rationals are now saved if LibBF support is used for
    unbounded integers and rationals. The saved format is identical to
    the format used by the GMP version.

  • PORT: Drop tty_goto/2 and related predicates if the term.h is not
    provided Reported to happen on MacOS using clang-15. The status of
    tgetent() that supports these predicates is rather unclear. Docs say
    they might be discontinued, so more extensive checking that they are
    really available seems justified.

    This patch keeps tty_size/2 if possible (depends on ioctl()).

  • ADDED: evaluable_property/2: iso property.

Package debian

  • ADDED: Python3-dev dependency

Package archive

  • TEST: Avoid dependency on swipl.rc This file is only installed
    with xpce.

Package cpp

  • TEST: Avoid dependency on library(pcre) for running tests.

  • TEST: Failed on Windows Windows writes %p without leading 0x.

  • PORT: Fixed Windows build Not clear to me why the Windows specific C++
    wrapper claims the API functions cannot be found. Disabled for now.

  • DOC: Fixed LaTeX errors

  • ADDED: added API for blobs

Package http

Package pcre

  • TEST: Install input files.

Package pldoc

  • ENHACED: Give manual section in HTML title

Package plunit

  • FIXED: call print_message/2 for begin/end unit also when tests
    run in paralel Runs print_message(silent, plunit(begin(Unit))) and
    print_message(silent, plunit(end(Unit, Summary))).

Package xpce

  • FIXED: Prevent persistent changes to the Prolog stacks in the gui
    tracer
1 Like

Many thanks for this very nice work Jan :

joseph@mx:~$ swipl --version
SWI-Prolog version 9.1.12 for x86_64-linux

:+1: