From 7651f507c69e233c472184ed75ea778a1658dc13 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Mon, 1 Aug 2016 17:48:43 -0500 Subject: [PATCH] error handling --- C/cdmgr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/C/cdmgr.c b/C/cdmgr.c index 232a462b1..66c63cc9b 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -1697,6 +1697,9 @@ bool Yap_addclause(Term t, yamop *cp, Term tmode, Term mod, Term *t4ref) mode = asserta; } else if (tmode == TermAssertzStatic) { mode = assertz; + } else { + Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, tmode, + "compilation mode used to assert") return false; } if (IsApplTerm(t) && FunctorOfTerm(t) == FunctorAssert) tf = ArgOfTerm(1, t); @@ -1862,7 +1865,8 @@ bool Yap_addclause(Term t, yamop *cp, Term tmode, Term mod, Term *t4ref) } else { tf = Yap_MkStaticRefTerm(ClauseCodeToStaticClause(cp), p); } - __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "add %s/%ld %p", RepAtom(at)->StrOfAE, Arity); + __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "add %s/%ld %p", + RepAtom(at)->StrOfAE, Arity); if (mod == PROLOG_MODULE) mod = TermProlog; if (pflags & MultiFileFlag) {