From d0bba305646edb9c5353f711fd384a4d0a1307c4 Mon Sep 17 00:00:00 2001 From: Arvid Norlander Date: Thu, 10 Jun 2021 10:22:35 +0200 Subject: [PATCH 1/2] Fixes for changed constants. New values correct as of SWIPL 8.2.4. According to git history the change was done for SWI-Prolog 8.1.22. This partially fixes #124. --- pyswip/core.py | 59 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/pyswip/core.py b/pyswip/core.py index 770b0ee..59e5761 100644 --- a/pyswip/core.py +++ b/pyswip/core.py @@ -755,23 +755,48 @@ def check_and_call(*args): # * CHAR BUFFERS * # *******************************/ -CVT_ATOM = 0x0001 -CVT_STRING = 0x0002 -CVT_LIST = 0x0004 -CVT_INTEGER = 0x0008 -CVT_FLOAT = 0x0010 -CVT_VARIABLE = 0x0020 -CVT_NUMBER = CVT_INTEGER | CVT_FLOAT -CVT_ATOMIC = CVT_NUMBER | CVT_ATOM | CVT_STRING -CVT_WRITE = 0x0040 # as of version 3.2.10 -CVT_ALL = CVT_ATOMIC | CVT_LIST -CVT_MASK = 0x00ff - -BUF_DISCARDABLE = 0x0000 -BUF_RING = 0x0100 -BUF_MALLOC = 0x0200 - -CVT_EXCEPTION = 0x10000 # throw exception on error +# Changed in 8.1.22 +if PL_VERSION < 80122: + CVT_ATOM = 0x0001 + CVT_STRING = 0x0002 + CVT_LIST = 0x0004 + CVT_INTEGER = 0x0008 + CVT_FLOAT = 0x0010 + CVT_VARIABLE = 0x0020 + CVT_NUMBER = CVT_INTEGER | CVT_FLOAT + CVT_ATOMIC = CVT_NUMBER | CVT_ATOM | CVT_STRING + CVT_WRITE = 0x0040 # as of version 3.2.10 + CVT_ALL = CVT_ATOMIC | CVT_LIST + CVT_MASK = 0x00ff + + BUF_DISCARDABLE = 0x0000 + BUF_RING = 0x0100 + BUF_MALLOC = 0x0200 + + CVT_EXCEPTION = 0x10000 # throw exception on error +else: + CVT_ATOM = 0x00000001 + CVT_STRING = 0x00000002 + CVT_LIST = 0x00000004 + CVT_INTEGER = 0x00000008 + CVT_RATIONAL = 0x00000010 + CVT_FLOAT = 0x00000020 + CVT_VARIABLE = 0x00000040 + CVT_NUMBER = CVT_RATIONAL | CVT_FLOAT + CVT_ATOMIC = CVT_NUMBER | CVT_ATOM | CVT_STRING + CVT_WRITE = 0x00000080 + CVT_WRITE_CANONICAL = 0x00000080 + CVT_WRITEQ = 0x000000C0 + CVT_ALL = CVT_ATOMIC | CVT_LIST + CVT_MASK = 0x00000fff + + BUF_DISCARDABLE = 0x00000000 + BUF_STACK = 0x00010000 + BUF_RING = BUF_STACK + BUF_MALLOC = 0x00020000 + BUF_ALLOW_STACK = 0x00040000 + + CVT_EXCEPTION = 0x00001000 # throw exception on error From 1b447805387719a0de438d82829931b751ebaa28 Mon Sep 17 00:00:00 2001 From: Arvid Norlander Date: Wed, 1 Sep 2021 14:44:32 +0200 Subject: [PATCH 2/2] Update CONTRIBUTORS.txt as requested. --- CONTRIBUTORS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 26427f7..2ed813c 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -25,3 +25,4 @@ Dylan Lukes Guglielmo Gemignani Vince Jankovics Tobias Grubenmann +Arvid Norlander