Ann: SWI-Prolog 9.2.0 (stable) and 9.3.0 (new devel series)

Dear SWI-Prolog user,

I’m happy to announce SWI-Prolog 9.2.0 as a new stable release.
Version 9.0.0 was released November 24, 2022, about 14 months ago.
The number of changes is large and would not have been possible
without the involvement of amateur, academic and commercial users.
Thanks for all the bug reports, comments and pull requests!

Not many changes are related to the core of the system. Instead,
new interfaces, improved and extended tooling and portability have
been the main focus of this release.

Note Many of the Prolog library files have been moved. As a result, installing the new version over the old version leads to duplicates of these libraries. This may result in loading old libraries or trying to load both the old and new one, leading to a module conflict. If you install from source

  • Remove the old installed system. You can find its location by running swipl --home
  • Delete the build directory and re-run cmake. If you insist preserving the build directory, remove the home directory inside the build directory and run cmake . to prepare a fresh one.

Package managers typically take care of removing the old version. The Windows installer asks for uninstalling the previous version. Please do.

Highlights

  • @peter.ludemann has produced a second incarnation of the C++
    interface as SWI-cpp2.h. The new interface covers practically
    the whole C API and results in fewer surprises by relying or more
    explicit conversion rules. Possibly more valuable is that Peter
    contributed a lot in improving the documentation of the C API
    and helped resolving many ambiguities.

  • The “Janus” Python interface was added. Janus provides a
    comprehensive bi-directional interface between SWI-Prolog and
    CPython. Janus was also the first PIP (Prolog Improvement
    Proposal
    ) project were the XSB, Ciao and SWI-Prolog
    developers cooperated to establish a compatible interface.

  • The sweep project by @oskardrums has advanced a lot, providing
    a nice advanced GNU-Emacs edit mode for SWI-Prolog.

  • @ridgeworks has improved the profile data collection, allowing
    for two modes: a precise port count mode and the “classical”
    mode. For now the classical mode is the default because the
    new mode can cause the established dynamic call tree to grow
    (too) big.

  • Coverage analysis has been improved a lot. Data collection
    is no longer based on intercepting the tracer, but on a VM
    level extension. This reduces the overhead from about 20
    times to 2 times. Furthermore, line level annotation of
    source files, handling multiple threads and combining the
    results of multiple Prolog invocations has been added.

  • PlUnit (Unit testing) has been modernized. Notably allows
    for running tests concurrently and hide output of tests unless
    the test fails.

  • There is a new option for adding command line tools, called
    “apps”. These tools are Prolog files added to the file search
    path app that can be called as below. SWI-Prolog now ships
    with qlf and pack as two apps to manage quick load files
    and installed packages.

    swipl app [arg...]
    
  • The WASM version has been improved a lot. Thanks to @jeswr.

  • The pack manager got an app to allow for e.g.

    swipl pack install [option ...] pack1 pack2 ...
    

    The new pack manager deal with version restrictions for other
    packs as well as the Prolog system used. Pack may also
    require certain Prolog features to be present. Packs may
    build and test dependencies using CMake.

  • Portability has been improved.

    • Sources can now be compiled using strict C11, i.e., without the
      GNU/Clang extensions. This allows for building using MSVC,
      tested using VS2022.
    • @mgondan1 help fixing a lot of warnings and maintains support
      for MSYS2, connecting to R.
    • The bundled extensions (sockets, testing, GUI, etc.) now install
      in different subdirectories of the library. This allows adding
      and removing extensions with e.g. Linux package managers without
      running post (de)installation scripts.
    • The system now supports adding foreign extensions by linking
      them into the core system as alternative to runtime dynamic
      loading. This notably supports extensions for the WASM
      version. It may also be used to achieve simpler distribution
      of applications.
    • Experimental support for Conda has been added. All necessary
      restructuring of Prolog is ready. We hope to release this
      version for Conda.
    • Allow adding the SWI-Prolog source as a subdirectory of a
      project and integrate it into the overall CMake build process.
  • Allow for swipl -D[no-]<flag>[=<value>] to set Prolog flags
    from the commandline.

  • Make help/1 work on user defined predicates that use PlDoc.

Platform notes

  • Windows Build infrastructure has been updated to be based on Fedora 39, using gcc 13. All dependencies have been updated to their latest stable version.
  • MacOS All dependencies have been updated to their latest stable version.
    OS and xCode have been updated. For the MacOS App:
    • Unbounded integer and rational number support uses LibGMP again as
      this seems to work again. Used LibBF for some time because
      LibGMP crashed with used in SWI-Prolog.app.
    • We provide binaries for x86_64 (Intel Mac) compiled using
      GCC-13 in addition to the fat binaries. These run about
      40% faster than the Clang compiled universal versions. Note
      that we will only provide these for the stable releases and 9.3.0 devel release.

In addition to the above, there are many small fixes, additions and a
few incompatible modifications. We do not expect any of the
modifications to have major impact. Please search for MODIFIED:
below.

Enjoy --- Jan

SWI-Prolog Changelog since version 9.0.0

  • ADDED: library(dom) (WASM version) bind/4: allow passing JavaScript
    objects.

  • FIXED: Qlf file generation for :- include(File) The include
    statements can come in more places, even in the middle of a predicate.
    This changes the identifier from ‘I’ to ‘L’ to make the statement
    unique in all contexts and defines handling the include statements.

    Updates the qlf save vesion to 69. Old valid version 68 files can
    still be loaded.

  • MODIFIED: swipl qlf app to use sub commands. Now use e.g. swipl qlf compile file.pl

  • FIXED: pack_install/2: install from archive without git.

  • FIXED: Avoid confusion about -o, -x, -b and -c options These options
    are used early in the initialization and were detected using dedicated
    option processing. This goes easily wrong. Therefore we now use the
    full option processor. If we loaded a state that includes options,
    we redo the option processing.

  • ADDED: swipl qlf app: --include for compilation to include user files.

  • FIXED: pack_install/2: may try to delete old pack twice.

  • FIXED: pack_install/2 from an archive file.

  • PORT: Re-enable gmp for MacOS binaries. For some versions using gmp
    in the app crashed. Seems these issues are resolved.

  • PORT: Re-enable gmp for MacOS binaries. For some versions using gmp
    in the app crashed. Seems these issues are resolved.

  • PORT: Updated MacOS dependencies to their latest stable version

  • PORT: Fix MacOS bundle fixup The Qt bundle fixup fixes too much,
    so we first move our modules away.

  • PORT: Install CMake exports inside the bundle

  • PORT: Updated MacOS versions of the maintenance scripts.

  • FIXED: WASM: returning an array of objects. Reported by @mjano314
    on Discourse.

  • PORT: Fix MacOS bundle fixup The Qt bundle fixup fixes too much,
    so we first move our modules away.

  • PORT: Install CMake exports inside the bundle

  • FIXED: WASM: returning an array of objects. Reported by @mjano314
    on Discourse.

  • PORT: Updated MacOS versions of the maintenance scripts.

  • ENHANCED: Installing packs in an explicit directory creates this dir.

  • PORT: Updated MacOS dependencies to their latest stable version

  • TEST: Add help to test.pl option handling. Added --output=always to
    force emitting all test output.

  • FIXED: Invalid PlDoc comment.

  • ENHANCED: argv_usage/1: deal witn oneof(Values) types.

  • RELEASE: Preparing 9.2.0. Merged devel at
    4803519071d94771a48322d77739118d0e211adf

  • TEST: Created answer subsumption test from #1222

  • FIXED: require_prolog_version/2: accept dirty on release tag/.

  • MODIFIED: library(prolog_pack) This is an extensive rewrite of the
    package infra structure. The pack format has not changed. A brief
    summary of the changes:

    • Plan the installation of multiple packages, selecting a compatible
      combination.
    • Plan the installation, including dependencies before installing
      anything, first asking consent from the user. On accept, the
      packs are downloaded and the build process is established.
    • Easily support installing packs specifically for a project in
      addition to user and system-wide packs.
    • More informative listing of packs, including listing only
      outdated packs.
    • More work on the app pack.
  • ADDED: swipl pack list: --installed option.

  • ENHANCED: Hide library(apply) from debugger.

  • ADDED: git_tags/2.

  • ADDED: git_branches/2: option remote(true).

  • ENHANCED: logic behind git_default_branch/2

  • ADDED: git_process_output/3: option status(-Status)

  • ADDED: Prolog flag rationals to claim rational number support.

  • ADDED: cov_property/1 Allows querying coverage collection system
    properties (currently only whether coverage data collection is active).

  • FIXED: #1222 answer subsumption pruning of answers may crash.

  • ADDED: library(prolog_coverage). This used to be available as
    library(test_cover) from the plunit package.

  • ADDED: ‘$cov_add’/3 to allow loading coverage data from a file.

  • CLEANUP: Removed predicate indicator from ‘$cov_data’/3 call_site/3
    term. Was not used and wrong anyway as it was not module qualified.

  • ADDED: git_current_branch/2. git_default_branch/2 was actually
    implementing getting the current branch. This commit renames
    git_default_branch/2 to git_current_branch/2, making it fail
    if there is no current branch (detached HEAD). It adds a
    new git_default_branch/2 that returns the branch related to
    refs/origin/HEAD.

  • FIXED: git_branches/2 to omit the reported detached head.

  • MODIFIED: Moved pack_attach/2 from the library to the core.
    This predicate is not about installing. This patch also deletes
    '$pack_attach'/1 and '$pack_attach'/2.

  • ADDED: library(git): is_git_hash/1.

  • FIXED: #1220 create_prolog_flag/3 using type(term), keep(true)
    If the initial type is not a term, the type must be set to term
    and the value must be converted.

  • ADDED: pack_install_local/3 This predicate adds one or more packs to
    the local project directory. Work in progress.

  • ADDED: Prolog environment variable SWIPL_PACK_PATH This defines
    the Prolog search path for packs at startup.

  • ADDED: Prolog flag path_sep. Provides access to OS path separator
    (: or ; for Windows).

  • ADDED: replace(+Bool) option to attach_packs/2. Allows attach_packs/2
    to clear the default package list.

  • FIXED: Make sure saving the environment always succeeds

  • ADDED: Allow installing git packs from a URL whose base name does
    not match the pack name

  • ENHANCED: Improve listing of packs

  • ADDED: pack_list/2 List packs with options.

  • ENHANCED: library(prolog_versions). Extended and improved
    require_prolog_version/2. Added require_version/3 and cmp_versions/3.
    Added to library documentation.

  • DOC: Succeed if there is no profiling support in this version.

  • FIXED: Keep track of base and size of the C-stack This information
    was stored in the thread-info structure. However, if an engine
    is detached and later attached in a new OS thread this information
    is wrong. We now cache it in the info structure, but we store it in
    a pthread key.

    This notably fixes thread interaction for JPL.

  • ENHANCED: always save buildenv.sh on pack build directory.

  • ADDED: swipl_add_test() to home/cmake/swipl.cmake

  • ADDED: Set ${swipl_module_dir} in home/cmake/swipl.cmake

  • FIXED: CMake error in home/cmake/swipl.cmake.

  • DOC: #1217 Improve documentation for selecting Python version.

  • BUILD: Disable Janus when using -DSTATIC_EXTENSIONS=ON

  • FIXED: Avoid PL_thread_attach_engine()/PL_thread_destroy_engine()
    destroying the thread. If this pair is called on a thread that already
    exists, it should not destroy the engine. This notably causes Janus
    to crash when running on a background thread. Reported by Fabrizio
    Riguzzi.

  • FIXED: Use snapshot/1 when computing exports This is used to update the
    autoload library as well as several other IDE related tasks. For this
    we read and expand the file until we find the first non-directive.
    This may however leave traces in dynamic predicates. Using snapshot/1
    avoids that.

    It is a partial work around. There could be other side-effects.
    Should
    probably be considered experimental.

  • FIXED: Declare more system dynamic predicates as not being subject
    to transactions. This fixes several issues when (auto)loading sources
    files inside snapshots (snapshot/1) or discarded transactions.

  • FIXED: #1213 transactions interfering with wrap_predicate/4. More
    generally, transactions and snapshots should not affect some system
    maintained dynamic predicates. The wrapper used by wrap_predicate/4
    is one example. This also affects dynamic predicates involved in
    loading sources. This patch disconnects whether predicates are
    subject to transactions from whether they are dynamic.

    For now, the ability to separate the two properties is reserved to the
    system.

  • FIXED: Consistency of LD and CC variables for building packages.

  • BUILD: Use static libraries to silence Windows Defender It appears
    that executables cannot be copied when Windows Defender is active.

  • BUILD: Use CMake recommended CMAKE_C_BYTE_ORDER when available

  • ENHANCED: Allow for some rounding and jitter when deciding INDEX.pl
    is out-of-date.

  • TEST: Make test_installation/0 run package tests concurrently.

  • CLEANUP: document many of the maintenance scripts and remove some
    outdated ones.

  • FIXED: require_prolog_version/2: silent failure of git version parsing
    Git version parsing fails if we are at a release.

  • ENHANCED: Declare wrap_predicate/4 body argument as meta-argument.

  • ENHANCED: library(prolog_colour) support for Prolog flags.

  • ADDED: library(prolog_colour): colorized known but unset flags.

  • ADDED: library(prolog_colour): support arithmetic function
    roundtoward/2. Second argument is not a function but a rounding
    mode identifier.

  • ADDED: arithmetic_function/1 to allow import/export If the
    implementation of a function is exported, it may be imported into
    another module and used. This patch also updates the documentation.

  • FIXED: pretty_print/2 to deal with blobs around an operator.

  • DOC: PL_new_term_refs() takes size_t since recently.

  • FIXED: Fixup script for MacOS bundle was not executed. Seems a change
    in recent CMake that requires the script to start with #!.

  • FIXED: Avoid dependency from library(edit) on library(pce).

  • FIXED: Loading library(readutil) without foreign support Was broken
    since the changes to support static extensions.

  • CLEANUP: list_debug_topics/1 to use a single print_message/2 call.
    Also fixes hooking into debugging/0

  • DOC: Document tty_get_capability/3 exceptions.

  • MODIFIED: prolog:translate_bindings/5 to name the variables.
    Supports named variables in SWISH.

  • INSTALL: #1209 Fixed missing manindex.db during intallation.

  • DOC: Get profiler/2 and related docs from PlDoc rather than LaTeX

  • ENHANCED: When emitting a document, consider text already on the
    current line.

  • ADDED: opt_usage/1: allow for multiple opt_help(help(usage), Usage)
    This allows to present multiple usage lines.

  • ADDED: app qlf This app simplifies commandline driven management
    of QLF files. Use swipl qlf -h for help. The command line syntax
    is still unstable.

  • FIXED: Recompile or ignore incompatible QLF files An incompatible
    VM signature caused loading of a QLF file to result in a warning,
    loading nothing. It now prints a message and recompiles the file.

  • ADDED: check_installation/0 to verify there are no ambiguities in
    the autoload index.

  • ENHANCED: library(portray_text): allow 10% unicode characters

  • MODIFIED: Install each extension in library/ext/dir This allows
    adding and removing extensions without rebuilding the library index
    and clarifies the source of files. This was introduced to simplify
    adding and deleting optional components in e.g., the Windows installer
    or package managers that split SWI-Prolog into multiple packages such
    as used by Debian and planned for Conda.

  • FIXED: Toplevel calls repl_loop_hook/2 with a variable.

  • FIXED: Choice point left by loading the personal init file.

  • FIXED: format_types/2: error on backracking This predicate left a
    choice point and on backtracking produced an error when analyzing
    format strings that contain a *.

  • ADDED: Experimental prolog:repl_loop_hook/2 hook This allows acting
    on entering/leaving interactive mode.

  • DOC: Improve swipl --help (list “app” mode)

  • SANDBOX: Declare flag write_attributes as safe. This may call
    portray, but local definitions are verified and global definitions
    cannot be changed.

  • CLEANUP: Move installation locations to cmake/Locations Moving it
    into a separate file keeps the main file short and it needs to be
    before Ports because we need to act on them. Possibly though, we
    need part of the locations before and part after the Ports? As is,
    that does not seem to be the case. Alternatively we could move part
    of this into the Port files?

  • PORT: Allow for not having a compiled-in “home” directory Conda has
    no sensible fixed installation location.

  • FIXED: check_installation not to bail out if a feature test raises
    an exception.

  • CLEANUP: Moved default definition for file_search_path/2 foreign
    to library(shlib). This simplifies maintenance. The change also adds
    swi(lib/Arch) for all platforms, although the default SWI-Prolog
    for Windows installs the libraries in swi(bin). Possibly we can
    change that too?

  • INSTALL: Allow installing in public directory without symlink For some
    installations we want the executables in another directory than the
    “home”. Normally these were POSIX systems and we would symlink from
    the executable to the real location in the self-contained binary.

    But, also some Windows installations such as MSYS2 and Conda (and
    probably
    Cygwin) want this. Therefore we added SWIPL_INSTALL_AS_LINK which, if
    OFF, compiles the relative path to the anticipated home into the binary
    such that we can install the .exe in a separate directory (for Windows
    along with the DLLs needed to run them).

  • CLEANUP: format_types/2 Remove not-working attempt to make it
    bi-directional. It now properly raises an instantiation error,
    causing sandbox analyis to work without breaking anything.

  • FIXED: Conditional compilation and :- include/1. Avoid errors on

    :- if(...).
    :- include(...).
    :- elif(...).
    ...
    
  • ENHANCED: Shorten and simplify calling deterministic foreign functions
    This patch unifies I_FOPEN with the subsequent calling function and
    somewhat simpifies the design.

  • SANDBOX: added several arithmetic predicates as safe: -
    current_arithmetic_function/1 - bounded_number/3 - float_class/2 -
    float_parts/4

  • SECURITY: CVE-2023-45853 Upstream bug in the minizip library
    used to create and load Prolog saved states. Not very relevant
    to SWI-Prolog as it unlikely that SWI-Prolog is used in a way that
    provides uncontrolled access to the involved parameters.

    Upstream message:

    Reject overflows of zip header fields in minizip.

    This checks the lengths of the file name, extra field, and comment
    that would be put in the zip headers, and rejects them if they are
    too long. They are each limited to 65535 bytes in length by the zip
    format. This also avoids possible buffer overflows if the provided
    fields are too long.

  • ADDED: create_prolog_flag/3: type(oneof(ListOfAtoms)) This patch
    also cleans up the relation to create_prolog_flag/3 and existence of
    a flag with some value. Adds test cases.

  • MODIFIED: set_prolog_flag/2: convert Booleans If set_prolog_flag/2 is
    used to create a new flag and the value is an atom that is recognised
    as a Boolean, normalise the value.

  • ADDED: must_be/2 and friends: constructed types and compounds Allow
    for e.g. compound(atom-integer) to express a pair mapping an atom to
    an integer. Also introduces constructed types such as (atom;integer)

  • FIXED: #1205: sandbox:format_calls/3 to handle non-list format args
    correctly.

  • ADDED: Provide a mechanism to warn on unused Prolog flags

  • ADDED: Allow -Dno-flag

  • MODIFIED: library(apply_macros) flags Now listens to optimise_apply,
    which defaults to optimize, while the flag apply_macros_scope
    defines whether the optimization applies to the files that import
    this library or all files (default).

  • CLEANUP: Make optimise_debug flag library-only.

  • MODIFIED: Renamed Prolog flag clpfd_goal_expansion to
    optimise_clpfd Improves consistency

  • FIXED: Source position preservation of string tereminals in DCG.

  • ADDED: Rewrite positions for function evaluation in meta-predicate
    arguments This fixes source location handling for clauses that
    call a meta-predicate where one of the non-meta arguments uses
    e.g. Dict.attr.

  • FIXED: clause_info/4: perform full body matching.

  • FIXED: Clause position handling of plunit test/1,2 clauses.

  • FIXED: ‘$notrace’/2 + ‘$restore_trace’/2 pair to properly restore This
    pair now reliably restores LCO and VMI instruction optimization such
    that e.g., the coverage tools work properly after this pair is called.

  • ENHANCED: load library(apply_macros) globally on -O.

  • FIXED: #1204: undo/1: crash if a single undo is scheduled that fails.

  • FIXED: clause_info/5 for unification moved into the head

  • FIXED: clause/2: moved unifications If a unification is moved into
    the head and the variable is unified against some other variable,
    we must move the unification back.

  • MODIFIED: Control transformations by library(apply_macros). The new
    Prolog flag apply_macros controls when this library rewrites the
    code. Values are true (old default), false (no-op), optimise
    (only wwith -O) and imported (only apply to modules where it is
    explicitly imported to).

  • ADDED: Process -Dname=value to set Prolog flags.

  • FIXED: tracer S command to save the
    current goal. Reported by Wolfram Diestel
    (Stacktrace after hitting t S u while browsing through query solutions - #2 by wdiestel)

  • PORT: MSVC install: there is no libswipl.ddl.a.

  • PORT: Windows: deal with OpenSSL when using per-module CRT support.

  • ADDED: Swin_open_osfhandle()

  • PORT: Fixed integer addition overflow check when using MSVC

  • PORT: Allow using Windows HANDLE in communicating about Prolog streams.

  • BUILD: Make installation work again Broken with
    71caaeb72188627f0d717d251cab14d3e557a241

  • BUILD: Simplify forced building of the library indices.

  • PORT: Improve support for Conda on Windows. Adds a flag
    conda. Windows versions added %CONDA_PREFIX%\Library\bin and
    %PREFIX%\Library\bin to dependent DLL search path. This extends
    a similar work-around for MSYS2.

  • DOC: Non-ISO behavior of \+/1

  • PORT: Use uint64_t for LibBF mpz_ui_pow_ui() Switch to using the 64
    bit versions on all platforms. Requires some more 64 bit init/set
    versions, but overflow checking intrinsic __umulh() for MSVC only
    exists of 64 bit.

  • FIXED: gcd function for LibBF on platforms with 32 bit long.

  • FIXED: mpz_ui_pow_ui() emulation on LibBF on systems with 32 bit long.
    Breaks e.g. A is 2^65, succeeding with A = 0.

  • ADDED: PL_get_delay_list() API.

  • CLEANUP: PL_new_term_refs() now takes size_t argument (was int).

  • DOC: Fix return types of Sfread() and Sfwrite() (size_t instead of
    int)

  • ADDED: Start applications using swipl app-name [arg ...]

  • CLEANUP: Code and docs for ‘$initialise’/0 that starts the system

  • FIXED: Issues with name/2 and number_codes/2 high Unicode points
    on Windows. Also fixes issues with code strings holding 0 codes for
    these predicates.

  • FIXED: After converting text representation it may no longer be
    canonical. This causes name/2 on a string that starts with a digit
    and contains wide characters to re-interpret UTF-8 and wide characters.

  • ENHANCED: pack_install/2: duplicate handling Allow installing a
    package in a given directory if the package is already installed in
    some other directory.

  • MODIFIED: pack_install/1,2: enforce TLS certificates From this version
    the system by default verifies TLS certificates. For poorly configured
    servers there is an option insecure(true) to pack_install/2 to skip
    the verification.

  • FIXED: downcase_atom/2 and upcase_atom/2: error handling.

  • DOC: PrologScript and shell script usage

  • XSB: Reorganise dialect emulation libraries Make timed_call/2 and
    consult/1 available from the right modules.

  • FIXED: html to text translation float right This patch fixes handling
    of inline style float:right and dealing with multiple flush-right
    elements in a block.

  • FIXED: undo/1: calling hooks while backtracking could corrupt
    choicepoint. Reported by Fernando Saenz Perez.

  • FIXED: PL_get_size_ex() on 64 bit systems using LibBF based bignums.

  • ENHANCED: help/1: keep track of modules for user predicates Also show
    private predicate matches.

  • TEST: Disable shared tabling tests conditionally. This test requires
    threads and library(time).

  • MODIFIED: When using --no-signals, keep using the GC thread The
    communication with the garbage collection thread is not based on
    OS signals and thus there is no reason to stop using the dedicated
    GC thread when not using signals. Using a separate thread improved
    real-time behavior.

  • MODIFIED: Make the Prolog flag float_overflow to affect read_term/3.
    With this flag setting, too large floats are read as infinity rather
    than raising a syntax error.

  • MODIFIED: Issue a warning on suspect autoloading The autoloader now
    issues a warning if it loads a library that contains global goal
    or term expansion rules. Expansion typically improves performance
    or otherwise enhances the functionality of some of the predicates
    defined in the module.

  • FIXED: Preserve table properties on reconsult. Reported by Jan Burse.

  • CLEANUP: Removed unfinished and not maintained packages/cpproxy

  • FIXED: PL_thread_attach_engine()/PL_thread_destroy_engine() on main
    thread The main thread did not set the open_count to 1, causing
    hthe attach/destroy cycle in the main thread to kill the main thread.

  • DOC: read_string/3 [no ci]

  • DOC: clarify some details of stream error handling

  • TEST: Enable rational number tests when using LibBF.

  • TEST: Test suite for bomb DoS vulnerabilities.

  • SECURITY: Allow interrupts in the compiler This avoids using the
    “bomb” DoS attack using assertz/1 and friends.

  • SECURITY: Allow interrupts in term_variables/2 and numbervars/4
    variants Some of these variant goals require processing the tree
    such that shared terms are walked normally. Such goals can take
    exponential time. This patch allows processing interrupts.

    Without this, notably services such as SWISH that allow users to run
    arbitrary Prolog goals become subject to DoS attacks.

  • ENHANCED: Speedup arithmetic comparision in non-O mode.

  • PORT: Partial work to allow MSVC build under Conda. This patch works
    around issues for CMake FindThreads.cmake. It also explicitly enables
    MSVC /MD to compile the packages if threading is enabled.

  • BUILD: Runtime configuration during boot for Windows As, on Windows,
    we install all DLLs in the same directory we do not need to add
    the package bin dirs to the foreign search path. But, we must use
    prolog_to_os_filename/2 to ensure proper handling of the search based
    on the executable.

  • FIXED: #1197 function cmpr failing for negative values.

  • FIXED: #1097 ctrl-C in read causes exit from REPL Fix consists of
    two parts. (1) if something (libedit) already set the stream error
    condition, make S__fillbuf() return with an error immediately and
    (2) do not abort the main query loop if we get an abort request.

  • DOC: additions and cleanup wrap_predicate/4, pack_install/1, handling
    blobs and streams from foreign code, returning from foreign predicates.

  • ENHANCED: Allow interrupts during evalExpression()

  • PORT: Make new stuff work again using MSVC

  • ENHANCED: dark theme arithmetic used blue on black. [no ci]

  • PERFORMANCE: Add shortcut to PL_unify_number() Add a shortcut for
    the typical case where the number is a small integer, the target is
    a variable and we are not short on stack space.

  • PERFORMANCE: Simplify clearNumber() Notably improves performance for
    float arithmetic.

  • FIXED: Memory leak in PL_put_term_from_chars() fast route. This
    function implements a fast route for integers and rationals and leaked
    the GMP/LibBF object for rationals and large integers.

  • ENHANCED: PL_get_float() to raise a float overflow on too large
    rational.

  • BUILD: Added scripts/configure This script is used for a long time
    to maintain multiple versions under the same source tree. See script
    for details. [no ci]

  • PORT: Work around broken MacOS versions lacking <term.h> Reported
    by Matthias Gondan after failing build for CRAN

  • FIXED: PL_get_nchars() and friends CVT_INTEGER handling Broken
    in 2ac1553770ac1a9d6753b8b6e72ac2028815a028

  • ADDED: PL_get_nchars(): CVT_XINTEGER Allow converting numbers to
    hexadecimal strings.

  • DOC: library(occurs) [no ci]

  • BUILD: Avoid dependency on Threads::Threads when building single
    threaded. This applies to the packages and blocks e.g., the WASM
    build.

  • DOC: check/0 Document new checks and using check/0 for batch mode
    static analysis (linter).

  • ADDED: check/0: run check_predicate_options/0.

  • FIXED: check_predicate_options/0: avoid several false warnings.

  • ADDED: must_be/2: type list_or_partial_list(Type)

  • DOC: open/4 reposition option.

  • MODIFIED: Disable toplevel variables if the flag toplevel_var_size
    is 0

  • ENHANCED: Performance of nth1/3 and nth0/3 for mode (-,+,?)

  • PORT: Remove emacs module declarations from SWI-Prolog.h The symbols
    must be exported, but we should not declare them as part of the API
    as that prevents building the sweep module. In MSVC the linkage
    options for exported and imported data is different.

  • FIXED: Recompilation logic may use an erased clause If the newly
    compiled clause is equal to the “current” clause, the new clause is
    destroyed and the old is kept. We must however check that the “old”
    is not yet erased.

  • FIXED: Message translation for trace(Head, Ports) Got getting location
    of predicate wrong and ansi_hyperlink/3 printed the URL rather than
    the label if the terminal does not support hyperlinks.

  • ENHANCED: Avoid dependency of library(ansi_term) on package clib

  • ENHANCED: ansi_get_color/2 to use stream timeouts Old version used
    call_with_time_limit/2, but this is in a library, pulls in a shared
    object dependency and requires threads.

  • BUILD: Allow building the manuals in non-Unix environments.

  • PORT: Find local home more flexible. Normally swipl is in src, but
    using some backends there can be a configuration directory in between.

  • PORT: Property configure threads for packages.

  • FIXED: bf_set_ui(): uint32_t >> 32 is undefined.

  • CLEANUP: signed/unsigned and other warnings for bf_gmp.c

  • CLEANUP: Resolve signed/unsigned comparison and negation of unsigned
    ints.

  • PORT: Make multi-threading work with MSVC version - Allow using
    vcpkg package pthreads for threading. - Port atomic operations
    to use teh MSVC _Interlocked* intrinsics - Sync thread config for
    swipl-win.exe with libswipl.dll.

  • PORT: Make LibBF compile using MSVC Now compiles with many warnings.
    Basics seem to work.

  • PORT: Empty struct support for pl-wam.c

  • FIXED: set_prolog_gc_thread/1: no-op in the single-threaded version.

  • PORT: Introduce free() for LibBF memory management. LibBF uses
    realloc(ptr,0) rather than free, but this is not-portable and
    flagged by the latests versions of valgrind.

  • BUILD: Work around problem generating Unix Makefiles

  • CLEANUP: `Remove swipl.home and swipl.rc from the source root dir.

  • PORT: Fix various warnings generated by MSVC2022

  • BUILD: Simplify build_home.pl

  • BUILD: More patches to allow building as a CMake subdir. These patches
    notably deal with the package locations and documentation.

  • BUILD: Allow building as a sub project from a larger CMake project This
    patch replaces use of CMAKE_SOURCE_DIR with CMAKE_CURRENT_SOURCE_DIR,
    so we can do

    add_subdirectory(swipl)
    

    in a larger project.

  • BUILD: Allow building as a sub project from a larger CMake project This
    patch replaces use of CMAKE_SOURCE_DIR with CMAKE_CURRENT_SOURCE_DIR,
    so we can do

    add_subdirectory(swipl)
    

    in a larger project.

  • FIXED: Typo in check_installation/0 (syntax error)

  • PORT: WASM: Do not try to get ioctl support.

  • PORT: Further refine terminal support detection. Recent regression
    cause tty_size/2 to be undefined on systems where it can be supported.

  • ENHANCED: Compile all plugins using -fvisibility=hidden

  • ENHANCED: Use visibility attribute for install_t This allows
    compiling plugins with gcc -fvisibility=hidden, reducing the risc
    for symbol conflicts and reducing load time.

  • ADDED: open_shared_object/3: support all glibc RTLD_* options.

  • DOC: Clarify some details of blob and I/O functions

  • PPA: Dropped kinetic, added lunar

  • FIXED: Pass check/0 dependency check if tty_size/2 is not defined.

  • PORT: When using Macports for dependencies, set the cmake FrameWork
    search path

  • PORT: Disable swipy (janus) if CMake is older than 3.18.

  • 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 Te
    Windows path “c:dir” is an absolute file name. It is now recognised
    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 exeption.

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

  • ADDED: evaluable_property/2 Proposal to inspect evaluable functions.

  • ADDED: indicate DCG rules in xref_defined/3 This makes
    xref_defined(Src, Head, How) succeed (also) with How = dcg for DCG
    grammar rules.

  • MAINTAIN: Add CI based on Github workflows

  • ADDED: library(rwlocks), implementing read/write locks.

  • FIXED: Avoid closing a stream with an alias If a stream-handle is
    created for a stream with an alias (e.g., by stream_property/2),
    the stream would be closed if this handle is garbage collected.

  • ENHANCED: library(macros) to leave #Var alone.

  • ADDED: library(prolog_colour): Add support for library(macro).

  • ADDED: library(macros) A general purpose compile time macro expansion
    mechanism based on term_expansion/2.

  • MODIFIED: Removed undocumented prolog:rename_predicate/2 hook.
    This hook was used to be able to wrap predicates. That is currently
    achieved more reliable and dynamically using wrap_predicate/4.

  • FIXED: Ensure expand_term/2 cannot alter the current source location.

  • FIXED: #1174: read_pending_codes/3: release stream on EOF or error.

  • DOC: details about building packages

  • ADDED: trap/1: aliases for det and =>. Expandable.

  • MODIFIED: top_sort/2, deleted top_sort/3 added ugraph_layers/2
    top_sort/3 was deleted due to mismatch of documentation and
    implementation for the order of the difference list arguments.
    The docs give a replacement.

    top_sort/2 now returns vertices from the same layer in input order,
    i.e., in standard order of terms.

    ugraph_layers(+UGraph, -Layers) returns the topogical sorted result
    as a
    list of layers. I.e., all legal toplogical sorts can be established by
    creating permutations for the layers.

  • FIXED: catch/3 debugger interaction. In debug mode it was possible for
    catch/3 to not finish the catch if the goal succeeded deterministically
    due to CHP_DEBUG choice points.

  • CLEANUP: Remove very old work-around for clang bug.

  • WASM: Get the link options for the various targets ok. This notably
    passes -s STACK_SIZE=1048576 as the default 64K is too small for
    SWI-Prolog. The patch reorganises assembling the link option lists
    for better sharing of common options.

  • BUILD: By default implement VM instructions using functions for
    clang On recent versions of clang (14,15), the code produced using
    VM instructions as functions rather than a big switch is faster.

  • BUILD: Generalize configuration of C-stack limit

  • BUILD: Added ccache support Currently disabled for Emscripted as that
    seems to do its own caching these days.

  • WASM: Removed export Pointer_stringify. Compiler complains and it is
    (no longer) used.

  • FIXED: absolute_file_name/3: allow for duplicate options. This change
    also affects other predicates that use the Prolog built-in option
    handling.

  • DOC: limitation of PL_record_external() with blobs

  • ADDED: library(main) cli flag processing for debugging.
    See cli_debug_opt_type/3 and friends.

  • ADDED: argv_options/4: typed directory and directory(+Access).

  • ADDED: print_term/2: option auto_indent_arguments(Int) With this option
    (defaults to 4), dicts and compounds that are too wide ands whose
    funtor is at least twice this width, have their arguments printed on
    the next line.

  • PORT: When using -DSTATIC_EXTENSIONS=ON, drop usage of dlopen()
    This is required for recent versions of Emscripten that give a runtime
    error on the usage of dladdr().

  • TEST: Added test for #1168

  • FIXED: Issue#1168: race condition betweem abolish and CGC Clause
    Garbage Collection concurrent with abolish/1 could leave the predicate
    with erased clauses while it was not marked dirty. As a result,
    a subsequent attempt to assert/1 to this predicate results in an
    error trying to amodify a static predicate. Reported by Paulo Moura.

  • TEST: Create a new test directory to improve concurrency while testing.

  • ADDED: Issue#1019: PL_put_wchars().

  • TEST: Fix and disable some tests when running under Wine.

  • PORT: Demand C11 early

  • DOC: Document issues with standard order on rational trees.

  • DOC: Issue#1164: clarify answer_write_options flag.

  • DOC: Prolog flag toplevel_residue_vars.

  • FIXED: Addresses #1160, residual constraints in tuples_in/2 from
    clp(fd). Patch by @triska for Scryer Prolog.

  • FIXED: Windows exists_file/1 and exists_directory/1 domain error.
    Avoid Domain error: `foreign_return_value' expected, found `-1'.
    Document that invalid names cause silent failure.

  • MODIFIED: statistics/2 cputime and infereneces to include completed
    “child threads”. This patch causes threads to keep track of their
    “creator” thread. If the creator still exists when a thread dies,
    the time and inferences are recorded with the creator and reflected in
    the statistics keys. The new keys self_cputime and self_inferences
    provide the original.

  • BUILD: When using -DSTATIC_EXTENSIONS=ON, do not install the
    libraries. This implies plugins are not installed as *.a files
    and libswipl.a is not installed. Only bin/swipl and the Prolog
    libraries and support files are installed.

  • FIXED: swipl.cmake syntax error

  • BUILD: Only setup CMake rpath stuff if the Prolog core is a shared
    library. This allows building a completely static executable without
    RPATH/RUNPATH.

  • ENHANCED: Better error if process argv cannot be processed in current
    locale.

  • FIXED: Using PL_new_atom() before PL_initialise() Lazy initialization
    of the atom infrastructure must initialize threads.

  • ADDED: PL_new_blob()

  • PORT: Msys2 & Win, static build dependencies

  • FIXED: recorded/2,3: If the first record was marked erased it is
    still reported.

  • PORT: Do not link to dladdr() if not available.

  • BUILD: Allow for CMake to provide list of packages explictly as e.g.
    -DSWIPL_PACKAGE_LIST=“clib;plunit”

  • MODIFIED: PL_qlf_* functions to use the normal public API function
    naming and calling conventions.

  • ADDED: PL_qlf_put_atom() and PL_qlf_get_atom(). Both functions may
    only be used from callbacks to blobs save/load hooks.

  • MODIFIED: names for integer exchange functions to qlf files.

  • MODIFIED: Stop exporting PL_qlf_getInt32() and its put version.
    They are not needed and easily implemented.

  • MODIFIED: Stop exporting PL_qlf_getString() and
    PL_qlf_putString(). These functions are too simple to write using
    e.g. Sfwrite() and Sfread() while the interface regarding lifetime
    if PL_qlf_getString() is not suitable for public use.

  • FIXED: Qlf save/load of Unicode text on Windows. Also makes the Qlf
    format portable between POSIX and Windows for wide strings using
    Unicode plane 1.

  • TEST: Test load/save .qlf files. Current test deals with Unicode.

  • ADDED: profile/2: options sample_rate(+Rate) and ports(+Ports).

  • FIXED: Prevent callbacks to Prolog from a thread running the atom
    garbage collector. Such callbacks may be initiated from blob
    release handlers.

  • FIXED: Windows: handle UNC paths properly.

  • MODIFIED: engine_next_reified/2 to return an exception as
    throw(Exception) rather than exception(Exception). Compatibile
    with e.g. call_time/3.

  • FIXED: When using single threaded engines we must scan all engines
    during atom and clause GC

  • ADDED: Allow building using -DMULTI_THREADED=OFF -DENGINES=ON This
    provides engines without threads. This is merely a proof of concept.
    It proofs that the code changes are quite minimal. A full version
    requires more work:

    • Probably we should also remove message queues and thread signals.
    • Do we want thread-local predicates in engines? Actually that is
      also a question for the multi threaded version. Probably we need
      an option to engine_create/4.

    This spreads a lot more #ifdef in the code. Luckily mostly
    limited to pl-thread.h and pl-thread.c. Requires further cleanup
    by moving more functions and declarations under the same conditonals
    together and possibly split some stuff to a new file, e.g. move
    mutexes and possibly later message queues and signals to their
    own file.

  • CLEANUP: There is no need for using the lingering structures to delay
    unallocation for some usage in single threaded mode. Split into
    linger_always() and linger().

  • FIXED: Possible error getting stack trace.

  • TEST: Disable pipe test when running under Wine.

  • TEST: Prevent test from failing of concurrent threads are active.

  • ENHANCED: sleep/1: sleep(0) just does sched_yield() if possible.

  • CLEANUP: Use new style foreign language interface for predicates
    from pl-sys.c.

  • ENHANCED: If we fail to print an exception message through
    print_message/2, print the raw exception.

  • FIXED: Make last resort stack resize work and (also) apply it if an
    exception is being processed.

  • STYLE: Updated library(dcg/basics) to use the current layout.

  • ADDED: library(dcg/basics): csym(?Atom) as <csymf><csym>*.

  • ADDED: argv_options/3: allow for optional long options by allowing
    for a boolean in the disjunctive type.

  • DOC: Clarify exceptions behavior

  • DOC: add a few background papers

  • FIXED: det/1 and friends to propagate the expectation in last calls
    to a meta predicate.

  • FIXED: XSB emulation no longer needs subseq/3 as that is now in our
    library(lists) as well.

  • TEST: Fixed tests to comply with
    e23c141be2f071b450f0d39981ac53251e1bd4f1 in debug mode.

  • MODIFIED: Writing \ quoted without character_escapes
    should not double the \. This bug was introduced
    with cbe691f8af61ccaf466147868a316b96c110fedb to “fix”
    term_to_atom('a\\b', A) to produce A = 'a\\b' (which is
    quoted again by the toplevel to produce A = '\'a\\\\b\''.
    The issue is that term_to_atom/2 using PL_write_term() with
    PL_WRT_QUOTED, but not PL_WRT_CHARESCAPES. There is now
    a new flag PL_WRT_NO_CHARESCAPES. If either flag is given, we
    explicitly enable or disable character escapes. If none is given,
    the behaviour depends on the global (module user) value of the
    character_escapes flag.

    This implies that e.g. term_to_atom('a\nb', A) used to produce a
    quoted atom with a plain newline, while in the new version the newline
    is escaped as \n.

    Many foreign libraries using PL_write_term() or PL_get_chars() using
    CVT_WRITE did not use character escapes while they do now. As long as
    the output is read by Prolog the result is the same.

  • FIXED: with_output_to/3: need to restore the streams while redirected
    to avoid leaking the stream handle because it remains referenced.

  • FIXED: tty_get_capability/3: memory leak.

  • FIXED: Memory leak in peek_string/3.

  • MODIFIED: Renamed exception processing hook
    user:prolog_exception_hook/4 into prolog:prolog_exception_hook/5,
    providing an additional argument that contains the current setting
    of the debug flag. Note that we cannot ask for this flag as the
    hook runs in “nodebug” mode. As the change is incompatible anyway,
    we also move the hook to the prolog module where the modern system
    hooks live. The new argument is used by library(prolog_stack) to make
    catch/3 behave as catch_with_backtrace/3 when in debug mode if the
    “guard” debug is defined (default). If this is not desired, use

    :- use_module(library(prolog_stack)).
    :- retractall(prolog_stack:guard(debug)).
    

    Code that use the old hook must rename the predicate and add the
    Debug
    argument. Code that wishes to be compatible with old and new
    Prolog can
    implement both hooks.

  • FIXED: error propagation of call_time/2 and updated docs.

  • MODIFIED: call_time/3 to not rethrow the exception but return it in
    the status reification as throw(Error).

  • ADDED: base64_encoded/3: added charset(openbsd), implementing the
    OpenBSD alphabet for base64 encoding Needed for bcrypt implementation
    in packages/ssl

  • FIXED: Provide (dummy) profiling interface for foreign code if
    profiling is not supported.

  • ENHANCED: explain/1 to report predicates as non-terminal if this
    is known.

  • ENHANCED: Use 64 bit counters for profiling.

  • FIXED: Issue#122: unification can create unsatisfyable or nodes.

  • ADDED: library(lists): subseq/3.

  • WASM: make prolog compatible with emsdk 3.1.31

  • FIXED: profiler port counts for redo and fail. Rather than trying
    to count redo, we now count fail and compute redo from call+redo =
    exit+fail. Note that a call can be matched with at most one fail.

  • SNAP: Updated KDE/Qt build framework. This required
    a kludge to run cmake twice to work around a
    dangling link in the KDE/Qt build snap. See
    Kde-frameworks-5-99-qt-5-15-7-core20-sdk wrong link for libcrypto.so - #3 by janw - snapcraft - snapcraft.io

  • SNAP: core20 seems to require usr/bin/swipl for the command.

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

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

  • 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

  • DOC: Issue#1116: typo in example.

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

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

  • PORT: fix cat2 test for windows

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

  • ENHANCED: Small speedup for findall/3 by specializing
    setup_call_cleanup/3.

  • ENHANCED: Simplified implementation for the cleanup family,
    call_cleanup/2, setup_call_cleanup/3.

  • MODIFIED: Moved already deprecated call_cleanup/3 from the core to
    library(backcomp).

  • CLEANUP: The VM no longer needs to know the identify of
    setup_call_catcher_cleanup/4

  • SNAP: Updated KDE/Qt build framework. This required
    a kludge to run cmake twice to work around a
    dangling link in the KDE/Qt build snap. See
    Kde-frameworks-5-99-qt-5-15-7-core20-sdk wrong link for libcrypto.so - #3 by janw - snapcraft - snapcraft.io

  • SNAP: core20 seems to require usr/bin/swipl for the command.

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

  • 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
    PL_fatal_error()

  • 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

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

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

  • 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
    ansi_hyperlink/2.

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

  • DOC: fix minor typo

  • 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

  • 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
    prolog_debug_tools:debugging_hook/0

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

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

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

  • DOC: Use PlDoc for trace/1,2 documentation.

  • ADDED: trace/1,2: print wall time since call port for other ports.

  • 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
    prolog_debug_tools:debugging_hook/0

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

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

  • PORT: Fix crash in walking the Prolog stack for gcc 12 on arm
    32-bit. This is caused by padding added in struct queryFrame between
    saved_environment and top_frame

  • PORT: Fixed rationalize/1 and cmpFloatNumbers() to fail due to
    gcc optimization using internal wide float registers rather than
    comparing 64 bit doubles. Not entirely sure this is our mistake
    or within GCC’s claim to work with the extended float registers.
    Bottom line is that comparing a double (from memory, so 64 bits) to
    the result of a computation may return non-equal even if the extended
    float when forced to 64 bits is equal. This problem surfaced in i386
    using gcc 12.2.0.

  • FIXED: Issue#119: library(apply_macros) goal expansion for phrase/3
    using a partial terminal was too greedy. Uwe Neumerkel.

  • FIXED: Initialise Prolog flag encoding from locale name. Internal
    UTF-8 decoding is typically faster than the C library multibyte
    operations.

  • FIXED: clause/2,3: possible GC crash when dealing with moved
    unification
    . We cannot have references to the local stack and thus
    we must allocate the support variable on the global stack.

  • ENHANCED: If one of the standard streams of a thread has been closed,
    rebind the stream to the original process streams. This can happen
    if, for example, we create a thread while output is redirected to
    some stream. If now this stream is closed the thread ends up with
    a closed standard stream.

  • PORT: Build MacOS bundle using LibBF based big integers. Somehow the
    build for the universal binaries covering a large series of MacOS
    versions (since 10.14) breaks after uograde to MacOS Ventura when
    linking against libGMP. The results are random segfaults, bus errors
    and memory corruption.

  • PORT: Build MacOS bundle using LibBF based big integers. Somehow the
    build for the universal binaries covering a large series of MacOS
    versions (since 10.14) breaks after uograde to MacOS Ventura when
    linking against libGMP. The results are random segfaults, bus errors
    and memory corruption.

  • FIXED: Possibly crash in breakpoint callback after GC/shift.

  • TEST: Make thread signal test behave better under high loads.

  • PORT: Make C backtraces work on ARM systems that use libunwind or
    glibc backtrace().

  • FIXED: Error handling if prolog_frame_attribute/3 using parent_frame
    runs out of stack. Careful review of this function after reported
    crash on 32 bit arm. Might be due to a stack shift in this code,
    but I doubt it and cannot reproduce the issue. Surely the current
    code is safer.

  • DOC: Document prolog_frame_attribute/2 with parent_frame(-Next)

  • TEST: test may result in another error on 32-bit platforms.

  • ADDED: library(streams). Intended for various tricks in capturing
    and redirecting streams. Currently only provides with_output_to/3
    that extends with_output_to/2 to allow capturing user_output and
    user_error.

  • FIXED: WASM shell: failure after clearing output.

  • UPDATE: Merge devel@b70e1737c01220e258830db17ade553164d5d9d1 -
    Fixed SSL password hash compatibility - Fixed race condition for
    creating functor objects - Fixed data corruption in clause/2 when
    decompiling the head - Fixed updating break table when removing a
    clause - Updated sweep - Made all sources stricty C11 compatible
    (gcc -std=c11 -pedantic)

  • FIXED: breakpoint removal when retracting a clause.

  • PORT: Provide MSVC alternatives for MinGW runtime support.

  • DEBUG: Dump Prolog stack on assertion error.

  • PORT: Drop old MSVC #ifdef code in favour of <inttypes.h>
    on all platforms.

  • PORT: Strict C11 support for VM instruction argument declaration.

  • PORT: Avoid GCC empty struct and named variadic arguments for cpp to
    make pl-wam.c compile under strict C11 standard. This does not solve
    full portability. pl-codetable.c suffers from related problems.

  • PORT: Fixed compilation for Windows after providing the libswipl
    patches

  • FIXED: Race condition between destroying indexes of thread-local
    predicates on thread exit and the clause garbage collector.

  • FIXED: Race condition for creating a functor. We must add the
    functor to the global functor array before we can declare it valid.

  • FIXED: thread_wait/2: race condition in updating threads waiting for
    a module.

  • FIXED: clause/2: possible error handling H_LIST_FF if there is a GC
    between handling the head and tail.

  • BUILD: Simplify configuration detection in the build environment
    by exploiting the libswipl flag if it is read-only (and thus
    reliable).

  • ADDED: swipl --dump-runtime-variables to provide the name of the
    shared object in PLLIBSWIPL.

  • ENHANCED: Set the Prolog flag libswipl based on dladdr() when
    possible.

  • PORT: The C11 standard does not allow for empty structs.

  • SNAP: CMAKE_INSTALL_LIBDIR seems undefined inside snapcraft, causing
    the build to fail.

  • SNAP: Latest snapcraft sets LD_LIBRARY_PATH to provide access to the
    “parts”. We should not consider this a broken environment.

  • DOC: Fixed LaTeX issues blocking the generation of the PDF manual.

Package bench

  • ENHANCED: Better compensation for computing dummy overhead.
    Contributed by Jose Morales

  • PORT: Make benchmarks run on Scryer Prolog 0.9.3

  • FIXED: queens_clpfd.pl benchmark merely posted the constraints.
    Now actually solves them and does not generate all solutions as these
    are too many.

  • ADDED: Ciao lang

  • PORT: Improve portability for boyer.pl

  • PORT: Generalize, support XSB, GNU-Prolog and Trealla Prolog.

  • PORT: Support clpfd benchmark for SICStus.

  • PORT: fast_mu.pl: avoid length/2.

  • PORT: browse.pl benchmark to avoid length/2

  • PORT: sieve.pl: avoid forall/2, ignore/2 and between/3.

  • ENHANCED: Portability, Prolog driver, many details Now uses a single
    (SWI-)Prolog program for the overall management, running the Prolog
    system(s), joining the data and generating the chart.

    We now have a system in place to support pretty much every Prolog
    system, with or without modules. SWI, Yap and SICStus can do the
    job with the original sources. For e.g., Scryer we transform the
    sources and test beforehand which files Scryer can handle.

  • COMPAT: Avoid name/2 in favor of atom_codes/2 and number_codes/2.

  • PORT: Support CSV for all platforms

  • PORT: Revive YAP and SICStus compatibility.

Package debian

  • ADDED: dependency on Python itself. Although a dependency on
    libpython3-dev is good enough, cmake cannot find the Python conponents
    without Python.

  • ADDED: Python3-dev dependency

Package archive

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

  • TEST: Disable write tests under Wine. These tests work fine under
    Windows.

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

  • DOC: Build documentation

Package chr

  • FIXED: Exported current_chr_constraint/1 from library(chr).
    This predicate replaces the deprecated find_chr_constraint/1, but
    was not exported.

  • BUILD: Another missing use_module for maplist/3.

  • BUILD: Avoid relying on autoloding during bootstrapping.

Package clib

  • ADDED: process_which/2 to find executable.

  • FIXED: directory_file_path/3: typo in raised exception.

  • BUILD: replace CMake deprecated exec_program() with
    execute_process()

  • FIXED: uri_edit/3 to consider the initial path '' to be the same as
    /.

  • FIXED: directory_file_path/3 when Dir = ''

  • ADDED: ensure_directory/1

  • ENHANCED: Make rewrite_host/3 hook work fot tcp_connect/3 Also allows
    tcp_connect/3 to accept an IP number. These two enhancements avoid
    the need to lookup localhost on Windows.

  • ADDED: socket:rewrite_host/3 hook for tcp_connect/2 This multifile
    hook allows for mapping hostnames, either directly to an IP address or
    another host. Currently a work-around for Windows broken handling of
    localhost, mapping it directly to the IP address 127.0.0.1.

  • PORT: CRT handles for the process pipes must be owned by libswipl.dll.

  • PORT: Work around inconsistent definitions for ETIMEDOUT on Windows.

  • PORT: We cannot share Windows CRT stream handles with the Prolog core.

  • PORT: Windows: create_process/3: make stream(S) work. This patch
    fixes the options stdin(stream(S)), etc. when S denotes a file stream
    by enabling inheritance for the handle before calling ProcessCreate().

  • FIXED: process_create/3: Allow user_input (file_no 0) for stream(S)

  • TEST: Use PlUnit for the socket tests.

  • FIXED: udp_receive/4: did not pass address parameters correctly.

  • PORT: MSVC Avoid issues with different address length and buffer
    size types.

  • PORT: Support MSVC. Mostly silense warnings, improved types,
    fixed headers.

  • FIXED: Export install function from hashstream.so

  • PORT: Proper ip6 support detection for FreeBSD

  • FIXED: uuid/1,2: Prolog implementation for random UUID This
    implementation is only used if the C based ossp-uuid implementation
    cannot be found.

    Set the two most significant bits (bits 6 and 7) of the
    clock_seq_hi_and_reserved to zero and one, respectively according to
    RFC 4122 - A Universally Unique IDentifier (UUID) URN Namespace

  • ENHANCED: prolog_server/2: if tcp_host_to_address/2 raises an exception
    or fails, just use the Peer in the thread alias, rather than having the
    server thread die

  • ADDED: uri_edit/3 to build or modify a URI from components.

  • FIXED: Memory leak in uri handling

  • FIXED: socket address length to be the actual used length. Linux does
    not care, but MacOS does.

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

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

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

  • PORT: Fix some Sdprintf formats

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

Package cpp

  • DOC: Improve blob sample code

  • MODIFIED: SWI-cpp2.h includes inlined methods by default

  • PORT: Removed check_rc(). Seems not all C++ compilers can deal
    with this.

  • ENHANCED: added unwrap() method and PlUnwrapPtr()

  • PORT: Retain C++17 compatibility by removing designated initializer
    (a C++20 feature)

  • TEST: Ensure strict checking of C++17 standard on GCC.

  • ENHANCED: PlStream error handling + wrapper methods (and remove
    PlAcquireStream)

  • ENHANCEMENT: added PlAcquireStream

  • ENHANCED: AtomMap utility

  • DOC: blobs and exceptions

  • ENHANCED: std::string instead of char* in some calls (no code change
    needed) - Can add char* interface if needed for performance (unlikely)
    PlTerm(term_t) constructor is public, for consistency with PlAtom

  • PORT: MSVC MSVC work-arounds for compiling the tests. MSVS requires
    c++20 for the blob type initialization.

  • FIXED: likes.cpp sample code

  • CLEANUP: Simplify blob interface and more Simplify blob interface
    (PlBlob) - Add PlTerm::unify_blob for unique_ptr - Add try/catch
    to blob callbacks - Improve documentation of PlBlob Rename some
    implementation functions to more meaninful names Fix inverted condition
    test (zero vs non-zero return code) Move some code from SWI-cpp2.h
    to SWI-cpp2.cpp Add PREDICATE_CATCH macro to remove copy&paste code
    duplication Rename some example classes to improve the documentation
    Improve some garbage collection tests for blobs Update with changes
    from swipl v9.1.12

  • 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

  • DOC: Fixed LaTeX errors and duplicate conclusion section.

  • ENHANCED: C+±compatible exception handling + more wrapper functions
    and classes SWI-cpp2-plx.h contains wrapper functions (imported
    from SWI-cpp2.h) - throw PlException for Prolog errors - most
    SWI-Prolog.h functions have a wrapper. verify() methods removed from
    PlAtom, PlTerm, etc. - the wrapper functions do the checking. Some
    executable code has been moved to SWI-cpp2.cpp - can be inlined,
    if desired. PlException is now a subclass of std::exception,
    not a subclass of PlTerm. PlTypeError, PlDomainError, etc. are no
    longer subclasses of PlTerm, but are functions for creating suitable
    PlException objects. The string comparison operators are deprecated;
    use as_string() and std::string comparison instead, which allows
    specifying the encoding. Added PlRecord, PlRecordExternal, PlControl
    (used by PREDICATE_NONDET), PlStream. Fixed numerous bugs and
    misfeatures; added tests.

  • TEST: Do not build and link the tests when building with
    STATIC_EXTENSIONS

  • TEST: Updated for new qlf integer exchange functions.

  • TEST: Add some PL_qlf_*() tests

  • TEST: Fix C++ allocation tests

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

  • FIXED: PlQuery() should resolve the predicate in the target module
    if one is provided as well as set the context. This bug breaks
    completion in swipl-win.

  • TEST: Avoid encoding issues when running the tests.

  • TEST: Fixed PL_scan_options() test for 32-bit platforms.

  • TEST: Avoid test_common.pl. Although avoiding duplication is good,
    it is not a good idea that when build with -DINSTALL_TESTS, this file
    ends up in the public library.

  • DOC: Fixed LaTeX errors and duplicate labels.

  • DOC: Add “philosophy” section on classes Remove some obsolete sections
    Some cleanup of markup

  • ADDED: PlPredicate, PlModule classes, support Pltermv(0) Also removed
    some unused parameter defaults and clean up initialization checks.

  • DOC: fix description of how exceptions work

  • TEST: Disabled invalid tests on Windows.

  • DOC: more details about exception handling

Package http

  • FIXED: Deal with non-existence of library(http/http_exception) This
    library does not exist in the single threaded version.

  • ADDED: reply_html_partial/1 Reply HTML element without DOCTYPE
    and <html>.

  • ENHANCED: http_stop_server/2: try to avoid connecting This sends
    a signal to the HTTP accept thread. To make sure the signal is
    processed it connects after the signal. Unfortunately this takes 2
    seconds before raising an error on Windows. We now first check that
    the signal is processed within 0.1 second. If so, we are happy.
    If not, we try to connect anyway.

  • ENHANCED: Pass number reading exceptions rather than generating
    invalid_number.

  • FIXED: Several predicate options declarations.

  • PORT: Support MSVC Cleanup types.

  • ADDED: Updated list of HTML void elements

  • DOC: json option paragraph for http_post_data/4
    The json was missing, I copied explanation from
    SWI-Prolog -- library(http/http_json): HTTP JSON Plugin module and edited it.

    Used PlDoc markup

  • DOC: http_reply_from_files/3: document need for trailing /

  • ADDED: Full HTTP chunked support for CGI streams The CGI stream,
    as used by the HTTP server framework, supports setting the transfer
    encoding to chunked, but ctually had its own separate implementation.
    This commit shares most of the code with http_chunked.c and provides
    support for emitting chunk extensions as well as trailers.

  • ENHANCED: http_open/3: add lazy loading of chunked encoding support.

  • ADDED: http_is_chunked/1, http_chunked_add_trailer/3 and
    http_chunked_flush/2. These predicates support HTTP chunked out of
    band data. Unfortunately neither chunk extensions, nor trailer lines
    are widely accepted by clients.

  • ADDED: UTF-8 as default encoding for several SPARQL related content
    types.

  • FIXED: Prevent type error in redis based session management.

  • FIXED: http_open/3 with keep-alive connections Fixes two issues: (1)
    streams may be left open (leaking stream handles) when an error occurs
    during the HTTP handhake and (2) errors during the http handshake
    were propagated without the error(,) wrapper. With http handshake
    we refer to sending and reading the header as well as, for https,
    the TLS handshake.

  • MODIFIED: reply_json_dict/2 to explicitly use UTF-8 by default.
    Where the other reply_json variants used application/json; charset=UTF-8, reply_json_dict/2 used only application/json.
    This is fine according to the standards, but some clients insist on
    the charset. Ths patch makes all versions compatible.

  • FIXED: library(http/http_log): exception when logging was disabled.
    Harmless as the exception was printed but otherwise ignored.

  • FIXED: When stream garbage collection is enabled we cannot make a
    callback from the CGI context stream in case a context was lost and
    reclaimed through AGC.

  • ADDED: #158: Handle surrogate pairs in http/json The JSON string
    “\ud83d\udc95” has one codepoint, not two.

    This is because the spec allows extended characters to be
    encoded as a pair of 16-bit values, called a “surrogate pair”.

    From RFC 4627:

    To escape an extended character that is not in the Basic Multilingual
    Plane, the character is represented as a twelve-character sequence,
    encoding the UTF-16 surrogate pair. So, for example, a string
    containing only the G clef character (U+1D11E) may be represented as
    “\uD834\uDD1E”.

    This commit fixes the JSON parser to handle such surrogate pairs.

  • ENHANCED: library(http/http_unix_daemon) to use argv_options/3
    in guided mode. This simplifies adding options and defaults for
    applications using this library and simplifies maintenance.

  • FIXED: Possible non-determinism in write_html/2 on a mailbox that
    has not been posted to.

  • 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
    128+signum.

  • DOC: IPv6 consequences for the HTTP libraries.

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

  • 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
    http/http_error.

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

  • TEST: Avoid using test condition bindings.

Package inclpr

  • PORT: MSVC Cleanup old code.

Package jpl

  • BUILD: replace CMake deprecated exec_program() with
    execute_process()

  • PORT: Avoid conversion messages and warnings for MSVC

  • COMPAT: Set Prolog flag gc_thread to false SWI-Prolog used to
    disable the garbage collection thread on --no-signals. This was
    for JPL and is removed in version 9.1.18. It is unclear why using
    a separate GC thread causes the prolog_in_java test to hang.

    This patch sets the GC thread explicitly.

  • UPDATED: Java standards from 7 to 8. Support for 7 is dropped from
    latest OpenJDK releases and 7 is officially EOL for a while.

Package ltx2htm

  • MODIFIED: As all extensions are now installed in a subdirectory we
    no longer need an extra layer.

  • FIXED: Various math symbols Unicode translation

  • PORT: Support MSVC Silense warnings, cleanup types.

  • ENHANCED: Use more Unicode characters for math commands.

Package mqi

  • MODIFIED: Install MQI as a SWI-Prolog app This simplifies the command
    line interface and avoids the need for autoloading. New interface is

    swipl mqi [option ...]
    
  • TEST: Don’t use Unix domain sockets if the path is so long that it
    will fail

  • BUILD: Avoid dependency on CMAKE_SOURCE_DIR

  • TEST: Do not run tests if Pythin cannot be found.

  • TEST: Avoid recorsive Python exception

Package nlp

  • PORT: Suppress MSVC warnings

Package odbc

  • ADDED: odbc_table_column/4: improved mapping to Prolog types.
    Maps 'TEXT' to longvarchar(Length).

  • ADDED: odbc_prepare/4: return derived parameter mapping This commit
    also improves debug messages on type mappings to use type names
    rather than integers and writes debug messages for the type mapping
    for prepared statement arguments.

  • PORT: MSVC Cleanup types (inroduce more size_t)

  • PORT: Fix some printf formats

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

  • PORT: MSVC Avoid type warnings.

  • TEST: Install input files.

  • ADDED: added save/load functionality to pcre blob

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

Package pengines

  • CLEANUP: use uri_edit/3 to compute the final server path

  • FIXED: chunk=false. Spotted by @meditans

  • ADDED: Allow no-chunking behavior for pengines. If chunk=false
    we avoids the usage of findnsols (and the effects on global variables
    associated with its backtracking). Initially, this was motivated by
    the fact that I wanted the pengine top-level (which is recursive
    in nature) to respect the chr store, but I also think it’s a more
    principled thing to do.

  • FIXED: Predicte option declarations.

Package pldoc

  • FIXED: Avoid dependency on library(pce) Allows running the
    documentation tools without library(pce)

  • ADDED: print_markdown/2 to emit a string as markdown.

  • CLEANUP: File system interaction to use more libraries.

  • DOC: Document doc_save/1 include_reexported(Bool) option.

  • ADDED: @since tag Allows annotating the version when a predicate
    was added.

  • ADDED: man_pages//2 option qualified(always) This is used by help/1
    on the commandline to show documented private predicates when found
    in some module.

  • FIXED: Handle search if summary contains non-ASCII characters.

  • ENHACED: Give manual section in HTML title

  • ADDED: Include documentation for exported predicates loaded from other
    files. While this was in place for imported modules (re-export),
    documentation from non-module files loaded by and exported from a
    module was not included.

  • FIXED: LaTeX backend: generating \url{} must escape #.

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

Package plunit

  • MODIFIED: removed library(test_cover). This library is moved to the
    core as library(prolog_coverage) because it has no dependencies on
    the unit testing and serves more purposes.

  • ADDED: library(test_cover): allow to save and restore coverage data.
    This patch is a major improvement to the coverage analysis tool.
    It modifies the API, although the old show_coverage/2 is still working
    as it used to.

    It improves the report and, most importantly, allows for combining
    coverage data from multiple Prolog invocations.

  • ADDED: cov_save_data/1.

  • FIXED: #23 allow set_tests_options([run(make(all))]).

  • DOC: Improved documentation for show_coverage/1,2

  • FIXED: Avoid tty_get_capability/3 exception

  • FIXED: show_coverage/2: details for non-module files with tests.
    A non-module file that defines a test was not considere a non-module
    file due to the existence of the test module and as a result, coverage
    details were no shown for such files.

  • ENHANCED: If --on-warning=status or --on-error=status is active,
    consider such messages testv failures When running tests using
    --on-error=status, printing an error message that does not cause
    a test to fail silently ignores the message while Prolog exits with
    status 1. That is hard to debug. Now, if these flags are present,
    tests that emit warnings or errors are considered failed and thus
    the test is printed.

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

  • ENHANCED: Name of failed test. Now prints both the unit and test
    and uses quoted write so you can copy/paste the result.

  • PORT: Make library(plunit) without timeout support.

  • DOC: Sync recent changes into the LaTeX docs

  • 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([fomat(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.

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

  • ADDED: test_set_options/1: output(+Mode) to suppress output or emit
    it only after the test fails.

  • CLEANUP: Cleaner code for running tests and map to results. This is a
    squashed commit for a large set of improvements. Roughly, in tackles:

    • Cleaner wrapping code for running the tests, removing a lot of
      code duplications
    • Make test time available to a larger part of the code and use
      call_time/2 to get more extensive resource usage information than
      just time.
    • MODIFIED: Various message formats have changed. This may impact
      code that uses the message hooks to make the output satisfy some
      test driver. This is also the driving force: the end-goal of
      these changes is to provide a good concurrent test framework.
  • ADDED: current_test_unit/2 to enumerate the available unit tests.

  • MODIFIED: extend message term plunit(end(Unit)) to plunit(end(Unit,
    Summary)) where summary provides the status and time spend on
    the unit.

Package protobufs

  • BUILD: replace CMake deprecated exec_program() with
    execute_process()

  • PORT: MSVC Cleanup float32 and int32 handling.

Package redis

  • FIXED: Better reconnect implementation

  • ENHANCED: Avoid hanging connection on invalid authentication.

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

  • FIXED: Also connecting to the sentinels require authentication.

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

  • ADDED: Support Redis TLS connections.

  • TEST: More relaxed timing to make test pass on heavily loaded machines.

Package semweb

  • ADDED: sparql_query/3: pass SSL options to the SSL context.

  • FIXED: Predicate options declarations.

  • PORT: MSVC Type cleanup, added atomic versions.

  • ADDED: rdfe_load/2: accept .nt (N-Triples) files.

  • FIXED: rdf_literal/1 should not succeed on IRIs in object position

  • FIXED: memory leak in Turtle parser in create/destroy cycle.

  • PORT: Fix some *printf formats

  • PORT: Fix some Sdprintf formats

  • PORT: Support full Unicode input for ntriples and trutle on
    Windows. Based on PR#108 by @mgondan.

Package sgml

  • PORT: MSVC More portable types and avoid possible overflows by
    using size_t

  • PORT: Support MSVC Suppress warnings, support MSVC atomic intrinsics.

  • FIXED: Race condition in dtd_property/2 Can lead to Domain error:
    dtd_property’ expected, found entities(_37838)’

  • ADDED: the atom transformation to the attribute value in xpath.
    The content attributes provided with load_structure/3 can be atoms
    or strings depending on the attribute_value/1 option. So adding
    a transformation of attribute values to an atom in xpath/3 should
    be a useful feature, such as string transflation.

  • TEST: Free sgml parser and end of test to avoid a memory leak.

  • 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

  • PORT: Add OPENSSL_Applink() to ssl4pl.dll This function is used by
    OpenSSL to get module-consistent of the MS CRT library. It is expected
    at the application level. This patch tries to keep it locally in the
    ssl binding with a small relay function from the SWI-Prolog executable.

  • PORT: Make use of OpenSSL “applink” Consistency use OpenSSL applink.c
    if this is defined. This patch itself does not enable applink.

  • TEST: Allow running SSL test suite from main build directory.

  • PORT: Create test certificates when running under Conda

  • FIXED: Avoid leaking file handle in test

  • PORT: Handle the zlib OpenSSL dependency correctly on Windows.

  • PORT: MSVC Make configure work by removing z.lib dependency when not
    using MinGW and avoid several type errors.

  • PORT: MSVC MSVC doesn’t allow for array declaration from const int.
    Also use MSVC intrinsics for atomic operations.

  • FIXED: Return type for Prolog term.

  • ADDED: crypto_password_hash/2,3 option algorithm(bcrypt) Uses the
    Openwall implementation of BCrypt, a public-domain, widely-used
    C implementation.

    Requires openbsd support from library(base64), added Feb 22 2023.

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

  • FIXED: crypto_password_hash/2,3 assumed byte encoding for
    base64_encoded/3 while the default changed to UTF-8. Added test.

Package sweep

  • ADDED: in-buffer completions for Prolog flags * sweep.pl
    (sweep_context_callable_arg/4): Report “flag” context.
    (sweep_flags_collection/2): New predicate. * sweeprolog.el
    (sweeprolog–flag-completion-at-point): New function.
    (sweeprolog–atom-or-functor-completion-at-point): Use it. *
    sweeprolog-tests.el (cap-flag-name): New test. * sweep.texi (Code
    Completion): Update.

  • ADDED: in-buffer completions for arithmetic functions * sweep.pl
    (sweep_function_functors_collection/2) (sweep_functions_collection/2):
    New predicates. (sweep_context_callable_arg/4): Recognize arithmetic
    functions.

    • sweeprolog.el (sweeprolog-arith-functor-completion-candidates)
      (sweeprolog-arith-completion-candidates): New functions, used in…
      (sweeprolog–atom-or-functor-completion-at-point): …here.

    • sweep.texi (Code Completion): Document arithmetic function
      completion.

    • sweeprolog-tests.el: Test it.

  • ADDED: in-buffer completions for predicate options * sweep.pl
    (sweep_option_functors_collection/2) (sweep_options_collection/2)
    (sweep_option_arguments_collection/2): New predicates.
    (sweep_context_callable_arg/4): Recognize predicate options.

    • sweeprolog.el (sweeprolog-option-functor-completion-candidates)
      (sweeprolog-option-completion-candidates)
      (sweeprolog-option-arg-completion-candidates): New functions,
      used in…
      (sweeprolog–atom-or-functor-completion-at-point): …here.

    • sweep.texi (Code Completion): Document predicate options completion.

    • sweeprolog-tests.el: Test it.

  • ADDED: in-buffer completions for source file specs

    • sweep.pl (sweep_alias_source_file_name_collection/2)
      (sweep_alias_source_file_name/4) (sweep_source_file_name_collection/2)
      (sweep_source_file_name/3) (sweep_path_alias_collection/2)
      (sweep_matching_path_alias/3): New predicates.
      (sweep_context_callable_/3): Simplify, and recognize predicate
      arguments that should be source file specifications.

    • sweeprolog.el (sweeprolog-source-functor-completion-candidates)
      (sweeprolog-alias-source-completion-candidates)
      (sweeprolog-source-completion-candidates): New functions, used in…
      (sweeprolog–atom-or-functor-completion-at-point): …here.
      (sweeprolog-electric-layout-post-self-insert-function)
      (sweeprolog-context-menu-for-region)
      (sweeprolog-maybe-extract-region-to-predicate): Adapt.

    • sweep.texi (Code Completion): Document file spec completion.

    • sweeprolog-tests.el: Test it.

  • ENHANCED: Improve ‘sweeprolog-extract-region-to-predicate’ Teach
    ‘sweeprolog-extract-region-to-predicate’ about existentially quantified
    goals and lambda terms.

    • sweep.pl (sweep_term_variable_names/2): Remove from export list.
    • sweep.pl (sweep_extract_goal/2): New public predicate.
    • sweeprolog.el (sweeprolog-extract-region-to-predicate): Use it.
    • sweeprolog-tests.el: Test it.
    • sweep.texi (Extract Goal): Update documentation.
  • ADDED: new command ‘sweeprolog-query-replace-term’ This patch
    extends the Term Search infrastructure to support search-and-replace
    operations. Namely, we replace the predicate ‘sweep_term_search/2’
    with a new predicate ‘sweep_term_replace/2’ that subsumes the
    functionality of the former. The command ‘sweeprolog-term-search’
    is greatly simplified and adjusted to work with this new predicate,
    and we introduce a new command, ‘sweeprolog-query-replace-term’, that
    exposes the new search-and-replace facility of ‘sweep_term_replace/2’
    in an interactive UI inspired by ‘query-replace’.

    • sweep.pl (sweep_term_search/2): Remove in favor of…
      (sweep_term_replace/2): New predicate.
    • sweeprolog.el: (sweeprolog-term-replace-edits): New function.
      (sweeprolog-term-search): Rewrite.
      (sweeprolog-term-search-last-search)
      (sweeprolog-term-search-overlays)
      (sweeprolog-term-search-repeat-count)
      (sweeprolog-term-search-repeat-backward)
      (sweeprolog-term-search-repeat-forward)
      (sweeprolog-term-search-abort)
      (sweeprolog-term-search-in-buffer)
      (sweeprolog-term-search-next)
      (sweeprolog-term-search-map): Remove, unused.
      (sweeprolog-query-replace-term): New command.
      (sweeprolog-mode-map): Bind it.
    • sweeprolog-tests.el (term-search)
    • sweep.texi (Term Search): Adjust.
      (Term Replace): New section.
  • ENHANCED: Support pty top-level communication instead of TCP Add
    the ability for top-level buffers to communicate with their backing
    threads via pty instead of a local TCP connection. This is controlled
    by a new user option, enabled by default on systems where Emacs can
    creates a pty.

    • sweep.pl (sweep_top_level_start_pty/2): New predicate.
    • sweeprolog.el (sweeprolog-top-level-use-pty): New user option.
      (sweeprolog-top-level-buffer): Use it.
    • sweep.texi (The Prolog Top-level): Document it.
  • ADDED: New command ‘sweeprolog-extract-region-to-predicate’ Add
    a command for extracting a part of a clause body into a separate
    predicate.

    • sweep.pl (sweep_term_variable_names/2)
      (sweep_goal_may_cut/2): New helper predicates.
    • sweeprolog.el (sweeprolog-extract-region-to-predicate): New command.
      (sweeprolog-maybe-extract-region-to-predicate): New function.
      (sweeprolog-insert-term-functions): Add it.
    • sweep.texi (Insert Term DWIM, Extract Goal): Document it.
  • PORT: MSVC Need to get DLL linkage correct. This also requires a
    change in SWI-Prolog.h

  • PORT: Include local copy of emacs-module.h in case this is not
    provided.

  • PORT: Explicitly export the symbols we need By default, plugins are
    now compiled with hidden visibility for internal symbols.

  • MODIFIED: Replace “faces styles” with a theme emulating PceEmacs
    This adds a custom theme called ‘sweeprolog-pce’ that mimics the
    highlighting of SWI-Prolog’s built-in editor, PceEmacs. It obsoletes
    the “faces styles” feature that Sweep provided thus far. For backward
    compatibility, The user option ‘sweeprolog-faces-style’ is retained
    and mostly still respected.

    Thanks to Stefan Monnier for suggesting this approach for simplifying
    Sweep’s code and making it more conformant with Emacs conventions.

    • sweeprolog-pce-theme.el: New file.

    • sweeprolog.el: Remove ‘sweeprolog-defface’ macro its
      ‘sweeprolog-*-face’ functions, use plain face definitions and refer to
      them directly by their names instead. Also extend
      ‘custom-theme-load-path’ to include the new sweeprolog-pce-theme.el.

    • README.org (Semantic Highlighting): Replace “Available Styles”
      subsection with new subsection “PceEmacs Theme”.

  • DOC: Extend the “Overview” manual section * README.org (Main Features)
    (Comparison with Emacs’s built-in Prolog mode): New subsections.

  • ADDED: Persistent history for Sweep top-levels This adds a new user
    option that controls the value of ‘comint-input-ring-file-name’
    in Sweep top-level buffers.

    • sweeprolog.el (sweeprolog-top-level-persistent-history): New user
      option.
      (sweeprolog-top-level-sentinel)
      (sweeprolog-top-level-setup-history): New functions.
      (sweeprolog-top-level-setup-buffer): Call
      ‘sweeprolog-top-level-setup-history’ when creating a new top-level
      buffer.
  • FIXED: Correctly recognize DCG grammar rules in ‘C-c C-d’ *
    sweeprolog.el (sweeprolog-beginning-of-predicate-at-point):
    Also return the module and neck operator of the predicate
    at point. (sweeprolog-insert-predicate-documentation)
    (sweeprolog-read-predicate-documentation-function)
    (sweeprolog-read-predicate-documentation-with-holes)
    (sweeprolog-read-predicate-documentation-default-function)
    (sweeprolog-read-predicate-documentation)
    (sweeprolog-document-predicate-at-point): Adapt to support DCGs and
    non-local predicates.

  • ENHANCED: Guess argument names for DCG grammar rules * sweeprolog.el
    (sweeprolog-predicate-completion-at-point) (sweeprolog-insert-clause):
    Support guessing argument names from documentation also for DCG
    grammar rules.

  • ENHANCED: Also highlight “undefined” head terms

  • ENHANCED: ‘sweeprolog-find-predicate/module’ improvements Allow
    finding modules and predicates in another window with prefix argument.
    Also improve prompt for ‘sweeprolog-find-predicate’.

    • sweeprolog.el (sweeprolog-read-predicate-prompt): Remove trailing
      colon and space.
      (sweeprolog-predicate-visible-p-function): New user option.
      (sweeprolog-read-predicate): Use it, and format PROMPT with predicate
      at point as the default argument.
      (sweeprolog-find-module)
      (sweeprolog-find-predicate): Add optional argument OTHER-WINDOW.
      (sweeprolog-describe-predicate): Adapt PROMPT argument passed to
      ‘sweeprolog-read-predicate’.

    • README.org (Finding Prolog Code): Expand.

  • ENHANCED: Improve DCG support Take into account DCG grammar
    rules and ensure they’re supported all around. Crucially, allow
    ‘sweeprolog-describe-predicate’ to display documentation for DCG
    grammar rules.

  • FIXED: Don’t change hooks globally * sweeprolog.el (sweeprolog-mode):
    Extend ‘kill-buffer-hook’ and ‘context-menu-functions’ locally rather
    than global.

  • ENHANCED: Add tooltip info for string-stye DCG terminals

  • ENHANCED: Export DCG non-terminals as ‘foo//N’, not ‘foo/N+2’ *
    sweep.pl (strip_det/2): Handle DCG non-terminals with determinism
    specification. (sweep_local_predicate_export_comment/2,
    sweep_exportable_predicates/2) * sweeprolog.el
    (sweeprolog-local-export-comment) (sweeprolog-local-export-comment):
    Adapt for DCG non-terminals.

  • ENHANCED: Highlight string-style DCG terminals

  • ADDED: highlighting and tooltip info for declaration options * sweep.pl
    (sweep_color_normalized_/4): Handle ‘decl_option/1’ fragments.

    • sweeprolog.el (sweeprolog-declaration-option): New face, used in…
      (sweeprolog-analyze-fragment-to-faces): …for ‘decl_option’ frags.
      (sweeprolog–help-echo-for-declaration-option): New function.
      (sweeprolog-analyze-fragment-help-echo): Use it.
  • ADDED: command for inserting example usage comments *
    sweeprolog.el (sweeprolog-top-level-example-mode): New minor
    mode. (sweeprolog-make-example-usage-comment): New command.
    (sweeprolog-mode-map): Bind it.

    • README.org (Example Usage Comments): New section.
  • ADDED: New command for expanding macros *
    sweep.pl (sweep_expand_macro/2): New predicate. *
    sweeprolog.el (sweeprolog-expand-macro-at-pos):
    New function. (sweeprolog-expand-macro-at-point):
    New command. (sweeprolog-context-menu-functions): Add…
    (sweeprolog-context-menu-for-macro): New function. * README.org
    (Macro Expansion): New section.

  • ADDED: Highlighting and tooltip info for macros * sweep.pl
    (sweep_color_normalized_/4): Handle ‘macro(String)’
    terms. * sweeprolog.el (sweeprolog-macro):
    New face. (sweeprolog-analyze-fragment-to-faces)
    (sweeprolog-analyze-fragment-help-echo): Handle ‘macro’ fragments.

  • FIXED: tokenizing adjacent operators Make Sweep’s Prolog tokenization
    functions more careful in their handling of unrelated adjacent
    operators. This fixes an issue that affects term-based movement
    commands and other commands that rely on ‘sweeprolog–forward-sexp’
    and friends.

    • sweeprolog.el (sweeprolog-next-token-boundaries)
      (sweeprolog-last-token-boundaries): Fix handling of
      adjacent (distinct) operators.

    • sweeprolog-tests.el
      (forward-sexp-with-adjacent-operators): New test case.

  • MODIFIED: Remove ‘-face’ suffix from face names Remove the ‘-face’
    suffix from the names of all defined faces as prescribed in (info
    “(elisp)Defining Faces”).

  • ENHANCED: faster completion-at-point for predicates Filter
    predicate completion candidates according to the text near
    point before formatting and computing argument names. This makes
    completion-at-point for predicates much faster when there are lots
    of known predicates.

    • sweeprolog.el (sweeprolog-predicate-completion-at-point): Pass
      (partial) functor at point to…
    • sweep.pl (sweep_predicate_completion_candidates/2): Filter
      predicates based on new Sub argument.
  • FIXED: beginning-of-clause detection with quoted head functors *
    sweeprolog.el (sweeprolog-beginning-of-top-term): don’t skip quoted
    functors in clause heads.

  • ADDED: Support setting breakpoints in sweeprolog-mode *
    sweep.pl (sweep_set_breakpoint/2) (sweep_delete_breakpoint/2)
    (sweep_set_breakpoint_condition/2): new predicates.

    • sweeprolog.el (sweeprolog-dependency-directive): update
      package-version field.
      (sweeprolog-set-breakpoint)
      (sweeprolog-set-breakpoint-condition)
      (sweeprolog-delete-breakpoint)
      (sweeprolog-list-breakpoints): new commands.
      (sweeprolog-highlight-breakpoints): new user option.
      (sweeprolog-mode-map): bind sweeprolog-set-breakpoint.

    • README.org (Setting Breakpoints): new manual section.

  • ADDED: mode line indication for loaded buffers *
    sweep.pl (sweep_source_file_load_time/2): new predicate.
    (sweep_load_buffer/2): also update source modification
    time based. * sweeprolog.el (sweeprolog-buffer-load-time)
    (sweeprolog-buffer-loaded-since-last-modification-p): new functions.
    (sweeprolog-load-buffer): use it. (sweeprolog-mode): add mode line
    indication if buffer is loaded.

  • MODIFIED: sweeprolog-update-dependencies choice of
    directives * sweeprolog.el (sweeprolog-dependency-directive):
    New user option. Determines which directive to use in…
    (sweeprolog-update-dependencies): Fix edge cases in finding where
    to insert new directives. Optionally infer directive to add based on
    current buffer contents.

    • README.org (Managing Dependencies): Update section.
  • 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
    

    to:

    foo(Bar, Baz) :- Baz = Bar.foo.	^ 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.

    • README.org (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 * sweep.pl (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. * README.org
    (Renaming Variables): new section.

  • ENHANCED: use docs from the SWI-Prolog manual to guess hole names *
    sweep.pl (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.
  • 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.
  • 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.pl (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.pl (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.pl (sweep_term_search/2): new predicate. *
    sweeprolog.el (sweeprolog-term-search-in-buffer): new function.
    (sweeprolog-term-search): new command. * README.org (“Term Search”):
    new manual section.

  • FIXED: find next predicate definition more reliably

    • sweep.pl (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)
    (sweeprolog-read-predicate-documentation-default-function):
    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.pl (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. * README.org (“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.pl (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

  • ADDED: new command sweeprolog-infer-indent-style * sweeprolog.el
    (sweeprolog-infer-indent-style): new command. * sweeprolog-tests.el:
    test it. * README.org (“Indentation”): mention it.

  • FIXED: stale predicate locations in loaded modified buffers * sweep.pl
    (sweep_predicate_location_/2,3): prefer xref over loaded predicate
    properties. * sweeprolog.el (sweeprolog-predicate-location): first
    analyze buffer if modified to update xref data.

  • ADDED: ability to pass command line args directly to swipl

    • sweeprolog.el (sweeprolog-handle-command-line-args): new
      function, sets up command line argument handling using…
      (sweeprolog-command-line-function): new function.
  • ADDED: minor mode for moving to the next hole with TAB * sweeprolog.el
    (sweeprolog-forward-hole-on-tab-mode): new minor mode, binding
    TAB to… (sweeprolog-indent-or-forward-hole): new command. *
    README.org (“Filling Holes”): rephrase and mention new minor mode.

  • ENHANCED: indentation after infix operators * sweeprolog.el
    (sweeprolog-indent-line-after-infix): adhere to last line indentation
    even if non-standard, handle DCG RHS contexts and SSU guards. *
    sweeprolog-tests.el: add more tests for indentation.

  • ENHANCED: use argument names for holes in predicate
    completion * sweep.pl (predicate_argument_names/2):
    new predicate. (sweep_format_predicate/2): use it, and
    revise into… (sweep_format_predicate/4): new predicate.
    (sweep_predicate_completion_candidates): use it.

  • ADDED: make flymake optionally complain about implicit autoloads *
    sweeprolog.el (sweeprolog-note-implicit-autoloads): new user-option.
    (sweeprolog-analyze-fragment-flymake): use it. * README.org (“Managing
    Dependencies”): mention it.

  • ADDED: new command for updating use_module/autoload directives

    • sweep.pl (sweep_file_path_in_library/2): new predicate.
      (sweep_color_normalized/3): normalize autoload source paths. *
      sweeprolog.el (sweeprolog-analyze-buffer-with): new helper function.
      (sweeprolog-update-dependencies): new command.

Package swipl-win

  • INSTALL: Sync with central cmake changes

  • PORT: Updated cmake compatibility to > 3.5

  • PORT: Changes for SWI-cpp2.h version 2

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

Package table

  • PORT: MSVC

Package tipc

  • FIXED: library(tipc/tipc_linda): Did not load
    library(tipc/tipc_broadcast).

Package xpce

  • CLEANUP: Removed unused code.

  • CLEANUP: Avoid duplication between library(prolog_xref) and
    library(pce_prolog_xref)

  • ADDED: GUI tracer settings: allow setting ellipses length for text.

  • FIXED: Huge spacing in PceEmacs on some fixed width fonts.

  • FIXED: Windows possible memory corruption due to long/intptr_t mismatch

  • PORT: MSVC - Avoid dependency on globbing in CMake command by
    using CMake file(GLOB) - Suppress compiler warnings on data loss and
    signed/unsigned types - Small typing cleanup. - Avoid RedrawWindow()
    (renamed to pceRedrawWindow()) - Fix SendFunc casting - Avoid conflict
    over “small”!?

  • PORT: Include Win32 port of Xpm dependency This simplifies the
    build process. The code has been included and updated to avoid many
    compiler warnings.

  • PORT: C11 compatibility

  • BUILD: Copy swipl-rc to home/xpce/prolog This is the only file
    that required running the binary without installation that was in
    the source. By copying it to the binary pre-stage home dir we can
    greatly simplify build_home.pl

  • ENHANCED: Hide internal xpce symbols This avoids symbol conflicts
    and reduces the startup time

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

  • FIXED: finder with default mode to find files for reading.

  • PORT: Add function prototypes.

  • PORT: migration of regex library to ANSI C prototypes

  • PORT: Convert gitwrite.c code to ANSI C.

  • FIXED: directory->scan existence checking.

  • ADDED: Deal with new port option of the profiler.

  • UPDATED: Use renamed (to prolog:prolog_exception_hook/5) hook for
    trapping exceptions.

  • FIXED: Marshall 64 bit integers from xpce to Prolog.

  • FIXED: pce->write for integers > 32 bits.

  • CLEANUP: Use PRIdPTR from <inttypes.h>for printing intptr_t
    rather than our own creation.

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

  • FIXED: file<-time default was accidentally to access where it used
    to be modified.

  • PORT: Make the xpce source compile clean using GCC -pedantic flag.
    Note that an important part of the problems is that XPCE threads data
    and function pointers the same. This used to work with a cast to
    void*. This is not allowed in C11. It is allowed to cast both
    pointers and functions to intptr_t, so with a little detour we
    get where we need to be. Time will tell whether we will see systems
    where this conversion is not allowed.

Package yaml

  • PORT: MSVC

  • FIXED: Stricter number syntax checking. The library tests scalars
    for numeric syntax and then invokes the Prolog parser. It passed “e”
    as a number. This patch also documents that, violating the standard,
    we parse “0.” as a string rather than a float.

Package zlib

  • FIXED: Predicate options declarations.
5 Likes

All the MacOS releases appear to require Catalina (MacOS 10.15) rather than Mojave (10.14) as advertised. Was that the intent?

Yes. Well, current Qt version (used for the app) requires 10.15. As that is the key component of the app, I’ve updated the entire dependency for the binary releases to 10.15. Note that 12.7 is the oldest maintained version.

(post deleted and replaced by a Github issue)

I spent some time (hours) installing 10.15 on a secondary disk, but it failed to launch the 9.3.0 Intel bundle (from system console, all I could find):

Feb  1 17:10:50 ... com.apple.xpc.launchd[1] (org.swi-prolog.app.6984[979]): Service exited with abnormal code: 1`

Command line version in the bundle worked fine so I’ll be using that, and the 9.1.22 bundle, on 10.14 for now.

So, 10.15 doesn’t work either :frowning: 10.15 being end-of-life, I won’t bother. Can some mac users of the binary app report on the versions where it does (not) work?

MSYS2: build works, check_installation too. With ctest I get a segfault:

2: Running test set "load_program" . done.
2: Running test set "ctype" ...... done.
2: Running test set "thread" ....
1/2 Test  #2: swipl:basic ......................***Exception: SegFault  1.50 sec
test 18

I am a bit lost, how can I debug this further? I have already entered the directory swipl-devel/src/Tests/threads, and swipled all the files in that folder, i.e., ../../../build/src/swipl -s acg -g acg -g halt, no suspicious behavior. Maybe the problem is not in threads?

First step is to run

ctest -V -R basic

that should print some output. Next, you can copy/paste the commandline that is executed, drop -q and add at the end --output=always, e.g., on my system:

src/swipl "-f" "none" "--no-packs" "--on-error=status" "/home/janw/src/swipl-devel/src/test.pl" "--no-subdirs" --output=always

That should give some clue about where it goes wrong. If we are lucky, running just the crashing test should reproduce … We’ll see from there.

It is a bit odd. Tests pass on Windows both using the normal binaries compiled with MinGW based on gcc-13 and on the Windows version compiled with VS2022. As well as on all other tests platforms.

msys2 is a bash, but I am in src anyway, hence:

./swipl.exe "-f" "none" "--no-packs" "--on-error=status" "-q" "C:/msys64/home/matth/swipl-devel/src/test.pl" "--no-subdirs"

It segfaults in thread,

Running test set "load_program" . done.
Running test set "ctype" ...... done.
Running test set "thread" ....Segmentation fault

Moving on…

matth@hp UCRT64 ~/swipl-devel/src
$ ../build/src/swipl.exe -s test

All tests pass, no segfault.

matth@hp UCRT64 ~/swipl-devel/src
$ ../build/src/swipl.exe -f none -s test

Running test set “thread” (2430).(2432).(2437).(2442).(2447)Segmentation fault

I don’t think I have a “user initialization file”, so that can be an artifact.

Here it is:

[trace] 2 ?- thread(at_exit-1).
   Call: (12) thread(at_exit-1) ? creep
^  Call: (13) retractall(at_exit_called) ? skip
^  Exit: (13) retractall(at_exit_called) ? creep
^  Call: (13) thread_create(at_exit_work, _18764, []) ? creep
^  Exit: (13) thread_create(at_exit_work, <thread>(3,00000121FDE24F00), []) ?
   Call: (1) at_exit_work ? creep
   Call: (13) thread_join(<thread>(3,00000121FDE24F00), exited(true)) ? creep
^  Call: (2) backward_compatibility:thread_at_exit(assert(at_exit_called)) ? creep
creep
^  Call: (3) prolog_listen(this_thread_exit, user:assert(at_exit_called)) ? creep
^  Exit: (3) prolog_listen(this_thread_exit, user:assert(at_exit_called)) ? creep
^  Exit: (2) backward_compatibility:thread_at_exit(user:assert(at_exit_called)) ? creep
   Call: (2) thread_exit(true) ? creep
Segmentation fault

9.0.4 works fine

matth@hp UCRT64 ~/swipl-devel/build/src
$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 9.0.4)
1 ?-  dynamic(at_exit_called/0).
true.

2 ?-  assert((at_exit_work :- thread_at_exit(assert(at_exit_called)), thread_exit(true))).
true.

3 ?- trace, thread_create(at_exit_work, Id, []), thread_join(Id, exited(true)).
^  Call: (11) thread_create(at_exit_work, _4878, []) ? creep
^  Exit: (11) thread_create(at_exit_work, <thread>(3,0000019477320280), []) ?
   Call: (1) at_exit_work ? creep
   Call: (11) thread_join(<thread>(3,0000019477320280), exited(true)) ? creep
^  Call: (2) backward_compatibility:thread_at_exit(assert(at_exit_called)) ? creep
creep
^  Call: (3) prolog_listen(this_thread_exit, user:assert(at_exit_called)) ? creep
^  Exit: (3) prolog_listen(this_thread_exit, user:assert(at_exit_called)) ? creep
^  Exit: (2) backward_compatibility:thread_at_exit(user:assert(at_exit_called)) ? creep
   Call: (2) thread_exit(true) ? creep
   Exit: (11) thread_join(<thread>(3,0000019477320280), exited(true)) ? creep
Id = <thread>(3,0000019477320280).

More guidance needed :slight_smile:

Surely, nothing relevant changed to the SWI-Prolog code in years. Sure 9.0.4 still works fine when compiled in your current environment? thread_exit/1 is deprecated. Time for gdb. I think that should run under MSYS2? If so

gdb --args swipl.exe -f ... (whole command line)
(gdb) run
<hopefully crashs>
(gdb) bt
<shows backtrace>

That might give a clue. You can better results when rebuilding with -DCMAKE_BUILD_TYPE=Debug. Normally do that in a second build directory (which I normally call build.debug). The debug build also allows for -d topic to enable the C DEBUG() statements.

Indeed, it also fails on 9.0.4.

It actually works fine within the CI system of MSYS2 · GitHub. Maybe my local installation is broken.

Is this still relevant?

My gut feeling says no.

out-of-date library?

One option is that I made no mistakes and all the CMake magic works fine in MSYS2 as well :slight_smile: If it actually works, swipl.exe should be in MSYS’s bin directory, rather than in the Prolog tree with a swipl.bat file in the bin that calls it.

I tried to make it generic, but in my experience these things tend to fail on some systems :frowning:

In fact, it fails. I need to type

matth@hp UCRT64 /ucrt64/bin
$ ./swipl --home=/ucrt64/lib/swipl

I guess I’ll let msys2 join the Unix installation, and put the little bash scripts instead of symbolic links:

/ucrt64/bin/swipl (bash script)
/ucrt64/lib/swipl/x64/swipl.exe

More or less at it’s been before.

For 9.3.0. on intel iMac (Sonoma) build was successful, bu I got ninja error on M1 MacBook pro:

-- Configuring done (1.2s)
-- Generating done (0.2s)
-- Build files have been written to: /Users/cantor/src/swipl-devel/build

ninja: error: '/opt/homebrew/Cellar/openssl@3/3.2.0_1/lib/libcrypto.dylib', needed by 'packages/ssl/crypto4pl.so', missing and no known rule to make it

I have no idea how to fix this error more than
simply running homebrew to install necessary stuff on openssl.

Smells like you should do the configure from scratch after updating versions of Xcode or Homebrew. Remove your build directory, recreate it and re-run cmake. Possibly there is something wrong with the homebrew package, but normally it should be cmake to complain rather than the build itself.

Following your guess, I ran an old build script of
mine named update-swipl-clang, which deletes the build directory first, then I got 9.3.0 successfully.
Thanks.

That is not how it is supposed to work. The process is controlled by the CMake option SWIPL_INSTALL_AS_LINK, which is OFF by default on WIN32. cmake/Params.cmake computes PLRELHOME, which ends up in src/param.h in the build directory. That is compiled into the executable to find the home relative to the executable itself.

So, first check src/param.h whether it defines PLRELHOME. If not, the SWIPL_INSTALL_AS_LINK is probably not triggered ok. If it is set, but wrong, the logic in cmake/LocationsPostPorts.cmake to compute PLRELHOME is probably wrong. It is right, something in src/pl-init.c to compute the home must be wrong. With a couple of message() calls in the Cmake files it is probably possible to figure out where it goes wrong for MSYS2.

I can do the same in MSYS2 as for Conda,

if(MINGW_ROOT)
  include(port/MinGW)
elseif(CONDA OR MSYS2) # here
  include(port/CondaWindows)
endif()

Then, src/param.h gets the correct PLRELHOME. That’s probably the way to go.

Next problem: I can run swipl only from the “current folder”.

matth@hp UCRT64 ~/swipl/bin
$ ./swipl
bindir=C:\msys64\home\matth\swipl\bin\swipl.exe
bindir=.
Welcome to SWI-Prolog (threaded, 64 bits, version 9.3.0-13-g84784c878-DIRTY)
1 ?- halt.

matth@hp UCRT64 ~/swipl/bin
$ cd ..

matth@hp UCRT64 ~/swipl
$ bin/swipl
bindir=C:\msys64\home\matth\swipl\bin\swipl.exe
bindir=.
SWI-Prolog: [FATAL ERROR: at Sun Feb  4 20:36:24 2024
        Could not find system resources]

I wonder if the same problem is seen on Conda.

The debug messages are from pl-init.c:

#ifdef PLRELHOME
  if ( !home && symbols )
  { char bindir[PATH_MAX];
    char *o;

    strcpy(bindir, symbols);
    fprintf(stdout, "bindir=%s\n", bindir);
    DirName(bindir, bindir);
    fprintf(stdout, "bindir=%s\n", bindir);
    if ( strlen(bindir)+strlen(PLRELHOME)+2 > sizeof(bindir) )
      fatalError("Executable path name too long");
    o = bindir+strlen(bindir);

Is DirName doing what it is supposed to do?

Yes. We should either comment CondaWindows.cmake, rename it or just copy activating the relative home as I don’t like a file that is explicitly named to configure things for Conda to get used for MSYS. Sooner or later that will go wrong :frowning: . That is step 2.

Some quick tests tell me this is not an issue. Possibly bash passes argv[0] in different notation than the Windows cmd.exe?

DirName() is fine, but it expects symbols to be in Prolog (/) notation. That is not the case. Now, there are various paths that lead to computing symbols. I suspect that findExecutable() in pl-nt.c requires a translation to a Prolog path after the _xos_long_file_name_toA() call.