fix min list

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1882 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2007-05-15 11:33:51 +00:00
parent 039067068e
commit 498c7a6d42
6 changed files with 23 additions and 21 deletions

View File

@ -10,8 +10,11 @@
* File: c_interface.c *
* comments: c_interface primitives definition *
* *
* Last rev: $Date: 2007-05-14 16:44:11 $,$Author: vsc $ *
* Last rev: $Date: 2007-05-15 11:33:51 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.93 2007/05/14 16:44:11 vsc
* improve external interface
*
* Revision 1.92 2007/04/18 23:01:16 vsc
* fix deadlock when trying to create a module with the same name as a
* predicate (for now, just don't lock modules). obs Paulo Moura.
@ -314,7 +317,7 @@ X_API Term STD_PROTO(YAP_BufferToAtomList, (char *));
X_API void STD_PROTO(YAP_Error,(int, Term, char *, ...));
X_API Term STD_PROTO(YAP_RunGoal,(Term));
X_API int STD_PROTO(YAP_RestartGoal,(void));
X_API int STD_PROTO(YAP_ShutdownGoal,(void));
X_API int STD_PROTO(YAP_ShutdownGoal,(int));
X_API int STD_PROTO(YAP_GoalHasException,(Term *));
X_API void STD_PROTO(YAP_ClearExceptions,(void));
X_API int STD_PROTO(YAP_ContinueGoal,(void));
@ -1129,7 +1132,7 @@ YAP_RestartGoal(void)
}
X_API int
YAP_ShutdownGoal(void)
YAP_ShutdownGoal(int backtrack)
{
BACKUP_MACHINE_REGS();
@ -1146,11 +1149,14 @@ YAP_ShutdownGoal(void)
#endif
/* just force backtrack */
B = cut_pt;
P = FAILCODE;
Yap_exec_absmi(TRUE);
/* recover stack space */
H = cut_pt->cp_h;
TR = cut_pt->cp_tr;
if (backtrack) {
P = FAILCODE;
Yap_exec_absmi(TRUE);
/* recover stack space */
H = cut_pt->cp_h;
TR = cut_pt->cp_tr;
}
/* we can always recover the stack */
ENV = cut_pt->cp_env;
ASP = (CELL *)(cut_pt+1);
ASP += EnvSizeInCells;

View File

@ -402,12 +402,6 @@ p_execute(void)
return do_execute(t, CurrentModule);
}
static int
Yap_Execute(Term t)
{ /* '$execute'(Goal) */
return do_execute(t, CurrentModule);
}
static void
heap_store(Term t)
{

View File

@ -16,6 +16,7 @@
<h2>Yap-5.1.2:</h2>
<ul>
<li> FIXED: min_list (obs from Angelika, Bernd & Niels).</li>
<li> FIXED: issues with C-Interface (obs from Trevor Walker).</li>
<li> FIXED: mktime needs to know if daylight time savings are on
(obs from Bernd Gutmann).</li>

View File

@ -12798,11 +12798,12 @@ Look for the next solution to the current query by forcing YAP to
backtrack to the latest goal. Notice that slots allocated since the last
@code{YAP_RunGoal} will become invalid.
@item @code{int} YAP_ShutdownGoal(@code{void})
@item @code{int} YAP_ShutdownGoal(@code{int backtrack})
@findex YAP_ShutdownGoal/0
Clean up the current goal. All it space should be recovered and any
pointers to the goal will become invalid. Also notice that slots
allocated since the goal was started will be invalid.
Clean up the current goal. If
@code{backtrack} is true, stack space will be recovered and bindings
will be undone. In both cases, any slots allocated since the goal was
created will become invalid.
@item @code{int} YAP_Reset(@code{void})
@findex YAP_Reset/0

View File

@ -222,8 +222,8 @@ extern X_API YAP_Term PROTO(YAP_RunGoal,(YAP_Term));
/* int YAP_RestartGoal(void) */
extern X_API YAP_Bool PROTO(YAP_RestartGoal,(void));
/* int YAP_ShutdownGoal(void) */
extern X_API YAP_Bool PROTO(YAP_ShutdownGoal,(void));
/* int YAP_ShutdownGoal(int) */
extern X_API YAP_Bool PROTO(YAP_ShutdownGoal,(int));
/* int YAP_ContinueGoal(void) */
extern X_API YAP_Bool PROTO(YAP_ContinueGoal,(void));

View File

@ -335,7 +335,7 @@ max_list([H|L],Max0,Max) :-
).
min_list([H|L],Max) :-
max_list(L,H,Max).
min_list(L,H,Max).
min_list([],Max,Max).
min_list([H|L],Max0,Max) :-