Ann: SWI-Prolog 9.3.10

Dear SWI-Prolog user,

SWI-Prolog 9.3.10 is ready for download. It is a rather quick release
that reverts the removed loading of files relative to CWD, restoring
the old behaviour as deprecated feature. It also fixes a couple of
serious bugs (affecting few users though). The (xpce) GUI has now
pretty extensive support for hi-res displays under X11 that should run
out-of-the-box on configurations that properly report the physical
layout using the Xrandr extension. Unfortunately that is not always
the case. Users can overrule the detected DPI in
~/.config/swi-prolog/xpce/Defaults using a line (here telling the
display is 200DPI). The system uses some heuristics to see whether
the reported physical size makes sense and sets the dpi to 100 if
not.

display.dpi: 200

Enjoy --- Jan

SWI-Prolog Changelog since version 9.3.9

  • DEPRECATED: file search from a source file relative to CWD Searching
    relative to CWD when loading a source file was supported up to
    version 9.3.8. 9.3.9 disabled this, but the implications appear
    too severe. This patch re-enables the old behaviour with a warning.
    The Prolog flag source_search_working_directory can be set to
    false to disable searching the working directory.

  • FIXED: possibly early GC of arguments for call_cleanup/2 Also affects
    '$bags':cleanup_bag/2. The early GC can happen if a signal arrives
    when these predicates are being called and the signal handler calls GC.

  • FIXED: use_module(M, [Pred as Alias]) for meta-predicates

Package clib

  • PORT: Added library(uuid) to WASM version

  • ADDED: is_uuid/1 to test that an atom is a valid UUID

Package http

  • FIXED: http_open/3 using keep-alive connections When multiple threads
    are connecting to the same host, it may give the same connection to
    multiple threads if a connection was already closed by the peer.

  • FIXED: http_open/3 using Keep-alive This lead to errors if the number
    of cached connections was exceeded (fixed). The library now defines
    the cache parameters as settings, such that applications can change
    them.

Package pengines

  • FIZED: pass SSL Options when destroying pengines

  • FIXED: pass SSL options (such as client certificate) to probe.
    Needed to make pengines work in a 2-way SSL setup.

Package xpce

  • PORT: Be more critical on the reported physical dimensions of the
    screen.

  • SCALE: Scale stepper/combobox indicator for class text_item
    and related.

  • SCALE: Properly scale caret in class text and text_item.

  • SCALE: Several dimensions concerning widgets

  • SCALE: Make GUI tracer margin scale with bitmaps.

  • SCALE: Wrong default for image.scale Using display<-size
    rather than display<-dpi

  • ENHANCED: Use Xrandr extension to get DPI resolution of the display
    This seems to provide more reliable results.

  • SCALE: Specify default arrow dimensions in mm rather than px.

  • FIXED: Compute the GUI tracer stack layout based on the font.

  • FIXED: Compute thread-monitor dimensions based on the font

  • FIXED: Make sure image<-size of built-in images respect the scale

  • FIXED: #34 Allow for @display?dpi if there is no display. This notably
    allows for building xpce when there is no DISPLAY.

  • MODIFIED: Default scale for fonts and images now depends on DPI This
    implies that one should get a reasonable default if the X server
    provides the right DPI value. If not, setting e.g.

     display.dpi: 200
    

    in Defaults may be used. Subsequently, font.scale and/or image.scale
    may be used to fine tune the sizes.

2 Likes

In version 9.3.10, spy/1 does not work on macOS 14/ (15 beta). I use mainly ediprolog mode for swi-prolog on Gnu emacs (with Xquarz), have poor knowledge on X and am reluctant
to go into details on setting X-window-like environment.

% swipl --version
SWI-Prolog version 9.3.10 for x86_64-darwin

% swipl    
Welcome to SWI-Prolog (threaded, 64 bits, version 9.3.10-4-g0009ca51f)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

I have found spy/2 works on M1 macbook pro, but not on imac intel (2020)

% ?- spy(...).
%@ [PCE fatal: @display/display: Failed to connect to X-server at `/private/tmp/com.apple.launchd.MzrhT3idUV/org.xquartz:0': malformed DISPLAY address: /private/tmp/com.apple.launchd.MzrhT3idUV/org.xquartz:0
%@ *********************************************************************
%@ * You MUST be running the X11 Windowing environment.  If you are,   *
%@ * check the setting of your DISPLAY environment variable as well    *
%@ * the access rights to your X11 server.  See xauth(1) and xhost(1). *
%@ *********************************************************************

<snip>

Is there a simple way for spy/1 to work as before ? Thanks in advance.

It means XQuartz, the Mac X11 implementation is not properly working. XQuartz is a bit of a nuisance :frowning: It sometimes helps to open it explicitly, at least for me. You have to search there though. Prolog can’t do anything about this.

… except if there is someone willing to write a native MacOS binding for xpce, so we can bypass XQuartz. With good knowledge on how to access MacOS native graphics from C it is not a very big deal. It mostly implies implementing about 150 mostly tiny C functions to do things like “create a Window”, “draw a line”, etc.

1 Like

On iMac intel, swipl spy/2 works with terminal, but not in Emacs.app. No problem with M1 macbook pro and M2 mac mini as usual. I have no idea how to bind swipl with Xquartz in Emacs but I would take it an occasion for me to take time to learn it.

If it works in one setup, use ?- getenv('DISPLAY', D). to find the working value. Next, add

:- setenv('DISPLAY', <value>).

to your init.pl file. No guarantees, but it sometimes helps. I’m always a bit unsure where MacOS apps get environment variables. Neither do I know how XQuartz passes the information to apps where the connection can be found.

BINGO ! Thanks for the simple solution.