YPP would leave exceptions on the system, disabling Yap-4.5.7
message. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1364 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
a4b79352d5
commit
996272db22
@ -10,8 +10,11 @@
|
|||||||
* File: c_interface.c *
|
* File: c_interface.c *
|
||||||
* comments: c_interface primitives definition *
|
* comments: c_interface primitives definition *
|
||||||
* *
|
* *
|
||||||
* Last rev: $Date: 2005-08-04 15:45:51 $,$Author: ricroc $ *
|
* Last rev: $Date: 2005-08-17 13:35:51 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.70 2005/08/04 15:45:51 ricroc
|
||||||
|
* TABLING NEW: support to limit the table space size
|
||||||
|
*
|
||||||
* Revision 1.69 2005/07/19 17:12:18 rslopes
|
* Revision 1.69 2005/07/19 17:12:18 rslopes
|
||||||
* fix for older compilers that do not support declaration of vars
|
* fix for older compilers that do not support declaration of vars
|
||||||
* in the middle of the function code.
|
* in the middle of the function code.
|
||||||
@ -205,6 +208,7 @@ X_API void STD_PROTO(YAP_Error,(int, Term, char *, ...));
|
|||||||
X_API Term STD_PROTO(YAP_RunGoal,(Term));
|
X_API Term STD_PROTO(YAP_RunGoal,(Term));
|
||||||
X_API int STD_PROTO(YAP_RestartGoal,(void));
|
X_API int STD_PROTO(YAP_RestartGoal,(void));
|
||||||
X_API int STD_PROTO(YAP_GoalHasException,(Term *));
|
X_API int STD_PROTO(YAP_GoalHasException,(Term *));
|
||||||
|
X_API void STD_PROTO(YAP_ClearExceptions,(void));
|
||||||
X_API int STD_PROTO(YAP_ContinueGoal,(void));
|
X_API int STD_PROTO(YAP_ContinueGoal,(void));
|
||||||
X_API void STD_PROTO(YAP_PruneGoal,(void));
|
X_API void STD_PROTO(YAP_PruneGoal,(void));
|
||||||
X_API void STD_PROTO(YAP_InitConsult,(int, char *));
|
X_API void STD_PROTO(YAP_InitConsult,(int, char *));
|
||||||
@ -980,7 +984,14 @@ YAP_GoalHasException(Term *t)
|
|||||||
out = TRUE;
|
out = TRUE;
|
||||||
}
|
}
|
||||||
RECOVER_MACHINE_REGS();
|
RECOVER_MACHINE_REGS();
|
||||||
return(out);
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
X_API void
|
||||||
|
YAP_ClearExceptions(void)
|
||||||
|
{
|
||||||
|
EX = 0L;
|
||||||
|
UncaughtThrow = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
X_API void
|
X_API void
|
||||||
|
@ -116,7 +116,7 @@ loop:
|
|||||||
to_visit += 3;
|
to_visit += 3;
|
||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
cufail:
|
cufail:
|
||||||
/* we found an infinite term */
|
/* we found an infinite term */
|
||||||
@ -361,9 +361,7 @@ oc_unify_nvar:
|
|||||||
oc_unify_nvar_nvar:
|
oc_unify_nvar_nvar:
|
||||||
|
|
||||||
if (d0 == d1) {
|
if (d0 == d1) {
|
||||||
if (rational_tree(d0))
|
return (!rational_tree(d0));
|
||||||
return(FALSE);
|
|
||||||
return(TRUE);
|
|
||||||
}
|
}
|
||||||
/* both arguments are bound */
|
/* both arguments are bound */
|
||||||
if (IsPairTerm(d0)) {
|
if (IsPairTerm(d0)) {
|
||||||
|
@ -621,6 +621,7 @@ main (int argc, char **argv)
|
|||||||
YAP_RunGoal(t_goal);
|
YAP_RunGoal(t_goal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
YAP_ClearExceptions();
|
||||||
/* End preprocessor code */
|
/* End preprocessor code */
|
||||||
|
|
||||||
exec_top_level(BootMode, &init_args);
|
exec_top_level(BootMode, &init_args);
|
||||||
|
16
docs/yap.tex
16
docs/yap.tex
@ -8753,6 +8753,13 @@ Generate the set of nodes @var{Sort} as a topological sorting of graph
|
|||||||
L = [_138,_219,_139]
|
L = [_138,_219,_139]
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
@item top_sort(+@var{Graph}, -@var{Sort0}, -@var{Sort})
|
||||||
|
@findex top_sort/3
|
||||||
|
@syindex top_sort/3
|
||||||
|
@cnindex top_sort/3
|
||||||
|
Generate the difference list @var{Sort}-@var{Sort0} as a topological
|
||||||
|
sorting of graph @var{Graph}, if one is possible.
|
||||||
|
|
||||||
@item transitive_closure(+@var{Graph}, +@var{Closure})
|
@item transitive_closure(+@var{Graph}, +@var{Closure})
|
||||||
@findex transitive_closure/2
|
@findex transitive_closure/2
|
||||||
@syindex transitive_closure/2
|
@syindex transitive_closure/2
|
||||||
@ -14191,6 +14198,15 @@ Reset execution environment (similar to the @code{abort/0}
|
|||||||
builtin). This is useful when you want to start a new query before
|
builtin). This is useful when you want to start a new query before
|
||||||
asking all solutions to the previous query.
|
asking all solutions to the previous query.
|
||||||
|
|
||||||
|
@item @code{YAP_Bool} YAP_GoalHasException(@code{YAP_Term *tp})
|
||||||
|
@findex YAP_RestartGoal/1
|
||||||
|
Check if the last goal generated an exception, and if so copy it to the
|
||||||
|
space pointed to by @var{tp}
|
||||||
|
|
||||||
|
@item @code{void} YAP_ClearExceptions(@code{void})
|
||||||
|
@findex YAP_ClearExceptions/0
|
||||||
|
Reset any exceptions left over by the system.
|
||||||
|
|
||||||
@item @code{void} YAP_Write(@code{YAP_Term} @var{t}, @code{void (*)(int)}
|
@item @code{void} YAP_Write(@code{YAP_Term} @var{t}, @code{void (*)(int)}
|
||||||
@var{PutC}, @code{int} @var{flags})
|
@var{PutC}, @code{int} @var{flags})
|
||||||
@findex YAP_Write/3
|
@findex YAP_Write/3
|
||||||
|
@ -218,9 +218,12 @@ extern X_API YAP_Bool PROTO(YAP_ContinueGoal,(void));
|
|||||||
/* void YAP_PruneGoal(void) */
|
/* void YAP_PruneGoal(void) */
|
||||||
extern X_API void PROTO(YAP_PruneGoal,(void));
|
extern X_API void PROTO(YAP_PruneGoal,(void));
|
||||||
|
|
||||||
/* int YAP_GoalHasException(void) */
|
/* int YAP_GoalHasException(YAP_Term *) */
|
||||||
extern X_API YAP_Bool PROTO(YAP_GoalHasException,(YAP_Term *));
|
extern X_API YAP_Bool PROTO(YAP_GoalHasException,(YAP_Term *));
|
||||||
|
|
||||||
|
/* void YAP_ClearExceptions(void) */
|
||||||
|
extern X_API void PROTO(YAP_ClearExceptions,(void));
|
||||||
|
|
||||||
/* int YAP_Reset(void) */
|
/* int YAP_Reset(void) */
|
||||||
extern X_API void PROTO(YAP_Reset,(void));
|
extern X_API void PROTO(YAP_Reset,(void));
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
neighbors/3,
|
neighbors/3,
|
||||||
reachable/3,
|
reachable/3,
|
||||||
top_sort/2,
|
top_sort/2,
|
||||||
|
top_sort/3,
|
||||||
transitive_closure/2,
|
transitive_closure/2,
|
||||||
transpose/2,
|
transpose/2,
|
||||||
vertices/2,
|
vertices/2,
|
||||||
@ -450,6 +451,12 @@ top_sort(Graph, Sorted) :-
|
|||||||
select_zeros(Counts1, Vertices, Zeros),
|
select_zeros(Counts1, Vertices, Zeros),
|
||||||
top_sort(Zeros, Sorted, Graph, Vertices, Counts1).
|
top_sort(Zeros, Sorted, Graph, Vertices, Counts1).
|
||||||
|
|
||||||
|
top_sort(Graph, Sorted0, Sorted) :-
|
||||||
|
vertices_and_zeros(Graph, Vertices, Counts0),
|
||||||
|
count_edges(Graph, Vertices, Counts0, Counts1),
|
||||||
|
select_zeros(Counts1, Vertices, Zeros),
|
||||||
|
top_sort(Zeros, Sorted, Sorted0, Graph, Vertices, Counts1).
|
||||||
|
|
||||||
|
|
||||||
vertices_and_zeros([], [], []) :- !.
|
vertices_and_zeros([], [], []) :- !.
|
||||||
vertices_and_zeros([Vertex-_|Graph], [Vertex|Vertices], [0|Zeros]) :-
|
vertices_and_zeros([Vertex-_|Graph], [Vertex|Vertices], [0|Zeros]) :-
|
||||||
@ -485,6 +492,13 @@ top_sort([Zero|Zeros], [Zero|Sorted], Graph, Vertices, Counts1) :-
|
|||||||
decr_list(Neibs, Vertices, Counts1, Counts2, Zeros, NewZeros),
|
decr_list(Neibs, Vertices, Counts1, Counts2, Zeros, NewZeros),
|
||||||
top_sort(NewZeros, Sorted, Graph, Vertices, Counts2).
|
top_sort(NewZeros, Sorted, Graph, Vertices, Counts2).
|
||||||
|
|
||||||
|
top_sort([], Sorted0, Sorted0, Graph, _, Counts) :- !,
|
||||||
|
vertices_and_zeros(Graph, _, Counts).
|
||||||
|
top_sort([Zero|Zeros], [Zero|Sorted], Sorted0, Graph, Vertices, Counts1) :-
|
||||||
|
graph_memberchk(Zero-Neibs, Graph),
|
||||||
|
decr_list(Neibs, Vertices, Counts1, Counts2, Zeros, NewZeros),
|
||||||
|
top_sort(NewZeros, Sorted, Sorted0, Graph, Vertices, Counts2).
|
||||||
|
|
||||||
graph_memberchk(Element1-Edges, [Element2-Edges2|_]) :- Element1 == Element2, !,
|
graph_memberchk(Element1-Edges, [Element2-Edges2|_]) :- Element1 == Element2, !,
|
||||||
Edges = Edges2.
|
Edges = Edges2.
|
||||||
graph_memberchk(Element, [_|Rest]) :-
|
graph_memberchk(Element, [_|Rest]) :-
|
||||||
|
@ -51,6 +51,7 @@ YAP_Error
|
|||||||
YAP_RunGoal
|
YAP_RunGoal
|
||||||
YAP_RestartGoal
|
YAP_RestartGoal
|
||||||
YAP_GoalHasException
|
YAP_GoalHasException
|
||||||
|
YAP_ClearExceptions
|
||||||
YAP_ContinueGoal
|
YAP_ContinueGoal
|
||||||
YAP_PruneGoal
|
YAP_PruneGoal
|
||||||
YAP_InitConsult
|
YAP_InitConsult
|
||||||
|
Reference in New Issue
Block a user