fix syntax error essages

WITH_PACKAGES
This commit is contained in:
Vitor Santos Costa
2018-10-23 10:09:17 +01:00
parent 5f989e58b2
commit eed36e99a6
5 changed files with 54 additions and 46 deletions

View File

@@ -77,7 +77,7 @@ static void kill_first_log_iblock(LogUpdIndex *, LogUpdIndex *, PredEntry *);
static void InitConsultStack(void) {
CACHE_REGS
LOCAL_ConsultLow = (consult_obj *)Yap_AllocCodeSpace(sizeof(consult_obj) *
InitialConsultCapacity);
InitialConsultCapacity);
if (LOCAL_ConsultLow == NULL) {
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, "No Heap Space in InitCodes");
return;
@@ -94,20 +94,32 @@ void Yap_ResetConsultStack(void) {
LOCAL_ConsultCapacity = InitialConsultCapacity;
}
/**
* Are we compiling a file?
*
*/
bool Yap_Consulting(USES_REGS1) {
return LOCAL_ConsultBase != NULL
&& LOCAL_ConsultSp != LOCAL_ConsultLow+LOCAL_ConsultCapacity;
}
/******************************************************************
ADDING AND REMOVE INFO TO A PROCEDURE
******************************************************************/
/*
* we have three kinds of predicates: dynamic DynamicPredFlag
* static CompiledPredFlag fast FastPredFlag all the
/**
* we have three kinds of predicates:
* + dynamic DynamicPredFlag
* + static CompiledPredFlag fast
* + fast FastPredFlag.
*
* all the
* database predicates are supported for dynamic predicates only abolish and
* assertz are supported for static predicates no database predicates are
* supportted for fast predicates
*/
PredEntry *Yap_get_pred(Term t, Term tmod, const char *pname) {
Term t0 = t;
@@ -251,9 +263,9 @@ void Yap_BuildMegaClause(PredEntry *ap) {
if (ap->PredFlags & (DynamicPredFlag | LogUpdatePredFlag | MegaClausePredFlag
#ifdef TABLING
| TabledPredFlag
| TabledPredFlag
#endif /* TABLING */
| UDIPredFlag) ||
| UDIPredFlag) ||
ap->cs.p_code.FirstClause == NULL || ap->cs.p_code.NOfClauses < 16) {
return;
}

View File

@@ -679,6 +679,7 @@ bool Yap_MkErrorRecord(yap_error_descriptor_t *r, const char *file,
r->errorLine = lineno;
r->errorFunction = function;
r->errorFile = file;
r->prologConsulting = Yap_Consulting();
LOCAL_PrologMode |= InErrorMode;
Yap_ClearExs();
// first, obtain current location
@@ -1034,7 +1035,7 @@ static Int print_exception(USES_REGS1) {
static Int query_exception(USES_REGS1) {
const char *query;
const char *query = NULL;
Term t;
if (IsAtomTerm((t = Deref(ARG1))))
@@ -1045,13 +1046,13 @@ static Int query_exception(USES_REGS1) {
return false;
yap_error_descriptor_t *y = AddressOfTerm(Deref(ARG2));
Term t3 = Deref(ARG3);
if (IsVarTerm(t3)) {
//if (IsVarTerm(t3)) {
Term rc = queryErr(query, y);
// Yap_DebugPlWriteln(rc);
return Yap_unify(ARG3, rc);
} else {
return setErr(query, y, t3);
}
// } else {
// return setErr(query, y, t3);
// }
}
@@ -1261,7 +1262,7 @@ static Int is_predicate_indicator(USES_REGS1) {
void Yap_InitErrorPreds(void) {
CACHE_REGS
Yap_InitCPred("$print_exception", 1, print_exception, 0);
Yap_InitCPred("$print_exception<", 1, print_exception, 0);
Yap_InitCPred("$reset_exception", 1, reset_exception, 0);
Yap_InitCPred("$new_exception", 1, new_exception, 0);
Yap_InitCPred("$get_exception", 1, get_exception, 0);