Ann: SWI-Prolog 10.0.1 (stable)

Dear SWI-Prolog user,

SWI-Prolog 10.0.1 (stable) is ready for download. This is a complete
merge of the current development version. Highlights:

  • Many fixes and enhancements to the GUI toolkit.

  • Many fixes and enhancements to the JSON-RPC server. This, with the
    GUI toolkit changes adds core support for LSP (Language Server Protocol)
    clients to the editor.

  • Various development tool enhancements.

    • Improvements to edit/1 (better result merging and allow editing
      foreign predicates on some platforms (notably Linux). E.g.
      ?- edit(retract). Also works on dynamically loaded extensions.
      Unfortunately not for C++ defined predicates.
    • Support thread local predicates in other threads using listing/2
      and the Listing menu item in the source level debugger.
  • Code cleanup

    • Patches by @mgondan1 to fix implicit integer truncation, mostly
      by using more consistent integer types. Pretty much all benign.
    • Patches by @EricGT to the MSVC port. The complete system can
      now be built using all build types (except PGO), only leaving
      a couple of build-system warnings. All tests pass.
    • Patches to improve internal typing. Many int types have been
      changed into bool or an enum type. This makes the source
      easier to read. Fixed several error handling scenarios. Might
      cause regression.
  • All cleanup fixes a couple of bugs, notably reading uninitialized
    memory. This affects notably (1) tries (tabling), (2) clause
    references (assert/2, etc.) and (3) bignum format output on Windows.

  • MacOS build updates for Homebrew dependencies and building using
    GCC. The MacOS fat bundle is now compiled using GCC, making it
    30-40% faster than the Apple Clang compiled version.

  • Updated dependencies for Windows and MacOS binary distributions.
    Notably OpenSSL and SDL3.

  • Updated Ubuntu PPAs for all active Ubuntu releases, including
    26.04 (Resolute Raccoon). Note that the releases for Jammy and Noble
    do not include the GUI due to lacking SDL3 libraries.

    Enjoy — Jan

SWI-Prolog Changelog since version 10.0.0

  • TEST: added tests for library(record)

  • FIXED: reload_foreign_libraries/0. Failed with type error.

  • TEST: Fixed Debug build test on Windows to avoid C stack overflow.
    Based on PR by Eric Tauber. This replacement builds on the new Prolog
    flag build_type and rewrites the test suite to use PlUnit.

  • ADDED: Prolog flag build_type, representing the CMake build type
    used.

  • FIXED: library(main): make spy options default to the user module.

  • BUILD: added comments to scripts/configure

  • BUILD: added comments to CMakeLists.txt for protobufs test

  • DOC: clarified details of heap allocation

  • PORT: Minimize C stack on MSVC debug builds.

  • TEST: Skip test_thread_exit if alert signal == 0

  • PORT: Include platform pthread headers and includes for pthread config.

  • FIXED: #1465 Overflow issue in trie handling. This is the result of
    replacing an int incorrectly with bool.

  • FIXED: PThreads4W exit crash in MSVC Debug builds Without this,
    the system crashes during process exit.

  • ENHANCED: listing/1,2: show number of clauses in other threads.

  • ADDED: listing/2: option thread(+ThreadId) This lists the clauses
    for a thread-local predicate as they can be seen for the given thread
    (rather than the calling thread).

  • MODIFIED: Modified PL_put_dict() to be a bool function. All usage
    in packages assumed bool and this is a more consistent interface.
    Invalid keys now generate a fatal ABI error and dupiicate keys a normal
    Prolog exception. As this function is not used much and there is no
    clean way to fix the current bugs without changing the API we will
    backport this to the stable series as is.

  • FIXED: dict_pairs/3 could create dicts with duplicate keys.
    Mistake changing types to bool. This changes the dict ordering
    functions to return _PL_dict_status_t, which is now also returned
    by PL_put_dict().

  • CLEANUP: Avoid unreferenced variable warning for MSVC

  • BUILD: MSVC Sanitize build

  • TEST: Windows pipe test by using absolute batch file path The pipe:cat1
    test was failing because the batch file path was relative. cmd /c
    couldn’t find pltest-XXXX.bat. Fixed using absolute_file_name/2.

  • BUILD: Use proper CMake dependencies for building the INDEX.pl
    files Since we no longer merge the package library files with the
    main library and since CMake has evolved, we can get rid of the ugly
    “run always” approach to building the INDEX.pl files and create
    a proper custom rule with the proper dependencies.

  • FIXED: Hashing over uninitialized memory on 32-bit systems. On 32-bit
    systems, clause references are created in part from unitialized memory.
    This leads to crashes in atom-gc for clause references.

  • TEST: Add alternative bitint term hash for 32 bit engines.

  • PORT: Remove /D_DEBUG and /DO_DEBUG from MSVC Sanitize build flags
    MSVC AddressSanitizer requires the release CRT (/MD), but /D_DEBUG
    causes the STL to reference debug-CRT symbols (_CrtDbgReport) and
    makes Python headers demand python3XX_d.lib.

  • PORT: MSVC debug build CRT mismatch for plugins

  • PORT: MSVC debug build: variadic macros and PRETTY_FUNCTION

  • PORT: Set CMAKE_MSVC_RUNTIME_LIBRARY globally for MSVC builds

  • PORT: Fix MSVC C4334 warning in pl-buffer.c

  • PORT: Drop xpce on < 64 bit platforms.

  • BUILD: Extend build_home.pl to support multi-config generators There
    was specific code to support Microsoft Visual Studio. This patch
    supports multi-config generators on platforms that leave the modules
    in the package directories such as ninja -G "Ninja Multi-Config"

  • PORT: Avoid undefined ms_snprintf() and renamed to c99_snprintf().

  • PORT: Add /EHsc to MAKE_CXX_FLAGS for MSVC. Thanks to Eric Tauber.

  • CLEANUP: Avoid implict enum conversion warnings. Based on #1445 by
    Eric Tauber.

  • FIXED: Make PL_query(PL_QUERY_HALTING) return true inside atexit()
    handlers. This addresses the cleanup in package nlp cleanup issues.

  • PORT: Make exit() work properly in Windows with Asan and Debug enabled.
    Thanks to Eric Tauber.

  • PORT: Avoid calling sleep() after Lsan detects a leak.

  • PORT: Updated scripts/macos-deps.h for SDL3 Updated version and build
    instructions for building a universal binary.

  • ADDED: check_installation/0: report OpenSSL version

  • PORT: Exclude LeakSanitizer code on Windows (MSVC ASan lacks LSan
    support)

  • FIXED: Bignum allocation issues. This may lead to memory corruption
    on LibBF as well as using GMP on arithmetic errors. Found by Eric
    Taucher while debugging the MSVC compiled version.

  • FIXED: Tabling with attributed variables: memory management. Make sure
    avm in trie_lookup_abstract() never points below the allocated
    buffer. It is not clear to me whether that is strictly necessary,
    but MSYS-2 using clang and Asan suggests it is. I do not understand
    why this is not reported using Asan under Linux. Surely this prevents
    reading below the buffer, causing a SEGV if it is tried anyway.

  • TEST: term_hash/2 for indirect data types (bigints, floats) term_hash/2
    is platform dependent as it hashes the binary representations of
    indirect types (big int, rational, float). The test succeeds if
    the produced hash is one of a set. When using LibBF, the hash also
    depends on whether the limb size is 32 bits or 64 bits. The C
    compiler must support a twice as wide integer type, i.e., the choice
    depends on HAVE_INT128.

  • FIXED: term_hash/2: exception when exhausting memory. Also cleanup
    types.

  • CLEANUP: Avoid reading uninitialized local variable. Not entirely sure
    why the popSegStack() can fail. Surely it does on the XSB tests from
    tests/xsb/sub_tests/xsb_test_sub.pl. In debug mode we set dstate
    such that accessing it crashes. This seems not to be the case.

  • FIXED: Windows: ms_snprintf null-termination bug for edge case

  • PORT: Ensure default 4Mb C-stack on Windows Otherwise the default is
    2Mb for MinGW and 1Mb for MSVC

  • FIXED: When specified, also set the C-stack limit for swipl-win

  • PORT: Compile MacOSX bundle using gcc. This provides about 40%
    performance improvement.

  • PORT: Support CMake < 3.24 Using CMake < 3.24 the build was broken due
    to the usage of cmake -E env ... -- ... We now omit that for older
    cmake version. This implies that building in e.g build.gcc=14
    does not work for these versions.

  • FIXED: write_term/2: handle partial(true) for backquoted text.

  • FIXED: write_term/2 using option partial(true) to separate quoted
    objects. Found by Joachim Schimpf

  • DOC: write_term/2: handling of back_quotes and module options

  • FIXED: write_term/3 and friends to get default back_quotes from flags.

  • PORT: Better support for Homebrew dependencies (MacOS) This ensures
    SDL3 comes from Homebrew if both provided by Macports and Homebrew and
    configure maps gcc=14 to Homebrew gcc.

  • PORT: Make configure work for build.gcc=15 on MacOS. Compiler is
    called gcc-mp-15 and it does not support -g3.

  • ENHANCED: edit/1: merging module and file. If a spec resolves to a
    file and module with the same name, edit the module.

  • FIXED: Allow building only the core system (no packages at all).
    Stop installing libraries that depend on packages and do not warn if
    library(editline) is not present.

  • FIXED: #1436 check_installation/0: check editline, also on Windows.

  • FIXED: CpuCount() typing

  • FIXED: Type issues on 32 bit platforms

  • CLEANUP: Types Restore API affecting type changes of -Wconversion
    cleanup, introduce new integer aliases and enums to replace int
    with more appropriate types. Propagate these through the system
    (incomplete).

  • CLEANUP: Make likely/unlikely silent.

  • FIXED: #1431 format/2: handling ~d on gmp evaluation returning
    a small int.

  • ENHANCED: edit/1: if multiple hits are in the same file, take most
    specific. Thus, if both the file and some object inside the file
    match, use the object. Also xpce classes are more specific that the
    module they are contained in.

  • FIXED: edit/1 for normal predicates. Broken after integrating
    foreign predicates.

  • FIXED: UBSAN: Calling event handler with too many arguments.

  • UBSAN: Avoid offset to NULL pointer

  • UBSAN: Possible increment of NULL pointer This is benign, but
    officially undefined.

  • FIXED: Type handling for PL_thread_at_exit(). Resulted in reported
    undefined behaviour due to non-matching function prototype.

  • CLEANUP: Unconditionally use fpclassify() This is available on any
    system providing C99 and we already demand C11.

  • PORT: Make compile using Emscripten

  • ADDED: Extract the source location of foreign predicates. Added
    '$foreign_predicate_source'/2. Requires debug symbols and
    addr2line or similar.

  • THEME: Support PceEmacs bookmark view in the dark theme,

  • DOC: library(persistency): document generation of asserta_<pred>

  • UBSAN: Avoid bit shift == sizeof(x) The proposed change is not pretty,
    but it avoids another UBSAN error if low (64 bit) is << by 64 bits.

  • UBSAN: Avoid bit shifts in MT RNG

  • FIX: UBSAN check Avoid memcpy(NULL, _, 0)

  • FIXED: bigint cache allocation error Can lead to buffer overflow.

  • CLEANUP: use snprintf to avoid deprecation warnings

  • PORT: replace sprintf by snprintf to avoid deprecation warnings

  • BUILD: Updated scripts/configure Simplified, added --help
    option and allow for both extracting features from the name and using
    commandline arguments.

  • FIXED: Undefined ep_has_console/1 message when enabling the debugger.

Package archive

  • CLEANUP: avoid -Wconversion warnings

Package bdb

  • CLEANUP: Avoid -Wconversion warnings You might wish to check if the
    assertions are needed/solve a problem.

Package clib

  • CLEANUP: Bool types and avoid conversion warnings for Windows

  • PORT: Ensure ssize_t is defined when using MSVC

  • ENHANCE: use size_t to avoid -Wconversion errors I also added a few
    casts I considered safe. Dubious casts are highlighted.

  • DOC: minor fix in comment

  • PORT: replace sprintf by snprintf to avoid deprecation warnings

Package cpp

  • ENHANCED: make it easier to generate the standard form of exceptions

  • CLEANUP: add more default qid=0

  • CLEANUP: Plx_exception() has default qid=0

  • CLEANUP: change PL_exception() to Plx_exception()

  • ASAN: add comment

  • ASAN: avoid uninitialized buffer in fread This silences an ASAN error
    mentioned in ASAN: Container overflow ¡ Issue #105 ¡ SWI-Prolog/packages-cpp ¡ GitHub.

    1. I don’t really see the point, but maybe clang’s ASAN does not like
      to write into “reserved” but not initialized memory areas.
    2. Alternatively, and that may be the reason for the ASAN complaint:
      buf in the outer std::string(buf, size) function is not “officially”
      initialized. * DOC: fix description of PlQuery::next_solution()

Package http

  • BUILD: Add zlib to doc generation dependencies

  • ENHANCED: http_post_data/3 to raise an exception if the data is
    not recognised.

  • CLEANUP: avoid -Wconversion warnings

  • ADDED: Extended predicate option declaration for http_read_data/3
    Added the common JSON options. Note that these options only work if
    the plugin library(http/http_json) is loaded.

Package jpl

  • CLEANUP: avoid -Wconversion, improve UTF16 support On systems with
    wchar_t is 4 bytes (pretty much anything but Windows), convert
    Prolog Unicode code points > 0xffff to/from UTF-16.

Package json

  • CLEANUP: avoid -Wconversion warning

  • FIXED: Server side handling for methods without parameters.
    Now accepts omitted params field as well as ""params: {} as
    valid input for such a method.

  • FIXED: Correctly call methods that take no parameters

  • ADDED: json_call/4: option async(:Goal) Extends async(true) to get
    an asynchronous reply.

  • FIXED: json_method/1: Avoid discontiguous messages

  • ADDED: Print a warning if the server receives a non-implemented
    notification.

  • ADDED: json_rpc_call/4, etc: option thread_alias(+Atom)

  • ADDED: JSON RPC server: set json_rpc_stream global variable while
    dispatching. This variable provides access to the underlying stream.
    This may be used to identify the connection.

  • FIXED: Apply header to server van using client in full duplex mode.
    Also code cleanup, avoiding code duplication between client and server
    by adding json_rpc_common.pl

  • ADDED: json_call/3 option async(true) JSON RPC allows calls with a
    request id not to send a reply. This option adds an id, but does
    not wait for a reply.

Package libedit

  • FIXED: Build on Windows for enhanced background write handling.

  • ENHANCED: Refreshing the terminal on background writes.

Package nlp

  • FIXED: Crash during cleanup on Windows This patch replaces the
    pthread specific handling of the thread specific stemmers with
    __thread__ and using Prolog’s ``PL_thread_at_exit’’ to clean
    stemmers for terminated threads.

    This is a safe solution that also avoids the need for platform
    specific code.

Package plunit

  • FIXED: Allow for concurrent loading of unit test files.

Package sgml

  • CLEANUP: avoid -Wconversion warnings

  • CLEANUP: Use snprintf to avoid deprecation warnings

Package ssl

  • CLEANUP: avoid -Wconversion warnings

Package table

  • CLEANUP: avoid -Wconversion warnings

  • FIXED: Windows: close memory leak after error.

  • CLEANUP: use snprintf to avoid deprecation warnings

Package tipc

  • CLEANUP: Modernise exception handling, use bool and update PlDoc

  • CLEANUP: avoid -Wconversion warnings

Package utf8proc

  • CLEANUP: avoid -Wconversion warnings

  • FIXED: #1 UBSAN: adding to NULL pointer.

Package xpce

  • ENHANCED: PceEmacs to list thread-local clauses. If a PceEmacs window
    is embedded in the debugger, fetch the target debug thread and list
    the clauses as the debuggee sees them.

  • FIXED: undefined Dprintf and _T symbols in terminal.c debug code

  • FIXED: MSVC C4319 warning and potential bug in
    clearDFlagProgramObject() Cast mask to uintptr_t before applying
    bitwise NOT. Without this, ~mask produces a 32-bit result on Win64
    (unsigned long is 32 bits) that gets zero-extended to 64-bit uintptr_t,
    incorrectly clearing the upper 32 bits of dflags.

  • CLEANUP: Remove old deprecated usage of SunOS on_exit()

  • ADDED: implementation for 3d rounded corners box r_3d_box()

  • ENHANCED: 3d effect rendering. Notably makes scrollbars look better.

  • PORT: Support MSVC

  • FIXED: GUI Tracer: remove non-functioning Help menu entries. Links to
    the manual and notably xpce manual seem unnecessary. Also removed
    the About as it is all part of the integrated Prolog IDE tools.

  • ADDED: PceEmacs: associate emacs_<mode>_mode module with mode.
    And define style/2 and def_style/2 for style mapping. This is used
    by the experimental LSP client and should be used by the other modes,
    notably the Prolog mode.

  • CLEANUP: Avoid suspicious sizeof() handling warning by clangd

  • FIXED: Use font<-average_char_width for width computations This
    used to be font<-ex, but this is the height of the x character.
    This notably fixes the default width of PceEmacs windows to hold 80
    characters rather than a few less (depending on the font).

  • FIXED: PceEmacs Prolog mode: find-references to avoid duplicates.

  • FIXED: class text_buffer: LSP position reporting for wide-character
    buffers.

  • FIXED: Epilog: underline could continue in scrollbar.

  • FIXED: text->underline. Underline was relative to top instead
    of base.

  • ENHANCED: When opening one of xpce’s manual tools, do not show @manual.
    This additional window is often needed and especially on systems that
    do not allow for window placement, this is annoying.

  • ENHANCED: Make most errors that result from buggy program print
    a backtrace

  • ADDED: PceEmacs: (empty) markdown mode. Allows for user extension,
    so we can play with markdown LSP servers.

  • ENHANCED: editor->align: minimize the change This reduces
    change/undo info and keeps the buffer marked clean if no change
    happens.

  • FIXED: Collecting LSP change message could corrupt edit modifications.

  • ADDED: Broadcast pce_emacs(saved(Buffer)) when a buffer was saved.
    Can be used to trigger an LSP didSave() event, automatically recompile,
    etc.

  • FIXED: Avoid undefined @nil->update in bookmark handling.

  • ENHANCED: Only display output from help/1 in GUI when invoked from
    the gui.

  • ADDED: error->feedback type backtrace to force errors to dump
    a backtrace.

  • FIXED: Avoid memory corruption when ->initialise fails. The partial
    object may have references. If so, leave its final destruction to
    the reference count dropping to zero.

  • CLEANUP: Replace all calls to sprintf() with snprintf()

  • FIXED: Thread monitor. Broken due to changes to class image.
    New code is simplified by using image->fill and num rather than
    int|real type.

  • FIXED: image->fill to accept a colour. Filling with images is
    currently not supported.

  • ADDED: Exploit features to edit foreign predicates directly.

  • FIXED: swipl-win: deadlock when trying to attach a console to
    the xpce (main) thread.

  • FIXED: Underline colour when using default underline. If a line
    contains two fragments with different colour and underline, the first
    used the colour of the second.

  • ADDED: Update bookmarks both when saving and colouring.

  • FIXED: PceEmacs bookmarks: update when saving the buffer.

  • ADDED: PceEmacs Prolog mode: find_references (Alt-?)

  • FIXED: PceEmacs bookmarks displaying the full path.

  • ENHANCED: PceEmacs bookmark list Create nodes per file and provide
    proper highlighting

  • ADDED: Class grbox: allow for baseline vertical aligment.

  • FIXED: Class grbox was not displaying

  • ADDED: parbox->initialise: allow adding content

  • FIXED: Class parbox redraw handling for opacity.

  • ENHANCED: Style PceEmacs bookmarks

  • ADDED: Support background of style in class tbox.

  • ENHANCED: PceEmacs bookmark handling. Allow bookmarks on a selection
    inside a line. Working on a non-persistent bookmark instance that we
    can use for dynamic sets such as search hits, references, errors, etc.

  • ENHANCED: @emacs->goto_source_location: use new line_pos and
    length

  • ADDED: Class source_location: line_pos and length fields.

  • ADDED: PceEmacs: allow adding new type-based prompting.

  • ADDED: editor<-dabbrev_candidates: mode user0 This mode allows
    completion that is more targeted than searching the current buffer.
    It is intended to support intelligent completion using M-/.

  • MODIFIED: Removed image<->foreground and image<->background.
    Also removes corresponding initialization arguments from class pixmap
    and image->set_pixel and image->clear_pixel.

    Use image->pixel to set pixels in an image.

  • CLEANUP: Remove bitmap<-display. Bitmaps are no longer related
    to a specific display.

  • CLEANUP: Removed image<->depth All our images are now 32-bit RGBA

  • MODIFIED: Removed bitmap<->transparent No longer needed. This also
    removes the second argument from ->initialise.

  • CLEANUP: Removed image->mask Since we have an alpha channel on
    images this is no longer needed.

  • ADDED: Icons for LSP fix and tweak operations

  • ADDED: class label: allow image selection to be scaled using
    ->width

  • ADDED: image->resize. Now only sets the width and height.

  • CLEANUP: Removed a lot of outdated image code

  • FIXED: LSP change message for consecutive backward delete.

  • FIXED: class text_buffer: undo handling. Undo may be lost if two
    consecutive changes that can be merged are executed on a virgin buffer.

  • FIXED: r_3d_box(): device offset for filling the box was applied twice.

  • ADDED: PceEmacs: support hovering fragment icons.

  • ADDED: PceEmacs: quick action for commenting xpce get methods.

  • FIXED: Class editor: align line spacing between normal and bold fonts.

  • ENHANCED: Moved font ascent and descent to main object. This allows
    for adjusting the line spacing of a font, such that we can ensure
    consistent line spacing for normal and bold font in editors.

  • ENHANCED: Class font: properly compute ex Instead of using
    simulation, being 1/2*h.

  • ADDED: ``editor->hover_fragment_icon: fragment*, [area]‘’ Called from
    the margin to act on hovering the margin icons.

  • FIXED: Underline in class tbox

  • FIXED: PceEmacs: keep LSP servers in sync on M-x revert

  • ENHANCED: text_margin: indicate that a fragment icon can be clicked.

  • FIXED: text_margin: display fragment that appears on first line

  • ADDED: text_margin->icon_size to scale icons.

  • ADDED: Margin icons for LSP diagnostic types

  • FIXED: Broadcast changes due to white space normalisation while saving

  • ENHANCED: Class editor: use real bold font instead of simulated.
    This results in cleaner and more efficient rendering.

  • ADDED: style->underline is now either a boolean or a colour
    Colour is also supported by text->underline. Future versions may
    also add names for specific underline styles.

    This patch also replaces the use of fixed offset and thickness for the
    line by using the Pango suggested values for the current font.
    This makes
    underlined text look more natural, in particular when using larger
    fonts.

  • FIXED: Re-implement style->grey Was lost in conversion to SDL.

  • FIXED: Avoid warning on freed object when closing a PceEmacs window
    This is harmless, but annoying.

Package yaml

  • CLEANUP: avoid -Wconversion warnings
3 Likes