# Ann: SWI-Prolog 9.1.14

**URL:** <https://swi-prolog.discourse.group/t/ann-swi-prolog-9-1-14/6770>\
**Category:** Releases\
**Created:** [August 14, 2023, 1:59pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-1-14/6770 "2023-08-14T13:59:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [August 14, 2023, 1:59pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-1-14/6770/1 "2023-08-14T13:59:20Z")

</div>

Dear SWI-Prolog user,

I have uploaded SWI-Prolog 9.1.14. This release updates the C++  
and Python interfaces improves embedding on ELF based systems  
and fixes some minor issues. Highlights

- Janus (the Python interface) has received several incompatible  
changes that resulted from synchornizing the API with XSB. The  
main reason for this fast re-release is to reduce confusion  
due to outdated documentation on the website as well as to  
reduce get the (almost) stable API out as quickly as possible.

- @peter.ludemann pushed various updated to the C++ interface.  
SWI-cpp2 is getting pretty stable.

- Recent patches caused tty\_size/2 to be unavailable in several  
versions.

- The bundled packages did not hide internal symbols on ELF  
systems, making them vulnerable to name conflicts if  
SWI-Prolog is embedded. This work also supports all  
glibc flags for dlopen(), providing more control over  
shared objects (be it largely non-portable). This showed  
up with the sweep interface for GNU-Emacs. Thanks to  
@oskardrums for analyzing and testing.

- Updated sweep to the latest version.

# SWI-Prolog Changelog since version 9.1.13

- 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

## Package clib

- FIXED: Export install function from `hashstream.so`

## Package cpp

- 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

## Package ltx2htm

- ENHANCED: Use more Unicode characters for math commands.

## Package sgml

- FIXED: Race condition in dtd\_property/2 Can lead to Domain error:  
dtd\_property’ expected, found entities(\_37838)’

## Package sweep

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

- DOC: Extend the “Overview” manual section \* [README.org](http://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.

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

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

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

- 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](http://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.

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

## Package swipy

- FIXED: janus.Query(): properly handle exceptions.

- ADDED: Allow compiling a Python string and compile into a module.

- MODIFIED: Renamed installed module to `janus_swi`

- COMPAT: added is\_py\_object/1, renamed add\_py\_libdir/1,2 to  
py\_add\_libdir/1,2

- FIXED: Several issues wrt Python reference counts.

- COMPAT: Use @true, @false and @none for the Python constants.

- COMPAT: Functor for PyTuples in Prolog changed to -/N Decided in Zoom  
call August 11.

- FIXED: Wrong return code (ignoring error)

- FIXED: Memory leak in py\_iter/2,3

- MAINTENANCE: Use debug version of Python when enabling asan.

- FIXED: PyEval\_GetBuiltins() returns a borrowed reference Decrementing  
destroys the builtins …

- FIXED: We should not Py\_DECREF the output of PyErr\_Fetch()

- FIXED: the output of PyUnicode\_AsUTF8AndSize() disappears with the  
object ` __name__ ` seems to generate a new PyObject and thus we must  
use the UTF-8 string before decrementing the reference count for the  
PyObject \*name.

- PORT: CMake option() is only boolean.

- PORT: Allow asking for a Python version Use cmake  
`-DCPYTHON_VERSION=3.11` or `-DCPYTHON_VERSION=3.11;EXACT`.

- TEST: Port XSB Janus tests

- TEST: Imported tests from XSB

- ENHANCED: Connect Python console I/O to Prolog’s when rebound.

- FIXED: Return empty tuple as :().

- ENHANCED: Various fixes, allow passing arbitrary Prolog terms,  
docs This is a elaborative commit that introduces janus.Term to  
represent arbitrary Prolog terms, represents Prolog exceptions using  
janus.PrologError which uses janus.Term for storing the exception term.

- ENHANCED: Error handling for calls from Python to Prolog. Introduce a  
class janus.PrologError to represent the errors. This patch also  
changes the representation and printing of Python errors.

- PORT: py\_run(“from janus import \*”) requires Python \>= 3.10 This  
patch ensure the shell is still started and prints a message.

- TEST: Avoid running tests using := in \< 3.8 versions of Python.

## Package xpce

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

---

<div class="post-metadata">

**Author:** ![joseph-vidal-rosset](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/joseph-vidal-rosset/32/2594_2.png) [@joseph-vidal-rosset](https://swi-prolog.discourse.group/u/joseph-vidal-rosset)\
**Post date:** [August 22, 2023, 8:49am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-1-14/6770/2 "2023-08-22T08:49:13Z")

</div>

Hi Jan, I met difficulties to compile this version and the cause is cmake. I had to install it manually, but fnallly it did not work correctly:

> make[2]: \*\*\* Aucune règle pour fabriquer la cible « home/library/\_\_INDEX.pl », nécessaire pour « src/CMakeFiles/library\_index\_library\_always ». Arrêt.  
> make[1]: \*\*\* [CMakeFiles/Makefile2:1908 : src/CMakeFiles/library\_index\_library\_always.dir/all] Erreur 2  
> make: \*\*\* [Makefile:166 : all] Erreur 2

I believe that the best for Debian 12 would be to work with cmake Debian package, but the previous manual installation produced also a cache error. I am lost…

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [August 22, 2023, 9:29am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-1-14/6770/3 "2023-08-22T09:29:33Z")

</div>

> [@joseph-vidal-rosset](#):
>
> make[2]: \*\*\* Aucune règle pour fabriquer la cible « home/library/\_\_INDEX.pl », nécessaire pour « src/CMakeFiles/library\_index\_library\_always ». Arrêt.

Thanks for reporting.

Ah, commit bb091d081615c3fecb10f132db457d10887e1390 was added to work around warnings using Microsoft Visual C++ projects. It works fine, but only using Ninja or MSVC. So, either use `-G Ninja` to Cmake or revert the above commit.

I’ll see whether I can find an elegant work around.

**edit** Pushed 0ec564164a6af1d045f30a46d6931eebcf523015 to address this.

---

<div class="post-metadata">

**Author:** ![joseph-vidal-rosset](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/joseph-vidal-rosset/32/2594_2.png) [@joseph-vidal-rosset](https://swi-prolog.discourse.group/u/joseph-vidal-rosset)\
**Post date:** [August 23, 2023, 1:46pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-1-14/6770/4 "2023-08-23T13:46:24Z")

</div>

Hello Jan,

> I’ll see whether I can find an elegant work around.

I presume that’s what you did, because it works now:

```prolog
joseph@mx:/usr/local/swipl-devel$ swipl --version
SWI-Prolog version 9.1.14 for x86_64-linux

```

Again, many thanks for SWI-Prolog ! 👍
