fix bad memory information in Interrupt Handler

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@308 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2002-01-17 22:12:09 +00:00
parent b53ca0ed7b
commit 35ba78008b
3 changed files with 30 additions and 11 deletions

View File

@ -2105,7 +2105,12 @@ absmi(int inp)
}
if (PrologMode & AbortMode) {
PrologMode &= ~AbortMode;
ASP = Y+E_CB;
if (ASP > (CELL *)B)
ASP = (CELL *)B;
saveregs();
Error(PURE_ABORT, TermNil, "");
setregs();
}
JMPNext();
}

View File

@ -315,7 +315,10 @@ Error (yap_error_number type, Term where, char *format,...)
/* disallow recursive error handling */
if (PrologMode & InErrorMode)
return(P);
if (type != PURE_ABORT)
/* PURE_ABORT may not have set where correctly */
if (type == PURE_ABORT)
where = TermNil;
else
where = Deref(where);
if (IsVarTerm(where)) {
/* we must be careful someone gave us a copy to a local variable */

View File

@ -1936,9 +1936,11 @@ static Int p_file_age(void)
}
/* wrapper for alarm system call */
#if defined(_WIN32)
#if _MSC_VER || defined(__MINGW32__)
static VOID CALLBACK HandleTimer(LPVOID v, DWORD d1, DWORD d2) {
/* force the system to creep */
exit(0);
p_creep ();
/* now, say what is going on */
PutValue(AtomAlarm, MkAtomTerm(AtomTrue));
@ -1960,16 +1962,25 @@ p_alarm(void)
#if _MSC_VER || defined(__MINGW32__)
{
Term tout;
HANDLE htimer = CreateWaitableTimer(NULL,FALSE,NULL);
LARGE_INTEGER due_time;
__int64 timeout = -IntegerOfTerm(t);
due_time.QuadPart = timeout;
HANDLE htimer;
Int time = -IntegerOfTerm(t);
if (time != 0) {
__int64 due_time;
LARGE_INTEGER liDueTime;
if (SetWaitableTimer(htimer, &due_time,0,HandleTimer,NULL,TRUE) == 0) {
Error(SYSTEM_ERROR, TermNil,
"alarm not available in this configuration");
return(FALSE);
}
htimer = CreateWaitableTimer(NULL,FALSE,NULL);
due_time = time;
due_time *= 10000000;
/* Copy the relative time into a LARGE_INTEGER. */
liDueTime.LowPart = (DWORD) ( due_time & 0xFFFFFFFF );
liDueTime.HighPart = (LONG) ( due_time >> 32 );
if (SetWaitableTimer(htimer, &liDueTime,0,HandleTimer,NULL,0) == 0) {
Error(SYSTEM_ERROR, TermNil,
"alarm not available in this configuration");
return(FALSE);
}
}
tout = MkIntegerTerm(0);
return(unify(ARG2,tout));
}