Merge branch 'master' of ssh://git.dcc.fc.up.pt/yap-6.3
Conflicts: library/matrix.yap pl/qly.yap
This commit is contained in:
commit
66a95e96c0
@ -2358,7 +2358,7 @@ YAP_LeaveGoal(int backtrack, YAP_dogoalinfo *dgi)
|
|||||||
/* if backtracking asked for, recover space and bindings */
|
/* if backtracking asked for, recover space and bindings */
|
||||||
if (backtrack) {
|
if (backtrack) {
|
||||||
P = FAILCODE;
|
P = FAILCODE;
|
||||||
Yap_exec_absmi(TRUE);
|
Yap_exec_absmi( true, YAP_EXEC_ABSMI);
|
||||||
/* recover stack space */
|
/* recover stack space */
|
||||||
HR = B->cp_h;
|
HR = B->cp_h;
|
||||||
TR = B->cp_tr;
|
TR = B->cp_tr;
|
||||||
@ -2560,7 +2560,7 @@ YAP_RestartGoal(void)
|
|||||||
if (LOCAL_AllowRestart) {
|
if (LOCAL_AllowRestart) {
|
||||||
P = (yamop *)FAILCODE;
|
P = (yamop *)FAILCODE;
|
||||||
LOCAL_PrologMode = UserMode;
|
LOCAL_PrologMode = UserMode;
|
||||||
out = Yap_exec_absmi(TRUE);
|
out = Yap_exec_absmi(TRUE, YAP_EXEC_ABSMI);
|
||||||
LOCAL_PrologMode = UserCCallMode;
|
LOCAL_PrologMode = UserCCallMode;
|
||||||
if (out == FALSE) {
|
if (out == FALSE) {
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
@ -2599,7 +2599,7 @@ YAP_ShutdownGoal(int backtrack)
|
|||||||
B = cut_pt;
|
B = cut_pt;
|
||||||
if (backtrack) {
|
if (backtrack) {
|
||||||
P = FAILCODE;
|
P = FAILCODE;
|
||||||
Yap_exec_absmi(TRUE);
|
Yap_exec_absmi(TRUE, YAP_EXEC_ABSMI);
|
||||||
/* recover stack space */
|
/* recover stack space */
|
||||||
HR = cut_pt->cp_h;
|
HR = cut_pt->cp_h;
|
||||||
TR = cut_pt->cp_tr;
|
TR = cut_pt->cp_tr;
|
||||||
@ -2626,7 +2626,7 @@ YAP_ContinueGoal(void)
|
|||||||
BACKUP_MACHINE_REGS();
|
BACKUP_MACHINE_REGS();
|
||||||
|
|
||||||
LOCAL_PrologMode = UserMode;
|
LOCAL_PrologMode = UserMode;
|
||||||
out = Yap_exec_absmi(TRUE);
|
out = Yap_exec_absmi(TRUE, YAP_EXEC_ABSMI);
|
||||||
LOCAL_PrologMode = UserCCallMode;
|
LOCAL_PrologMode = UserCCallMode;
|
||||||
|
|
||||||
RECOVER_MACHINE_REGS();
|
RECOVER_MACHINE_REGS();
|
||||||
@ -2936,7 +2936,7 @@ do_bootfile (char *bootfilename)
|
|||||||
fprintf(stderr, "%s", ErrorMessage);
|
fprintf(stderr, "%s", ErrorMessage);
|
||||||
}
|
}
|
||||||
/* do backtrack */
|
/* do backtrack */
|
||||||
YAP_Reset();
|
YAP_Reset( YAP_FULL_RESET );
|
||||||
}
|
}
|
||||||
YAP_EndConsult(bootfile);
|
YAP_EndConsult(bootfile);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
@ -3268,7 +3268,7 @@ YAP_CompareTerms(Term t1, Term t2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
X_API int
|
X_API int
|
||||||
YAP_Reset(void)
|
YAP_Reset(yap_reset_t mode)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
int res = TRUE;
|
int res = TRUE;
|
||||||
@ -3278,9 +3278,10 @@ YAP_Reset(void)
|
|||||||
/* first, backtrack to the root */
|
/* first, backtrack to the root */
|
||||||
while (B->cp_b) {
|
while (B->cp_b) {
|
||||||
B = B->cp_b;
|
B = B->cp_b;
|
||||||
P = FAILCODE;
|
|
||||||
res = Yap_exec_absmi(0);
|
|
||||||
}
|
}
|
||||||
|
// B shoul lead to CP with _ystop0,,
|
||||||
|
P = FAILCODE;
|
||||||
|
res = Yap_exec_absmi( true, mode );
|
||||||
/* reinitialise the engine */
|
/* reinitialise the engine */
|
||||||
// Yap_InitYaamRegs( worker_id );
|
// Yap_InitYaamRegs( worker_id );
|
||||||
GLOBAL_Initialised = TRUE;
|
GLOBAL_Initialised = TRUE;
|
||||||
|
30
C/cdmgr.c
30
C/cdmgr.c
@ -3407,6 +3407,35 @@ p_set_pred_module( USES_REGS1 )
|
|||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Int
|
||||||
|
p_set_pred_owner( USES_REGS1 )
|
||||||
|
{ /* '$set_pred_module'(+P,+File) */
|
||||||
|
PredEntry *pe;
|
||||||
|
Term a2 = Deref( ARG2 );
|
||||||
|
|
||||||
|
pe = get_pred(Deref(ARG1), CurrentModule, "set_pred_module/1");
|
||||||
|
if (EndOfPAEntr(pe))
|
||||||
|
return FALSE;
|
||||||
|
PELOCK(35,pe);
|
||||||
|
if (pe->PredFlags & (UserCPredFlag|CArgsPredFlag|NumberDBPredFlag|AtomDBPredFlag|TestPredFlag|AsmPredFlag|CPredFlag|BinaryPredFlag)) {
|
||||||
|
UNLOCKPE(56,pe);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (IsVarTerm(a2)) {
|
||||||
|
Yap_Error(INSTANTIATION_ERROR, a2, "load_files/2");
|
||||||
|
UNLOCKPE(56,pe);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (!IsAtomTerm(a2)) {
|
||||||
|
Yap_Error(TYPE_ERROR_ATOM, a2, "load_files/2");
|
||||||
|
UNLOCKPE(56,pe);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
pe->src.OwnerFile = AtomOfTerm(a2);
|
||||||
|
UNLOCKPE(56,pe);
|
||||||
|
return(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
p_undefined( USES_REGS1 )
|
p_undefined( USES_REGS1 )
|
||||||
{ /* '$undefined'(P,Mod) */
|
{ /* '$undefined'(P,Mod) */
|
||||||
@ -6659,6 +6688,7 @@ Yap_InitCdMgr(void)
|
|||||||
Yap_InitCPred("$call_count_reset", 0, p_call_count_reset, SafePredFlag|SyncPredFlag);
|
Yap_InitCPred("$call_count_reset", 0, p_call_count_reset, SafePredFlag|SyncPredFlag);
|
||||||
Yap_InitCPred("$toggle_static_predicates_in_use", 0, p_toggle_static_predicates_in_use, SafePredFlag|SyncPredFlag);
|
Yap_InitCPred("$toggle_static_predicates_in_use", 0, p_toggle_static_predicates_in_use, SafePredFlag|SyncPredFlag);
|
||||||
Yap_InitCPred("$set_pred_module", 2, p_set_pred_module, SafePredFlag);
|
Yap_InitCPred("$set_pred_module", 2, p_set_pred_module, SafePredFlag);
|
||||||
|
Yap_InitCPred("$set_pred_owner", 2, p_set_pred_owner, SafePredFlag);
|
||||||
Yap_InitCPred("$parent_pred", 3, p_parent_pred, SafePredFlag);
|
Yap_InitCPred("$parent_pred", 3, p_parent_pred, SafePredFlag);
|
||||||
Yap_InitCPred("$system_predicate", 2, p_system_pred, SafePredFlag);
|
Yap_InitCPred("$system_predicate", 2, p_system_pred, SafePredFlag);
|
||||||
Yap_InitCPred("$all_system_predicate", 3, p_all_system_pred, SafePredFlag);
|
Yap_InitCPred("$all_system_predicate", 3, p_all_system_pred, SafePredFlag);
|
||||||
|
14
C/exec.c
14
C/exec.c
@ -1046,7 +1046,7 @@ p_pred_goal_expansion_on( USES_REGS1 ) {
|
|||||||
|
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
exec_absmi(int top USES_REGS)
|
exec_absmi(bool top, yap_reset_t reset_mode USES_REGS)
|
||||||
{
|
{
|
||||||
int lval, out;
|
int lval, out;
|
||||||
|
|
||||||
@ -1152,7 +1152,7 @@ Yap_PrepGoal(UInt arity, CELL *pt, choiceptr saved_b USES_REGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
do_goal(yamop *CodeAdr, int arity, CELL *pt, int top USES_REGS)
|
do_goal(yamop *CodeAdr, int arity, CELL *pt, bool top USES_REGS)
|
||||||
{
|
{
|
||||||
choiceptr saved_b = B;
|
choiceptr saved_b = B;
|
||||||
Int out;
|
Int out;
|
||||||
@ -1161,7 +1161,7 @@ do_goal(yamop *CodeAdr, int arity, CELL *pt, int top USES_REGS)
|
|||||||
P = (yamop *) CodeAdr;
|
P = (yamop *) CodeAdr;
|
||||||
S = CellPtr (RepPredProp (PredPropByFunc (Yap_MkFunctor(AtomCall, 1),0))); /* A1 mishaps */
|
S = CellPtr (RepPredProp (PredPropByFunc (Yap_MkFunctor(AtomCall, 1),0))); /* A1 mishaps */
|
||||||
|
|
||||||
out = exec_absmi(top PASS_REGS);
|
out = exec_absmi(top, YAP_EXEC_ABSMI PASS_REGS);
|
||||||
Yap_flush();
|
Yap_flush();
|
||||||
// if (out) {
|
// if (out) {
|
||||||
// out = Yap_GetFromSlot(sl);
|
// out = Yap_GetFromSlot(sl);
|
||||||
@ -1171,10 +1171,10 @@ do_goal(yamop *CodeAdr, int arity, CELL *pt, int top USES_REGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Int
|
Int
|
||||||
Yap_exec_absmi(int top)
|
Yap_exec_absmi(bool top, yap_reset_t has_reset)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
return exec_absmi(top PASS_REGS);
|
return exec_absmi(top, has_reset PASS_REGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1191,7 +1191,7 @@ Yap_execute_pred(PredEntry *ppe, CELL *pt USES_REGS)
|
|||||||
PELOCK(81,ppe);
|
PELOCK(81,ppe);
|
||||||
CodeAdr = ppe->CodeOfPred;
|
CodeAdr = ppe->CodeOfPred;
|
||||||
UNLOCK(ppe->PELock);
|
UNLOCK(ppe->PELock);
|
||||||
out = do_goal(CodeAdr, ppe->ArityOfPE, pt, FALSE PASS_REGS);
|
out = do_goal(CodeAdr, ppe->ArityOfPE, pt, false PASS_REGS);
|
||||||
|
|
||||||
if (out == 1) {
|
if (out == 1) {
|
||||||
choiceptr cut_B;
|
choiceptr cut_B;
|
||||||
@ -1382,7 +1382,7 @@ Yap_RunTopGoal(Term t)
|
|||||||
"unable to boot because of too little Trail space");
|
"unable to boot because of too little Trail space");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
goal_out = do_goal(CodeAdr, arity, pt, TRUE PASS_REGS);
|
goal_out = do_goal(CodeAdr, arity, pt, true PASS_REGS);
|
||||||
return goal_out;
|
return goal_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ Detach the shared object identified by _Handle_.
|
|||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
Yap_InitCPred("call_shared_object_function", 2, p_call_shared_object_function, SyncPredFlag);
|
Yap_InitCPred("$call_shared_object_function", 2, p_call_shared_object_function, SyncPredFlag);
|
||||||
Yap_InitCPred("$obj_suffix", 1, p_obj_suffix, SafePredFlag);
|
Yap_InitCPred("$obj_suffix", 1, p_obj_suffix, SafePredFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
21
C/qlyr.c
21
C/qlyr.c
@ -276,9 +276,12 @@ static DBRef
|
|||||||
LookupDBRef(DBRef dbr, int inc_ref)
|
LookupDBRef(DBRef dbr, int inc_ref)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
CELL hash = (CELL)(dbr) % LOCAL_ImportDBRefHashTableSize;
|
CELL hash;
|
||||||
import_dbref_hash_entry_t *p;
|
import_dbref_hash_entry_t *p;
|
||||||
|
|
||||||
|
if (LOCAL_ImportDBRefHashTableSize == 0)
|
||||||
|
return NULL;
|
||||||
|
hash = (CELL)(dbr) % LOCAL_ImportDBRefHashTableSize;
|
||||||
p = LOCAL_ImportDBRefHashChain[hash];
|
p = LOCAL_ImportDBRefHashChain[hash];
|
||||||
while (p) {
|
while (p) {
|
||||||
if (p->oval == dbr) {
|
if (p->oval == dbr) {
|
||||||
@ -297,9 +300,12 @@ static LogUpdClause *
|
|||||||
LookupMayFailDBRef(DBRef dbr)
|
LookupMayFailDBRef(DBRef dbr)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
CELL hash = (CELL)(dbr) % LOCAL_ImportDBRefHashTableSize;
|
CELL hash;
|
||||||
import_dbref_hash_entry_t *p;
|
import_dbref_hash_entry_t *p;
|
||||||
|
|
||||||
|
if (LOCAL_ImportDBRefHashTableSize == 0)
|
||||||
|
return NULL;
|
||||||
|
hash = (CELL)(dbr) % LOCAL_ImportDBRefHashTableSize;
|
||||||
p = LOCAL_ImportDBRefHashChain[hash];
|
p = LOCAL_ImportDBRefHashChain[hash];
|
||||||
while (p) {
|
while (p) {
|
||||||
if (p->oval == dbr) {
|
if (p->oval == dbr) {
|
||||||
@ -1007,11 +1013,13 @@ static void
|
|||||||
read_module(IOSTREAM *stream) {
|
read_module(IOSTREAM *stream) {
|
||||||
qlf_tag_t x;
|
qlf_tag_t x;
|
||||||
|
|
||||||
InitHash();
|
|
||||||
read_header(stream);
|
read_header(stream);
|
||||||
|
InitHash();
|
||||||
ReadHash(stream);
|
ReadHash(stream);
|
||||||
while ((x = read_tag(stream)) == QLY_START_MODULE) {
|
while ((x = read_tag(stream)) == QLY_START_MODULE) {
|
||||||
Term mod = (Term)read_UInt(stream);
|
Term mod = (Term)read_UInt(stream);
|
||||||
|
if (mod == 0)
|
||||||
|
mod = TermProlog;
|
||||||
mod = MkAtomTerm(AtomAdjust(AtomOfTerm(mod)));
|
mod = MkAtomTerm(AtomAdjust(AtomOfTerm(mod)));
|
||||||
if (mod)
|
if (mod)
|
||||||
while ((x = read_tag(stream)) == QLY_START_PREDICATE) {
|
while ((x = read_tag(stream)) == QLY_START_PREDICATE) {
|
||||||
@ -1047,10 +1055,6 @@ static void
|
|||||||
ReInitProlog(void)
|
ReInitProlog(void)
|
||||||
{
|
{
|
||||||
Term t = MkAtomTerm(AtomInitProlog);
|
Term t = MkAtomTerm(AtomInitProlog);
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
|
||||||
Yap_init_root_frames();
|
|
||||||
#endif /* YAPOR || TABLING */
|
|
||||||
Yap_InitYaamRegs( 0 );
|
|
||||||
YAP_RunGoalOnce(t);
|
YAP_RunGoalOnce(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1073,12 +1077,11 @@ p_read_program( USES_REGS1 )
|
|||||||
if (!(stream = Yap_GetInputStream(AtomOfTerm(t1))) ) {
|
if (!(stream = Yap_GetInputStream(AtomOfTerm(t1))) ) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
YAP_Reset();
|
YAP_Reset( YAP_RESET_FROM_RESTORE );
|
||||||
read_module(stream);
|
read_module(stream);
|
||||||
Sclose( stream );
|
Sclose( stream );
|
||||||
/* back to the top level we go */
|
/* back to the top level we go */
|
||||||
ReInitProlog();
|
ReInitProlog();
|
||||||
Yap_RestartYap( 3 );
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
98
C/qlyw.c
98
C/qlyw.c
@ -770,9 +770,19 @@ save_ops(IOSTREAM *stream, Term mod) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
save_header(IOSTREAM *stream)
|
||||||
|
{
|
||||||
|
char msg[256];
|
||||||
|
|
||||||
|
sprintf(msg, "#!/bin/sh\nexec_dir=${YAPBINDIR:-%s}\nexec $exec_dir/yap $0 \"$@\"\n%s", YAP_BINDIR, YAP_FULL_VERSION);
|
||||||
|
return save_bytes(stream, msg, strlen(msg)+1);
|
||||||
|
}
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
save_module(IOSTREAM *stream, Term mod) {
|
save_module(IOSTREAM *stream, Term mod) {
|
||||||
PredEntry *ap = Yap_ModulePred(mod);
|
PredEntry *ap = Yap_ModulePred(mod);
|
||||||
|
save_header( stream );
|
||||||
InitHash();
|
InitHash();
|
||||||
ModuleAdjust(mod);
|
ModuleAdjust(mod);
|
||||||
while (ap) {
|
while (ap) {
|
||||||
@ -798,15 +808,6 @@ save_module(IOSTREAM *stream, Term mod) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
save_header(IOSTREAM *stream)
|
|
||||||
{
|
|
||||||
char msg[256];
|
|
||||||
|
|
||||||
sprintf(msg, "#!/bin/sh\nexec_dir=${YAPBINDIR:-%s}\nexec $exec_dir/yap $0 \"$@\"\n%s", YAP_BINDIR, YAP_FULL_VERSION);
|
|
||||||
return save_bytes(stream, msg, strlen(msg)+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
save_program(IOSTREAM *stream) {
|
save_program(IOSTREAM *stream) {
|
||||||
ModEntry *me = CurrentModules;
|
ModEntry *me = CurrentModules;
|
||||||
@ -849,6 +850,52 @@ save_program(IOSTREAM *stream) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static size_t
|
||||||
|
save_file(IOSTREAM *stream, Atom FileName) {
|
||||||
|
ModEntry *me = CurrentModules;
|
||||||
|
|
||||||
|
InitHash();
|
||||||
|
save_header( stream );
|
||||||
|
/* should we allow the user to see hidden predicates? */
|
||||||
|
while (me) {
|
||||||
|
PredEntry *pp;
|
||||||
|
pp = me->PredForME;
|
||||||
|
AtomAdjust(me->AtomOfME);
|
||||||
|
while (pp != NULL) {
|
||||||
|
pp = PredEntryAdjust(pp);
|
||||||
|
if (pp &&
|
||||||
|
!(pp->PredFlags & (MultiFileFlag|NumberDBPredFlag|AtomDBPredFlag|CPredFlag|AsmPredFlag|UserCPredFlag)) &&
|
||||||
|
pp->src.OwnerFile == FileName) {
|
||||||
|
CHECK(mark_pred(pp));
|
||||||
|
}
|
||||||
|
pp = pp->NextPredOfModule;
|
||||||
|
}
|
||||||
|
me = me->NextME;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* just to make sure */
|
||||||
|
mark_ops(stream, 0);
|
||||||
|
SaveHash(stream);
|
||||||
|
me = CurrentModules;
|
||||||
|
while (me) {
|
||||||
|
PredEntry *pp;
|
||||||
|
pp = me->PredForME;
|
||||||
|
CHECK(save_tag(stream, QLY_START_MODULE));
|
||||||
|
CHECK(save_UInt(stream, (UInt)MkAtomTerm(me->AtomOfME)));
|
||||||
|
while (pp != NULL) {
|
||||||
|
CHECK(save_tag(stream, QLY_START_PREDICATE));
|
||||||
|
CHECK(save_pred(stream, pp));
|
||||||
|
pp = pp->NextPredOfModule;
|
||||||
|
}
|
||||||
|
CHECK(save_tag(stream, QLY_END_PREDICATES));
|
||||||
|
me = me->NextME;
|
||||||
|
}
|
||||||
|
CHECK(save_tag(stream, QLY_END_MODULES));
|
||||||
|
save_ops(stream, 0);
|
||||||
|
CloseHash();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
p_save_module_preds( USES_REGS1 )
|
p_save_module_preds( USES_REGS1 )
|
||||||
{
|
{
|
||||||
@ -902,10 +949,43 @@ p_save_program( USES_REGS1 )
|
|||||||
return save_program(stream) != 0;
|
return save_program(stream) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Int
|
||||||
|
p_save_file( USES_REGS1 )
|
||||||
|
{
|
||||||
|
IOSTREAM *stream;
|
||||||
|
Term t1 = Deref(ARG1);
|
||||||
|
Term tfile = Deref(ARG2);
|
||||||
|
|
||||||
|
if (IsVarTerm(t1)) {
|
||||||
|
Yap_Error(INSTANTIATION_ERROR,t1,"save_file/3");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (!IsAtomTerm(t1)) {
|
||||||
|
Yap_Error(TYPE_ERROR_ATOM,t1,"save_file/3");
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
if (!(stream = Yap_GetOutputStream(AtomOfTerm(t1))) ) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (!(stream = Yap_GetOutputStream(AtomOfTerm(t1))) ) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (IsVarTerm(tfile)) {
|
||||||
|
Yap_Error(INSTANTIATION_ERROR,tfile,"save_file/2");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (!IsAtomTerm(tfile)) {
|
||||||
|
Yap_Error(TYPE_ERROR_ATOM,tfile,"save_file/2");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return save_file(stream, AtomOfTerm(tfile) ) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
void Yap_InitQLY(void)
|
void Yap_InitQLY(void)
|
||||||
{
|
{
|
||||||
Yap_InitCPred("$qsave_module_preds", 2, p_save_module_preds, SyncPredFlag|UserCPredFlag);
|
Yap_InitCPred("$qsave_module_preds", 2, p_save_module_preds, SyncPredFlag|UserCPredFlag);
|
||||||
Yap_InitCPred("$qsave_program", 1, p_save_program, SyncPredFlag|UserCPredFlag);
|
Yap_InitCPred("$qsave_program", 1, p_save_program, SyncPredFlag|UserCPredFlag);
|
||||||
|
Yap_InitCPred("$qsave_file", 2, p_save_file, SyncPredFlag|UserCPredFlag);
|
||||||
if (FALSE) {
|
if (FALSE) {
|
||||||
restore_codes();
|
restore_codes();
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ Int Yap_JumpToEnv(Term);
|
|||||||
Term Yap_RunTopGoal(Term);
|
Term Yap_RunTopGoal(Term);
|
||||||
void Yap_ResetExceptionTerm(int);
|
void Yap_ResetExceptionTerm(int);
|
||||||
Int Yap_execute_goal(Term, int, Term);
|
Int Yap_execute_goal(Term, int, Term);
|
||||||
Int Yap_exec_absmi(int);
|
Int Yap_exec_absmi( bool, yap_reset_t );
|
||||||
void Yap_trust_last(void);
|
void Yap_trust_last(void);
|
||||||
Term Yap_GetException(void);
|
Term Yap_GetException(void);
|
||||||
void Yap_PrepGoal(UInt, CELL *, choiceptr USES_REGS);
|
void Yap_PrepGoal(UInt, CELL *, choiceptr USES_REGS);
|
||||||
|
15
Makefile.in
15
Makefile.in
@ -693,11 +693,16 @@ FULL_PATH_PL_SOURCES=$(addprefix $(srcdir)/, $(PL_SOURCES) )
|
|||||||
FULL_PATH_HEADERS=$(addprefix $(srcdir)/, $(HEADERS) )
|
FULL_PATH_HEADERS=$(addprefix $(srcdir)/, $(HEADERS) )
|
||||||
|
|
||||||
TAGS: $(C_SOURCES) $(PL_SOURCES) $(HEADERS)
|
TAGS: $(C_SOURCES) $(PL_SOURCES) $(HEADERS)
|
||||||
etags $(FULL_PATH_C_SOURCES) $(FULL_PATH_PL_SOURCES) $(FULL_PATH_HEADERS)
|
rm -f TAGS
|
||||||
for p in $(PACKAGES); do \
|
find . -name '*.c' -exec etags -a {} \;
|
||||||
echo " ============== INSTALLING" $$p; \
|
find . -name '*.h' -exec etags -a {} \;
|
||||||
if [ -r $$p/Makefile ]; then $(MAKE) -C $$p TAGS || exit 1; fi; \
|
find . -name '*.i' -exec etags -a {} \;
|
||||||
done
|
find . -name '*.yap' -exec etags -a {} \;
|
||||||
|
find . -name '*.pl' -exec etags -a {} \;
|
||||||
|
find . -name '*.cpp' -exec etags -a {} \;
|
||||||
|
find . -name '*.hh' -exec etags -a {} \;
|
||||||
|
find . -name '*.java' -exec etags -a {} \;
|
||||||
|
find . -name '*.py' -exec etags -a {} \;
|
||||||
|
|
||||||
depend: $(HEADERS) $(C_SOURCES)
|
depend: $(HEADERS) $(C_SOURCES)
|
||||||
-@if test "$(GCC)" = yes; then\
|
-@if test "$(GCC)" = yes; then\
|
||||||
|
@ -125,7 +125,7 @@ exec_top_level(int BootMode, YAP_init_args *iap)
|
|||||||
livegoal = YAP_FullLookupAtom("$live");
|
livegoal = YAP_FullLookupAtom("$live");
|
||||||
atomfalse = YAP_MkAtomTerm (YAP_FullLookupAtom("$false"));
|
atomfalse = YAP_MkAtomTerm (YAP_FullLookupAtom("$false"));
|
||||||
while (YAP_GetValue (livegoal) != atomfalse) {
|
while (YAP_GetValue (livegoal) != atomfalse) {
|
||||||
YAP_Reset();
|
YAP_Reset( YAP_FULL_RESET );
|
||||||
do_top_goal (YAP_MkAtomTerm (livegoal));
|
do_top_goal (YAP_MkAtomTerm (livegoal));
|
||||||
}
|
}
|
||||||
YAP_Exit(EXIT_SUCCESS);
|
YAP_Exit(EXIT_SUCCESS);
|
||||||
@ -168,7 +168,7 @@ main (int argc, char **argv)
|
|||||||
YAP_RunGoalOnce(t_goal);
|
YAP_RunGoalOnce(t_goal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
YAP_Reset();
|
YAP_Reset( YAP_FULL_RESET );
|
||||||
/* End preprocessor code */
|
/* End preprocessor code */
|
||||||
|
|
||||||
exec_top_level(BootMode, &init_args);
|
exec_top_level(BootMode, &init_args);
|
||||||
|
@ -58,7 +58,7 @@ PROJECT_LOGO = misc/icons/yap_96x96x32.png
|
|||||||
# entered, it will be relative to the location where doxygen was started. If
|
# entered, it will be relative to the location where doxygen was started. If
|
||||||
# left blank the current directory will be used.
|
# left blank the current directory will be used.
|
||||||
|
|
||||||
OUTPUT_DIRECTORY = /scratch/vitor/doxout
|
OUTPUT_DIRECTORY = /Users/vsc/Yap/doxout
|
||||||
|
|
||||||
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
|
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
|
||||||
# directories (in 2 levels) under the output directory of each output format and
|
# directories (in 2 levels) under the output directory of each output format and
|
||||||
|
@ -149,7 +149,7 @@ typedef unsigned long uintptr_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PL_HAVE_TERM_T
|
#ifndef PL_HAVE_TERM_T
|
||||||
#define PL_HAVE_TERM_Temacs
|
#define PL_HAVE_TERM_T
|
||||||
typedef intptr_t term_t;
|
typedef intptr_t term_t;
|
||||||
#endif
|
#endif
|
||||||
typedef struct mod_entry *module_t;
|
typedef struct mod_entry *module_t;
|
||||||
|
@ -302,5 +302,11 @@ typedef enum
|
|||||||
YAPC_ENABLE_AGC /* enable or disable atom garbage collection */
|
YAPC_ENABLE_AGC /* enable or disable atom garbage collection */
|
||||||
} yap_flag_t;
|
} yap_flag_t;
|
||||||
|
|
||||||
|
typedef enum yap_enum_reset_t {
|
||||||
|
YAP_EXEC_ABSMI = 0,
|
||||||
|
YAP_FULL_RESET = 1,
|
||||||
|
YAP_RESET_FROM_RESTORE = 3
|
||||||
|
} yap_reset_t;
|
||||||
|
\
|
||||||
|
|
||||||
#endif /* _YAPDEFS_H */
|
#endif /* _YAPDEFS_H */
|
||||||
|
@ -859,10 +859,13 @@ Look for the next solution to the current query by forcing YAP to
|
|||||||
backtrack to the latest goal. Notice that slots allocated since the last
|
backtrack to the latest goal. Notice that slots allocated since the last
|
||||||
YAP_RunGoal() will become invalid.
|
YAP_RunGoal() will become invalid.
|
||||||
|
|
||||||
@Item `int` YAP_Reset(`void`)
|
@Item `int` YAP_Reset(`yap_reset_t mode`)
|
||||||
Reset execution environment (similar to the [abort/0](@ref abort)
|
|
||||||
built-in). This is useful when you want to start a new query before
|
Reset execution environment
|
||||||
asking all solutions to the previous query.
|
(similar to the abort/0 built-in). This is useful when
|
||||||
|
you want to start a new query before asking all solutions to the
|
||||||
|
previous query. 'mode` specifies how deep the Reset will go and what
|
||||||
|
to do next. It will be most often set to `YAP_FULL_RESET`.
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li>`int` YAP_ShutdownGoal(`int backtrack`)
|
<li>`int` YAP_ShutdownGoal(`int backtrack`)
|
||||||
@ -1829,7 +1832,7 @@ extern X_API YAP_Bool YAP_GoalHasException(YAP_Term *);
|
|||||||
/* void YAP_ClearExceptions(void) */
|
/* void YAP_ClearExceptions(void) */
|
||||||
extern X_API void YAP_ClearExceptions(void);
|
extern X_API void YAP_ClearExceptions(void);
|
||||||
|
|
||||||
extern X_API int YAP_Reset(void);
|
extern X_API int YAP_Reset(yap_reset_t reset);
|
||||||
|
|
||||||
extern X_API void YAP_Error(int myerrno, YAP_Term t, const char *buf, ...);
|
extern X_API void YAP_Error(int myerrno, YAP_Term t, const char *buf, ...);
|
||||||
|
|
||||||
|
@ -22,20 +22,21 @@
|
|||||||
This package provides a fast implementation of multi-dimensional
|
This package provides a fast implementation of multi-dimensional
|
||||||
matrices of integers and floats. In contrast to dynamic arrays, these
|
matrices of integers and floats. In contrast to dynamic arrays, these
|
||||||
matrices are multi-dimensional and compact. In contrast to static
|
matrices are multi-dimensional and compact. In contrast to static
|
||||||
arrays. these arrays are allocated in the stack. Matrices are available
|
arrays. these arrays are allocated in the stack, and disppear in
|
||||||
by loading the library `library(matrix)`. They are multimensional
|
backtracking. Matrices are available by loading the library
|
||||||
objects of type:
|
`library(matrix)`. They are multimensional objects of type:
|
||||||
|
|
||||||
+ <tt>terms</tt>: Prolog terms
|
+ <tt>terms</tt>: Prolog terms
|
||||||
|
|
||||||
+ <tt>ints</tt>: bounded integers, represented as an opaque term. The
|
+ <tt>ints</tt>: bounded integers, represented as an opaque term. The
|
||||||
maximum integer depends on hardware, but should be obtained from the
|
maximum integer depends on hardware, but should be obtained from the
|
||||||
natural size of the machine.
|
natural size of the machine.
|
||||||
+ <tt>floats</tt>: floating-poiny numbers, represented as an opaque term.
|
|
||||||
|
|
||||||
|
+ <tt>floats</tt>: floating-point numbers, represented as an opaque term.
|
||||||
|
|
||||||
Matrix elements can be accessed through the `matrix_get/2`
|
Matrix elements can be accessed through the `matrix_get/2`
|
||||||
predicate or through an <tt>R</tt>-inspired access notation (that uses the ciao
|
predicate or through an <tt>R</tt>-inspired access notation (that uses the ciao
|
||||||
style extension to `[]`. Examples include:
|
style extension to `[]`). Examples include:
|
||||||
|
|
||||||
|
|
||||||
+ Access the second row, third column of matrix <tt>X</tt>. Indices start from
|
+ Access the second row, third column of matrix <tt>X</tt>. Indices start from
|
||||||
@ -161,8 +162,10 @@ of matrix _M_ at offset _Offset_.
|
|||||||
create a matrix from a list. Options are:
|
create a matrix from a list. Options are:
|
||||||
+ dim=
|
+ dim=
|
||||||
a list of dimensions
|
a list of dimensions
|
||||||
|
|
||||||
+ type=
|
+ type=
|
||||||
integers, floating-point or terms
|
integers, floating-point or terms
|
||||||
|
|
||||||
+ base=
|
+ base=
|
||||||
a list of base offsets per dimension (all must be the same for arrays of
|
a list of base offsets per dimension (all must be the same for arrays of
|
||||||
integers and floating-points
|
integers and floating-points
|
||||||
@ -227,8 +230,9 @@ all elements of a matrix or list
|
|||||||
|
|
||||||
+ `* /2`
|
+ `* /2`
|
||||||
|
|
||||||
multiply two numbers, multiply two matrices or lists element-by-element, or multiply a number from
|
multiply two numbers, multiply two matrices or lists
|
||||||
all elements of a matrix or list
|
element-by-element, or multiply a number from all elements of a
|
||||||
|
matrix or list
|
||||||
|
|
||||||
+ `log/1`
|
+ `log/1`
|
||||||
|
|
||||||
@ -566,10 +570,9 @@ Unify _NElems_ with the type of the elements in _Matrix_.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
:- module( matrix,
|
:- module( matrix,
|
||||||
[op(100, yf, []),
|
[(<==)/2, op(600, xfx, '<=='),
|
||||||
(<==)/2, op(710, xfx, '<=='),
|
op(700, xfx, in),
|
||||||
op(580, xfx, in),
|
op(700, xfx, ins),
|
||||||
op(580, xfx, ins),
|
|
||||||
op(450, xfx, ..), % should bind more tightly than \/
|
op(450, xfx, ..), % should bind more tightly than \/
|
||||||
op(590, xfx, of), of/2,
|
op(590, xfx, of), of/2,
|
||||||
matrix_new/3,
|
matrix_new/3,
|
||||||
@ -922,7 +925,7 @@ mtimes(I1, I2, V) :-
|
|||||||
|
|
||||||
%
|
%
|
||||||
% three types of matrix: integers, floats and general terms.
|
% three types of matrix: integers, floats and general terms.
|
||||||
%
|
§%
|
||||||
|
|
||||||
matrix_new(terms,Dims, '$matrix'(Dims, NDims, Size, Offsets, Matrix) ) :-
|
matrix_new(terms,Dims, '$matrix'(Dims, NDims, Size, Offsets, Matrix) ) :-
|
||||||
length(Dims,NDims),
|
length(Dims,NDims),
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
|
|
||||||
# ANDROID_RELEASE= 17 is 4.2.2, 19 is 4.4.2
|
# ANDROID_RELEASE= 17 is 4.2.2, 19 is 4.4.2
|
||||||
ANDROID_RELEASE=19
|
ANDROID_RELEASE=17
|
||||||
# ANDROID_ARCH= arm, x86, mips
|
# ANDROID_ARCH= arm, x86, mips
|
||||||
ANDROID_ARCH=arm
|
ANDROID_ARCH=arm
|
||||||
# ANDROID_BUILD=linux
|
# ANDROID_BUILD=linux
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit ec046839d6f64e030d08bd8781cdc1495fc37f7c
|
Subproject commit d8add7b7d10f57ce1b96653799b6a5662e3dc5a9
|
@ -1 +1 @@
|
|||||||
Subproject commit 86b82220ec929fab1e648109c53f5b46b0569190
|
Subproject commit 9ee28c0798c4d7b348c8033e84da6c0a81887e79
|
10
pl/absf.yap
10
pl/absf.yap
@ -76,7 +76,7 @@
|
|||||||
|
|
||||||
3. `executable` implies `['.so', ',dylib', '.dll']` depending on the Operating system,
|
3. `executable` implies `['.so', ',dylib', '.dll']` depending on the Operating system,
|
||||||
|
|
||||||
4. `qlf` implies `['.qlf', '']`,
|
4. `qly` implies `['.qly', '']`,
|
||||||
|
|
||||||
5. `directory` implies `['']`,
|
5. `directory` implies `['']`,
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ absolute_file_name(File0,File) :-
|
|||||||
'$check_fn_type'(prolog,_) :- !.
|
'$check_fn_type'(prolog,_) :- !.
|
||||||
'$check_fn_type'(source,_) :- !.
|
'$check_fn_type'(source,_) :- !.
|
||||||
'$check_fn_type'(executable,_) :- !.
|
'$check_fn_type'(executable,_) :- !.
|
||||||
'$check_fn_type'(qlf,_) :- !.
|
'$check_fn_type'(qly,_) :- !.
|
||||||
'$check_fn_type'(directory,_) :- !.
|
'$check_fn_type'(directory,_) :- !.
|
||||||
'$check_fn_type'(T,G) :- atom(T), !,
|
'$check_fn_type'(T,G) :- atom(T), !,
|
||||||
'$do_error'(domain_error(file_type,T),G).
|
'$do_error'(domain_error(file_type,T),G).
|
||||||
@ -563,6 +563,8 @@ remove_from_path(New) :- '$check_path'(New,Path),
|
|||||||
prolog_file_type(yap, prolog).
|
prolog_file_type(yap, prolog).
|
||||||
prolog_file_type(pl, prolog).
|
prolog_file_type(pl, prolog).
|
||||||
prolog_file_type(prolog, prolog).
|
prolog_file_type(prolog, prolog).
|
||||||
|
prolog_file_type(qly, prolog).
|
||||||
|
prolog_file_type(qly, qly).
|
||||||
prolog_file_type(A, prolog) :-
|
prolog_file_type(A, prolog) :-
|
||||||
current_prolog_flag(associate, A),
|
current_prolog_flag(associate, A),
|
||||||
A \== prolog,
|
A \== prolog,
|
||||||
@ -586,8 +588,8 @@ user:prolog_file_type(A, prolog) :-
|
|||||||
A \== prolog,
|
A \== prolog,
|
||||||
A \==pl,
|
A \==pl,
|
||||||
A \== yap.
|
A \== yap.
|
||||||
%user:prolog_file_type(qlf, prolog).
|
user:prolog_file_type(qly, prolog).
|
||||||
%user:prolog_file_type(qlf, qlf).
|
user:prolog_file_type(qly, qly).
|
||||||
user:prolog_file_type(A, executable) :-
|
user:prolog_file_type(A, executable) :-
|
||||||
current_prolog_flag(shared_object_extension, A).
|
current_prolog_flag(shared_object_extension, A).
|
||||||
|
|
||||||
|
@ -30,7 +30,8 @@
|
|||||||
source_file/1,
|
source_file/1,
|
||||||
source_file/2,
|
source_file/2,
|
||||||
source_file_property/2,
|
source_file_property/2,
|
||||||
use_module/3], ['$add_multifile'/3,
|
use_module/3],
|
||||||
|
['$add_multifile'/3,
|
||||||
'$csult'/2,
|
'$csult'/2,
|
||||||
'$do_startup_reconsult'/1,
|
'$do_startup_reconsult'/1,
|
||||||
'$elif'/2,
|
'$elif'/2,
|
||||||
@ -93,61 +94,78 @@ General implementation of the consult/1 family. Execution is controlled by the
|
|||||||
following flags:
|
following flags:
|
||||||
|
|
||||||
+ consult(+ _Mode_)
|
+ consult(+ _Mode_)
|
||||||
|
|
||||||
This extension controls the type of file to load. If _Mode_ is:
|
This extension controls the type of file to load. If _Mode_ is:
|
||||||
|
|
||||||
`consult`, clauses are added to the data-base, unless from the same file;
|
`consult`, clauses are added to the data-base, unless from the same file;
|
||||||
`reconsult`, clauses are recompiled,
|
`reconsult`, clauses are recompiled,
|
||||||
`db`, these are facts that need to be added to the data-base,
|
`db`, these are facts that need to be added to the data-base,
|
||||||
`exo`, these are facts with atoms and integers that can be stored in a compact representation (see load_exo/1).
|
`exo`, these are facts with atoms and integers that can be stored in a compact representation (see load_exo/1).
|
||||||
|
|
||||||
+ silent(+ _Bool_)
|
+ silent(+ _Bool_)
|
||||||
If true, load the file without printing a message. The specified value is the default for all files loaded as a result of loading the specified files.
|
|
||||||
|
If true, load the file without printing a message. The specified
|
||||||
|
value is the default for all files loaded as a result of loading
|
||||||
|
the specified files.
|
||||||
|
|
||||||
+ stream(+ _Input_)
|
+ stream(+ _Input_)
|
||||||
This SWI-Prolog extension compiles the data from the stream _Input_. If this option is used, _Files_ must be a single atom which is used to identify the source-location of the loaded
|
|
||||||
|
This SWI-Prolog extension compiles the data from the stream
|
||||||
|
_Input_. If this option is used, _Files_ must be a single atom
|
||||||
|
which is used to identify the source-location of the loaded
|
||||||
clauses as well as remove all clauses if the data is re-consulted.
|
clauses as well as remove all clauses if the data is re-consulted.
|
||||||
|
|
||||||
This option is added to allow compiling from non-file locations such as databases, the web, the user (see consult/1) or other servers.
|
This option is added to allow compiling from non-file locations
|
||||||
|
such as databases, the web, the user (see consult/1) or other
|
||||||
|
servers.
|
||||||
|
|
||||||
+ compilation_mode(+ _Mode_)
|
+ compilation_mode(+ _Mode_)
|
||||||
This extension controls how procedures are compiled. If _Mode_
|
|
||||||
is `compact` clauses are compiled and no source code is stored;
|
This extension controls how procedures are compiled. If _Mode_ is
|
||||||
if it is `source` clauses are compiled and source code is stored;
|
`compact` clauses are compiled and no source code is stored; if it
|
||||||
if it is `assert_all` clauses are asserted into the data-base.
|
is `source` clauses are compiled and source code is stored; if it
|
||||||
|
is `assert_all` clauses are asserted into the data-base.
|
||||||
|
|
||||||
+ encoding(+ _Encoding_)
|
+ encoding(+ _Encoding_)
|
||||||
Character encoding used in consulting files. Please (see [Encoding](@ref Encoding)) for
|
|
||||||
supported encodings.
|
Character encoding used in consulting files. Please (see
|
||||||
|
[Encoding](@ref Encoding)) for supported encodings.
|
||||||
|
|
||||||
+ expand(+ _Bool_)
|
+ expand(+ _Bool_)
|
||||||
If `true`, run the
|
|
||||||
filenames through expand_file_name/2 and load the returned
|
If `true`, run the filenames through expand_file_name/2 and load
|
||||||
files. Default is false, except for consult/1 which is
|
the returned files. Default is false, except for consult/1 which
|
||||||
intended for interactive use.
|
is intended for interactive use.
|
||||||
|
|
||||||
+ if(+ _Condition_)
|
+ if(+ _Condition_)
|
||||||
Load the file only if the specified _Condition_ is
|
|
||||||
satisfied. The value `true` the file unconditionally,
|
Load the file only if the specified _Condition_ is satisfied. The
|
||||||
`changed` loads the file if it was not loaded before, or has
|
value `true` the file unconditionally, `changed` loads the file if
|
||||||
been modified since it was loaded the last time, `not_loaded`
|
it was not loaded before, or has been modified since it was loaded
|
||||||
loads the file if it was not loaded before.
|
the last time, `not_loaded` loads the file if it was not loaded
|
||||||
|
before.
|
||||||
|
|
||||||
+ imports(+ _ListOrAll_)
|
+ imports(+ _ListOrAll_)
|
||||||
|
|
||||||
If `all` and the file is a module file, import all public
|
If `all` and the file is a module file, import all public
|
||||||
predicates. Otherwise import only the named predicates. Each
|
predicates. Otherwise import only the named predicates. Each
|
||||||
predicate is referred to as `\<name\>/\<arity\>`. This option has
|
predicate is referred to as `\<name\>/\<arity\>`. This option has
|
||||||
no effect if the file is not a module file.
|
no effect if the file is not a module file.
|
||||||
|
|
||||||
+ must_be_module(+ _Bool_)
|
+ must_be_module(+ _Bool_)
|
||||||
|
|
||||||
If true, raise an error if the file is not a module file. Used by
|
If true, raise an error if the file is not a module file. Used by
|
||||||
` use_module/1 and use_module/2.
|
` use_module/1 and use_module/2.
|
||||||
|
|
||||||
+ autoload(+ _Autoload_)
|
+ autoload(+ _Autoload_)
|
||||||
SWI-compatible option where if _Autoload_ is `true` undefined predicates
|
|
||||||
are loaded on first call.
|
SWI-compatible option where if _Autoload_ is `true` undefined
|
||||||
|
predicates are loaded on first call.
|
||||||
|
|
||||||
+ derived_from(+ _File_)
|
+ derived_from(+ _File_)
|
||||||
SWI-compatible option to control make/0. Currently
|
|
||||||
not supported.
|
SWI-compatible option to control make/0. Currently not supported.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
%
|
%
|
||||||
% SWI options
|
% SWI options
|
||||||
@ -368,13 +386,18 @@ load_files(Files,Opts) :-
|
|||||||
'$lf'([F|Fs], Mod, Call, TOpts) :- !,
|
'$lf'([F|Fs], Mod, Call, TOpts) :- !,
|
||||||
% clean up after each consult
|
% clean up after each consult
|
||||||
( '$lf'(F,Mod,Call, TOpts), fail ;
|
( '$lf'(F,Mod,Call, TOpts), fail ;
|
||||||
'$lf'(Fs, Mod, Call, TOpts) ).
|
'$lf'(Fs, Mod, Call, TOpts), fail;
|
||||||
|
true
|
||||||
|
).
|
||||||
'$lf'(user, Mod, _, TOpts) :- !,
|
'$lf'(user, Mod, _, TOpts) :- !,
|
||||||
|
b_setval('$source_file', user_input),
|
||||||
'$do_lf'(Mod, user_input, user_input, TOpts).
|
'$do_lf'(Mod, user_input, user_input, TOpts).
|
||||||
'$lf'(user_input, Mod, _, TOpts) :- !,
|
'$lf'(user_input, Mod, _, TOpts) :- !,
|
||||||
|
b_setval('$source_file', user_input),
|
||||||
'$do_lf'(Mod, user_input, user_input, TOpts).
|
'$do_lf'(Mod, user_input, user_input, TOpts).
|
||||||
'$lf'(File, Mod, Call, TOpts) :-
|
'$lf'(File, Mod, Call, TOpts) :-
|
||||||
'$lf_opt'(stream, TOpts, Stream),
|
'$lf_opt'(stream, TOpts, Stream),
|
||||||
|
b_setval('$source_file', File),
|
||||||
( var(Stream) ->
|
( var(Stream) ->
|
||||||
/* need_to_open_file */
|
/* need_to_open_file */
|
||||||
'$full_filename'(File, Y, Call),
|
'$full_filename'(File, Y, Call),
|
||||||
@ -664,16 +687,16 @@ db_files(Fs) :-
|
|||||||
'$bind_module'(Mod, use_module(Mod)).
|
'$bind_module'(Mod, use_module(Mod)).
|
||||||
|
|
||||||
'$import_to_current_module'(File, ContextModule, Imports, RemainingImports, TOpts) :-
|
'$import_to_current_module'(File, ContextModule, Imports, RemainingImports, TOpts) :-
|
||||||
\+ recorded('$module','$module'(File, _Module, _ModExports, _),_),
|
\+ recorded('$module','$module'(File, _Module, _, |