fix error after error and error within error

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@344 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2002-02-01 15:48:17 +00:00
parent c5267f786c
commit 20c6b50a0d
6 changed files with 32 additions and 9 deletions

View File

@ -160,7 +160,7 @@ AccessNamedArray(Atom a, Int indx)
READ_LOCK(pp->ArRWLock);
if (IsVarTerm(pp->ValueOfVE)) {
READ_UNLOCK(pp->ArRWLock);
return(FALSE);
return(MkAtomTerm(AtomFoundVar));
}
out = RepAppl(pp->ValueOfVE)[indx+1];
READ_UNLOCK(pp->ArRWLock);
@ -310,6 +310,9 @@ p_access_array(void)
tf = (RepAppl(t))[indx + 1];
} else if (IsAtomTerm(t)) {
tf = AccessNamedArray(AtomOfTerm(t), indx);
if (tf == MkAtomTerm(AtomFoundVar)) {
return(FALSE);
}
} else {
Error(TYPE_ERROR_ARRAY,t,"access_array");
return(FALSE);
@ -350,7 +353,9 @@ p_array_arg(void)
}
else if (IsAtomTerm(t)) {
Term tf = AccessNamedArray(AtomOfTerm(t), indx);
if (tf == MkAtomTerm(AtomFoundVar)) {
return(FALSE);
}
return (unify(tf, ARG1));
}
else

View File

@ -313,9 +313,26 @@ Error (yap_error_number type, Term where, char *format,...)
char *tp = p;
int psize = 512;
/* disallow recursive error handling */
if (PrologMode & InErrorMode)
return(P);
/* disallow recursive error handling */
if (PrologMode & InErrorMode) {
/* error within error */
va_start (ap, format);
/* now build the error string */
if (format != NULL) {
#if HAVE_VSNPRINTF
(void) vsnprintf(p, 512, format, ap);
#else
(void) vsprintf(p, format, ap);
#endif
} else {
p[0] = '\0';
}
va_end (ap);
fprintf(stderr,"[ ERROR WITHIN ERROR: %s ]\n", p);
exit(1);
}
if (P == FAILCODE)
return(P);
/* PURE_ABORT may not have set where correctly */
if (type == PURE_ABORT)
where = TermNil;

View File

@ -1278,6 +1278,7 @@ JumpToEnv(Term t) {
/* I could backtrack here, but it is easier to leave the unwinding
to the emulator */
B->cp_a3 = t;
P = FAILCODE;
return(FALSE);
}

View File

@ -1188,8 +1188,6 @@ InitStacks(int Heap,
ReleaseAtom(AtomFoundVar);
LookupAtomWithAddress("[]",&(SF_STORE->AtNil));
LookupAtomWithAddress(".",&(SF_STORE->AtDot));
PutValue(LookupAtom("$catch_counter"),
MkIntTerm(0));
/* InitAbsmi must be done before InitCodes */
#ifdef MPW
InitAbsmi(REGS, FunctorList);

View File

@ -10,7 +10,7 @@
* File: Regs.h *
* mods: *
* comments: YAP abstract machine registers *
* version: $Id: Regs.h,v 1.11 2002-01-14 22:26:51 vsc Exp $ *
* version: $Id: Regs.h,v 1.12 2002-02-01 15:48:17 vsc Exp $ *
*************************************************************************/
@ -336,7 +336,7 @@ EXTERN inline void restore_TR(void) {
TR = REGS.TR_;
}
#elif defined(__GNUC__) && defined(mips)
#elif defined(__GNUC__) && defined(mips) && defined(VSC_UNDEFINED)
#define P REGS.P_ /* prolog machine program counter */
#define YENV REGS.YENV_ /* current environment (may differ from ENV) */

View File

@ -16,6 +16,8 @@
<h2>Yap-4.3.21:</h2>
<ul>
<li>FIXED: access to non-existing dynamic array should not core-dump.</li>
<li>FIXED: abolish(_) should give error in ISO mode.</li>
<li>NEW: yap_flag(argv,L) (Nicos Angelopoulos).</li>
<li>FIXED: make user the name of the first three streams.</li>
<li>NEW: reachable/3 in ugraphs (Nicos Angelopoulos).</li>