more loops.

This commit is contained in:
Vítor Santos Costa 2019-02-15 21:09:58 +00:00
parent 1bd2f0338c
commit 1ef3f738ee
5 changed files with 12 additions and 7 deletions

View File

@ -367,7 +367,7 @@ static int cycles_in_complex_term(register CELL *pt0,
ptd0 = RepAppl(d0);
f = (Functor)(d0 = *ptd0);
if (IsExtensionFunctor(f)) {
*ptf++ = d0;
*ptf++ = AbsAppl(ptd0);
continue;
}
if (IS_VISIT_MARKER) {
@ -1228,7 +1228,7 @@ static Int numbervars_in_complex_term(CELL * pt0, CELL * pt0_end, Int numbv,
if (IsAttVar(pt0))
continue;
/* do or pt2 are unbound */
if (singles || 0)
if (singles)
d0 = numbervar_singleton(PASS_REGS1);
else
d0 = numbervar(numbv++ PASS_REGS);
@ -1384,6 +1384,8 @@ static Int t_ref(cl_connector *d, cl_connector * q, int max) {
static Int create_entry(Term t, Int i, Int j, cl_connector * q, Int max) {
Term ref, h, *s, *ostart;
ssize_t n;
// fprintf(stderr,"[%ld,%ld]/%ld, %lx\n",i,j,max,t);
// first time, create a new term
if (IsVarTerm(t)) {
return -1;
@ -1482,7 +1484,6 @@ Term Yap_BreakCycles(Term inp, UInt arity, Term * listp USES_REGS) {
return t;
} else {
// initialization
fprintf(stderr,"C i=%ld,%ld %lx\n", i, 0, q[i].copy[0]); }
qlen = create_entry(Deref(t), i, 0, q, qlen);
while(i<qlen) {
arity_t n, j;

View File

@ -1103,6 +1103,7 @@ void Yap_plwrite(Term t, StreamDesc *mywrite, int max_depth, int flags,
wglb.Write_Loops = flags & Handle_cyclics_f;
wglb.Quote_illegal = flags & Quote_illegal_f;
wglb.MaxArgs = 0 ;
wglb.MaxDepth = 0 ;
wglb.lw = separator;
Term tp;

View File

@ -419,4 +419,6 @@ fetch(pp(P,_,_,_)._Tree, -1, N) :- N is 1-P.
fetch(pn(P,_,_,_)._Tree, 1, P).
fetch(pn(P,_,_,_)._Tree, -1, N) :- N is 1-P.
%% @}

View File

@ -8,11 +8,11 @@ from .ptutils import IPythonPTCompleter
from .shortcuts import suspend_to_bg, cursor_in_leading_ws
from prompt_toolkit.enums import DEFAULT_BUFFER
from prompt_toolkit.filters import (Condition, has_focus, has_selection,
vi_insert_mode, emacs_insert_mode)
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.filters import (Condition, HasFocus, HasSelection,
ViInsertMode, EmacsInsertMode)
from prompt_toolkit.keys import Keys
from prompt_toolkit.key_binding.manager import KeyBindingManager
from prompt_toolkit.key_binding.bindings.completion import display_completions_like_readline
from pygments.token import Token
from prompt_toolkit.shortcuts.prompt import PromptSession
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.formatted_text import PygmentsTokens

View File

@ -70,6 +70,7 @@ d(X, ( X= f(X,X)) ).
d(X, ( X= f(_,X)) ).
d(X, ( X= f(A,A,X)) ).
d(X, ( X= f(A,A,g(A))) ).
d(X, ( X= f(A,A,2.3)) ).
d(X, ( X= f(A,g(X,[A|A]),X)) ).
d(X, ( X= f(X,[X,X])) ).
d(X, ( X= f(3.14,[22.3,X])) ).