make Error Handler call throw in C, instead of doing messy
Prolog code. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@335 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
a60e61f507
commit
28128ed29c
18
C/errors.c
18
C/errors.c
@ -1749,24 +1749,10 @@ Error (yap_error_number type, Term where, char *format,...)
|
||||
}
|
||||
nt[1] = MkAtomTerm(LookupAtom(p));
|
||||
if (serious) {
|
||||
choiceptr newb;
|
||||
PredEntry *p = PredThrow;
|
||||
|
||||
CreepFlag = CalculateStackGap();
|
||||
ASP--;
|
||||
newb = ((choiceptr)ASP)-1;
|
||||
newb->cp_h = H;
|
||||
newb->cp_tr = TR;
|
||||
newb->cp_cp = CP;
|
||||
newb->cp_ap = (yamop *)(p->CodeOfPred);
|
||||
newb->cp_env = ENV;
|
||||
newb->cp_b = B;
|
||||
if (type == PURE_ABORT)
|
||||
ARG1 = newb->cp_a1 = MkAtomTerm(LookupAtom("abort"));
|
||||
JumpToEnv(MkAtomTerm(LookupAtom("abort")));
|
||||
else
|
||||
ARG1 = newb->cp_a1 = MkApplTerm(fun, 2, nt);
|
||||
B = newb;
|
||||
ASP = YENV = (CELL *)B;
|
||||
JumpToEnv(CopyTerm(MkApplTerm(fun, 2, nt)));
|
||||
P = (yamop *)FAILCODE;
|
||||
}
|
||||
PrologMode &= ~InErrorMode;
|
||||
|
15
C/exec.c
15
C/exec.c
@ -1250,9 +1250,8 @@ p_clean_ifcp(void) {
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/* This does very nasty stuff!!!!! */
|
||||
static Int
|
||||
p_jump_env(void) {
|
||||
Int
|
||||
JumpToEnv(Term t) {
|
||||
yamop *min = (yamop *)(PredCatch->CodeOfPred);
|
||||
yamop *max = (yamop *)(PredThrow->CodeOfPred);
|
||||
CELL *cur = ENV, *env;
|
||||
@ -1274,11 +1273,19 @@ p_jump_env(void) {
|
||||
B->cp_h = H;
|
||||
/* I could backtrack here, but it is easier to leave the unwinding
|
||||
to the emulator */
|
||||
B->cp_a3 = Deref(ARG1);
|
||||
B->cp_a3 = t;
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* This does very nasty stuff!!!!! */
|
||||
static Int
|
||||
p_jump_env(void) {
|
||||
return(JumpToEnv(Deref(ARG1)));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InitExecFs(void)
|
||||
{
|
||||
|
@ -251,7 +251,7 @@ static void copy_complex_term(register CELL *pt0, register CELL *pt0_end, CELL *
|
||||
clean_tr(TR0);
|
||||
}
|
||||
|
||||
static Term
|
||||
Term
|
||||
CopyTerm(Term inp) {
|
||||
Term t = Deref(inp);
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
* File: Yap.proto *
|
||||
* mods: *
|
||||
* comments: Function declarations for YAP *
|
||||
* version: $Id: Yapproto.h,v 1.7 2002-01-07 06:28:03 vsc Exp $ *
|
||||
* version: $Id: Yapproto.h,v 1.8 2002-01-29 05:37:31 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
/* prototype file for Yap */
|
||||
@ -149,6 +149,7 @@ Int STD_PROTO(EvFArt,(Term));
|
||||
/* exec.c */
|
||||
Term STD_PROTO(ExecuteCallMetaCall,(SMALLUNSGN mod));
|
||||
void STD_PROTO(InitExecFs,(void));
|
||||
Int STD_PROTO(JumpToEnv,(Term));
|
||||
int STD_PROTO(RunTopGoal,(Term));
|
||||
Int STD_PROTO(execute_goal,(Term, int, SMALLUNSGN));
|
||||
int STD_PROTO(exec_absmi,(int));
|
||||
@ -270,6 +271,7 @@ void STD_PROTO(InitUserCPreds,(void));
|
||||
void STD_PROTO(InitUserBacks,(void));
|
||||
|
||||
/* utilpreds.c */
|
||||
Term STD_PROTO(CopyTerm,(Term));
|
||||
Int STD_PROTO(var_in_term, (Term, Term));
|
||||
void STD_PROTO(InitUtilCPreds,(void));
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
* File: Yap.h.m4 *
|
||||
* mods: *
|
||||
* comments: main header file for YAP *
|
||||
* version: $Id: Yap.h.m4,v 1.18 2002-01-27 20:40:10 vsc Exp $ *
|
||||
* version: $Id: Yap.h.m4,v 1.19 2002-01-29 05:37:31 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
@ -496,7 +496,7 @@ typedef enum {
|
||||
#define ISO_CHARACTER_ESCAPES 1
|
||||
#define SICSTUS_CHARACTER_ESCAPES 2
|
||||
|
||||
#define NUMBER_OF_YAP_FLAGS HALT_AFTER_CONSULT_FLAG+1
|
||||
#define NUMBER_OF_YAP_FLAGS FAST_BOOT_FLAG+1
|
||||
|
||||
/************************ prototypes **********************************/
|
||||
|
||||
|
Reference in New Issue
Block a user