try to fix exceptions
This commit is contained in:
parent
508e10d0be
commit
48bcffdce7
52
C/errors.c
52
C/errors.c
@ -166,7 +166,7 @@ bool Yap_HandleError__(const char *file, const char *function, int lineno,
|
|||||||
switch (err) {
|
switch (err) {
|
||||||
case RESOURCE_ERROR_STACK:
|
case RESOURCE_ERROR_STACK:
|
||||||
if (!Yap_gc(arity, ENV, gc_P(P, CP))) {
|
if (!Yap_gc(arity, ENV, gc_P(P, CP))) {
|
||||||
Yap_Error__(file, function, lineno, RESOURCE_ERROR_STACK, ARG1, serr);
|
Yap_Error__(false, file, function, lineno, RESOURCE_ERROR_STACK, ARG1, serr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -176,18 +176,18 @@ bool Yap_HandleError__(const char *file, const char *function, int lineno,
|
|||||||
}
|
}
|
||||||
if (!Yap_ExpandPreAllocCodeSpace(0, NULL, TRUE)) {
|
if (!Yap_ExpandPreAllocCodeSpace(0, NULL, TRUE)) {
|
||||||
/* crash in flames */
|
/* crash in flames */
|
||||||
Yap_Error__(file, function, lineno, RESOURCE_ERROR_AUXILIARY_STACK, ARG1,
|
Yap_Error__(false, file, function, lineno, RESOURCE_ERROR_AUXILIARY_STACK, ARG1,
|
||||||
serr);
|
serr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case RESOURCE_ERROR_HEAP:
|
case RESOURCE_ERROR_HEAP:
|
||||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||||
Yap_Error__(file, function, lineno, RESOURCE_ERROR_HEAP, ARG2, serr);
|
Yap_Error__(false, file, function, lineno, RESOURCE_ERROR_HEAP, ARG2, serr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
Yap_Error__(file, function, lineno, err, TermNil, serr);
|
Yap_Error__(false, file, function, lineno, err, TermNil, serr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,24 +218,25 @@ int Yap_SWIHandleError(const char *s, ...) {
|
|||||||
Yap_Error(RESOURCE_ERROR_AUXILIARY_STACK, ARG1, serr);
|
Yap_Error(RESOURCE_ERROR_AUXILIARY_STACK, ARG1, serr);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
case RESOURCE_ERROR_HEAP:
|
case RESOURCE_ERROR_HEAP:
|
||||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
if (!Yap_growheap(false, 0, NULL)) {
|
||||||
Yap_Error(RESOURCE_ERROR_HEAP, ARG2, serr);
|
Yap_Error(RESOURCE_ERROR_HEAP, ARG2, serr);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
Yap_Error(err, TermNil, serr);
|
Yap_Error(err, TermNil, serr);
|
||||||
return (FALSE);
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Yap_RestartYap(int flag) {
|
void Yap_RestartYap(int flag) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
|
fprintf(stderr,"HR=%p\n", HR);
|
||||||
#if PUSH_REGS
|
#if PUSH_REGS
|
||||||
restore_absmi_regs(&Yap_standard_regs);
|
restore_absmi_regs(&Yap_standard_regs);
|
||||||
#endif
|
#endif
|
||||||
siglongjmp(*LOCAL_RestartEnv, 1);
|
siglongjmp(*LOCAL_RestartEnv, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void error_exit_yap(int value) {
|
static void error_exit_yap(int value) {
|
||||||
@ -335,7 +336,8 @@ void Yap_pushErrorContext(yap_error_descriptor_t *new_error) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
reset_error_description(void) {
|
reset_error_description(void) {
|
||||||
sigjmp_buf *bf = LOCAL_ActiveError->top_error;
|
yap_error_descriptor_t *bf = LOCAL_ActiveError->top_error;
|
||||||
|
if (Yap_HasException())
|
||||||
memset(LOCAL_ActiveError, 0, sizeof(*LOCAL_ActiveError));
|
memset(LOCAL_ActiveError, 0, sizeof(*LOCAL_ActiveError));
|
||||||
LOCAL_ActiveError->top_error = bf;
|
LOCAL_ActiveError->top_error = bf;
|
||||||
|
|
||||||
@ -365,12 +367,15 @@ void Yap_ThrowError__(const char *file, const char *function, int lineno,
|
|||||||
(void)vsprintf(tnpbuf, fmt, ap);
|
(void)vsprintf(tnpbuf, fmt, ap);
|
||||||
#endif
|
#endif
|
||||||
// fprintf(stderr, "warning: ");
|
// fprintf(stderr, "warning: ");
|
||||||
Yap_Error__(file, function, lineno, type, where, tmpbuf);
|
Yap_Error__(true, file, function, lineno, type, where, tmpbuf);
|
||||||
} else {
|
} else {
|
||||||
Yap_Error__(file, function, lineno, type, where);
|
Yap_Error__(true, file, function, lineno, type, where);
|
||||||
|
}
|
||||||
|
if (LOCAL_RestartEnv) {
|
||||||
|
Yap_RestartYap(5);
|
||||||
|
} else {
|
||||||
|
exit(5);
|
||||||
}
|
}
|
||||||
if (LOCAL_RestartEnv)
|
|
||||||
siglongjmp(*LOCAL_RestartEnv, 5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -406,7 +411,7 @@ void Yap_ThrowError__(const char *file, const char *function, int lineno,
|
|||||||
*
|
*
|
||||||
* + i=i(Comment): an user-written comment on this bug.
|
* + i=i(Comment): an user-written comment on this bug.
|
||||||
*/
|
*/
|
||||||
yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
yamop *Yap_Error__(bool throw, const char *file, const char *function, int lineno,
|
||||||
yap_error_number type, Term where, ...) {
|
yap_error_number type, Term where, ...) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -573,7 +578,7 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
LOCAL_PredEntriesCounterOn = FALSE;
|
LOCAL_PredEntriesCounterOn = FALSE;
|
||||||
LOCAL_RetriesCounterOn = FALSE;
|
LOCAL_RetriesCounterOn = FALSE;
|
||||||
Yap_JumpToEnv(MkAtomTerm(AtomCallCounter));
|
Yap_JumpToEnv(MkAtomTerm(AtomCallCounter));
|
||||||
P = (yamop *)FAILCODE;
|
P = FAILCODE;
|
||||||
LOCAL_PrologMode &= ~InErrorMode;
|
LOCAL_PrologMode &= ~InErrorMode;
|
||||||
return (P);
|
return (P);
|
||||||
case PRED_ENTRY_COUNTER_UNDERFLOW_EVENT:
|
case PRED_ENTRY_COUNTER_UNDERFLOW_EVENT:
|
||||||
@ -582,7 +587,7 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
LOCAL_PredEntriesCounterOn = FALSE;
|
LOCAL_PredEntriesCounterOn = FALSE;
|
||||||
LOCAL_RetriesCounterOn = FALSE;
|
LOCAL_RetriesCounterOn = FALSE;
|
||||||
Yap_JumpToEnv(MkAtomTerm(AtomCallAndRetryCounter));
|
Yap_JumpToEnv(MkAtomTerm(AtomCallAndRetryCounter));
|
||||||
P = (yamop *)FAILCODE;
|
P = FAILCODE;
|
||||||
LOCAL_PrologMode &= ~InErrorMode;
|
LOCAL_PrologMode &= ~InErrorMode;
|
||||||
return (P);
|
return (P);
|
||||||
case RETRY_COUNTER_UNDERFLOW_EVENT:
|
case RETRY_COUNTER_UNDERFLOW_EVENT:
|
||||||
@ -659,11 +664,16 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
}
|
}
|
||||||
if (LOCAL_DoingUndefp) {
|
if (LOCAL_DoingUndefp) {
|
||||||
Yap_PrintWarning(error_t);
|
Yap_PrintWarning(error_t);
|
||||||
} else {
|
return P;
|
||||||
//memset(LOCAL_ActiveError, 0, sizeof(*LOCAL_ActiveError));
|
|
||||||
Yap_JumpToEnv(error_t);
|
|
||||||
}
|
}
|
||||||
P = (yamop *)FAILCODE;
|
//reset_error_description();
|
||||||
|
Yap_PutException(error_t);
|
||||||
|
fprintf(stderr,"HR before jmp=%p\n", HR);
|
||||||
|
if (throw)
|
||||||
|
LOCAL_BallTerm = Yap_StoreTermInDB(error_t, 5);
|
||||||
|
else
|
||||||
|
Yap_JumpToEnv(error_t);
|
||||||
|
fprintf(stderr,"HR after jmp=%p\n", HR);
|
||||||
LOCAL_PrologMode &= ~InErrorMode;
|
LOCAL_PrologMode &= ~InErrorMode;
|
||||||
return P;
|
return P;
|
||||||
}
|
}
|
||||||
|
3
C/eval.c
3
C/eval.c
@ -93,6 +93,7 @@ static Term get_matrix_element(Term t1, Term t2 USES_REGS) {
|
|||||||
static Term Eval(Term t USES_REGS) {
|
static Term Eval(Term t USES_REGS) {
|
||||||
|
|
||||||
if (IsVarTerm(t)) {
|
if (IsVarTerm(t)) {
|
||||||
|
fprintf(stderr,"HR before jmp=%p v=%p\n", HR, VarOfTerm(t));
|
||||||
Yap_ArithError(INSTANTIATION_ERROR, t, "in arithmetic");
|
Yap_ArithError(INSTANTIATION_ERROR, t, "in arithmetic");
|
||||||
} else if (IsNumTerm(t)) {
|
} else if (IsNumTerm(t)) {
|
||||||
return t;
|
return t;
|
||||||
@ -387,7 +388,7 @@ void Yap_EvalError__(const char *file, const char *function, int lineno,
|
|||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
Yap_ThrowError__(file, function, lineno, type, where, buf);
|
Yap_Error__(false, file, function, lineno, type, where, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
169
C/exec.c
169
C/exec.c
@ -1390,76 +1390,85 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
|
|||||||
LOCAL_CBorder = LCL0 - (CELL *)B;
|
LOCAL_CBorder = LCL0 - (CELL *)B;
|
||||||
sigjmp_buf signew, *sighold = LOCAL_RestartEnv;
|
sigjmp_buf signew, *sighold = LOCAL_RestartEnv;
|
||||||
LOCAL_RestartEnv = &signew;
|
LOCAL_RestartEnv = &signew;
|
||||||
|
REGSTORE *old_rs = Yap_regp;
|
||||||
|
|
||||||
if (top && (lval = sigsetjmp(signew, 1)) != 0) {
|
if (top && (lval = sigsetjmp(signew, 1)) != 0) {
|
||||||
switch (lval) {
|
switch (lval) {
|
||||||
case 1: { /* restart */
|
case 1: { /* restart */
|
||||||
/* otherwise, SetDBForThrow will fail entering critical mode */
|
/* otherwise, SetDBForThrow will fail entering critical mode */
|
||||||
LOCAL_PrologMode = UserMode;
|
LOCAL_PrologMode = UserMode;
|
||||||
/* find out where to cut to */
|
/* find out where to cut to */
|
||||||
/* siglongjmp resets the TR hardware register */
|
/* siglongjmp resets the TR hardware register */
|
||||||
/* TR and B are crucial, they might have been changed, or not */
|
/* TR and B are crucial, they might have been changed, or not */
|
||||||
restore_TR();
|
restore_TR();
|
||||||
restore_B();
|
restore_B();
|
||||||
/* H is not so important, because we're gonna backtrack */
|
/* H is not so important, because we're gonna backtrack */
|
||||||
restore_H();
|
restore_H();
|
||||||
/* set stack */
|
/* set stack */
|
||||||
ASP = (CELL *)PROTECT_FROZEN_B(B);
|
ASP = (CELL *) PROTECT_FROZEN_B(B);
|
||||||
/* forget any signals active, we're reborne */
|
/* forget any signals active, we're reborne */
|
||||||
LOCAL_Signals = 0;
|
LOCAL_Signals = 0;
|
||||||
CalculateStackGap(PASS_REGS1);
|
CalculateStackGap(PASS_REGS1);
|
||||||
LOCAL_PrologMode = UserMode;
|
LOCAL_PrologMode = UserMode;
|
||||||
P = (yamop *)FAILCODE;
|
P = (yamop *) FAILCODE;
|
||||||
} break;
|
}
|
||||||
case 2: {
|
break;
|
||||||
/* arithmetic exception */
|
case 2: {
|
||||||
/* must be done here, otherwise siglongjmp will clobber all the
|
/* arithmetic exception */
|
||||||
* registers
|
/* must be done here, otherwise siglongjmp will clobber all the
|
||||||
*/
|
* registers
|
||||||
/* reset the registers so that we don't have trash in abstract
|
*/
|
||||||
* machine */
|
/* reset the registers so that we don't have trash in abstract
|
||||||
Yap_set_fpu_exceptions(
|
* machine */
|
||||||
getAtomicGlobalPrologFlag(ARITHMETIC_EXCEPTIONS_FLAG));
|
Yap_set_fpu_exceptions(
|
||||||
P = (yamop *)FAILCODE;
|
getAtomicGlobalPrologFlag(ARITHMETIC_EXCEPTIONS_FLAG));
|
||||||
LOCAL_PrologMode = UserMode;
|
P = (yamop *) FAILCODE;
|
||||||
} break;
|
LOCAL_PrologMode = UserMode;
|
||||||
case 3: { /* saved state */
|
}
|
||||||
LOCAL_CBorder = OldBorder;
|
break;
|
||||||
LOCAL_RestartEnv = sighold;
|
case 3: { /* saved state */
|
||||||
return false;
|
LOCAL_CBorder = OldBorder;
|
||||||
}
|
LOCAL_RestartEnv = sighold;
|
||||||
case 4:
|
return false;
|
||||||
/* abort */
|
}
|
||||||
/* can be called from anywhere, must reset registers,
|
case 4:
|
||||||
*/
|
/* abort */
|
||||||
while (B) {
|
/* can be called from anywhere, must reset registers,
|
||||||
Yap_JumpToEnv(TermDAbort);
|
*/
|
||||||
|
while (B) {
|
||||||
|
Yap_JumpToEnv(TermDAbort);
|
||||||
|
}
|
||||||
|
LOCAL_PrologMode &= ~AbortMode;
|
||||||
|
P = (yamop *) FAILCODE;
|
||||||
|
LOCAL_RestartEnv = sighold;
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
// going up, unless there is no up to go to. or someone
|
||||||
|
// but we should inform the caller on what happened.
|
||||||
|
|
||||||
|
Yap_regp = old_rs;
|
||||||
|
fprintf(stderr,"HR before jmp=%p\n", HR);
|
||||||
|
Yap_JumpToEnv(0);
|
||||||
|
fprintf(stderr,"HR after jmp=%p\n", HR);
|
||||||
|
LOCAL_PrologMode = UserMode;
|
||||||
|
ASP = (CELL *) B;
|
||||||
|
if (B == NULL || B->cp_b == NULL || (CELL*)(B->cp_b) > LCL0 - LOCAL_CBorder) {
|
||||||
|
LOCAL_RestartEnv = sighold;
|
||||||
|
LOCAL_CBorder = OldBorder;
|
||||||
|
fprintf(stderr, "HR after sigset A=%p\n", HR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
fprintf(stderr, "HR after sigset=B %p\n", HR);
|
||||||
|
P = FAILCODE;
|
||||||
|
|
||||||
}
|
}
|
||||||
LOCAL_PrologMode &= ~AbortMode;
|
|
||||||
P = (yamop *)FAILCODE;
|
|
||||||
LOCAL_RestartEnv = sighold;
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
// going up, unless there is no up to go to. or someone
|
|
||||||
// but we should inform the caller on what happened.
|
|
||||||
if (B && B->cp_b && B->cp_b <= (choiceptr)(LCL0 - LOCAL_CBorder)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
LOCAL_RestartEnv = sighold;
|
|
||||||
LOCAL_PrologMode = UserMode;
|
|
||||||
LOCAL_CBorder = OldBorder;
|
|
||||||
return false;
|
|
||||||
default:
|
|
||||||
/* do nothing */
|
|
||||||
LOCAL_PrologMode = UserMode;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LOCAL_PrologMode = UserMode;
|
|
||||||
}
|
}
|
||||||
|
LOCAL_PrologMode = UserMode;
|
||||||
YENV = ASP;
|
YENV = ASP;
|
||||||
YENV[E_CB] = Unsigned(B);
|
YENV[E_CB] = Unsigned(B);
|
||||||
out = Yap_absmi(0);
|
out = Yap_absmi(0);
|
||||||
|
fprintf(stderr, "HR after absmi=%p\n", HR);
|
||||||
/* make sure we don't leave a FAIL signal hanging around */
|
/* make sure we don't leave a FAIL signal hanging around */
|
||||||
Yap_get_signal(YAP_FAIL_SIGNAL);
|
Yap_get_signal(YAP_FAIL_SIGNAL);
|
||||||
if (!Yap_has_a_signal())
|
if (!Yap_has_a_signal())
|
||||||
@ -1958,14 +1967,14 @@ static Int cut_up_to_next_disjunction(USES_REGS1) {
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the Prolog engine . If _Hard_ resèt the global stack_el. If
|
* Reset the Prolog engine . If _Hard_ resèt the global stack_el. If
|
||||||
* p_no_use_'soft_float keei
|
* p_no_use_'soft_float keei
|
||||||
*
|
*
|
||||||
* @param mode
|
* @param mode
|
||||||
* @param hard
|
* @param hard
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
bool Yap_Reset(yap_reset_t mode, bool hard) {
|
bool Yap_Reset(yap_reset_t mode, bool hard) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
@ -2008,7 +2017,7 @@ bool is_cleanup_cp(choiceptr cp_b) {
|
|||||||
return pe == PredSafeCallCleanup;
|
return pe == PredSafeCallCleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int JumpToEnv() {
|
static Int JumpToEnv() {
|
||||||
choiceptr handler = B;
|
choiceptr handler = B;
|
||||||
/* just keep the throwm object away, we don't need to care about it
|
/* just keep the throwm object away, we don't need to care about it
|
||||||
*/
|
*/
|
||||||
@ -2025,7 +2034,7 @@ static Int JumpToEnv() {
|
|||||||
if (LOCAL_PrologMode & AsyncIntMode) {
|
if (LOCAL_PrologMode & AsyncIntMode) {
|
||||||
Yap_signal(YAP_FAIL_SIGNAL);
|
Yap_signal(YAP_FAIL_SIGNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
B = handler;
|
B = handler;
|
||||||
P = FAILCODE;
|
P = FAILCODE;
|
||||||
return true;
|
return true;
|
||||||
@ -2033,6 +2042,7 @@ static Int JumpToEnv() {
|
|||||||
|
|
||||||
bool Yap_JumpToEnv(Term t) {
|
bool Yap_JumpToEnv(Term t) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
|
if (t)
|
||||||
LOCAL_BallTerm = Yap_StoreTermInDB(t, 0);
|
LOCAL_BallTerm = Yap_StoreTermInDB(t, 0);
|
||||||
if (!LOCAL_BallTerm)
|
if (!LOCAL_BallTerm)
|
||||||
return false;
|
return false;
|
||||||
@ -2181,6 +2191,7 @@ static Int jump_env(USES_REGS1) {
|
|||||||
t = Yap_PopTermFromDB(LOCAL_BallTerm);
|
t = Yap_PopTermFromDB(LOCAL_BallTerm);
|
||||||
}
|
}
|
||||||
LOCAL_BallTerm = NULL;
|
LOCAL_BallTerm = NULL;
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2201,20 +2212,30 @@ static Int jump_env(USES_REGS1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Yap_ResetException(int wid) {
|
bool Yap_ResetException(int wid) {
|
||||||
|
// reset errir descriptir
|
||||||
|
yap_error_descriptor_t *bf = REMOTE_ActiveError(wid)->top_error;
|
||||||
if (REMOTE_ActiveError(wid)->errorTerm) {
|
if (REMOTE_ActiveError(wid)->errorTerm) {
|
||||||
Yap_PopTermFromDB(REMOTE_ActiveError(wid)->errorTerm);
|
Yap_PopTermFromDB(REMOTE_ActiveError(wid)->errorTerm);
|
||||||
}
|
}
|
||||||
REMOTE_ActiveError(wid)->errorTerm = NULL;
|
memset(REMOTE_ActiveError(wid), 0, sizeof(*LOCAL_ActiveError));
|
||||||
|
REMOTE_ActiveError(wid)->top_error = bf;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int reset_exception(USES_REGS1) { return Yap_ResetException(worker_id); }
|
static Int reset_exception(USES_REGS1) { return Yap_ResetException(worker_id); }
|
||||||
|
|
||||||
static Int get_exception(USES_REGS1) {
|
static Int get_exception(USES_REGS1) {
|
||||||
|
fprintf(stderr,"HR befo get_xc=%p\n", HR);
|
||||||
Term t = Yap_GetException();
|
Term t = Yap_GetException();
|
||||||
if (t == 0)
|
fprintf(stderr,"HR befo get_xc=%p\n", HR);
|
||||||
|
if (t == 0)
|
||||||
return false;
|
return false;
|
||||||
return Yap_unify(t, ARG1);
|
Yap_DebugPlWriteln(t);
|
||||||
|
Yap_ResetException(worker_id);
|
||||||
|
fprintf(stderr,"HR after get_xc=%p\n", HR);
|
||||||
|
Int rc= Yap_unify(t, ARG1);
|
||||||
|
Yap_DebugPlWriteln(t);
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Yap_dogc(int extra_args, Term *tp USES_REGS) {
|
int Yap_dogc(int extra_args, Term *tp USES_REGS) {
|
||||||
|
2
C/qlyr.c
2
C/qlyr.c
@ -89,7 +89,7 @@ static void QLYR_ERROR__(const char *file, const char *function, int lineno,
|
|||||||
qlfr_err_t my_err) {
|
qlfr_err_t my_err) {
|
||||||
// __android_log_print(ANDROID_LOG_INFO, "YAP ", "error %s in saved state
|
// __android_log_print(ANDROID_LOG_INFO, "YAP ", "error %s in saved state
|
||||||
// %s",GLOBAL_RestoreFile, qlyr_error[my_err]);
|
// %s",GLOBAL_RestoreFile, qlyr_error[my_err]);
|
||||||
Yap_Error__(file, function, lineno, SYSTEM_ERROR_SAVED_STATE, TermNil, "error %s in saved state %s",
|
Yap_Error__(false, file, function, lineno, SYSTEM_ERROR_SAVED_STATE, TermNil, "error %s in saved state %s",
|
||||||
GLOBAL_RestoreFile, qlyr_error[my_err]);
|
GLOBAL_RestoreFile, qlyr_error[my_err]);
|
||||||
Yap_exit(1);
|
Yap_exit(1);
|
||||||
}
|
}
|
||||||
|
@ -1665,6 +1665,7 @@ static Term attvars_in_complex_term(register CELL *pt0, register CELL *pt0_end,
|
|||||||
++ pt0;
|
++ pt0;
|
||||||
ptd0 = pt0;
|
ptd0 = pt0;
|
||||||
d0 = *ptd0;
|
d0 = *ptd0;
|
||||||
|
fprintf(stderr,"d0=%lx in attvars after jmp=%p\n", d0, HR);
|
||||||
deref_head(d0, attvars_in_term_unk);
|
deref_head(d0, attvars_in_term_unk);
|
||||||
attvars_in_term_nvar:
|
attvars_in_term_nvar:
|
||||||
{
|
{
|
||||||
|
@ -402,16 +402,14 @@ Term Yap_eval_binary(Int, Term, Term);
|
|||||||
Term Yap_InnerEval__(Term USES_REGS);
|
Term Yap_InnerEval__(Term USES_REGS);
|
||||||
|
|
||||||
#define Yap_EvalError(id, t, ...) \
|
#define Yap_EvalError(id, t, ...) \
|
||||||
Yap_EvalError__(__FILE__, __FUNCTION__, __LINE__, id, t, __VA_ARGS__)
|
Yap_ThrowError__(__FILE__, __FUNCTION__, __LINE__, id, t, __VA_ARGS__)
|
||||||
void Yap_EvalError__(const char *, const char *, int, yap_error_number, Term,
|
|
||||||
...);
|
|
||||||
|
|
||||||
#define Yap_ArithError(id, t, ...) \
|
#define Yap_ArithError(id, t, ...) \
|
||||||
Yap_ThrowError__(__FILE__, __FUNCTION__, __LINE__, id, t, __VA_ARGS__)
|
Yap_ThrowError__(__FILE__, __FUNCTION__, __LINE__, id, t, __VA_ARGS__)
|
||||||
#define Yap_BinError(id) \
|
#define Yap_BinError(id) \
|
||||||
Yap_Error__(__FILE__, __FUNCTION__, __LINE__, id, 0L, "")
|
Yap_Error__(false, __FILE__, __FUNCTION__, __LINE__, id, 0L, "")
|
||||||
#define Yap_AbsmiError(id) \
|
#define Yap_AbsmiError(id) \
|
||||||
Yap_Error__(__FILE__, __FUNCTION__, __LINE__, id, 0L, "")
|
Yap_Error__(false, __FILE__, __FUNCTION__, __LINE__, id, 0L, "")
|
||||||
|
|
||||||
|
|
||||||
#include "inline-only.h"
|
#include "inline-only.h"
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
Yap_InitError__(const char *file, const char *function, int lineno,
|
Yap_InitError__(const char *file, const char *function, int lineno,
|
||||||
yap_error_number e, YAP_Term g, ...);
|
yap_error_number e, YAP_Term g, ...);
|
||||||
|
|
||||||
extern struct yami *Yap_Error__(const char *file, const char *function,
|
extern struct yami *Yap_Error__(bool thrw, const char *file, const char *function,
|
||||||
int lineno, yap_error_number err,
|
int lineno, yap_error_number err,
|
||||||
YAP_Term wheret, ...);
|
YAP_Term wheret, ...);
|
||||||
|
|
||||||
@ -53,13 +53,13 @@ extern void Yap_ThrowError__(const char *file, const char *function, int lineno,
|
|||||||
;
|
;
|
||||||
|
|
||||||
#define Yap_NilError(id, ...) \
|
#define Yap_NilError(id, ...) \
|
||||||
Yap_Error__(__FILE__, __FUNCTION__, __LINE__, id, TermNil, __VA_ARGS__)
|
Yap_Error__(false,__FILE__, __FUNCTION__, __LINE__, id, TermNil, __VA_ARGS__)
|
||||||
|
|
||||||
#define Yap_InitError(id, ...) \
|
#define Yap_InitError(id, ...) \
|
||||||
Yap_InitError__(__FILE__, __FUNCTION__, __LINE__, id, TermNil, __VA_ARGS__)
|
Yap_InitError__(__FILE__, __FUNCTION__, __LINE__, id, TermNil, __VA_ARGS__)
|
||||||
|
|
||||||
#define Yap_Error(id, inp, ...) \
|
#define Yap_Error(id, inp, ...) \
|
||||||
Yap_Error__(__FILE__, __FUNCTION__, __LINE__, id, inp, __VA_ARGS__)
|
Yap_Error__(false,__FILE__, __FUNCTION__, __LINE__, id, inp, __VA_ARGS__)
|
||||||
|
|
||||||
#define Yap_ThrowError(id, inp, ...) \
|
#define Yap_ThrowError(id, inp, ...) \
|
||||||
Yap_ThrowError__(__FILE__, __FUNCTION__, __LINE__, id, inp, __VA_ARGS__)
|
Yap_ThrowError__(__FILE__, __FUNCTION__, __LINE__, id, inp, __VA_ARGS__)
|
||||||
@ -80,11 +80,11 @@ INLINE_ONLY extern inline Term Yap_ensure_atom__(const char *fu, const char *fi,
|
|||||||
if (!IsVarTerm(t) && IsAtomTerm(t))
|
if (!IsVarTerm(t) && IsAtomTerm(t))
|
||||||
return t;
|
return t;
|
||||||
if (IsVarTerm(t)) {
|
if (IsVarTerm(t)) {
|
||||||
Yap_Error__(fu, fi, line, INSTANTIATION_ERROR, t, NULL);
|
Yap_Error__(false,fu, fi, line, INSTANTIATION_ERROR, t, NULL);
|
||||||
} else {
|
} else {
|
||||||
if (IsAtomTerm(t))
|
if (IsAtomTerm(t))
|
||||||
return t;
|
return t;
|
||||||
Yap_Error__(fu, fi, line, TYPE_ERROR_ATOM, t, NULL);
|
Yap_Error__(false,fu, fi, line, TYPE_ERROR_ATOM, t, NULL);
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ Int PlIOError__(const char *file, const char *function, int lineno,
|
|||||||
who[0] = '\0';
|
who[0] = '\0';
|
||||||
}
|
}
|
||||||
va_end(args);
|
va_end(args);
|
||||||
Yap_Error__(file, function, lineno, type, culprit, who);
|
Yap_Error__(false, file, function, lineno, type, culprit, who);
|
||||||
/* and fail */
|
/* and fail */
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -1574,8 +1574,7 @@ int Yap_OpenStream(const char *fname, const char* io_mode, Term user_name, encod
|
|||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
int sno;
|
int sno;
|
||||||
StreamDesc *st;
|
StreamDesc *st;
|
||||||
struct vfs *vfsp = NULL;
|
struct vfs *vfsp;
|
||||||
FILE *fd = NULL;
|
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
sno = GetFreeStreamD();
|
sno = GetFreeStreamD();
|
||||||
@ -1599,7 +1598,7 @@ int Yap_OpenStream(const char *fname, const char* io_mode, Term user_name, encod
|
|||||||
user_name = st->user_name;
|
user_name = st->user_name;
|
||||||
} else {
|
} else {
|
||||||
st->file = fopen(fname, io_mode);
|
st->file = fopen(fname, io_mode);
|
||||||
if (fd == NULL) {
|
if (st->file == NULL) {
|
||||||
if (!strchr(io_mode, 'b') && binary_file(fname)) {
|
if (!strchr(io_mode, 'b') && binary_file(fname)) {
|
||||||
UNLOCK(st->streamlock);
|
UNLOCK(st->streamlock);
|
||||||
if (errno == ENOENT && !strchr(io_mode, 'r')) {
|
if (errno == ENOENT && !strchr(io_mode, 'r')) {
|
||||||
|
@ -4470,7 +4470,7 @@ add_search_path(Path, Dir) :-
|
|||||||
% =CLASSPATH=, etc.
|
% =CLASSPATH=, etc.
|
||||||
|
|
||||||
search_path_separator((;)) :-
|
search_path_separator((;)) :-
|
||||||
current_prolog_flag(windo/.... ,,,,,,,,,,,,,,,,,, :l'p[KIO)_"?ws, true), !.
|
current_prolog_flag(windows, true), !.
|
||||||
search_path_separator(:).
|
search_path_separator(:).
|
||||||
|
|
||||||
/*******************************
|
/*******************************
|
||||||
@ -4503,7 +4503,8 @@ location( java_root, _, Home) :-
|
|||||||
getenv( 'JAVA_HOME', Home ).
|
getenv( 'JAVA_HOME', Home ).
|
||||||
location(java_root, _, JRE) :-
|
location(java_root, _, JRE) :-
|
||||||
% OS well-known
|
% OS well-known
|
||||||
member(Root, [ '/usr/lib',
|
member(Root, [
|
||||||
|
/System/Library/Frameworks/JavaVM.framework/Versions/A/JavaV '/usr/lib',
|
||||||
'/usr/local/lib',
|
'/usr/local/lib',
|
||||||
'/opt/lib',
|
'/opt/lib',
|
||||||
'/Library/Java/JavaVirtualMachines',
|
'/Library/Java/JavaVirtualMachines',
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
set(CMAKE_MACOSX_RPATH 1)
|
||||||
|
|
||||||
add_lib(jplYap jpl.h jpl.c hacks.h)
|
add_lib(jplYap jpl.h jpl.c hacks.h)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user