From df8b264751d491d6bb65badfefa2d3eee3045dcf Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Tue, 20 Sep 2016 22:53:33 -0500 Subject: [PATCH] meta stuff --- H/Yatom.h | 3 ++- include/YapInterface.h | 4 ++-- library/dialect/swi/fli/swi.c | 19 ++++++++++++------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/H/Yatom.h b/H/Yatom.h index 05aef0d23..ec81e38bd 100755 --- a/H/Yatom.h +++ b/H/Yatom.h @@ -620,7 +620,8 @@ typedef struct pred_entry { #ifdef BEAM struct Predicates *beamTable; #endif - Term ModuleOfPred; /* module for this definition */ + struct yami *MetaEntryOfPred; /* allow direct access from meta-calls */ + Term ModuleOfPred; /* module for this definition */ UInt TimeStampOfPred; timestamp_type LastCallOfPred; /* This must be at an odd number of cells, otherwise it diff --git a/include/YapInterface.h b/include/YapInterface.h index 86fa96f4c..f9ac6c343 100755 --- a/include/YapInterface.h +++ b/include/YapInterface.h @@ -1896,14 +1896,14 @@ extern X_API YAP_PredEntryPtr YAP_FunctorToPredInModule(YAP_Functor, extern X_API YAP_PredEntryPtr YAP_AtomToPredInModule(YAP_Atom, YAP_Module); /* int YAP_EnterGoal(void) */ -extern X_API YAP_Bool YAP_EnterGoal(YAP_PredEntryPtr, YAP_handle_t, +extern X_API YAP_Bool YAP_EnterGoal(YAP_PredEntryPtr, YAP_Term *, YAP_dogoalinfo *); /* int YAP_RetryGoal(void) */ extern X_API YAP_Bool YAP_RetryGoal(YAP_dogoalinfo *); /* int YAP_LeaveGoal(void) */ -extern X_API YAP_Bool YAP_LeaveGoal(int, YAP_dogoalinfo *); +extern X_API YAP_Bool YAP_LeaveGoal(bool, YAP_dogoalinfo *); /* int YAP_GoalHasException(YAP_Term *) */ extern X_API YAP_Bool YAP_GoalHasException(YAP_Term *); diff --git a/library/dialect/swi/fli/swi.c b/library/dialect/swi/fli/swi.c index 53148e037..d16eae86e 100755 --- a/library/dialect/swi/fli/swi.c +++ b/library/dialect/swi/fli/swi.c @@ -32,11 +32,14 @@ Moyle. All rights reserved. #include #include +#include "swi.h" #include + +#include + #include #include -#include "swi.h" #if HAVE_MATH_H #include #endif @@ -254,10 +257,10 @@ X_API int PL_unify_chars(term_t l, int flags, size_t length, const char *s) { if (flags & REP_UTF8) { inp.val.c0 = s; - inp.type = YAP_STRING_CHARS|ENC_ISO_LATIN1; + inp.type = YAP_STRING_CHARS | ENC_ISO_LATIN1; if (length != (size_t)-1) { inp.type |= YAP_STRING_NCHARS; - } + } } if (flags & PL_ATOM) { out.type = YAP_STRING_ATOM; @@ -1976,7 +1979,8 @@ X_API int PL_is_pair(term_t ts) { X_API int PL_skip_list(term_t list, term_t tail, size_t *len) { CACHE_REGS - Term *l = Yap_AddressFromSlot(list); + Term t0 = Yap_GetFromSlot(list); + Term *l = &t0; Term *t; intptr_t length; @@ -2412,14 +2416,15 @@ X_API int PL_next_solution(qid_t qi) { return 0; // don't forget, on success these guys must create slots if (qi->q_state == 0) { - result = YAP_EnterGoal((YAP_PredEntryPtr)qi->q_pe, qi->q_g, &qi->q_h); + result = YAP_EnterGoal((YAP_PredEntryPtr)qi->q_pe, + Yap_GetPtrFromHandle(qi->q_g), &qi->q_h); } else { LOCAL_AllowRestart = qi->q_open; result = YAP_RetryGoal(&qi->q_h); } qi->q_state = 1; if (result == 0) { - YAP_LeaveGoal(FALSE, &qi->q_h); + YAP_LeaveGoal(false, &qi->q_h); qi->q_open = 0; } return result; @@ -2430,7 +2435,7 @@ X_API void PL_cut_query(qid_t qi) { if (qi->q_open != 1 || qi->q_state == 0) return; - YAP_LeaveGoal(FALSE, &qi->q_h); + YAP_LeaveGoal(false, &qi->q_h); qi->q_open = 0; LOCAL_execution = qi->oq; Yap_FreeCodeSpace((char *)qi);