Ann: SWI-Prolog 9.1.4

Dear SWI-Prolog user,

SWI-Prolog 9.1.4 is ready for download. The version comes with some
important fixes as well as new features. Highlights:

  • Fixed a deadlock in transaction/1 when running concurrently
    with abolish/1.
  • More updates to the sweep Emacs mode by @oskardrums
  • Various fixes and additions to Windows Unicode (UTF-16) handling.
  • Various arithmetic fixes after reports from @j4n_bur53 and
    @ridgeworks. @ridgeworks provided a rational number based
    implementation of rationalize/1.
  • WASM version now provides a single file version as swipl-bundle.js.
    Used by https://dev/swi-prolog.org/wasm/shell. Patch by Jesse
    Wright.
  • @peter.ludemann implemented checking of printf()-like functions
    in the core. Found quite a few issues, though most only affect
    the maintenance debug builds.
  • More work on the MSYS2 port by @mgondan1
  • Major rewrite of library(plunit). Highlights:
    • Provide two feedback styles. When running on a terminal,
      overwrite a single line with successful tests. If a test
      hangs or crashes badly, so see which. Status line and
      messages for failed tests are preserved. When not talking
      to a terminal, print the start and result of each test. That
      is more output. It simplifies finding which test caused a
      crash.

    • Provide output(Mode) option to select output_on_failure
      or always modes.

    • Provide timeout option at global, unit and test level (more
      specific wins).

    • Removed the sto(Mode) option. Now provides occurs_check(+Mode)
      using the corresponding flag values. The flag is inherited,
      so setting it globally runs all tests in a specific mode except
      when redefined locally (unit or test).

    • Provide run_tests(+Tests, +Options). Options set global test
      options as set_test_options/1 and provide summary(-Data) to
      return a dict with statistics on the tests results.

    • Provide global jobs(+Jobs) option to run units concurrently,
      e.g.

      ?- run_tests(all, [jobs(4)]).
      

Quite likely there are regression issues in plunit, especially wrt.
reporting the many possible events during testing. Please report. TAP
compatible output is still on the wish list. This is probably fairly
simple given the current status. I think TAP14 output is YAML friendly,
possibly providing good enough machine readable output.

Enjoy --- Jan

SWI-Prolog Changelog since version 9.1.3

  • DOC: Point at the Prolog flag tmp_dir from the predicates that
    create temporary files.

  • DOC: Document all environment variables that control running the
    test suite.

  • TEST: Run unsafe thread_wait tests only if
    SWIPL_TEST_FAIL_ON_UNLIKELY is set to y.

  • FIXED: 1Inf should be invalid syntax.

  • DOC: Foreign language details. Notable PL_raise_exception().

  • FIXED: With float_undefined set to nan, 0/0 must return NaN.

  • ADDED: WASM: Create swipl-bundle.js that contains swipl-web.js,
    swipl-web.wasm and swipl-web.data.

  • ENHANCED: Rational version of mpq_set_double (rationalize/1)

  • ENHANCED: library(prolog_colour): handle arithmetic functions

  • FIXED: with_output_to/3 to flush the streams before finishing the
    capture.

  • ADDED: Sdprintf() and friends to accept the t integer size specified
    for ptrdiff_t.

  • MAINTENANCE: Added checking format templates for Sdprintf() and friends
    when compiled with -DCHECK_FORMAT. Introduces SdprintfX() and
    similar functions that are not checked because they use one of the
    extensions such as %Us or %Ws (UTF-8/wchar_t string).

  • FIXED: Allow signal handling and e.g. call_with_time_limit/2 on raw
    terminal input.

  • ENHANCED: Messages that refer to predicates.

  • FIXED: ansi_hyperlink/3. Also unify ansi_hyperlink/3 and
    ansi_hyperlink/2.

  • ADDED: list_tracing/0 and hook this into debugging/0.

  • FIXED: trace/2 using -all to stop considering the predicate traced.

  • FIXED: prolog_stack_frame_property/2 for the predicate property.

  • FIXED: Windows: string_length/2 did not handle UTF16 surrogate pairs
    correctly.

  • DOC: Document PL_write_term()

  • FIXED: Possible deadlock in a transaction commit due to different
    ordering in locking L_GENERATION and L_PREDICATE locks.

  • PORT: unix-like directories under MSYS2

  • DOC: fix minor typo

Package clib

  • FIXED: uri_iri/2 to not decode encoding &=; in the query string.

  • PORT: Fix some Sdprintf formats

Package http

  • FIXED: 1Inf → 1.0Inf syntax.

  • ENHANCED: More robust restoring of current output after redirection
    to the CGI stream.

Package pldoc

  • FIXED: Possible race condition when pldoc is loaded concurrently from
    multiple threads. Hook is installed before the predicates it needs
    are defined.

Package plunit

  • FIXED: Avoid defining user:term_expansion/2 as discontiguous. It is
    not defined for swi, causing check/0 to report a warning.

  • MODIFIED: Large scale rewrite the library(plunit). Highlights:

    • Added timeout support - Added concurrency at the unit level
      using the jobs(Jobs) option. - Added output(on_failure) (default)
      to only emit console output
      of a test when it failed. - Added two output formats:
      • tty, which is the default it the output is a tty reuses the
        current output line on success, only displaying failed tests.
      • log, which maintains all output. - Removed the sto(Mode)
        options, replaced by an occurs_check(+Mode)
        option at the global, unit and test level.

    A lot of internal restructuring.

  • MODIFIED: set_test_options/1 to merge the test options with the
    current options.

Package semweb

  • PORT: Fix some Sdprintf formats

Package sgml

  • FIXED: Back skip over UTF-16. @UweR.

  • ENHANCED: Partial support for full Unicode handling ion Windows
    (UTF-16).

  • ADDED: Add ignore_doctype(+Bool) option to explicitly ignore DOCTYPEs
    embedded in XML

Package ssl

  • FIXED: Allow HTTPS server to be started as Interface:Port.

Package sweep

  • DOC: improve documentation for holes

  • ADDED: command to pipe output of Prolog goals to Emacs buffers *
    sweep.c (sweep_open_channel(), sweep_fd_open()): new helper functions
    for obtaining Prolog streams from Emacs pipe buffers. * sweep.pl
    (sweep_async_goal/2, sweep_interrupt_async_goal/2): new predicates.

    • sweeprolog.el (sweeprolog-async-goal): new command, executes a goal
      in a separate thread and redirects its output to a buffer with mode…
      (sweeprolog-async-goal-output-mode): new major mode, derived from
      Compilation mode. (sweeprolog-mode-map, sweeprolog-prefix-map,
      sweeprolog-menu): bind sweeprolog-async-goal. * README.org (Executing
      Prolog Asynchronously): new manual section.
  • FIXED: possible race condition when signaling new top-level threads

  • ENHANCED: consult with library index for finding predicate defs *
    sweep.pl (sweep_predicate_location_/4): also check library_index/3.

    • sweeprolog-tests.el: add test for finding the source location of
      a predicate in the package clib.
  • FIXED: stale xref data when jumping across files with M-.

  • ADDED: right-click context menus in sweeprolog-mode *
    sweeprolog.el (sweeprolog-context-menu-find-module)
    (sweeprolog-context-menu-find-module-other-window)
    (sweeprolog-context-menu-describe-module)
    (sweeprolog-context-menu-find-file)
    (sweeprolog-context-menu-find-file-other-window)
    (sweeprolog-context-menu-describe-predicate): new commands, add to
    context menus by… (sweeprolog-context-menu-for-predicate)
    (sweeprolog-context-menu-for-module)
    (sweeprolog-context-menu-for-file): new functions, used in…
    (sweeprolog-context-menu-functions): new abnormal hook, used by…
    (sweeprolog-context-menu-function): new function. (sweeprolog-mode):
    add it to context-menu-functions.

  • ADDED: short description for tokens on mouse hover (help-echo)

    • sweep.pl (sweep_predicate_dependencies/2): new predicate. *
      sweeprolog.el (sweeprolog-enable-help-echo): new user-option,
      when non-nil sweeprolog-analyze-region-start-hook
      and sweeprolog-analyze-region-fragment-hook are
      extended with… (sweeprolog-analyze-start-help-echo)
      (sweeprolog-analyze-fragment-help-echo): new functions, manage the
      help-echo text property for Prolog text. * README.org (“Hover for
      Help”): new section about help-echo.
  • ENHANCED: improve semantic highlighting for several constructs

    • sweep.pl (sweep_color_normalized_/4): fix handling of
      non-callable terms, propagate type error expected type
      to Elisp. (sweeprolog_goal_kind_normalized/2): rename to…
      (sweep_goal_kind_normalized/2): normalize all goal and head classes.
    • sweeprolog.el (sweeprolog-analyze-fragment-to-faces): adapt to new
      info from sweep_goal_kind_normalized/2, and highlight some missing
      token kinds.
  • DOC: improve listings in the “Editing Prolog Code” section

  • ADDED: command for sending a goal to top-level from any buffer

    • sweeprolog.el (sweeprolog-top-level): extract buffer setup
      logic to… (sweeprolog-top-level-buffer): new function.
      (sweeprolog-top-level-send-string): new function, used by…
      (sweeprolog-top-level-send-goal): new command, reads a goal
      from the minibuffer and sends it to a Prolog top-level buffer.
      (sweeprolog-mode-map): bind it to C-c C-q. (sweeprolog-menu): add
      “Send Goal to Top-level” entry. * README.org (“Sending Goals to the
      Top-level”): new manual section.

Package swipl-win

  • PORT: qmake.pro and includes to compile in QtCreator (up to Qt 6.4)

Package xpce

  • ADDED: Also bind M-j to newline_and_indent. This is not exactly
    the same as Emacs does, but in most cases close.

  • TEST: Skip test if xpce cannot be found.

2 Likes