Dear SWI-Prolog user,
SWI-Prolog 9.3.36 is ready for download. This is the final
pre-release for 10.0.0. If nothing turns up with the distribution,
version 10.0.0 will be released tomorrow.
There are still quite a few changes, trying to avoid the need for the
new development series to deviate immediately. Highlights
Core
- Resolved several saved-state issues, mostly by @mgondan1
- Implemented several PIP proposals related to write_term/2.
Notable addedmax_text(+Length)to truncate
long atoms and strings similarly tomax_depth(+Depth)and
a new optiontruncated(-Bool)that indicates whether one
of these options caused the printed term to be truncated.
The new PIP-0105 optionportable(true)is likeignore_ops(true),
but writes lists and brace-terms normally and preserves the,
operator. As the,operator cannot be redefined, this results
in more readable terms that can be read in any context regardless
of the operator definitions. - Fixed deadlock in with_tty_raw/1.
- Fixed crash related to undo/1.
JSON
- MODIFIED
json_read_dict/2,3now returns JSON objects
as Prolog dicts using the anonymous tag#rather than
a variable tag. - Added libraries for JSON-RPC, both client, server and full
duplex modes are supported.
XPCE
- Various changes to accommodate LSP (Language Server Protocol)
in PceEmacs. This notably adds extracting incremental change
data from the editor such that we can keep an LSP server in sync
efficiently. In addition, several methods have been added to
to translate efficiently between LSP positions as 0-based line- UTF-16 character positions inside the line and Emacs view of
a file as an array of Unicode points.
- UTF-16 character positions inside the line and Emacs view of
- Various extensions to class
syntax_table, supporting efficient
highlighting of comments, strings and keywords.
The XPCE and JSON enhancements have been used to implement a prototype
C mode based on the clangd LSP server, currently only supporting
semantic highlighting and find-definition. This is currently a
proof of concept to validate basic LSP integration. If you want to play with this LSP integration, install this C mode as follows:
cd ~/.config/swi-prolog/xpce
git clone https://github.com/JanWielemaker/my-pceemacs-lib.git emacs
Next, make sure clangd is installed and edit a .c file using PceEmacs.
Enjoy --- Jan
SWI-Prolog Changelog since version 9.3.35
-
PORT: Support older gcc and clang versions that do not provide
__auto_type -
ENHANCED: On ELF systems that have
objcopy, add the state as an
ELF section. This makes the system a valid ELF executable on which
all ELF tools work normally. -
ADDED: qsave_program/2: option zip(true) to create a clean .zip file.
-
FIXED: #1414 crash in C_CUT due to reset clause pointer from undo/1.
-
MODIFIED: PIP-0105: write_term/2 option
max_textto exclude ellipsis.
As we already exclude the quotes and escape sequences, excluding the
ellipsis is more consistent. After remarks by Joachim Schimpf. -
FIXED: #1411 Windows issue for handling max_text on UTF-16 pairs.
-
TEST: Relax thread queue timeout tests and provide more accurate
failure feedback. -
FIXED: Save history for new directory using
swipl-win -
ENHANCED: On (Linux/Unix) systems with hot-pluggable CPU or running as
virtual machines, the cpu_count Prolog flag should be set to the number
of online processors (SC_NPROCESSORS_ONLN) instead of the configured
maximum number (SC_NPROCESSORS_CONF). Using the online count avoids
situations where cpu_count reflects offline or non-present CPUs. If
SC_NPROCESSORS_ONLN is not defined by the system, we fall back to
the old SWI-Prolog behaviour. -
BUILD: show options in generated file
-
MODIFIED: write_term/2:
max_depth(+Depth)to use Unicode…
If the encoding of the output supports Unicode. Otherwise the ASCII
sequence...is emitted. -
ADDED: write_term/2: support max_text(+Length) for quoted output.
-
ADDED: PIP-0105: write_term/2 support for
max_text(+Length)Actually
calledtext_maxin the proposal. Considering all other options
and flags are namedmax_*, I think this should change.This commit only implements this option for unquoted atoms and strings.
-
FIXED: with_tty_raw/1: kept lock on stream.
-
ADDED: PIP-0105:
write_term/2optiontruncated(-Bool). Bool
is unified totrueif the term has been truncated due to the
max_depthoption. -
ADDED: PIP-0105
write_term/2optionportable(Bool) -
DOC: Update CMAKE.md, section components
-
TEST: saved_states, disable timeout under MSYS2 (#1406) * TEST:
saved_states, disable timeout under WindowsOn Windows, stream timeout only works for sockets. * DIST: Added
packages/libedit/libedit to tar archive
Package cpp
- FIXED: compiler warnings for print formats
Package http
- TEST: Updated for modified json_read_dict/2 using
#as anonymous tag.
Package json
-
FIXED: Clean exit from client thread on end-of-file When using
header(true), EOF resulted in a warning that the thread died
on failure. -
ADDED: Allow a JSON RPC client to also act as server on the same
connection. This is allowed by the spec and used by the LSP (Language
Server Protocol). A new predicate json_full_duplex/2 can be used to
add server functionality to a client connection. -
FIXED: Server side positional vs named parameters
-
MODIFIED: Calling conventions for json_call/4 and json_notify/3.
Clarify and fix distinguishing named from positional parameters. -
ADDED: library(json_rpc_client): header(true) option
-
DOC: Dynamic dict
-
ADDED: library(json_rpc_client) and library(json_rpc_server).
-
MODIFIED: The default tag for json_read_dict/2,3 is now
#This
used to be a variable. Following discussion about dicts in the PIP
meetings, this is part of getting rid of unbound tags and use#
as anonymous (dynamic) dict.
Package xpce
-
ADDED: PceEmacs C-mode: declaration of keywords.
-
ADDED:
syntax_table->keywordsto register known keywords for
a syntax -
MODIFIED: Generalised
text_buffer->for_all_commentsReplaced by
text_buffer->for_all_syntax, which qualifies additional syntax
types. Currently only quoted material. -
ADDED: Support for multi-character line comment lead-in (e.g. //
comment) -
MODIFIED:
syntax_table->prolog: boolreplaced by
syntax_table->language -
ADDED: `text_buffer<-lsp_offset(line,character) → offset Translate
position in LSP notation to an offset. -
ADDED:
text_buffer<-lsp_columnProduces thecharacterfield
of an LSP range start/end. This is the position inside the line in
UTF-16 code points. -
ENHANCED:
editor->align_lineto avoid modifications if alignment
is already satisfied. -
FIXED: text_buffer->insert not to set modified if we insert 0 times.
-
ADDED: PceEmacs: M-x idle-timeout seconds Sets the time we wait before
re-running semantic highlighting. -
ADDED: PceEmacs: hooks to allow syncing to an LSP server
-
ADDED: Class
text_bufferto allow forwarding changes incrementally
This implements methods to generate LSP (Language Server Protocol)
compatible incremental change events. The basic method is
text_buffer<-lsp_changes, which returns a chain oftext_change
objects that provide the changed range and replacement text.