Ann: SWI-Prolog 9.3.16

Dear SWI-Prolog user,

SWI-Prolog 9.3.16 is ready for download. This version fixes some
important bugs and provides one new library. Highlights:

  • WASM for(v of Query) and variants lost the last solution due to
    a bug in the JavaScript iterator implementation.
  • Fixed phrase_from_file/2 for UTF-16 files containing
    surrogate pairs on Windows.
  • Improved support for ==> SSU DCG rules: mark predicate as
    non_terminal and provide basic support for the GUI debugger.
  • An experimental library exceptions allows for defining exception
    types and catching based on type rather than unification. See
    catch/4 in this library. Comments welcome!
  • Changed search for the Prolog home to consider the ABI version
    info and provide better feedback if the search fails. This should
    notably simplify embedding SWI-Prolog if you have multiple SWI-Prolog
    installations on your system.
  • Avoid Emscripten (WASM) deprecated functions.
  • Fix test failures for prolog_in_java tests when the build system
    has multiple copies of junit[4].jar in places we look for it.

Enjoy — Jan

P.s. We are approaching 1,000 :star:s on Github. Starring the repo is
simplest thing you can do to help the system. We also got
new donations. Thanks!

SWI-Prolog Changelog since version 9.3.15

  • ENHANCED: gui tracer support for Head ==> Body rules.

  • ENHANCED: Set non_terminal property for clauses for Head ==> Body

  • WASM: Include ABI file to make the home search work.

  • FIXED: New home search to actually try the compiled in value.

  • ENHANCED: Verify sanity of the Prolog home directory This patch
    validates that the home directory contains a file ABI holding the
    ABI information and compares this. On failure, it reports a detailed
    report on why Prolog could not find its home directory.

  • FIXED: explain/1 to report the same predicate multiple times.
    This happens if the predicate is imported into multiple modules.

  • ADDED: library(exceptions) This library provides catch/4 and error/2
    to define error types and catch based on types rather than unification.
    Experimental.

  • PORT: read_pending_input/3 and friends: make 16 bit encodings work
    on Windows.

  • FIXED: Pass command line arguments in class Prolog.

  • DOC: gcd/2 and lcm/2 are not operators.

  • ADDED: Prolog flag unknown_option with values {ignore,warning,error}.
    As a result of PIP-105. May change, but unlikely as their was clear
    agreement.

    This flag disables the iso flag from reporting errors on unknown
    options
    because this breaks large parts of SWI-Prolog’s libraries. The user
    can
    now explicitly enable this as well as make the system pring warnings to
    investigate possible issues.

  • FIXED: Use of undefined options in the toplevel. This makes the
    toplevel unusable if the Prolog flag iso is set to true.

  • PORT: WASM: Get rid of deprecated allocate, ALLOC_NORMAL and
    ALLOC_STACK

  • FIXED: WASM: Query.next() to set done to true on last answer.
    This must be false when used as iterator.

  • ENHANCED: Allow suppressing autoload warnings.

  • TEST: Move test_rwlocks.pl from library to thread test dir.
    This test should not run in the single threaded version.

  • FIXED: WASM: for(x of prolog.query(…)) lost last answer

Package http

  • DOC: Fixed example code for apropos with HTML output.

Package jpl

  • TEST: #104 prolog_in_java test fails if multiple copies of junit*.jar
    are found. Now first search for junit4.jar. On success, use first,
    else search for junit.jar. On success, use first.

  • TEST: Cache JUNIT_JAR in CMake. This provides better cmake performance
    and easier inspecting the configuration result.

Package swipy

  • BUILD: Honour environment variable SWIPL for pip install .

  • DOC: Document creating the Windows binary wheel in scripts/README.md

3 Likes

With CC="gcc (or clang) -std=gnu23" cmake .., I get a compiler error.

.../src/pl-prof.c:289:23: error: incompatible function pointer types passing 'void (int)' to parameter of type 'handler_t' (aka 'int (*)(int)') [-Wincompatible-function-pointer-types]
  289 |   set_sighandler(sig, sig_profile);
      |                       ^~~~~~~~~~~
.../src/pl-setup.h:62:45: note: passing argument to parameter 'func' here
   62 | handler_t       set_sighandler(int sig, handler_t func);

I tried to fix it with CC="gcc -std=gnu23" cmake -DCMAKE_C_STANDARD=23 -DCMAKE_C_EXTENSIONS=ON .., but that doesn’t help. Am I missing something?

PS. The problem is not specific to 9.3.16, was just recently reported by the R people.

I see. The cmake test whether the return type of a signal handler is void or int was broken for c23. Fixed.

I don’t know whether this test still makes sense as void is the standard return type for signal handlers for a long time. Similar considerations apply to quite a few tests. They are there because at some point in the past they were needed. Fortunately standardization has progressed :slight_smile:

Removing simplifies the code base, but at the risk of making mistakes and discontinued support for old platforms :frowning:

1 Like

Thank you, problem solved

https://cran.r-project.org/web/checks/check_results_rswipl.html

Just saw some errors in my console that make is seem like something has been compiled to expect swipl is running in your personal “jan” directory:

Warning: [Thread pce] The predicates below are not defined. If these are defined
Warning: [Thread pce] at runtime using assert/1, use :- dynamic Name/Arity.
Warning: [Thread pce] 
Warning: [Thread pce] '$bags':'$call_cleanup'/0, which is referenced by
Warning: [Thread pce] 	/Users/jan/src/swipl-devel/build.macosx-fat/home/boot/bags.pl:104: 1-st clause of '$bags':cleanup_bag/2
Warning: [Thread pce] '$messages':win_get_user_preferred_ui_languages/2, which is referenced by
Warning: [Thread pce] 	/Users/jan/src/swipl-devel/build.macosx-fat/home/boot/messages.pl:1947: 1-st clause of '$messages':os_user_lang/1
Warning: [Thread pce] '$toplevel':win_registry_get_value/3, which is referenced by
Warning: [Thread pce] 	/Users/jan/src/swipl-devel/build.macosx-fat/home/boot/toplevel.pl:529: 1-st clause of '$toplevel':'$set_prolog_file_extension'/0
Warning: [Thread pce] qsave:qsave_toplevel/0, which is referenced by
Warning: [Thread pce] 	/Users/jan/src/swipl-devel/build.macosx-fat/home/boot/toplevel.pl:914: 1-st clause of '$toplevel':'$compile_'/0

Hmm. The paths from which the compiled files are loaded still seem to be there. That is a little odd as I think they should normally be updated at load time to the actual sources. It is in any case harmless.

How did you get these messages though?

I get the same if I just start swipl and run

?- make.

This happens only on Mac OS, after building from source

Just downloaded 9.3.16 for Windows. The problem shows up here, as well:

?- make.
Warning: The predicates below are not defined. If these are defined
Warning: at runtime using assert/1, use :- dynamic Name/Arity.
Warning: 
Warning: '$bags':'$call_cleanup'/0, which is referenced by
Warning:        z:/home/swipl/src/swipl-devel/build.win64/home/boot/bags.pl:104: 1-st clause of '$bags':cleanup_bag/2
Warning: qsave:qsave_toplevel/0, which is referenced by
Warning:        z:/home/swipl/src/swipl-devel/build.win64/home/boot/toplevel.pl:914: 1-st clause of '$toplevel':'$compile_'/0
true.

I can confirm both. Odd. Will check.

Ok. Fixed. Turns out to be a build ordering issue related to the new ABI compatibility check.