From 3bf897c50313356ae3a499a3fadb62e1f265af42 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Tue, 3 Jul 2018 12:42:33 +0100 Subject: [PATCH] more --- C/errors.c | 9 ++++++--- CXX/yapt.hh | 2 +- H/YapGFlagInfo.h | 6 ++++++ packages/myddas/pl/myddas.ypp | 1 + pl/imports.yap | 3 +++ 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/C/errors.c b/C/errors.c index ca856b98c..3abd55edb 100755 --- a/C/errors.c +++ b/C/errors.c @@ -95,8 +95,8 @@ static bool setErr(const char *q, yap_error_descriptor_t *i, Term t) { } #define query_key_s(k, ks, q, i) \ - if (strcmp(ks, q) == 0) { \ - return MkAtomTerm(Yap_LookupAtom(i->k)); } + if (strcmp(ks, q) == 0 && i->k) { \ + return MkAtomTerm(Yap_LookupAtom(i->k)); } else {return TermNil;} #define query_key_t(k, ks, q, i) \ if (strcmp(ks, q) == 0) { \ @@ -986,8 +986,11 @@ static Int reset_exception(USES_REGS1) { return Yap_ResetException(worker_id); } Term MkErrorTerm(yap_error_descriptor_t *t) { if (t->errorClass == EVENT) return t->errorRawTerm; + Term tc = t->culprit ? Yap_BufferToTerm(t->culprit, TermNil) : TermNil; + if (tc == 0) + tc = MkAtomTerm(Yap_LookupAtom(t->culprit)); return mkerrort(t->errorNo, - t->culprit ? Yap_BufferToTerm(t->culprit, TermNil) : TermNil, + tc, err2list(t)); } diff --git a/CXX/yapt.hh b/CXX/yapt.hh index c56562c8c..d841e9cbc 100644 --- a/CXX/yapt.hh +++ b/CXX/yapt.hh @@ -117,7 +117,7 @@ public: /// numbervars ( int start, bool process=false ) intptr_t numberVars(intptr_t start, bool skip_singletons = false); inline Term term() { - return gt(); + return Deref(gt()); } /// from YAPTerm to Term (internal YAP representation) YAPTerm arg(int i) { BACKUP_MACHINE_REGS(); diff --git a/H/YapGFlagInfo.h b/H/YapGFlagInfo.h index 4633ab29a..0e626dd11 100644 --- a/H/YapGFlagInfo.h +++ b/H/YapGFlagInfo.h @@ -159,6 +159,12 @@ opportunity. Initial value is 10,000. May be changed. A value of 0 NULL), YAP_FLAG(DEBUGGER_SHOW_CONTEXT_FLAG, "debugger_show_context", true, booleanFlag, "false", NULL), + YAP_FLAG(DEFAULT_PARENT_MODULE_FLAG, "default_parent_module", true, isatom, "user", NULL), + /**< + * A module to be inherited by all other modules. Default is user that reexports prolog. + * + * Set it to `prolog` for SICStus Prolog like resolution, to `user` for SWI-like. + */ YAP_FLAG(DIALECT_FLAG, "dialect", false, ro, "yap", NULL), /**< diff --git a/packages/myddas/pl/myddas.ypp b/packages/myddas/pl/myddas.ypp index 991bfff14..0cd260b4d 100644 --- a/packages/myddas/pl/myddas.ypp +++ b/packages/myddas/pl/myddas.ypp @@ -181,6 +181,7 @@ member/2 ]). +:- set(verbose,silent). diff --git a/pl/imports.yap b/pl/imports.yap index fea7ba8d0..46dc2a7f6 100644 --- a/pl/imports.yap +++ b/pl/imports.yap @@ -38,6 +38,9 @@ '$get_undefined_predicates'(G, ImportingMod, G0, ExportingMod) :- '$parent_module'(ImportingMod,ExportingModI), '$continue_imported'(ExportingMod, ExportingModI, G0, G). +'$get_undefined_predicates'(G, ImportingMod, G0, ExportingMod) :- + yap_flag(default_parent_module,ExportingModI), + '$continue_imported'(ExportingMod, ExportingModI, G0, G). '$get_undefined_pred'(G, ImportingMod, G0, ExportingMod) :- '$get_undefined_predicates'(G, ImportingMod, G0, ExportingMod),