error_handling
This commit is contained in:
parent
c9babdd03e
commit
3de5b2c2de
@ -1 +0,0 @@
|
||||
M-x
|
@ -1100,7 +1100,7 @@ atom_concat2( USES_REGS1 )
|
||||
error:
|
||||
/* Error handling */
|
||||
if (LOCAL_Error_TYPE) {
|
||||
if (Yap_HandleError( "string_code/3" )) {
|
||||
if (Yap_HandleError( "atom_concat/2" )) {
|
||||
goto restart_aux;
|
||||
} else {
|
||||
return FALSE;
|
||||
|
22
C/errors.c
22
C/errors.c
@ -163,7 +163,7 @@ bool Yap_PrintWarning(Term twarning) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
int Yap_HandleError(const char *s, ...) {
|
||||
bool Yap_HandleError__(const char *file, const char *function, int lineno, const char *s, ...) {
|
||||
CACHE_REGS
|
||||
yap_error_number err = LOCAL_Error_TYPE;
|
||||
const char *serr;
|
||||
@ -177,28 +177,28 @@ int Yap_HandleError(const char *s, ...) {
|
||||
switch (err) {
|
||||
case RESOURCE_ERROR_STACK:
|
||||
if (!Yap_gc(2, ENV, gc_P(P, CP))) {
|
||||
Yap_Error(RESOURCE_ERROR_STACK, ARG1, serr);
|
||||
return (FALSE);
|
||||
Yap_Error__(file, function, lineno, RESOURCE_ERROR_STACK, ARG1, serr);
|
||||
return false;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
case RESOURCE_ERROR_AUXILIARY_STACK:
|
||||
if (LOCAL_MAX_SIZE < (char *)AuxSp - AuxBase) {
|
||||
LOCAL_MAX_SIZE += 1024;
|
||||
}
|
||||
if (!Yap_ExpandPreAllocCodeSpace(0, NULL, TRUE)) {
|
||||
/* crash in flames */
|
||||
Yap_Error(RESOURCE_ERROR_AUXILIARY_STACK, ARG1, serr);
|
||||
return FALSE;
|
||||
Yap_Error__(file, function, lineno, RESOURCE_ERROR_AUXILIARY_STACK, ARG1, serr);
|
||||
return false;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
case RESOURCE_ERROR_HEAP:
|
||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||
Yap_Error(RESOURCE_ERROR_HEAP, ARG2, serr);
|
||||
return FALSE;
|
||||
Yap_Error__(file, function, lineno, RESOURCE_ERROR_HEAP, ARG2, serr);
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
Yap_Error(err, LOCAL_Error_Term, serr);
|
||||
return (FALSE);
|
||||
Yap_Error__(file, function, lineno, err, LOCAL_Error_Term, serr);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,8 @@ void Yap_RestartYap(int);
|
||||
void Yap_exit(int);
|
||||
bool Yap_Warning(const char *s, ...);
|
||||
bool Yap_PrintWarning(Term t);
|
||||
int Yap_HandleError(const char *msg, ...);
|
||||
bool Yap_HandleError__(const char *file, const char *function, int lineno, const char *s, ...);
|
||||
#define Yap_HandleError(...) Yap_HandleError__(__FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
int Yap_SWIHandleError(const char *, ...);
|
||||
void Yap_InitErrorPreds(void);
|
||||
|
||||
|
Reference in New Issue
Block a user