ppisar pushed to perl-Language-Prolog-Yaswi (master). "Adjust list parsing to SWI Prolog 7"

notifications at fedoraproject.org notifications at fedoraproject.org
Tue Jun 9 12:53:50 UTC 2015


From 06ff64a31af4ee08e3e4d19df0784dbaa342fd29 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
Date: Tue, 9 Jun 2015 14:42:44 +0200
Subject: Adjust list parsing to SWI Prolog 7


diff --git a/Language-Prolog-Yaswi-0.21-Adjust-list-parsing-to-SWI-Prolog-7.patch b/Language-Prolog-Yaswi-0.21-Adjust-list-parsing-to-SWI-Prolog-7.patch
new file mode 100644
index 0000000..946f2cd
--- /dev/null
+++ b/Language-Prolog-Yaswi-0.21-Adjust-list-parsing-to-SWI-Prolog-7.patch
@@ -0,0 +1,84 @@
+From 7bc2143f8ee6eee8fc9e30c7bd17d7f6bde16143 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Tue, 9 Jun 2015 14:37:53 +0200
+Subject: [PATCH] Adjust list parsing to SWI Prolog 7
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+SWI Prolog 7 brought a different representation of lists. This patch
+imlements the PL_LIST_PAIR type in swi2perl(). It does not touch
+PL_NIL type as I don't know what to do with it.
+
+CPAN RT#105114
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ Low/swi2perl.c | 46 +++++++++++++++++++++++-----------------------
+ 1 file changed, 23 insertions(+), 23 deletions(-)
+
+diff --git a/Low/swi2perl.c b/Low/swi2perl.c
+index 9f91292..53f0f14 100644
+--- a/Low/swi2perl.c
++++ b/Low/swi2perl.c
+@@ -32,34 +32,34 @@ SV *swi2perl(pTHX_ term_t t, AV *cells) {
+ 	return newSVnv(v);
+     }
+     case PL_STRING:
++    /*case PL_NIL:*/
+     case PL_ATOM: {
+         return swi2perl_atom_sv(aTHX_ t);
+     }
+-    case PL_TERM: {
+-        if (PL_is_list(t)) {
+-            AV *array=newAV();
+-            SV *ref=newRV_noinc((SV *)array);
+-            int len=0;
+-            term_t head, tail;
+-            while(PL_is_list(t)) {
+-                if(PL_get_nil(t)) {
+-                    sv_bless(ref, gv_stashpv( len ?
+-                                              TYPEINTPKG "::list" :
+-                                              TYPEINTPKG "::nil", 1));
+-                    return ref;
+-                }
+-                head=PL_new_term_refs(2);
+-                tail=head+1;
+-                PL_get_list(t, head, tail);
+-                av_push(array, swi2perl(aTHX_ head, cells));
+-                t=tail;
+-                len++;
++    case PL_LIST_PAIR: {
++        AV *array=newAV();
++        SV *ref=newRV_noinc((SV *)array);
++        int len=0;
++        term_t head, tail;
++        while(PL_is_list(t)) {
++            if(PL_get_nil(t)) {
++                sv_bless(ref, gv_stashpv( len ?
++                                          TYPEINTPKG "::list" :
++                                          TYPEINTPKG "::nil", 1));
++                return ref;
+             }
+-            av_push(array, swi2perl(aTHX_ tail, cells));
+-            sv_bless(ref, gv_stashpv(TYPEINTPKG "::ulist", 1));
+-            return ref;
++            head=PL_new_term_refs(2);
++            tail=head+1;
++            PL_get_list(t, head, tail);
++            av_push(array, swi2perl(aTHX_ head, cells));
++            t=tail;
++            len++;
+         }
+-
++        av_push(array, swi2perl(aTHX_ tail, cells));
++        sv_bless(ref, gv_stashpv(TYPEINTPKG "::ulist", 1));
++        return ref;
++    }
++    case PL_TERM: {
+         {
+             /* any other compound */
+             SV *ref;
+-- 
+2.1.0
+
diff --git a/perl-Language-Prolog-Yaswi.spec b/perl-Language-Prolog-Yaswi.spec
index 3df9868..033c48c 100644
--- a/perl-Language-Prolog-Yaswi.spec
+++ b/perl-Language-Prolog-Yaswi.spec
@@ -1,16 +1,18 @@
 Name:           perl-Language-Prolog-Yaswi
 Version:        0.21
-Release:        25%{?dist}
+Release:        26%{?dist}
 Summary:        Yet another interface to SWI-Prolog
 License:        GPL+ or Artistic
 Group:          Development/Libraries
 URL:            http://search.cpan.org/dist/Language-Prolog-Yaswi/
 Source0:        http://www.cpan.org/authors/id/S/SA/SALVA/Language-Prolog-Yaswi-%{version}.tar.gz
+# Adjust list parsing to SWI Prolog 7, bug #1229589, CPAN RT#105114
+Patch0:         Language-Prolog-Yaswi-0.21-Adjust-list-parsing-to-SWI-Prolog-7.patch
 BuildRequires:  perl
 BuildRequires:  perl(ExtUtils::MakeMaker)
 # XXX: Both SWI Prolog and Perl must (not) be compiled with threads support at
 # the same time.
-BuildRequires:  pl-devel >= 5.6
+BuildRequires:  pl-devel >= 7
 # Run-time
 BuildRequires:  perl(Carp)
 BuildRequires:  perl(DynaLoader)
@@ -37,6 +39,7 @@ and so on.
 
 %prep
 %setup -q -n Language-Prolog-Yaswi-%{version}
+%patch0 -p1
 for F in README; do
     iconv -f iso8859-1 -t utf-8 < "$F" > "${F}.new"
     touch -r "$F" "${F}.new"
@@ -65,6 +68,9 @@ make test
 %{_mandir}/man3/*
 
 %changelog
+* Tue Jun 09 2015 Petr Pisar <ppisar at redhat.com> - 0.21-26
+- Adjust list parsing to SWI Prolog 7 (bug #1229589)
+
 * Fri Jun 05 2015 Jitka Plesnikova <jplesnik at redhat.com> - 0.21-25
 - Perl 5.22 rebuild
 
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/perl-Language-Prolog-Yaswi.git/commit/?h=master&id=06ff64a31af4ee08e3e4d19df0784dbaa342fd29


More information about the perl-devel mailing list