Ann: SWI-Prolog 9.0.4 (stable)

Dear SWI-Prolog user,

SWI-Prolog 9.0.4 (stable) is ready for download. In the stable release
we only deal with fixes, documentation and portability issues. An
exception is the Emacs sweep mode, which we simply keep update for the
time being. This release also includes the Redis extensions to connect
to TLS enabled servers and talk to Redis “Sentinel” servers.

This release includes a number of urgent fixes, incorrect results,
crashes and deadlocks. Please scan the ChangeLog below for details.

Enjoy --- Jan

SWI-Prolog Changelog since version 9.0.3

  • 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.

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

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

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

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

  • 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

  • DOC: Document PL_write_term()

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

  • DOC: fix minor typo

  • FIXED: Issue#195: cmpFloatNumbers() for NaN.

  • FIXED: Implement A_MPZ and A_MPQ instructions when using LibBF
    binding. This fixes using such numbers in expressions compiled with
    optimization enabled. Reported by Rick Workman.

  • FIXED: Issue#1091: optimised compilation of clauses containing big
    integers or rational numbers in expressions.

  • FIXED: Issue#1092: term_hash/2,4 crashes on Unicode strings.

  • ADDED: list_debug_topics/1 to search, only print active topics,
    etc. This predicate now uses print_message/2. debugging/0 is hooked
    to show the active topics.

  • ADDED: debugging/0: allow extensions using

  • DOC: Fixed PL_Q_CATCH_EXCEPTION interaction with the debugger.

  • DOC: Reviewed and updated foreign language sections on exception
    handling. Thanks to Peter Ludemann for pointing the many parts of
    the docs that were unclear or outdated.

  • DOC: Added some details for PL_exception()

  • FIXED: Issue#1087: crash on inlined unification against a rational

  • DOC: rational/1 and rationalize/1 use current notation.

  • PORT: msys2, add %MINGW_PREFIX%/bin to dll path

  • PORT: msys2, do not copy system dlls into home

  • ADDED: Prolog flag msys2 to detect the MSYS2 installation.

Package archive

  • PORT: Simply use int64_t as older 3.x libarchive versions do not
    define la_int64_t. Simply using int64_t seems the easiest way out.

Package clib

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

  • FIXED: detach_IO/1: Protect I/O stream against garbage collection.

Package http

  • FIXED: 1Inf1.0Inf syntax.

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

  • ADDED: library(http/http_error): dynamic predicate
    http_error:suppress_code/1 to make the library silent on specific
    reply codes.

  • ENHANCED: Avoid confusing “Unknown message” from library

  • FIXED: Avoid recursion when garbage collecting HTTP sessions under
    Redis session management.

  • ENHANCED: Do not try to send websocket broadcast messages after
    shutdown progressed too far.

  • ADDED: library(http_unix_daemon) to broadcast http(shutdown) before
    calling halt(0).

  • ENHANCED: http_absolute_uri/2 to use the setting http:public_scheme
    or the port to find the scheme (http or https)

  • ENHANCED: Redis http session plugin to use caching to speedup checking
    whether a session is alive.

  • FIXED: Issue#120: term//2 (term to HTML) rendering of infix terms if
    these contain “member” terms with arity 2.

Package odbc

  • PORT: More odbc type work around. As we do not use long [long] int
    sizes or availability, just leave them undefined and let unixODBC do
    its magic.

  • PORT: Include patch from Debian for some 32-bit systems. Some versions
    of sql.h depend on HAVE_LONG_LONG. Our code does not use any of
    the properties for long int.

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 redis

  • ENHANCED: Avoid hanging connection on invalid authentication.

  • ADDED: Split authentication for the redis instances from the sentinel

  • FIXED: Also connecting to the sentinels require authentication.

  • ADDED: Connect to a master through a sentinel network.

  • ADDED: Support Redis TLS connections.

Package sgml

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

  • ENHANCED: Partial support for full Unicode handling ion Windows

  • 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_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. * (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_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-describe-predicate): new commands, add to
    context menus by… (sweeprolog-context-menu-for-predicate)
    (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_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. * (“Hover for
      Help”): new section about help-echo.
  • ENHANCED: improve semantic highlighting for several constructs

    • (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. * (“Sending Goals to the
      Top-level”): new manual section.
  • DOC: explain how to follow source locations in top-level messages

  • MODIFIED: do not force set next-error buffer to Prolog buffer

  • ENHANCED: use terms at point as “future history” for term-search * (sweep_terms_at_point/2): new predicate. * sweeprolog.el
    (sweeprolog-terms-at-point): new function. (sweeprolog-read-term):
    use it for setting the future history. (sweeprolog-read-goal):
    new function. (sweeprolog-term-search): use it for reading a goal
    when called with prefix argument.

  • ENHANCED: Support refining term searches with arbitrary goals * (sweep_term_search/2): extend with an extra goal argument.

    • sweeprolog.el (sweeprolog-read-term): new function, similar to
      read–expression but for Prolog terms rather than Elisp expressions.
      (sweeprolog-term-search): use it, and prompt for goal with prefix arg.
  • ENHANCED: restore original point when a term search is quit

  • ADDED: command for finding terms subsumed by a given
    term * (sweep_term_search/2): new predicate. *
    sweeprolog.el (sweeprolog-term-search-in-buffer): new function.
    (sweeprolog-term-search): new command. * (“Term Search”):
    new manual section.

  • FIXED: find next predicate definition more reliably

    • (sweeprolog_beginning_of_last_predicate/2)
      (sweeprolog_beginning_of_last_predicate/2): explicitly sort results,
      don’t assume xref_defined/3 yields ordered results.
  • ADDED: user option to control predicate documentation composition *
    sweeprolog.el (sweeprolog-insert-pldoc-for-predicate): remove in
    favor of… (sweeprolog-insert-predicate-documentation): new function.
    (sweeprolog-format-term-with-holes): new utility function,
    used by… (sweeprolog-read-predicate-documentation-with-holes)
    new functions, used for…
    (sweeprolog-read-predicate-documentation-function): new user option,
    used by… (sweeprolog-read-predicate-documentation): new function,
    used by… (sweeprolog-document-predicate-at-point): refactor.

  • ADDED: New command sweeprolog-insert-term-with-holes * (sweep_format_term/2, sweep_current_functors/2): new
    predicates. * sweeprolog.el (sweeprolog-read-functor-history):
    new variable, history list for… (sweeprolog-read-functor):
    new function. (sweeprolog-forward-hole-repeat-mode): rename
    to… (sweeprolog-forward-hole-repeat-map): corrected name
    for keymap. (sweeprolog-analyze-end-font-lock): don’t rely
    on sweeprolog–next-hole to move point. (sweeprolog-at-hole-p,
    sweeprolog-beginning-of-hole) (sweeprolog-end-of-hole): new functions,
    used by… (sweeprolog–previous-hole, sweeprolog–next-hole):
    revise. (sweeprolog–precedence-at-point): new function,
    used by… (sweeprolog-insert-term-with-holes): new command.
    (sweeprolog-mode-map): bind it to C-c C-m * sweeprolog-tests: test
    it. * (“Filling Holes”): move to top and rename to…
    (“Holes”): document sweeprolog-insert-term-with-holes.

  • ENHANCED: use variable names from docs when inserting next clause

    • (sweep_format_head/2): new predicate. * sweeprolog.el
      (sweeprolog-insert-clause): use it.
  • ENHANCED: highlight holes in incomplete terms * sweeprolog.el
    (sweeprolog-predicate-completion-at-point): fontify holes when
    inserting them. (sweeprolog-analyze-start-font-lock):
    reset font-lock-face in analyzed region.
    (sweeprolog-analyze-fragment-to-faces): fix syntax
    error handling, don’t highlight holes as it is done by…
    (sweeprolog-analyze-end-font-lock): new function, highlights holes
    in analyzed region when sweeprolog-highlight-holes is non-nil.
    (sweeprolog-analyze-region-end-hook): add it. (sweeprolog–hole):
    fix text property used for setting stickiness.

  • FIXED: possible crash after calling sweeprolog-restart

Package swipl-win

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

Package xpce

  • TEST: Skip test if xpce cannot be found.

Hi, I just installed this as part of Ubuntu-MATE 23.04. All looks good except all the text in the graphical trace panel is double spaced and therefore hard to read. I suspect this is something to do with the switch to UTF-16.

It is, AFAIK, not an UTF-16 issue. It has to do something with the X11 font management. It happened with various configurations, but the last time the issue was raised is quite long (years) ago. So long ago that I forgot the work-around :frowning: Should be somewhere on this forum or possibly even older mailing list.

edit Found X-Window XPCE debugger - #10 by jan