Skip Menu |

This queue is for tickets about the Language-Prolog-Yaswi CPAN distribution.

Report information
The Basics
Id: 105114
Status: new
Priority: 0/
Queue: Language-Prolog-Yaswi

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.21
Fixed in: (no value)



Subject: Tests fail with SWI Prolog 7.2.0
SWI Prolog 7.2.0 brought some syntax changes <http://www.swi-prolog.org/download/stable> and Language-Prolog-Yaswi-0.21's t/5opaque.t test fails now: $ prove -b -v t/5opaque.t t/5opaque.t .. 1..2 unknown SWI-Prolog type 0x7, using undef at /home/test/fedora/perl-Language-Prolog-Yaswi/Language-Prolog-Yaswi-0.21/blib/lib/Language/Prolog/Yaswi/Low.pm line 37. unknown SWI-Prolog type 0x9, using undef at /home/test/fedora/perl-Language-Prolog-Yaswi/Language-Prolog-Yaswi-0.21/blib/lib/Language/Prolog/Yaswi/Low.pm line 37. unknown SWI-Prolog type 0x7, using undef at /home/test/fedora/perl-Language-Prolog-Yaswi/Language-Prolog-Yaswi-0.21/blib/lib/Language/Prolog/Yaswi/Low.pm line 37. unknown SWI-Prolog type 0x9, using undef at /home/test/fedora/perl-Language-Prolog-Yaswi/Language-Prolog-Yaswi-0.21/blib/lib/Language/Prolog/Yaswi/Low.pm line 37. unknown SWI-Prolog type 0x9, using undef at /home/test/fedora/perl-Language-Prolog-Yaswi/Language-Prolog-Yaswi-0.21/blib/lib/Language/Prolog/Yaswi/Low.pm line 37. not ok 1 - method called ok 2 - bad method called # Failed test 'method called' # at t/5opaque.t line 18. # got: undef # expected: 'method foo called' unknown SWI-Prolog type 0x7, using undef at /home/test/fedora/perl-Language-Prolog-Yaswi/Language-Prolog-Yaswi-0.21/blib/lib/Language/Prolog/Yaswi/Low.pm line 37. unknown SWI-Prolog type 0x9, using undef at /home/test/fedora/perl-Language-Prolog-Yaswi/Language-Prolog-Yaswi-0.21/blib/lib/Language/Prolog/Yaswi/Low.pm line 37. unknown SWI-Prolog type 0x7, using undef at /home/test/fedora/perl-Language-Prolog-Yaswi/Language-Prolog-Yaswi-0.21/blib/lib/Language/Prolog/Yaswi/Low.pm line 37. unknown SWI-Prolog type 0x9, using undef at /home/test/fedora/perl-Language-Prolog-Yaswi/Language-Prolog-Yaswi-0.21/blib/lib/Language/Prolog/Yaswi/Low.pm line 37. unknown SWI-Prolog type 0x9, using undef at /home/test/fedora/perl-Language-Prolog-Yaswi/Language-Prolog-Yaswi-0.21/blib/lib/Language/Prolog/Yaswi/Low.pm line 37. # Looks like you failed 1 test of 2. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/2 subtests
From: ppisar [...] redhat.com
Dne Út 09.čen.2015 03:50:53, ppisar napsal(a): Show quoted text
> unknown SWI-Prolog type 0x7, using undef at /home/test/fedora/perl- > Language-Prolog-Yaswi/Language-Prolog-Yaswi- > 0.21/blib/lib/Language/Prolog/Yaswi/Low.pm line 37. > unknown SWI-Prolog type 0x9, using undef at /home/test/fedora/perl- > Language-Prolog-Yaswi/Language-Prolog-Yaswi- > 0.21/blib/lib/Language/Prolog/Yaswi/Low.pm line 37.
From SWI Prolog's man/foreign.doc: \textbf{Version~7} added \const{PL_NIL}, \const{PL_BLOB}, \const{PL_LIST_PAIR} and \const{PL_DICT}. Older versions classify \const{PL_NIL} and \const{PL_BLOB} as \const{PL_ATOM}, \const{PL_LIST_PAIR} as \const{PL_TERM} and do not have dicts. \begin{tabular}{|p{\tableft}|p{\linewidth-\tableft-2cm}|} \hline \const{PL_VARIABLE} & A variable or attributed variable \\ \const{PL_ATOM} & A Prolog atom \\ \const{PL_NIL} & The constant \verb$[]$ \\ \const{PL_BLOB} & A blob (see \secref{blobaccess}) \\ \const{PL_STRING} & A string (see \secref{strings}) \\ \const{PL_INTEGER} & A integer \\ \const{PL_FLOAT} & A floating point number \\ \const{PL_TERM} & A compound term \\ \const{PL_LIST_PAIR} & A list cell (\verb$[H|T]$) \\ \const{PL_DICT} & A dict (see \secref{dicts})) \\ \hline \end{tabular} \end{description} and SWI-Prolog.h lists: #define PL_NIL (7) /* The constant [] */ #define PL_BLOB (8) /* non-atom blob */ #define PL_LIST_PAIR (9) /* [_|_] term */
From: ppisar [...] redhat.com
Dne Út 09.čen.2015 07:30:00, ppisar napsal(a): Show quoted text
> Dne Út 09.čen.2015 03:50:53, ppisar napsal(a):
> > unknown SWI-Prolog type 0x7, using undef at /home/test/fedora/perl- > > Language-Prolog-Yaswi/Language-Prolog-Yaswi- > > 0.21/blib/lib/Language/Prolog/Yaswi/Low.pm line 37. > > unknown SWI-Prolog type 0x9, using undef at /home/test/fedora/perl- > > Language-Prolog-Yaswi/Language-Prolog-Yaswi- > > 0.21/blib/lib/Language/Prolog/Yaswi/Low.pm line 37.
> > From SWI Prolog's man/foreign.doc: > > \textbf{Version~7} added \const{PL_NIL}, \const{PL_BLOB}, > \const{PL_LIST_PAIR} and \const{PL_DICT}. Older versions > classify \const{PL_NIL} and \const{PL_BLOB} as \const{PL_ATOM}, > \const{PL_LIST_PAIR} as \const{PL_TERM} and do not have > dicts. >
Attached patch implements the PL_LIST_PAIR type 0x9. I don't know what to do with the PL_NIL type 0x7. But at least test pass now.
Subject: Language-Prolog-Yaswi-0.21-Adjust-list-parsing-to-SWI-Prolog-7.patch
From 7bc2143f8ee6eee8fc9e30c7bd17d7f6bde16143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@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@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