Ann: SWI-Prolog 8.5.18

Dear SWI-Prolog user,

SWI-Prolog 8.5.18 is ready for download. Quite a few things happened.

  • @oskardrums “sweep” Prolog mode is now bundled, which should make
    it easy to obtain the shared object that is required for running
    this nice Emacs mode.

  • @j4n_bur53’s comments and @ridgeworks implementation work brought
    correct rounding and fast big integer and rational support to
    floats.

  • @peter.ludemann’s work on a new C++ interface is now included as
    SWI-cpp2.h. It is much more comprehensive and avoids many of the
    pitfalls of the old SWI-cpp.h. Unfortuantely there are still
    some problems with it. Notably we would like to see issues around
    character encodings settled. Still, if you start a new C++ project
    this should be your starting point. Porting old C++ projects is
    a good way to become future proof and evaluate the new interface.

  • Quite a few extensions to the WASM version. The basic interfaces
    should be close to stable.

  • @swi allowed help/1 to work on your own annotated predicates.

    Enjoy — Jan

SWI-Prolog Changelog since version 8.5.17

  • WASM: Do not use undocumented interfaces in test/demo.

  • WASM: Issue#1052: make output of Prolog.query().once() easier to
    handle.

  • FIXED: help/1 for normal built-in predicates (broke after support
    for user predicates). Patch by @swi.

  • ADDED: Colour test/1 and test/2 heads and classify them as tests when
    inside a unit test body.

  • ADDED: library(prolog_xref): Make aware of unit tests

  • ADDED: Allow help/1 on user predicates. Contributed by @swi

  • ADDED: make_reload_file/1 to make correct reloading of a file public.

  • TEST: Add additional float rounding test cases for various integer
    sub-types.

  • ENHANCED: New (faster) function for converting bigints (MPZ) to float
    Also includes minor adjustments for some mpz_fdiv rounding modes.

  • DOC: Fixed LaTeX errors

  • ENHANCED: Replace mpz_fdiv() with a version that rounds to nearest.

  • CLEANUP: Introduce mpz_to_double()

  • FIXED: Added missing import for pi_head/2 in library(prolog_xref).

  • PORT: swipl --abi-version: VM signature hash depended on big/little
    endian.

  • ADDED: PL_atom_mbchars() to extract text from an atom in various
    encodings.

  • ADDED: PL_cvt_i_[u]int32() for consistency.

  • PORT: Avoid false alarm warning from gcc on 32-bit Windows.

  • PORT: Windows: fixed compilation of the DDE interface after adding
    FUNCTOR_error1 to the core system.

  • FIXED: Instantiation error in cross-referencer.

  • FIXED: xref_source/1: avoid lazy definition of predicates in user
    by calling predicate_property(user:Goal, ...).

  • FIXED: prolog_set_IO/3: stderr wrapper interpreted return code from
    low-level output wrong. This causes problems if output is connected
    to a socket as used by prolog_server/2.

  • ENHANCED: Make toplevel quit nicely if the I/O streams are in error
    state.

  • ADDED: stream_property(S, error(Boolean)).

  • PORT: Msys2, fix LibDir for swipl in build env

  • ADDED: sweep package - integration with GNU Emacs

  • FIXED: Windows: directory_files/2 and other directory access for
    long paths. Fixed by @mgondan1. Thanks!

  • ENHANCED: portray_clause/1: add space after (?- goal).

  • WASM: Avoid error on HTMLCollection on node

  • FIXED: Windows: long file support was broken again.

  • FIXED: Handle reexport/1 and reexport/2 properly in multi-file
    .qlf files. Reported by @swi.

  • DOC: syntax error handling in conditional compilation.

  • ENHANCED: ^ and ** arithmetic operator optimization for small integer
    use cases to avoid relying on GMP. This patch also uses integer
    exponentiation when compiled without GMP when possible and handles
    all special cases compatible with the GMP based version.

  • ENHANCED: Use __builtin_mul_overflow() when available to do fast
    overflow-safe multiplication.

  • TEST: Silence syntax error on a rational number when compiled without
    rational support.

  • MODIFIED: When inside code fragment under conditional compilation
    where the code is ignored, do not report syntax errors.

  • WASM: Added CHAT80 demo.

  • FIXED: Prolog.Compound.toJSON()

  • WASM: Avoid dependency on HTMLCollection to run on node.

  • MODIFIED: WASM: Prolog.consult() now calls load_files/1, allowing it
    to handle a mixture of local files, URLs as well as Prolog sources
    and .qlf files. The sources are now processed sequentially and
    are no longer materialised as files.

  • DOC: Improved WASM documentation.

  • ADD: License to CBG Chords example

  • ADDED: qcompile/2: option include(user). This option allows for
    compiling an application into a single Prolog .qlf file.

  • ADDED: load_files/2: option if(Cond) is extended with exists to
    silently not load a file if it does not exist.

  • FIXED: det/1 was not declared as a proper meta-predicate.

  • WASM: Allow translation of JavaScript ArrayBuffer into a Prolog
    byte-string. This allows extracting binary data from Response.blob()
    and is used by the WASM compilation hook to allow loading .qlf
    files from URLs.

  • BUILD: Allow building with AddressSanitizer on Clang. Based on
    patches by Alessandro Bartolucci. Thanks!

Package clib

  • ENHANCED: prolog_server/2: ensure the server thread terminates,
    also if the client disappears with an error. Improved docs.

Package cpp

  • TEST: Remove .as_string.c_str() as this is unsafe.

  • DOC: Document both version 1 and version 2.

  • DOC: Setup for documenting both SWI-cpp.h and SWI-cpp2.h

  • ENHANCED: added PlTerm::record(), PlTerm::write(), PlTerm_recorded,
    PlRewindOnFail(), PlStringBuffers Removed PlTerm::unify_check()
    Added example code for backtracking predicate that gets info on int
    types Fixing integer overloading for win32, MacOS - remove many of the
    overloaded methods and instead use names derived from the underlying
    SWI-Prolog PL_put
    () and PL_unify*()

  • DOC: Added a porting section

  • PORT: Make SWI-cpp2.h compile on systems where long int is 32 bits
    (Win64). Patch by Peter Ludemann.

  • CLEANUP: better reuse of Prolog exceptions.

  • ENHANCED: Version 2 of C++ interface - removed some implicit
    conversions and constructors whose use can cause subtle bugs -
    made most conversions and constructors explicit - added subclass
    constructors to make Prolog types explicit and avoid some subtle bugs

    • added copy constructors, assignment operators - renamed handle_,
      ref_ to C_, for simplified “getter/setter” - added PlCheck() for
      easier calling of SWI-Prolog.h functions - removed conversion
      (cast) operator - added pseudo-exception PlFail for returning
      failure from a PREDICATE - also used by the unify_XXX_ex() methods -
      deprecated assignment operator for term unification - replaced by
      unify_XXX() and unify_XXX_ex() methods - added some support for
      std::string, std::wstring - and additional support for wchar_t -
      added some more methods that allow using PlTerm:xxx(…) instead of
      PL_xxx(t.get_term_t(), …); also for PlAtom - added PlTerm::type(),
      PlTerm::is_variable(), etc. methods - moved atom_t handle into private
      PlAtom, term_t into private PlTerm - added get_atom_t(), get_term_t() -
      added verify(), is_valid(), reset() methods - some refactoring, e.g.,
      PlTerm::check(), PlTerm::null - refactored the integer “getters”
      to get around problems with C++ built-in conversions and integer
      promotion. - refactored comparison methods, added PlTerm::compare() -
      replaced “int” as return type by “bool” in many places - use common
      C++ naming practice for class fields (suffixed by “_”) - added unit
      tests - moved examples from test.cpp to unit tests file (cpp4pl.cpp,
      test_cpp.pl) - used C++ initializer lists where possible - added
      [[nodiscard]] to many methods - added [[deprecated]] to some methods -
      (internal: used a template class to handle some boilerplate)

Package http

  • FIXED: term//2 from library(http/term_html) left a choicepoint.

Package semweb

  • DOC: Fixed LaTeX errors.

Package xpce

  • ENHANCED: PceEmacs: properties of predicates in status line (better
    text and ignore more irrelevant).

  • ADDED: pce_xref_gui:gxref_called/2 hook into gxref/0 to allow silencing
    predicates that are called by means of hooks or some other mechanism.

  • FIXED: gxref/0: edit predicate on click to properly handling included
    files.

  • PORT: suppress uninitialized warning in msys2 gcc

  • PORT: msys2-compatible mkdir and wildcards

4 Likes