diff --git a/C/attvar.c b/C/attvar.c index 066771885..818d1fc6a 100644 --- a/C/attvar.c +++ b/C/attvar.c @@ -170,13 +170,6 @@ WakeAttVar(CELL* pt1, CELL reg2) CELL *myH = H; CELL *bind_ptr; - if (!IsVarTerm(attv->Value) || !IsUnboundVar(attv->Value)) { - /* oops, our goal is on the queue to be woken */ - if (!unify(attv->Value, reg2)) { - AddFailToQueue(); - } - return; - } if (IsVarTerm(reg2)) { if (IsAttachedTerm(reg2)) { attvar_record *susp2 = (attvar_record *)VarOfTerm(reg2); @@ -204,6 +197,13 @@ WakeAttVar(CELL* pt1, CELL reg2) return; } } + if (!IsVarTerm(attv->Value) || !IsUnboundVar(attv->Value)) { + /* oops, our goal is on the queue to be woken */ + if (!unify(attv->Value, reg2)) { + AddFailToQueue(); + } + return; + } bind_ptr = AddToQueue(attv); if (IsNonVarTerm(reg2)) { if (IsPairTerm(reg2) && RepPair(reg2) == myH) diff --git a/library/ugraphs.yap b/library/ugraphs.yap index 7150a29de..ef128b937 100644 --- a/library/ugraphs.yap +++ b/library/ugraphs.yap @@ -244,7 +244,7 @@ p_to_s_group([Vertex|Vertices], EdgeSet, [Vertex-Neibs|G]) :- p_to_s_group(Vertices, RestEdges, G). -p_to_s_group([V-X|Edges], V, [X|Neibs], RestEdges) :- !, +p_to_s_group([V1-X|Edges], V2, [X|Neibs], RestEdges) :- V1 == V2, !, p_to_s_group(Edges, V, Neibs, RestEdges). p_to_s_group(Edges, _, [], Edges). diff --git a/pl/errors.yap b/pl/errors.yap index f5fdb36bd..1ff08a234 100644 --- a/pl/errors.yap +++ b/pl/errors.yap @@ -386,18 +386,20 @@ print_message(Level, Mss) :- '$dump_syntax_error_term'(I1,J1,R). '$dump_error_token'(atom(A)) :- !, - '$format'(user_error," ~a", [A]). + '$format'(user_error,"~a", [A]). '$dump_error_token'(number(N)) :- !, - '$format'(user_error," ~w", [N]). + '$format'(user_error,"~w", [N]). '$dump_error_token'(var(_,S,_)) :- !, - '$format'(user_error," ~s ", [S]). + '$format'(user_error,"~s ", [S]). '$dump_error_token'(string(S)) :- !, - '$format'(user_error," ""~s""", [S]). + '$format'(user_error,"""~s""", [S]). '$dump_error_token'('(') :- '$format'(user_error,"(", []). '$dump_error_token'(')') :- '$format'(user_error," )", []). +'$dump_error_token'(',') :- + '$format'(user_error," , ", []). '$dump_error_token'(A) :- - '$format'(user_error," ~a", [A]). + '$format'(user_error," ~a ", [A]).