Ann: SWI-Prolog 9.1.5

Dear SWI-Prolog user,

SWI-Prolog 9.1.5 is ready for download. Highlights:

  • Added IPv6 support in library(socket) and the HTTP libraries.

  • Rational number based comparison for mixed float/rational by @ridgeworks.
    This work MODIFIES standard order for mixed float/rational to first do
    exact comparison and only if that is equal, place the float first.

  • Many documentation updates and tests by @peter.ludemann. Peter also
    added C compile time warnings for internal printf-like functions and
    portability fixes for many calls (most of them are only enabled for
    maintenance debugging though).

  • WASM bundle file, getting a complete Prolog in one .js file by

  • Quite a few fixes and cleanup to the new plunit library.

  • Many updates to the sweep Emacs mode by @oskardrums

  • Properly handle signals in with_mutex/2, and related high level
    mutex predicates.

  • Fixes to http client libs for 1xx and 204 replies to avoid trying
    to read reply content. With help from @gavin.mendel.gleason and @matthijs.

    Enjoy — Jan

SWI-Prolog Changelog since version 9.1.4

  • CLEANUP: Remove profiling library and (dummy) built in predicates if
    execution profiling is not supported.

  • DOC: Fix typos + fix example code. Make PL_get_nil_ex() explicitly
    propagate an old exception. Effectively that would have happened

  • MODIFIED: Move profile interface from library(statistics) to
    library(prolog_profile), With that we can easily omit installing
    this library and C API if the system does not support profiling.
    This is a first rough split, making as few as possible changes.

  • MODIFIED: Deal with return value of the blob save function,
    propagating a possible exception. Documented the save and load
    functions. Joined work by Peter Ludemann and Jan Wielemaker.

  • DOC: Better explanation for list iteration by Peter Ludemann.

  • TEST: More sub_atom/5 and sub_string/5 tests.

  • DOC: sub_atom/5, sub_string/5 by Peter Ludemann.

  • PORT: Silence tcmalloc except for Linux. Not ported to Windows and
    conflicts with libc on MacOS.

  • CLEANUP: Remove old Pentium counters based statistics. Especially
    since we can compile virtual machine instructions to functions we
    have better mechanisms to achieve the same.

  • ADDED: halt/1 to accept signal names as status code. This causes an
    exit with status 128+signum.

  • FIXED: make halt(abort) really ignore halt cancellation.

  • DOC: Clarify some details of PL_put_list(), PL_cons_list(),
    PL_unify_list() and modify some sample code

  • MAINTAINANCE: Added printf format checking to PL_message() and

  • DOC: Issue#1116: typo in example.

  • BUILD: Allow building with -DUSE_GMP=OFF -DUSE_LIBBF=OFF

  • FIXED: LibBF: bug in mpz_rootrem() optimization Tripped over case
    when rop same as OP in degenerate case. Also replace mpz_sub_ui with
    mpz_add_si since argument op_sign is signed.

  • DOC: tweak WASM port introductory text

  • WASM: Added swipl-bundle-no-data.js, providing SWI-Prolog as bundle
    (with wasm bundled in js), but no data file, so you must provide the
    application as saved state.

  • MODIFIED: standard order of terms to use cmpr/2 for comparison,
    comparing mixed float/rational exact (i.e., as rationals).

  • MODIFIED: min/2 and max/2 functions propagate NaN rather than the
    concrete value.

  • ADDED: functions cmpr/2, minr/2 and maxr/2 that compare mixed
    float/rationals exact (i.e., after converting the float to rational).
    The min/max versions propagate the rational in case of a tie and
    propagate numbers rather than NaN.

  • FIXED: If locking mutexes can be interrupted, handle signals and
    exceptions properly.

  • PORT: fix cat2 test for windows

Package clib

  • MODIFIED: uri_authority_components/3: deal with IPv6 addresses embraced
    using [].

  • PORT: Deal with IPv6 address struct for MacOS

  • FIXED: ip_name/2 for ::1.

  • ENHANCED: tcp_connect/3 to stick with using the address information
    if no socket domain is specified, rethrowing the first exception if
    the connection fails.

  • MODIFIED: tcp_connect/3 now tries addresses returned by host_address/2
    in order. This typically prefers IPv6 addresses over IPv4 and connects
    properly if the server can only be accessed on one of these domains.

  • ADDED: ip_name/2 to translate between string and ip address structure.

  • ADDED: host_address/3.

  • CLEANUP: Update socket data structures to support IP6

  • ADDED: socket_create/3. Will replace all other socket creation

  • DOC: move documentation for library(time) to use the PlDoc version
    from the source.

  • ADDED: call_with_time_limit/3, providing a context with the exception.

  • TEST: Fixed encoding of test file.

Package cpp

  • TEST: PL_open_query with various options plus some foreign.doc examples

Package http

  • FIXED: Issue#157: do not try to read the reply data for HTTP return
    codes that have no reply: 1xx and 204.

  • ADDED: http_open/3 using the headers(-Reply) option to add
    status_code(Code) to the headers.

  • FIXED: Issue#157: reading reply for OPTIONS method.

  • MODIFIED: If the server is terminated on a signal, exit with

  • DOC: IPv6 consequences for the HTTP libraries.

  • ADDED: http_server/2 to allow creating IPv6 sockets.

Package odbc

  • PORT: Fix some printf formats

Package pcre

  • ADDED: re_match/2,3: calls to known patterns may be compiled using
    set_prolog_flag(re_compile, true).

Package plunit

  • FIXED: forall(Generator) tests that failed on an assertion considered
    all subsequent generated tests to fail as well.

  • FIXED: run_tests/0-2: failing tests were no longer reflected in the
    success/failure of this predicate.

  • MODIFIED: Removed global concurrent(true), keeping only jobs(Count). At
    unit level, the option is maintained, but currently prints a message
    that it is not supported.

  • FIXED: make/0 to run all unit tests in changed files rather than only
    the first unit.

  • FIXED: Avoid using tty width if really narrow.

  • FIXED: Bad format string. Peter Ludemann.

  • ADDED: Re-implemented library(plunit) option processing, mapping all
    global test options to Prolog flags plunit_<option>, e.g.
    ?- set_prolog_flag(plunit_format, log).

    is the same as

     ?- set_tests_options([format(log)]).

    Added option show_blocked(+Boolean) to list names of blocked tests and
    their reason only on demand.

  • FIXED: reporting blocked tests.

  • ENHANCED: load_test_files/1: provide feedback on found/loaded tests.

  • FIXED: Restore output when interrupting a running test. @swi.

Package semweb

  • PORT: Fix some *printf formats

Package sweep

  • FIXED: end-of-term detection after a fullstop turns to a dict dot
    This fixes an issue with finding clause bounds after changing e.g.:

    foo(Bar, Baz) :- Baz = Bar.  ^ read as fullstop


    foo(Bar, Baz) :- Baz =  ^ read as dict dot
  • ADDED: new commands for managing numbered variables *
    sweeprolog.el (sweeprolog-increment-numbered-variables)
    (sweeprolog-decrement-numbered-variables): new commands.
    (sweeprolog-mode-map): bind them to C-c C-+ and C-c C–.
    (sweeprolog-context-menu-for-variable): allow calling these
    new commands from context menus for numbered variables. *
    sweeprolog-tests.el: add test for incrementing numbered variables.

    • (Numbered Variables): new manual section.
  • ENHANCED: handle renaming variables to existing variable names *
    sweeprolog.el (sweeprolog-rename-variable-allow-existing): new
    user option, used by… (sweeprolog-read-new-variable-try): new
    command, exists the minibuffer if it contains a valid variable name.
    It checks if the selected variable name already exists. Used by…
    (sweeprolog-read-new-variable): new function, reads a Prolog
    variable name in the minibuffer with a dedicated exit command.
    (sweeprolog-rename-variable): use it.

  • ENHANCED: provide exact buffer positions for cross
    references * (reference_span/5): new predicate.
    (sweep_predicate_references/2): use it to find exact character offset
    of predicate references. * sweeprolog.el (xref-backend-references):
    adapt accordingly.

  • ADDED: command for renaming a variable in Prolog term *
    sweeprolog.el (sweeprolog-rename-variable): new command.
    (sweeprolog-context-menu-rename-variable): new command used in context
    menus for variables. (sweeprolog-context-menu-for-variable): new
    function, used in… (sweeprolog-context-menu-functions): add it to
    the list. (sweeprolog-mode-map): bind it to C-c C-r. *
    (Renaming Variables): new section.

  • ENHANCED: use docs from the SWI-Prolog manual to guess hole names * (predicate_argument_names/2): also consult the SWI-Prolog
    manual via pldoc_man:load_man_object/4 to find argument names for
    built-in predicates.

  • ADDED: numeric argument for sweeprolog-forward/backward-hole

    • sweeprolog.el (sweeprolog-count-holes): new command,
      counts holes in the current buffer. (sweeprolog-forward-hole,
      sweeprolog-backward-hole): new numeric argument, corresponding to the
      prefix argument when called interactively. With positive/negative
      numeric argument, move over that many holes. With zero numeric
      argument, call sweeprolog-count-holes instead.

P.s. Updated the “snap” version to use core20 (Ubuntu 20.04). This caused some problems. After some work-arounds this version seems to work fine and seems to avoid warnings about fonts in previous snap releases.

Also pushed an update for the Docker library.

1 Like