- do not call goal expansion on meta-calls (that is done by undef).
- docs updates
- fix init code
This commit is contained in:
Vítor Santos Costa 2015-12-15 09:28:43 +00:00
parent 14459cce03
commit 15404b3835
124 changed files with 5167 additions and 1597 deletions

16
.gitignore vendored
View File

@ -78,6 +78,7 @@ yap
*cmake_files *cmake_files
C/pl-yap.c C/pl-yap.c
GitSHA1.c GitSHA1.c
.vscode
CMakeLists.txt.* CMakeLists.txt.*
FindPackageLog.txt FindPackageLog.txt
GitSHA1.c GitSHA1.c
@ -112,10 +113,13 @@ packages/real/rconfig.h
packages/ProbLog/problog/#completion.yap# packages/ProbLog/problog/#completion.yap#
packages/ProbLog/problog_examples/output/out.dat packages/ProbLog/problog_examples/output
packages/ProbLog/problog_examples/queries
packages/swig/java/*.java
packages/swig/java/*.class
packages/swig/java/*.jar
packages/swig/java/*wrap*
*jnilib
*.jar
packages/ProbLog/problog_examples/output/,_query_1_cluster_1.dot packages/cplint/approx/simplecuddLPADs/LPADBDD
packages/ProbLog/problog_examples/output/out.dat
packages/ProbLog/problog_examples/output/,_query_1_cluster_1

View File

@ -795,12 +795,6 @@ Prop Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod) {
p->beamTable = NULL; p->beamTable = NULL;
#endif /* BEAM */ #endif /* BEAM */
/* careful that they don't cross MkFunctor */ /* careful that they don't cross MkFunctor */
if (PRED_GOAL_EXPANSION_FUNC) {
if (fe->PropsOfFE &&
(RepPredProp(fe->PropsOfFE)->PredFlags & GoalExPredFlag)) {
p->PredFlags |= GoalExPredFlag;
}
}
if (!trueGlobalPrologFlag(DEBUG_INFO_FLAG)) { if (!trueGlobalPrologFlag(DEBUG_INFO_FLAG)) {
p->PredFlags |= NoTracePredFlag; p->PredFlags |= NoTracePredFlag;
} }
@ -918,7 +912,7 @@ Prop Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod) {
p->cs.p_code.FirstClause = p->cs.p_code.LastClause = NULL; p->cs.p_code.FirstClause = p->cs.p_code.LastClause = NULL;
p->cs.p_code.NOfClauses = 0; p->cs.p_code.NOfClauses = 0;
p->PredFlags = 0L; p->PredFlags = 0L;
p->src.OwnerFile = AtomNil; p->src.OwnerFile = LOCAL_SourceFileName;
p->OpcodeOfPred = UNDEF_OPCODE; p->OpcodeOfPred = UNDEF_OPCODE;
p->cs.p_code.ExpandCode = EXPAND_OP_CODE; p->cs.p_code.ExpandCode = EXPAND_OP_CODE;
p->CodeOfPred = p->cs.p_code.TrueCodeOfPred = (yamop *)(&(p->OpcodeOfPred)); p->CodeOfPred = p->cs.p_code.TrueCodeOfPred = (yamop *)(&(p->OpcodeOfPred));
@ -936,21 +930,6 @@ Prop Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod) {
p->beamTable = NULL; p->beamTable = NULL;
#endif #endif
/* careful that they don't cross MkFunctor */ /* careful that they don't cross MkFunctor */
if (PRED_GOAL_EXPANSION_FUNC) {
Prop p1 = ae->PropsOfAE;
while (p1) {
PredEntry *pe = RepPredProp(p1);
if (pe->KindOfPE == PEProp) {
if (pe->PredFlags & GoalExPredFlag) {
p->PredFlags |= GoalExPredFlag;
}
break;
}
p1 = pe->NextOfPE;
}
}
AddPropToAtom(ae, (PropEntry *)p); AddPropToAtom(ae, (PropEntry *)p);
p0 = AbsPredProp(p); p0 = AbsPredProp(p);
p->FunctorOfPred = (Functor)AbsAtom(ae); p->FunctorOfPred = (Functor)AbsAtom(ae);

View File

@ -3875,7 +3875,7 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
cl->ClSize = osize; cl->ClSize = osize;
cip->code_addr = (yamop *)cl; cip->code_addr = (yamop *)cl;
} else if (mode == ASSEMBLING_CLAUSE && } else if (mode == ASSEMBLING_CLAUSE &&
(ap->PredFlags & SourcePredFlag || (ap->PredFlags & (SourcePredFlag|MultiFileFlag) ||
trueGlobalPrologFlag(SOURCE_FLAG ) ) && trueGlobalPrologFlag(SOURCE_FLAG ) ) &&
!is_fact) { !is_fact) {
DBTerm *x; DBTerm *x;

View File

@ -1154,6 +1154,7 @@ atomic_concat2( USES_REGS1 )
int i = 0; int i = 0;
Atom at; Atom at;
if (n == 1) return Yap_unify(ARG2, HeadOfTerm(t1));
if (!inpv) { if (!inpv) {
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP; LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP;
free(inpv); free(inpv);

View File

@ -2394,6 +2394,7 @@ X_API void YAP_ClearExceptions(void) {
} }
X_API int YAP_InitConsult(int mode, const char *filename, int *osnop) { X_API int YAP_InitConsult(int mode, const char *filename, int *osnop) {
CACHE_REGS
FILE *f; FILE *f;
int sno; int sno;
BACKUP_MACHINE_REGS(); BACKUP_MACHINE_REGS();
@ -2403,7 +2404,7 @@ X_API int YAP_InitConsult(int mode, const char *filename, int *osnop) {
} }
bool consulted = (mode == YAP_CONSULT_MODE); bool consulted = (mode == YAP_CONSULT_MODE);
Yap_init_consult(consulted, filename); Yap_init_consult(consulted, filename);
f = fopen(filename, "r"); f = fopen(Yap_AbsoluteFile(filename, LOCAL_FileNameBuf, FILENAME_MAX-1), "r");
if (!f) if (!f)
return -1; return -1;
sno = Yap_OpenStream(f, NULL, TermNil, Input_Stream_f); sno = Yap_OpenStream(f, NULL, TermNil, Input_Stream_f);
@ -2717,7 +2718,7 @@ X_API Int YAP_Init(YAP_init_args *yap_init) {
setBooleanGlobalPrologFlag(HALT_AFTER_CONSULT_FLAG, setBooleanGlobalPrologFlag(HALT_AFTER_CONSULT_FLAG,
yap_init->HaltAfterConsult); yap_init->HaltAfterConsult);
} }
/* tell the system who should cope with interrupts */ /* tell the scystem who should cope with interrupts */
Yap_ExecutionMode = yap_init->ExecutionMode; Yap_ExecutionMode = yap_init->ExecutionMode;
if (do_bootstrap) { if (do_bootstrap) {
restore_result = YAP_BOOT_FROM_PROLOG; restore_result = YAP_BOOT_FROM_PROLOG;
@ -3326,7 +3327,6 @@ X_API int YAP_FileNoFromStream(Term t) {
if (IsVarTerm(t)) if (IsVarTerm(t))
return -1; return -1;
return Yap_StreamToFileNo(t); return Yap_StreamToFileNo(t);
return -1;
} }
X_API void *YAP_FileDescriptorFromStream(Term t) { X_API void *YAP_FileDescriptorFromStream(Term t) {
@ -3335,7 +3335,6 @@ X_API void *YAP_FileDescriptorFromStream(Term t) {
if (IsVarTerm(t)) if (IsVarTerm(t))
return NULL; return NULL;
return Yap_FileDescriptorFromStream(t); return Yap_FileDescriptorFromStream(t);
return NULL;
} }
X_API void *YAP_Record(Term t) { X_API void *YAP_Record(Term t) {
@ -3588,7 +3587,6 @@ Term YAP_BPROLOG_curr_toam_status;
* @return a positive number with the size, or 0. * @return a positive number with the size, or 0.
*/ */
size_t YAP_UTF8_TextLength(Term t) { size_t YAP_UTF8_TextLength(Term t) {
Term *aux;
utf8proc_uint8_t dst[8]; utf8proc_uint8_t dst[8];
size_t sz = 0; size_t sz = 0;

366
C/cdmgr.c
View File

@ -212,7 +212,7 @@
* fix several bugs in save/restore.b * fix several bugs in save/restore.b
* *
* Revision 1.171 2005/10/29 01:28:37 vsc * Revision 1.171 2005/10/29 01:28:37 vsc
* make undefined more ISO compatible. * make undefinedore ISO compatible.
* *
* Revision 1.170 2005/10/18 17:04:43 vsc * Revision 1.170 2005/10/18 17:04:43 vsc
* 5.1: * 5.1:
@ -493,7 +493,6 @@ static int not_was_reconsulted(PredEntry *, Term, int);
static int RemoveIndexation(PredEntry *); static int RemoveIndexation(PredEntry *);
static Int p_number_of_clauses(USES_REGS1); static Int p_number_of_clauses(USES_REGS1);
static Int p_compile(USES_REGS1); static Int p_compile(USES_REGS1);
static Int p_compile_dynamic(USES_REGS1);
static Int p_purge_clauses(USES_REGS1); static Int p_purge_clauses(USES_REGS1);
static Int p_setspy(USES_REGS1); static Int p_setspy(USES_REGS1);
static Int p_rmspy(USES_REGS1); static Int p_rmspy(USES_REGS1);
@ -1477,12 +1476,6 @@ static void add_first_static(PredEntry *p, yamop *cp, int spy_flag) {
CACHE_REGS CACHE_REGS
yamop *pt = cp; yamop *pt = cp;
if (is_logupd(p)) {
if (p == PredGoalExpansion || p->FunctorOfPred == FunctorGoalExpansion2) {
PRED_GOAL_EXPANSION_ON = TRUE;
Yap_InitComma();
}
} else {
#ifdef TABLING #ifdef TABLING
if (is_tabled(p)) { if (is_tabled(p)) {
p->OpcodeOfPred = INDEX_OPCODE; p->OpcodeOfPred = INDEX_OPCODE;
@ -1490,7 +1483,6 @@ static void add_first_static(PredEntry *p, yamop *cp, int spy_flag) {
(yamop *)(&(p->OpcodeOfPred)); (yamop *)(&(p->OpcodeOfPred));
} }
#endif /* TABLING */ #endif /* TABLING */
}
p->cs.p_code.TrueCodeOfPred = pt; p->cs.p_code.TrueCodeOfPred = pt;
p->cs.p_code.FirstClause = p->cs.p_code.LastClause = cp; p->cs.p_code.FirstClause = p->cs.p_code.LastClause = cp;
p->OpcodeOfPred = pt->opc; p->OpcodeOfPred = pt->opc;
@ -1531,10 +1523,7 @@ static void add_first_dynamic(PredEntry *p, yamop *cp, int spy_flag) {
CACHE_REGS CACHE_REGS
yamop *ncp = ((DynamicClause *)NULL)->ClCode; yamop *ncp = ((DynamicClause *)NULL)->ClCode;
DynamicClause *cl; DynamicClause *cl;
if (p == PredGoalExpansion || p->FunctorOfPred == FunctorGoalExpansion2) {
PRED_GOAL_EXPANSION_ON = TRUE;
Yap_InitComma();
}
if (PROFILING) { if (PROFILING) {
p->PredFlags |= ProfiledPredFlag; p->PredFlags |= ProfiledPredFlag;
spy_flag = TRUE; spy_flag = TRUE;
@ -1615,8 +1604,8 @@ static void add_first_dynamic(PredEntry *p, yamop *cp, int spy_flag) {
ncp = NEXTOP(ncp, e); ncp = NEXTOP(ncp, e);
ncp->opc = Yap_opcode(_Ystop); ncp->opc = Yap_opcode(_Ystop);
ncp->y_u.l.l = cl->ClCode; ncp->y_u.l.l = cl->ClCode;
if (!(p->PredFlags & MultiFileFlag) && p->src.OwnerFile == AtomNil) //if (!(p->PredFlags & MultiFileFlag) && p->src.OwnerFile == AtomNil)
p->src.OwnerFile = Yap_ConsultingFile(PASS_REGS1); // p->src.OwnerFile = Yap_ConsultingFile(PASS_REGS1);
} }
/* p is already locked */ /* p is already locked */
@ -1851,7 +1840,7 @@ static int not_was_reconsulted(PredEntry *p, Term t, int mode) {
!(p->PredFlags & MultiFileFlag)) /* we are in reconsult mode */ { !(p->PredFlags & MultiFileFlag)) /* we are in reconsult mode */ {
retract_all(p, Yap_static_in_use(p, TRUE)); retract_all(p, Yap_static_in_use(p, TRUE));
} }
p->src.OwnerFile = Yap_ConsultingFile(PASS_REGS1); //p->src.OwnerFile = Yap_ConsultingFile(PASS_REGS1);
} }
LOCAL_LastAssertedPred = p; LOCAL_LastAssertedPred = p;
return TRUE; /* careful */ return TRUE; /* careful */
@ -1948,7 +1937,7 @@ bool Yap_multiple(PredEntry *ap, int mode USES_REGS) {
register consult_obj *fp; register consult_obj *fp;
if ((ap->PredFlags & (MultiFileFlag | LogUpdatePredFlag | DynamicPredFlag)) || if ((ap->PredFlags & (MultiFileFlag | LogUpdatePredFlag | DynamicPredFlag)) ||
mode == consult) mode == TermConsult)
return false; return false;
if (LOCAL_consult_level == 0) if (LOCAL_consult_level == 0)
return false; return false;
@ -1974,126 +1963,6 @@ static int is_fact(Term t) {
return FALSE; return FALSE;
} }
static void mark_preds_with_this_func(Functor f, Prop p0) {
PredEntry *pe = RepPredProp(p0);
pe->PredFlags |= GoalExPredFlag;
Prop p = f->PropsOfFE;
while (p) {
Prop nextp = p->NextOfPE;
pe = RepPredProp(p);
pe->PredFlags |= GoalExPredFlag;
p = nextp;
}
}
static void mark_preds_with_this_atom(Prop p) {
while (p) {
Prop nextp = p->NextOfPE;
if (p->KindOfPE == PEProp)
RepPredProp(p)->PredFlags |= GoalExPredFlag;
p = nextp;
}
}
static void goal_expansion_support(PredEntry *p, Term tf) {
if (p == PredGoalExpansion) {
Term tg = ArgOfTerm(1, tf);
Term tm = ArgOfTerm(2, tf);
if (IsVarTerm(tg) || IsVarTerm(tm)) {
if (!IsVarTerm(tg)) {
/* this is the complicated case, first I need to inform
predicates for this functor */
PRED_GOAL_EXPANSION_FUNC = TRUE;
if (IsAtomTerm(tg)) {
AtomEntry *ae = RepAtom(AtomOfTerm(tg));
Prop p0 = ae->PropsOfAE;
int found = FALSE;
while (p0) {
PredEntry *pe = RepPredProp(p0);
if (pe->KindOfPE == PEProp) {
pe->PredFlags |= GoalExPredFlag;
found = TRUE;
}
p0 = pe->NextOfPE;
}
if (!found) {
PredEntry *npe =
RepPredProp(PredPropByAtom(AtomOfTerm(tg), IDB_MODULE));
npe->PredFlags |= GoalExPredFlag;
}
} else if (IsApplTerm(tg)) {
FunctorEntry *fe = (FunctorEntry *)FunctorOfTerm(tg);
Prop p0;
p0 = fe->PropsOfFE;
if (p0) {
mark_preds_with_this_func(FunctorOfTerm(tg), p0);
} else {
CACHE_REGS
Term mod = CurrentModule;
PredEntry *npe;
if (CurrentModule == PROLOG_MODULE)
mod = IDB_MODULE;
npe = RepPredProp(PredPropByFunc(fe, mod));
npe->PredFlags |= GoalExPredFlag;
}
}
} else {
PRED_GOAL_EXPANSION_ALL = TRUE;
}
} else {
if (IsAtomTerm(tm)) {
if (IsAtomTerm(tg)) {
PredEntry *p = RepPredProp(PredPropByAtom(AtomOfTerm(tg), tm));
p->PredFlags |= GoalExPredFlag;
} else if (IsApplTerm(tg)) {
PredEntry *p = RepPredProp(PredPropByFunc(FunctorOfTerm(tg), tm));
p->PredFlags |= GoalExPredFlag;
}
}
}
} else if (p->FunctorOfPred == FunctorGoalExpansion2) {
Term tg = ArgOfTerm(1, tf);
if (IsVarTerm(tg)) {
PRED_GOAL_EXPANSION_ALL = TRUE;
} else if (IsApplTerm(tg)) {
FunctorEntry *fe = (FunctorEntry *)FunctorOfTerm(tg);
Prop p0;
PredEntry *npe;
p0 = fe->PropsOfFE;
if (p0 && (p->ModuleOfPred == PROLOG_MODULE ||
p->ModuleOfPred == SYSTEM_MODULE ||
p->ModuleOfPred == USER_MODULE)) {
mark_preds_with_this_func(fe, p0);
PRED_GOAL_EXPANSION_FUNC = TRUE;
}
npe = RepPredProp(PredPropByFunc(fe, p->ModuleOfPred));
npe->PredFlags |= GoalExPredFlag;
} else if (IsAtomTerm(tg)) {
Atom at = AtomOfTerm(tg);
Prop p0;
PredEntry *npe;
p0 = RepAtom(at)->PropsOfAE;
if (p0 && (p->ModuleOfPred == PROLOG_MODULE ||
p->ModuleOfPred == SYSTEM_MODULE ||
p->ModuleOfPred == USER_MODULE)) {
mark_preds_with_this_atom(p0);
PRED_GOAL_EXPANSION_FUNC = TRUE;
}
npe = RepPredProp(PredPropByAtom(at, p->ModuleOfPred));
npe->PredFlags |= GoalExPredFlag;
}
}
}
Int Yap_source_line_no(void) { Int Yap_source_line_no(void) {
CACHE_REGS CACHE_REGS
return LOCAL_SourceFileLineno; return LOCAL_SourceFileLineno;
@ -2104,6 +1973,40 @@ Atom Yap_source_file_name(void) {
return LOCAL_SourceFileName; return LOCAL_SourceFileName;
} }
/**
* @brief we cannot add clauses to the proceduree
*
* @param p predicate
*
* @return boolean
*/
bool Yap_constPred( PredEntry *p)
{
pred_flags_t pflags;
pflags = p->PredFlags;
if (pflags & ((UserCPredFlag | CArgsPredFlag | NumberDBPredFlag | AtomDBPredFlag |
TestPredFlag | AsmPredFlag | CPredFlag | BinaryPredFlag) ) )
return true;
if (p->PredFlags & (SysExportPredFlag|MultiFileFlag|DynamicPredFlag))
return false;
if (Yap_isSystemModule(p->ModuleOfPred)){
if (p->cs.p_code.NOfClauses == 0) {
p->src.OwnerFile = LOCAL_SourceFileName;
return false;
}
if ( p->src.OwnerFile == LOCAL_SourceFileName ) {
return false;
}
return true;
}
return false;
}
static int addclause(Term t, yamop *cp, int mode, Term mod, Term *t4ref) static int addclause(Term t, yamop *cp, int mode, Term mod, Term *t4ref)
/* /*
* *
@ -2137,19 +2040,13 @@ static int addclause(Term t, yamop *cp, int mode, Term mod, Term *t4ref)
} }
Yap_PutValue(AtomAbol, TermNil); Yap_PutValue(AtomAbol, TermNil);
PELOCK(20, p); PELOCK(20, p);
pflags = p->PredFlags;
/* we are redefining a prolog module predicate */ /* we are redefining a prolog module predicate */
if (!(p->PredFlags & SysExportPredFlag) && if (Yap_constPred(p)) {
((pflags &
(UserCPredFlag | CArgsPredFlag | NumberDBPredFlag | AtomDBPredFlag |
TestPredFlag | AsmPredFlag | CPredFlag | BinaryPredFlag)) ||
(p->ModuleOfPred == PROLOG_MODULE && mod != TermProlog && mod))) {
// printf("p=%p p->PredFlags=%lx %lx p->cs.p_code.NOfClauses=%ld\n", p,
// p->PredFlags,SysExportPredFlag , p->cs.p_code.NOfClauses);
addcl_permission_error(RepAtom(at), Arity, FALSE); addcl_permission_error(RepAtom(at), Arity, FALSE);
UNLOCKPE(30, p); UNLOCKPE(30, p);
return TermNil; return TermNil;
} }
pflags = p->PredFlags;
/* we are redefining a prolog module predicate */ /* we are redefining a prolog module predicate */
if (pflags & MegaClausePredFlag) { if (pflags & MegaClausePredFlag) {
split_megaclause(p); split_megaclause(p);
@ -2162,13 +2059,13 @@ static int addclause(Term t, yamop *cp, int mode, Term mod, Term *t4ref)
} }
if (pflags & (SpiedPredFlag | CountPredFlag | ProfiledPredFlag)) if (pflags & (SpiedPredFlag | CountPredFlag | ProfiledPredFlag))
spy_flag = TRUE; spy_flag = TRUE;
goal_expansion_support(p, tf); if (mode == consult &&
if (Yap_discontiguous(p PASS_REGS)) { Yap_discontiguous(p PASS_REGS)) {
Term disc[3], sc[4]; Term disc[3], sc[4];
if (p->ArityOfPE) { if (p->ArityOfPE) {
disc[0] = MkAtomTerm(NameOfFunctor(p->FunctorOfPred)); disc[0] = MkAtomTerm(NameOfFunctor(p->FunctorOfPred));
} else { } else {
disc[1] = MkAtomTerm((Atom)(p->FunctorOfPred)); disc[0] = MkAtomTerm((Atom)(p->FunctorOfPred));
} }
disc[1] = MkIntTerm(p->ArityOfPE); disc[1] = MkIntTerm(p->ArityOfPE);
disc[2] = Yap_Module_Name(p); disc[2] = Yap_Module_Name(p);
@ -2185,7 +2082,7 @@ static int addclause(Term t, yamop *cp, int mode, Term mod, Term *t4ref)
if (p->ArityOfPE) { if (p->ArityOfPE) {
disc[0] = MkAtomTerm(NameOfFunctor(p->FunctorOfPred)); disc[0] = MkAtomTerm(NameOfFunctor(p->FunctorOfPred));
} else { } else {
disc[1] = MkAtomTerm((Atom)(p->FunctorOfPred)); disc[0] = MkAtomTerm((Atom)(p->FunctorOfPred));
} }
disc[1] = MkIntTerm(p->ArityOfPE); disc[1] = MkIntTerm(p->ArityOfPE);
disc[2] = Yap_Module_Name(p); disc[2] = Yap_Module_Name(p);
@ -2426,36 +2323,8 @@ void Yap_add_logupd_clause(PredEntry *pe, LogUpdClause *cl, int mode) {
} }
} }
static Int p_compile(USES_REGS1) { /* '$compile'(+C,+Flags, Mod) */
Term t = Deref(ARG1);
Term t1 = Deref(ARG2);
Term mod = Deref(ARG4);
Term tn = TermNil;
yamop *codeadr;
if (IsVarTerm(t1) || !IsIntTerm(t1))
return (FALSE);
if (IsVarTerm(mod) || !IsAtomTerm(mod))
return (FALSE);
YAPEnterCriticalSection();
codeadr =
Yap_cclause(t, 4, mod, Deref(ARG3)); /* vsc: give the number of arguments
to cclause in case there is overflow */
t = Deref(ARG1); /* just in case there was an heap overflow */
if (!LOCAL_ErrorMessage)
addclause(t, codeadr, (int)(IntOfTerm(t1) & 3), mod, &tn);
YAPLeaveCriticalSection();
if (LOCAL_ErrorMessage) {
Yap_Error(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage);
return FALSE;
}
return TRUE;
}
static Int static Int
p_compile_dynamic(USES_REGS1) { /* '$compile_dynamic'(+C,+Flags,Mod,-Ref) */ p_compile(USES_REGS1) { /* '$compile'(+C,+Flags,+C0,-Ref) */
Term t = Deref(ARG1); Term t = Deref(ARG1);
Term t1 = Deref(ARG2); Term t1 = Deref(ARG2);
Term mod = Deref(ARG4); Term mod = Deref(ARG4);
@ -2466,19 +2335,24 @@ static Int
return FALSE; return FALSE;
if (IsVarTerm(mod) || !IsAtomTerm(mod)) if (IsVarTerm(mod) || !IsAtomTerm(mod))
return FALSE; return FALSE;
if (IsAtomTerm(t1)) { if (t1 == TermConsult) {
if (RepAtom(AtomOfTerm(t1))->StrOfAE[0] == 'f') mode = consult;
} else if (t1 == TermReconsult) {
mode = consult;
} else if (t1 == TermAsserta) {
mode = asserta; mode = asserta;
else } else if (t1 == TermAssertz) {
mode = assertz; mode = assertz;
} else } else if (t1 == TermAssertaStatic) {
mode = IntegerOfTerm(t1); mode = asserta;
} else if (t1 == TermAssertzStatic) {
mode = assertz;
}
/* separate assert in current file from reconsult /* separate assert in current file from reconsult
if (mode == assertz && LOCAL_consult_level && mod == CurrentModule) if (mode == assertz && LOCAL_consult_level && mod == CurrentModule)
mode = consult; mode = consult;
*/ */
old_optimize = optimizer_on; old_optimize = optimizer_on;
optimizer_on = FALSE;
YAPEnterCriticalSection(); YAPEnterCriticalSection();
code_adr = Yap_cclause(t, 5, mod, code_adr = Yap_cclause(t, 5, mod,
Deref(ARG3)); /* vsc: give the number of arguments to Deref(ARG3)); /* vsc: give the number of arguments to
@ -2497,7 +2371,7 @@ static Int
return FALSE; return FALSE;
} }
YAPLeaveCriticalSection(); YAPLeaveCriticalSection();
return TRUE; return true;
} }
Atom Yap_ConsultingFile(USES_REGS1) { Atom Yap_ConsultingFile(USES_REGS1) {
@ -2507,6 +2381,9 @@ Atom Yap_ConsultingFile(USES_REGS1) {
// return(AtomUserIn); // return(AtomUserIn);
return StreamFullName(sno); return StreamFullName(sno);
} }
if (LOCAL_SourceFileName != NULL) {
return LOCAL_SourceFileName;
}
if (LOCAL_consult_level == 0) { if (LOCAL_consult_level == 0) {
return (AtomUser); return (AtomUser);
} else { } else {
@ -2883,6 +2760,23 @@ static Int p_new_multifile(USES_REGS1) { /* '$new_multifile'(+N,+Ar,+Mod) */
else else
pe = RepPredProp(PredPropByFunc(Yap_MkFunctor(at, arity), mod)); pe = RepPredProp(PredPropByFunc(Yap_MkFunctor(at, arity), mod));
PELOCK(26, pe); PELOCK(26, pe);
if (pe->PredFlags & (UserCPredFlag | CArgsPredFlag |
NumberDBPredFlag | AtomDBPredFlag |
TestPredFlag | AsmPredFlag |
CPredFlag | BinaryPredFlag)) {
UNLOCKPE(26, pe);
addcl_permission_error(RepAtom(at), arity, FALSE);
return false;
}
if (pe->PredFlags & MultiFileFlag) {
UNLOCKPE(26, pe);
return true;
}
if (pe->cs.p_code.NOfClauses) {
UNLOCKPE(26, pe);
addcl_permission_error(RepAtom(at), arity, FALSE);
return false;
}
pe->PredFlags |= MultiFileFlag; pe->PredFlags |= MultiFileFlag;
/* mutifile-predicates are weird, they do not seat really on the default /* mutifile-predicates are weird, they do not seat really on the default
* module */ * module */
@ -2894,7 +2788,7 @@ static Int p_new_multifile(USES_REGS1) { /* '$new_multifile'(+N,+Ar,+Mod) */
} }
pe->src.OwnerFile = Yap_ConsultingFile(PASS_REGS1); pe->src.OwnerFile = Yap_ConsultingFile(PASS_REGS1);
UNLOCKPE(43, pe); UNLOCKPE(43, pe);
return (TRUE); return true;
} }
static Int p_is_multifile(USES_REGS1) { /* '$is_multifile'(+S,+Mod) */ static Int p_is_multifile(USES_REGS1) { /* '$is_multifile'(+S,+Mod) */
@ -2949,7 +2843,7 @@ static Int p_is_discontiguous(USES_REGS1) { /* '$is_multifile'(+S,+Mod) */
PredEntry *pe; PredEntry *pe;
bool out; bool out;
pe = get_pred(Deref(ARG1), Deref(ARG2), "discontigus"); pe = get_pred(Deref(ARG1), Deref(ARG2), "discontiguous");
if (EndOfPAEntr(pe)) if (EndOfPAEntr(pe))
return FALSE; return FALSE;
PELOCK(27, pe); PELOCK(27, pe);
@ -3099,68 +2993,6 @@ static Int p_is_metapredicate(USES_REGS1) { /* '$is_metapredicate'(+P) */
return out; return out;
} }
static Int p_is_expandgoalormetapredicate(
USES_REGS1) { /* '$is_expand_goal_predicate'(+P) */
PredEntry *pe;
Term t = Deref(ARG1);
Term mod = Deref(ARG2);
bool out;
if (PRED_GOAL_EXPANSION_ALL)
return TRUE;
if (IsVarTerm(t)) {
return (FALSE);
} else if (IsAtomTerm(t)) {
Atom at = AtomOfTerm(t);
pe = RepPredProp(Yap_GetPredPropByAtom(at, mod));
if (EndOfPAEntr(pe)) {
if (PRED_GOAL_EXPANSION_FUNC) {
Prop p1 = RepAtom(at)->PropsOfAE;
while (p1) {
PredEntry *pe = RepPredProp(p1);
if (pe->KindOfPE == PEProp) {
if (pe->PredFlags & GoalExPredFlag) {
PredPropByAtom(at, mod);
return TRUE;
} else {
return FALSE;
}
}
p1 = pe->NextOfPE;
}
}
return FALSE;
}
} else if (IsApplTerm(t)) {
Functor fun = FunctorOfTerm(t);
if (IsExtensionFunctor(fun)) {
return FALSE;
}
pe = RepPredProp(Yap_GetPredPropByFunc(fun, mod));
if (EndOfPAEntr(pe)) {
if (PRED_GOAL_EXPANSION_FUNC) {
FunctorEntry *fe = (FunctorEntry *)fun;
if (fe->PropsOfFE &&
(RepPredProp(fe->PropsOfFE)->PredFlags & GoalExPredFlag)) {
PredPropByFunc(fun, mod);
return TRUE;
}
}
return FALSE;
}
} else {
return FALSE;
}
PELOCK(33, pe);
out = (pe->PredFlags & (GoalExPredFlag | MetaPredFlag));
UNLOCKPE(53, pe);
return (out);
}
static Int p_pred_exists(USES_REGS1) { /* '$pred_exists'(+P,+M) */ static Int p_pred_exists(USES_REGS1) { /* '$pred_exists'(+P,+M) */
PredEntry *pe; PredEntry *pe;
bool out; bool out;
@ -3265,7 +3097,7 @@ static Int p_kill_dynamic(USES_REGS1) { /* '$kill_dynamic'(P,M) */
pe->OpcodeOfPred = UNDEF_OPCODE; pe->OpcodeOfPred = UNDEF_OPCODE;
pe->cs.p_code.TrueCodeOfPred = pe->CodeOfPred = pe->cs.p_code.TrueCodeOfPred = pe->CodeOfPred =
(yamop *)(&(pe->OpcodeOfPred)); (yamop *)(&(pe->OpcodeOfPred));
pe->PredFlags = pe->PredFlags & GoalExPredFlag; pe->PredFlags = 0;
UNLOCKPE(62, pe); UNLOCKPE(62, pe);
return (TRUE); return (TRUE);
} }
@ -3475,6 +3307,34 @@ static Int p_clean_up_dead_clauses(USES_REGS1) {
return TRUE; return TRUE;
} }
static Int /* $ml_system_predicate(P) */
p_mk_system_pred(USES_REGS1) {
PredEntry *pe;
Term t1 = Deref(ARG1);
Term tm = Deref(ARG2);
if (IsVarTerm(t1))
return FALSE;
if (IsAtomTerm(t1)) {
pe = RepPredProp(PredPropByAtom(AtomOfTerm(t1), tm));
pe->ModuleOfPred = PROLOG_MODULE;
return true;
} else if (IsApplTerm(t1)) {
Functor funt = FunctorOfTerm(t1);
if (IsExtensionFunctor(funt)) {
return FALSE;
}
pe = RepPredProp(PredPropByFunc(funt, tm));
pe->ModuleOfPred = PROLOG_MODULE;
return true;
} else if (IsPairTerm(t1)) {
pe = RepPredProp(PredPropByFunc(FunctorDot, tm));
pe->ModuleOfPred = PROLOG_MODULE;
return TRUE;
}
return FALSE;
}
static Int /* $system_predicate(P) */ static Int /* $system_predicate(P) */
p_system_pred(USES_REGS1) { p_system_pred(USES_REGS1) {
PredEntry *pe; PredEntry *pe;
@ -5166,15 +5026,12 @@ void Yap_InitCdMgr(void) {
/* gc() may happen during compilation, hence these predicates are /* gc() may happen during compilation, hence these predicates are
now unsafe */ now unsafe */
Yap_InitCPred("$predicate_flags", 4, predicate_flags, SyncPredFlag); Yap_InitCPred("$predicate_flags", 4, predicate_flags, SyncPredFlag);
Yap_InitCPred("$compile", 4, p_compile, SyncPredFlag); Yap_InitCPred("$compile", 5, p_compile, SyncPredFlag);
Yap_InitCPred("$compile_dynamic", 5, p_compile_dynamic, SyncPredFlag);
Yap_InitCPred("$purge_clauses", 2, p_purge_clauses, Yap_InitCPred("$purge_clauses", 2, p_purge_clauses,
SafePredFlag | SyncPredFlag); SafePredFlag | SyncPredFlag);
Yap_InitCPred("$is_dynamic", 2, p_is_dynamic, TestPredFlag | SafePredFlag); Yap_InitCPred("$is_dynamic", 2, p_is_dynamic, TestPredFlag | SafePredFlag);
Yap_InitCPred("$is_metapredicate", 2, p_is_metapredicate, Yap_InitCPred("$is_metapredicate", 2, p_is_metapredicate,
TestPredFlag | SafePredFlag); TestPredFlag | SafePredFlag);
Yap_InitCPred("$is_expand_goal_or_meta_predicate", 2,
p_is_expandgoalormetapredicate, TestPredFlag | SafePredFlag);
Yap_InitCPred("$is_log_updatable", 2, p_is_log_updatable, Yap_InitCPred("$is_log_updatable", 2, p_is_log_updatable,
TestPredFlag | SafePredFlag); TestPredFlag | SafePredFlag);
Yap_InitCPred("$is_thread_local", 2, p_is_thread_local, Yap_InitCPred("$is_thread_local", 2, p_is_thread_local,
@ -5223,6 +5080,7 @@ void Yap_InitCdMgr(void) {
SafePredFlag | SyncPredFlag); 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("$set_pred_owner", 2, p_set_pred_owner, SafePredFlag);
Yap_InitCPred("$mk_system_predicate", 2, p_mk_system_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);
Yap_InitCPred("$hide_predicate", 2, p_hide_predicate, SafePredFlag); Yap_InitCPred("$hide_predicate", 2, p_hide_predicate, SafePredFlag);

View File

@ -602,3 +602,67 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
LOCAL_PrologMode &= ~InErrorMode; LOCAL_PrologMode &= ~InErrorMode;
return P; return P;
} }
static Int
is_boolean( USES_REGS1 )
{
Term t = Deref(ARG1);
//Term Context = Deref(ARG2);
if (IsVarTerm(t)) {
Yap_Error(INSTANTIATION_ERROR, t, NULL);
return false;
}
return t == TermTrue || t == TermFalse;
}
static Int
is_callable( USES_REGS1 )
{
Term G = Deref(ARG1);
//Term Context = Deref(ARG2);
while (true) {
if (IsVarTerm(G)) {
Yap_Error(INSTANTIATION_ERROR, G, NULL);
return false;
}
if (IsApplTerm(G)) {
Functor f = FunctorOfTerm(G);
if (IsExtensionFunctor(f)) {
Yap_Error(TYPE_ERROR_CALLABLE, G, NULL);
}
if (f == FunctorModule) {
Term tm = ArgOfTerm( 1, G);
if (IsVarTerm(tm)) {
Yap_Error(INSTANTIATION_ERROR, G, NULL);
return false;
}
if (!IsAtomTerm(tm)) {
Yap_Error(TYPE_ERROR_CALLABLE, G, NULL);
return false;
}
G = ArgOfTerm( 2, G );
} else {
return true;
}
} else if (IsPairTerm(G) || IsAtomTerm(G)) {
return true;
} else {
Yap_Error(TYPE_ERROR_CALLABLE, G, NULL);
return false;
}
}
return false;
}
void
Yap_InitErrorPreds( void )
{
CACHE_REGS
Term cm = CurrentModule;
CurrentModule = ERROR_MODULE;
Yap_InitCPred("is_boolean", 2, is_boolean, 0L);
Yap_InitCPred("is_callable", 2, is_callable, 0L);
CurrentModule = cm;
}

View File

@ -192,13 +192,7 @@ inline static Int do_execute(Term t, Term mod USES_REGS) {
Term t0 = t; Term t0 = t;
/* first do predicate expansion, even before you process signals. /* first do predicate expansion, even before you process signals.
This way you don't get to spy goal_expansion(). */ This way you don't get to spy goal_expansion(). */
if (PRED_GOAL_EXPANSION_ALL) { if (Yap_has_a_signal() && !LOCAL_InterruptsDisabled &&
/* disable creeping when we do goal expansion */
if (!LOCAL_InterruptsDisabled && Yap_get_signal(YAP_CREEP_SIGNAL)) {
CalculateStackGap(PASS_REGS1);
}
return CallMetaCall(ARG1, mod PASS_REGS);
} else if (Yap_has_a_signal() && !LOCAL_InterruptsDisabled &&
!(LOCAL_PrologMode & (AbortMode | InterruptMode | SystemMode))) { !(LOCAL_PrologMode & (AbortMode | InterruptMode | SystemMode))) {
return EnterCreepMode(t, mod PASS_REGS); return EnterCreepMode(t, mod PASS_REGS);
} }
@ -222,7 +216,7 @@ restart_exec:
pen = RepPredProp(PredPropByFunc(f, mod)); pen = RepPredProp(PredPropByFunc(f, mod));
/* You thought we would be over by now */ /* You thought we would be over by now */
/* but no meta calls require special preprocessing */ /* but no meta calls require special preprocessing */
if (pen->PredFlags & (GoalExPredFlag | MetaPredFlag)) { if (pen->PredFlags & MetaPredFlag) {
if (f == FunctorModule) { if (f == FunctorModule) {
Term tmod = ArgOfTerm(1, t); Term tmod = ArgOfTerm(1, t);
if (!IsVarTerm(tmod) && IsAtomTerm(tmod)) { if (!IsVarTerm(tmod) && IsAtomTerm(tmod)) {
@ -359,14 +353,7 @@ restart_exec:
if (IsExtensionFunctor(f)) { if (IsExtensionFunctor(f)) {
return CallError(TYPE_ERROR_CALLABLE, t, mod PASS_REGS); return CallError(TYPE_ERROR_CALLABLE, t, mod PASS_REGS);
} }
if (PRED_GOAL_EXPANSION_ALL) { if (Yap_has_a_signal() && !LOCAL_InterruptsDisabled) {
/* disable creeping when we do goal expansion */
if (Yap_get_signal(YAP_CREEP_SIGNAL) && !LOCAL_InterruptsDisabled) {
CalculateStackGap(PASS_REGS1);
}
t = copy_execn_to_heap(f, pt, n, arity, mod PASS_REGS);
return CallMetaCall(t, mod PASS_REGS);
} else if (Yap_has_a_signal() && !LOCAL_InterruptsDisabled) {
return EnterCreepMode( return EnterCreepMode(
copy_execn_to_heap(f, pt, n, arity, CurrentModule PASS_REGS), copy_execn_to_heap(f, pt, n, arity, CurrentModule PASS_REGS),
mod PASS_REGS); mod PASS_REGS);
@ -377,7 +364,7 @@ restart_exec:
pen = RepPredProp(PredPropByFunc(f, mod)); pen = RepPredProp(PredPropByFunc(f, mod));
/* You thought we would be over by now */ /* You thought we would be over by now */
/* but no meta calls require special preprocessing */ /* but no meta calls require special preprocessing */
if (pen->PredFlags & (GoalExPredFlag | MetaPredFlag)) { if (pen->PredFlags & MetaPredFlag) {
Term t = copy_execn_to_heap(f, pt, n, arity, mod PASS_REGS); Term t = copy_execn_to_heap(f, pt, n, arity, mod PASS_REGS);
return (CallMetaCall(t, mod PASS_REGS)); return (CallMetaCall(t, mod PASS_REGS));
} }
@ -650,33 +637,39 @@ static Int execute_in_mod(USES_REGS1) { /* '$execute'(Goal) */
return (do_execute(Deref(ARG1), Deref(ARG2) PASS_REGS)); return (do_execute(Deref(ARG1), Deref(ARG2) PASS_REGS));
} }
static Int do_goal_expansion(USES_REGS1) { static Int _user_expand_goal(USES_REGS1) {
Int creeping = Yap_get_signal(YAP_CREEP_SIGNAL); Int creeping = Yap_get_signal(YAP_CREEP_SIGNAL);
Int out = FALSE; Int out = FALSE;
PredEntry *pe; PredEntry *pe;
Term cmod = Deref(ARG2); Term cmod = CurrentModule, omod = cmod;
Term mg_args[2], mg;
ARG2 = ARG3; Term g = Yap_YapStripModule( ARG1, &cmod);
yhandle_t h1 = Yap_InitSlot( ARG1), h2 = Yap_InitSlot( ARG2);
/* CurMod:goal_expansion(A,B) */ /* CurMod:goal_expansion(A,B) */
ARG1 = g;
if ((pe = RepPredProp(Yap_GetPredPropByFunc(FunctorGoalExpansion2, cmod))) && if ((pe = RepPredProp(Yap_GetPredPropByFunc(FunctorGoalExpansion2, cmod))) &&
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE && pe->OpcodeOfPred != FAIL_OPCODE &&
pe->OpcodeOfPred != UNDEF_OPCODE &&
Yap_execute_pred(pe, NULL, false PASS_REGS)) { Yap_execute_pred(pe, NULL, false PASS_REGS)) {
out = TRUE; out = true;
ARG3 = ARG2;
goto complete; goto complete;
} }
/* system:goal_expansion(A,B) */ /* system:goal_expansion(A,B) */
mg_args[0] = cmod;
mg_args[1] = Yap_GetFromSlot(h1);
ARG1 = Yap_MkApplTerm( FunctorModule, 2, mg_args );
ARG2 = Yap_GetFromSlot(h2);
if ((pe = RepPredProp( if ((pe = RepPredProp(
Yap_GetPredPropByFunc(FunctorGoalExpansion2, SYSTEM_MODULE))) && Yap_GetPredPropByFunc(FunctorGoalExpansion2, SYSTEM_MODULE))) &&
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE && pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
Yap_execute_pred(pe, NULL, false PASS_REGS)) { Yap_execute_pred(pe, NULL, false PASS_REGS)) {
out = TRUE; out = true;
ARG3 = ARG2;
goto complete; goto complete;
} }
ARG3 = ARG2; ARG1 = Yap_GetFromSlot(h1);
ARG2 = cmod; ARG2 = cmod;
ARG3 = Yap_GetFromSlot(h2);
/* user:goal_expansion(A,CurMod,B) */ /* user:goal_expansion(A,CurMod,B) */
if ((pe = RepPredProp( if ((pe = RepPredProp(
Yap_GetPredPropByFunc(FunctorGoalExpansion, USER_MODULE))) && Yap_GetPredPropByFunc(FunctorGoalExpansion, USER_MODULE))) &&
@ -685,7 +678,10 @@ static Int do_goal_expansion(USES_REGS1) {
out = TRUE; out = TRUE;
goto complete; goto complete;
} }
ARG2 = ARG3; mg_args[0] = cmod;
mg_args[1] = Yap_GetFromSlot(h1);
ARG1 = Yap_MkApplTerm( FunctorModule, 2, mg_args );
ARG2 = Yap_GetFromSlot(h2);
/* user:goal_expansion(A,B) */ /* user:goal_expansion(A,B) */
if (cmod != USER_MODULE && /* we have tried this before */ if (cmod != USER_MODULE && /* we have tried this before */
(pe = RepPredProp( (pe = RepPredProp(
@ -699,6 +695,7 @@ complete:
if (creeping) { if (creeping) {
Yap_signal(YAP_CREEP_SIGNAL); Yap_signal(YAP_CREEP_SIGNAL);
} }
CurrentModule = omod;
return out; return out;
} }
@ -1006,12 +1003,6 @@ static Int execute_depth_limit(USES_REGS1) {
} }
#endif #endif
static Int pred_goal_expansion_on(USES_REGS1) {
/* a goal needs expansion if we have goal_expansion defined or
if the goal is a meta-call */
return PRED_GOAL_EXPANSION_ON;
}
static Int exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) { static Int exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
int lval, out; int lval, out;
@ -1892,8 +1883,6 @@ void Yap_InitExecFs(void) {
Yap_InitCPred("trail_suspension_marker", 1, trail_suspension_marker, 0); Yap_InitCPred("trail_suspension_marker", 1, trail_suspension_marker, 0);
Yap_InitCPred("cut_at", 1, clean_ifcp, SafePredFlag); Yap_InitCPred("cut_at", 1, clean_ifcp, SafePredFlag);
CurrentModule = cm; CurrentModule = cm;
Yap_InitCPred("$pred_goal_expansion_on", 0, pred_goal_expansion_on,
SafePredFlag);
Yap_InitCPred("$restore_regs", 1, restore_regs, Yap_InitCPred("$restore_regs", 1, restore_regs,
NoTracePredFlag | SafePredFlag); NoTracePredFlag | SafePredFlag);
Yap_InitCPred("$restore_regs", 2, restore_regs2, Yap_InitCPred("$restore_regs", 2, restore_regs2,
@ -1905,7 +1894,7 @@ void Yap_InitExecFs(void) {
Yap_InitCPred("$generate_pred_info", 4, generate_pred_info, 0); Yap_InitCPred("$generate_pred_info", 4, generate_pred_info, 0);
Yap_InitCPred("$uncaught_throw", 0, uncaught_throw, 0); Yap_InitCPred("$uncaught_throw", 0, uncaught_throw, 0);
Yap_InitCPred("$reset_exception", 1, reset_exception, 0); Yap_InitCPred("$reset_exception", 1, reset_exception, 0);
Yap_InitCPred("$do_goal_expansion", 3, do_goal_expansion, 0); Yap_InitCPred("_user_expand_goal", 2, _user_expand_goal, 0);
Yap_InitCPred("$do_term_expansion", 2, do_term_expansion, 0); Yap_InitCPred("$do_term_expansion", 2, do_term_expansion, 0);
Yap_InitCPred("$get_exception", 1, get_exception, 0); Yap_InitCPred("$get_exception", 1, get_exception, 0);
} }

View File

@ -4267,6 +4267,7 @@ Yap_locked_gc(Int predarity, CELL *current_env, yamop *nextop)
CACHE_REGS CACHE_REGS
int res; int res;
#if YAPOR_COPY #if YAPOR_COPY
fprintf(stderr, "\n\n***** Trying to call the garbage collector in YAPOR/copying ****\n\n\n"); fprintf(stderr, "\n\n***** Trying to call the garbage collector in YAPOR/copying ****\n\n\n");
exit( 1 ); exit( 1 );
#endif #endif

View File

@ -106,9 +106,6 @@
} }
#endif /* FROZEN_STACKS */ #endif /* FROZEN_STACKS */
d0 = ARG1; d0 = ARG1;
if (PRED_GOAL_EXPANSION_ALL) {
goto execute_metacall;
}
restart_execute: restart_execute:
deref_head(d0, execute_unk); deref_head(d0, execute_unk);
execute_nvar: execute_nvar:
@ -119,7 +116,7 @@
} }
pen = RepPredProp(PredPropByFunc(f, mod)); pen = RepPredProp(PredPropByFunc(f, mod));
execute_pred_f: execute_pred_f:
if (pen->PredFlags & (MetaPredFlag|GoalExPredFlag)) { if (pen->PredFlags & MetaPredFlag) {
/* just strip all of M:G */ /* just strip all of M:G */
if (f == FunctorModule) { if (f == FunctorModule) {
Term tmod = ArgOfTerm(1,d0); Term tmod = ArgOfTerm(1,d0);

View File

@ -25,6 +25,7 @@ static char SccsId[] = "%W% %G%";
static Int current_module(USES_REGS1); static Int current_module(USES_REGS1);
static Int current_module1(USES_REGS1); static Int current_module1(USES_REGS1);
static ModEntry *LookupModule(Term a); static ModEntry *LookupModule(Term a);
static ModEntry *LookupSystemModule(Term a);
static ModEntry *FetchModuleEntry(Atom at) static ModEntry *FetchModuleEntry(Atom at)
/* get predicate entry for ap/arity; create it if neccessary. */ /* get predicate entry for ap/arity; create it if neccessary. */
@ -89,6 +90,17 @@ Term Yap_getUnknownModule(ModEntry *m) {
} }
} }
bool Yap_getUnknown ( Term mod) {
ModEntry *m = LookupModule( mod );
if (m && m->flags & UNKNOWN_ERROR) {
return TermError;
} else if (m && m->flags & UNKNOWN_WARNING) {
return TermWarning;
} else {
return TermFail;
}
}
bool Yap_CharacterEscapes(Term mt) { bool Yap_CharacterEscapes(Term mt) {
if (mt == PROLOG_MODULE) mt = TermProlog; if (mt == PROLOG_MODULE) mt = TermProlog;
@ -118,6 +130,20 @@ Term Yap_Module_Name(PredEntry *ap) {
} }
static ModEntry *LookupSystemModule(Term a) {
Atom at;
ModEntry *me;
/* prolog module */
if (a == 0) {
return GetModuleEntry(AtomProlog);
}
at = AtomOfTerm(a);
me = GetModuleEntry(at);
me->flags |= M_SYSTEM;
return me;}
static ModEntry *LookupModule(Term a) { static ModEntry *LookupModule(Term a) {
Atom at; Atom at;
ModEntry *me; ModEntry *me;
@ -131,6 +157,13 @@ static ModEntry *LookupModule(Term a) {
return me; return me;
} }
bool Yap_isSystemModule(Term a) {
ModEntry *me = LookupModule(a);
return
me != NULL &&
me->flags & M_SYSTEM;
}
Term Yap_Module(Term tmod) { Term Yap_Module(Term tmod) {
LookupModule(tmod); LookupModule(tmod);
return tmod; return tmod;
@ -141,6 +174,7 @@ ModEntry *Yap_GetModuleEntry(Term mod) {
if (!(me = LookupModule(mod))) if (!(me = LookupModule(mod)))
return NULL; return NULL;
return me; return me;
} }
Term Yap_GetModuleFromEntry(ModEntry *me) { Term Yap_GetModuleFromEntry(ModEntry *me) {
@ -191,13 +225,6 @@ static Int
return TRUE; return TRUE;
} }
static Int current_module1(USES_REGS1) { /* $current_module(Old)
*/
if (CurrentModule)
return Yap_unify_constant(ARG1, CurrentModule);
return Yap_unify_constant(ARG1, TermProlog);
}
static Int change_module(USES_REGS1) { /* $change_module(New) */ static Int change_module(USES_REGS1) { /* $change_module(New) */
Term mod = Deref(ARG1); Term mod = Deref(ARG1);
LookupModule(mod); LookupModule(mod);
@ -206,6 +233,14 @@ static Int change_module(USES_REGS1) { /* $change_module(New) */
return TRUE; return TRUE;
} }
static Int current_module1(USES_REGS1) { /* $current_module(Old)
*/
if (CurrentModule)
return Yap_unify_constant(ARG1, CurrentModule);
return Yap_unify_constant(ARG1, TermProlog);
}
static Int cont_current_module(USES_REGS1) { static Int cont_current_module(USES_REGS1) {
ModEntry *imod = AddressOfTerm(EXTRA_CBACK_ARG(1, 1)), *next; ModEntry *imod = AddressOfTerm(EXTRA_CBACK_ARG(1, 1)), *next;
Term t = MkAtomTerm(imod->AtomOfME); Term t = MkAtomTerm(imod->AtomOfME);
@ -280,6 +315,42 @@ static Int init_ground_module(USES_REGS1) {
return cont_ground_module(PASS_REGS1); return cont_ground_module(PASS_REGS1);
} }
/**
* @pred is_system_module( + _Mod_)
*
* @param module
*
* @return
*/
static Int is_system_module( USES_REGS1 )
{
Term t;
if (IsVarTerm(t = Deref (ARG1))) {
return false;
}
if (!IsAtomTerm(t)) {
Yap_Error(TYPE_ERROR_ATOM, t, "load_files/2");
return false;
}
return Yap_isSystemModule( t );
}
static Int system_module( USES_REGS1 )
{
ModEntry *me;
Term t;
if (IsVarTerm(t = Deref (ARG1))) {
Yap_Error( INSTANTIATION_ERROR, t, NULL);
return false;
}
if (!IsAtomTerm(t)) {
Yap_Error(TYPE_ERROR_ATOM, t, NULL);
return false;
}
me = LookupSystemModule( t );
return me != NULL;
}
static Int strip_module(USES_REGS1) { static Int strip_module(USES_REGS1) {
Term t1 = Deref(ARG1), tmod = CurrentModule; Term t1 = Deref(ARG1), tmod = CurrentModule;
if (tmod == PROLOG_MODULE) { if (tmod == PROLOG_MODULE) {
@ -359,6 +430,20 @@ static Int context_module(USES_REGS1) {
return Yap_unify(ARG1, CurrentModule); return Yap_unify(ARG1, CurrentModule);
} }
/**
* @pred source_module(-Mod)
*
* @param Mod is the current text source module.
*
* : _Mod_ is the current read-in or source module.
*/
static Int source_module(USES_REGS1) {
if (LOCAL_SourceModule == PROLOG_MODULE) {
return Yap_unify(ARG1, TermProlog);
}
return Yap_unify(ARG1, LOCAL_SourceModule);
}
Term Yap_StripModule(Term t, Term *modp) { Term Yap_StripModule(Term t, Term *modp) {
CACHE_REGS CACHE_REGS
Term tmod; Term tmod;
@ -406,9 +491,12 @@ void Yap_InitModulesC(void) {
Yap_InitCPred("$change_module", 1, change_module, Yap_InitCPred("$change_module", 1, change_module,
SafePredFlag | SyncPredFlag); SafePredFlag | SyncPredFlag);
Yap_InitCPred("strip_module", 3, strip_module, SafePredFlag | SyncPredFlag); Yap_InitCPred("strip_module", 3, strip_module, SafePredFlag | SyncPredFlag);
Yap_InitCPred("source_module", 1, source_module, SafePredFlag | SyncPredFlag);
Yap_InitCPred("$yap_strip_module", 3, yap_strip_module, Yap_InitCPred("$yap_strip_module", 3, yap_strip_module,
SafePredFlag | SyncPredFlag); SafePredFlag | SyncPredFlag);
Yap_InitCPred("context_module", 1, context_module, 0); Yap_InitCPred("context_module", 1, context_module, 0);
Yap_InitCPred("system_module", 1, system_module, SafePredFlag);
Yap_InitCPred("is_system_module", 1, is_system_module, SafePredFlag);
Yap_InitCPredBack("$all_current_modules", 1, 1, init_current_module, Yap_InitCPredBack("$all_current_modules", 1, 1, init_current_module,
cont_current_module, SafePredFlag | SyncPredFlag); cont_current_module, SafePredFlag | SyncPredFlag);
Yap_InitCPredBack("$ground_module", 3, 1, init_ground_module, Yap_InitCPredBack("$ground_module", 3, 1, init_ground_module,
@ -417,19 +505,19 @@ void Yap_InitModulesC(void) {
void Yap_InitModules(void) { void Yap_InitModules(void) {
CACHE_REGS CACHE_REGS
LookupModule(MkAtomTerm(AtomProlog)); LookupSystemModule(MkAtomTerm(AtomProlog));
LOCAL_SourceModule = MkAtomTerm(AtomProlog); LOCAL_SourceModule = MkAtomTerm(AtomProlog);
LookupModule(USER_MODULE); LookupModule(USER_MODULE);
LookupModule(IDB_MODULE); LookupModule(IDB_MODULE);
LookupModule(ATTRIBUTES_MODULE); LookupModule(ATTRIBUTES_MODULE);
LookupModule(CHARSIO_MODULE); LookupSystemModule(CHARSIO_MODULE);
LookupModule(TERMS_MODULE); LookupSystemModule(TERMS_MODULE);
LookupModule(SYSTEM_MODULE); LookupSystemModule(SYSTEM_MODULE);
LookupModule(READUTIL_MODULE); LookupSystemModule(READUTIL_MODULE);
LookupModule(HACKS_MODULE); LookupSystemModule(HACKS_MODULE);
LookupModule(ARG_MODULE); LookupModule(ARG_MODULE);
LookupModule(GLOBALS_MODULE); LookupSystemModule(GLOBALS_MODULE);
LookupModule(DBLOAD_MODULE); LookupSystemModule(DBLOAD_MODULE);
LookupModule(RANGE_MODULE); LookupSystemModule(RANGE_MODULE);
CurrentModule = PROLOG_MODULE; CurrentModule = PROLOG_MODULE;
} }

View File

@ -39,7 +39,8 @@ extended where necessary with attributes denoting integer precedence or
operator type. operator type.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
term ----> subterm(1200) end_of_term_marker term
----> subterm(1200) end_of_term_marker
subterm(N) ----> term(M) [M <= N] subterm(N) ----> term(M) [M <= N]
@ -169,9 +170,7 @@ static Term ParseTerm( int, JMPBUFF *CACHE_TYPE);
const char *Yap_tokRep(TokEntry *tokptr); const char *Yap_tokRep(TokEntry *tokptr);
static void static void syntax_msg(const char *msg, ...) {
syntax_msg( const char *msg, ...)
{
CACHE_REGS CACHE_REGS
va_list ap; va_list ap;
@ -225,7 +224,8 @@ syntax_msg( const char *msg, ...)
#define FAIL siglongjmp(FailBuff->JmpBuff, 1) #define FAIL siglongjmp(FailBuff->JmpBuff, 1)
VarEntry *Yap_LookupVar(const char *var) /* lookup variable in variables table */ VarEntry *
Yap_LookupVar(const char *var) /* lookup variable in variables table */
{ {
CACHE_REGS CACHE_REGS
VarEntry *p; VarEntry *p;
@ -627,11 +627,7 @@ loop:
if (LOCAL_tokptr->Tok == Ord(Ponctuation_tok)) { if (LOCAL_tokptr->Tok == Ord(Ponctuation_tok)) {
if (((int)LOCAL_tokptr->TokInfo) == ',') { if (((int)LOCAL_tokptr->TokInfo) == ',') {
NextToken; NextToken;
if (LOCAL_tokptr->Tok == Ord(Name_tok) && {
strcmp((char *)RepAtom((Atom)(LOCAL_tokptr->TokInfo))->StrOfAE, "..") == 0) {
NextToken;
to_store[1] = ParseTerm( 999, FailBuff PASS_REGS);
} else {
/* check for possible overflow against local stack */ /* check for possible overflow against local stack */
if (HR > ASP - 4096) { if (HR > ASP - 4096) {
to_store[1] = TermNil; to_store[1] = TermNil;
@ -649,7 +645,8 @@ loop:
to_store[1] = MkAtomTerm(AtomNil); to_store[1] = MkAtomTerm(AtomNil);
} }
} else { } else {
syntax_msg("looking for symbol ',','|' got symbol '%s'", Yap_tokRep(LOCAL_tokptr) ); syntax_msg("looking for symbol ',','|' got symbol '%s'",
Yap_tokRep(LOCAL_tokptr));
FAIL; FAIL;
} }
return (o); return (o);
@ -719,11 +716,11 @@ static Term ParseTerm( int prio, JMPBUFF *FailBuff USES_REGS) {
/* try to parse as a prefix operator */ /* try to parse as a prefix operator */
TRY( TRY(
/* build appl on the heap */ /* build appl on the heap */
func = Yap_MkFunctor((Atom)t, 1); func = Yap_MkFunctor((Atom)t, 1); if (func == NULL) {
if (func == NULL) {
syntax_msg("Heap Overflow"); syntax_msg("Heap Overflow");
FAIL; FAIL;
} t = ParseTerm( oprprio, FailBuff PASS_REGS); }
t = ParseTerm(oprprio, FailBuff PASS_REGS);
t = Yap_MkApplTerm(func, 1, &t); t = Yap_MkApplTerm(func, 1, &t);
/* check for possible overflow against local stack */ /* check for possible overflow against local stack */
if (HR > ASP - 4096) { if (HR > ASP - 4096) {
@ -748,9 +745,9 @@ static Term ParseTerm( int prio, JMPBUFF *FailBuff USES_REGS) {
case String_tok: /* build list on the heap */ case String_tok: /* build list on the heap */
{ {
Volatile char *p = (char *)LOCAL_tokptr->TokInfo; Volatile char *p = (char *)LOCAL_tokptr->TokInfo;
t = Yap_CharsToTDQ(p, CurrentModule, ENC_ISO_LATIN1 PASS_REGS); t = Yap_CharsToTDQ(p, CurrentModule, LOCAL_encoding PASS_REGS);
if (!t) { if (!t) {
syntax_msg( "could not convert \'%s\'", (char *)LOCAL_tokptr->TokInfo ); syntax_msg("could not convert \"%s\"", (char *)LOCAL_tokptr->TokInfo);
FAIL; FAIL;
} }
NextToken; NextToken;
@ -771,7 +768,7 @@ static Term ParseTerm( int prio, JMPBUFF *FailBuff USES_REGS) {
{ {
Volatile char *p = (char *)LOCAL_tokptr->TokInfo; Volatile char *p = (char *)LOCAL_tokptr->TokInfo;
t = Yap_CharsToTBQ(p, CurrentModule, ENC_ISO_LATIN1 PASS_REGS); t = Yap_CharsToTBQ(p, CurrentModule, LOCAL_encoding PASS_REGS);
if (!t) { if (!t) {
syntax_msg("could not convert \'%s\"", (char *)LOCAL_tokptr->TokInfo); syntax_msg("could not convert \'%s\"", (char *)LOCAL_tokptr->TokInfo);
FAIL; FAIL;
@ -884,21 +881,23 @@ case Var_tok:
NextToken; NextToken;
t = ParseTerm(GLOBAL_MaxPriority, FailBuff PASS_REGS); t = ParseTerm(GLOBAL_MaxPriority, FailBuff PASS_REGS);
if (LOCAL_tokptr->Tok != QuasiQuotes_tok) { if (LOCAL_tokptr->Tok != QuasiQuotes_tok) {
syntax_msg( "expected to find quasi quotes, got \"%s\"", , Yap_tokRep(LOCAL_tokptr) ); syntax_msg("expected to find quasi quotes, got \"%s\"", ,
Yap_tokRep(LOCAL_tokptr));
FAIL; FAIL;
} }
if (!(is_quasi_quotation_syntax(t, &at))) { if (!(is_quasi_quotation_syntax(t, &at))) {
syntax_msg( "bad quasi quotation syntax, at \"%s\"", Yap_tokRep(LOCAL_tokptr) ); syntax_msg("bad quasi quotation syntax, at \"%s\"",
Yap_tokRep(LOCAL_tokptr));
FAIL; FAIL;
} }
/* Arg 2: the content */ /* Arg 2: the content */
tn = Yap_MkNewApplTerm(SWIFunctorToFunctor(FUNCTOR_quasi_quotation4), 4); tn = Yap_MkNewApplTerm(SWIFunctorToFunctor(FUNCTOR_quasi_quotation4), 4);
tnp = RepAppl(tn) + 1; tnp = RepAppl(tn) + 1;
tnp[0] = MkAtomTerm(at); tnp[0] = MkAtomTerm(at);
if (!get_quasi_quotation(Yap_InitSlot(ArgOfTerm(2, tn)), if (!get_quasi_quotation(Yap_InitSlot(ArgOfTerm(2, tn)), &qq->text,
&qq->text,
qq->text + strlen((const char *)qq->text))) { qq->text + strlen((const char *)qq->text))) {
syntax_msg( "could not get quasi quotation, at \"%s\"", Yap_tokRep(LOCAL_tokptr) ); syntax_msg("could not get quasi quotation, at \"%s\"",
Yap_tokRep(LOCAL_tokptr));
FAIL; FAIL;
} }
if (positions) { if (positions) {
@ -909,18 +908,19 @@ case Var_tok:
FUNCTOR_minus2, PL_INTPTR, FUNCTOR_minus2, PL_INTPTR,
qq->mid.charno + 2, /* end of | token */ qq->mid.charno + 2, /* end of | token */
PL_INTPTR, qqend - 2)) /* end minus "|}" */ PL_INTPTR, qqend - 2)) /* end minus "|}" */
syntax_msg( "failed to unify quasi quotation, at \"%s\"", Yap_tokRep(LOCAL_tokptr) ); syntax_msg("failed to unify quasi quotation, at \"%s\"",
Yap_tokRep(LOCAL_tokptr));
FAIL; FAIL;
} }
tnp[2] = tnp[2] = Yap_GetFromSlot(LOCAL_varnames); /* Arg 3: the var dictionary */
Yap_GetFromSlot(LOCAL_varnames); /* Arg 3: the var dictionary */
/* Arg 4: the result */ /* Arg 4: the result */
t = ArgOfTerm(4, tn); t = ArgOfTerm(4, tn);
if (!(to = PL_new_term_ref()) || if (!(to = PL_new_term_ref()) ||
!PL_unify_list(LOCAL_qq_tail, to, LOCAL_qq_tail) || !PL_unify_list(LOCAL_qq_tail, to, LOCAL_qq_tail) ||
!PL_unify(to, Yap_InitSlot(tn))) { !PL_unify(to, Yap_InitSlot(tn))) {
syntax_msg( "failed to unify quasi quotation, at \"%s\"", Yap_tokRep(LOCAL_tokptr) ); syntax_msg("failed to unify quasi quotation, at \"%s\"",
Yap_tokRep(LOCAL_tokptr));
FAIL; FAIL;
} }
} }
@ -941,7 +941,8 @@ case Var_tok:
opprio <= prio && oplprio >= curprio) { opprio <= prio && oplprio >= curprio) {
/* try parsing as infix operator */ /* try parsing as infix operator */
Volatile int oldprio = curprio; Volatile int oldprio = curprio;
TRY3(func = Yap_MkFunctor((Atom)LOCAL_tokptr->TokInfo, 2); TRY3(
func = Yap_MkFunctor((Atom)LOCAL_tokptr->TokInfo, 2);
if (func == NULL) { if (func == NULL) {
syntax_msg("Heap Overflow"); syntax_msg("Heap Overflow");
FAIL; FAIL;
@ -1056,20 +1057,19 @@ Term Yap_Parse(UInt prio) {
#if DEBUG #if DEBUG
if (GLOBAL_Option['p' - 'a' + 1]) { if (GLOBAL_Option['p' - 'a' + 1]) {
Yap_DebugPutc(stderr, '['); Yap_DebugPutc(stderr, '[');
if (t==0) Yap_DebugPlWrite(MkIntTerm(0)); if (t == 0)
else Yap_DebugPlWrite(t); Yap_DebugPlWrite(MkIntTerm(0));
else
Yap_DebugPlWrite(t);
Yap_DebugPutc(stderr, ']'); Yap_DebugPutc(stderr, ']');
Yap_DebugPutc(stderr, '\n'); Yap_DebugPutc(stderr, '\n');
} }
#endif #endif
Yap_CloseSlots(sls); Yap_CloseSlots(sls);
if (LOCAL_tokptr != NULL && if (LOCAL_tokptr != NULL && LOCAL_tokptr->Tok != Ord(eot_tok)) {
LOCAL_tokptr->Tok != Ord(eot_tok)
) {
t = 0; t = 0;
} }
if (t != 0 && if (t != 0 && LOCAL_Error_TYPE == SYNTAX_ERROR) {
LOCAL_Error_TYPE == SYNTAX_ERROR) {
LOCAL_Error_TYPE = YAP_NO_ERROR; LOCAL_Error_TYPE = YAP_NO_ERROR;
LOCAL_ErrorMessage = NULL; LOCAL_ErrorMessage = NULL;
} }

View File

@ -1735,17 +1735,16 @@ TokEntry *Yap_tokenizer(struct stream_desc *inp_stream, bool store_comments,
case SY: case SY:
if (ch == '`') if (ch == '`')
goto quoted_string; goto quoted_string;
if (ch == '.') { och = ch;
int nch = Yap_peek(inp_stream - GLOBAL_Stream); ch = getchr(inp_stream);
if (chtype(nch) == BS || chtype(nch) == EF || nch == '%') { if (och == '.') {
if (chtype(ch) == BS || chtype(ch) == EF || ch == '%') {
t->Tok = Ord(kind = eot_tok); t->Tok = Ord(kind = eot_tok);
if (chtype(ch) == EF) if (chtype(ch) == EF)
mark_eof(inp_stream); mark_eof(inp_stream);
return l; return l;
} }
} }
och = ch;
ch = getchr(inp_stream);
if (och == '/' && ch == '*') { if (och == '/' && ch == '*') {
if (store_comments) { if (store_comments) {
CHECK_SPACE(); CHECK_SPACE();
@ -1830,9 +1829,9 @@ TokEntry *Yap_tokenizer(struct stream_desc *inp_stream, bool store_comments,
Yap_ReleasePreAllocCodeSpace((CODEADDR)TokImage); Yap_ReleasePreAllocCodeSpace((CODEADDR)TokImage);
t->Tok = Ord(kind = Name_tok); t->Tok = Ord(kind = Name_tok);
if (ch == '(') if (ch == '(')
solo_flag = FALSE; solo_flag = false;
else else
solo_flag = TRUE; solo_flag = true;
} }
break; break;

View File

@ -1588,7 +1588,7 @@ static Int p_unlock_system(USES_REGS1) {
return TRUE; return TRUE;
} }
static Int p_enterundefp(USES_REGS1) { static Int enter_undefp(USES_REGS1) {
if (LOCAL_DoingUndefp) { if (LOCAL_DoingUndefp) {
return FALSE; return FALSE;
} }
@ -1596,7 +1596,7 @@ static Int p_enterundefp(USES_REGS1) {
return TRUE; return TRUE;
} }
static Int p_exitundefp(USES_REGS1) { static Int exit_undefp(USES_REGS1) {
if (LOCAL_DoingUndefp) { if (LOCAL_DoingUndefp) {
LOCAL_DoingUndefp = FALSE; LOCAL_DoingUndefp = FALSE;
return TRUE; return TRUE;
@ -1745,8 +1745,8 @@ void Yap_InitCPreds(void) {
Yap_InitCPred("$halt", 1, p_halt, SyncPredFlag); Yap_InitCPred("$halt", 1, p_halt, SyncPredFlag);
Yap_InitCPred("$lock_system", 0, p_lock_system, SafePredFlag); Yap_InitCPred("$lock_system", 0, p_lock_system, SafePredFlag);
Yap_InitCPred("$unlock_system", 0, p_unlock_system, SafePredFlag); Yap_InitCPred("$unlock_system", 0, p_unlock_system, SafePredFlag);
Yap_InitCPred("$enter_undefp", 0, p_enterundefp, SafePredFlag); Yap_InitCPred("$enter_undefp", 0, enter_undefp, SafePredFlag);
Yap_InitCPred("$exit_undefp", 0, p_exitundefp, SafePredFlag); Yap_InitCPred("$exit_undefp", 0, exit_undefp, SafePredFlag);
#ifdef YAP_JIT #ifdef YAP_JIT
Yap_InitCPred("$jit_init", 1, p_jit, SafePredFlag | SyncPredFlag); Yap_InitCPred("$jit_init", 1, p_jit, SafePredFlag | SyncPredFlag);
@ -1772,6 +1772,7 @@ void Yap_InitCPreds(void) {
Yap_InitCmpPreds(); Yap_InitCmpPreds();
Yap_InitCoroutPreds(); Yap_InitCoroutPreds();
Yap_InitDBPreds(); Yap_InitDBPreds();
Yap_InitErrorPreds();
Yap_InitExecFs(); Yap_InitExecFs();
Yap_InitGlobals(); Yap_InitGlobals();
Yap_InitInlines(); Yap_InitInlines();

View File

@ -14334,9 +14334,6 @@ S_SREG = RepAppl(d0);
} }
#endif /* FROZEN_STACKS */ #endif /* FROZEN_STACKS */
d0 = ARG1; d0 = ARG1;
if (PRED_GOAL_EXPANSION_ALL) {
goto execute_metacall;
}
restart_execute: restart_execute:
deref_head(d0, execute_unk); deref_head(d0, execute_unk);
execute_nvar: execute_nvar:

View File

@ -445,7 +445,7 @@ static int legalAtom(unsigned char *s) /* Is this a legal atom ? */
} else if (Yap_chtype[ch] == SL) { } else if (Yap_chtype[ch] == SL) {
return (!s[1]); return (!s[1]);
} else if ((ch == ',' || ch == '.') && !s[1]) { } else if ((ch == ',' || ch == '.') && !s[1]) {
return FALSE; return false;
} else { } else {
if (ch == '/') { if (ch == '/') {
if (s[1] == '*') if (s[1] == '*')
@ -470,7 +470,9 @@ static wtype
AtomIsSymbols(unsigned char *s) /* Is this atom just formed by symbols ? */ AtomIsSymbols(unsigned char *s) /* Is this atom just formed by symbols ? */
{ {
int ch; int ch;
if (Yap_chtype[(int)s[0]] == SL && s[1] == '\0') if ( Yap_chtype[(int)s[0]] == SL &&
s[1] == '\0'
)
return (separator); return (separator);
while ((ch = *s++) != '\0') { while ((ch = *s++) != '\0') {
if (Yap_chtype[ch] != SY) if (Yap_chtype[ch] != SY)
@ -840,6 +842,9 @@ static void write_list(Term t, int direction, int depth,
do_jump = (direction >= 0); do_jump = (direction >= 0);
} }
if (wglb->MaxDepth != 0 && depth > wglb->MaxDepth) { if (wglb->MaxDepth != 0 && depth > wglb->MaxDepth) {
if (lastw == symbol || lastw == separator) {
wrputc(' ', wglb->stream);
}
wrputc('|', wglb->stream); wrputc('|', wglb->stream);
putAtom(Atom3Dots, wglb->Quote_illegal, wglb); putAtom(Atom3Dots, wglb->Quote_illegal, wglb);
return; return;
@ -856,6 +861,9 @@ static void write_list(Term t, int direction, int depth,
Term nt = from_pointer(RepPair(t) + 1, &nrwt, wglb); Term nt = from_pointer(RepPair(t) + 1, &nrwt, wglb);
/* we found an infinite loop */ /* we found an infinite loop */
if (IsAtomTerm(nt)) { if (IsAtomTerm(nt)) {
if (lastw == symbol || lastw == separator) {
wrputc(' ', wglb->stream);
}
wrputc('|', wglb->stream); wrputc('|', wglb->stream);
writeTerm(nt, 999, depth, FALSE, wglb, rwt); writeTerm(nt, 999, depth, FALSE, wglb, rwt);
} else { } else {
@ -865,6 +873,9 @@ static void write_list(Term t, int direction, int depth,
} }
restore_from_write(&nrwt, wglb); restore_from_write(&nrwt, wglb);
} else if (ti != MkAtomTerm(AtomNil)) { } else if (ti != MkAtomTerm(AtomNil)) {
if (lastw == symbol || lastw == separator) {
wrputc(' ', wglb->stream);
}
wrputc('|', wglb->stream); wrputc('|', wglb->stream);
lastw = separator; lastw = separator;
writeTerm(from_pointer(RepPair(t) + 1, &nrwt, wglb), 999, depth, FALSE, writeTerm(from_pointer(RepPair(t) + 1, &nrwt, wglb), 999, depth, FALSE,
@ -1101,6 +1112,9 @@ static void writeTerm(Term t, int p, int depth, int rinfixarg,
wrputc(',', wglb->stream); wrputc(',', wglb->stream);
lastw = separator; lastw = separator;
} else if (!strcmp((char *)RepAtom(atom)->StrOfAE, "|")) { } else if (!strcmp((char *)RepAtom(atom)->StrOfAE, "|")) {
if (lastw == symbol || lastw == separator) {
wrputc(' ', wglb->stream);
}
wrputc('|', wglb->stream); wrputc('|', wglb->stream);
lastw = separator; lastw = separator;
} else } else

View File

@ -17,15 +17,8 @@
@file TermExt.h @file TermExt.h
@page Extensions Extensions to Prolog
YAP includes a number of extensions over the original Prolog
language. Next, we discuss support to the most important ones.
*/ */
#ifdef USE_SYSTEM_MALLOC #ifdef USE_SYSTEM_MALLOC
#define SF_STORE (&(Yap_heap_regs->funcs)) #define SF_STORE (&(Yap_heap_regs->funcs))
#else #else
@ -54,16 +47,14 @@ language. Next, we discuss support to the most important ones.
#define TermNil MkAtomTerm(AtomNil) #define TermNil MkAtomTerm(AtomNil)
#define TermDot MkAtomTerm(AtomDot) #define TermDot MkAtomTerm(AtomDot)
typedef enum typedef enum {
{
db_ref_e = sizeof(Functor *), db_ref_e = sizeof(Functor *),
attvar_e = 2 * sizeof(Functor *), attvar_e = 2 * sizeof(Functor *),
double_e = 3 * sizeof(Functor *), double_e = 3 * sizeof(Functor *),
long_int_e = 4 * sizeof(Functor *), long_int_e = 4 * sizeof(Functor *),
big_int_e = 5 * sizeof(Functor *), big_int_e = 5 * sizeof(Functor *),
string_e = 6 * sizeof(Functor *) string_e = 6 * sizeof(Functor *)
} } blob_type;
blob_type;
#define FunctorDBRef ((Functor)(db_ref_e)) #define FunctorDBRef ((Functor)(db_ref_e))
#define FunctorAttVar ((Functor)(attvar_e)) #define FunctorAttVar ((Functor)(attvar_e))
@ -79,12 +70,9 @@ blob_type;
INLINE_ONLY inline EXTERN int __IsAttVar(CELL *pt USES_REGS); INLINE_ONLY inline EXTERN int __IsAttVar(CELL *pt USES_REGS);
INLINE_ONLY inline EXTERN int INLINE_ONLY inline EXTERN int __IsAttVar(CELL *pt USES_REGS) {
__IsAttVar (CELL *pt USES_REGS)
{
#ifdef YAP_H #ifdef YAP_H
return (pt)[-1] == (CELL)attvar_e return (pt)[-1] == (CELL)attvar_e && pt < HR;
&& pt < HR;
#else #else
return (pt)[-1] == (CELL)attvar_e; return (pt)[-1] == (CELL)attvar_e;
#endif #endif
@ -92,14 +80,11 @@ __IsAttVar (CELL *pt USES_REGS)
INLINE_ONLY inline EXTERN int GlobalIsAttVar(CELL *pt); INLINE_ONLY inline EXTERN int GlobalIsAttVar(CELL *pt);
INLINE_ONLY inline EXTERN int INLINE_ONLY inline EXTERN int GlobalIsAttVar(CELL *pt) {
GlobalIsAttVar (CELL *pt)
{
return (pt)[-1] == (CELL)attvar_e; return (pt)[-1] == (CELL)attvar_e;
} }
typedef enum typedef enum {
{
BIG_INT = 0x01, BIG_INT = 0x01,
BIG_RATIONAL = 0x02, BIG_RATIONAL = 0x02,
BIG_FLOAT = 0x04, BIG_FLOAT = 0x04,
@ -110,14 +95,11 @@ typedef enum
EXTERNAL_BLOB = 0x100, /* generic data */ EXTERNAL_BLOB = 0x100, /* generic data */
USER_BLOB_START = 0x1000, /* user defined blob */ USER_BLOB_START = 0x1000, /* user defined blob */
USER_BLOB_END = 0x1100 /* end of user defined blob */ USER_BLOB_END = 0x1100 /* end of user defined blob */
} } big_blob_type;
big_blob_type;
INLINE_ONLY inline EXTERN blob_type BlobOfFunctor(Functor f); INLINE_ONLY inline EXTERN blob_type BlobOfFunctor(Functor f);
INLINE_ONLY inline EXTERN blob_type INLINE_ONLY inline EXTERN blob_type BlobOfFunctor(Functor f) {
BlobOfFunctor (Functor f)
{
return (blob_type)((CELL)f); return (blob_type)((CELL)f);
} }
@ -131,11 +113,9 @@ typedef struct cp_frame {
#endif #endif
} copy_frame; } copy_frame;
#ifdef COROUTINING #ifdef COROUTINING
typedef struct typedef struct {
{
/* what to do when someone tries to bind our term to someone else /* what to do when someone tries to bind our term to someone else
in some predefined context */ in some predefined context */
void (*bind_op)(Term *, Term CACHE_TYPE); void (*bind_op)(Term *, Term CACHE_TYPE);
@ -149,26 +129,19 @@ typedef struct
} ext_op; } ext_op;
/* known delays */ /* known delays */
typedef enum typedef enum {
{
empty_ext = 0 * sizeof(ext_op), /* default op, this should never be called */ empty_ext = 0 * sizeof(ext_op), /* default op, this should never be called */
attvars_ext = 1 * sizeof(ext_op) /* support for attributed variables */ attvars_ext = 1 * sizeof(ext_op) /* support for attributed variables */
/* add your own extensions here */ /* add your own extensions here */
/* keep this one */ /* keep this one */
} } exts;
exts;
#endif #endif
#if defined(YAP_H) #if defined(YAP_H)
/* make sure that these data structures are the first thing to be allocated /* make sure that these data structures are the first thing to be allocated
in the heap when we start the system */ in the heap when we start the system */
typedef struct special_functors_struct typedef struct special_functors_struct {
{
#if 0 #if 0
struct ExtraAtomEntryStruct AtFoundVar; struct ExtraAtomEntryStruct AtFoundVar;
@ -181,8 +154,7 @@ typedef struct special_functors_struct
struct AtomEntryStruct *AtNil; struct AtomEntryStruct *AtNil;
struct AtomEntryStruct *AtDot; struct AtomEntryStruct *AtDot;
#endif #endif
} } special_functors;
special_functors;
#endif /* YAP_H */ #endif /* YAP_H */
INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr); INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr);
@ -195,28 +167,18 @@ INLINE_ONLY inline EXTERN Float FloatOfTerm (Term t);
#if SIZEOF_DOUBLE == SIZEOF_INT_P #if SIZEOF_DOUBLE == SIZEOF_INT_P
INLINE_ONLY inline EXTERN Term INLINE_ONLY inline EXTERN Term __MkFloatTerm(Float dbl USES_REGS) {
__MkFloatTerm (Float dbl USES_REGS) return (Term)((HR[0] = (CELL)FunctorDouble, *(Float *)(HR + 1) = dbl,
{ HR[2] = EndSpecials, HR += 3, AbsAppl(HR - 3)));
return (Term) ((HR[0] = (CELL) FunctorDouble, *(Float *) (HR + 1) =
dbl, HR[2] = EndSpecials, HR +=
3, AbsAppl (HR - 3)));
} }
INLINE_ONLY inline EXTERN Float FloatOfTerm(Term t) {
INLINE_ONLY inline EXTERN Float
FloatOfTerm (Term t)
{
return (Float)(*(Float *)(RepAppl(t) + 1)); return (Float)(*(Float *)(RepAppl(t) + 1));
} }
#define InitUnalignedFloat() #define InitUnalignedFloat()
INLINE_ONLY inline EXTERN Float INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr) {
CpFloatUnaligned(CELL *ptr)
{
return *((Float *)ptr); return *((Float *)ptr);
} }
@ -226,12 +188,9 @@ CpFloatUnaligned(CELL *ptr)
#define DOUBLE_ALIGNED(ADDR) ((CELL)(ADDR)&0x4) #define DOUBLE_ALIGNED(ADDR) ((CELL)(ADDR)&0x4)
INLINE_ONLY EXTERN inline void INLINE_ONLY EXTERN inline void AlignGlobalForDouble(USES_REGS1);
AlignGlobalForDouble( USES_REGS1 );
INLINE_ONLY EXTERN inline void INLINE_ONLY EXTERN inline void AlignGlobalForDouble(USES_REGS1) {
AlignGlobalForDouble( USES_REGS1 )
{
/* Force Alignment for floats. Note that garbage collector may /* Force Alignment for floats. Note that garbage collector may
break the alignment; */ break the alignment; */
if (!DOUBLE_ALIGNED(HR)) { if (!DOUBLE_ALIGNED(HR)) {
@ -241,19 +200,14 @@ AlignGlobalForDouble( USES_REGS1 )
} }
#ifdef i386 #ifdef i386
INLINE_ONLY inline EXTERN Float INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr) {
CpFloatUnaligned (CELL * ptr)
{
return *((Float *)(ptr + 1)); return *((Float *)(ptr + 1));
} }
#else #else
/* first, need to address the alignment problem */ /* first, need to address the alignment problem */
INLINE_ONLY inline EXTERN Float INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr) {
CpFloatUnaligned (CELL * ptr) union {
{
union
{
Float f; Float f;
CELL d[2]; CELL d[2];
} u; } u;
@ -264,24 +218,17 @@ CpFloatUnaligned (CELL * ptr)
#endif #endif
INLINE_ONLY inline EXTERN Term INLINE_ONLY inline EXTERN Term __MkFloatTerm(Float dbl USES_REGS) {
__MkFloatTerm (Float dbl USES_REGS) return (Term)((AlignGlobalForDouble(PASS_REGS1), HR[0] = (CELL)FunctorDouble,
{ *(Float *)(HR + 1) = dbl, HR[3] = EndSpecials, HR += 4,
return (Term) ((AlignGlobalForDouble ( PASS_REGS1 ), HR[0] = AbsAppl(HR - 4)));
(CELL) FunctorDouble, *(Float *) (HR + 1) = dbl, HR[3] =
EndSpecials, HR +=
4, AbsAppl (HR - 4)));
} }
INLINE_ONLY inline EXTERN Float FloatOfTerm(Term t) {
INLINE_ONLY inline EXTERN Float
FloatOfTerm (Term t)
{
return (Float)((DOUBLE_ALIGNED(RepAppl(t)) ? *(Float *)(RepAppl(t) + 1) return (Float)((DOUBLE_ALIGNED(RepAppl(t)) ? *(Float *)(RepAppl(t) + 1)
: CpFloatUnaligned(RepAppl(t)))); : CpFloatUnaligned(RepAppl(t))));
} }
/* no alignment problems for 64 bit machines */ /* no alignment problems for 64 bit machines */
#else #else
/* OOPS, YAP only understands Floats that are as large as cells or that /* OOPS, YAP only understands Floats that are as large as cells or that
@ -296,25 +243,19 @@ OOPS
#include <stddef.h> #include <stddef.h>
#endif #endif
INLINE_ONLY inline EXTERN int IsFloatTerm(Term); INLINE_ONLY inline EXTERN int IsFloatTerm(Term);
INLINE_ONLY inline EXTERN int INLINE_ONLY inline EXTERN int IsFloatTerm(Term t) {
IsFloatTerm (Term t)
{
return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorDouble); return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorDouble);
} }
/* extern Functor FunctorLongInt; */ /* extern Functor FunctorLongInt; */
#define MkLongIntTerm(i) __MkLongIntTerm((i)PASS_REGS) #define MkLongIntTerm(i) __MkLongIntTerm((i)PASS_REGS)
INLINE_ONLY inline EXTERN Term __MkLongIntTerm(Int USES_REGS); INLINE_ONLY inline EXTERN Term __MkLongIntTerm(Int USES_REGS);
INLINE_ONLY inline EXTERN Term INLINE_ONLY inline EXTERN Term __MkLongIntTerm(Int i USES_REGS) {
__MkLongIntTerm (Int i USES_REGS)
{
HR[0] = (CELL)FunctorLongInt; HR[0] = (CELL)FunctorLongInt;
HR[1] = (CELL)(i); HR[1] = (CELL)(i);
HR[2] = EndSpecials; HR[2] = EndSpecials;
@ -322,26 +263,18 @@ __MkLongIntTerm (Int i USES_REGS)
return AbsAppl(HR - 3); return AbsAppl(HR - 3);
} }
INLINE_ONLY inline EXTERN Int LongIntOfTerm(Term t); INLINE_ONLY inline EXTERN Int LongIntOfTerm(Term t);
INLINE_ONLY inline EXTERN Int INLINE_ONLY inline EXTERN Int LongIntOfTerm(Term t) {
LongIntOfTerm (Term t)
{
return (Int)(RepAppl(t)[1]); return (Int)(RepAppl(t)[1]);
} }
INLINE_ONLY inline EXTERN int IsLongIntTerm(Term); INLINE_ONLY inline EXTERN int IsLongIntTerm(Term);
INLINE_ONLY inline EXTERN int INLINE_ONLY inline EXTERN int IsLongIntTerm(Term t) {
IsLongIntTerm (Term t)
{
return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorLongInt); return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorLongInt);
} }
/****************************************************/ /****************************************************/
/*********** strings, coded as UTF-8 ****************/ /*********** strings, coded as UTF-8 ****************/
@ -354,9 +287,7 @@ IsLongIntTerm (Term t)
INLINE_ONLY inline EXTERN Term __MkStringTerm(const char *s USES_REGS); INLINE_ONLY inline EXTERN Term __MkStringTerm(const char *s USES_REGS);
INLINE_ONLY inline EXTERN Term INLINE_ONLY inline EXTERN Term __MkStringTerm(const char *s USES_REGS) {
__MkStringTerm (const char *s USES_REGS)
{
Term t = AbsAppl(HR); Term t = AbsAppl(HR);
size_t sz = ALIGN_BY_TYPE(strlen((char *)s) + 1, CELL); size_t sz = ALIGN_BY_TYPE(strlen((char *)s) + 1, CELL);
HR[0] = (CELL)FunctorString; HR[0] = (CELL)FunctorString;
@ -367,11 +298,11 @@ __MkStringTerm (const char *s USES_REGS)
return t; return t;
} }
INLINE_ONLY inline EXTERN Term __MkUStringTerm (const unsigned char *s USES_REGS); INLINE_ONLY inline EXTERN Term
__MkUStringTerm(const unsigned char *s USES_REGS);
INLINE_ONLY inline EXTERN Term INLINE_ONLY inline EXTERN Term
__MkUStringTerm (const unsigned char *s USES_REGS) __MkUStringTerm(const unsigned char *s USES_REGS) {
{
Term t = AbsAppl(HR); Term t = AbsAppl(HR);
size_t sz = ALIGN_BY_TYPE(strlen((char *)s) + 1, CELL); size_t sz = ALIGN_BY_TYPE(strlen((char *)s) + 1, CELL);
HR[0] = (CELL)FunctorString; HR[0] = (CELL)FunctorString;
@ -382,35 +313,24 @@ __MkUStringTerm (const unsigned char *s USES_REGS)
return t; return t;
} }
INLINE_ONLY inline EXTERN const unsigned char *UStringOfTerm(Term t); INLINE_ONLY inline EXTERN const unsigned char *UStringOfTerm(Term t);
INLINE_ONLY inline EXTERN const unsigned char * INLINE_ONLY inline EXTERN const unsigned char *UStringOfTerm(Term t) {
UStringOfTerm (Term t)
{
return (const unsigned char *)(RepAppl(t) + 2); return (const unsigned char *)(RepAppl(t) + 2);
} }
INLINE_ONLY inline EXTERN const char *StringOfTerm(Term t); INLINE_ONLY inline EXTERN const char *StringOfTerm(Term t);
INLINE_ONLY inline EXTERN const char * INLINE_ONLY inline EXTERN const char *StringOfTerm(Term t) {
StringOfTerm (Term t)
{
return (const char *)(RepAppl(t) + 2); return (const char *)(RepAppl(t) + 2);
} }
INLINE_ONLY inline EXTERN int IsStringTerm(Term); INLINE_ONLY inline EXTERN int IsStringTerm(Term);
INLINE_ONLY inline EXTERN int INLINE_ONLY inline EXTERN int IsStringTerm(Term t) {
IsStringTerm (Term t)
{
return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorString); return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorString);
} }
/****************************************************/ /****************************************************/
#ifdef USE_GMP #ifdef USE_GMP
@ -444,9 +364,7 @@ typedef struct {
INLINE_ONLY inline EXTERN int IsBigIntTerm(Term); INLINE_ONLY inline EXTERN int IsBigIntTerm(Term);
INLINE_ONLY inline EXTERN int INLINE_ONLY inline EXTERN int IsBigIntTerm(Term t) {
IsBigIntTerm (Term t)
{
return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorBigInt); return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorBigInt);
} }
@ -460,9 +378,7 @@ MP_RAT *Yap_BigRatOfTerm(Term);
INLINE_ONLY inline EXTERN void MPZ_SET(mpz_t, MP_INT *); INLINE_ONLY inline EXTERN void MPZ_SET(mpz_t, MP_INT *);
INLINE_ONLY inline EXTERN void INLINE_ONLY inline EXTERN void MPZ_SET(mpz_t dest, MP_INT *src) {
MPZ_SET (mpz_t dest, MP_INT *src)
{
dest->_mp_size = src->_mp_size; dest->_mp_size = src->_mp_size;
dest->_mp_alloc = src->_mp_alloc; dest->_mp_alloc = src->_mp_alloc;
dest->_mp_d = src->_mp_d; dest->_mp_d = src->_mp_d;
@ -470,156 +386,101 @@ MPZ_SET (mpz_t dest, MP_INT *src)
INLINE_ONLY inline EXTERN int IsLargeIntTerm(Term); INLINE_ONLY inline EXTERN int IsLargeIntTerm(Term);
INLINE_ONLY inline EXTERN int INLINE_ONLY inline EXTERN int IsLargeIntTerm(Term t) {
IsLargeIntTerm (Term t) return (int)(IsApplTerm(t) && ((FunctorOfTerm(t) <= FunctorBigInt) &&
{ (FunctorOfTerm(t) >= FunctorLongInt)));
return (int) (IsApplTerm (t)
&& ((FunctorOfTerm (t) <= FunctorBigInt)
&& (FunctorOfTerm (t) >= FunctorLongInt)));
} }
INLINE_ONLY inline EXTERN UInt Yap_SizeOfBigInt(Term); INLINE_ONLY inline EXTERN UInt Yap_SizeOfBigInt(Term);
INLINE_ONLY inline EXTERN UInt INLINE_ONLY inline EXTERN UInt Yap_SizeOfBigInt(Term t) {
Yap_SizeOfBigInt (Term t)
{
CELL *pt = RepAppl(t) + 1; CELL *pt = RepAppl(t) + 1;
return 2+(sizeof(MP_INT)+ return 2 +
(((MP_INT *)pt)->_mp_alloc*sizeof(mp_limb_t)))/sizeof(CELL); (sizeof(MP_INT) + (((MP_INT *)pt)->_mp_alloc * sizeof(mp_limb_t))) /
sizeof(CELL);
} }
#else #else
INLINE_ONLY inline EXTERN int IsLargeIntTerm(Term); INLINE_ONLY inline EXTERN int IsLargeIntTerm(Term);
INLINE_ONLY inline EXTERN int INLINE_ONLY inline EXTERN int IsLargeIntTerm(Term t) {
IsLargeIntTerm (Term t)
{
return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorLongInt); return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorLongInt);
} }
#endif #endif
/* extern Functor FunctorLongInt; */ /* extern Functor FunctorLongInt; */
INLINE_ONLY inline EXTERN int IsLargeNumTerm(Term); INLINE_ONLY inline EXTERN int IsLargeNumTerm(Term);
INLINE_ONLY inline EXTERN int INLINE_ONLY inline EXTERN int IsLargeNumTerm(Term t) {
IsLargeNumTerm (Term t) return (int)(IsApplTerm(t) && ((FunctorOfTerm(t) <= FunctorBigInt) &&
{ (FunctorOfTerm(t) >= FunctorDouble)));
return (int) (IsApplTerm (t)
&& ((FunctorOfTerm (t) <= FunctorBigInt)
&& (FunctorOfTerm (t) >= FunctorDouble)));
} }
INLINE_ONLY inline EXTERN int IsExternalBlobTerm(Term, CELL); INLINE_ONLY inline EXTERN int IsExternalBlobTerm(Term, CELL);
INLINE_ONLY inline EXTERN int INLINE_ONLY inline EXTERN int IsExternalBlobTerm(Term t, CELL tag) {
IsExternalBlobTerm (Term t, CELL tag) return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorBigInt &&
{
return (int) (IsApplTerm (t) &&
FunctorOfTerm (t) == FunctorBigInt &&
RepAppl(t)[1] == tag); RepAppl(t)[1] == tag);
} }
INLINE_ONLY inline EXTERN void *ExternalBlobFromTerm(Term); INLINE_ONLY inline EXTERN void *ExternalBlobFromTerm(Term);
INLINE_ONLY inline EXTERN void * INLINE_ONLY inline EXTERN void *ExternalBlobFromTerm(Term t) {
ExternalBlobFromTerm (Term t)
{
MP_INT *base = (MP_INT *)(RepAppl(t) + 2); MP_INT *base = (MP_INT *)(RepAppl(t) + 2);
return (void *)(base + 1); return (void *)(base + 1);
} }
INLINE_ONLY inline EXTERN int IsNumTerm(Term); INLINE_ONLY inline EXTERN int IsNumTerm(Term);
INLINE_ONLY inline EXTERN int INLINE_ONLY inline EXTERN int IsNumTerm(Term t) {
IsNumTerm (Term t)
{
return (int)((IsIntTerm(t) || IsLargeNumTerm(t))); return (int)((IsIntTerm(t) || IsLargeNumTerm(t)));
} }
INLINE_ONLY inline EXTERN Int IsAtomicTerm(Term); INLINE_ONLY inline EXTERN Int IsAtomicTerm(Term);
INLINE_ONLY inline EXTERN Int INLINE_ONLY inline EXTERN Int IsAtomicTerm(Term t) {
IsAtomicTerm (Term t)
{
return (Int)(IsAtomOrIntTerm(t) || IsLargeNumTerm(t) || IsStringTerm(t)); return (Int)(IsAtomOrIntTerm(t) || IsLargeNumTerm(t) || IsStringTerm(t));
} }
INLINE_ONLY inline EXTERN Int IsExtensionFunctor(Functor); INLINE_ONLY inline EXTERN Int IsExtensionFunctor(Functor);
INLINE_ONLY inline EXTERN Int INLINE_ONLY inline EXTERN Int IsExtensionFunctor(Functor f) {
IsExtensionFunctor (Functor f)
{
return (Int)(f <= FunctorString); return (Int)(f <= FunctorString);
} }
INLINE_ONLY inline EXTERN Int IsBlobFunctor(Functor); INLINE_ONLY inline EXTERN Int IsBlobFunctor(Functor);
INLINE_ONLY inline EXTERN Int INLINE_ONLY inline EXTERN Int IsBlobFunctor(Functor f) {
IsBlobFunctor (Functor f)
{
return (Int)((f <= FunctorString && f >= FunctorDBRef)); return (Int)((f <= FunctorString && f >= FunctorDBRef));
} }
INLINE_ONLY inline EXTERN Int IsPrimitiveTerm(Term); INLINE_ONLY inline EXTERN Int IsPrimitiveTerm(Term);
INLINE_ONLY inline EXTERN Int INLINE_ONLY inline EXTERN Int IsPrimitiveTerm(Term t) {
IsPrimitiveTerm (Term t) return (Int)((IsAtomOrIntTerm(t) ||
{ (IsApplTerm(t) && IsBlobFunctor(FunctorOfTerm(t)))));
return (Int) ((IsAtomOrIntTerm (t)
|| (IsApplTerm (t) && IsBlobFunctor (FunctorOfTerm (t)))));
} }
#ifdef TERM_EXTENSIONS #ifdef TERM_EXTENSIONS
INLINE_ONLY inline EXTERN Int IsAttachFunc(Functor); INLINE_ONLY inline EXTERN Int IsAttachFunc(Functor);
INLINE_ONLY inline EXTERN Int INLINE_ONLY inline EXTERN Int IsAttachFunc(Functor f) { return (Int)(FALSE); }
IsAttachFunc (Functor f)
{
return (Int) (FALSE);
}
#define IsAttachedTerm(t) __IsAttachedTerm(t PASS_REGS) #define IsAttachedTerm(t) __IsAttachedTerm(t PASS_REGS)
INLINE_ONLY inline EXTERN Int __IsAttachedTerm(Term USES_REGS); INLINE_ONLY inline EXTERN Int __IsAttachedTerm(Term USES_REGS);
INLINE_ONLY inline EXTERN Int INLINE_ONLY inline EXTERN Int __IsAttachedTerm(Term t USES_REGS) {
__IsAttachedTerm (Term t USES_REGS)
{
return (Int)((IsVarTerm(t) && IsAttVar(VarOfTerm(t)))); return (Int)((IsVarTerm(t) && IsAttVar(VarOfTerm(t))));
} }
INLINE_ONLY inline EXTERN Int GlobalIsAttachedTerm(Term); INLINE_ONLY inline EXTERN Int GlobalIsAttachedTerm(Term);
INLINE_ONLY inline EXTERN Int INLINE_ONLY inline EXTERN Int GlobalIsAttachedTerm(Term t) {
GlobalIsAttachedTerm (Term t)
{
return (Int)((IsVarTerm(t) && GlobalIsAttVar(VarOfTerm(t)))); return (Int)((IsVarTerm(t) && GlobalIsAttVar(VarOfTerm(t))));
} }
@ -627,63 +488,37 @@ GlobalIsAttachedTerm (Term t)
INLINE_ONLY inline EXTERN Int __SafeIsAttachedTerm(Term USES_REGS); INLINE_ONLY inline EXTERN Int __SafeIsAttachedTerm(Term USES_REGS);
INLINE_ONLY inline EXTERN Int INLINE_ONLY inline EXTERN Int __SafeIsAttachedTerm(Term t USES_REGS) {
__SafeIsAttachedTerm (Term t USES_REGS)
{
return (Int)(IsVarTerm(t) && IsAttVar(VarOfTerm(t))); return (Int)(IsVarTerm(t) && IsAttVar(VarOfTerm(t)));
} }
INLINE_ONLY inline EXTERN exts ExtFromCell(CELL *); INLINE_ONLY inline EXTERN exts ExtFromCell(CELL *);
INLINE_ONLY inline EXTERN exts INLINE_ONLY inline EXTERN exts ExtFromCell(CELL *pt) { return attvars_ext; }
ExtFromCell (CELL * pt)
{
return attvars_ext;
}
#else #else
INLINE_ONLY inline EXTERN Int IsAttachFunc(Functor); INLINE_ONLY inline EXTERN Int IsAttachFunc(Functor);
INLINE_ONLY inline EXTERN Int INLINE_ONLY inline EXTERN Int IsAttachFunc(Functor f) { return (Int)(FALSE); }
IsAttachFunc (Functor f)
{
return (Int) (FALSE);
}
INLINE_ONLY inline EXTERN Int IsAttachedTerm(Term); INLINE_ONLY inline EXTERN Int IsAttachedTerm(Term);
INLINE_ONLY inline EXTERN Int INLINE_ONLY inline EXTERN Int IsAttachedTerm(Term t) { return (Int)(FALSE); }
IsAttachedTerm (Term t)
{
return (Int) (FALSE);
}
#endif #endif
INLINE_ONLY inline EXTERN Int Yap_BlobTag(Term t); INLINE_ONLY inline EXTERN Int Yap_BlobTag(Term t);
INLINE_ONLY inline EXTERN Int Yap_BlobTag(Term t) INLINE_ONLY inline EXTERN Int Yap_BlobTag(Term t) {
{
CELL *pt = RepAppl(t); CELL *pt = RepAppl(t);
return pt[1]; return pt[1];
} }
INLINE_ONLY inline EXTERN void *Yap_BlobInfo(Term t); INLINE_ONLY inline EXTERN void *Yap_BlobInfo(Term t);
INLINE_ONLY inline EXTERN void *Yap_BlobInfo(Term t) INLINE_ONLY inline EXTERN void *Yap_BlobInfo(Term t) {
{
MP_INT *blobp; MP_INT *blobp;
CELL *pt = RepAppl(t); CELL *pt = RepAppl(t);
@ -699,11 +534,9 @@ EXTERN int unify_extension(Functor, CELL, CELL *, CELL);
int Yap_gmp_tcmp_big_big(Term, Term); int Yap_gmp_tcmp_big_big(Term, Term);
INLINE_ONLY inline EXTERN int INLINE_ONLY inline EXTERN int unify_extension(Functor f, CELL d0, CELL *pt0,
unify_extension (Functor f, CELL d0, CELL * pt0, CELL d1) CELL d1) {
{ switch (BlobOfFunctor(f)) {
switch (BlobOfFunctor (f))
{
case db_ref_e: case db_ref_e:
return (d0 == d1); return (d0 == d1);
case attvar_e: case attvar_e:
@ -718,8 +551,7 @@ unify_extension (Functor f, CELL d0, CELL * pt0, CELL d1)
#else #else
return d0 == d1; return d0 == d1;
#endif /* USE_GMP */ #endif /* USE_GMP */
case double_e: case double_e: {
{
CELL *pt1 = RepAppl(d1); CELL *pt1 = RepAppl(d1);
return (pt0[1] == pt1[1] return (pt0[1] == pt1[1]
#if SIZEOF_DOUBLE == 2 * SIZEOF_INT_P #if SIZEOF_DOUBLE == 2 * SIZEOF_INT_P
@ -731,9 +563,7 @@ unify_extension (Functor f, CELL d0, CELL * pt0, CELL d1)
return (FALSE); return (FALSE);
} }
static inline static inline CELL Yap_IntP_key(CELL *pt) {
CELL Yap_IntP_key(CELL *pt)
{
#ifdef USE_GMP #ifdef USE_GMP
if (((Functor)pt[-1] == FunctorBigInt)) { if (((Functor)pt[-1] == FunctorBigInt)) {
MP_INT *b1 = Yap_BigIntOfTerm(AbsAppl(pt - 1)); MP_INT *b1 = Yap_BigIntOfTerm(AbsAppl(pt - 1));
@ -745,15 +575,9 @@ CELL Yap_IntP_key(CELL *pt)
return MkIntTerm(pt[0] & (MAX_ABS_INT - 1)); return MkIntTerm(pt[0] & (MAX_ABS_INT - 1));
} }
static inline static inline CELL Yap_Int_key(Term t) { return Yap_IntP_key(RepAppl(t) + 1); }
CELL Yap_Int_key(Term t)
{
return Yap_IntP_key(RepAppl(t)+1);
}
static inline static inline CELL Yap_DoubleP_key(CELL *pt) {
CELL Yap_DoubleP_key(CELL *pt)
{
#if SIZEOF_DOUBLE1 == 2 * SIZEOF_INT_P #if SIZEOF_DOUBLE1 == 2 * SIZEOF_INT_P
CELL val = pt[0] ^ pt[1]; CELL val = pt[0] ^ pt[1];
#else #else
@ -762,15 +586,11 @@ CELL Yap_DoubleP_key(CELL *pt)
return MkIntTerm(val & (MAX_ABS_INT - 1)); return MkIntTerm(val & (MAX_ABS_INT - 1));
} }
static inline static inline CELL Yap_Double_key(Term t) {
CELL Yap_Double_key(Term t)
{
return Yap_DoubleP_key(RepAppl(t) + 1); return Yap_DoubleP_key(RepAppl(t) + 1);
} }
static inline static inline CELL Yap_StringP_key(CELL *pt) {
CELL Yap_StringP_key(CELL *pt)
{
UInt n = pt[1], i; UInt n = pt[1], i;
CELL val = pt[2]; CELL val = pt[2];
for (i = 1; i < n; i++) { for (i = 1; i < n; i++) {
@ -779,9 +599,7 @@ CELL Yap_StringP_key(CELL *pt)
return MkIntTerm(val & (MAX_ABS_INT - 1)); return MkIntTerm(val & (MAX_ABS_INT - 1));
} }
static inline static inline CELL Yap_String_key(Term t) {
CELL Yap_String_key(Term t)
{
return Yap_StringP_key(RepAppl(t) + 1); return Yap_StringP_key(RepAppl(t) + 1);
} }

View File

@ -442,10 +442,10 @@ follows immediate semantics.
library. library.
*/ */
YAP_FLAG(UNKNOWN_FLAG, "unknown", true, isatom, "error", YAP_FLAG(UNKNOWN_FLAG, "unknown", true, isatom, "error",
NULL), /**< `unknown is iso` Yap_unknown), /**< `unknown is iso`
Corresponds to calling the unknown/2 built-in. Possible values Corresponds to calling the unknown/2 built-in. Possible ISO values
are `error`, `fail`, and `warning`. are `error`, `fail`, and `warning`. Yap includes the following extensions: `fast_fail` does not invoke any handler.
*/ */
YAP_FLAG(VARIABLE_NAMES_MAY_END_WITH_QUOTES_FLAG, YAP_FLAG(VARIABLE_NAMES_MAY_END_WITH_QUOTES_FLAG,
"variable_names_may_end_with_quotes", true, boolean, "false", "variable_names_may_end_with_quotes", true, boolean, "false",

View File

@ -135,6 +135,7 @@ void Yap_ResetConsultStack(void);
void Yap_AssertzClause(struct pred_entry *, yamop *); void Yap_AssertzClause(struct pred_entry *, yamop *);
void Yap_HidePred(struct pred_entry *pe); void Yap_HidePred(struct pred_entry *pe);
int Yap_SetNoTrace(char *name, UInt arity, Term tmod); int Yap_SetNoTrace(char *name, UInt arity, Term tmod);
bool Yap_unknown(Term tflagvalue);
/* cmppreds.c */ /* cmppreds.c */
Int Yap_compare_terms(Term, Term); Int Yap_compare_terms(Term, Term);
@ -176,6 +177,7 @@ bool Yap_Warning(const char *s, ...);
bool Yap_PrintWarning(Term t); bool Yap_PrintWarning(Term t);
int Yap_HandleError(const char *msg, ...); int Yap_HandleError(const char *msg, ...);
int Yap_SWIHandleError(const char *, ...); int Yap_SWIHandleError(const char *, ...);
void Yap_InitErrorPreds(void);
/* eval.c */ /* eval.c */
void Yap_InitEval(void); void Yap_InitEval(void);
@ -317,6 +319,8 @@ void Yap_InitModulesC(void);
struct mod_entry *Yap_GetModuleEntry(Term tmod); struct mod_entry *Yap_GetModuleEntry(Term tmod);
Term Yap_GetModuleFromEntry(struct mod_entry *me); Term Yap_GetModuleFromEntry(struct mod_entry *me);
bool Yap_CharacterEscapes(Term mt); bool Yap_CharacterEscapes(Term mt);
bool Yap_constPred( struct pred_entry *pt);
bool Yap_isSystemModule(Term mod);
#if HAVE_MPI #if HAVE_MPI
/* mpi.c */ /* mpi.c */

View File

@ -437,7 +437,10 @@ IsModProperty (int flags)
#define UNKNOWN_FAIL (0x0400) /* module */ #define UNKNOWN_FAIL (0x0400) /* module */
#define UNKNOWN_WARNING (0x0800) /* module */ #define UNKNOWN_WARNING (0x0800) /* module */
#define UNKNOWN_ERROR (0x1000) /* module */ #define UNKNOWN_ERROR (0x1000) /* module */
#define UNKNOWN_MASK (UNKNOWN_ERROR|UNKNOWN_WARNING|UNKNOWN_FAIL) #define UNKNOWN_FAST_FAIL (0x2000) /* module */
#define UNKNOWN_ABORT (0x4000) /* module */
#define UNKNOWN_HALT (0x8000) /* module */
#define UNKNOWN_MASK (UNKNOWN_ERROR|UNKNOWN_WARNING|UNKNOWN_FAIL|UNKNOWN_FAST_FAIL|UNKNOWN_ABORT|UNKNOWN_HALT )
Term Yap_getUnknownModule(ModEntry *m); Term Yap_getUnknownModule(ModEntry *m);
void Yap_setModuleFlags(ModEntry *n, ModEntry *o); void Yap_setModuleFlags(ModEntry *n, ModEntry *o);
@ -688,7 +691,7 @@ don't forget to also add in qly.h
#define SyncPredFlag ((pred_flags_t)0x00100000) /* has to synch before it can execute */ #define SyncPredFlag ((pred_flags_t)0x00100000) /* has to synch before it can execute */
#define NumberDBPredFlag ((pred_flags_t)0x00080000) /* entry for a number key */ #define NumberDBPredFlag ((pred_flags_t)0x00080000) /* entry for a number key */
#define AtomDBPredFlag ((pred_flags_t)0x00040000) /* entry for an atom key */ #define AtomDBPredFlag ((pred_flags_t)0x00040000) /* entry for an atom key */
#define GoalExPredFlag ((pred_flags_t)0x00020000) /* predicate that is called by goal_expand */ // #define GoalExPredFlag ((pred_flags_t)0x00020000) /* predicate that is called by goal_expand */
#define TestPredFlag ((pred_flags_t)0x00010000) /* is a test (optim. comit) */ #define TestPredFlag ((pred_flags_t)0x00010000) /* is a test (optim. comit) */
#define AsmPredFlag ((pred_flags_t)0x00008000) /* inline */ #define AsmPredFlag ((pred_flags_t)0x00008000) /* inline */
#define StandardPredFlag ((pred_flags_t)0x00004000) /* system predicate */ #define StandardPredFlag ((pred_flags_t)0x00004000) /* system predicate */

View File

@ -142,3 +142,5 @@
#define GLOBAL_LastWTimePtr Yap_global->LastWTimePtr_ #define GLOBAL_LastWTimePtr Yap_global->LastWTimePtr_
#define GLOBAL_MaxPriority Yap_global->MaxPriority_

View File

@ -101,6 +101,7 @@
#define SWI_MODULE Yap_heap_regs->swi_module #define SWI_MODULE Yap_heap_regs->swi_module
#define DBLOAD_MODULE Yap_heap_regs->dbload_module #define DBLOAD_MODULE Yap_heap_regs->dbload_module
#define RANGE_MODULE Yap_heap_regs->range_module #define RANGE_MODULE Yap_heap_regs->range_module
#define ERROR_MODULE Yap_heap_regs->error_module
@ -207,9 +208,6 @@
#define PROFILING Yap_heap_regs->system_profiling #define PROFILING Yap_heap_regs->system_profiling
#define CALL_COUNTING Yap_heap_regs->system_call_counting #define CALL_COUNTING Yap_heap_regs->system_call_counting
#define PRED_GOAL_EXPANSION_ALL Yap_heap_regs->system_pred_goal_expansion_all
#define PRED_GOAL_EXPANSION_FUNC Yap_heap_regs->system_pred_goal_expansion_func
#define PRED_GOAL_EXPANSION_ON Yap_heap_regs->system_pred_goal_expansion_on
#define optimizer_on Yap_heap_regs->compiler_optimizer_on #define optimizer_on Yap_heap_regs->compiler_optimizer_on
#define compile_mode Yap_heap_regs->compiler_compile_mode #define compile_mode Yap_heap_regs->compiler_compile_mode
#define profiling Yap_heap_regs->compiler_profiling #define profiling Yap_heap_regs->compiler_profiling

View File

@ -453,8 +453,6 @@
#define REMOTE_ImportDBRefHashTableNum(wid) REMOTE(wid)->ImportDBRefHashTableNum_ #define REMOTE_ImportDBRefHashTableNum(wid) REMOTE(wid)->ImportDBRefHashTableNum_
#define LOCAL_ImportFAILCODE LOCAL->ImportFAILCODE_ #define LOCAL_ImportFAILCODE LOCAL->ImportFAILCODE_
#define REMOTE_ImportFAILCODE(wid) REMOTE(wid)->ImportFAILCODE_ #define REMOTE_ImportFAILCODE(wid) REMOTE(wid)->ImportFAILCODE_
#define LOCAL_FunctorVar LOCAL->FunctorVar_
#define REMOTE_FunctorVar(wid) REMOTE(wid)->FunctorVar_
#if __ANDROID__ #if __ANDROID__
#define LOCAL_assetManager LOCAL->assetManager_ #define LOCAL_assetManager LOCAL->assetManager_

View File

@ -141,4 +141,6 @@ typedef struct global_data {
char* CharConversionTable2_; char* CharConversionTable2_;
void* LastWTimePtr_; void* LastWTimePtr_;
int MaxPriority_;
} w_shared; } w_shared;

View File

@ -252,7 +252,6 @@ const char* Error_Function_;
UInt ImportDBRefHashTableSize_; UInt ImportDBRefHashTableSize_;
UInt ImportDBRefHashTableNum_; UInt ImportDBRefHashTableNum_;
yamop *ImportFAILCODE_; yamop *ImportFAILCODE_;
Functor FunctorVar_;
#if __ANDROID__ #if __ANDROID__
struct AAssetManager* assetManager_; struct AAssetManager* assetManager_;

View File

@ -101,6 +101,7 @@
Term swi_module; Term swi_module;
Term dbload_module; Term dbload_module;
Term range_module; Term range_module;
Term error_module;
@ -207,9 +208,6 @@
int system_profiling; int system_profiling;
int system_call_counting; int system_call_counting;
int system_pred_goal_expansion_all;
int system_pred_goal_expansion_func;
int system_pred_goal_expansion_on;
int compiler_optimizer_on; int compiler_optimizer_on;
int compiler_compile_mode; int compiler_compile_mode;
int compiler_profiling; int compiler_profiling;

View File

@ -25,6 +25,10 @@
AtomEmptyBrackets = Yap_LookupAtom("()"); AtomEmptyBrackets = Yap_LookupAtom("()");
AtomEmptySquareBrackets = Yap_LookupAtom("[]"); AtomEmptySquareBrackets = Yap_LookupAtom("[]");
AtomEmptyCurlyBrackets = Yap_LookupAtom("{}"); AtomEmptyCurlyBrackets = Yap_LookupAtom("{}");
AtomAsserta = Yap_LookupAtom("asserta");
AtomAssertaStatic = Yap_LookupAtom("asserta_static");
AtomAssertz = Yap_LookupAtom("assertz");
AtomAssertzStatic = Yap_LookupAtom("assertz_static");
AtomAt = Yap_LookupAtom("at"); AtomAt = Yap_LookupAtom("at");
AtomAtom = Yap_LookupAtom("atom"); AtomAtom = Yap_LookupAtom("atom");
AtomAtomic = Yap_LookupAtom("atomic"); AtomAtomic = Yap_LookupAtom("atomic");
@ -66,6 +70,7 @@
AtomCompact = Yap_LookupAtom("compact"); AtomCompact = Yap_LookupAtom("compact");
AtomCompound = Yap_LookupAtom("compound"); AtomCompound = Yap_LookupAtom("compound");
AtomConsistencyError = Yap_LookupAtom("consistency_error"); AtomConsistencyError = Yap_LookupAtom("consistency_error");
AtomConsult = Yap_LookupAtom("consult");
AtomConsultOnBoot = Yap_FullLookupAtom("$consult_on_boot"); AtomConsultOnBoot = Yap_FullLookupAtom("$consult_on_boot");
AtomContext = Yap_LookupAtom("context"); AtomContext = Yap_LookupAtom("context");
AtomCputime = Yap_LookupAtom("cputime"); AtomCputime = Yap_LookupAtom("cputime");
@ -133,6 +138,7 @@
AtomFail = Yap_LookupAtom("fail"); AtomFail = Yap_LookupAtom("fail");
AtomFalse = Yap_LookupAtom("false"); AtomFalse = Yap_LookupAtom("false");
AtomFast = Yap_FullLookupAtom("$fast"); AtomFast = Yap_FullLookupAtom("$fast");
AtomFastFail = Yap_LookupAtom("fast_fail");
AtomFileErrors = Yap_LookupAtom("file_errors"); AtomFileErrors = Yap_LookupAtom("file_errors");
AtomFileerrors = Yap_LookupAtom("fileerrors"); AtomFileerrors = Yap_LookupAtom("fileerrors");
AtomFileType = Yap_LookupAtom("file_type"); AtomFileType = Yap_LookupAtom("file_type");
@ -288,6 +294,7 @@
AtomReadOnly = Yap_LookupAtom("read_only"); AtomReadOnly = Yap_LookupAtom("read_only");
AtomReadWrite = Yap_LookupAtom("read_write"); AtomReadWrite = Yap_LookupAtom("read_write");
AtomReadutil = Yap_LookupAtom("readutil"); AtomReadutil = Yap_LookupAtom("readutil");
AtomReconsult = Yap_LookupAtom("reconsult");
AtomRecordedP = Yap_FullLookupAtom("$recordep"); AtomRecordedP = Yap_FullLookupAtom("$recordep");
AtomRecordedWithKey = Yap_FullLookupAtom("$recorded_with_key"); AtomRecordedWithKey = Yap_FullLookupAtom("$recorded_with_key");
AtomRedefineWarnings = Yap_LookupAtom("redefine_warnings"); AtomRedefineWarnings = Yap_LookupAtom("redefine_warnings");

View File

@ -141,4 +141,6 @@ static void InitGlobal(void) {
GLOBAL_CharConversionTable2 = NULL; GLOBAL_CharConversionTable2 = NULL;
GLOBAL_LastWTimePtr = NULL; GLOBAL_LastWTimePtr = NULL;
GLOBAL_MaxPriority = 1200;
} }

View File

@ -101,6 +101,7 @@
SWI_MODULE = MkAtomTerm(AtomSwi); SWI_MODULE = MkAtomTerm(AtomSwi);
DBLOAD_MODULE = MkAtomTerm(AtomDBLoad); DBLOAD_MODULE = MkAtomTerm(AtomDBLoad);
RANGE_MODULE = MkAtomTerm(AtomRange); RANGE_MODULE = MkAtomTerm(AtomRange);
ERROR_MODULE = MkAtomTerm(AtomError);
@ -207,9 +208,6 @@
PROFILING = FALSE; PROFILING = FALSE;
CALL_COUNTING = FALSE; CALL_COUNTING = FALSE;
PRED_GOAL_EXPANSION_ALL = FALSE;
PRED_GOAL_EXPANSION_FUNC = FALSE;
PRED_GOAL_EXPANSION_ON = FALSE;
optimizer_on = TRUE; optimizer_on = TRUE;
compile_mode = 0; compile_mode = 0;
profiling = FALSE; profiling = FALSE;

View File

@ -252,7 +252,6 @@ static void InitWorker(int wid) {
REMOTE_ImportDBRefHashTableSize(wid) = 0; REMOTE_ImportDBRefHashTableSize(wid) = 0;
REMOTE_ImportDBRefHashTableNum(wid) = 0; REMOTE_ImportDBRefHashTableNum(wid) = 0;
REMOTE_ImportFAILCODE(wid) = NULL; REMOTE_ImportFAILCODE(wid) = NULL;
REMOTE_FunctorVar(wid) = FunctorVar;
#if __ANDROID__ #if __ANDROID__
REMOTE_assetManager(wid) = GLOBAL_assetManager; REMOTE_assetManager(wid) = GLOBAL_assetManager;

View File

@ -25,6 +25,10 @@
AtomEmptyBrackets = AtomAdjust(AtomEmptyBrackets); AtomEmptyBrackets = AtomAdjust(AtomEmptyBrackets);
AtomEmptySquareBrackets = AtomAdjust(AtomEmptySquareBrackets); AtomEmptySquareBrackets = AtomAdjust(AtomEmptySquareBrackets);
AtomEmptyCurlyBrackets = AtomAdjust(AtomEmptyCurlyBrackets); AtomEmptyCurlyBrackets = AtomAdjust(AtomEmptyCurlyBrackets);
AtomAsserta = AtomAdjust(AtomAsserta);
AtomAssertaStatic = AtomAdjust(AtomAssertaStatic);
AtomAssertz = AtomAdjust(AtomAssertz);
AtomAssertzStatic = AtomAdjust(AtomAssertzStatic);
AtomAt = AtomAdjust(AtomAt); AtomAt = AtomAdjust(AtomAt);
AtomAtom = AtomAdjust(AtomAtom); AtomAtom = AtomAdjust(AtomAtom);
AtomAtomic = AtomAdjust(AtomAtomic); AtomAtomic = AtomAdjust(AtomAtomic);
@ -66,6 +70,7 @@
AtomCompact = AtomAdjust(AtomCompact); AtomCompact = AtomAdjust(AtomCompact);
AtomCompound = AtomAdjust(AtomCompound); AtomCompound = AtomAdjust(AtomCompound);
AtomConsistencyError = AtomAdjust(AtomConsistencyError); AtomConsistencyError = AtomAdjust(AtomConsistencyError);
AtomConsult = AtomAdjust(AtomConsult);
AtomConsultOnBoot = AtomAdjust(AtomConsultOnBoot); AtomConsultOnBoot = AtomAdjust(AtomConsultOnBoot);
AtomContext = AtomAdjust(AtomContext); AtomContext = AtomAdjust(AtomContext);
AtomCputime = AtomAdjust(AtomCputime); AtomCputime = AtomAdjust(AtomCputime);
@ -289,6 +294,7 @@
AtomReadOnly = AtomAdjust(AtomReadOnly); AtomReadOnly = AtomAdjust(AtomReadOnly);
AtomReadWrite = AtomAdjust(AtomReadWrite); AtomReadWrite = AtomAdjust(AtomReadWrite);
AtomReadutil = AtomAdjust(AtomReadutil); AtomReadutil = AtomAdjust(AtomReadutil);
AtomReconsult = AtomAdjust(AtomReconsult);
AtomRecordedP = AtomAdjust(AtomRecordedP); AtomRecordedP = AtomAdjust(AtomRecordedP);
AtomRecordedWithKey = AtomAdjust(AtomRecordedWithKey); AtomRecordedWithKey = AtomAdjust(AtomRecordedWithKey);
AtomRedefineWarnings = AtomAdjust(AtomRedefineWarnings); AtomRedefineWarnings = AtomAdjust(AtomRedefineWarnings);

View File

@ -141,4 +141,6 @@ static void RestoreGlobal(void) {
} }

View File

@ -101,6 +101,7 @@
SWI_MODULE = AtomTermAdjust(SWI_MODULE); SWI_MODULE = AtomTermAdjust(SWI_MODULE);
DBLOAD_MODULE = AtomTermAdjust(DBLOAD_MODULE); DBLOAD_MODULE = AtomTermAdjust(DBLOAD_MODULE);
RANGE_MODULE = AtomTermAdjust(RANGE_MODULE); RANGE_MODULE = AtomTermAdjust(RANGE_MODULE);
ERROR_MODULE = AtomTermAdjust(ERROR_MODULE);
@ -214,9 +215,6 @@
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(DBTermsListLock); REINIT_LOCK(DBTermsListLock);
#endif #endif

View File

@ -250,7 +250,6 @@ static void RestoreWorker(int wid USES_REGS) {
#if __ANDROID__ #if __ANDROID__

View File

@ -71,6 +71,18 @@
Atom AtomEmptyCurlyBrackets_; Atom AtomEmptyCurlyBrackets_;
#define AtomEmptyCurlyBrackets Yap_heap_regs->AtomEmptyCurlyBrackets_ #define AtomEmptyCurlyBrackets Yap_heap_regs->AtomEmptyCurlyBrackets_
#define TermEmptyCurlyBrackets MkAtomTerm( Yap_heap_regs->AtomEmptyCurlyBrackets_ ) #define TermEmptyCurlyBrackets MkAtomTerm( Yap_heap_regs->AtomEmptyCurlyBrackets_ )
Atom AtomAsserta_;
#define AtomAsserta Yap_heap_regs->AtomAsserta_
#define TermAsserta MkAtomTerm( Yap_heap_regs->AtomAsserta_ )
Atom AtomAssertaStatic_;
#define AtomAssertaStatic Yap_heap_regs->AtomAssertaStatic_
#define TermAssertaStatic MkAtomTerm( Yap_heap_regs->AtomAssertaStatic_ )
Atom AtomAssertz_;
#define AtomAssertz Yap_heap_regs->AtomAssertz_
#define TermAssertz MkAtomTerm( Yap_heap_regs->AtomAssertz_ )
Atom AtomAssertzStatic_;
#define AtomAssertzStatic Yap_heap_regs->AtomAssertzStatic_
#define TermAssertzStatic MkAtomTerm( Yap_heap_regs->AtomAssertzStatic_ )
Atom AtomAt_; Atom AtomAt_;
#define AtomAt Yap_heap_regs->AtomAt_ #define AtomAt Yap_heap_regs->AtomAt_
#define TermAt MkAtomTerm( Yap_heap_regs->AtomAt_ ) #define TermAt MkAtomTerm( Yap_heap_regs->AtomAt_ )
@ -194,6 +206,9 @@
Atom AtomConsistencyError_; Atom AtomConsistencyError_;
#define AtomConsistencyError Yap_heap_regs->AtomConsistencyError_ #define AtomConsistencyError Yap_heap_regs->AtomConsistencyError_
#define TermConsistencyError MkAtomTerm( Yap_heap_regs->AtomConsistencyError_ ) #define TermConsistencyError MkAtomTerm( Yap_heap_regs->AtomConsistencyError_ )
Atom AtomConsult_;
#define AtomConsult Yap_heap_regs->AtomConsult_
#define TermConsult MkAtomTerm( Yap_heap_regs->AtomConsult_ )
Atom AtomConsultOnBoot_; Atom AtomConsultOnBoot_;
#define AtomConsultOnBoot Yap_heap_regs->AtomConsultOnBoot_ #define AtomConsultOnBoot Yap_heap_regs->AtomConsultOnBoot_
#define TermConsultOnBoot MkAtomTerm( Yap_heap_regs->AtomConsultOnBoot_ ) #define TermConsultOnBoot MkAtomTerm( Yap_heap_regs->AtomConsultOnBoot_ )
@ -395,6 +410,9 @@
Atom AtomFast_; Atom AtomFast_;
#define AtomFast Yap_heap_regs->AtomFast_ #define AtomFast Yap_heap_regs->AtomFast_
#define TermFast MkAtomTerm( Yap_heap_regs->AtomFast_ ) #define TermFast MkAtomTerm( Yap_heap_regs->AtomFast_ )
Atom AtomFastFail_;
#define AtomFastFail Yap_heap_regs->AtomFastFail_
#define TermFastFail MkAtomTerm( Yap_heap_regs->AtomFastFail_ )
Atom AtomFileErrors_; Atom AtomFileErrors_;
#define AtomFileErrors Yap_heap_regs->AtomFileErrors_ #define AtomFileErrors Yap_heap_regs->AtomFileErrors_
#define TermFileErrors MkAtomTerm( Yap_heap_regs->AtomFileErrors_ ) #define TermFileErrors MkAtomTerm( Yap_heap_regs->AtomFileErrors_ )
@ -860,6 +878,9 @@
Atom AtomReadutil_; Atom AtomReadutil_;
#define AtomReadutil Yap_heap_regs->AtomReadutil_ #define AtomReadutil Yap_heap_regs->AtomReadutil_
#define TermReadutil MkAtomTerm( Yap_heap_regs->AtomReadutil_ ) #define TermReadutil MkAtomTerm( Yap_heap_regs->AtomReadutil_ )
Atom AtomReconsult_;
#define AtomReconsult Yap_heap_regs->AtomReconsult_
#define TermReconsult MkAtomTerm( Yap_heap_regs->AtomReconsult_ )
Atom AtomRecordedP_; Atom AtomRecordedP_;
#define AtomRecordedP Yap_heap_regs->AtomRecordedP_ #define AtomRecordedP Yap_heap_regs->AtomRecordedP_
#define TermRecordedP MkAtomTerm( Yap_heap_regs->AtomRecordedP_ ) #define TermRecordedP MkAtomTerm( Yap_heap_regs->AtomRecordedP_ )

View File

@ -1,23 +1,11 @@
SET (CODES SET (CODES
web/bootstrap/doxy-boot.js
web/bootstrap/footer.html
web/bootstrap/header.html
web/bootstrap/customdoxygen.css
offcanvas.css
offcanvas.js
solarized-light.css solarized-light.css
theme.css theme.css
yap.css yap.css
bootstrap.min.css icons/yap_64x64x32.png
bootstrap.min.js icons/yap_256x256x32.png
font-awesome.min.css icons/yap_128x128x32.png
jquery-2.0.3.min.js icons/yap_48x48x32.png
application.js
pygments.css
misc/icons/yap_64x64x32.png
misc/icons/yap_256x256x32.png
misc/icons/yap_128x128x32.png
misc/icons/yap_48x48x32.png
) )
SET (DOCS SET (DOCS

View File

@ -51,7 +51,7 @@ PROJECT_BRIEF = "The YAP Prolog Compiler Manual"
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory. # the logo to the output directory.
PROJECT_LOGO = @CMAKE_SOURCE_DIR@/misc/icons/yap_96x96x32.png PROJECT_LOGO = @CMAKE_SOURCE_DIR@/docs/icons/yap_96x96x32.png
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is # into which the generated documentation will be written. If a relative path is
@ -384,7 +384,7 @@ INLINE_GROUPED_CLASSES = NO
# with only public data fields or simple typedef fields will be shown inline in # with only public data fields or simple typedef fields will be shown inline in
# the documentation of the scope in which they are defined (i.e. file, # the documentation of the scope in which they are defined (i.e. file,
# namespace, or group documentation), provided this scope is documented. If set # namespace, or group documentation), provided this scope is documented. If set
# to NO, structs, classes, and unions are shown on a separate page (for HTML and v# to NO, structs, classes, and unions are shown on a separate page (for HTML and
# Man pages) or section (for LaTeX and RTF). # Man pages) or section (for LaTeX and RTF).
# The default value is: NO. # The default value is: NO.
@ -776,15 +776,15 @@ WARN_LOGFILE =
# Note: If this tag is empty the current directory is searched. # Note: If this tag is empty the current directory is searched.
INPUT = @PROJECT_SOURCE_DIR@/pl \ INPUT = @PROJECT_SOURCE_DIR@/pl \
@PROJECT_SOURCE_DIR@/swi \
@PROJECT_SOURCE_DIR@/CXX \ @PROJECT_SOURCE_DIR@/CXX \
@PROJECT_SOURCE_DIR@/OPTYap \ @PROJECT_SOURCE_DIR@/OPTYap \
@PROJECT_SOURCE_DIR@/C \ @PROJECT_SOURCE_DIR@/C \
@PROJECT_SOURCE_DIR@/H \ @PROJECT_SOURCE_DIR@/H \
@PROJECT_SOURCE_DIR@/include \ @PROJECT_SOURCE_DIR@/include \
@PROJECT_SOURCE_DIR@/os \ @PROJECT_SOURCE_DIR@/os \
@PROJECT_SOURCE_DIR@/packages \
@PROJECT_SOURCE_DIR@/library \ @PROJECT_SOURCE_DIR@/library \
@PROJECT_SOURCE_DIR@/packages \
@PROJECT_SOURCE_DIR@/swi/library \
@PROJECT_SOURCE_DIR@/docs/yap.md \ @PROJECT_SOURCE_DIR@/docs/yap.md \
@PROJECT_SOURCE_DIR@/docs/chr.md \ @PROJECT_SOURCE_DIR@/docs/chr.md \
@PROJECT_SOURCE_DIR@/docs/clpqr.md \ @PROJECT_SOURCE_DIR@/docs/clpqr.md \
@ -828,7 +828,7 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is # Note that relative paths are relative to the directory from which doxygen is
# run. # run.
EXCLUDE = *pltotex.pl packages/swig/android packages/chr packages/RDF packages/pyswip EXCLUDE = *pltotex.pl
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded # directories that are symbolic links (a Unix file system feature) are excluded
@ -844,7 +844,7 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to # Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/* # exclude all test directories for example use the pattern */test/*
EXCLUDE_PATTERNS = EXCLUDE_PATTERNS = */CMakeFiles/* *~
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the # (namespaces, classes, functions, etc.) that should be excluded from the
@ -881,7 +881,7 @@ EXAMPLE_RECURSIVE = NO
# that contain images that are to be included in the documentation (see the # that contain images that are to be included in the documentation (see the
# \image command). # \image command).
IMAGE_PATH = @CMAKE_SOURCE_DIR@/misc/icons IMAGE_PATH = @CMAKE_SOURCE_DIR@/docs/icons
# The INPUT_FILTER tag can be used to specify a program that doxygen should # The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program # invoke to filter for each input file. Doxygen will invoke the filter program
@ -1105,7 +1105,7 @@ HTML_HEADER =
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
HTML_FOOTER = HTML_FOOTER =
@CMAKE_SOURCE_DIR@/docs/web/bootstrap/footer.html #@CMAKE_SOURCE_DIR@/docs/web/bootstrap/footer.html
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
# sheet that is used by each HTML page. It can be used to fine-tune the look of # sheet that is used by each HTML page. It can be used to fine-tune the look of

4
docs/application.js Normal file
View File

@ -0,0 +1,4 @@
$(function () {
$('a').tooltip();
});

7
docs/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

7
docs/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

0
docs/builtins.md Normal file
View File

View File

@ -2,6 +2,8 @@
CHR: Constraint Handling Rules {#chr} CHR: Constraint Handling Rules {#chr}
============================== ==============================
@ingroup packages
This chapter is written by Tom Schrijvers, K.U. Leuven for the hProlog This chapter is written by Tom Schrijvers, K.U. Leuven for the hProlog
system. Adjusted by Jan Wielemaker to fit the SWI-Prolog documentation system. Adjusted by Jan Wielemaker to fit the SWI-Prolog documentation
infrastructure and remove hProlog specific references. infrastructure and remove hProlog specific references.

View File

@ -1,6 +1,7 @@
Constraint Logic Programming over Rationals and Reals {#clpqr} Constraint Logic Programming over Rationals and Reals {#clpqr}
===================================================== =====================================================
@ingroup paackages
YAP now uses the CLP(R) package developed by <em>Leslie De Koninck</em>, YAP now uses the CLP(R) package developed by <em>Leslie De Koninck</em>,
K.U. Leuven as part of a thesis with supervisor Bart Demoen and daily K.U. Leuven as part of a thesis with supervisor Bart Demoen and daily

0
docs/download.md Normal file
View File

121
docs/doxy-boot.js Normal file
View File

@ -0,0 +1,121 @@
$( document ).ready(function() {
$("div.headertitle").addClass("page-header");
$("div.title").addClass("h1");
$('li > a[href="index.html"] > span').before("<i class='fa fa-cog'></i> ");
$('li > a[href="index.html"] > span').text("BioGears");
$('li > a[href="modules.html"] > span').before("<i class='fa fa-square'></i> ");
$('li > a[href="namespaces.html"] > span').before("<i class='fa fa-bars'></i> ");
$('li > a[href="annotated.html"] > span').before("<i class='fa fa-list-ul'></i> ");
$('li > a[href="classes.html"] > span').before("<i class='fa fa-book'></i> ");
$('li > a[href="inherits.html"] > span').before("<i class='fa fa-sitemap'></i> ");
$('li > a[href="functions.html"] > span').before("<i class='fa fa-list'></i> ");
$('li > a[href="functions_func.html"] > span').before("<i class='fa fa-list'></i> ");
$('li > a[href="functions_vars.html"] > span').before("<i class='fa fa-list'></i> ");
$('li > a[href="functions_enum.html"] > span').before("<i class='fa fa-list'></i> ");
$('li > a[href="functions_eval.html"] > span').before("<i class='fa fa-list'></i> ");
$('img[src="ftv2ns.png"]').replaceWith('<span class="label label-danger">N</span> ');
$('img[src="ftv2cl.png"]').replaceWith('<span class="label label-danger">C</span> ');
$("ul.tablist").addClass("nav nav-pills nav-justified");
$("ul.tablist").css("margin-top", "0.5em");
$("ul.tablist").css("margin-bottom", "0.5em");
$("li.current").addClass("active");
$("iframe").attr("scrolling", "yes");
$("#nav-path > ul").addClass("breadcrumb");
$("table.params").addClass("table");
$("div.ingroups").wrapInner("<small></small>");
$("div.levels").css("margin", "0.5em");
$("div.levels > span").addClass("btn btn-default btn-xs");
$("div.levels > span").css("margin-right", "0.25em");
$("table.directory").addClass("table table-striped");
$("div.summary > a").addClass("btn btn-default btn-xs");
$("table.fieldtable").addClass("table");
$(".fragment").addClass("well");
$(".memitem").addClass("panel panel-default");
$(".memproto").addClass("panel-heading");
$(".memdoc").addClass("panel-body");
$("span.mlabel").addClass("label label-info");
$("table.memberdecls").addClass("table");
$("[class^=memitem]").addClass("active");
$("div.ah").addClass("btn btn-default");
$("span.mlabels").addClass("pull-right");
$("table.mlabels").css("width", "100%")
$("td.mlabels-right").addClass("pull-right");
$("div.ttc").addClass("panel panel-primary");
$("div.ttname").addClass("panel-heading");
$("div.ttname a").css("color", 'white');
$("div.ttdef,div.ttdoc,div.ttdeci").addClass("panel-body");
$('#MSearchBox').parent().remove();
$('div.fragment.well div.line:first').css('margin-top', '15px');
$('div.fragment.well div.line:last').css('margin-bottom', '15px');
$('table.doxtable').removeClass('doxtable').addClass('table table-striped table-bordered').each(function(){
$(this).prepend('<thead></thead>');
$(this).find('tbody > tr:first').prependTo($(this).find('thead'));
$(this).find('td > span.success').parent().addClass('success');
$(this).find('td > span.warning').parent().addClass('warning');
$(this).find('td > span.danger').parent().addClass('danger');
});
if($('div.fragment.well div.ttc').length > 0)
{
$('div.fragment.well div.line:first').parent().removeClass('fragment well');
}
$('table.memberdecls').find('.memItemRight').each(function(){
$(this).contents().appendTo($(this).siblings('.memItemLeft'));
$(this).siblings('.memItemLeft').attr('align', 'left');
});
function getOriginalWidthOfImg(img_element) {
var t = new Image();
t.src = (img_element.getAttribute ? img_element.getAttribute("src") : false) || img_element.src;
return t.width;
}
$('div.dyncontent').find('img').each(function(){
if(getOriginalWidthOfImg($(this)[0]) > $('#content>div.container').width())
$(this).css('width', '100%');
});
$(".memitem").removeClass('memitem');
$(".memproto").removeClass('memproto');
$(".memdoc").removeClass('memdoc');
$("span.mlabel").removeClass('mlabel');
$("table.memberdecls").removeClass('memberdecls');
$("[class^=memitem]").removeClass('memitem');
$("span.mlabels").removeClass('mlabels');
$("table.mlabels").removeClass('mlabels');
$("td.mlabels-right").removeClass('mlabels-right');
$(".navpath").removeClass('navpath');
$("li.navelem").removeClass('navelem');
$("a.el").removeClass('el');
$("div.ah").removeClass('ah');
$("div.header").removeClass("header");
$('.mdescLeft').each(function(){
if($(this).html()=="&nbsp;") {
$(this).siblings('.mdescRight').attr('colspan', 2);
$(this).remove();
}
});
$('td.memItemLeft').each(function(){
if($(this).siblings('.memItemRight').html()=="") {
$(this).attr('colspan', 2);
$(this).siblings('.memItemRight').remove();
}
});
});

0
docs/extensions.md Normal file
View File

0
docs/fli.md Normal file
View File

4
docs/font-awesome.min.css vendored Normal file

File diff suppressed because one or more lines are too long

0
docs/install.md Normal file
View File

6
docs/jquery-2.0.3.min.js vendored Normal file

File diff suppressed because one or more lines are too long

59
docs/offcanvas.css Normal file
View File

@ -0,0 +1,59 @@
/*
* Style tweaks
* --------------------------------------------------
*/
html,
body {
overflow-x: hidden; /* Prevent scroll on narrow devices */
}
body {
padding-top: 70px;
}
footer {
padding: 30px 0;
}
/*
* Off Canvas
* --------------------------------------------------
*/
@media screen and (max-width: 767px) {
.row-offcanvas {
position: relative;
-webkit-transition: all .25s ease-out;
-o-transition: all .25s ease-out;
transition: all .25s ease-out;
}
.row-offcanvas-right {
right: 0;
}
.row-offcanvas-left {
left: 0;
}
.row-offcanvas-right
.sidebar-offcanvas {
right: -50%; /* 6 columns */
}
.row-offcanvas-left
.sidebar-offcanvas {
left: -50%; /* 6 columns */
}
.row-offcanvas-right.active {
right: 50%; /* 6 columns */
}
.row-offcanvas-left.active {
left: 50%; /* 6 columns */
}
.sidebar-offcanvas {
position: absolute;
top: 0;
width: 50%; /* 6 columns */
}
}

5
docs/offcanvas.js Normal file
View File

@ -0,0 +1,5 @@
$(document).ready(function () {
$('[data-toggle="offcanvas"]').click(function () {
$('.row-offcanvas').toggleClass('active')
});
});

62
docs/pygments.css Normal file
View File

@ -0,0 +1,62 @@
.hll { background-color: #ffffcc }
.c { color: #0099FF; font-style: italic } /* Comment */
.err { color: #AA0000; background-color: #FFAAAA } /* Error */
.k { color: #006699; font-weight: bold } /* Keyword */
.o { color: #555555 } /* Operator */
.cm { color: #0099FF; font-style: italic } /* Comment.Multiline */
.cp { color: #009999 } /* Comment.Preproc */
.c1 { color: #0099FF; font-style: italic } /* Comment.Single */
.cs { color: #0099FF; font-weight: bold; font-style: italic } /* Comment.Special */
.gd { background-color: #FFCCCC; border: 1px solid #CC0000 } /* Generic.Deleted */
.ge { font-style: italic } /* Generic.Emph */
.gr { color: #FF0000 } /* Generic.Error */
.gh { color: #003300; font-weight: bold } /* Generic.Heading */
.gi { background-color: #CCFFCC; border: 1px solid #00CC00 } /* Generic.Inserted */
.go { color: #AAAAAA } /* Generic.Output */
.gp { color: #000099; font-weight: bold } /* Generic.Prompt */
.gs { font-weight: bold } /* Generic.Strong */
.gu { color: #003300; font-weight: bold } /* Generic.Subheading */
.gt { color: #99CC66 } /* Generic.Traceback */
.kc { color: #006699; font-weight: bold } /* Keyword.Constant */
.kd { color: #006699; font-weight: bold } /* Keyword.Declaration */
.kn { color: #006699; font-weight: bold } /* Keyword.Namespace */
.kp { color: #006699 } /* Keyword.Pseudo */
.kr { color: #006699; font-weight: bold } /* Keyword.Reserved */
.kt { color: #007788; font-weight: bold } /* Keyword.Type */
.m { color: #FF6600 } /* Literal.Number */
.s { color: #CC3300 } /* Literal.String */
.na { color: #330099 } /* Name.Attribute */
.nb { color: #336666 } /* Name.Builtin */
.nc { color: #00AA88; font-weight: bold } /* Name.Class */
.no { color: #336600 } /* Name.Constant */
.nd { color: #9999FF } /* Name.Decorator */
.ni { color: #999999; font-weight: bold } /* Name.Entity */
.ne { color: #CC0000; font-weight: bold } /* Name.Exception */
.nf { color: #CC00FF } /* Name.Function */
.nl { color: #9999FF } /* Name.Label */
.nn { color: #00CCFF; font-weight: bold } /* Name.Namespace */
.nt { color: #330099; font-weight: bold } /* Name.Tag */
.nv { color: #003333 } /* Name.Variable */
.ow { color: #000000; font-weight: bold } /* Operator.Word */
.w { color: #bbbbbb } /* Text.Whitespace */
.mb { color: #FF6600 } /* Literal.Number.Bin */
.mf { color: #FF6600 } /* Literal.Number.Float */
.mh { color: #FF6600 } /* Literal.Number.Hex */
.mi { color: #FF6600 } /* Literal.Number.Integer */
.mo { color: #FF6600 } /* Literal.Number.Oct */
.sb { color: #CC3300 } /* Literal.String.Backtick */
.sc { color: #CC3300 } /* Literal.String.Char */
.sd { color: #CC3300; font-style: italic } /* Literal.String.Doc */
.s2 { color: #CC3300 } /* Literal.String.Double */
.se { color: #CC3300; font-weight: bold } /* Literal.String.Escape */
.sh { color: #CC3300 } /* Literal.String.Heredoc */
.si { color: #AA0000 } /* Literal.String.Interpol */
.sx { color: #CC3300 } /* Literal.String.Other */
.sr { color: #33AAAA } /* Literal.String.Regex */
.s1 { color: #CC3300 } /* Literal.String.Single */
.ss { color: #FFCC33 } /* Literal.String.Symbol */
.bp { color: #336666 } /* Name.Builtin.Pseudo */
.vc { color: #003333 } /* Name.Variable.Class */
.vg { color: #003333 } /* Name.Variable.Global */
.vi { color: #003333 } /* Name.Variable.Instance */
.il { color: #FF6600 } /* Literal.Number.Integer.Long */

2399
docs/web/bootstrap/Doxyfile Normal file

File diff suppressed because it is too large Load Diff

202
docs/web/bootstrap/LICENSE Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,16 @@
# How to Integrate
This is easy to integrate into your own doxyfile. Simply tell your doxyfile to use these 3 files in the HTML section:
* HTML_HEADER=header.html
* Adds a simple Bootstrap navbar for the title
* Wraps the content in a Bootstrap container/row combo
* HTML_FOOTER=footer.html
* Simply closes the extra divs opened in the header.html
* HTML_EXTRA_STYLESHEET=customdoxygen.css
You should also copy `doxy-boot.js` into your `html` directory, else it won't be found.
## Note
This hasn't been tested with the search box functionality or with the Doxygen sidebar.

View File

@ -0,0 +1,255 @@
h1, .h1, h2, .h2, h3, .h3{
font-weight: 200 !important;
}
#navrow1, #navrow2, #navrow3, #navrow4, #navrow5{
border-bottom: 1px solid #EEEEEE;
}
.adjust-right {
margin-left: 30px !important;
font-size: 1.15em !important;
}
.navbar{
border: 0px solid #222 !important;
}
/* Sticky footer styles
-------------------------------------------------- */
html,
body {
height: 100%;
/* The html and body elements cannot have any padding or margin. */
}
/* Wrapper for page content to push down footer */
#wrap {
min-height: 100%;
height: auto;
/* Negative indent footer by its height */
margin: 0 auto -60px;
/* Pad bottom by footer height */
padding: 0 0 60px;
}
/* Set the fixed height of the footer here */
#footer {
font-size: 0.9em;
padding: 8px 0px;
background-color: #f5f5f5;
}
.footer-row {
line-height: 44px;
}
#footer > .container {
padding-left: 15px;
padding-right: 15px;
}
.footer-follow-icon {
margin-left: 3px;
text-decoration: none !important;
}
.footer-follow-icon img {
width: 20px;
}
.footer-link {
padding-top: 5px;
display: inline-block;
color: #999999;
text-decoration: none;
}
.footer-copyright {
text-align: center;
}
@media (min-width: 992px) {
.footer-row {
text-align: left;
}
.footer-icons {
text-align: right;
}
}
@media (max-width: 991px) {
.footer-row {
text-align: center;
}
.footer-icons {
text-align: center;
}
}
/* DOXYGEN Code Styles
----------------------------------- */
a.qindex {
font-weight: bold;
}
a.qindexHL {
font-weight: bold;
background-color: #9CAFD4;
color: #ffffff;
border: 1px double #869DCA;
}
.contents a.qindexHL:visited {
color: #ffffff;
}
a.code, a.code:visited, a.line, a.line:visited {
color: #4665A2;
}
a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited {
color: #4665A2;
}
/* @end */
dl.el {
margin-left: -1cm;
}
pre.fragment {
border: 1px solid #C4CFE5;
background-color: #FBFCFD;
padding: 4px 6px;
margin: 4px 8px 4px 2px;
overflow: auto;
word-wrap: break-word;
font-size: 9pt;
line-height: 125%;
font-family: monospace, fixed;
font-size: 105%;
}
div.fragment {
padding: 4px 6px;
margin: 4px 8px 4px 2px;
border: 1px solid #C4CFE5;
}
div.line {
font-family: monospace, fixed;
font-size: 13px;
min-height: 13px;
line-height: 1.0;
text-wrap: unrestricted;
white-space: -moz-pre-wrap; /* Moz */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* CSS3 */
word-wrap: break-word; /* IE 5.5+ */
text-indent: -53px;
padding-left: 53px;
padding-bottom: 0px;
margin: 0px;
-webkit-transition-property: background-color, box-shadow;
-webkit-transition-duration: 0.5s;
-moz-transition-property: background-color, box-shadow;
-moz-transition-duration: 0.5s;
-ms-transition-property: background-color, box-shadow;
-ms-transition-duration: 0.5s;
-o-transition-property: background-color, box-shadow;
-o-transition-duration: 0.5s;
transition-property: background-color, box-shadow;
transition-duration: 0.5s;
}
div.line.glow {
background-color: cyan;
box-shadow: 0 0 10px cyan;
}
span.lineno {
padding-right: 4px;
text-align: right;
border-right: 2px solid #0F0;
background-color: #E8E8E8;
white-space: pre;
}
span.lineno a {
background-color: #D8D8D8;
}
span.lineno a:hover {
background-color: #C8C8C8;
}
div.groupHeader {
margin-left: 16px;
margin-top: 12px;
font-weight: bold;
}
div.groupText {
margin-left: 16px;
font-style: italic;
}
/* @group Code Colorization */
span.keyword {
color: #008000
}
span.keywordtype {
color: #604020
}
span.keywordflow {
color: #e08000
}
span.comment {
color: #800000
}
span.preprocessor {
color: #806020
}
span.stringliteral {
color: #002080
}
span.charliteral {
color: #008080
}
span.vhdldigit {
color: #ff00ff
}
span.vhdlchar {
color: #000000
}
span.vhdlkeyword {
color: #700070
}
span.vhdllogic {
color: #ff0000
}
blockquote {
background-color: #F7F8FB;
border-left: 2px solid #9CAFD4;
margin: 0 24px 0 4px;
padding: 0 12px 0 16px;
}

View File

@ -0,0 +1,121 @@
$( document ).ready(function() {
$("div.headertitle").addClass("page-header");
$("div.title").addClass("h1");
$('li > a[href="index.html"] > span').before("<i class='fa fa-cog'></i> ");
$('li > a[href="index.html"] > span').text("BioGears");
$('li > a[href="modules.html"] > span').before("<i class='fa fa-square'></i> ");
$('li > a[href="namespaces.html"] > span').before("<i class='fa fa-bars'></i> ");
$('li > a[href="annotated.html"] > span').before("<i class='fa fa-list-ul'></i> ");
$('li > a[href="classes.html"] > span').before("<i class='fa fa-book'></i> ");
$('li > a[href="inherits.html"] > span').before("<i class='fa fa-sitemap'></i> ");
$('li > a[href="functions.html"] > span').before("<i class='fa fa-list'></i> ");
$('li > a[href="functions_func.html"] > span').before("<i class='fa fa-list'></i> ");
$('li > a[href="functions_vars.html"] > span').before("<i class='fa fa-list'></i> ");
$('li > a[href="functions_enum.html"] > span').before("<i class='fa fa-list'></i> ");
$('li > a[href="functions_eval.html"] > span').before("<i class='fa fa-list'></i> ");
$('img[src="ftv2ns.png"]').replaceWith('<span class="label label-danger">N</span> ');
$('img[src="ftv2cl.png"]').replaceWith('<span class="label label-danger">C</span> ');
$("ul.tablist").addClass("nav nav-pills nav-justified");
$("ul.tablist").css("margin-top", "0.5em");
$("ul.tablist").css("margin-bottom", "0.5em");
$("li.current").addClass("active");
$("iframe").attr("scrolling", "yes");
$("#nav-path > ul").addClass("breadcrumb");
$("table.params").addClass("table");
$("div.ingroups").wrapInner("<small></small>");
$("div.levels").css("margin", "0.5em");
$("div.levels > span").addClass("btn btn-default btn-xs");
$("div.levels > span").css("margin-right", "0.25em");
$("table.directory").addClass("table table-striped");
$("div.summary > a").addClass("btn btn-default btn-xs");
$("table.fieldtable").addClass("table");
$(".fragment").addClass("well");
$(".memitem").addClass("panel panel-default");
$(".memproto").addClass("panel-heading");
$(".memdoc").addClass("panel-body");
$("span.mlabel").addClass("label label-info");
$("table.memberdecls").addClass("table");
$("[class^=memitem]").addClass("active");
$("div.ah").addClass("btn btn-default");
$("span.mlabels").addClass("pull-right");
$("table.mlabels").css("width", "100%")
$("td.mlabels-right").addClass("pull-right");
$("div.ttc").addClass("panel panel-primary");
$("div.ttname").addClass("panel-heading");
$("div.ttname a").css("color", 'white');
$("div.ttdef,div.ttdoc,div.ttdeci").addClass("panel-body");
$('#MSearchBox').parent().remove();
$('div.fragment.well div.line:first').css('margin-top', '15px');
$('div.fragment.well div.line:last').css('margin-bottom', '15px');
$('table.doxtable').removeClass('doxtable').addClass('table table-striped table-bordered').each(function(){
$(this).prepend('<thead></thead>');
$(this).find('tbody > tr:first').prependTo($(this).find('thead'));
$(this).find('td > span.success').parent().addClass('success');
$(this).find('td > span.warning').parent().addClass('warning');
$(this).find('td > span.danger').parent().addClass('danger');
});
if($('div.fragment.well div.ttc').length > 0)
{
$('div.fragment.well div.line:first').parent().removeClass('fragment well');
}
$('table.memberdecls').find('.memItemRight').each(function(){
$(this).contents().appendTo($(this).siblings('.memItemLeft'));
$(this).siblings('.memItemLeft').attr('align', 'left');
});
function getOriginalWidthOfImg(img_element) {
var t = new Image();
t.src = (img_element.getAttribute ? img_element.getAttribute("src") : false) || img_element.src;
return t.width;
}
$('div.dyncontent').find('img').each(function(){
if(getOriginalWidthOfImg($(this)[0]) > $('#content>div.container').width())
$(this).css('width', '100%');
});
$(".memitem").removeClass('memitem');
$(".memproto").removeClass('memproto');
$(".memdoc").removeClass('memdoc');
$("span.mlabel").removeClass('mlabel');
$("table.memberdecls").removeClass('memberdecls');
$("[class^=memitem]").removeClass('memitem');
$("span.mlabels").removeClass('mlabels');
$("table.mlabels").removeClass('mlabels');
$("td.mlabels-right").removeClass('mlabels-right');
$(".navpath").removeClass('navpath');
$("li.navelem").removeClass('navelem');
$("a.el").removeClass('el');
$("div.ah").removeClass('ah');
$("div.header").removeClass("header");
$('.mdescLeft').each(function(){
if($(this).html()=="&nbsp;") {
$(this).siblings('.mdescRight').attr('colspan', 2);
$(this).remove();
}
});
$('td.memItemLeft').each(function(){
if($(this).siblings('.memItemRight').html()=="") {
$(this).attr('colspan', 2);
$(this).siblings('.memItemRight').remove();
}
});
});

View File

@ -0,0 +1,7 @@
# Testing {#index}
Hello world!
~~~{.xml}
<test />
~~~

9
docs/yap.css Normal file
View File

@ -0,0 +1,9 @@
body { padding-top: 100px; }
/* set a max-width for horizontal fluid layout and make it centered */
.container-fluid {
margin-right: auto;
margin-left: auto;
max-width: 1600px; /* or 950px */
}

View File

@ -357,7 +357,7 @@ typedef enum stream_f {
Eof_Error_Stream_f = 0x000200, /**< Stream should generate error on trying to read after EOF */ Eof_Error_Stream_f = 0x000200, /**< Stream should generate error on trying to read after EOF */
Reset_Eof_Stream_f = 0x000400, /**< Stream should be reset on findind an EO (C-D and console.*/ Reset_Eof_Stream_f = 0x000400, /**< Stream should be reset on findind an EO (C-D and console.*/
Past_Eof_Stream_f = 0x000800, /**< Read EOF from stream */ Past_Eof_Stream_f = 0x000800, /**< Read EOF from stream */
Push_Eof_Stream_f = 0x001000, /**< keep on sennding EOFs */ Push_Eof_Stream_f = 0x001000, /**< keep on sending EOFs */
Seekable_Stream_f = 0x002000, /**< we can jump around the stream (std regular files) */ Seekable_Stream_f = 0x002000, /**< we can jump around the stream (std regular files) */
Promptable_Stream_f = 0x004000, /**< Interactive line-by-line stream */ Promptable_Stream_f = 0x004000, /**< Interactive line-by-line stream */
Client_Socket_Stream_f= 0x008000, /**< socket in client mode */ Client_Socket_Stream_f= 0x008000, /**< socket in client mode */
@ -369,7 +369,8 @@ typedef enum stream_f {
HAS_BOM_f = 0x200000, /**< media for streamhas a BOM mar. */ HAS_BOM_f = 0x200000, /**< media for streamhas a BOM mar. */
RepError_Prolog_f = 0x400000, /**< handle representation error as Prolog terms */ RepError_Prolog_f = 0x400000, /**< handle representation error as Prolog terms */
RepError_Xml_f = 0x800000, /**< handle representation error as XML objects */ RepError_Xml_f = 0x800000, /**< handle representation error as XML objects */
DoNotCloseOnAbort_Stream_f= 0x1000000 /**< do not close the stream after an abort event */ DoNotCloseOnAbort_Stream_f= 0x1000000, /**< do not close the stream after an abort event */
Readline_Stream_f= 0x2000000 /**< the stream is a readline stream */
} estream_f; } estream_f;
typedef uint64_t stream_flags_t; typedef uint64_t stream_flags_t;

View File

@ -13,6 +13,7 @@ set (LIBRARY_PL
dbqueues.yap dbqueues.yap
dbusage.yap dbusage.yap
dgraphs.yap dgraphs.yap
error.yap
exo_interval.yap exo_interval.yap
expand_macros.yap expand_macros.yap
gensym.yap gensym.yap
@ -54,6 +55,7 @@ set (LIBRARY_PL
wundgraphs.yap wundgraphs.yap
lam_mpi.yap lam_mpi.yap
ypp.yap ypp.yap
ytest.yap
c_alarms.yap c_alarms.yap
flags.yap flags.yap
block_diagram.yap block_diagram.yap

View File

@ -14,10 +14,10 @@
/** /**
* @file apply.yap * @file apply.yap
* @defgroup apply_stub Apply Predicates * @defgroup apply_stub Apply Predicates
*
* @ingroup library * @ingroup library
*
@{ * @{
This library provides a SWI-compatible set of utilities for applying a This library provides a SWI-compatible set of utilities for applying a
predicate to all elements of a list. predicate to all elements of a list.
@ -34,8 +34,6 @@ The apply library is a _stub_, it just forwards definitions to the
- partition/4, - partition/4,
- partition/5 - partition/5
@}
*/ */
:- reexport(library(maplist), :- reexport(library(maplist),
@ -50,3 +48,5 @@ The apply library is a _stub_, it just forwards definitions to the
]). ]).
%% @}

View File

@ -1,3 +1,4 @@
/% File : apply_macros.yap /% File : apply_macros.yap
% Author : E. Alphonse from code by Joachim Schimpf % Author : E. Alphonse from code by Joachim Schimpf
% Updated: 15 June 2002 % Updated: 15 June 2002
@ -25,7 +26,6 @@ definitions to the @ref maplist library, these include:
- partition/4, - partition/4,
- partition/5 - partition/5
@}
*/ */
@ -33,4 +33,4 @@ definitions to the @ref maplist library, these include:
:- reexport(mapargs). :- reexport(mapargs).
%% @}

View File

@ -25,6 +25,8 @@
@ingroup @library @ingroup @library
@{
Extends arg/3 by including backtracking through arguments and access Extends arg/3 by including backtracking through arguments and access
to sub-arguments, to sub-arguments,
@ -158,3 +160,6 @@ path_arg([], Term, Term).
path_arg([Index|Indices], Term, SubTerm) :- path_arg([Index|Indices], Term, SubTerm) :-
genarg(Index, Term, Arg), genarg(Index, Term, Arg),
path_arg(Indices, Arg, SubTerm). path_arg(Indices, Arg, SubTerm).
%%@}

View File

@ -11,9 +11,6 @@
* Note: the keys should be bound, the associated values need not be. * Note: the keys should be bound, the associated values need not be.
*/ */
*/
:- module(assoc, [ :- module(assoc, [
empty_assoc/1, empty_assoc/1,
assoc_to_list/2, assoc_to_list/2,

View File

@ -20,7 +20,7 @@
%% @{ %% @{
/** /**
@ingroup Old_Style_Attribute_Declarations @addtogroup attributes
SICStus style attribute declarations are activated through loading the SICStus style attribute declarations are activated through loading the
@ -122,6 +122,7 @@ user:goal_expansion(get_atts(Var,AccessSpec), Mod, Goal) :-
Associate with or remove attributes from a variable _Var_. The Associate with or remove attributes from a variable _Var_. The
attributes are given in _?ListOfAttributes_, and the action depends attributes are given in _?ListOfAttributes_, and the action depends
on how they are prefixed: on how they are prefixed:
+ +( _Attribute_ ) + +( _Attribute_ )
Associate _Var_ with _Attribute_. A previous value for the Associate _Var_ with _Attribute_. A previous value for the
attribute is simply replace (like with `set_mutable/2`). attribute is simply replace (like with `set_mutable/2`).
@ -130,8 +131,6 @@ attribute is simply replace (like with `set_mutable/2`).
Remove the attribute with the same name. If no such attribute existed, Remove the attribute with the same name. If no such attribute existed,
simply succeed. simply succeed.
*/ */
user:goal_expansion(put_atts(Var,AccessSpec), Mod, Goal) :- user:goal_expansion(put_atts(Var,AccessSpec), Mod, Goal) :-
expand_put_attributes(AccessSpec, Mod, Var, Goal). expand_put_attributes(AccessSpec, Mod, Var, Goal).
@ -271,6 +270,13 @@ do_verify_attributes([Mod|Mods], AttVar, Binding, [Mod:Goal|Goals]) :-
do_verify_attributes([_|Mods], AttVar, Binding, Goals) :- do_verify_attributes([_|Mods], AttVar, Binding, Goals) :-
do_verify_attributes(Mods, AttVar, Binding, Goals). do_verify_attributes(Mods, AttVar, Binding, Goals).
has_modules_with_attributes(LMods) :-
modules_with_attributes(LMods).
module_has_attributes(Mod) :-
attributed_module(Mod, _, _), !.
/** /**
@} @}
*/ */

View File

@ -34,6 +34,8 @@
* @defgroup bhash Backtrackable Hash Tables * @defgroup bhash Backtrackable Hash Tables
* @ingroup library * @ingroup library
@{
This library implements hash-arrays. This library implements hash-arrays.
It requires the hash key to be a ground term. The library can It requires the hash key to be a ground term. The library can
be loaded as be loaded as
@ -326,4 +328,5 @@ mklistvals(K.Vals, KK.NVals) :-
mklistvals(Vals, NVals). mklistvals(Vals, NVals).
/** /**
@}
*/ */

View File

@ -7,7 +7,7 @@
* *
* @brief Graph the program structure. * @brief Graph the program structure.
* *
* * @{
*/ */
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -473,3 +473,5 @@ write_explicit.
atom_concat([InModule, ' -> DYNAMIC [label="DYNAMIC",style=dashed]'], NodeConnection), atom_concat([InModule, ' -> DYNAMIC [label="DYNAMIC",style=dashed]'], NodeConnection),
write(NodeConnection), nl. write(NodeConnection), nl.
*/ */
%% @}

View File

@ -21,7 +21,7 @@
* @date Tue Nov 17 01:17:33 2015 * @date Tue Nov 17 01:17:33 2015
* *
* @brief Several operations on text. * @brief Several operations on text.
* * @{
* *
*/ */

View File

@ -13,7 +13,7 @@
conj2list/2, conj2list/2,
clauselength/2]). clauselength/2]).
%%! @{ %% @{
/** /**
* @defgroup clauses Clause Manipulation * @defgroup clauses Clause Manipulation
@ -31,26 +31,42 @@
It is often easier to apply operations on lists than on clauses It is often easier to apply operations on lists than on clauses
*/ */
conj2list( M:Conj, List ) :-
conj2list_( Conj, M, List, [] ).
conj2list( Conj, List ) :- conj2list( Conj, List ) :-
conj2list( Conj, List, [] ). conj2list_( Conj, List, [] ).
conj2list( C ) --> conj2list_( C ) -->
{ var(C) }, { var(C) },
!, !,
[C]. [C].
conj2list( true ) --> !. conj2list_( true ) --> !.
conj2list( (C1, C2) ) --> conj2list_( (C1, C2) ) -->
!, !,
conj2list( C1 ), conj2list_( C1 ),
conj2list( C2 ). conj2list_( C2 ).
conj2list( C ) --> conj2list_( C ) -->
[C]. [C].
/** conj2list( +List, -Conj) is det conj2list_( C, M ) -->
{ var(C) },
!,
[M: C].
conj2list_( true , _) --> !.
conj2list_( (C1, C2), M ) -->
!,
conj2list_( C1, M ),
conj2list_( C2, M ).
conj2list_( C, M ) -->
{ strip_module(M:C, NM, NC) },
[NM:NC].
/** list2conj( +List, -Conj) is det
Generate a conjunction from a list of literals. Generate a conjunction from a list of literals.
Notice that this relies on indexing within the list to avoid creating Notice Mthat this relies on indexing within the list to avoid creating
choice-points. choice-points.
*/ */
list2conj([], true). list2conj([], true).
@ -77,3 +93,4 @@ clauselength( (C1, C2), I2, I ) :- !,
clauselength( _C, I1, I ) :- clauselength( _C, I1, I ) :-
I1 is I+1. I1 is I+1.
%%@}

View File

@ -17,7 +17,7 @@
/** /**
* *
* @{ * @{
* @file blobs.c * @file swi/fli/blobs.c
* *
* @addtogroup swi-c-interface * @addtogroup swi-c-interface
* *

2
library/error.yap Normal file
View File

@ -0,0 +1,2 @@
%:- include('pl/error').

View File

@ -1,7 +1,7 @@
%%% -*- Mode: Prolog; -*- %%% -*- Mode: Prolog; -*-
/** /**
* @file flags.yap * @file library/flags.yap
* @author Theofrastos Mantadelis, Bernd Gutmann, Paulo Moura * @author Theofrastos Mantadelis, Bernd Gutmann, Paulo Moura
* @date Tue Nov 17 15:18:02 2015 * @date Tue Nov 17 15:18:02 2015
* *
@ -235,6 +235,7 @@
* *
* Routines to manipulate flags: they allow defining, set, * Routines to manipulate flags: they allow defining, set,
* resetting. * resetting.
* @{
*/ */
@ -585,4 +586,4 @@ defined_flag(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, H
nonvar(FlagName), nonvar(FlagGroup), nonvar(FlagName), nonvar(FlagGroup),
'$defined_flag$'(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, Handler). '$defined_flag$'(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, Handler).
%%@}

View File

@ -21,6 +21,7 @@
enable_interrupts/0, enable_interrupts/0,
disable_interrupts/0, disable_interrupts/0,
virtual_alarm/3, virtual_alarm/3,
fully_strip_module/3,
context_variables/1 context_variables/1
]). ]).
@ -65,3 +66,7 @@ virtual_alarm(Interval.USecs, Goal, Left.LUSecs) :-
on_signal(sig_vtalarm, _, Goal), on_signal(sig_vtalarm, _, Goal),
virtual_alarm(Interval, USecs, Left, LUSecs). virtual_alarm(Interval, USecs, Left, LUSecs).
fully_strip_module(T,M,S) :-
'$hacks':fully_strip_module(T,M,S).

View File

@ -257,8 +257,7 @@ the pair with the smallest Key), but does not remove it from the heap.
min_of_heap(t(_,_,t(Key,Datum,_,_)), Key, Datum). min_of_heap(t(_,_,t(Key,Datum,_,_)), Key, Datum).
%% @pred @pred min_of_heap(+ _Heap_, - _Key1_, - _Datum1_, %% @pred @pred min_of_heap(+ _Heap_, - _Key1_, - _Datum1_, -_Key2_, - _Datum2_)
- _Key2_, - _Datum2_)
% %
% returns the smallest (Key1) and second smallest (Key2) pairs in % returns the smallest (Key1) and second smallest (Key2) pairs in
% the heap, without deleting them. It fails if the heap does not % the heap, without deleting them. It fails if the heap does not

View File

@ -18,6 +18,7 @@
blank/3, blank/3,
split/2, split/2,
split/3, split/3,
split_unquoted/3,
fields/2, fields/2,
fields/3, fields/3,
glue/3, glue/3,
@ -199,6 +200,58 @@ split(SplitCodes, [C|New], Set) -->
split(SplitCodes, New, Set). split(SplitCodes, New, Set).
split(_, [], []) --> []. split(_, [], []) --> [].
/** @pred split_unquoted(+ _Line_,+ _Separators_,- _Split_)
Unify _Words_ with a set of strings obtained from _Line_ by
using the character codes in _Separators_ as separators, but treat text within double quotes as a single unit. As an
example, consider:
~~~~~{.prolog}
?- split("Hello * I \"am free\""," *",S).
S = ["Hello","I","am free"] ?
no
~~~~~
*/
split_unquoted(String, SplitCodes, Strings) :-
split_unquoted_at_blank(SplitCodes, Strings, String, []).
split_unquoted_at_blank(SplitCodes, [[0'"|New]|More]) --> %0'"
"\"",
split_quoted(New, More),
split_unquoted_at_blank(SplitCodes, More).
split_unquoted_at_blank(SplitCodes, More) -->
[C],
{ member(C, SplitCodes) }, !,
split_unquoted_at_blank(SplitCodes, More).
split_unquoted_at_blank(SplitCodes, [[C|New]| More]) -->
[C], !,
split_unquoted(SplitCodes, New, More).
split_unquoted_at_blank(_, []) --> [].
split_unquoted(SplitCodes, [], More) -->
[C],
{ member(C, SplitCodes) }, !,
split_unquoted_at_blank(SplitCodes, More).
split_unquoted(SplitCodes, [C|New], Set) -->
[C], !,
split_unquoted(SplitCodes, New, Set).
split_unquoted(_, [], []) --> [].
split_quoted( [0'"], More) --> %0'"
"\"".
split_quoted( [0'\\ ,C|New], More) --> %0'"
"\\",
[C],
split_quoted(New, More).
split_quoted( [C|New], More) --> %0'"
[C],
split_quoted(New, More).
/** @pred fields(+ _Line_,- _Split_) /** @pred fields(+ _Line_,- _Split_)
Unify _Words_ with a set of strings obtained from _Line_ by Unify _Words_ with a set of strings obtained from _Line_ by

View File

@ -1,5 +1,5 @@
/** /**
* @file lists.yap * @file library/lists.yap
* @author Bob Welham, Lawrence Byrd, and R. A. O'Keefe. Contributions from Vitor Santos Costa, Jan Wielemaker and others. * @author Bob Welham, Lawrence Byrd, and R. A. O'Keefe. Contributions from Vitor Santos Costa, Jan Wielemaker and others.
* @date 1999 * @date 1999
* *
@ -212,6 +212,7 @@ append_([L1,L2|[L3|LL]], L) :-
True when _List_ is a list and _Last_ is identical to its last element. True when _List_ is a list and _Last_ is identical to its last element.
d(_, [X], L). d(_, [X], L).
*/
last([H|List], Last) :- last([H|List], Last) :-
last(List, H, Last). last(List, H, Last).
@ -623,3 +624,4 @@ close_list([_|T]) :-
close_list(T). close_list(T).
%% @}

View File

@ -34,7 +34,7 @@
ord_memberchk/2 % Element X Set ord_memberchk/2 % Element X Set
]). ]).
/** @defgroup Ordered_Sets Ordered Sets /** @defgroup ordsets Ordered Sets
* @ingroup library * @ingroup library
* @{ * @{

View File

@ -55,7 +55,6 @@ read_file_to_codes(File, Codes, _) :-
close(Stream). close(Stream).
read_file_to_codes(File, Codes) :- read_file_to_codes(File, Codes) :-
v
open(File, read, Stream), open(File, read, Stream),
read_stream_to_codes(Stream, Codes, []), read_stream_to_codes(Stream, Codes, []),
close(Stream). close(Stream).
@ -79,5 +78,3 @@ prolog_read_stream_to_terms(Stream, Terms, Terms0) :-
Terms = [Term|TermsI], Terms = [Term|TermsI],
prolog_read_stream_to_terms(Stream, TermsI, Terms0) prolog_read_stream_to_terms(Stream, TermsI, Terms0)
). ).

View File

@ -27,8 +27,9 @@
:- module operating_system_support, :- module( operating_system_support,
[ [
datime/1,
delete_file/1, delete_file/1,
delete_file/2, delete_file/2,
directory_files/2, directory_files/2,
@ -831,4 +832,3 @@ tmpdir(TmpDir):-
path_separator('\\'):- path_separator('\\'):-
win, !. win, !.
path_separator('/'). path_separator('/').

View File

@ -35,8 +35,6 @@
wdgraph_path/3, wdgraph_path/3,
wdgraph_reachable/3]). wdgraph_reachable/3]).
/Weighted Directed Graph Processing Utilities.
:- module( wdgraphs, :- module( wdgraphs,
[ [
wdgraph_new/1, wdgraph_new/1,

150
library/ytest.yap Normal file
View File

@ -0,0 +1,150 @@
:- module( ytest, [run_test/1,
run_tests/0,
test_mode/0,
op(1150, fx, test),
op(999, xfx, returns)] ).
:- use_module( clauses ).
:- multifile test/1.
:- dynamic error/3, failed/3.
test_mode.
user:term_expansion( test( (A, B) ), ytest:test( Lab, Cond, Done ) ) :-
info((A,B), Lab, Cond , Done ).
run_tests :-
run_test(_Lab),
fail.
run_tests :-
show_bad.
run_test(Lab) :-
current_module(M,M),
test(Lab, (G returns Sols ), Done),
ground( Done),
format('~w : ',[ Lab ]),
reset( Streams ),
conj2list( Sols, LSols ),
% trace,
catch( do_returns(M:G, LSols, Lab), Ball, end( Ball ) ),
shutdown( Streams ).
info((A,B), Lab, Cl, G) :- !,
info(A, Lab, Cl, G),
info(B, Lab, Cl, G).
info(A, _, _, _) :- var(A), !.
info(A returns B, _, (A returns B), g(_,ok)) :- !.
info(A, A, _, g(ok,_)) :- primitive(A), !.
info(_A, _, _, _).
do_returns(G0 , Sols0, Lab ) :-
counter(I),
fetch(I, Sols0, Pattern0, Next),
Pattern0 = ( V0 =@= Target0),
copy_term(G0-V0, G-VGF),
catch( answer(G, VGF, Target0, Lab, Sol) , Error, Sol = error(G, Error) ),
step( _I, Sols, G0, Sol, Lab ),
!.
answer(G, V, Target0, Lab, answer(G)) :-
call(G),
( V =@= Target0
->
success(Lab, V)
;
failure(V, Target0, Lab)
).
step( I, Sols , G0, Sol, Lab ) :-
inc(I),
fetch(I, Sols, Pattern, Next),
( Sol = answer(_)
->
true
;
Sol = error(_, Error)
->
(
nonvar(Pattern ) ,
Pattern = ( Error -> G),
G
->
success
;
error(I, G0, Error, Pattern, Lab )
)
),
(
Next == ... -> throw( done )
;
Next == [] -> throw( done )
).
% fail
success( _, _) :-
write('.'),
flush_output.
error(_, G, E, _ , Lab) :-
write('X'),
flush_output,
assert( error(Lab,E,G) ).
failure( G, Pattern, Lab) :-
write('X'),
flush_output,
assert(failed(Lab, G, Pattern)).
reset( _ ) :-
nb_setval( counter,( 0 ) ).
inc( I ) :-
nb_getval( counter,( I ) ),
I1 is I+1,
nb_setval( counter,( I1 ) ).
counter( I ) :-
nb_getval( counter,( I ) ).
shutdown( _Streams ) :-
% close_io( Streams ).
true.
test_error( Ball, e( Ball ) ).
fetch( 0, [ A ], A, []) :-
!.
fetch( 0, [ A, B | _ ], A, B) :-
!.
fetch( I0, [ _ | L ] , A, B) :-
I0 > 0,
I is I0-1,
fetch( I, L, A, B ).
show_bad :-
error( Lab, E , B),
numbervars(E, 1, _),
format( '~n~n~w: error, error ~w.~n', [Lab, E] ),
writeln( error: E: B ),
fail.
show_bad :-
failed( Lab, V, P ),
numbervars(V, 1, _),
numbervars(P, 1, _),
format( '~n~n~w: failed, ~w =\\@= ~w.~n', [Lab, V, P] ),
fail.
show_bad.
end(done) :-
!,
nl,
fail.
end(Ball) :-
writeln( bad:Ball ).

90
library/ytest/preds.yap Normal file
View File

@ -0,0 +1,90 @@
'$predicate_flags'(P, M, Flags0, Flags1) :-
var(Flags0),
Flags0 == Flags1,
!,
(
predicate_property(M:P, meta_predicate(_))
->
Flags1 = 0x200000
).
'$predicate_flags'(P, M, Flags0, Flags1) :-
( Flags1 /\ 0x200000 =\= 0,
Flags0 /\ 0x200000 =:= 0
->
true
;
Flags1 /\ 0x200000 =\= 0,
Flags0 /\ 0x200000 =\= 0
).
'$get_undefined_pred'(G,M,G,M0) :-
predicate_property(M:G, imported_from(M0)), !.
'$get_undefined_pred'(G,M,G,OM) :-
functor(G,F,N),
( system_predicate(F/N), OM = prolog ; current_predicate(user:F/N), OM= user), !.
'$get_undefined_pred'(G,M,G,M0) :-
predicate_property(M:G, imported_from(M0)), !.
'$get_undefined_pred'(G,M,G,M).
'$is_metapredicate'( call(_), _M) :- !.
'$is_metapredicate'( call(_,_), _M) :- !.
'$is_metapredicate'( G, M) :-
predicate_property(M:G, meta_predicate(_)).
'$imported_predicate'(G,M,G,M0) :-
predicate_property(M:G, imported_from(M0)).
'$system_predicate'( call(_), _M) :- !.
'$system_predicate'( call(_,_), _M) :- !.
'$system_predicate'(G,M) :-
predicate_property(M:G, built_in).
'$is_multifile'(G,M) :-
predicate_property(M:G, multifile).
'$module_transparent'(_,_,_,_) :- fail.
'$meta_predicate'(call,_M,1,call(0)) :- !.
'$meta_predicate'(call,_M,2,call(1,?)) :- !.
'$meta_predicate'(F,M,N,P) :-
functor(G, F, N),
predicate_property(M:G, meta_predicate(P)).
user:term_expansion( ( :- '$meta_predicate'( _ ) ), [] ).
user:goal_expansion(_:'_user_expand_goal'(A, M, B), user:user_expand_goal(A, M, B) ).
user_expand_goal(A, M, B) :-
(
current_predicate(M:goal_expansion/2),
M:goal_expansion(A,B) -> true ;
system:goal_expansion(A,B) -> true ;
user:goal_expansion(A,M,B) -> true ;
user:goal_expansion(A,B) -> true
).
user:goal_expansion(prolog:'$meta_predicate'(N,M,A,D) , user:mt( N, M, A, D) ).
mt(N,M,A,D) :-
functor(D,N,A),
predicate_property(M:D, meta_predicate(D)).
'$full_clause_optimisation'(_H, _M, B, B).
'$c_built_in'(G, _SM, _H, G).
'$head_and_body'((H:-B),H,B) :- !.
'$head_and_body'(H,H,true).
'$yap_strip_module'(T,M,S) :-
fully_strip_module(T,M,S).
:- hide( expand_goal ).
:- include('pl/meta').

View File

@ -30,6 +30,10 @@ A Assert N ":-"
A EmptyBrackets N "()" A EmptyBrackets N "()"
A EmptySquareBrackets N "[]" A EmptySquareBrackets N "[]"
A EmptyCurlyBrackets N "{}" A EmptyCurlyBrackets N "{}"
A Asserta N "asserta"
A AssertaStatic N "asserta_static"
A Assertz N "assertz"
A AssertzStatic N "assertz_static"
A At N "at" A At N "at"
A Atom N "atom" A Atom N "atom"
A Atomic N "atomic" A Atomic N "atomic"
@ -71,6 +75,7 @@ A CommentHook N "comment_hook"
A Compact N "compact" A Compact N "compact"
A Compound N "compound" A Compound N "compound"
A ConsistencyError N "consistency_error" A ConsistencyError N "consistency_error"
A Consult N "consult"
A ConsultOnBoot F "$consult_on_boot" A ConsultOnBoot F "$consult_on_boot"
A Context N "context" A Context N "context"
A Cputime N "cputime" A Cputime N "cputime"
@ -138,6 +143,7 @@ A FB N "fb"
A Fail N "fail" A Fail N "fail"
A False N "false" A False N "false"
A Fast F "$fast" A Fast F "$fast"
A FastFail N "fast_fail"
A FileErrors N "file_errors" A FileErrors N "file_errors"
A Fileerrors N "fileerrors" A Fileerrors N "fileerrors"
A FileType N "file_type" A FileType N "file_type"
@ -293,6 +299,7 @@ A Read N "read"
A ReadOnly N "read_only" A ReadOnly N "read_only"
A ReadWrite N "read_write" A ReadWrite N "read_write"
A Readutil N "readutil" A Readutil N "readutil"
A Reconsult N "reconsult"
A RecordedP F "$recordep" A RecordedP F "$recordep"
A RecordedWithKey F "$recorded_with_key" A RecordedWithKey F "$recorded_with_key"
A RedefineWarnings N "redefine_warnings" A RedefineWarnings N "redefine_warnings"
@ -395,6 +402,7 @@ A User N "user"
A UserErr N "user_error" A UserErr N "user_error"
A UserIn N "user_input" A UserIn N "user_input"
A UserOut N "user_output" A UserOut N "user_output"
A DollarVar N "$VAR"
A VBar N "|" A VBar N "|"
A VarBranches N "var_branches" A VarBranches N "var_branches"
A VariableNames N "variable_names" A VariableNames N "variable_names"

View File

@ -104,6 +104,7 @@ Term globals_module GLOBALS_MODULE MkAT AtomNb
Term swi_module SWI_MODULE MkAT AtomSwi Term swi_module SWI_MODULE MkAT AtomSwi
Term dbload_module DBLOAD_MODULE MkAT AtomDBLoad Term dbload_module DBLOAD_MODULE MkAT AtomDBLoad
Term range_module RANGE_MODULE MkAT AtomRange Term range_module RANGE_MODULE MkAT AtomRange
Term error_module ERROR_MODULE MkAT AtomError
// //
// Module list // Module list
@ -227,9 +228,6 @@ yamop *retry_recorded_k_code RETRY_C_RECORDED_K_CODE =NULL PtoOpAdjust
/* compiler flags */ /* compiler flags */
int system_profiling PROFILING =FALSE void int system_profiling PROFILING =FALSE void
int system_call_counting CALL_COUNTING =FALSE void int system_call_counting CALL_COUNTING =FALSE void
int system_pred_goal_expansion_all PRED_GOAL_EXPANSION_ALL =FALSE void
int system_pred_goal_expansion_func PRED_GOAL_EXPANSION_FUNC =FALSE void
int system_pred_goal_expansion_on PRED_GOAL_EXPANSION_ON =FALSE void
int compiler_optimizer_on optimizer_on =TRUE void int compiler_optimizer_on optimizer_on =TRUE void
int compiler_compile_mode compile_mode =0 void int compiler_compile_mode compile_mode =0 void
int compiler_profiling profiling =FALSE void int compiler_profiling profiling =FALSE void

View File

@ -288,8 +288,6 @@ UInt ImportDBRefHashTableNum =0
yamop *ImportFAILCODE =NULL yamop *ImportFAILCODE =NULL
Functor FunctorVar =FunctorVar
#if __ANDROID__ #if __ANDROID__
// current virtual directory. // current virtual directory.
struct AAssetManager* assetManager =GLOBAL_assetManager struct AAssetManager* assetManager =GLOBAL_assetManager

View File

@ -1,7 +1,8 @@
:- use_module(library(lineutils), :- use_module(library(lineutils),
[file_filter_with_init/5, [file_filter_with_init/5,
split/3]). file_filter_with_initialization/5,
split_unquoted/3]).
:- use_module(library(lists), :- use_module(library(lists),
[append/2]). [append/2]).
@ -19,47 +20,47 @@ main :-
warning('~n /* This file, ~a, was generated automatically by \"yap -L misc/buildatoms\"~n please do not update, update misc/ATOMS instead */~n~n'). warning('~n /* This file, ~a, was generated automatically by \"yap -L misc/buildatoms\"~n please do not update, update misc/ATOMS instead */~n~n').
gen_fields(Inp,Out) :- gen_fields(Inp,Out) :-
split(Inp," ",["A",Atom,_,_]), !, split_unquoted(Inp," ",["A",Atom,_,_]), !,
append([" Atom Atom",Atom,"_;\n#define Atom",Atom," Yap_heap_regs->Atom",Atom,"_\n", append([" Atom Atom",Atom,"_;\n#define Atom",Atom," Yap_heap_regs->Atom",Atom,"_\n",
"#define Term",Atom," MkAtomTerm( Yap_heap_regs->Atom",Atom,"_ )"],Out). "#define Term",Atom," MkAtomTerm( Yap_heap_regs->Atom",Atom,"_ )"],Out).
%gen_fields(Inp,Out) :- %gen_fields(Inp,Out) :-
% split(Inp," ",["A",Atom,_]), !, % split_unquoted(Inp," ",["A",Atom,_]), !,
% append([" Atom Atom_",Atom,"_;\n#define Atom_",Atom," Yap_heap_regs->Atom_",Atom,"_"],Out). % append([" Atom Atom_",Atom,"_;\n#define Atom_",Atom," Yap_heap_regs->Atom_",Atom,"_"],Out).
gen_fields(Inp,Out) :- gen_fields(Inp,Out) :-
split(Inp," ",["F",Name,_,_]), !, split_unquoted(Inp," ",["F",Name,_,_]), !,
append([" Functor Functor",Name,"_;\n#define Functor",Name," Yap_heap_regs->Functor",Name,"_"],Out). append([" Functor Functor",Name,"_;\n#define Functor",Name," Yap_heap_regs->Functor",Name,"_"],Out).
%gen_fields(Inp,Out) :- %gen_fields(Inp,Out) :-
% split(Inp," ",["F",Name,Arity]), !, % split_unquoted(Inp," ",["F",Name,Arity]), !,
% append([" Functor Functor_",Name,Arity,"_;\n#define Functor_",Name,Arity," Yap_heap_regs->Functor_",Name,Arity,"_"],Out). % append([" Functor Functor_",Name,Arity,"_;\n#define Functor_",Name,Arity," Yap_heap_regs->Functor_",Name,Arity,"_"],Out).
gen_rcov(Inp,Out) :- gen_rcov(Inp,Out) :-
split(Inp," ",["A",Atom,_,_]), !, split_unquoted(Inp," ",["A",Atom,_,_]), !,
append([" Atom",Atom," = AtomAdjust(Atom",Atom,");"],Out). append([" Atom",Atom," = AtomAdjust(Atom",Atom,");"],Out).
%gen_rcov(Inp,Out) :- %gen_rcov(Inp,Out) :-
% split(Inp," ",["A",Atom,_]), !, % split_unquoted(Inp," ",["A",Atom,_]), !,
% append([" Atom_",Atom," = AtomAdjust(Atom_",Atom,");"],Out). % append([" Atom_",Atom," = AtomAdjust(Atom_",Atom,");"],Out).
gen_rcov(Inp,Out) :- gen_rcov(Inp,Out) :-
split(Inp," ",["F",Functor,_,_]), !, split_unquoted(Inp," ",["F",Functor,_,_]), !,
append([" Functor",Functor," = FuncAdjust(Functor",Functor,");"],Out). append([" Functor",Functor," = FuncAdjust(Functor",Functor,");"],Out).
%gen_rcov(Inp,Out) :- %gen_rcov(Inp,Out) :-
% split(Inp," ",["F",Functor,Arity]), !, % split_unquoted(Inp," ",["F",Functor,Arity]), !,
% append([" Functor_",Functor,Arity," = FuncAdjust(Functor_",Functor,Arity,");"],Out). % append([" Functor_",Functor,Arity," = FuncAdjust(Functor_",Functor,Arity,");"],Out).
gen_decl(Inp,Out) :- gen_decl(Inp,Out) :-
split(Inp," ",["A",Atom,"N",String]), !, split_unquoted(Inp," ",["A",Atom,"N",String]), !,
append([" Atom",Atom," = Yap_LookupAtom(",String,");"],Out). append([" Atom",Atom," = Yap_LookupAtom(",String,");"],Out).
gen_decl(Inp,Out) :- gen_decl(Inp,Out) :-
split(Inp," ",["A",Atom,"F",String]), !, split_unquoted(Inp," ",["A",Atom,"F",String]), !,
append([" Atom",Atom," = Yap_FullLookupAtom(",String,");"],Out). append([" Atom",Atom," = Yap_FullLookupAtom(",String,");"],Out).
%gen_decl(Inp,Out) :- %gen_decl(Inp,Out) :-
% split(Inp," ",["A",Atom,String]), String = [0'",0'$|_], !, % split_unquoted(Inp," ",["A",Atom,String]), String = [0'",0'$|_], !,
% append([" Atom_",Atom," = Yap_FullLookupAtom(",String,");"],Out). % append([" Atom_",Atom," = Yap_FullLookupAtom(",String,");"],Out).
%gen_decl(Inp,Out) :- %gen_decl(Inp,Out) :-
% split(Inp," ",["A",Atom,String]), !, % split_unquoted(Inp," ",["A",Atom,String]), !,
% append([" Atom_",Atom," = Yap_LookupAtom(",String,");"],Out). % append([" Atom_",Atom," = Yap_LookupAtom(",String,");"],Out).
gen_decl(Inp,Out) :- gen_decl(Inp,Out) :-
split(Inp," ",["F",Name,Atom,Arity]), !, split_unquoted(Inp," ",["F",Name,Atom,Arity]), !,
append([" Functor",Name," = Yap_MkFunctor(Atom",Atom,",",Arity,");"],Out). append([" Functor",Name," = Yap_MkFunctor(Atom",Atom,",",Arity,");"],Out).
%gen_decl(Inp,Out) :- %gen_decl(Inp,Out) :-
% split(Inp," ",["F",Name,Arity]), !, % split_unquoted(Inp," ",["F",Name,Arity]), !,
% append([" Functor_",Name,Arity," = Yap_MkFunctor(Atom_",Name,",",Arity,");"],Out). % append([" Functor_",Name,Arity," = Yap_MkFunctor(Atom_",Name,",",Arity,");"],Out).

View File

@ -16,18 +16,18 @@
:- initialization main. :- initialization main.
main :- main :-
unix( argv(L) ), unix( argv(L0 ) ),
(L0 == [] -> L = [.] ; L = L0 ),
member( Lib, L ), member( Lib, L ),
absolute_file_name( Lib, NL, [glob('*.pl *.yap'),file_type(prolog), file_errors(fail), solutions(all)] ), absolute_file_name( Lib, NL, [glob('*.pl *.yap'),file_type(prolog), file_errors(fail), solutions(all)] ),
% current_module(M), writeln(M:NL), %current_module(M), writeln(M:x:NL),
catch( ensure_loaded(library( NL )) , _, (writeln(crash:NL), module(user))), catch( ensure_loaded( NL ) , Error, (format('crash ~w in ~a~n',[Error,NL]), module(user) ) ),
fail. fail.
main :- main :-
unix( argv(L) ), unix( argv(L) ),
member( Lib, L ), member( Lib, L ),
absolute_file_name( Lib, NL, [glob('*.pl *.yap'),file_type(prolog), file_errors(fail), solutions(all)] ), absolute_file_name( Lib, NL, [glob('*.pl *.yap'),file_type(prolog), file_errors(fail), solutions(all)] ),
writeln( NL ),
module_property( Mod, file( NL )), module_property( Mod, file( NL )),
module_property( Mod, exports( Preds )), module_property( Mod, exports( Preds )),
file_base_name( NL, NameF), file_base_name( NL, NameF),
@ -39,4 +39,3 @@ main :-
main. main.
out(N/A) :- format(' - ~q~n', [N/A]). out(N/A) :- format(' - ~q~n', [N/A]).

View File

@ -17,8 +17,23 @@
#ifdef SCCS #ifdef SCCS
static char SccsId[] = "%W% %G%"; static char SccsId[] = "%W% %G%";
#endif #endif
/**
* @file chartypes.c
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP.lan>
* @date Thu Nov 19 12:05:14 2015
*
* @brief Character Properties
*
*
*/
///{@
/// @addtogroup CharProps
/* /*
* This file includes the definition of a pipe related IO. * This file includes the definition of a character properties.
* *
*/ */
@ -98,7 +113,12 @@ static enc_map_t ematches[] = {
{"Windows-1252", ENC_ISO_LATIN1}, // almost, but not quite {"Windows-1252", ENC_ISO_LATIN1}, // almost, but not quite
{"CP-1252", ENC_ISO_LATIN1}, {"CP-1252", ENC_ISO_LATIN1},
{"C", ENC_ISO_ASCII}, {"C", ENC_ISO_ASCII},
{NULL, ENC_OCTET}}; #ifdef _WIN32
{NULL, ENC_UTF16_LE}
#else
{NULL, ENC_ISO_UTF8}
#endif
};
static encoding_t DefaultEncoding(void) { static encoding_t DefaultEncoding(void) {
encoding_t rc; encoding_t rc;
@ -134,7 +154,7 @@ static encoding_t DefaultEncoding(void) {
int j = 0; int j = 0;
while (rc != ematches[j].e) while (rc != ematches[j].e)
j++; j++;
Yap_Warning("YAP will use default encoding %s", ematches[j].s); // Yap_Warning("YAP will use default encoding %s", ematches[j].s);
} }
return rc; return rc;
} }
@ -822,7 +842,7 @@ static Int p_all_char_conversions(USES_REGS1) {
void Yap_InitChtypes(void) { void Yap_InitChtypes(void) {
CACHE_REGS CACHE_REGS
DefaultEncoding(); LOCAL_encoding = DefaultEncoding();
Yap_InitCPred("$change_type_of_char", 2, p_change_type_of_char, Yap_InitCPred("$change_type_of_char", 2, p_change_type_of_char,
SafePredFlag | SyncPredFlag | HiddenPredFlag); SafePredFlag | SyncPredFlag | HiddenPredFlag);
Yap_InitCPred("toupper", 2, toupper2, SafePredFlag); Yap_InitCPred("toupper", 2, toupper2, SafePredFlag);

View File

@ -66,12 +66,12 @@ console_post_process_read_char(int ch, StreamDesc *s)
++s->linecount; ++s->linecount;
++s->charcount; ++s->charcount;
s->linepos = 0; s->linepos = 0;
LOCAL_newline = TRUE; LOCAL_newline = true;
} else { } else {
CACHE_REGS CACHE_REGS
++s->charcount; ++s->charcount;
++s->linepos; ++s->linepos;
LOCAL_newline = FALSE; LOCAL_newline = false;
} }
return ch; return ch;
} }
@ -122,6 +122,7 @@ ConsolePutc (int sno, int ch)
if (ch == 10) if (ch == 10)
{ {
putc ('\n', s->file); putc ('\n', s->file);
LOCAL_newline = true;
} }
else else
#endif #endif

View File

@ -166,6 +166,7 @@ bool Yap_ReadlineOps(StreamDesc *s) {
is_same_tty(s->file, GLOBAL_Stream[0].file)) is_same_tty(s->file, GLOBAL_Stream[0].file))
s->stream_putc = ReadlinePutc; s->stream_putc = ReadlinePutc;
s->stream_getc = ReadlineGetc; s->stream_getc = ReadlineGetc;
s->status |= Readline_Stream_f;
return true; return true;
} }
return false; return false;
@ -231,11 +232,11 @@ static bool getLine(int inp, int out) {
/* window of vulnerability opened */ /* window of vulnerability opened */
LOCAL_PrologMode |= ConsoleGetcMode; LOCAL_PrologMode |= ConsoleGetcMode;
if (GLOBAL_Stream[out].linepos == 0) { // no output so far
fflush(NULL); fflush(NULL);
LOCAL_PrologMode |= ConsoleGetcMode;
if (LOCAL_newline) { // no output so far
myrl_line = readline(LOCAL_Prompt); myrl_line = readline(LOCAL_Prompt);
} else { } else {
LOCAL_PrologMode |= ConsoleGetcMode;
myrl_line = readline(NULL); myrl_line = readline(NULL);
} }
/* Do it the gnu way */ /* Do it the gnu way */
@ -277,9 +278,11 @@ static int ReadlinePutc(int sno, int ch) {
return ((int)ch); return ((int)ch);
} }
/* /**
reading from the console is complicated because we need to @brief reading from the console is complicated because we need to
know whether to prompt and so on... know whether to prompt and so on...
EOF must be handled by resetting the file.
*/ */
static int ReadlineGetc(int sno) { static int ReadlineGetc(int sno) {
StreamDesc *s = &GLOBAL_Stream[sno]; StreamDesc *s = &GLOBAL_Stream[sno];

View File

@ -351,6 +351,12 @@ Term Yap_syntax_error(TokEntry *errtok, int sno) {
tn[0] = Yap_MkApplTerm(FunctorShortSyntaxError, 1, &terr); tn[0] = Yap_MkApplTerm(FunctorShortSyntaxError, 1, &terr);
tn[1] = TermNil; tn[1] = TermNil;
terr = Yap_MkApplTerm(FunctorError, 2, tn); terr = Yap_MkApplTerm(FunctorError, 2, tn);
#if DEBUG
if (Yap_ExecutionMode == YAP_BOOT_MODE) {
fprintf(stderr, "SYNTAX ERROR while booting: ");
Yap_DebugPlWriteln( terr );
}
#endif
return terr; return terr;
} }
@ -365,6 +371,7 @@ typedef struct FEnv {
xarg *args; /// input args xarg *args; /// input args
bool reading_clause; /// read_clause bool reading_clause; /// read_clause
size_t nargs; /// arity of current procedure size_t nargs; /// arity of current procedure
encoding_t enc; /// encoding of the stream being read
} FEnv; } FEnv;
typedef struct renv { typedef struct renv {
@ -388,6 +395,7 @@ static xarg *setReadEnv(Term opts, FEnv *fe, struct renv *re, int inp_stream) {
LOCAL_VarTable = NULL; LOCAL_VarTable = NULL;
LOCAL_AnonVarTable = NULL; LOCAL_AnonVarTable = NULL;
re->cm = CurrentModule; re->cm = CurrentModule;
fe->enc = GLOBAL_Stream[inp_stream].encoding;
xarg *args = Yap_ArgListToVector(opts, read_defs, READ_END); xarg *args = Yap_ArgListToVector(opts, read_defs, READ_END);
if (args == NULL) { if (args == NULL) {
return NULL; return NULL;
@ -651,6 +659,7 @@ static parser_state_t scan(REnv *re, FEnv *fe, int inp_stream) {
/* preserve value of H after scanning: otherwise we may lose strings /* preserve value of H after scanning: otherwise we may lose strings
and floats */ and floats */
LOCAL_tokptr = LOCAL_toktide = LOCAL_tokptr = LOCAL_toktide =
Yap_tokenizer(GLOBAL_Stream + inp_stream, false, &fe->tpos); Yap_tokenizer(GLOBAL_Stream + inp_stream, false, &fe->tpos);
if (LOCAL_ErrorMessage) if (LOCAL_ErrorMessage)
return YAP_SCANNING_ERROR; return YAP_SCANNING_ERROR;
@ -737,8 +746,10 @@ static parser_state_t parseError(REnv *re, FEnv *fe, int inp_stream) {
static parser_state_t parse(REnv *re, FEnv *fe, int inp_stream) { static parser_state_t parse(REnv *re, FEnv *fe, int inp_stream) {
CACHE_REGS CACHE_REGS
TokEntry *tokstart = LOCAL_tokptr; TokEntry *tokstart = LOCAL_tokptr;
encoding_t e = LOCAL_encoding;
LOCAL_encoding = fe->enc;
fe->t = Yap_Parse(re->prio); fe->t = Yap_Parse(re->prio);
LOCAL_encoding = e;
fe->toklast = LOCAL_tokptr; fe->toklast = LOCAL_tokptr;
LOCAL_tokptr = tokstart; LOCAL_tokptr = tokstart;
TR = (tr_fr_ptr)tokstart; TR = (tr_fr_ptr)tokstart;

View File

@ -587,9 +587,10 @@ PrologExpandVars(const char *spec, char *tmp0, bool ok_to)
{ {
tmp=expandVars(spec,tmp,YAP_FILENAME_MAX); tmp=expandVars(spec,tmp,YAP_FILENAME_MAX);
} }
else else {
if (tmp != tmp0) { if (tmp != tmp0) {
free(tmp); free(tmp);
}
tmp = (char *)spec; tmp = (char *)spec;
} }
return tmp; return tmp;
@ -751,8 +752,9 @@ do_expand_file_name(Term t1, Term opts USES_REGS)
} }
tmpe = expandVars( spec, tmpe, YAP_FILENAME_MAX); tmpe = expandVars( spec, tmpe, YAP_FILENAME_MAX);
#ifdef GLOB_BRACE #ifdef GLOB_BRACE
flags = GLOB_BRACE; flags = GLOB_BRACE|GLOB_TILDE;
#endif #endif
flags |= GLOB_NOCHECK;
spec = tmpe; spec = tmpe;
} else if (t == TermTrue) { } else if (t == TermTrue) {
use_glob = false; use_glob = false;
@ -810,10 +812,17 @@ do_expand_file_name(Term t1, Term opts USES_REGS)
case 0: /* Successful. */ case 0: /* Successful. */
ss = gresult.gl_pathv; ss = gresult.gl_pathv;
pathcount = gresult.gl_pathc; pathcount = gresult.gl_pathc;
if (pathcount) {
break; break;
}
case GLOB_NOMATCH: case GLOB_NOMATCH:
globfree(&gresult); globfree(&gresult);
return Yap_unify_constant(TermNil, ARG2); {
Term t;
char *out = LOCAL_FileNameBuf;
t = MkAtomTerm( Yap_LookupAtom( expandVars(spec, out, YAP_FILENAME_MAX-1) ));
return MkPairTerm( t, TermNil );
}
case GLOB_ABORTED: case GLOB_ABORTED:
PlIOError(SYSTEM_ERROR_OPERATING_SYSTEM, ARG1, "glob aborted: %sn", strerror(errno)); PlIOError(SYSTEM_ERROR_OPERATING_SYSTEM, ARG1, "glob aborted: %sn", strerror(errno));
globfree (&gresult); globfree (&gresult);
@ -836,7 +845,15 @@ do_expand_file_name(Term t1, Term opts USES_REGS)
case 0: /* Successful. */ case 0: /* Successful. */
ss = wresult.we_wordv; ss = wresult.we_wordv;
pathcount = wresult.we_wordc; pathcount = wresult.we_wordc;
if (pathcount) {
break; break;
} else {
Term t;
char *out = LOCAL_FileNameBuf;
t = MkAtomTerm( Yap_LookupAtom( expandVars(spec, out, YAP_FILENAME_MAX-1) ) );
wordfree (&wresult);
return MkPairTerm( t, TermNil );
}
case WRDE_NOSPACE: case WRDE_NOSPACE:
/* If the error was WRDE_NOSPACE, /* If the error was WRDE_NOSPACE,
then perhaps part of the result was allocated. */ then perhaps part of the result was allocated. */
@ -844,7 +861,7 @@ do_expand_file_name(Term t1, Term opts USES_REGS)
wordfree (&wresult); wordfree (&wresult);
return TermNil; return TermNil;
default: /* Some other error. */ default: /* Some other error. */
PlIOError(SYSTEM_ERROR_OPERATING_SYSTEM, ARG1, "wordexp failed: %s", strerror(errno)); ; PlIOError(SYSTEM_ERROR_OPERATING_SYSTEM, ARG1, "wordexp failed: %s", strerror(errno));
wordfree (&wresult); wordfree (&wresult);
return TermNil; return TermNil;
} }
@ -856,8 +873,8 @@ do_expand_file_name(Term t1, Term opts USES_REGS)
#if HAVE_REALPATH #if HAVE_REALPATH
s = myrealpath(s, tmp); s = myrealpath(s, tmp);
#endif #endif
if (!exists(s)) //if (!exists(s))
continue; // continue;
Atom a = Yap_LookupAtom(s); Atom a = Yap_LookupAtom(s);
tf = MkPairTerm(MkAtomTerm( a ),tf); tf = MkPairTerm(MkAtomTerm( a ),tf);
} }

View File

@ -92,7 +92,7 @@ all_tuples(Constraints, Tuple, Tuples) :-
run([]). run([]).
run(Goal.Constraints) :- run([Goal|Constraints]) :-
user:Goal, user:Goal,
run(Constraints). run(Constraints).

View File

@ -291,7 +291,7 @@ propagate_evidence(InterpretationID,Query_Type) :-
% iterate over all evidence atoms % iterate over all evidence atoms
forall(user:known(InterpretationID,Atom,Value), forall(user:known(InterpretationID,Atom,Value),
( (
catch( rounder_compute_reachable_atoms(Atom,InterpretationID,Success), _, fail), catch( grounder_compute_reachable_atoms(Atom,InterpretationID,Success), _, fail),
( (
(Success==true; Value==false) (Success==true; Value==false)
-> ->
@ -385,7 +385,6 @@ propagate_evidence(InterpretationID,Query_Type) :-
print_script_per_cluster([],_,_,Seen_Atoms,Seen_Atoms,Cluster_IDs,Cluster_IDs). print_script_per_cluster([],_,_,Seen_Atoms,Seen_Atoms,Cluster_IDs,Cluster_IDs).
print_script_per_cluster([Refs|T],InterpretationID,Cluster_ID,Old_Seen_Atoms,Seen_Atoms,Old_Cluster_IDs,Cluster_IDs) :- print_script_per_cluster([Refs|T],InterpretationID,Cluster_ID,Old_Seen_Atoms,Seen_Atoms,Old_Cluster_IDs,Cluster_IDs) :-
create_bdd_file_name(InterpretationID,Cluster_ID,File_Name), create_bdd_file_name(InterpretationID,Cluster_ID,File_Name),
%trace,
once(print_simplecudd_script(Refs,File_Name,This_Seen_Atoms)), once(print_simplecudd_script(Refs,File_Name,This_Seen_Atoms)),
New_Seen_Atoms is Old_Seen_Atoms+This_Seen_Atoms, New_Seen_Atoms is Old_Seen_Atoms+This_Seen_Atoms,
Next_Cluster_ID is Cluster_ID+1, Next_Cluster_ID is Cluster_ID+1,

View File

@ -261,7 +261,6 @@
:- style_check(all). :- style_check(all).
:- yap_flag(unknown,error). :- yap_flag(unknown,error).
% this is a test to determine whether YAP provides the needed trie library % this is a test to determine whether YAP provides the needed trie library
:- initialization( :- initialization(
( predicate_property(trie_disable_hash, imported_from(tries)) -> ( predicate_property(trie_disable_hash, imported_from(tries)) ->

View File

@ -730,8 +730,8 @@ update_query(QueryID,Symbol,What_To_Update) :-
problog_flag(sigmoid_slope,Slope), problog_flag(sigmoid_slope,Slope),
problog_dir(PD), problog_dir(PD),
((What_To_Update=all;query_is_similar(_,QueryID)) -> Method='g' ; Method='l'), ((What_To_Update=all;query_is_similar(_,QueryID)) -> Method='g' ; Method='l'),
atomic_concat([PD, convert_filename_to_problog_path('problogbdd', ProblogBDD),
'/problogbdd', atomic_concat([ProblogBDD,
' -i "', Probabilities_File, '"', ' -i "', Probabilities_File, '"',
' -l "', Query_Directory,'/query_',QueryID, '"', ' -l "', Query_Directory,'/query_',QueryID, '"',
' -m ', Method, ' -m ', Method,

View File

@ -1,3 +1,4 @@
%%% -*- Mode: Prolog; -*- %%% -*- Mode: Prolog; -*-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -1180,3 +1181,11 @@ init_logger :-
:- initialization(init_flags). :- initialization(init_flags).
:- initialization(init_logger). :- initialization(init_logger).
%:- spy em_one_iteration.
%:- initialization(do_learning(100) ).

View File

@ -10,7 +10,7 @@
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
:- module('real', [ :- module(real, [
start_r/0, start_r/0,
end_r/0, end_r/0,
r/2, r/2,
@ -61,7 +61,7 @@
:- create_prolog_flag( real, none, [type(atom)] ). :- create_prolog_flag( real, none, [type(atom)] ).
:- set_prolog_flag(double_quotes, string ). %:- set_prolog_flag(double_quotes, string ).
/** <module> An interface to the R statistical software. /** <module> An interface to the R statistical software.
@ -749,12 +749,12 @@ rexpr_codes(V,[]) -->
rexpr_codes(T,[]) --> rexpr_codes(T,[]) -->
{ current_predicate(string/1), string(T), { current_predicate(string/1), string(T),
!, !,
format( codes(S), "~s", [T]) format( codes(S), '~s', [T])
}, },
"\"", S, "\"". "\"", S, "\"".
rexpr_codes(+A,[]) --> rexpr_codes(+A,[]) -->
!, !,
{ atom(A) -> format(codes(S), "~s", [A]) }, { atom(A) -> format(codes(S), '~s', [A]) },
"\"", S, "\"". "\"", S, "\"".
rexpr_codes(-A,[]) --> rexpr_codes(-A,[]) -->
!, !,

Some files were not shown because too many files have changed in this diff Show More