Merge branch 'master' of ssh://git.dcc.fc.up.pt/yap-6.3
31
.gitignore
vendored
@ -24,7 +24,6 @@ tmtags*
|
||||
.zedstate
|
||||
config.h
|
||||
Yap.h
|
||||
*Makefile
|
||||
YapConfig.h
|
||||
YapTermConfig.h
|
||||
.graffiti
|
||||
@ -48,7 +47,6 @@ groups
|
||||
.Rhistory
|
||||
.zedstate
|
||||
.graffiti
|
||||
*Makefile
|
||||
.kateproject
|
||||
autom4te.cache
|
||||
*rej
|
||||
@ -61,7 +59,6 @@ JIT/HPP/bkp
|
||||
cmake_install.cmake
|
||||
cmake_clean.cmake
|
||||
*.build
|
||||
Makefile
|
||||
C/myabsmi.c
|
||||
*.ctags#
|
||||
*.hs
|
||||
@ -78,6 +75,7 @@ yap
|
||||
*cmake_files
|
||||
C/pl-yap.c
|
||||
GitSHA1.c
|
||||
.vscode
|
||||
CMakeLists.txt.*
|
||||
FindPackageLog.txt
|
||||
GitSHA1.c
|
||||
@ -112,10 +110,29 @@ packages/real/rconfig.h
|
||||
|
||||
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/swi-minisat2/˜:ilp
|
||||
|
||||
packages/ProbLog/problog_examples/output/,_query_1_cluster_1
|
||||
packages/cplint/L
|
||||
|
||||
packages/CLPBN/horus/hcli
|
||||
|
||||
packages/bdd/simplecudd/problogbdd
|
||||
|
||||
packages/bdd/cudd_config.h
|
||||
Makefile
|
||||
build
|
||||
Debug
|
||||
debug
|
||||
Release
|
||||
Build
|
@ -2512,7 +2512,7 @@ break_debug(contador);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
Yap_plwrite ((Term) beam_X[1], NULL, 0, 1200);
|
||||
Yap_plwrite ((Term) beam_X[1], NULL, 0, GLOBAL_MaxPriority);
|
||||
#else
|
||||
extern int beam_write (void);
|
||||
beam_write();
|
||||
|
@ -742,10 +742,10 @@ void ShowCode_new2(int op, int new1,CELL new4)
|
||||
switch (ch = *f++)
|
||||
{
|
||||
case '1':
|
||||
Yap_plwrite(MkIntTerm(new1), NULL, 30, 0, 1200);
|
||||
Yap_plwrite(MkIntTerm(new1), NULL, 30, 0, GLOBAL_MaxPriority);
|
||||
break;
|
||||
case '4':
|
||||
Yap_plwrite(MkIntTerm(new4), NULL, 20, 0, 1200);
|
||||
Yap_plwrite(MkIntTerm(new4), NULL, 20, 0, GLOBAL_MaxPriority);
|
||||
break;
|
||||
default:
|
||||
Yap_DebugPutc (LOCAL_c_error_stream,'%');
|
||||
|
@ -1109,7 +1109,7 @@ interrupt_deallocate( USES_REGS1 )
|
||||
}
|
||||
return interrupt_handler( pe PASS_REGS );
|
||||
}
|
||||
if (!Yap_locked_gc(0, ENV, CP)) {
|
||||
if (!Yap_locked_gc(0, ENV, YESCODE)) {
|
||||
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
|
||||
}
|
||||
S = ASP;
|
||||
|
77
C/adtdefs.c
@ -28,12 +28,42 @@ static char SccsId[] = "%W% %G%";
|
||||
#include "Yap.h"
|
||||
#include "Yatom.h"
|
||||
#include "yapio.h"
|
||||
#include "clause.h"
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
#if HAVE_STRING_H
|
||||
#if HAVE_STRING_Hq
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
uint64_t HashFunction(const unsigned char *CHP) {
|
||||
/* djb2 */
|
||||
uint64_t hash = 5381;
|
||||
uint64_t c;
|
||||
|
||||
while ((c = (uint64_t)(*CHP++)) != '\0') {
|
||||
/* hash = ((hash << 5) + hash) + c; hash * 33 + c */
|
||||
hash = hash * (uint64_t)33 + c;
|
||||
}
|
||||
return hash;
|
||||
/*
|
||||
UInt OUT=0, i = 1;
|
||||
while(*CHP != '\0') { OUT += (UInt)(*CHP++); }
|
||||
return OUT;
|
||||
*/
|
||||
}
|
||||
|
||||
uint64_t WideHashFunction(wchar_t *CHP) {
|
||||
UInt hash = 5381;
|
||||
|
||||
UInt c;
|
||||
|
||||
while ((c = *CHP++) != '\0') {
|
||||
hash = hash * 33 ^ c;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
/* this routine must be run at least having a read lock on ae */
|
||||
static Prop
|
||||
GetFunctorProp(AtomEntry *ae,
|
||||
@ -142,14 +172,17 @@ static inline Atom SearchWideAtom(const wchar_t *p, Atom a) {
|
||||
|
||||
static Atom
|
||||
LookupAtom(const unsigned char *atom) { /* lookup atom in atom table */
|
||||
UInt hash;
|
||||
uint64_t hash;
|
||||
const unsigned char *p;
|
||||
Atom a, na;
|
||||
AtomEntry *ae;
|
||||
size_t sz = AtomHashTableSize;
|
||||
|
||||
/* compute hash */
|
||||
p = atom;
|
||||
hash = HashFunction(p) % AtomHashTableSize;
|
||||
|
||||
hash = HashFunction(p);
|
||||
hash = hash % sz ;
|
||||
|
||||
/* we'll start by holding a read lock in order to avoid contention */
|
||||
READ_LOCK(HashChain[hash].AERWLock);
|
||||
@ -754,29 +787,24 @@ static int ExpandPredHash(void) {
|
||||
|
||||
/* fe is supposed to be locked */
|
||||
Prop Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod) {
|
||||
CACHE_REGS
|
||||
PredEntry *p = (PredEntry *)Yap_AllocAtomSpace(sizeof(*p));
|
||||
|
||||
if (p == NULL) {
|
||||
WRITE_UNLOCK(fe->FRWLock);
|
||||
return NULL;
|
||||
}
|
||||
if (cur_mod == TermProlog)
|
||||
if (cur_mod == TermProlog || cur_mod == 0L) {
|
||||
p->ModuleOfPred = 0L;
|
||||
else
|
||||
} else
|
||||
p->ModuleOfPred = cur_mod;
|
||||
// TRUE_FUNC_WRITE_LOCK(fe);
|
||||
#if DEBUG_NEW_FUNCTOR
|
||||
if (!strcmp(fe->NameOfFE->StrOfAE, "library_directory"))
|
||||
jmp_deb(1);
|
||||
#endif
|
||||
INIT_LOCK(p->PELock);
|
||||
p->KindOfPE = PEProp;
|
||||
p->ArityOfPE = fe->ArityOfFE;
|
||||
p->cs.p_code.FirstClause = p->cs.p_code.LastClause = NULL;
|
||||
p->cs.p_code.NOfClauses = 0;
|
||||
p->PredFlags = 0L;
|
||||
p->src.OwnerFile = LOCAL_SourceFileName;
|
||||
p->src.OwnerFile = Yap_source_file_name();
|
||||
p->OpcodeOfPred = UNDEF_OPCODE;
|
||||
p->CodeOfPred = p->cs.p_code.TrueCodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
||||
p->cs.p_code.ExpandCode = EXPAND_OP_CODE;
|
||||
@ -795,12 +823,6 @@ Prop Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod) {
|
||||
p->beamTable = NULL;
|
||||
#endif /* BEAM */
|
||||
/* 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)) {
|
||||
p->PredFlags |= NoTracePredFlag;
|
||||
}
|
||||
@ -904,7 +926,7 @@ Prop Yap_NewThreadPred(PredEntry *ap USES_REGS) {
|
||||
Prop Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod) {
|
||||
Prop p0;
|
||||
PredEntry *p = (PredEntry *)Yap_AllocAtomSpace(sizeof(*p));
|
||||
|
||||
CACHE_REGS
|
||||
/* Printf("entering %s:%s/0\n", RepAtom(AtomOfTerm(cur_mod))->StrOfAE,
|
||||
* ae->StrOfAE); */
|
||||
|
||||
@ -918,7 +940,7 @@ Prop Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod) {
|
||||
p->cs.p_code.FirstClause = p->cs.p_code.LastClause = NULL;
|
||||
p->cs.p_code.NOfClauses = 0;
|
||||
p->PredFlags = 0L;
|
||||
p->src.OwnerFile = AtomNil;
|
||||
p->src.OwnerFile = Yap_source_file_name();
|
||||
p->OpcodeOfPred = UNDEF_OPCODE;
|
||||
p->cs.p_code.ExpandCode = EXPAND_OP_CODE;
|
||||
p->CodeOfPred = p->cs.p_code.TrueCodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
||||
@ -936,27 +958,14 @@ Prop Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod) {
|
||||
p->beamTable = NULL;
|
||||
#endif
|
||||
/* 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);
|
||||
p0 = AbsPredProp(p);
|
||||
p->FunctorOfPred = (Functor)AbsAtom(ae);
|
||||
if (!trueGlobalPrologFlag(DEBUG_INFO_FLAG)) {
|
||||
p->PredFlags |= (NoTracePredFlag | NoSpyPredFlag);
|
||||
}
|
||||
if (Yap_isSystemModule(CurrentModule))
|
||||
p->PredFlags |= StandardPredFlag;
|
||||
WRITE_UNLOCK(ae->ARWLock);
|
||||
{
|
||||
Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred) + 1, p,
|
||||
|
20
C/amasm.c
@ -3875,7 +3875,7 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
|
||||
cl->ClSize = osize;
|
||||
cip->code_addr = (yamop *)cl;
|
||||
} else if (mode == ASSEMBLING_CLAUSE &&
|
||||
(ap->PredFlags & SourcePredFlag ||
|
||||
(ap->PredFlags & (SourcePredFlag|MultiFileFlag) ||
|
||||
trueGlobalPrologFlag(SOURCE_FLAG ) ) &&
|
||||
!is_fact) {
|
||||
DBTerm *x;
|
||||
@ -3907,19 +3907,21 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
|
||||
}
|
||||
Yap_inform_profiler_of_clause(cip->code_addr, (char *)(cip->code_addr)+size, ap, ( mode == ASSEMBLING_INDEX ? GPROF_INDEX : GPROF_CLAUSE ));
|
||||
if (mode == ASSEMBLING_CLAUSE) {
|
||||
if (ap->PredFlags & LogUpdatePredFlag) {
|
||||
((LogUpdClause *)(cip->code_addr))->ClSize = size;
|
||||
Yap_LUClauseSpace += size;
|
||||
if (ap->PredFlags & LogUpdatePredFlag) {
|
||||
((LogUpdClause *)(cip->code_addr))->ClSize = size;
|
||||
Yap_LUClauseSpace += size;
|
||||
} else {
|
||||
((StaticClause *)(cip->code_addr))->ClSize = size;
|
||||
((StaticClause *)(cip->code_addr))->ClFlags = 0;
|
||||
Yap_ClauseSpace += size;
|
||||
StaticClause *cl = ((StaticClause *)(cip->code_addr));
|
||||
cl->usc.ClSource = NULL;
|
||||
cl->ClSize = size;
|
||||
cl->ClFlags = 0;
|
||||
Yap_ClauseSpace += size;
|
||||
}
|
||||
} else {
|
||||
if (ap->PredFlags & LogUpdatePredFlag) {
|
||||
Yap_LUIndexSpace_Tree += size;
|
||||
Yap_LUIndexSpace_Tree += size;
|
||||
} else
|
||||
Yap_IndexSpace_Tree += size;
|
||||
Yap_IndexSpace_Tree += size;
|
||||
}
|
||||
}
|
||||
do_pass(1, &entry_code, mode, &clause_has_blobs, &clause_has_dbterm, cip, size PASS_REGS);
|
||||
|
41
C/atomic.c
@ -65,9 +65,9 @@ static Int number_codes( USES_REGS1 );
|
||||
static Int current_atom( USES_REGS1 );
|
||||
static Int cont_current_atom( USES_REGS1 );
|
||||
static int AlreadyHidden(unsigned char *);
|
||||
static Int hide( USES_REGS1 );
|
||||
static Int hidden( USES_REGS1 );
|
||||
static Int unhide( USES_REGS1 );
|
||||
static Int hide_atom( USES_REGS1 );
|
||||
static Int hidden_atom( USES_REGS1 );
|
||||
static Int unhide_atom( USES_REGS1 );
|
||||
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ AlreadyHidden(unsigned char *name)
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/** @pred hide(+ _Atom_)
|
||||
/** @pred hide_atom(+ _Atom_)
|
||||
Make atom _Atom_ invisible.
|
||||
|
||||
Notice that defining a new atom with the same characters will
|
||||
@ -94,17 +94,17 @@ AlreadyHidden(unsigned char *name)
|
||||
|
||||
**/
|
||||
static Int
|
||||
hide( USES_REGS1 )
|
||||
hide_atom( USES_REGS1 )
|
||||
{ /* hide(+Atom) */
|
||||
Atom atomToInclude;
|
||||
Term t1 = Deref(ARG1);
|
||||
|
||||
if (IsVarTerm(t1)) {
|
||||
Yap_Error(INSTANTIATION_ERROR,t1,"hide/1");
|
||||
Yap_Error(INSTANTIATION_ERROR,t1,"hide_atom/1");
|
||||
return(FALSE);
|
||||
}
|
||||
if (!IsAtomTerm(t1)) {
|
||||
Yap_Error(TYPE_ERROR_ATOM,t1,"hide/1");
|
||||
Yap_Error(TYPE_ERROR_ATOM,t1,"hide_atom/1");
|
||||
return(FALSE);
|
||||
}
|
||||
atomToInclude = AtomOfTerm(t1);
|
||||
@ -123,13 +123,13 @@ hide( USES_REGS1 )
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/** @pred hidden( +Atom )
|
||||
/** @pred hidden_atom( +Atom )
|
||||
Is the atom _Ãtom_ visible to Prolog?
|
||||
|
||||
**/
|
||||
static Int
|
||||
hidden( USES_REGS1 )
|
||||
{ /* '$hidden'(+F) */
|
||||
hidden_atom( USES_REGS1 )
|
||||
{ /* '$hidden_atom'(+F) */
|
||||
Atom at;
|
||||
AtomEntry *chain;
|
||||
Term t1 = Deref(ARG1);
|
||||
@ -153,30 +153,30 @@ hidden( USES_REGS1 )
|
||||
}
|
||||
|
||||
|
||||
/** @pred unhide(+ _Atom_)
|
||||
/** @pred unhide_atom(+ _Atom_)
|
||||
Make hidden atom _Atom_ visible
|
||||
|
||||
Note that the operation fails if another atom with name _Atom_ was defined since.
|
||||
|
||||
**/
|
||||
static Int
|
||||
unhide( USES_REGS1 )
|
||||
{ /* unhide(+Atom) */
|
||||
unhide_atom( USES_REGS1 )
|
||||
{ /* unhide_atom(+Atom) */
|
||||
AtomEntry *atom, *old, *chain;
|
||||
Term t1 = Deref(ARG1);
|
||||
|
||||
if (IsVarTerm(t1)) {
|
||||
Yap_Error(INSTANTIATION_ERROR,t1,"unhide/1");
|
||||
Yap_Error(INSTANTIATION_ERROR,t1,"unhide_atom/1");
|
||||
return(FALSE);
|
||||
}
|
||||
if (!IsAtomTerm(t1)) {
|
||||
Yap_Error(TYPE_ERROR_ATOM,t1,"unhide/1");
|
||||
Yap_Error(TYPE_ERROR_ATOM,t1,"unhide_atom/1");
|
||||
return(FALSE);
|
||||
}
|
||||
atom = RepAtom(AtomOfTerm(t1));
|
||||
WRITE_LOCK(atom->ARWLock);
|
||||
if (atom->PropsOfAE != NIL) {
|
||||
Yap_Error(SYSTEM_ERROR_INTERNAL,t1,"cannot unhide an atom in use");
|
||||
Yap_Error(SYSTEM_ERROR_INTERNAL,t1,"cannot unhide_atom an atom in use");
|
||||
return(FALSE);
|
||||
}
|
||||
WRITE_LOCK(INVISIBLECHAIN.AERWLock);
|
||||
@ -1153,7 +1153,8 @@ atomic_concat2( USES_REGS1 )
|
||||
seq_tv_t *inpv = (seq_tv_t *)malloc(n*sizeof(seq_tv_t)), out;
|
||||
int i = 0;
|
||||
Atom at;
|
||||
|
||||
|
||||
if (n == 1) return Yap_unify(ARG2, HeadOfTerm(t1));
|
||||
if (!inpv) {
|
||||
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP;
|
||||
free(inpv);
|
||||
@ -2405,9 +2406,9 @@ atoms or numbers.
|
||||
Yap_InitCPred("atomics_to_string", 3, atomics_to_string3, 0);
|
||||
Yap_InitCPred("get_string_code", 3, get_string_code3, 0);
|
||||
/* hiding and unhiding some predicates */
|
||||
Yap_InitCPred("hide", 1, hide, SafePredFlag|SyncPredFlag);
|
||||
Yap_InitCPred("unhide", 1, unhide, SafePredFlag|SyncPredFlag);
|
||||
Yap_InitCPred("$hidden", 1, hidden, HiddenPredFlag|SafePredFlag|SyncPredFlag);
|
||||
Yap_InitCPred("hide_atom", 1, hide_atom, SafePredFlag|SyncPredFlag);
|
||||
Yap_InitCPred("unhide_atom", 1, unhide_atom, SafePredFlag|SyncPredFlag);
|
||||
Yap_InitCPred("$hidden_atom", 1, hidden_atom, HiddenPredFlag|SafePredFlag|SyncPredFlag);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -806,7 +806,7 @@ X_API Term YAP_MkPairTerm(Term t1, Term t2) {
|
||||
BACKUP_H();
|
||||
t1 = Yap_GetFromSlot(sl1);
|
||||
t2 = Yap_GetFromSlot(sl2);
|
||||
Yap_RecoverSlots(2, sl2 PASS_REGS);
|
||||
Yap_RecoverSlots(2, sl2);
|
||||
}
|
||||
t = MkPairTerm(t1, t2);
|
||||
RECOVER_H();
|
||||
@ -828,7 +828,7 @@ X_API Term YAP_MkListFromTerms(Term *ta, Int sz) {
|
||||
}
|
||||
BACKUP_H();
|
||||
ta = (CELL *)Yap_GetFromSlot(sl1);
|
||||
Yap_RecoverSlots(1, sl1 PASS_REGS);
|
||||
Yap_RecoverSlots(1, sl1);
|
||||
}
|
||||
h = HR;
|
||||
t = AbsPair(h);
|
||||
@ -1063,7 +1063,7 @@ X_API Int YAP_TermHash(Term t, Int sz, Int depth, int variant) {
|
||||
|
||||
X_API Int YAP_CurrentSlot(void) {
|
||||
CACHE_REGS
|
||||
return Yap_CurrentSlot(PASS_REGS1);
|
||||
return Yap_CurrentSlot();
|
||||
}
|
||||
|
||||
X_API Int YAP_NewSlots(int n) {
|
||||
@ -1078,7 +1078,7 @@ X_API Int YAP_InitSlot(Term t) {
|
||||
|
||||
X_API int YAP_RecoverSlots(int n, Int top_slot) {
|
||||
CACHE_REGS
|
||||
return Yap_RecoverSlots(n, top_slot PASS_REGS);
|
||||
return Yap_RecoverSlots(n, top_slot);
|
||||
}
|
||||
|
||||
X_API Term YAP_GetFromSlot(Int slot) {
|
||||
@ -1109,7 +1109,7 @@ restart:
|
||||
|
||||
X_API void YAP_PutInSlot(Int slot, Term t) {
|
||||
CACHE_REGS
|
||||
Yap_PutInSlot(slot, t PASS_REGS);
|
||||
Yap_PutInSlot(slot, t);
|
||||
}
|
||||
|
||||
typedef Int (*CPredicate0)(void);
|
||||
@ -1723,7 +1723,7 @@ X_API Term YAP_ReadBuffer(const char *s, Term *tp) {
|
||||
BACKUP_H();
|
||||
|
||||
LOCAL_ErrorMessage = NULL;
|
||||
while (!(t = Yap_StringToTerm(s, strlen(s) + 1, &LOCAL_encoding, 1200, tp))) {
|
||||
while (!(t = Yap_StringToTerm(s, strlen(s) + 1, &LOCAL_encoding, GLOBAL_MaxPriority, tp))) {
|
||||
if (LOCAL_ErrorMessage) {
|
||||
if (!strcmp(LOCAL_ErrorMessage, "Stack Overflow")) {
|
||||
if (!Yap_dogc(0, NULL PASS_REGS)) {
|
||||
@ -2394,6 +2394,7 @@ X_API void YAP_ClearExceptions(void) {
|
||||
}
|
||||
|
||||
X_API int YAP_InitConsult(int mode, const char *filename, int *osnop) {
|
||||
CACHE_REGS
|
||||
FILE *f;
|
||||
int sno;
|
||||
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);
|
||||
Yap_init_consult(consulted, filename);
|
||||
f = fopen(filename, "r");
|
||||
f = fopen(Yap_AbsoluteFile(filename, LOCAL_FileNameBuf, FILENAME_MAX-1), "r");
|
||||
if (!f)
|
||||
return -1;
|
||||
sno = Yap_OpenStream(f, NULL, TermNil, Input_Stream_f);
|
||||
@ -2467,7 +2468,7 @@ X_API void YAP_Write(Term t, FILE *f, int flags) {
|
||||
BACKUP_MACHINE_REGS();
|
||||
int sno = Yap_OpenStream(f, NULL, TermNil, Output_Stream_f);
|
||||
|
||||
Yap_plwrite(t, GLOBAL_Stream + sno, 0, flags, 1200);
|
||||
Yap_plwrite(t, GLOBAL_Stream + sno, 0, flags, GLOBAL_MaxPriority);
|
||||
Yap_ReleaseStream(sno);
|
||||
|
||||
RECOVER_MACHINE_REGS();
|
||||
@ -2717,7 +2718,7 @@ X_API Int YAP_Init(YAP_init_args *yap_init) {
|
||||
setBooleanGlobalPrologFlag(HALT_AFTER_CONSULT_FLAG,
|
||||
yap_init->HaltAfterConsult);
|
||||
}
|
||||
/* tell the system who should cope with interrupts */
|
||||
/* tell the scystem who should cope with interrupts */
|
||||
Yap_ExecutionMode = yap_init->ExecutionMode;
|
||||
if (do_bootstrap) {
|
||||
restore_result = YAP_BOOT_FROM_PROLOG;
|
||||
@ -3326,7 +3327,6 @@ X_API int YAP_FileNoFromStream(Term t) {
|
||||
if (IsVarTerm(t))
|
||||
return -1;
|
||||
return Yap_StreamToFileNo(t);
|
||||
return -1;
|
||||
}
|
||||
|
||||
X_API void *YAP_FileDescriptorFromStream(Term t) {
|
||||
@ -3335,7 +3335,6 @@ X_API void *YAP_FileDescriptorFromStream(Term t) {
|
||||
if (IsVarTerm(t))
|
||||
return NULL;
|
||||
return Yap_FileDescriptorFromStream(t);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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.
|
||||
*/
|
||||
size_t YAP_UTF8_TextLength(Term t) {
|
||||
Term *aux;
|
||||
utf8proc_uint8_t dst[8];
|
||||
size_t sz = 0;
|
||||
|
||||
@ -3652,7 +3650,7 @@ Term YAP_UnNumberVars(Term t) {
|
||||
}
|
||||
|
||||
int YAP_IsNumberedVariable(Term t) {
|
||||
return IsApplTerm(t) && FunctorOfTerm(t) == FunctorVar &&
|
||||
return IsApplTerm(t) && FunctorOfTerm(t) == FunctorDollarVar &&
|
||||
IsIntegerTerm(ArgOfTerm(1, t));
|
||||
}
|
||||
|
||||
|
17
C/cmppreds.c
@ -556,13 +556,28 @@ p_compare( USES_REGS1 )
|
||||
{ /* compare(?Op,?T1,?T2) */
|
||||
Int r = compare(Deref(ARG2), Deref(ARG3));
|
||||
Atom p;
|
||||
|
||||
Term t = Deref(ARG1);
|
||||
if (r < 0)
|
||||
p = AtomLT;
|
||||
else if (r > 0)
|
||||
p = AtomGT;
|
||||
else
|
||||
p = AtomEQ;
|
||||
if (!IsVarTerm(t)) {
|
||||
if (IsAtomTerm(t)) {
|
||||
Atom a = AtomOfTerm(t);
|
||||
if (a == p)
|
||||
return true;
|
||||
if (a != AtomLT &&
|
||||
a != AtomGT &&
|
||||
a != AtomEq)
|
||||
Yap_Error(DOMAIN_ERROR_ORDER, ARG1, NULL);
|
||||
} else {
|
||||
Yap_Error(TYPE_ERROR_ATOM, ARG1, NULL);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return Yap_unify_constant(ARG1, MkAtomTerm(p));
|
||||
}
|
||||
|
||||
|
@ -426,6 +426,10 @@
|
||||
Op(deallocate, p);
|
||||
CACHE_Y_AS_ENV(YREG);
|
||||
check_trail(TR);
|
||||
#ifndef NO_CHECKING
|
||||
/* check stacks */
|
||||
check_stack(NoStackDeallocate, HR);
|
||||
#endif
|
||||
PREG = NEXTOP(PREG, p);
|
||||
/* other instructions do depend on S being set by deallocate
|
||||
:-( */
|
||||
@ -452,24 +456,23 @@
|
||||
ENV_YREG = (CELL *) ((CELL) ENV_YREG + ENV_Size(CPREG));
|
||||
#endif /* FROZEN_STACKS */
|
||||
WRITEBACK_Y_AS_ENV();
|
||||
#ifndef NO_CHECKING
|
||||
/* check stacks */
|
||||
check_stack(NoStackDeallocate, HR);
|
||||
#endif
|
||||
ENDCACHE_Y_AS_ENV();
|
||||
GONext();
|
||||
|
||||
NoStackDeallocate:
|
||||
BEGD(d0);
|
||||
#ifdef SHADOW_S
|
||||
Yap_REGS.S_ = SREG;
|
||||
Yap_REGS.S_ = YREG;
|
||||
#endif
|
||||
PREG = NEXTOP(PREG,p);
|
||||
saveregs();
|
||||
d0 = interrupt_deallocate( PASS_REGS1 );
|
||||
setregs();
|
||||
PREG = PREVOP(PREG,p);
|
||||
#ifdef SHADOW_S
|
||||
SREG = Yap_REGS.S_;
|
||||
#endif
|
||||
// return to original deallocate
|
||||
if (!d0) FAIL();
|
||||
JMPNext();
|
||||
ENDD(d0);
|
||||
|
29
C/dbase.c
@ -5106,7 +5106,8 @@ static Int p_dequeue(USES_REGS1) {
|
||||
db_queue *father_key;
|
||||
QueueEntry *cur_instance;
|
||||
Term Father = Deref(ARG1);
|
||||
|
||||
Int rc;
|
||||
|
||||
if (IsVarTerm(Father)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, Father, "dequeue");
|
||||
return FALSE;
|
||||
@ -5120,16 +5121,11 @@ static Int p_dequeue(USES_REGS1) {
|
||||
/* an empty queue automatically goes away */
|
||||
WRITE_UNLOCK(father_key->QRWLock);
|
||||
FreeDBSpace((char *)father_key);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
if (!Yap_dequeue_tqueue(father_key, ARG2, true, true PASS_REGS))
|
||||
return FALSE;
|
||||
if (cur_instance == father_key->LastInQueue)
|
||||
father_key->FirstInQueue = father_key->LastInQueue = NULL;
|
||||
else
|
||||
father_key->FirstInQueue = cur_instance->next;
|
||||
rc = Yap_dequeue_tqueue(father_key, ARG2, true, true PASS_REGS);
|
||||
WRITE_UNLOCK(father_key->QRWLock);
|
||||
return TRUE;
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5151,13 +5147,7 @@ static Int p_dequeue_unlocked(USES_REGS1) {
|
||||
FreeDBSpace((char *)father_key);
|
||||
return FALSE;
|
||||
}
|
||||
if (!Yap_dequeue_tqueue(father_key, ARG2, true, true PASS_REGS))
|
||||
return FALSE;
|
||||
if (cur_instance == father_key->LastInQueue)
|
||||
father_key->FirstInQueue = father_key->LastInQueue = NULL;
|
||||
else
|
||||
father_key->FirstInQueue = cur_instance->next;
|
||||
return TRUE;
|
||||
return Yap_dequeue_tqueue(father_key, ARG2, true, true PASS_REGS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5206,9 +5196,6 @@ static Int p_slu(USES_REGS1) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* check current status for logical updates */
|
||||
static Int p_lu(USES_REGS1) { return Yap_unify(ARG1, MkIntTerm(UPDATE_MODE)); }
|
||||
|
||||
/* get a hold over the index table for logical update predicates */
|
||||
static Int p_hold_index(USES_REGS1) {
|
||||
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "hold_index in debugger");
|
||||
@ -5320,7 +5307,7 @@ static Int p_install_thread_local(USES_REGS1) { /* '$is_dynamic'(+P) */
|
||||
}
|
||||
|
||||
void Yap_InitDBPreds(void) {
|
||||
Yap_InitCPred("recorded", 3, p_recorded, SyncPredFlag);
|
||||
Yap_InitCPred("$set_pred_flags", 2, p_rcdz, SyncPredFlag);
|
||||
/** @pred recorded(+ _K_, _T_, _R_)
|
||||
|
||||
|
||||
@ -5336,6 +5323,7 @@ void Yap_InitDBPreds(void) {
|
||||
|
||||
|
||||
*/
|
||||
Yap_InitCPred("recorded", 3, p_recorded, SyncPredFlag);
|
||||
Yap_InitCPred("recorda", 3, p_rcda, SyncPredFlag);
|
||||
/** @pred recorda(+ _K_, _T_,- _R_)
|
||||
|
||||
@ -5382,7 +5370,6 @@ void Yap_InitDBPreds(void) {
|
||||
Yap_InitCPred("$db_peek_queue", 2, p_peek_queue, SyncPredFlag);
|
||||
Yap_InitCPred("$db_clean_queues", 1, p_clean_queues, SyncPredFlag);
|
||||
Yap_InitCPred("$switch_log_upd", 1, p_slu, SafePredFlag | SyncPredFlag);
|
||||
Yap_InitCPred("$log_upd", 1, p_lu, SafePredFlag | SyncPredFlag);
|
||||
Yap_InitCPred("$hold_index", 3, p_hold_index, SafePredFlag | SyncPredFlag);
|
||||
Yap_InitCPred("$fetch_reference_from_index", 3, p_fetch_reference_from_index,
|
||||
SafePredFlag | SyncPredFlag);
|
||||
|
118
C/errors.c
@ -104,15 +104,6 @@ bool Yap_Warning(const char *s, ...) {
|
||||
LOCAL_within_print_message = true;
|
||||
pred = RepPredProp(PredPropByFunc(FunctorPrintMessage,
|
||||
PROLOG_MODULE)); // PROCEDURE_print_message2
|
||||
if (pred->OpcodeOfPred == UNDEF_OPCODE) {
|
||||
// fprintf(stderr, "warning message:\n");
|
||||
// Yap_DebugPlWrite(twarning);
|
||||
// fprintf(stderr, "\n");
|
||||
LOCAL_DoingUndefp = false;
|
||||
LOCAL_within_print_message = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
va_start(ap, s);
|
||||
format = va_arg(ap, char *);
|
||||
if (format != NULL) {
|
||||
@ -124,6 +115,13 @@ bool Yap_Warning(const char *s, ...) {
|
||||
} else
|
||||
return false;
|
||||
va_end(ap);
|
||||
if (pred->OpcodeOfPred == UNDEF_OPCODE) {
|
||||
fprintf(stderr, "warning message: %s\n", tmpbuf);
|
||||
LOCAL_DoingUndefp = false;
|
||||
LOCAL_within_print_message = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
ts[1] = MkAtomTerm(AtomWarning);
|
||||
ts[0] = MkAtomTerm(Yap_LookupAtom(tmpbuf));
|
||||
rc = Yap_execute_pred(pred, ts, true PASS_REGS);
|
||||
@ -146,9 +144,9 @@ bool Yap_PrintWarning(Term twarning) {
|
||||
LOCAL_DoingUndefp = true;
|
||||
LOCAL_within_print_message = true;
|
||||
if (pred->OpcodeOfPred == UNDEF_OPCODE) {
|
||||
// fprintf(stderr, "warning message:\n");
|
||||
// Yap_DebugPlWrite(twarning);
|
||||
// fprintf(stderr, "\n");
|
||||
fprintf(stderr, "warning message:\n");
|
||||
Yap_DebugPlWrite(twarning);
|
||||
fprintf(stderr, "\n");
|
||||
LOCAL_DoingUndefp = false;
|
||||
LOCAL_within_print_message = false;
|
||||
return true;
|
||||
@ -489,7 +487,7 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
||||
}
|
||||
case ABORT_EVENT:
|
||||
nt[0] = MkAtomTerm(AtomDAbort);
|
||||
fun = FunctorVar;
|
||||
fun = FunctorDollarVar;
|
||||
serious = TRUE;
|
||||
break;
|
||||
case CALL_COUNTER_UNDERFLOW_EVENT:
|
||||
@ -604,3 +602,97 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
||||
LOCAL_PrologMode &= ~InErrorMode;
|
||||
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;
|
||||
}
|
||||
|
||||
static Int
|
||||
is_predicate_indicator( USES_REGS1 )
|
||||
{
|
||||
Term G = Deref(ARG1);
|
||||
//Term Context = Deref(ARG2);
|
||||
Term mod = CurrentModule;
|
||||
|
||||
G = Yap_YapStripModule(G, &mod);
|
||||
if (IsVarTerm(G)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, G, NULL);
|
||||
return false;
|
||||
}
|
||||
if (!IsVarTerm(mod) && !IsAtomTerm(mod)) {
|
||||
Yap_Error(TYPE_ERROR_ATOM, G, NULL);
|
||||
return false;
|
||||
}
|
||||
if (IsApplTerm(G)) {
|
||||
Functor f = FunctorOfTerm(G);
|
||||
if (IsExtensionFunctor(f)) {
|
||||
Yap_Error(TYPE_ERROR_PREDICATE_INDICATOR, G, NULL);
|
||||
}
|
||||
if (f == FunctorSlash || f == FunctorDoubleSlash) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Yap_Error(TYPE_ERROR_PREDICATE_INDICATOR, G, NULL);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Yap_InitErrorPreds( void )
|
||||
{
|
||||
CACHE_REGS
|
||||
Term cm = CurrentModule;
|
||||
CurrentModule = ERROR_MODULE;
|
||||
Yap_InitCPred("is_boolean", 2, is_boolean, TestPredFlag);
|
||||
Yap_InitCPred("is_callable", 2, is_callable, TestPredFlag);
|
||||
Yap_InitCPred("is_predicate_indicator", 2, is_predicate_indicator, TestPredFlag);
|
||||
CurrentModule = cm;
|
||||
}
|
||||
|
132
C/exec.c
@ -54,7 +54,7 @@ static inline Int CallPredicate(PredEntry *pen, choiceptr cut_pt,
|
||||
if (pen->ModuleOfPred) {
|
||||
if (DEPTH == MkIntTerm(0)) {
|
||||
UNLOCK(pen->PELock);
|
||||
return FALSE;
|
||||
return false;
|
||||
} else
|
||||
DEPTH = RESET_DEPTH();
|
||||
}
|
||||
@ -75,7 +75,7 @@ static inline Int CallPredicate(PredEntry *pen, choiceptr cut_pt,
|
||||
/* make sure we have access to the user given cut */
|
||||
YENV[E_CB] = (CELL)cut_pt;
|
||||
P = code;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline static Int CallMetaCall(Term t, Term mod USES_REGS) {
|
||||
@ -192,14 +192,8 @@ inline static Int do_execute(Term t, Term mod USES_REGS) {
|
||||
Term t0 = t;
|
||||
/* first do predicate expansion, even before you process signals.
|
||||
This way you don't get to spy goal_expansion(). */
|
||||
if (PRED_GOAL_EXPANSION_ALL) {
|
||||
/* 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))) {
|
||||
if (Yap_has_a_signal() && !LOCAL_InterruptsDisabled &&
|
||||
!(LOCAL_PrologMode & (AbortMode | InterruptMode | SystemMode))) {
|
||||
return EnterCreepMode(t, mod PASS_REGS);
|
||||
}
|
||||
restart_exec:
|
||||
@ -222,7 +216,7 @@ restart_exec:
|
||||
pen = RepPredProp(PredPropByFunc(f, mod));
|
||||
/* You thought we would be over by now */
|
||||
/* but no meta calls require special preprocessing */
|
||||
if (pen->PredFlags & (GoalExPredFlag | MetaPredFlag)) {
|
||||
if (pen->PredFlags & MetaPredFlag) {
|
||||
if (f == FunctorModule) {
|
||||
Term tmod = ArgOfTerm(1, t);
|
||||
if (!IsVarTerm(tmod) && IsAtomTerm(tmod)) {
|
||||
@ -359,14 +353,7 @@ restart_exec:
|
||||
if (IsExtensionFunctor(f)) {
|
||||
return CallError(TYPE_ERROR_CALLABLE, t, mod PASS_REGS);
|
||||
}
|
||||
if (PRED_GOAL_EXPANSION_ALL) {
|
||||
/* 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) {
|
||||
if (Yap_has_a_signal() && !LOCAL_InterruptsDisabled) {
|
||||
return EnterCreepMode(
|
||||
copy_execn_to_heap(f, pt, n, arity, CurrentModule PASS_REGS),
|
||||
mod PASS_REGS);
|
||||
@ -377,7 +364,7 @@ restart_exec:
|
||||
pen = RepPredProp(PredPropByFunc(f, mod));
|
||||
/* You thought we would be over by now */
|
||||
/* 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);
|
||||
return (CallMetaCall(t, mod PASS_REGS));
|
||||
}
|
||||
@ -565,6 +552,7 @@ static Int execute11(USES_REGS1) { /* '$execute'(Goal) */
|
||||
|
||||
static Int execute12(USES_REGS1) { /* '$execute'(Goal) */
|
||||
Term t = Deref(ARG1);
|
||||
|
||||
heap_store(Deref(ARG2) PASS_REGS);
|
||||
heap_store(Deref(ARG3) PASS_REGS);
|
||||
heap_store(Deref(ARG4) PASS_REGS);
|
||||
@ -647,97 +635,105 @@ restart_exec:
|
||||
}
|
||||
|
||||
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) {
|
||||
Int creeping = Yap_get_signal(YAP_CREEP_SIGNAL);
|
||||
Int out = FALSE;
|
||||
PredEntry *pe;
|
||||
Term cmod = Deref(ARG2);
|
||||
static bool complete_ge(bool out, Term omod, yhandle_t sl, bool creeping) {
|
||||
CACHE_REGS
|
||||
if (creeping) {
|
||||
Yap_signal(YAP_CREEP_SIGNAL);
|
||||
}
|
||||
CurrentModule = omod;
|
||||
Yap_CloseSlots(sl);
|
||||
if (out) {
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
ARG2 = ARG3;
|
||||
|
||||
static Int _user_expand_goal(USES_REGS1) {
|
||||
yhandle_t sl = Yap_StartSlots();
|
||||
Int creeping = Yap_get_signal(YAP_CREEP_SIGNAL);
|
||||
PredEntry *pe;
|
||||
Term cmod = CurrentModule, omod = cmod;
|
||||
Term mg_args[2];
|
||||
Term g = Yap_YapStripModule(ARG1, &cmod);
|
||||
yhandle_t h1 = Yap_InitSlot(g), h2 = Yap_InitSlot(ARG2);
|
||||
|
||||
/* CurMod:goal_expansion(A,B) */
|
||||
ARG1 = g;
|
||||
if ((pe = RepPredProp(Yap_GetPredPropByFunc(FunctorGoalExpansion2, cmod))) &&
|
||||
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
|
||||
Yap_execute_pred(pe, NULL, false PASS_REGS)) {
|
||||
out = TRUE;
|
||||
ARG3 = ARG2;
|
||||
goto complete;
|
||||
return complete_ge(true, omod, sl, creeping);
|
||||
}
|
||||
/* 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(
|
||||
Yap_GetPredPropByFunc(FunctorGoalExpansion2, SYSTEM_MODULE))) &&
|
||||
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
|
||||
Yap_execute_pred(pe, NULL, false PASS_REGS)) {
|
||||
out = TRUE;
|
||||
ARG3 = ARG2;
|
||||
goto complete;
|
||||
return complete_ge(true, omod, sl, creeping);
|
||||
}
|
||||
ARG3 = ARG2;
|
||||
ARG1 = Yap_GetFromSlot(h1);
|
||||
ARG2 = cmod;
|
||||
ARG3 = Yap_GetFromSlot(h2);
|
||||
/* user:goal_expansion(A,CurMod,B) */
|
||||
if ((pe = RepPredProp(
|
||||
Yap_GetPredPropByFunc(FunctorGoalExpansion, USER_MODULE))) &&
|
||||
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
|
||||
Yap_execute_pred(pe, NULL PASS_REGS, false)) {
|
||||
out = TRUE;
|
||||
goto complete;
|
||||
return complete_ge(true, omod, sl, creeping);
|
||||
}
|
||||
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) */
|
||||
if (cmod != USER_MODULE && /* we have tried this before */
|
||||
(pe = RepPredProp(
|
||||
Yap_GetPredPropByFunc(FunctorGoalExpansion2, USER_MODULE))) &&
|
||||
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
|
||||
Yap_execute_pred(pe, NULL PASS_REGS, false)) {
|
||||
ARG3 = ARG2;
|
||||
out = TRUE;
|
||||
return complete_ge(true, omod, sl, creeping);
|
||||
}
|
||||
complete:
|
||||
if (creeping) {
|
||||
Yap_signal(YAP_CREEP_SIGNAL);
|
||||
}
|
||||
return out;
|
||||
return complete_ge(false, omod, sl, creeping);
|
||||
}
|
||||
|
||||
static Int do_term_expansion(USES_REGS1) {
|
||||
yhandle_t sl = Yap_StartSlots();
|
||||
Int creeping = Yap_get_signal(YAP_CREEP_SIGNAL);
|
||||
Int out = FALSE;
|
||||
PredEntry *pe;
|
||||
Term cmod = CurrentModule;
|
||||
Term cmod = CurrentModule, omod = cmod;
|
||||
Term mg_args[2];
|
||||
Term g = Yap_YapStripModule(ARG1, &cmod);
|
||||
yhandle_t h1 = Yap_InitSlot(g), h2 = Yap_InitSlot(ARG2);
|
||||
|
||||
/* CurMod:term_expansion(A,B) */
|
||||
ARG1 = g;
|
||||
if ((pe = RepPredProp(Yap_GetPredPropByFunc(FunctorTermExpansion, cmod))) &&
|
||||
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
|
||||
Yap_execute_pred(pe, NULL, false PASS_REGS)) {
|
||||
out = TRUE;
|
||||
goto complete;
|
||||
return complete_ge(true, omod, sl, creeping);
|
||||
}
|
||||
/* system:term_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(
|
||||
Yap_GetPredPropByFunc(FunctorTermExpansion, SYSTEM_MODULE))) &&
|
||||
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
|
||||
Yap_execute_pred(pe, NULL, false PASS_REGS)) {
|
||||
out = TRUE;
|
||||
goto complete;
|
||||
return complete_ge(true, omod, sl, creeping);
|
||||
}
|
||||
/* user:term_expansion(A,B) */
|
||||
if (cmod != USER_MODULE && /* we have tried this before */
|
||||
(pe = RepPredProp(
|
||||
Yap_GetPredPropByFunc(FunctorTermExpansion, USER_MODULE))) &&
|
||||
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
|
||||
Yap_execute_pred(pe, NULL, false PASS_REGS)) {
|
||||
out = TRUE;
|
||||
}
|
||||
complete:
|
||||
if (creeping) {
|
||||
Yap_signal(YAP_CREEP_SIGNAL);
|
||||
}
|
||||
return out;
|
||||
return complete_ge(false, omod, sl, creeping);
|
||||
}
|
||||
|
||||
|
||||
static Int execute0(USES_REGS1) { /* '$execute0'(Goal,Mod) */
|
||||
Term t = Deref(ARG1), t0 = t;
|
||||
Term mod = Deref(ARG2);
|
||||
@ -1006,12 +1002,6 @@ static Int execute_depth_limit(USES_REGS1) {
|
||||
}
|
||||
#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) {
|
||||
int lval, out;
|
||||
|
||||
@ -1892,8 +1882,6 @@ void Yap_InitExecFs(void) {
|
||||
Yap_InitCPred("trail_suspension_marker", 1, trail_suspension_marker, 0);
|
||||
Yap_InitCPred("cut_at", 1, clean_ifcp, SafePredFlag);
|
||||
CurrentModule = cm;
|
||||
Yap_InitCPred("$pred_goal_expansion_on", 0, pred_goal_expansion_on,
|
||||
SafePredFlag);
|
||||
Yap_InitCPred("$restore_regs", 1, restore_regs,
|
||||
NoTracePredFlag | SafePredFlag);
|
||||
Yap_InitCPred("$restore_regs", 2, restore_regs2,
|
||||
@ -1905,7 +1893,7 @@ void Yap_InitExecFs(void) {
|
||||
Yap_InitCPred("$generate_pred_info", 4, generate_pred_info, 0);
|
||||
Yap_InitCPred("$uncaught_throw", 0, uncaught_throw, 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("$get_exception", 1, get_exception, 0);
|
||||
}
|
||||
|
39
C/heapgc.c
@ -1,4 +1,4 @@
|
||||
/*************************************************************************
|
||||
/**************************************************************************
|
||||
* *
|
||||
* YAP Prolog *
|
||||
* *
|
||||
@ -45,15 +45,15 @@ static void mark_db_fixed(CELL * CACHE_TYPE);
|
||||
static void mark_regs(tr_fr_ptr CACHE_TYPE);
|
||||
static void mark_trail(tr_fr_ptr, tr_fr_ptr, CELL *, choiceptr CACHE_TYPE);
|
||||
static void mark_environments(CELL *, size_t, CELL * CACHE_TYPE);
|
||||
static void mark_choicepoints(choiceptr, tr_fr_ptr, int CACHE_TYPE);
|
||||
static void mark_choicepoints(choiceptr, tr_fr_ptr, bool CACHE_TYPE);
|
||||
static void into_relocation_chain(CELL *, CELL * CACHE_TYPE);
|
||||
static void sweep_trail(choiceptr, tr_fr_ptr CACHE_TYPE);
|
||||
static void sweep_environments(CELL *, size_t, CELL * CACHE_TYPE);
|
||||
static void sweep_choicepoints(choiceptr CACHE_TYPE);
|
||||
static void compact_heap( CACHE_TYPE1 );
|
||||
static void update_relocation_chain(CELL *, CELL * CACHE_TYPE);
|
||||
static int is_gc_verbose(void);
|
||||
static int is_gc_very_verbose(void);
|
||||
static bool is_gc_verbose(void);
|
||||
static bool is_gc_very_verbose(void);
|
||||
static void LeaveGCMode( CACHE_TYPE1 );
|
||||
#ifdef EASY_SHUNTING
|
||||
static void set_conditionals(tr_fr_ptr CACHE_TYPE);
|
||||
@ -1971,7 +1971,7 @@ youngest_cp(choiceptr gc_B, dep_fr_ptr *depfrp)
|
||||
|
||||
|
||||
static void
|
||||
mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose USES_REGS)
|
||||
mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, bool very_verbose USES_REGS)
|
||||
{
|
||||
OPCODE
|
||||
trust_lu = Yap_opcode(_trust_logical),
|
||||
@ -3908,7 +3908,7 @@ compaction_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp USES_REGS)
|
||||
if (CurrentH0) {
|
||||
H0 = CurrentH0;
|
||||
#ifdef TABLING
|
||||
/* make sure that we have the correct H_FZ if we're not tabling */
|
||||
/* make sure that we havce the correct H_FZ if we're not tabling */
|
||||
if (B_FZ == (choiceptr)LCL0)
|
||||
H_FZ = H0;
|
||||
#endif /* TABLING */
|
||||
@ -3923,7 +3923,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS)
|
||||
volatile tr_fr_ptr old_TR = NULL;
|
||||
UInt m_time, c_time, time_start, gc_time;
|
||||
Int effectiveness, tot;
|
||||
int gc_trace;
|
||||
bool gc_trace;
|
||||
UInt gc_phase;
|
||||
UInt alloc_sz;
|
||||
int jmp_res;
|
||||
@ -3931,7 +3931,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS)
|
||||
heap_cells = HR-H0;
|
||||
gc_verbose = is_gc_verbose();
|
||||
effectiveness = 0;
|
||||
gc_trace = FALSE;
|
||||
gc_trace = false;
|
||||
LOCAL_GcCalls++;
|
||||
#ifdef INSTRUMENT_GC
|
||||
{
|
||||
@ -3956,8 +3956,8 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS)
|
||||
#ifdef DEBUG
|
||||
check_global();
|
||||
#endif
|
||||
if (Yap_GetValue(AtomGcTrace) != TermNil)
|
||||
gc_trace = 1;
|
||||
if (gcTrace() != TermOff)
|
||||
gc_trace = true;
|
||||
if (gc_trace) {
|
||||
fprintf(stderr, "%% gc\n");
|
||||
} else if (gc_verbose) {
|
||||
@ -4130,34 +4130,34 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS)
|
||||
return effectiveness;
|
||||
}
|
||||
|
||||
static int
|
||||
static bool
|
||||
is_gc_verbose(void)
|
||||
{
|
||||
CACHE_REGS
|
||||
if (LOCAL_PrologMode == BootMode)
|
||||
return FALSE;
|
||||
return false;
|
||||
#ifdef INSTRUMENT_GC
|
||||
/* always give info when we are debugging gc */
|
||||
return(TRUE);
|
||||
return true;
|
||||
#else
|
||||
return(Yap_GetValue(AtomGcVerbose) != TermNil ||
|
||||
Yap_GetValue(AtomGcVeryVerbose) != TermNil);
|
||||
Term t = gcTrace();
|
||||
return t == TermVerbose || t == TermVeryVerbose;
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
Yap_is_gc_verbose(void)
|
||||
{
|
||||
return is_gc_verbose();
|
||||
}
|
||||
|
||||
static int
|
||||
static bool
|
||||
is_gc_very_verbose(void)
|
||||
{
|
||||
CACHE_REGS
|
||||
if (LOCAL_PrologMode == BootMode)
|
||||
return FALSE;
|
||||
return Yap_GetValue(AtomGcVeryVerbose) != TermNil;
|
||||
return false;
|
||||
return gcTrace() == TermVeryVerbose;
|
||||
}
|
||||
|
||||
Int
|
||||
@ -4267,6 +4267,7 @@ Yap_locked_gc(Int predarity, CELL *current_env, yamop *nextop)
|
||||
CACHE_REGS
|
||||
int res;
|
||||
#if YAPOR_COPY
|
||||
|
||||
fprintf(stderr, "\n\n***** Trying to call the garbage collector in YAPOR/copying ****\n\n\n");
|
||||
exit( 1 );
|
||||
#endif
|
||||
|
@ -106,9 +106,6 @@
|
||||
}
|
||||
#endif /* FROZEN_STACKS */
|
||||
d0 = ARG1;
|
||||
if (PRED_GOAL_EXPANSION_ALL) {
|
||||
goto execute_metacall;
|
||||
}
|
||||
restart_execute:
|
||||
deref_head(d0, execute_unk);
|
||||
execute_nvar:
|
||||
@ -119,7 +116,7 @@
|
||||
}
|
||||
pen = RepPredProp(PredPropByFunc(f, mod));
|
||||
execute_pred_f:
|
||||
if (pen->PredFlags & (MetaPredFlag|GoalExPredFlag)) {
|
||||
if (pen->PredFlags & MetaPredFlag) {
|
||||
/* just strip all of M:G */
|
||||
if (f == FunctorModule) {
|
||||
Term tmod = ArgOfTerm(1,d0);
|
||||
|
123
C/modules.c
@ -25,6 +25,7 @@ static char SccsId[] = "%W% %G%";
|
||||
static Int current_module(USES_REGS1);
|
||||
static Int current_module1(USES_REGS1);
|
||||
static ModEntry *LookupModule(Term a);
|
||||
static ModEntry *LookupSystemModule(Term a);
|
||||
|
||||
static ModEntry *FetchModuleEntry(Atom at)
|
||||
/* get predicate entry for ap/arity; create it if neccessary. */
|
||||
@ -69,6 +70,7 @@ inline static ModEntry *GetModuleEntry(Atom at)
|
||||
new->NextME = CurrentModules;
|
||||
CurrentModules = new;
|
||||
new->AtomOfME = ae;
|
||||
new->OwnerFile = Yap_ConsultingFile( PASS_REGS1);
|
||||
AddPropToAtom(ae, (PropEntry *)new);
|
||||
if (CurrentModule == 0L || (oat = GetModuleEntry(AtomOfTerm(CurrentModule))) == new) {
|
||||
Yap_setModuleFlags(new, NULL);
|
||||
@ -84,11 +86,18 @@ Term Yap_getUnknownModule(ModEntry *m) {
|
||||
return TermError;
|
||||
} else if (m && m->flags & UNKNOWN_WARNING) {
|
||||
return TermWarning;
|
||||
} else if (m && m->flags & UNKNOWN_FAST_FAIL) {
|
||||
return TermFastFail;
|
||||
} else {
|
||||
return TermFail;
|
||||
}
|
||||
}
|
||||
|
||||
bool Yap_getUnknown ( Term mod) {
|
||||
ModEntry *m = LookupModule( mod );
|
||||
return Yap_getUnknownModule( m );
|
||||
}
|
||||
|
||||
|
||||
bool Yap_CharacterEscapes(Term mt) {
|
||||
if (mt == PROLOG_MODULE) mt = TermProlog;
|
||||
@ -118,6 +127,23 @@ Term Yap_Module_Name(PredEntry *ap) {
|
||||
|
||||
}
|
||||
|
||||
static ModEntry *LookupSystemModule(Term a) {
|
||||
CACHE_REGS
|
||||
Atom at;
|
||||
ModEntry *me;
|
||||
|
||||
|
||||
/* prolog module */
|
||||
if (a == 0) {
|
||||
return GetModuleEntry(AtomProlog);
|
||||
}
|
||||
at = AtomOfTerm(a);
|
||||
me = GetModuleEntry(at);
|
||||
me->flags |= M_SYSTEM;
|
||||
me->OwnerFile = Yap_ConsultingFile( PASS_REGS1 );
|
||||
return me;}
|
||||
|
||||
|
||||
static ModEntry *LookupModule(Term a) {
|
||||
Atom at;
|
||||
ModEntry *me;
|
||||
@ -131,6 +157,13 @@ static ModEntry *LookupModule(Term a) {
|
||||
return me;
|
||||
}
|
||||
|
||||
bool Yap_isSystemModule(Term a) {
|
||||
ModEntry *me = LookupModule(a);
|
||||
return
|
||||
me != NULL &&
|
||||
me->flags & M_SYSTEM;
|
||||
}
|
||||
|
||||
Term Yap_Module(Term tmod) {
|
||||
LookupModule(tmod);
|
||||
return tmod;
|
||||
@ -141,6 +174,7 @@ ModEntry *Yap_GetModuleEntry(Term mod) {
|
||||
if (!(me = LookupModule(mod)))
|
||||
return NULL;
|
||||
return me;
|
||||
|
||||
}
|
||||
|
||||
Term Yap_GetModuleFromEntry(ModEntry *me) {
|
||||
@ -191,13 +225,6 @@ static Int
|
||||
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) */
|
||||
Term mod = Deref(ARG1);
|
||||
LookupModule(mod);
|
||||
@ -206,6 +233,14 @@ static Int change_module(USES_REGS1) { /* $change_module(New) */
|
||||
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) {
|
||||
ModEntry *imod = AddressOfTerm(EXTRA_CBACK_ARG(1, 1)), *next;
|
||||
Term t = MkAtomTerm(imod->AtomOfME);
|
||||
@ -280,6 +315,43 @@ static Int init_ground_module(USES_REGS1) {
|
||||
return cont_ground_module(PASS_REGS1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @pred 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 new_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 );
|
||||
me->OwnerFile = Yap_ConsultingFile( PASS_REGS1);
|
||||
return me != NULL;
|
||||
}
|
||||
|
||||
static Int strip_module(USES_REGS1) {
|
||||
Term t1 = Deref(ARG1), tmod = CurrentModule;
|
||||
if (tmod == PROLOG_MODULE) {
|
||||
@ -359,9 +431,23 @@ static Int context_module(USES_REGS1) {
|
||||
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) {
|
||||
CACHE_REGS
|
||||
Term tmod;
|
||||
Term tmod;
|
||||
|
||||
if (modp)
|
||||
tmod = *modp;
|
||||
@ -406,9 +492,12 @@ void Yap_InitModulesC(void) {
|
||||
Yap_InitCPred("$change_module", 1, change_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,
|
||||
SafePredFlag | SyncPredFlag);
|
||||
Yap_InitCPred("context_module", 1, context_module, 0);
|
||||
Yap_InitCPred("$is_system_module", 1, is_system_module, SafePredFlag);
|
||||
Yap_InitCPred("new_system_module", 1, new_system_module, SafePredFlag);
|
||||
Yap_InitCPredBack("$all_current_modules", 1, 1, init_current_module,
|
||||
cont_current_module, SafePredFlag | SyncPredFlag);
|
||||
Yap_InitCPredBack("$ground_module", 3, 1, init_ground_module,
|
||||
@ -417,19 +506,19 @@ void Yap_InitModulesC(void) {
|
||||
|
||||
void Yap_InitModules(void) {
|
||||
CACHE_REGS
|
||||
LookupModule(MkAtomTerm(AtomProlog));
|
||||
LookupSystemModule(MkAtomTerm(AtomProlog));
|
||||
LOCAL_SourceModule = MkAtomTerm(AtomProlog);
|
||||
LookupModule(USER_MODULE);
|
||||
LookupModule(IDB_MODULE);
|
||||
LookupModule(ATTRIBUTES_MODULE);
|
||||
LookupModule(CHARSIO_MODULE);
|
||||
LookupModule(TERMS_MODULE);
|
||||
LookupModule(SYSTEM_MODULE);
|
||||
LookupModule(READUTIL_MODULE);
|
||||
LookupModule(HACKS_MODULE);
|
||||
LookupSystemModule(CHARSIO_MODULE);
|
||||
LookupSystemModule(TERMS_MODULE);
|
||||
LookupSystemModule(SYSTEM_MODULE);
|
||||
LookupSystemModule(READUTIL_MODULE);
|
||||
LookupSystemModule(HACKS_MODULE);
|
||||
LookupModule(ARG_MODULE);
|
||||
LookupModule(GLOBALS_MODULE);
|
||||
LookupModule(DBLOAD_MODULE);
|
||||
LookupModule(RANGE_MODULE);
|
||||
LookupSystemModule(GLOBALS_MODULE);
|
||||
LookupSystemModule(DBLOAD_MODULE);
|
||||
LookupSystemModule(RANGE_MODULE);
|
||||
CurrentModule = PROLOG_MODULE;
|
||||
}
|
||||
|
308
C/parser.c
@ -39,7 +39,8 @@ extended where necessary with attributes denoting integer precedence or
|
||||
operator type.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
term ----> subterm(1200) end_of_term_marker
|
||||
term
|
||||
----> subterm(1200) end_of_term_marker
|
||||
|
||||
subterm(N) ----> term(M) [M <= N]
|
||||
|
||||
@ -163,21 +164,19 @@ typedef struct jmp_buff_struct { sigjmp_buf JmpBuff; } JMPBUFF;
|
||||
|
||||
static void GNextToken(CACHE_TYPE1);
|
||||
static void checkfor(wchar_t, JMPBUFF *CACHE_TYPE);
|
||||
static Term ParseArgs( Atom, wchar_t, JMPBUFF *, Term CACHE_TYPE);
|
||||
static Term ParseList( JMPBUFF *CACHE_TYPE);
|
||||
static Term ParseTerm( int, JMPBUFF *CACHE_TYPE);
|
||||
static Term ParseArgs(Atom, wchar_t, JMPBUFF *, Term CACHE_TYPE);
|
||||
static Term ParseList(JMPBUFF *CACHE_TYPE);
|
||||
static Term ParseTerm(int, JMPBUFF *CACHE_TYPE);
|
||||
|
||||
const char *Yap_tokRep(TokEntry *tokptr);
|
||||
|
||||
static void
|
||||
syntax_msg( const char *msg, ...)
|
||||
{
|
||||
static void syntax_msg(const char *msg, ...) {
|
||||
CACHE_REGS
|
||||
va_list ap;
|
||||
|
||||
if (LOCAL_toktide == LOCAL_tokptr) {
|
||||
va_start(ap, msg);
|
||||
vsnprintf( LOCAL_FileNameBuf2, YAP_FILENAME_MAX-1, msg, ap );
|
||||
vsnprintf(LOCAL_FileNameBuf2, YAP_FILENAME_MAX - 1, msg, ap);
|
||||
LOCAL_ErrorMessage = LOCAL_FileNameBuf2;
|
||||
LOCAL_Error_TYPE = SYNTAX_ERROR;
|
||||
va_end(ap);
|
||||
@ -225,7 +224,8 @@ syntax_msg( const char *msg, ...)
|
||||
|
||||
#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
|
||||
VarEntry *p;
|
||||
@ -291,7 +291,7 @@ static Term VarNames(VarEntry *p, Term l USES_REGS) {
|
||||
|
||||
t[0] = MkAtomTerm(Yap_LookupAtom(p->VarRep));
|
||||
if (!IsVarTerm(p->VarAdr))
|
||||
p->VarAdr = MkVarTerm();
|
||||
p->VarAdr = MkVarTerm();
|
||||
t[1] = p->VarAdr;
|
||||
o = Yap_MkApplTerm(FunctorEq, 2, t);
|
||||
o = MkPairTerm(o, VarNames(p->VarRight,
|
||||
@ -316,7 +316,7 @@ Term Yap_VarNames(VarEntry *p, Term l) {
|
||||
|
||||
static Term Singletons(VarEntry *p, Term l USES_REGS) {
|
||||
if (p != NULL) {
|
||||
if ( p->VarRep[0] != '_' && p->refs == 1) {
|
||||
if (p->VarRep[0] != '_' && p->refs == 1) {
|
||||
Term t[2];
|
||||
Term o;
|
||||
|
||||
@ -378,7 +378,7 @@ static int IsPrefixOp(Atom op, int *pptr, int *rpptr USES_REGS) {
|
||||
}
|
||||
if ((p = opp->Prefix) != 0) {
|
||||
READ_UNLOCK(opp->OpRWLock);
|
||||
*pptr = *rpptr = p & MaskPrio;
|
||||
*pptr = *rpptr = p &MaskPrio;
|
||||
if (p & DcrrpFlag)
|
||||
--*rpptr;
|
||||
return TRUE;
|
||||
@ -405,7 +405,7 @@ static int IsInfixOp(Atom op, int *pptr, int *lpptr, int *rpptr USES_REGS) {
|
||||
}
|
||||
if ((p = opp->Infix) != 0) {
|
||||
READ_UNLOCK(opp->OpRWLock);
|
||||
*pptr = *rpptr = *lpptr = p & MaskPrio;
|
||||
*pptr = *rpptr = *lpptr = p &MaskPrio;
|
||||
if (p & DcrrpFlag)
|
||||
--*rpptr;
|
||||
if (p & DcrlpFlag)
|
||||
@ -434,7 +434,7 @@ static int IsPosfixOp(Atom op, int *pptr, int *lpptr USES_REGS) {
|
||||
}
|
||||
if ((p = opp->Posfix) != 0) {
|
||||
READ_UNLOCK(opp->OpRWLock);
|
||||
*pptr = *lpptr = p & MaskPrio;
|
||||
*pptr = *lpptr = p &MaskPrio;
|
||||
if (p & DcrlpFlag)
|
||||
--*lpptr;
|
||||
return (TRUE);
|
||||
@ -462,7 +462,7 @@ inline static void checkfor(wchar_t c, JMPBUFF *FailBuff USES_REGS) {
|
||||
if (LOCAL_tokptr->Tok != Ord(Ponctuation_tok) ||
|
||||
LOCAL_tokptr->TokInfo != (Term)c) {
|
||||
char s[1024];
|
||||
strncpy(s, Yap_tokRep(LOCAL_tokptr), 1023 );
|
||||
strncpy(s, Yap_tokRep(LOCAL_tokptr), 1023);
|
||||
syntax_msg("expected to find \'%c\', found %s", c, s);
|
||||
FAIL;
|
||||
}
|
||||
@ -523,7 +523,7 @@ static int get_quasi_quotation(term_t t, unsigned char **here,
|
||||
}
|
||||
#endif /*O_QUASIQUOTATIONS*/
|
||||
|
||||
static Term ParseArgs( Atom a, wchar_t close, JMPBUFF *FailBuff,
|
||||
static Term ParseArgs(Atom a, wchar_t close, JMPBUFF *FailBuff,
|
||||
Term arg1 USES_REGS) {
|
||||
int nargs = 0;
|
||||
Term *p, t;
|
||||
@ -543,12 +543,12 @@ static Term ParseArgs( Atom a, wchar_t close, JMPBUFF *FailBuff,
|
||||
|
||||
func = Yap_MkFunctor(a, 1);
|
||||
if (func == NULL) {
|
||||
syntax_msg("Heap Overflow");
|
||||
syntax_msg("Heap Overflow");
|
||||
FAIL;
|
||||
}
|
||||
t = Yap_MkApplTerm(func, nargs, p);
|
||||
if (HR > ASP - 4096) {
|
||||
syntax_msg("Stack Overflow");
|
||||
syntax_msg("Stack Overflow");
|
||||
return TermNil;
|
||||
}
|
||||
NextToken;
|
||||
@ -561,7 +561,7 @@ static Term ParseArgs( Atom a, wchar_t close, JMPBUFF *FailBuff,
|
||||
syntax_msg("Trail Overflow");
|
||||
FAIL;
|
||||
}
|
||||
*tp++ = Unsigned(ParseTerm( 999, FailBuff PASS_REGS));
|
||||
*tp++ = Unsigned(ParseTerm(999, FailBuff PASS_REGS));
|
||||
ParserAuxSp = (char *)tp;
|
||||
++nargs;
|
||||
if (LOCAL_tokptr->Tok != Ord(Ponctuation_tok))
|
||||
@ -576,7 +576,7 @@ static Term ParseArgs( Atom a, wchar_t close, JMPBUFF *FailBuff,
|
||||
* order
|
||||
*/
|
||||
if (HR > ASP - (nargs + 1)) {
|
||||
syntax_msg("Stack Overflow");
|
||||
syntax_msg("Stack Overflow");
|
||||
FAIL;
|
||||
}
|
||||
func = Yap_MkFunctor(a, nargs);
|
||||
@ -596,7 +596,7 @@ static Term ParseArgs( Atom a, wchar_t close, JMPBUFF *FailBuff,
|
||||
t = Yap_MkApplTerm(func, nargs, p);
|
||||
#endif
|
||||
if (HR > ASP - 4096) {
|
||||
syntax_msg("Stack Overflow");
|
||||
syntax_msg("Stack Overflow");
|
||||
return TermNil;
|
||||
}
|
||||
/* check for possible overflow against local stack */
|
||||
@ -616,26 +616,22 @@ static Term MakeAccessor(Term t, Functor f USES_REGS) {
|
||||
return Yap_MkApplTerm(f, 2, tf);
|
||||
}
|
||||
|
||||
static Term ParseList( JMPBUFF *FailBuff USES_REGS) {
|
||||
static Term ParseList(JMPBUFF *FailBuff USES_REGS) {
|
||||
Term o;
|
||||
CELL *to_store;
|
||||
o = AbsPair(HR);
|
||||
loop:
|
||||
to_store = HR;
|
||||
HR += 2;
|
||||
to_store[0] = ParseTerm( 999, FailBuff PASS_REGS);
|
||||
to_store[0] = ParseTerm(999, FailBuff PASS_REGS);
|
||||
if (LOCAL_tokptr->Tok == Ord(Ponctuation_tok)) {
|
||||
if (((int)LOCAL_tokptr->TokInfo) == ',') {
|
||||
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 */
|
||||
if (HR > ASP - 4096) {
|
||||
to_store[1] = TermNil;
|
||||
syntax_msg("Stack Overflow");
|
||||
syntax_msg("Stack Overflow");
|
||||
FAIL;
|
||||
} else {
|
||||
to_store[1] = AbsPair(HR);
|
||||
@ -644,18 +640,19 @@ loop:
|
||||
}
|
||||
} else if (((int)LOCAL_tokptr->TokInfo) == '|') {
|
||||
NextToken;
|
||||
to_store[1] = ParseTerm( 999, FailBuff PASS_REGS);
|
||||
to_store[1] = ParseTerm(999, FailBuff PASS_REGS);
|
||||
} else {
|
||||
to_store[1] = MkAtomTerm(AtomNil);
|
||||
}
|
||||
} else {
|
||||
syntax_msg("looking for symbol ',','|' got symbol '%s'", Yap_tokRep(LOCAL_tokptr) );
|
||||
FAIL;
|
||||
syntax_msg("looking for symbol ',','|' got symbol '%s'",
|
||||
Yap_tokRep(LOCAL_tokptr));
|
||||
FAIL;
|
||||
}
|
||||
return (o);
|
||||
}
|
||||
|
||||
static Term ParseTerm( int prio, JMPBUFF *FailBuff USES_REGS) {
|
||||
static Term ParseTerm(int prio, JMPBUFF *FailBuff USES_REGS) {
|
||||
/* parse term with priority prio */
|
||||
Volatile Term t;
|
||||
Volatile Functor func;
|
||||
@ -719,15 +716,15 @@ static Term ParseTerm( int prio, JMPBUFF *FailBuff USES_REGS) {
|
||||
/* try to parse as a prefix operator */
|
||||
TRY(
|
||||
/* build appl on the heap */
|
||||
func = Yap_MkFunctor((Atom)t, 1);
|
||||
if (func == NULL) {
|
||||
syntax_msg( "Heap Overflow" );
|
||||
func = Yap_MkFunctor((Atom)t, 1); if (func == NULL) {
|
||||
syntax_msg("Heap Overflow");
|
||||
FAIL;
|
||||
} t = ParseTerm( oprprio, FailBuff PASS_REGS);
|
||||
}
|
||||
t = ParseTerm(oprprio, FailBuff PASS_REGS);
|
||||
t = Yap_MkApplTerm(func, 1, &t);
|
||||
/* check for possible overflow against local stack */
|
||||
if (HR > ASP - 4096) {
|
||||
syntax_msg( "Stack Overflow" );
|
||||
syntax_msg("Stack Overflow");
|
||||
FAIL;
|
||||
} curprio = opprio;
|
||||
, break;)
|
||||
@ -735,7 +732,7 @@ static Term ParseTerm( int prio, JMPBUFF *FailBuff USES_REGS) {
|
||||
}
|
||||
if (LOCAL_tokptr->Tok == Ord(Ponctuation_tok) &&
|
||||
Unsigned(LOCAL_tokptr->TokInfo) == 'l')
|
||||
t = ParseArgs( (Atom)t, ')', FailBuff, 0L PASS_REGS);
|
||||
t = ParseArgs((Atom)t, ')', FailBuff, 0L PASS_REGS);
|
||||
else
|
||||
t = MkAtomTerm((Atom)t);
|
||||
break;
|
||||
@ -745,52 +742,68 @@ static Term ParseTerm( int prio, JMPBUFF *FailBuff USES_REGS) {
|
||||
NextToken;
|
||||
break;
|
||||
|
||||
case String_tok: /* build list on the heap */
|
||||
{
|
||||
Volatile char *p = (char *)LOCAL_tokptr->TokInfo;
|
||||
t = Yap_CharsToTDQ(p, CurrentModule, ENC_ISO_LATIN1 PASS_REGS);
|
||||
if (!t) {
|
||||
syntax_msg( "could not convert \'%s\'", (char *)LOCAL_tokptr->TokInfo );
|
||||
FAIL;
|
||||
}
|
||||
NextToken;
|
||||
} break;
|
||||
|
||||
case WString_tok: /* build list on the heap */
|
||||
{
|
||||
Volatile wchar_t *p = (wchar_t *)LOCAL_tokptr->TokInfo;
|
||||
t = Yap_WCharsToTDQ(p, CurrentModule PASS_REGS);
|
||||
if (!t) {
|
||||
syntax_msg( "could not convert \'%S\'", (wchar_t *)LOCAL_tokptr->TokInfo );
|
||||
FAIL;
|
||||
}
|
||||
NextToken;
|
||||
} break;
|
||||
|
||||
case BQString_tok: /* build list on the heap */
|
||||
{
|
||||
Volatile char *p = (char *)LOCAL_tokptr->TokInfo;
|
||||
case String_tok: /* build list on the heap */
|
||||
{
|
||||
Volatile char *p = (char *)LOCAL_tokptr->TokInfo;
|
||||
// we may be operating under a syntax error
|
||||
yap_error_number oerr = LOCAL_Error_TYPE;
|
||||
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
||||
t = Yap_CharsToTDQ(p, CurrentModule, LOCAL_encoding PASS_REGS);
|
||||
if (!t) {
|
||||
syntax_msg("could not convert \"%s\"", (char *)LOCAL_tokptr->TokInfo);
|
||||
FAIL;
|
||||
}
|
||||
LOCAL_Error_TYPE = oerr;
|
||||
NextToken;
|
||||
} break;
|
||||
|
||||
t = Yap_CharsToTBQ(p, CurrentModule, ENC_ISO_LATIN1 PASS_REGS);
|
||||
if (!t) {
|
||||
syntax_msg( "could not convert \'%s\"", (char *)LOCAL_tokptr->TokInfo );
|
||||
FAIL;
|
||||
}
|
||||
NextToken;
|
||||
} break;
|
||||
|
||||
case WBQString_tok: /* build list on the heap */
|
||||
{
|
||||
Volatile wchar_t *p = (wchar_t *)LOCAL_tokptr->TokInfo;
|
||||
t = Yap_WCharsToTBQ(p, CurrentModule PASS_REGS);
|
||||
if (!t) {
|
||||
syntax_msg( "could not convert \"%S\"", (wchar_t *)LOCAL_tokptr->TokInfo );
|
||||
FAIL;
|
||||
}
|
||||
NextToken;
|
||||
} break;
|
||||
|
||||
case Var_tok:
|
||||
case WString_tok: /* build list on the heap */
|
||||
{
|
||||
Volatile wchar_t *p = (wchar_t *)LOCAL_tokptr->TokInfo;
|
||||
// we may be operating under a syntax error
|
||||
yap_error_number oerr = LOCAL_Error_TYPE;
|
||||
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
||||
t = Yap_WCharsToTDQ(p, CurrentModule PASS_REGS);
|
||||
if (!t) {
|
||||
syntax_msg("could not convert \'%S\'", (wchar_t *)LOCAL_tokptr->TokInfo);
|
||||
FAIL;
|
||||
}
|
||||
LOCAL_Error_TYPE = oerr;
|
||||
NextToken;
|
||||
} break;
|
||||
|
||||
case BQString_tok: /* build list on the heap */
|
||||
{
|
||||
Volatile char *p = (char *)LOCAL_tokptr->TokInfo;
|
||||
// we may be operating under a syntax error
|
||||
yap_error_number oerr = LOCAL_Error_TYPE;
|
||||
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
||||
|
||||
t = Yap_CharsToTBQ(p, CurrentModule, LOCAL_encoding PASS_REGS);
|
||||
if (!t) {
|
||||
syntax_msg("could not convert \'%s\"", (char *)LOCAL_tokptr->TokInfo);
|
||||
FAIL;
|
||||
}
|
||||
LOCAL_Error_TYPE = oerr;
|
||||
NextToken;
|
||||
} break;
|
||||
|
||||
case WBQString_tok: /* build list on the heap */
|
||||
{
|
||||
Volatile wchar_t *p = (wchar_t *)LOCAL_tokptr->TokInfo;
|
||||
t = Yap_WCharsToTBQ(p, CurrentModule PASS_REGS);
|
||||
// we may be operating under a syntax error
|
||||
yap_error_number oerr = LOCAL_Error_TYPE;
|
||||
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
||||
if (!t) {
|
||||
syntax_msg("could not convert \"%S\"", (wchar_t *)LOCAL_tokptr->TokInfo);
|
||||
FAIL;
|
||||
}
|
||||
LOCAL_Error_TYPE = oerr;
|
||||
NextToken;
|
||||
} break;
|
||||
|
||||
case Var_tok:
|
||||
varinfo = (VarEntry *)(LOCAL_tokptr->TokInfo);
|
||||
if ((t = varinfo->VarAdr) == TermNil) {
|
||||
t = varinfo->VarAdr = MkVarTerm();
|
||||
@ -799,7 +812,7 @@ case Var_tok:
|
||||
break;
|
||||
|
||||
case Error_tok:
|
||||
syntax_msg( "found ill-formed \"%s\"", Yap_tokRep(LOCAL_tokptr) );
|
||||
syntax_msg("found ill-formed \"%s\"", Yap_tokRep(LOCAL_tokptr));
|
||||
FAIL;
|
||||
|
||||
case Ponctuation_tok:
|
||||
@ -808,7 +821,7 @@ case Var_tok:
|
||||
case '(':
|
||||
case 'l': /* non solo ( */
|
||||
NextToken;
|
||||
t = ParseTerm( 1200, FailBuff PASS_REGS);
|
||||
t = ParseTerm(GLOBAL_MaxPriority, FailBuff PASS_REGS);
|
||||
checkfor(')', FailBuff PASS_REGS);
|
||||
break;
|
||||
case '[':
|
||||
@ -819,7 +832,7 @@ case Var_tok:
|
||||
NextToken;
|
||||
break;
|
||||
}
|
||||
t = ParseList( FailBuff PASS_REGS);
|
||||
t = ParseList(FailBuff PASS_REGS);
|
||||
checkfor(']', FailBuff PASS_REGS);
|
||||
break;
|
||||
case '{':
|
||||
@ -830,11 +843,11 @@ case Var_tok:
|
||||
NextToken;
|
||||
break;
|
||||
}
|
||||
t = ParseTerm( 1200, FailBuff PASS_REGS);
|
||||
t = ParseTerm(GLOBAL_MaxPriority, FailBuff PASS_REGS);
|
||||
t = Yap_MkApplTerm(FunctorBraces, 1, &t);
|
||||
/* check for possible overflow against local stack */
|
||||
if (HR > ASP - 4096) {
|
||||
syntax_msg("Stack Overflow");
|
||||
syntax_msg("Stack Overflow");
|
||||
FAIL;
|
||||
}
|
||||
checkfor('}', FailBuff PASS_REGS);
|
||||
@ -882,45 +895,48 @@ case Var_tok:
|
||||
}
|
||||
|
||||
NextToken;
|
||||
t = ParseTerm( 1200, FailBuff PASS_REGS);
|
||||
t = ParseTerm(GLOBAL_MaxPriority, FailBuff PASS_REGS);
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
/* Arg 2: the content */
|
||||
tn = Yap_MkNewApplTerm(SWIFunctorToFunctor(FUNCTOR_quasi_quotation4), 4);
|
||||
tnp = RepAppl(tn) + 1;
|
||||
tnp[0] = MkAtomTerm(at);
|
||||
if (!get_quasi_quotation(Yap_InitSlot(ArgOfTerm(2, tn)),
|
||||
&qq->text,
|
||||
if (!get_quasi_quotation(Yap_InitSlot(ArgOfTerm(2, tn)), &qq->text,
|
||||
qq->text + strlen((const char *)qq->text))) {
|
||||
syntax_msg( "could not get quasi quotation, at \"%s\"", Yap_tokRep(LOCAL_tokptr) );
|
||||
FAIL;
|
||||
syntax_msg("could not get quasi quotation, at \"%s\"",
|
||||
Yap_tokRep(LOCAL_tokptr));
|
||||
FAIL;
|
||||
}
|
||||
if (positions) {
|
||||
intptr_t qqend = qq->end.charno;
|
||||
|
||||
// set_range_position(positions, -1, qqend PASS_LD);
|
||||
if (!PL_unify_term(Yap_InitSlot(ArgOfTerm(2, t) ), PL_FUNCTOR,
|
||||
if (!PL_unify_term(Yap_InitSlot(ArgOfTerm(2, t)), PL_FUNCTOR,
|
||||
FUNCTOR_minus2, PL_INTPTR,
|
||||
qq->mid.charno + 2, /* end of | token */
|
||||
PL_INTPTR, qqend - 2)) /* end minus "|}" */
|
||||
syntax_msg( "failed to unify quasi quotation, at \"%s\"", Yap_tokRep(LOCAL_tokptr) );
|
||||
FAIL;
|
||||
syntax_msg("failed to unify quasi quotation, at \"%s\"",
|
||||
Yap_tokRep(LOCAL_tokptr));
|
||||
FAIL;
|
||||
}
|
||||
|
||||
tnp[2] =
|
||||
Yap_GetFromSlot(LOCAL_varnames); /* Arg 3: the var dictionary */
|
||||
tnp[2] = Yap_GetFromSlot(LOCAL_varnames); /* Arg 3: the var dictionary */
|
||||
/* Arg 4: the result */
|
||||
t = ArgOfTerm(4, tn);
|
||||
if (!(to = PL_new_term_ref()) ||
|
||||
!PL_unify_list(LOCAL_qq_tail, to, LOCAL_qq_tail) ||
|
||||
!PL_unify(to, Yap_InitSlot(tn ))) {
|
||||
syntax_msg( "failed to unify quasi quotation, at \"%s\"", Yap_tokRep(LOCAL_tokptr) );
|
||||
!PL_unify(to, Yap_InitSlot(tn))) {
|
||||
syntax_msg("failed to unify quasi quotation, at \"%s\"",
|
||||
Yap_tokRep(LOCAL_tokptr));
|
||||
FAIL;
|
||||
}
|
||||
}
|
||||
@ -928,7 +944,7 @@ case Var_tok:
|
||||
NextToken;
|
||||
break;
|
||||
default:
|
||||
syntax_msg( "expected operator, got \'%s\'", Yap_tokRep(LOCAL_tokptr) );
|
||||
syntax_msg("expected operator, got \'%s\'", Yap_tokRep(LOCAL_tokptr));
|
||||
FAIL;
|
||||
}
|
||||
|
||||
@ -941,38 +957,39 @@ case Var_tok:
|
||||
opprio <= prio && oplprio >= curprio) {
|
||||
/* try parsing as infix operator */
|
||||
Volatile int oldprio = curprio;
|
||||
TRY3(func = Yap_MkFunctor((Atom)LOCAL_tokptr->TokInfo, 2);
|
||||
if (func == NULL) {
|
||||
syntax_msg("Heap Overflow");
|
||||
FAIL;
|
||||
} NextToken;
|
||||
{
|
||||
Term args[2];
|
||||
args[0] = t;
|
||||
args[1] = ParseTerm(oprprio, FailBuff PASS_REGS);
|
||||
t = Yap_MkApplTerm(func, 2, args);
|
||||
/* check for possible overflow against local stack */
|
||||
if (HR > ASP - 4096) {
|
||||
syntax_msg("Stack Overflow");
|
||||
FAIL;
|
||||
}
|
||||
},
|
||||
curprio = opprio;
|
||||
opinfo = save_opinfo; continue;, opinfo = save_opinfo;
|
||||
curprio = oldprio;)
|
||||
TRY3(
|
||||
func = Yap_MkFunctor((Atom)LOCAL_tokptr->TokInfo, 2);
|
||||
if (func == NULL) {
|
||||
syntax_msg("Heap Overflow");
|
||||
FAIL;
|
||||
} NextToken;
|
||||
{
|
||||
Term args[2];
|
||||
args[0] = t;
|
||||
args[1] = ParseTerm(oprprio, FailBuff PASS_REGS);
|
||||
t = Yap_MkApplTerm(func, 2, args);
|
||||
/* check for possible overflow against local stack */
|
||||
if (HR > ASP - 4096) {
|
||||
syntax_msg("Stack Overflow");
|
||||
FAIL;
|
||||
}
|
||||
},
|
||||
curprio = opprio;
|
||||
opinfo = save_opinfo; continue;, opinfo = save_opinfo;
|
||||
curprio = oldprio;)
|
||||
}
|
||||
if (IsPosfixOp(opinfo, &opprio, &oplprio PASS_REGS) && opprio <= prio &&
|
||||
oplprio >= curprio) {
|
||||
/* parse as posfix operator */
|
||||
Functor func = Yap_MkFunctor((Atom)LOCAL_tokptr->TokInfo, 1);
|
||||
if (func == NULL) {
|
||||
syntax_msg("Heap Overflow");
|
||||
syntax_msg("Heap Overflow");
|
||||
FAIL;
|
||||
}
|
||||
t = Yap_MkApplTerm(func, 1, &t);
|
||||
/* check for possible overflow against local stack */
|
||||
if (HR > ASP - 4096) {
|
||||
syntax_msg("Stack Overflow");
|
||||
syntax_msg("Stack Overflow");
|
||||
FAIL;
|
||||
}
|
||||
curprio = opprio;
|
||||
@ -987,11 +1004,11 @@ case Var_tok:
|
||||
Volatile Term args[2];
|
||||
NextToken;
|
||||
args[0] = t;
|
||||
args[1] = ParseTerm( 1000, FailBuff PASS_REGS);
|
||||
args[1] = ParseTerm(1000, FailBuff PASS_REGS);
|
||||
t = Yap_MkApplTerm(FunctorComma, 2, args);
|
||||
/* check for possible overflow against local stack */
|
||||
if (HR > ASP - 4096) {
|
||||
syntax_msg("Stack Overflow");
|
||||
syntax_msg("Stack Overflow");
|
||||
FAIL;
|
||||
}
|
||||
curprio = 1000;
|
||||
@ -1006,7 +1023,7 @@ case Var_tok:
|
||||
t = Yap_MkApplTerm(FunctorVBar, 2, args);
|
||||
/* check for possible overflow against local stack */
|
||||
if (HR > ASP - 4096) {
|
||||
syntax_msg("Stack Overflow");
|
||||
syntax_msg("Stack Overflow");
|
||||
FAIL;
|
||||
}
|
||||
curprio = opprio;
|
||||
@ -1021,7 +1038,7 @@ case Var_tok:
|
||||
IsPosfixOp(AtomEmptySquareBrackets, &opprio,
|
||||
&oplprio PASS_REGS) &&
|
||||
opprio <= prio && oplprio >= curprio) {
|
||||
t = ParseArgs( AtomEmptySquareBrackets, ']', FailBuff, t PASS_REGS);
|
||||
t = ParseArgs(AtomEmptySquareBrackets, ']', FailBuff, t PASS_REGS);
|
||||
t = MakeAccessor(t, FunctorEmptySquareBrackets PASS_REGS);
|
||||
curprio = opprio;
|
||||
continue;
|
||||
@ -1029,14 +1046,14 @@ case Var_tok:
|
||||
IsPosfixOp(AtomEmptyCurlyBrackets, &opprio,
|
||||
&oplprio PASS_REGS) &&
|
||||
opprio <= prio && oplprio >= curprio) {
|
||||
t = ParseArgs( AtomEmptyCurlyBrackets, '}', FailBuff, t PASS_REGS);
|
||||
t = ParseArgs(AtomEmptyCurlyBrackets, '}', FailBuff, t PASS_REGS);
|
||||
t = MakeAccessor(t, FunctorEmptyCurlyBrackets PASS_REGS);
|
||||
curprio = opprio;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (LOCAL_tokptr->Tok <= Ord(WString_tok)) {
|
||||
syntax_msg( "expected operator, got \'%s\'", Yap_tokRep(LOCAL_tokptr) );
|
||||
syntax_msg("expected operator, got \'%s\'", Yap_tokRep(LOCAL_tokptr));
|
||||
FAIL;
|
||||
}
|
||||
break;
|
||||
@ -1048,28 +1065,27 @@ Term Yap_Parse(UInt prio) {
|
||||
CACHE_REGS
|
||||
Volatile Term t;
|
||||
JMPBUFF FailBuff;
|
||||
yhandle_t sls = Yap_StartSlots();
|
||||
yhandle_t sls = Yap_StartSlots();
|
||||
|
||||
if (!sigsetjmp(FailBuff.JmpBuff, 0)) {
|
||||
|
||||
t = ParseTerm(prio, &FailBuff PASS_REGS);
|
||||
#if DEBUG
|
||||
if (GLOBAL_Option['p' - 'a' + 1]) {
|
||||
Yap_DebugPutc(stderr, '[');
|
||||
if (t==0) Yap_DebugPlWrite(MkIntTerm(0));
|
||||
else Yap_DebugPlWrite(t);
|
||||
Yap_DebugPutc(stderr, ']');
|
||||
Yap_DebugPutc(stderr, '\n');
|
||||
}
|
||||
if (GLOBAL_Option['p' - 'a' + 1]) {
|
||||
Yap_DebugPutc(stderr, '[');
|
||||
if (t == 0)
|
||||
Yap_DebugPlWrite(MkIntTerm(0));
|
||||
else
|
||||
Yap_DebugPlWrite(t);
|
||||
Yap_DebugPutc(stderr, ']');
|
||||
Yap_DebugPutc(stderr, '\n');
|
||||
}
|
||||
#endif
|
||||
Yap_CloseSlots( sls );
|
||||
if (LOCAL_tokptr != NULL &&
|
||||
LOCAL_tokptr->Tok != Ord(eot_tok)
|
||||
) {
|
||||
Yap_CloseSlots(sls);
|
||||
if (LOCAL_tokptr != NULL && LOCAL_tokptr->Tok != Ord(eot_tok)) {
|
||||
t = 0;
|
||||
}
|
||||
if (t != 0 &&
|
||||
LOCAL_Error_TYPE == SYNTAX_ERROR) {
|
||||
if (t != 0 && LOCAL_Error_TYPE == SYNTAX_ERROR) {
|
||||
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
||||
LOCAL_ErrorMessage = NULL;
|
||||
}
|
||||
@ -1077,7 +1093,7 @@ Term Yap_Parse(UInt prio) {
|
||||
// return (0L);
|
||||
return t;
|
||||
}
|
||||
Yap_CloseSlots( sls );
|
||||
Yap_CloseSlots(sls);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
41
C/qlyr.c
@ -698,7 +698,7 @@ read_tag(FILE *stream)
|
||||
return ch;
|
||||
}
|
||||
|
||||
static UInt
|
||||
static pred_flags_t
|
||||
read_predFlags(FILE *stream)
|
||||
{
|
||||
pred_flags_t v;
|
||||
@ -1018,23 +1018,30 @@ read_pred(FILE *stream, Term mod) {
|
||||
|
||||
ap = LookupPredEntry((PredEntry *)read_UInt(stream));
|
||||
flags = read_predFlags(stream);
|
||||
#if 0
|
||||
if (ap->ArityOfPE && ap->ModuleOfPred != IDB_MODULE)
|
||||
// __android_log_print(ANDROID_LOG_INFO, "YAP ", " %s/%ld %llx %llx\n", NameOfFunctor(ap->FunctorOfPred)->StrOfAE, ap->ArityOfPE, ap->PredFlags, flags);
|
||||
printf(" %s/%ld %llx %llx\n", NameOfFunctor(ap->FunctorOfPred)->StrOfAE, ap->ArityOfPE, ap->PredFlags, flags);
|
||||
else if (ap->ModuleOfPred != IDB_MODULE)
|
||||
//__android_log_print(ANDROID_LOG_INFO, "YAP "," %s/%ld %llx %llx\n", ((Atom)(ap->FunctorOfPred))->StrOfAE, ap->ArityOfPE, flags);
|
||||
printf(" %s/%ld %llx %llx\n", ((Atom)(ap->FunctorOfPred))->StrOfAE, ap->ArityOfPE, ap->PredFlags, flags);
|
||||
//else
|
||||
// __android_log_print(ANDROID_LOG_INFO, "YAP "," number\n");
|
||||
#endif
|
||||
if (flags & ForeignPredFlags) {
|
||||
if (!(ap->PredFlags & ForeignPredFlags))
|
||||
QLYR_ERROR(INCONSISTENT_CPRED);
|
||||
if (flags & MetaPredFlag)
|
||||
ap->PredFlags |= MetaPredFlag;
|
||||
return;
|
||||
}
|
||||
nclauses = read_UInt(stream);
|
||||
if (ap->PredFlags & IndexedPredFlag) {
|
||||
Yap_RemoveIndexation(ap);
|
||||
}
|
||||
#if 0
|
||||
if (ap->ArityOfPE && ap->ModuleOfPred != IDB_MODULE)
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAP ", " %s/%ld %lx\n", NameOfFunctor(ap->FunctorOfPred)->StrOfAE, ap->ArityOfPE, flags);
|
||||
/* printf(" %s/%ld %lx\n", NameOfFunctor(ap->FunctorOfPred)->StrOfAE, ap->ArityOfPE, flags); */
|
||||
else if (ap->ModuleOfPred != IDB_MODULE)
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAP "," %s/%ld %lx\n", ((Atom)(ap->FunctorOfPred))->StrOfAE, ap->ArityOfPE, flags);
|
||||
/* printf(" %s/%ld %lx\n", ((Atom)(ap->FunctorOfPred))->StrOfAE, ap->ArityOfPE, flags); */
|
||||
else
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAP "," number\n");
|
||||
#endif
|
||||
fl1 = flags & ((pred_flags_t)STATIC_PRED_FLAGS|(UInt)EXTRA_PRED_FLAGS);
|
||||
ap->PredFlags &= ~((UInt)STATIC_PRED_FLAGS|(UInt)EXTRA_PRED_FLAGS);
|
||||
ap->PredFlags |= fl1;
|
||||
//fl1 = flags & ((pred_flags_t)STATIC_PRED_FLAGS|(UInt)EXTRA_PRED_FLAGS);
|
||||
//ap->PredFlags &= ~((UInt)STATIC_PRED_FLAGS|(UInt)EXTRA_PRED_FLAGS);
|
||||
ap->PredFlags = flags & ~StatePredFlags;
|
||||
if (flags & NumberDBPredFlag) {
|
||||
ap->src.IndxId = read_UInt(stream);
|
||||
} else {
|
||||
@ -1046,9 +1053,9 @@ read_pred(FILE *stream, Term mod) {
|
||||
}
|
||||
ap->TimeStampOfPred = read_UInt(stream);
|
||||
/* multifile predicates cannot reside in module 0 */
|
||||
if (flags & MultiFileFlag && ap->ModuleOfPred == PROLOG_MODULE) {
|
||||
ap->ModuleOfPred = TermProlog;
|
||||
}
|
||||
// if (flags & MultiFileFlag && ap->ModuleOfPred == PROLOG_MODULE) {
|
||||
// ap->ModuleOfPred = TermProlog;
|
||||
// }
|
||||
if (nclauses)
|
||||
read_clauses(stream, ap, nclauses, flags);
|
||||
#if DEBUG
|
||||
|
9
C/qlyw.c
@ -698,6 +698,8 @@ static size_t
|
||||
save_pred(FILE *stream, PredEntry *ap) {
|
||||
CHECK(save_UInt(stream, (UInt)ap));
|
||||
CHECK(save_predFlags(stream, ap->PredFlags));
|
||||
if (ap->PredFlags & ForeignPredFlags)
|
||||
return 1;
|
||||
CHECK(save_UInt(stream, ap->cs.p_code.NOfClauses));
|
||||
CHECK(save_UInt(stream, ap->src.IndxId));
|
||||
CHECK(save_UInt(stream, ap->TimeStampOfPred));
|
||||
@ -706,11 +708,8 @@ save_pred(FILE *stream, PredEntry *ap) {
|
||||
|
||||
static int
|
||||
clean_pred(PredEntry *pp USES_REGS) {
|
||||
if (pp->PredFlags & (AsmPredFlag|CPredFlag)) {
|
||||
/* assembly */
|
||||
if (pp->CodeOfPred) {
|
||||
CleanClauses(pp->CodeOfPred, pp->CodeOfPred, pp PASS_REGS);
|
||||
}
|
||||
if (pp->PredFlags & ForeignPredFlags) {
|
||||
return true;
|
||||
} else {
|
||||
CleanClauses(pp->cs.p_code.FirstClause, pp->cs.p_code.LastClause, pp PASS_REGS);
|
||||
}
|
||||
|
6
C/save.c
@ -455,7 +455,7 @@ save_regs(int mode USES_REGS)
|
||||
if (putcellptr(CellPtr(HeapTop)) < 0)
|
||||
return -1;
|
||||
/* and the space it ocuppies */
|
||||
if (putout(Unsigned(Yap_heap_regs->heap_used)) < 0)
|
||||
if (putout(Unsigned(HeapUsed)) < 0)
|
||||
return -1;
|
||||
/* Then the start of the free code */
|
||||
if (putcellptr(CellPtr(FreeBlocks)) < 0)
|
||||
@ -1035,6 +1035,8 @@ get_coded(int flag, OPCODE old_ops[] USES_REGS)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* restore some heap registers */
|
||||
static void
|
||||
restore_heap_regs( USES_REGS1 )
|
||||
@ -1043,7 +1045,7 @@ restore_heap_regs( USES_REGS1 )
|
||||
HeapTop = AddrAdjust(HeapTop);
|
||||
*((YAP_SEG_SIZE *) HeapTop) = InUseFlag;
|
||||
}
|
||||
HeapMax = Yap_heap_regs->heap_used = OldHeapUsed;
|
||||
HeapMax = HeapUsed = OldHeapUsed;
|
||||
HeapLim = LOCAL_GlobalBase;
|
||||
}
|
||||
|
||||
|
13
C/scanner.c
@ -1735,17 +1735,16 @@ TokEntry *Yap_tokenizer(struct stream_desc *inp_stream, bool store_comments,
|
||||
case SY:
|
||||
if (ch == '`')
|
||||
goto quoted_string;
|
||||
if (ch == '.') {
|
||||
int nch = Yap_peek(inp_stream - GLOBAL_Stream);
|
||||
if (chtype(nch) == BS || chtype(nch) == EF || nch == '%') {
|
||||
och = ch;
|
||||
ch = getchr(inp_stream);
|
||||
if (och == '.') {
|
||||
if (chtype(ch) == BS || chtype(ch) == EF || ch == '%') {
|
||||
t->Tok = Ord(kind = eot_tok);
|
||||
if (chtype(ch) == EF)
|
||||
mark_eof(inp_stream);
|
||||
return l;
|
||||
}
|
||||
}
|
||||
och = ch;
|
||||
ch = getchr(inp_stream);
|
||||
if (och == '/' && ch == '*') {
|
||||
if (store_comments) {
|
||||
CHECK_SPACE();
|
||||
@ -1830,9 +1829,9 @@ TokEntry *Yap_tokenizer(struct stream_desc *inp_stream, bool store_comments,
|
||||
Yap_ReleasePreAllocCodeSpace((CODEADDR)TokImage);
|
||||
t->Tok = Ord(kind = Name_tok);
|
||||
if (ch == '(')
|
||||
solo_flag = FALSE;
|
||||
solo_flag = false;
|
||||
else
|
||||
solo_flag = TRUE;
|
||||
solo_flag = true;
|
||||
}
|
||||
break;
|
||||
|
||||
|
466
C/signals.c
@ -8,14 +8,14 @@
|
||||
* *
|
||||
**************************************************************************
|
||||
* *
|
||||
* File: signal.c *
|
||||
* File: signal.c *
|
||||
* comments: Signal Handling & Debugger Support *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*************************************************************************/
|
||||
#ifdef SCCS
|
||||
static char SccsId[] = "%W% %G%";
|
||||
static char SccsId[] = "%W% %G%";
|
||||
#endif
|
||||
|
||||
#define HAS_CACHE_REGS 1
|
||||
@ -51,59 +51,59 @@ static char SccsId[] = "%W% %G%";
|
||||
#include <tracer.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* The InteractSIGINT function is called after a normal interrupt had been caught.
|
||||
* The InteractSIGINT function is called after a normal interrupt had been
|
||||
* caught.
|
||||
* It allows 6 possibilities: abort, continue, trace, debug, help, exit.
|
||||
*/
|
||||
static yap_signals
|
||||
InteractSIGINT(int ch) {
|
||||
static yap_signals InteractSIGINT(int ch) {
|
||||
#ifdef HAVE_SETBUF
|
||||
/* make sure we are not waiting for the end of line */
|
||||
setbuf (stdin, NULL);
|
||||
setbuf(stdin, NULL);
|
||||
#endif
|
||||
switch (ch) {
|
||||
case 'a':
|
||||
/* abort computation */
|
||||
return YAP_ABORT_SIGNAL;
|
||||
case 'b':
|
||||
/* continue */
|
||||
return YAP_BREAK_SIGNAL;
|
||||
case 'c':
|
||||
/* continue */
|
||||
return YAP_NO_SIGNAL;
|
||||
case 'd':
|
||||
/* enter debug mode */
|
||||
return YAP_DEBUG_SIGNAL;
|
||||
case 'e':
|
||||
/* exit */
|
||||
Yap_exit(1);
|
||||
return YAP_EXIT_SIGNAL;
|
||||
case 'g':
|
||||
/* stack dump */
|
||||
return YAP_STACK_DUMP_SIGNAL;
|
||||
case 't':
|
||||
/* start tracing */
|
||||
return YAP_TRACE_SIGNAL;
|
||||
case 'a':
|
||||
/* abort computation */
|
||||
return YAP_ABORT_SIGNAL;
|
||||
case 'b':
|
||||
/* continue */
|
||||
return YAP_BREAK_SIGNAL;
|
||||
case 'c':
|
||||
/* continue */
|
||||
return YAP_NO_SIGNAL;
|
||||
case 'd':
|
||||
/* enter debug mode */
|
||||
return YAP_DEBUG_SIGNAL;
|
||||
case 'e':
|
||||
/* exit */
|
||||
Yap_exit(1);
|
||||
return YAP_EXIT_SIGNAL;
|
||||
case 'g':
|
||||
/* stack dump */
|
||||
return YAP_STACK_DUMP_SIGNAL;
|
||||
case 't':
|
||||
/* start tracing */
|
||||
return YAP_TRACE_SIGNAL;
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
case 'T':
|
||||
toggle_low_level_trace();
|
||||
return YAP_NO_SIGNAL;
|
||||
case 'T':
|
||||
toggle_low_level_trace();
|
||||
return YAP_NO_SIGNAL;
|
||||
#endif
|
||||
case 's':
|
||||
/* show some statistics */
|
||||
return YAP_STATISTICS_SIGNAL;
|
||||
case EOF:
|
||||
return YAP_NO_SIGNAL;
|
||||
case 'h':
|
||||
case '?':
|
||||
default:
|
||||
/* show an helpful message */
|
||||
fprintf(stderr, "Please press one of:\n");
|
||||
fprintf(stderr, " a for abort\n c for continue\n d for debug\n");
|
||||
fprintf(stderr, " e for exit\n g for stack dump\n s for statistics\n t for trace\n");
|
||||
fprintf(stderr, " b for break\n");
|
||||
return YAP_NO_SIGNAL;
|
||||
case 's':
|
||||
/* show some statistics */
|
||||
return YAP_STATISTICS_SIGNAL;
|
||||
case EOF:
|
||||
return YAP_NO_SIGNAL;
|
||||
case 'h':
|
||||
case '?':
|
||||
default:
|
||||
/* show an helpful message */
|
||||
fprintf(stderr, "Please press one of:\n");
|
||||
fprintf(stderr, " a for abort\n c for continue\n d for debug\n");
|
||||
fprintf(stderr, " e for exit\n g for stack dump\n s for statistics\n t "
|
||||
"for trace\n");
|
||||
fprintf(stderr, " b for break\n");
|
||||
return YAP_NO_SIGNAL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,162 +111,146 @@ InteractSIGINT(int ch) {
|
||||
This function talks to the user about a signal. We assume we are in
|
||||
the context of the main Prolog thread (trivial in Unix, but hard in WIN32)
|
||||
*/
|
||||
static yap_signals
|
||||
ProcessSIGINT(void)
|
||||
{
|
||||
static yap_signals ProcessSIGINT(void) {
|
||||
CACHE_REGS
|
||||
int ch, out;
|
||||
#if _WIN32
|
||||
if (!_isatty(0)) {
|
||||
return YAP_INT_SIGNAL;
|
||||
return YAP_INT_SIGNAL;
|
||||
}
|
||||
#elif HAVE_ISATTY
|
||||
if (!isatty(0)) {
|
||||
return YAP_INT_SIGNAL;
|
||||
return YAP_INT_SIGNAL;
|
||||
}
|
||||
#endif
|
||||
LOCAL_PrologMode |= AsyncIntMode;
|
||||
do {
|
||||
ch = Yap_GetCharForSIGINT();
|
||||
ch = Yap_GetCharForSIGINT();
|
||||
} while (!(out = InteractSIGINT(ch)));
|
||||
LOCAL_PrologMode &= ~AsyncIntMode;
|
||||
return(out);
|
||||
return (out);
|
||||
}
|
||||
|
||||
inline static void
|
||||
do_signal(int wid, yap_signals sig USES_REGS)
|
||||
{
|
||||
inline static void do_signal(int wid, yap_signals sig USES_REGS) {
|
||||
#if THREADS
|
||||
__sync_fetch_and_or ( &REMOTE(wid)->Signals_, SIGNAL_TO_BIT(sig));
|
||||
__sync_fetch_and_or(&REMOTE(wid)->Signals_, SIGNAL_TO_BIT(sig));
|
||||
if (!REMOTE_InterruptsDisabled(wid)) {
|
||||
REMOTE_ThreadHandle(wid).current_yaam_regs->CreepFlag_ =
|
||||
Unsigned(REMOTE_ThreadHandle(wid).current_yaam_regs->LCL0_);
|
||||
REMOTE_ThreadHandle(wid).current_yaam_regs->CreepFlag_ =
|
||||
Unsigned(REMOTE_ThreadHandle(wid).current_yaam_regs->LCL0_);
|
||||
}
|
||||
#else
|
||||
LOCAL_Signals |= SIGNAL_TO_BIT(sig);
|
||||
if (!LOCAL_InterruptsDisabled) {
|
||||
CreepFlag =
|
||||
Unsigned(LCL0);
|
||||
CreepFlag = Unsigned(LCL0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline static int
|
||||
get_signal(yap_signals sig USES_REGS)
|
||||
{
|
||||
inline static bool get_signal(yap_signals sig USES_REGS) {
|
||||
#if THREADS
|
||||
uint64_t old;
|
||||
|
||||
// first, clear the Creep Flag, now if someone sets it it is their problem
|
||||
CalculateStackGap( PASS_REGS1 );
|
||||
CalculateStackGap(PASS_REGS1);
|
||||
// reset the flag
|
||||
if ( (old =__sync_fetch_and_and( &LOCAL_Signals, ~SIGNAL_TO_BIT(sig) ) ) !=
|
||||
if ((old = __sync_fetch_and_and(&LOCAL_Signals, ~SIGNAL_TO_BIT(sig))) !=
|
||||
SIGNAL_TO_BIT(sig)) {
|
||||
if (!LOCAL_InterruptsDisabled && LOCAL_Signals != 0) {
|
||||
CreepFlag = (CELL)LCL0;
|
||||
}
|
||||
if (!(old & SIGNAL_TO_BIT(sig)) ) {
|
||||
// not there?
|
||||
return FALSE;
|
||||
}
|
||||
// more likely case, we have other interrupts.
|
||||
return TRUE;
|
||||
if (!LOCAL_InterruptsDisabled && LOCAL_Signals != 0) {
|
||||
CreepFlag = (CELL)LCL0;
|
||||
}
|
||||
if (!(old & SIGNAL_TO_BIT(sig))) {
|
||||
// not there?
|
||||
return FALSE;
|
||||
}
|
||||
// more likely case, we have other interrupts.
|
||||
return TRUE;
|
||||
}
|
||||
// success, we are good
|
||||
return TRUE;
|
||||
// should we set the flag?
|
||||
// should we set the flag?
|
||||
#else
|
||||
if (LOCAL_Signals & SIGNAL_TO_BIT(sig)) {
|
||||
LOCAL_Signals &= ~SIGNAL_TO_BIT(sig);
|
||||
if (!LOCAL_InterruptsDisabled && LOCAL_Signals != 0) {
|
||||
CreepFlag = (CELL)LCL0;
|
||||
} else {
|
||||
CalculateStackGap( PASS_REGS1 );
|
||||
}
|
||||
return TRUE;
|
||||
LOCAL_Signals &= ~SIGNAL_TO_BIT(sig);
|
||||
if (!LOCAL_InterruptsDisabled && LOCAL_Signals != 0) {
|
||||
CreepFlag = (CELL)LCL0;
|
||||
} else {
|
||||
CalculateStackGap(PASS_REGS1);
|
||||
}
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
Function called to handle delayed interrupts.
|
||||
Function called to handle delayed interrupts.
|
||||
*/
|
||||
int
|
||||
Yap_HandleInterrupts( void )
|
||||
{
|
||||
int Yap_HandleInterrupts(void) {
|
||||
CACHE_REGS
|
||||
yap_signals sig;
|
||||
|
||||
if ( get_signal( YAP_INT_SIGNAL PASS_REGS )) {
|
||||
if ( (sig = ProcessSIGINT()) != YAP_NO_SIGNAL )
|
||||
do_signal(worker_id, sig PASS_REGS);
|
||||
LOCAL_PrologMode &= ~InterruptMode;
|
||||
return 1;
|
||||
if (get_signal(YAP_INT_SIGNAL PASS_REGS)) {
|
||||
if ((sig = ProcessSIGINT()) != YAP_NO_SIGNAL)
|
||||
do_signal(worker_id, sig PASS_REGS);
|
||||
LOCAL_PrologMode &= ~InterruptMode;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Int
|
||||
p_creep( USES_REGS1 )
|
||||
{
|
||||
Atom at;
|
||||
PredEntry *pred;
|
||||
static Int p_creep(USES_REGS1) {
|
||||
Atom at;
|
||||
PredEntry *pred;
|
||||
|
||||
at = AtomCreep;
|
||||
pred = RepPredProp(PredPropByFunc(Yap_MkFunctor(at, 1),0));
|
||||
pred = RepPredProp(PredPropByFunc(Yap_MkFunctor(at, 1), 0));
|
||||
CreepCode = pred;
|
||||
do_signal(worker_id, YAP_CREEP_SIGNAL PASS_REGS);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Int
|
||||
p_creep_fail( USES_REGS1 )
|
||||
{
|
||||
Atom at;
|
||||
PredEntry *pred;
|
||||
static Int p_creep_fail(USES_REGS1) {
|
||||
Atom at;
|
||||
PredEntry *pred;
|
||||
|
||||
at = AtomCreep;
|
||||
pred = RepPredProp(PredPropByFunc(Yap_MkFunctor(at, 1),0));
|
||||
pred = RepPredProp(PredPropByFunc(Yap_MkFunctor(at, 1), 0));
|
||||
CreepCode = pred;
|
||||
do_signal(worker_id, YAP_CREEP_SIGNAL PASS_REGS);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static Int stop_creeping( USES_REGS1 )
|
||||
{
|
||||
get_signal( YAP_CREEP_SIGNAL PASS_REGS );
|
||||
static Int stop_creeping(USES_REGS1) {
|
||||
if (get_signal(YAP_CREEP_SIGNAL PASS_REGS)) {
|
||||
return Yap_unify(ARG1, TermTrue);
|
||||
}
|
||||
return Yap_unify(ARG1, TermFalse);
|
||||
}
|
||||
|
||||
static Int disable_debugging(USES_REGS1) {
|
||||
get_signal(YAP_CREEP_SIGNAL PASS_REGS);
|
||||
return true;
|
||||
}
|
||||
|
||||
static Int
|
||||
creep_allowed( USES_REGS1 )
|
||||
{
|
||||
static Int creep_allowed(USES_REGS1) {
|
||||
if (PP != NULL) {
|
||||
get_signal(YAP_CREEP_SIGNAL PASS_REGS);
|
||||
return true;
|
||||
get_signal(YAP_CREEP_SIGNAL PASS_REGS);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
Yap_signal(yap_signals sig)
|
||||
{
|
||||
void Yap_signal(yap_signals sig) {
|
||||
CACHE_REGS
|
||||
do_signal(worker_id, sig PASS_REGS);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static Int
|
||||
p_debug( USES_REGS1 );
|
||||
static Int p_debug(USES_REGS1);
|
||||
#endif
|
||||
|
||||
void
|
||||
Yap_external_signal(int wid, yap_signals sig)
|
||||
{
|
||||
void Yap_external_signal(int wid, yap_signals sig) {
|
||||
#if THREADS
|
||||
REGSTORE *regcache = REMOTE_ThreadHandle(wid).current_yaam_regs;
|
||||
#endif
|
||||
@ -274,195 +258,177 @@ Yap_external_signal(int wid, yap_signals sig)
|
||||
LOCAL_PrologMode &= ~InterruptMode;
|
||||
}
|
||||
|
||||
int
|
||||
Yap_get_signal__(yap_signals sig USES_REGS)
|
||||
{
|
||||
int Yap_get_signal__(yap_signals sig USES_REGS) {
|
||||
return get_signal(sig PASS_REGS);
|
||||
}
|
||||
|
||||
// the caller holds the lock.
|
||||
int
|
||||
Yap_has_signals__(yap_signals sig1, yap_signals sig2 USES_REGS)
|
||||
{
|
||||
return LOCAL_Signals & (SIGNAL_TO_BIT(sig1)|SIGNAL_TO_BIT(sig2));
|
||||
int Yap_has_signals__(yap_signals sig1, yap_signals sig2 USES_REGS) {
|
||||
return LOCAL_Signals & (SIGNAL_TO_BIT(sig1) | SIGNAL_TO_BIT(sig2));
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
Yap_only_has_signals__(yap_signals sig1, yap_signals sig2 USES_REGS)
|
||||
{
|
||||
uint64_t sigs = LOCAL_Signals;
|
||||
int Yap_only_has_signals__(yap_signals sig1, yap_signals sig2 USES_REGS) {
|
||||
uint64_t sigs = LOCAL_Signals;
|
||||
return sigs & (SIGNAL_TO_BIT(sig1) | SIGNAL_TO_BIT(sig2)) &&
|
||||
! (sigs & ~(SIGNAL_TO_BIT(sig1) | SIGNAL_TO_BIT(sig2))) ;
|
||||
!(sigs & ~(SIGNAL_TO_BIT(sig1) | SIGNAL_TO_BIT(sig2)));
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
volatile int volat = 0;
|
||||
|
||||
static Int
|
||||
p_debug( USES_REGS1 )
|
||||
{ /* $debug(+Flag) */
|
||||
int i = IntOfTerm(Deref(ARG1));
|
||||
static Int p_debug(USES_REGS1) { /* $debug(+Flag) */
|
||||
int i = IntOfTerm(Deref(ARG1));
|
||||
while (volat == 0) {
|
||||
}
|
||||
if (i >= 'a' && i <= 'z')
|
||||
GLOBAL_Option[i - 96] = !GLOBAL_Option[i - 96];
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
void Yap_loop(void);
|
||||
void Yap_debug_end_loop(void);
|
||||
|
||||
void Yap_loop(void)
|
||||
{
|
||||
while (volat == 0);
|
||||
void Yap_loop(void) {
|
||||
while (volat == 0)
|
||||
;
|
||||
}
|
||||
|
||||
void Yap_debug_end_loop(void)
|
||||
{
|
||||
volat = 1;
|
||||
}
|
||||
void Yap_debug_end_loop(void) { volat = 1; }
|
||||
#endif
|
||||
|
||||
static Int
|
||||
first_signal( USES_REGS1 )
|
||||
{
|
||||
static Int first_signal(USES_REGS1) {
|
||||
Atom at;
|
||||
yap_signals sig;
|
||||
|
||||
while (TRUE) {
|
||||
uint64_t mask = LOCAL_Signals;
|
||||
if (mask == 0)
|
||||
return FALSE;
|
||||
uint64_t mask = LOCAL_Signals;
|
||||
if (mask == 0)
|
||||
return FALSE;
|
||||
#if HAVE___BUILTIN_FFSLL
|
||||
sig = __builtin_ffsll(mask);
|
||||
sig = __builtin_ffsll(mask);
|
||||
#elif HAVE_FFSLL
|
||||
sig = ffsll(mask);
|
||||
sig = ffsll(mask);
|
||||
#else
|
||||
sig = Yap_msb( mask PASS_REGS)+1;
|
||||
sig = Yap_msb(mask PASS_REGS) + 1;
|
||||
#endif
|
||||
if (get_signal(sig PASS_REGS)) {
|
||||
break;
|
||||
}
|
||||
if (get_signal(sig PASS_REGS)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
loop:
|
||||
loop:
|
||||
switch (sig) {
|
||||
case YAP_INT_SIGNAL:
|
||||
sig = ProcessSIGINT();
|
||||
if (sig == YAP_INT_SIGNAL) {
|
||||
at = AtomSigInt;
|
||||
break;
|
||||
}
|
||||
if (sig != YAP_NO_SIGNAL)
|
||||
goto loop;
|
||||
return FALSE;
|
||||
case YAP_ABORT_SIGNAL:
|
||||
/* abort computation */
|
||||
LOCAL_PrologMode &= ~AsyncIntMode;
|
||||
if (LOCAL_PrologMode & (GCMode|ConsoleGetcMode|CritMode)) {
|
||||
LOCAL_PrologMode |= AbortMode;
|
||||
return -1;
|
||||
} else {
|
||||
Yap_Error(ABORT_EVENT, TermNil, "abort from console");
|
||||
}
|
||||
Yap_RestartYap( 1 );
|
||||
return FALSE;
|
||||
case YAP_CREEP_SIGNAL:
|
||||
at = AtomSigCreep;
|
||||
break;
|
||||
case YAP_TRACE_SIGNAL:
|
||||
at = AtomSigTrace;
|
||||
break;
|
||||
case YAP_DEBUG_SIGNAL:
|
||||
at = AtomSigDebug;
|
||||
break;
|
||||
case YAP_BREAK_SIGNAL:
|
||||
at = AtomSigBreak;
|
||||
break;
|
||||
case YAP_FAIL_SIGNAL:
|
||||
at = AtomFail;
|
||||
break;
|
||||
case YAP_STACK_DUMP_SIGNAL:
|
||||
at = AtomSigStackDump;
|
||||
break;
|
||||
case YAP_STATISTICS_SIGNAL:
|
||||
at = AtomSigStatistics;
|
||||
case YAP_INT_SIGNAL:
|
||||
sig = ProcessSIGINT();
|
||||
if (sig == YAP_INT_SIGNAL) {
|
||||
at = AtomSigInt;
|
||||
break;
|
||||
}
|
||||
if (sig != YAP_NO_SIGNAL)
|
||||
goto loop;
|
||||
return FALSE;
|
||||
case YAP_ABORT_SIGNAL:
|
||||
/* abort computation */
|
||||
LOCAL_PrologMode &= ~AsyncIntMode;
|
||||
if (LOCAL_PrologMode & (GCMode | ConsoleGetcMode | CritMode)) {
|
||||
LOCAL_PrologMode |= AbortMode;
|
||||
return -1;
|
||||
} else {
|
||||
Yap_Error(ABORT_EVENT, TermNil, "abort from console");
|
||||
}
|
||||
Yap_RestartYap(1);
|
||||
return FALSE;
|
||||
case YAP_CREEP_SIGNAL:
|
||||
at = AtomSigCreep;
|
||||
break;
|
||||
case YAP_TRACE_SIGNAL:
|
||||
at = AtomSigTrace;
|
||||
break;
|
||||
case YAP_DEBUG_SIGNAL:
|
||||
at = AtomSigDebug;
|
||||
break;
|
||||
case YAP_BREAK_SIGNAL:
|
||||
at = AtomSigBreak;
|
||||
break;
|
||||
case YAP_FAIL_SIGNAL:
|
||||
at = AtomFail;
|
||||
break;
|
||||
case YAP_STACK_DUMP_SIGNAL:
|
||||
at = AtomSigStackDump;
|
||||
break;
|
||||
case YAP_STATISTICS_SIGNAL:
|
||||
at = AtomSigStatistics;
|
||||
break;
|
||||
#ifdef SIGALRM
|
||||
case YAP_ALARM_SIGNAL:
|
||||
case YAP_ALARM_SIGNAL:
|
||||
#endif
|
||||
case YAP_WINTIMER_SIGNAL:
|
||||
at = AtomSigAlarm;
|
||||
break;
|
||||
case YAP_WINTIMER_SIGNAL:
|
||||
at = AtomSigAlarm;
|
||||
break;
|
||||
#ifdef SIGVTALRM
|
||||
case YAP_VTALARM_SIGNAL:
|
||||
at = AtomSigVTAlarm;
|
||||
break;
|
||||
case YAP_VTALARM_SIGNAL:
|
||||
at = AtomSigVTAlarm;
|
||||
break;
|
||||
#endif
|
||||
case YAP_EXIT_SIGNAL:
|
||||
Yap_exit(1);
|
||||
return FALSE;
|
||||
case YAP_WAKEUP_SIGNAL:
|
||||
at = AtomSigWakeUp;
|
||||
break;
|
||||
case YAP_ITI_SIGNAL:
|
||||
at = AtomSigIti;
|
||||
break;
|
||||
case YAP_EXIT_SIGNAL:
|
||||
Yap_exit(1);
|
||||
return FALSE;
|
||||
case YAP_WAKEUP_SIGNAL:
|
||||
at = AtomSigWakeUp;
|
||||
break;
|
||||
case YAP_ITI_SIGNAL:
|
||||
at = AtomSigIti;
|
||||
break;
|
||||
#ifdef SIGPIPE
|
||||
case YAP_PIPE_SIGNAL:
|
||||
at = AtomSigPipe;
|
||||
break;
|
||||
case YAP_PIPE_SIGNAL:
|
||||
at = AtomSigPipe;
|
||||
break;
|
||||
#endif
|
||||
#ifdef SIGHUP
|
||||
case YAP_HUP_SIGNAL:
|
||||
at = AtomSigHup;
|
||||
break;
|
||||
case YAP_HUP_SIGNAL:
|
||||
at = AtomSigHup;
|
||||
break;
|
||||
#endif
|
||||
#ifdef SIGUSR1
|
||||
case YAP_USR1_SIGNAL:
|
||||
at = AtomSigUsr1;
|
||||
break;
|
||||
case YAP_USR1_SIGNAL:
|
||||
at = AtomSigUsr1;
|
||||
break;
|
||||
#endif
|
||||
#ifdef SIGUSR2
|
||||
case YAP_USR2_SIGNAL:
|
||||
at = AtomSigUsr2;
|
||||
break;
|
||||
case YAP_USR2_SIGNAL:
|
||||
at = AtomSigUsr2;
|
||||
break;
|
||||
#endif
|
||||
#ifdef SIGFPE
|
||||
case YAP_FPE_SIGNAL:
|
||||
at = AtomSigFPE;
|
||||
break;
|
||||
case YAP_FPE_SIGNAL:
|
||||
at = AtomSigFPE;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return FALSE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
return Yap_unify(ARG1, MkAtomTerm(at));
|
||||
}
|
||||
|
||||
static Int
|
||||
continue_signals( USES_REGS1 )
|
||||
{
|
||||
return first_signal( PASS_REGS1 );
|
||||
}
|
||||
static Int continue_signals(USES_REGS1) { return first_signal(PASS_REGS1); }
|
||||
|
||||
void
|
||||
Yap_InitSignalCPreds(void)
|
||||
{
|
||||
void Yap_InitSignalCPreds(void) {
|
||||
/* Basic predicates for the debugger */
|
||||
Yap_InitCPred("$creep", 0, p_creep, SafePredFlag);
|
||||
Yap_InitCPred("$creep_fail", 0, p_creep_fail, SafePredFlag);
|
||||
Yap_InitCPred("$stop_creeping", 0, stop_creeping, NoTracePredFlag|HiddenPredFlag|SafePredFlag);
|
||||
Yap_InitCPred("$disable_debugging", 0, stop_creeping, NoTracePredFlag|HiddenPredFlag|SafePredFlag);
|
||||
Yap_InitCPred ("$first_signal", 1, first_signal, SafePredFlag|SyncPredFlag);
|
||||
Yap_InitCPred ("$continue_signals", 0, continue_signals, SafePredFlag|SyncPredFlag);
|
||||
Yap_InitCPred("$stop_creeping", 1, stop_creeping,
|
||||
NoTracePredFlag | HiddenPredFlag | SafePredFlag);
|
||||
Yap_InitCPred("$disable_debugging", 0, disable_debugging,
|
||||
NoTracePredFlag | HiddenPredFlag | SafePredFlag);
|
||||
Yap_InitCPred("$first_signal", 1, first_signal, SafePredFlag | SyncPredFlag);
|
||||
Yap_InitCPred("$continue_signals", 0, continue_signals,
|
||||
SafePredFlag | SyncPredFlag);
|
||||
Yap_InitCPred("creep_allowed", 0, creep_allowed, 0);
|
||||
#ifdef DEBUG
|
||||
Yap_InitCPred("sys_debug", 1, p_debug, SafePredFlag|SyncPredFlag);
|
||||
Yap_InitCPred("sys_debug", 1, p_debug, SafePredFlag | SyncPredFlag);
|
||||
#endif
|
||||
}
|
||||
|
||||
void *Yap_InitSignals(int wid)
|
||||
{
|
||||
void *ptr = (void *)malloc(sizeof(UInt)*REMOTE_MaxActiveSignals(wid));
|
||||
void *Yap_InitSignals(int wid) {
|
||||
void *ptr = (void *)malloc(sizeof(UInt) * REMOTE_MaxActiveSignals(wid));
|
||||
return ptr;
|
||||
}
|
||||
|
21
C/stack.c
@ -1768,8 +1768,7 @@ void DumpActiveGoals(USES_REGS1) {
|
||||
if (mod == PROLOG_MODULE)
|
||||
mod = TermProlog;
|
||||
Term t = Yap_MkNewApplTerm(f, pe->ArityOfPE);
|
||||
Yap_plwrite(Yap_PredicateIndicator(t,mod),GLOBAL_Stream+2, 0, 0, 1200);
|
||||
|
||||
Yap_plwrite(Yap_PredicateIndicator(t,mod),GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
fputc( '\n', stderr );
|
||||
} else {
|
||||
UNLOCK(pe->PELock);
|
||||
@ -1798,23 +1797,23 @@ void DumpActiveGoals(USES_REGS1) {
|
||||
else
|
||||
mod = TermProlog;
|
||||
if (mod != TermProlog && mod != MkAtomTerm(AtomUser)) {
|
||||
Yap_plwrite(mod,GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(mod,GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
fputc( ':', stderr );
|
||||
}
|
||||
if (mod == IDB_MODULE) {
|
||||
if (pe->PredFlags & NumberDBPredFlag) {
|
||||
Int id = pe->src.IndxId;
|
||||
Yap_plwrite(MkIntegerTerm(id),GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(MkIntegerTerm(id),GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
} else if (pe->PredFlags & AtomDBPredFlag) {
|
||||
Atom At = (Atom)pe->FunctorOfPred;
|
||||
Yap_plwrite(MkAtomTerm(At),GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(MkAtomTerm(At),GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
} else {
|
||||
Functor f = pe->FunctorOfPred;
|
||||
Atom At = NameOfFunctor(f);
|
||||
arity_t arity = ArityOfFunctor(f);
|
||||
int i;
|
||||
|
||||
Yap_plwrite(MkAtomTerm(At),GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(MkAtomTerm(At),GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
fputc( '(', stderr );
|
||||
for (i = 0; i < arity; i++) {
|
||||
if (i > 0)
|
||||
@ -1824,14 +1823,14 @@ void DumpActiveGoals(USES_REGS1) {
|
||||
fputc( ')', stderr );
|
||||
}
|
||||
fputc( '(', stderr );
|
||||
Yap_plwrite(b_ptr->cp_a2,GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(b_ptr->cp_a2,GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
fputc( ')', stderr );
|
||||
} else if (pe->ArityOfPE == 0) {
|
||||
Yap_plwrite(MkAtomTerm((Atom)f),GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(MkAtomTerm((Atom)f),GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
} else {
|
||||
Int i = 0, arity = pe->ArityOfPE;
|
||||
if (opnum == _or_last || opnum == _or_else) {
|
||||
Yap_plwrite(MkAtomTerm(NameOfFunctor(f)),GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(MkAtomTerm(NameOfFunctor(f)),GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
fputc( '(', stderr );
|
||||
for (i = 0; i < arity; i++) {
|
||||
if (i > 0)
|
||||
@ -1841,12 +1840,12 @@ void DumpActiveGoals(USES_REGS1) {
|
||||
fputs(") :- ... ( _ ; _ ", stderr);
|
||||
} else {
|
||||
Term *args = &(b_ptr->cp_a1);
|
||||
Yap_plwrite(MkAtomTerm(NameOfFunctor(f)),GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(MkAtomTerm(NameOfFunctor(f)),GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
fputc( '(', stderr );
|
||||
for (i = 0; i < arity; i++) {
|
||||
if (i > 0)
|
||||
fputc( ',', stderr );
|
||||
Yap_plwrite(args[i],GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(args[i],GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
}
|
||||
}
|
||||
fputc( ')', stderr );
|
||||
|
71
C/stdpreds.c
@ -1,3 +1,4 @@
|
||||
|
||||
/*************************************************************************
|
||||
* *
|
||||
* YAP Prolog *
|
||||
@ -922,8 +923,9 @@ static PropEntry *nextPredForAtom(PropEntry *p, Term task) {
|
||||
if (p == NIL)
|
||||
return NIL;
|
||||
pe = RepPredProp(p);
|
||||
if (pe->ArityOfPE == 0) {
|
||||
// if atom prop, search atom list
|
||||
if (pe->ArityOfPE == 0 ||
|
||||
(pe->PredFlags & (NumberDBPredFlag |AtomDBPredFlag) ) ) {
|
||||
// if atom prop, search atom list
|
||||
return followLinkedListOfProps(p->NextOfPE, task);
|
||||
} else {
|
||||
FunctorEntry *f = pe->FunctorOfPred;
|
||||
@ -981,15 +983,7 @@ static PredEntry *firstModulePred(PredEntry *npp, Term task) {
|
||||
return npp;
|
||||
}
|
||||
|
||||
static PredEntry *firstModulesPred(PredEntry *npp, Term task) {
|
||||
ModEntry *m;
|
||||
if (npp) {
|
||||
m = Yap_GetModuleEntry(npp->ModuleOfPred);
|
||||
npp = npp->NextPredOfModule;
|
||||
} else {
|
||||
m = CurrentModules;
|
||||
npp = m->PredForME;
|
||||
}
|
||||
static PredEntry *firstModulesPred(PredEntry *npp, ModEntry *m, Term task) {
|
||||
do {
|
||||
while (npp && !valid_prop(AbsPredProp(npp), task))
|
||||
npp = npp->NextPredOfModule;
|
||||
@ -998,7 +992,8 @@ static PredEntry *firstModulesPred(PredEntry *npp, Term task) {
|
||||
m = m->NextME;
|
||||
if (m) {
|
||||
npp = m->PredForME;
|
||||
}
|
||||
} else
|
||||
return NULL;
|
||||
} while (npp || m);
|
||||
return npp;
|
||||
}
|
||||
@ -1017,21 +1012,19 @@ static Int cont_current_predicate(USES_REGS1) {
|
||||
pp = AddressOfTerm(EXTRA_CBACK_ARG(4, 1));
|
||||
if (IsNonVarTerm(t3)) {
|
||||
PropEntry *np, *p;
|
||||
|
||||
|
||||
if (IsNonVarTerm(t2)) {
|
||||
// module and functor known, should be easy
|
||||
if (IsAtomTerm(t2)) {
|
||||
if ((p = Yap_GetPredPropByAtom(AtomOfTerm(t3), t2)) &&
|
||||
valid_prop(p, task)
|
||||
) {
|
||||
valid_prop(p, task)) {
|
||||
cut_succeed();
|
||||
} else {
|
||||
cut_fail();
|
||||
}
|
||||
} else {
|
||||
if ((p = Yap_GetPredPropByFunc(FunctorOfTerm(t3), t2)) &&
|
||||
valid_prop(p, task)
|
||||
) {
|
||||
valid_prop(p, task)) {
|
||||
cut_succeed();
|
||||
} else {
|
||||
cut_fail();
|
||||
@ -1050,23 +1043,25 @@ static Int cont_current_predicate(USES_REGS1) {
|
||||
if (p == NIL)
|
||||
cut_fail();
|
||||
pp = RepPredProp(p);
|
||||
}
|
||||
}
|
||||
np = followLinkedListOfProps(p->NextOfPE, task);
|
||||
Term mod = pp->ModuleOfPred;
|
||||
if (mod == PROLOG_MODULE)
|
||||
mod = TermProlog;
|
||||
bool b = Yap_unify(t2, mod);
|
||||
if (!np) {
|
||||
if (b) cut_succeed();
|
||||
else cut_fail();
|
||||
if (b)
|
||||
cut_succeed();
|
||||
else
|
||||
cut_fail();
|
||||
} else {
|
||||
EXTRA_CBACK_ARG(4, 1) = MkAddressTerm(RepPredProp(np));
|
||||
B->cp_h = HR;
|
||||
return b;
|
||||
return b;
|
||||
}
|
||||
} else if (IsNonVarTerm(t1)) {
|
||||
PropEntry *np, *p;
|
||||
// run over the same atomany predicate defined for that atom
|
||||
// run over the same atom any predicate defined for that atom
|
||||
// may be fair bait, depends on whether we know the module.
|
||||
p = AbsPredProp(pp);
|
||||
if (!p) {
|
||||
@ -1080,6 +1075,7 @@ static Int cont_current_predicate(USES_REGS1) {
|
||||
p = getPredProp(RepAtom(at)->PropsOfAE, task);
|
||||
} else {
|
||||
Yap_Error(TYPE_ERROR_CALLABLE, t1, "current_predicate/2");
|
||||
return false;
|
||||
}
|
||||
if (!p)
|
||||
cut_fail();
|
||||
@ -1117,18 +1113,22 @@ static Int cont_current_predicate(USES_REGS1) {
|
||||
}
|
||||
} else {
|
||||
// operating across all modules.
|
||||
PredEntry *npp;
|
||||
|
||||
PredEntry *npp = pp;
|
||||
ModEntry *me;
|
||||
|
||||
if (!pp) {
|
||||
pp = firstModulesPred(CurrentModules->PredForME, task);
|
||||
if (!pp)
|
||||
cut_fail();
|
||||
pp = firstModulesPred(CurrentModules->PredForME, CurrentModules, task);
|
||||
}
|
||||
npp = firstModulesPred(pp, task);
|
||||
|
||||
if (!pp)
|
||||
cut_fail();
|
||||
if (pp->ModuleOfPred == PROLOG_MODULE)
|
||||
me = Yap_GetModuleEntry(TermProlog);
|
||||
else
|
||||
me = Yap_GetModuleEntry(pp->ModuleOfPred);
|
||||
npp = firstModulesPred(pp->NextPredOfModule, me, task);
|
||||
if (!npp)
|
||||
will_cut = true;
|
||||
// just try next one
|
||||
// just try next module.
|
||||
else {
|
||||
EXTRA_CBACK_ARG(4, 1) = MkAddressTerm(npp);
|
||||
B->cp_h = HR;
|
||||
@ -1588,7 +1588,7 @@ static Int p_unlock_system(USES_REGS1) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Int p_enterundefp(USES_REGS1) {
|
||||
static Int enter_undefp(USES_REGS1) {
|
||||
if (LOCAL_DoingUndefp) {
|
||||
return FALSE;
|
||||
}
|
||||
@ -1596,7 +1596,7 @@ static Int p_enterundefp(USES_REGS1) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Int p_exitundefp(USES_REGS1) {
|
||||
static Int exit_undefp(USES_REGS1) {
|
||||
if (LOCAL_DoingUndefp) {
|
||||
LOCAL_DoingUndefp = FALSE;
|
||||
return TRUE;
|
||||
@ -1745,8 +1745,8 @@ void Yap_InitCPreds(void) {
|
||||
Yap_InitCPred("$halt", 1, p_halt, SyncPredFlag);
|
||||
Yap_InitCPred("$lock_system", 0, p_lock_system, SafePredFlag);
|
||||
Yap_InitCPred("$unlock_system", 0, p_unlock_system, SafePredFlag);
|
||||
Yap_InitCPred("$enter_undefp", 0, p_enterundefp, SafePredFlag);
|
||||
Yap_InitCPred("$exit_undefp", 0, p_exitundefp, SafePredFlag);
|
||||
Yap_InitCPred("$enter_undefp", 0, enter_undefp, SafePredFlag);
|
||||
Yap_InitCPred("$exit_undefp", 0, exit_undefp, SafePredFlag);
|
||||
|
||||
#ifdef YAP_JIT
|
||||
Yap_InitCPred("$jit_init", 1, p_jit, SafePredFlag | SyncPredFlag);
|
||||
@ -1772,6 +1772,7 @@ void Yap_InitCPreds(void) {
|
||||
Yap_InitCmpPreds();
|
||||
Yap_InitCoroutPreds();
|
||||
Yap_InitDBPreds();
|
||||
Yap_InitErrorPreds();
|
||||
Yap_InitExecFs();
|
||||
Yap_InitGlobals();
|
||||
Yap_InitInlines();
|
||||
@ -1799,9 +1800,7 @@ void Yap_InitCPreds(void) {
|
||||
#ifdef ANALYST
|
||||
Yap_InitAnalystPreds();
|
||||
#endif
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
Yap_InitLowLevelTrace();
|
||||
#endif
|
||||
Yap_InitEval();
|
||||
Yap_InitGrowPreds();
|
||||
Yap_InitLowProf();
|
||||
|
4
C/text.c
@ -969,9 +969,7 @@ write_number( void *s0, seq_tv_t *out, encoding_t enc, int minimal, int size USE
|
||||
static Term
|
||||
string_to_term( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng USES_REGS)
|
||||
{
|
||||
printf("TR0=%p\n", TR);
|
||||
Term o = out->val.t = Yap_StringToTerm(s0, strlen(s0)+1, &enc, 1200, NULL);
|
||||
printf("TRF=%p\n", TR);
|
||||
Term o = out->val.t = Yap_StringToTerm(s0, strlen(s0)+1, &enc, GLOBAL_MaxPriority, NULL);
|
||||
return o;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ static char SccsId[] = "%W% %G%";
|
||||
#include "yapio.h"
|
||||
#include "blobs.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#if HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
@ -1565,7 +1566,9 @@ p_thread_unlock( USES_REGS1 )
|
||||
intptr_t
|
||||
system_thread_id(void)
|
||||
{
|
||||
#if HAVE_SYS_GETTID
|
||||
#if defined(__APPLE__)
|
||||
return syscall(SYS_thread_selfid);
|
||||
#elif HAVE_SYS_GETTID || defined(__APPLE__)
|
||||
return syscall( SYS_GETTID );
|
||||
#elif HAVE_GETTID_SYSCALL
|
||||
return syscall(__NR_gettid);
|
||||
|
@ -14334,10 +14334,7 @@ S_SREG = RepAppl(d0);
|
||||
}
|
||||
#endif /* FROZEN_STACKS */
|
||||
d0 = ARG1;
|
||||
if (PRED_GOAL_EXPANSION_ALL) {
|
||||
goto execute_metacall;
|
||||
}
|
||||
restart_execute:
|
||||
restart_execute:
|
||||
deref_head(d0, execute_unk);
|
||||
execute_nvar:
|
||||
if (IsApplTerm(d0)) {
|
||||
|
30
C/tracer.c
@ -50,7 +50,8 @@ static void send_tracer_message(char *start, char *name, Int arity, char *mname,
|
||||
for (i = 0; i < arity; i++) {
|
||||
if (i > 0)
|
||||
fprintf(stderr, ",");
|
||||
Yap_plwrite(args[i], NULL, 15, Handle_vars_f | AttVar_Portray_f, 1200);
|
||||
Yap_plwrite(args[i], NULL, 15, Handle_vars_f | AttVar_Portray_f,
|
||||
GLOBAL_MaxPriority);
|
||||
}
|
||||
if (arity) {
|
||||
fprintf(stderr, ")");
|
||||
@ -172,10 +173,10 @@ void low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) {
|
||||
#endif
|
||||
|
||||
// if (!worker_id) return;
|
||||
LOCK(Yap_heap_regs->low_level_trace_lock);
|
||||
LOCK(Yap_low_level_trace_lock);
|
||||
sc = Yap_heap_regs;
|
||||
// if (vsc_count == 161862) jmp_deb(1);
|
||||
#ifdef THREADS
|
||||
// if (vsc_count == 161862) jmp_deb(1);
|
||||
#ifdef THREADS
|
||||
LOCAL_ThreadHandle.thread_inst_count++;
|
||||
#endif
|
||||
#ifdef COMMENTED
|
||||
@ -319,17 +320,17 @@ void low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) {
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
fprintf(stderr, "%lld ", vsc_count);
|
||||
fprintf(stderr, "%lld %ld ", vsc_count, LCL0 - (CELL *)B);
|
||||
#if defined(THREADS) || defined(YAPOR)
|
||||
fprintf(stderr, "(%d)", worker_id);
|
||||
#endif
|
||||
/* check_trail_consistency(); */
|
||||
if (pred == NULL) {
|
||||
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
||||
UNLOCK(Yap_low_level_trace_lock);
|
||||
return;
|
||||
}
|
||||
if (pred->ModuleOfPred == 0 && !LOCAL_do_trace_primitives) {
|
||||
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
||||
UNLOCK(Yap_low_level_trace_lock);
|
||||
return;
|
||||
}
|
||||
switch (port) {
|
||||
@ -405,7 +406,7 @@ void low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) {
|
||||
break;
|
||||
}
|
||||
fflush(NULL);
|
||||
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
||||
UNLOCK(Yap_low_level_trace_lock);
|
||||
}
|
||||
|
||||
void toggle_low_level_trace(void) {
|
||||
@ -475,6 +476,8 @@ static Int vsc_go(USES_REGS1) {
|
||||
void Yap_InitLowLevelTrace(void) {
|
||||
Yap_InitCPred("start_low_level_trace", 0, start_low_level_trace,
|
||||
SafePredFlag);
|
||||
Yap_InitCPred("$start_low_level_trace", 0, start_low_level_trace,
|
||||
SafePredFlag);
|
||||
/** @pred start_low_level_trace
|
||||
|
||||
|
||||
@ -488,6 +491,7 @@ Begin display of messages at procedure entry and retry.
|
||||
#endif
|
||||
Yap_InitCPred("stop_low_level_trace", 0, stop_low_level_trace, SafePredFlag);
|
||||
Yap_InitCPred("show_low_level_trace", 0, show_low_level_trace, SafePredFlag);
|
||||
Yap_InitCPred("$stop_low_level_trace", 0, stop_low_level_trace, SafePredFlag);
|
||||
Yap_InitCPred("total_choicepoints", 1, total_choicepoints, SafePredFlag);
|
||||
Yap_InitCPred("reset_total_choicepoints", 0, reset_total_choicepoints,
|
||||
SafePredFlag);
|
||||
@ -495,4 +499,14 @@ Begin display of messages at procedure entry and retry.
|
||||
Yap_InitCPred("vsc_go", 0, vsc_go, SafePredFlag);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static null(USES_REGS1) { return true; }
|
||||
|
||||
void Yap_InitLowLevelTrace(void) {
|
||||
Yap_InitCPred("$start_low_level_trace", 0, null,
|
||||
SafePredFlag | HiddenPredFlag);
|
||||
Yap_InitCPred("$stop_low_level_trace", 0, null,
|
||||
SafePredFlag | HiddenPredFlag);
|
||||
}
|
||||
#endif
|
||||
|
@ -558,7 +558,7 @@ static int p_grab_tokens() {
|
||||
char ch, IdChars[256], *chp;
|
||||
|
||||
IdFunctor = FunctorId;
|
||||
VarFunctor = FunctorVar;
|
||||
VarFunctor = FunctorDollarVar;
|
||||
p0 = p;
|
||||
ch = Yap_PlGetchar();
|
||||
while (1) {
|
||||
|
@ -1680,9 +1680,17 @@ static Term attvars_in_complex_term(register CELL *pt0, register CELL *pt0_end,
|
||||
attvars_in_term_nvar:
|
||||
{
|
||||
if (IsPairTerm(d0)) {
|
||||
if (to_visit + 1024 >= (CELL **)AuxSp) {
|
||||
goto aux_overflow;
|
||||
}
|
||||
if (to_visit + 1024 >= (CELL **)AuxSp) {
|
||||
goto aux_overflow;
|
||||
}
|
||||
{
|
||||
CELL *npt0 = RepPair(d0);
|
||||
if(IsAtomicTerm(Deref(npt0[0]))) {
|
||||
pt0 = npt0;
|
||||
pt0_end = pt0 + 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#ifdef RATIONAL_TREES
|
||||
to_visit[0] = pt0;
|
||||
to_visit[1] = pt0_end;
|
||||
@ -1697,7 +1705,7 @@ static Term attvars_in_complex_term(register CELL *pt0, register CELL *pt0_end,
|
||||
}
|
||||
#endif
|
||||
pt0 = RepPair(d0) - 1;
|
||||
pt0_end = RepPair(d0) + 1;
|
||||
pt0_end = pt0+2;
|
||||
} else if (IsApplTerm(d0)) {
|
||||
register Functor f;
|
||||
register CELL *ap2;
|
||||
@ -1739,14 +1747,14 @@ static Term attvars_in_complex_term(register CELL *pt0, register CELL *pt0_end,
|
||||
/* next make sure noone will see this as a variable again */
|
||||
if (TR > (tr_fr_ptr)LOCAL_TrailTop - 256) {
|
||||
/* Trail overflow */
|
||||
if (!Yap_growtrail((TR-TR0)*sizeof(tr_fr_ptr *), TRUE)) {
|
||||
goto trail_overflow;
|
||||
}
|
||||
if (!Yap_growtrail((TR-TR0)*sizeof(tr_fr_ptr *), TRUE)) {
|
||||
goto trail_overflow;
|
||||
}
|
||||
}
|
||||
TrailTerm(TR++) = (CELL)ptd0;
|
||||
/* leave an empty slot to fill in later */
|
||||
if (HR+1024 > ASP) {
|
||||
goto global_overflow;
|
||||
goto global_overflow;
|
||||
}
|
||||
HR[1] = AbsPair(HR+2);
|
||||
HR += 2;
|
||||
@ -4584,7 +4592,7 @@ numbervar(Int id USES_REGS)
|
||||
{
|
||||
Term ts[1];
|
||||
ts[0] = MkIntegerTerm(id);
|
||||
return Yap_MkApplTerm(LOCAL_FunctorVar, 1, ts);
|
||||
return Yap_MkApplTerm(FunctorDollarVar, 1, ts);
|
||||
}
|
||||
|
||||
static Term
|
||||
@ -4592,7 +4600,7 @@ numbervar_singleton(USES_REGS1)
|
||||
{
|
||||
Term ts[1];
|
||||
ts[0] = MkIntegerTerm(-1);
|
||||
return Yap_MkApplTerm(LOCAL_FunctorVar, 1, ts);
|
||||
return Yap_MkApplTerm(FunctorDollarVar, 1, ts);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -4904,7 +4912,7 @@ unnumber_complex_term(CELL *pt0, CELL *pt0_end, CELL *ptf, CELL *HLow, int share
|
||||
*ptf++ = d0; /* you can just unnumber other extensions. */
|
||||
continue;
|
||||
}
|
||||
if (f == FunctorVar) {
|
||||
if (f == FunctorDollarVar) {
|
||||
Int id = IntegerOfTerm(ap2[1]);
|
||||
ground = FALSE;
|
||||
if (id < -1) {
|
||||
|
53
C/write.c
@ -444,33 +444,37 @@ static int legalAtom(unsigned char *s) /* Is this a legal atom ? */
|
||||
return (s[1] == '}' && !s[2]);
|
||||
} else if (Yap_chtype[ch] == SL) {
|
||||
return (!s[1]);
|
||||
} else if (ch == '`') {
|
||||
return false;
|
||||
} else if ((ch == ',' || ch == '.') && !s[1]) {
|
||||
return FALSE;
|
||||
return false;
|
||||
} else {
|
||||
if (ch == '/') {
|
||||
if (s[1] == '*')
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
while (ch) {
|
||||
if (Yap_chtype[ch] != SY) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
ch = *++s;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
} else
|
||||
while ((ch = *++s) != 0)
|
||||
if (Yap_chtype[ch] > NU)
|
||||
return FALSE;
|
||||
return (TRUE);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static wtype
|
||||
AtomIsSymbols(unsigned char *s) /* Is this atom just formed by symbols ? */
|
||||
{
|
||||
int ch;
|
||||
if (Yap_chtype[(int)s[0]] == SL && s[1] == '\0')
|
||||
if ( Yap_chtype[(int)s[0]] == SL &&
|
||||
s[1] == '\0'
|
||||
)
|
||||
return (separator);
|
||||
while ((ch = *s++) != '\0') {
|
||||
if (Yap_chtype[ch] != SY)
|
||||
@ -707,7 +711,7 @@ static Term from_pointer(CELL *ptr0, struct rewind_term *rwt,
|
||||
|
||||
if (!IsAtomicTerm(t) && !IsVarTerm(t)) {
|
||||
while (x) {
|
||||
if (Yap_GetDerefedFromSlot(x->u_sd.s.old PASS_REGS) == t)
|
||||
if (Yap_GetDerefedFromSlot(x->u_sd.s.old) == t)
|
||||
return TermFoundVar;
|
||||
x = x->parent;
|
||||
}
|
||||
@ -734,8 +738,8 @@ static CELL *restore_from_write(struct rewind_term *rwt,
|
||||
CELL *ptr;
|
||||
|
||||
if (wglb->Keep_terms) {
|
||||
ptr = (CELL *)Yap_GetPtrFromSlot(rwt->u_sd.s.ptr PASS_REGS);
|
||||
Yap_RecoverSlots(2, rwt->u_sd.s.old PASS_REGS);
|
||||
ptr = Yap_GetPtrFromSlot(rwt->u_sd.s.ptr );
|
||||
Yap_RecoverSlots(2, rwt->u_sd.s.old );
|
||||
// printf("leak=%d %d\n", LOCALCurSlot,rwt->u_sd.s.old) ;
|
||||
} else {
|
||||
ptr = rwt->u_sd.d.ptr;
|
||||
@ -840,6 +844,9 @@ static void write_list(Term t, int direction, int depth,
|
||||
do_jump = (direction >= 0);
|
||||
}
|
||||
if (wglb->MaxDepth != 0 && depth > wglb->MaxDepth) {
|
||||
if (lastw == symbol || lastw == separator) {
|
||||
wrputc(' ', wglb->stream);
|
||||
}
|
||||
wrputc('|', wglb->stream);
|
||||
putAtom(Atom3Dots, wglb->Quote_illegal, wglb);
|
||||
return;
|
||||
@ -856,6 +863,9 @@ static void write_list(Term t, int direction, int depth,
|
||||
Term nt = from_pointer(RepPair(t) + 1, &nrwt, wglb);
|
||||
/* we found an infinite loop */
|
||||
if (IsAtomTerm(nt)) {
|
||||
if (lastw == symbol || lastw == separator) {
|
||||
wrputc(' ', wglb->stream);
|
||||
}
|
||||
wrputc('|', wglb->stream);
|
||||
writeTerm(nt, 999, depth, FALSE, wglb, rwt);
|
||||
} else {
|
||||
@ -865,6 +875,9 @@ static void write_list(Term t, int direction, int depth,
|
||||
}
|
||||
restore_from_write(&nrwt, wglb);
|
||||
} else if (ti != MkAtomTerm(AtomNil)) {
|
||||
if (lastw == symbol || lastw == separator) {
|
||||
wrputc(' ', wglb->stream);
|
||||
}
|
||||
wrputc('|', wglb->stream);
|
||||
lastw = separator;
|
||||
writeTerm(from_pointer(RepPair(t) + 1, &nrwt, wglb), 999, depth, FALSE,
|
||||
@ -1101,6 +1114,9 @@ static void writeTerm(Term t, int p, int depth, int rinfixarg,
|
||||
wrputc(',', wglb->stream);
|
||||
lastw = separator;
|
||||
} else if (!strcmp((char *)RepAtom(atom)->StrOfAE, "|")) {
|
||||
if (lastw == symbol || lastw == separator) {
|
||||
wrputc(' ', wglb->stream);
|
||||
}
|
||||
wrputc('|', wglb->stream);
|
||||
lastw = separator;
|
||||
} else
|
||||
@ -1117,14 +1133,17 @@ static void writeTerm(Term t, int p, int depth, int rinfixarg,
|
||||
if (op > p) {
|
||||
wrclose_bracket(wglb, TRUE);
|
||||
}
|
||||
} else if (wglb->Handle_vars && functor == LOCAL_FunctorVar) {
|
||||
} else if ( functor == FunctorDollarVar) {
|
||||
Term ti = ArgOfTerm(1, t);
|
||||
if (lastw == alphanum) {
|
||||
wrputc(' ', wglb->stream);
|
||||
}
|
||||
if (!IsVarTerm(ti) &&
|
||||
(IsIntTerm(ti) || IsCodesTerm(ti) ||
|
||||
IsAtomTerm(ti) || IsStringTerm(ti) )) {
|
||||
if (wglb->Handle_vars &&
|
||||
!IsVarTerm(ti) &&
|
||||
(IsIntTerm(ti) ||
|
||||
IsCodesTerm(ti) ||
|
||||
IsAtomTerm(ti) ||
|
||||
IsStringTerm(ti) )) {
|
||||
if (IsIntTerm(ti)) {
|
||||
Int k = IntOfTerm(ti);
|
||||
if (k == -1) {
|
||||
@ -1158,7 +1177,7 @@ static void writeTerm(Term t, int p, int depth, int rinfixarg,
|
||||
} else if (!wglb->Ignore_ops && functor == FunctorBraces) {
|
||||
wrputc('{', wglb->stream);
|
||||
lastw = separator;
|
||||
writeTerm(from_pointer(RepAppl(t) + 1, &nrwt, wglb), 1200, depth + 1,
|
||||
writeTerm(from_pointer(RepAppl(t) + 1, &nrwt, wglb), GLOBAL_MaxPriority, depth + 1,
|
||||
FALSE, wglb, &nrwt);
|
||||
restore_from_write(&nrwt, wglb);
|
||||
wrputc('}', wglb->stream);
|
||||
@ -1215,7 +1234,7 @@ void Yap_plwrite(Term t, StreamDesc *mywrite, int max_depth, int flags,
|
||||
CACHE_REGS
|
||||
struct write_globs wglb;
|
||||
struct rewind_term rwt;
|
||||
yhandle_t sls = Yap_CurrentSlot(PASS_REGS1);
|
||||
yhandle_t sls = Yap_CurrentSlot();
|
||||
|
||||
if (!mywrite) {
|
||||
CACHE_REGS
|
||||
@ -1269,7 +1288,7 @@ char *Yap_TermToString(Term t, char *s, size_t sz, size_t *length,
|
||||
GLOBAL_Stream[sno].encoding = *encp;
|
||||
else
|
||||
GLOBAL_Stream[sno].encoding = LOCAL_encoding;
|
||||
Yap_plwrite(t, GLOBAL_Stream + sno, 0, flags, 1200);
|
||||
Yap_plwrite(t, GLOBAL_Stream + sno, 0, flags, GLOBAL_MaxPriority);
|
||||
s = Yap_MemExportStreamPtr(sno);
|
||||
Yap_CloseStream(sno);
|
||||
LOCAL_c_output_stream = old_output_stream;
|
||||
|
@ -12,6 +12,8 @@ cmake_minimum_required(VERSION 2.8)
|
||||
# set path to additional CMake modules
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
|
||||
|
||||
|
||||
|
||||
# set(CMAKE_BUILD_TYPE Debug)
|
||||
|
||||
set (MACOSX_RPATH ON)
|
||||
@ -28,14 +30,18 @@ set(YAP_MAJOR_VERSION 6)
|
||||
set(YAP_MINOR_VERSION 3)
|
||||
set(YAP_PATCH_VERSION 4)
|
||||
|
||||
set(YAP_SYSTEM_OPTIONS "attributed_variables" )
|
||||
|
||||
if (WIN32)
|
||||
set (YAP_ARCH $ENV{PROCESSOR_ARCHITECTURE})
|
||||
set(YAP_SYSTEM_OPTIONS "windows " ${YAP_SYSTEM_OPTIONS})
|
||||
endif()
|
||||
if (UNIX)
|
||||
find_program (UNAME uname)
|
||||
execute_process (
|
||||
COMMAND ${UNAME} -m
|
||||
OUTPUT_VARIABLE YAP_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
set(YAP_SYSTEM_OPTIONS "unix " ${YAP_SYSTEM_OPTIONS})
|
||||
endif()
|
||||
|
||||
set(YAP_FULL_VERSION
|
||||
@ -92,21 +98,22 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
#cmake_policy( NO_POLICY_SCOPE )
|
||||
endif()
|
||||
|
||||
set (BUILD_SHARED_LIBS ON)
|
||||
|
||||
## define system
|
||||
|
||||
include (Sources)
|
||||
|
||||
|
||||
add_library(libYap SHARED
|
||||
add_library(libYap
|
||||
${ENGINE_SOURCES}
|
||||
${C_INTERFACE_SOURCES}
|
||||
${STATIC_SOURCES}
|
||||
${OPTYAP_SOURCES}
|
||||
${HEADERS}
|
||||
$<TARGET_OBJECTS:libYAPOs>
|
||||
$<TARGET_OBJECTS:libYAPOs>
|
||||
$<TARGET_OBJECTS:libOPTYap>
|
||||
# $<TARGET_OBJECTS:myddas>
|
||||
$<TARGET_OBJECTS:myddas>
|
||||
)
|
||||
|
||||
set_property(DIRECTORY PROPERTY CXX_STANDARD 11)
|
||||
@ -232,7 +239,11 @@ endif()
|
||||
# Model Specific
|
||||
if (HAVE_GCC)
|
||||
set_property( DIRECTORY APPEND PROPERTY COMPILE_OPTIONS -Wall )
|
||||
if ( ${C_COMPILER} MATCHES "GNU")
|
||||
set_property( DIRECTORY APPEND PROPERTY COMPILE_OPTIONS $<$<CONFIG:Release>:-O3;-fomit-frame-pointer;-fstrict-aliasing;-freorder-blocks;-fsched-interblock> )
|
||||
else()
|
||||
set_property( DIRECTORY APPEND PROPERTY COMPILE_OPTIONS $<$<CONFIG:Release>:-O3;-fstrict-aliasing;-freorder-blocks;-fsched-interblock> )
|
||||
endif()
|
||||
set_property( DIRECTORY APPEND PROPERTY COMPILE_OPTIONS -fexceptions )
|
||||
endif()
|
||||
|
||||
@ -249,15 +260,14 @@ if (HAVE_GCC)
|
||||
endif (HAVE_GCC)
|
||||
|
||||
#
|
||||
set (BUILD_SHARED_LIBS ON)
|
||||
|
||||
#option (YAP_SWI_IO ON)
|
||||
|
||||
OPTION (WITH_CALL_TRACER
|
||||
"support for procedure-call tracing" ON)
|
||||
#TODO:
|
||||
if (WITH_CALL_TRACER)
|
||||
set_property( DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:LOW_LEVEL_TRACER=1> )
|
||||
set(YAP_SYSTEM_OPTIONS "call_tracer " ${YAP_SYSTEM_OPTIONS})
|
||||
set_property( DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:LOW_LEVEL_TRACER=1> )
|
||||
endif (WITH_CALL_TRACER)
|
||||
|
||||
#set( CMAKE_REQUIRED_LIBRARIES ${READLINE_LIBS} ${CMAKE_REQUIRED_LIBRARIES} )
|
||||
@ -275,6 +285,7 @@ macro_log_feature (GMP_FOUND
|
||||
"libgmp"
|
||||
"GNU big integers and rationals"
|
||||
"http://gmplib.org")
|
||||
set(YAP_SYSTEM_OPTIONS "big_numbers " ${YAP_SYSTEM_OPTIONS})
|
||||
if (GMP_FOUND)
|
||||
include_directories (${GMP_INCLUDE_DIR})
|
||||
#add_executable(test ${SOURCES})
|
||||
@ -323,7 +334,8 @@ if (WITH_Threads)
|
||||
check_function_exists( pthread_mutexattr_settype HAVE_PTHREAD_MUTEXATTR_SETTYPE )
|
||||
check_function_exists( pthread_setconcurrency HAVE_PTHREAD_SETCONCURRENCY )
|
||||
endif (CMAKE_USE_PTHREADS_INIT)
|
||||
set_property( DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS THREADS=1)
|
||||
set(YAP_SYSTEM_OPTIONS "threads " ${YAP_SYSTEM_OPTIONS})
|
||||
set_property( DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS THREADS=1)
|
||||
#
|
||||
# Please note that the compiler flag can only be used with the imported
|
||||
# target. Use of both the imported target as well as this switch is highly
|
||||
@ -344,7 +356,6 @@ IF(WITH_Pthread_Lockin)
|
||||
set_DIRECTORY_properties(PROPERTIES APPEND COMPILE_DEFINITIONS USE_PTHREAD_LOCKING=1)
|
||||
ENDIF()
|
||||
|
||||
|
||||
#
|
||||
# include OS and I/o stuff
|
||||
#
|
||||
@ -353,7 +364,7 @@ ENDIF()
|
||||
#
|
||||
add_subDIRECTORY (OPTYap)
|
||||
|
||||
#add_subDIRECTORY (packages/myddas)
|
||||
add_subDIRECTORY (packages/myddas)
|
||||
|
||||
|
||||
add_subDIRECTORY (os)
|
||||
@ -369,6 +380,7 @@ ADD_SUBDIRECTORY(swi/library)
|
||||
# ADD_SUBDIRECTORY(os)
|
||||
# ADD_SUBDIRECTORY(packages)
|
||||
|
||||
|
||||
option (WITH_JIT
|
||||
"just in Time Clause Compilation" OFF)
|
||||
if (WITH_JIT)
|
||||
@ -397,6 +409,8 @@ add_subDIRECTORY (packages/cplint)
|
||||
|
||||
add_subDIRECTORY (packages/raptor)
|
||||
|
||||
add_subDIRECTORY (packages/xml)
|
||||
|
||||
add_subDIRECTORY (docs)
|
||||
|
||||
# add_subDIRECTORY (packages/cuda)
|
||||
|
@ -428,7 +428,7 @@ YAPQuery::initQuery( YAPTerm ts[], arity_t arity )
|
||||
if (arity) {
|
||||
q_g = Yap_NewSlots( arity );
|
||||
for (arity_t i=0; i < arity; i++) {
|
||||
Yap_PutInSlot(q_g+i, ts[i].term() PASS_REGS);
|
||||
Yap_PutInSlot(q_g+i, ts[i].term());
|
||||
}
|
||||
Term t = Yap_MkApplTerm(ap->FunctorOfPred, ap->ArityOfPE, Yap_AddressFromSlot(q_g));
|
||||
goal = YAPTerm( t );
|
||||
|
@ -1,2 +1,2 @@
|
||||
#define GIT_SHA1 "036876299f12a4761f8d1de2dfba9709d5c91739"
|
||||
#define GIT_SHA1 "713e9dc9d83c385f5bdd57c8cfa4c7771a6cdb12"
|
||||
const char g_GIT_SHA1[] = GIT_SHA1;
|
||||
|
674
H/TermExt.h
@ -17,108 +17,90 @@
|
||||
|
||||
@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
|
||||
#define SF_STORE (&(Yap_heap_regs->funcs))
|
||||
#define SF_STORE (&(Yap_heap_regs->funcs))
|
||||
#else
|
||||
#define SF_STORE ((special_functors *)HEAP_INIT_BASE)
|
||||
#define SF_STORE ((special_functors *)HEAP_INIT_BASE)
|
||||
#endif
|
||||
|
||||
#if defined(USE_OFFSETS)
|
||||
#define AtomFoundVar ((Atom)(&(((special_functors *)(NULL))->AtFoundVar)))
|
||||
#define AtomFreeTerm ((Atom)(&(((special_functors *)(NULL))->AtFreeTerm)))
|
||||
#define AtomNil ((Atom)(&(((special_functors *)(NULL))->AtNil)))
|
||||
#define AtomDot ((Atom)(&(((special_functors *)(NULL))->AtDot)))
|
||||
#define AtomFoundVar ((Atom)(&(((special_functors *)(NULL))->AtFoundVar)))
|
||||
#define AtomFreeTerm ((Atom)(&(((special_functors *)(NULL))->AtFreeTerm)))
|
||||
#define AtomNil ((Atom)(&(((special_functors *)(NULL))->AtNil)))
|
||||
#define AtomDot ((Atom)(&(((special_functors *)(NULL))->AtDot)))
|
||||
#elif OLD_STYLE_INITIAL_ATOMS
|
||||
#define AtomFoundVar AbsAtom((AtomEntry *)&(SF_STORE->AtFoundVar))
|
||||
#define AtomFreeTerm AbsAtom((AtomEntry *)&(SF_STORE->AtFreeTerm))
|
||||
#define AtomNil AbsAtom((AtomEntry *)&(SF_STORE->AtNil))
|
||||
#define AtomDot AbsAtom((AtomEntry *)&(SF_STORE->AtDot))
|
||||
#define AtomFoundVar AbsAtom((AtomEntry *)&(SF_STORE->AtFoundVar))
|
||||
#define AtomFreeTerm AbsAtom((AtomEntry *)&(SF_STORE->AtFreeTerm))
|
||||
#define AtomNil AbsAtom((AtomEntry *)&(SF_STORE->AtNil))
|
||||
#define AtomDot AbsAtom((AtomEntry *)&(SF_STORE->AtDot))
|
||||
#else
|
||||
#define AtomFoundVar AbsAtom(SF_STORE->AtFoundVar)
|
||||
#define AtomFreeTerm AbsAtom(SF_STORE->AtFreeTerm)
|
||||
#define AtomNil AbsAtom(SF_STORE->AtNil)
|
||||
#define AtomDot AbsAtom(SF_STORE->AtDot)
|
||||
#define AtomFoundVar AbsAtom(SF_STORE->AtFoundVar)
|
||||
#define AtomFreeTerm AbsAtom(SF_STORE->AtFreeTerm)
|
||||
#define AtomNil AbsAtom(SF_STORE->AtNil)
|
||||
#define AtomDot AbsAtom(SF_STORE->AtDot)
|
||||
#endif
|
||||
|
||||
#define TermFoundVar MkAtomTerm(AtomFoundVar)
|
||||
#define TermFreeTerm MkAtomTerm(AtomFreeTerm)
|
||||
#define TermNil MkAtomTerm(AtomNil)
|
||||
#define TermDot MkAtomTerm(AtomDot)
|
||||
#define TermFoundVar MkAtomTerm(AtomFoundVar)
|
||||
#define TermFreeTerm MkAtomTerm(AtomFreeTerm)
|
||||
#define TermNil MkAtomTerm(AtomNil)
|
||||
#define TermDot MkAtomTerm(AtomDot)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
db_ref_e = sizeof (Functor *),
|
||||
attvar_e = 2*sizeof (Functor *),
|
||||
double_e = 3 * sizeof (Functor *),
|
||||
long_int_e = 4 * sizeof (Functor *),
|
||||
big_int_e = 5 * sizeof (Functor *),
|
||||
string_e = 6 * sizeof (Functor *)
|
||||
}
|
||||
blob_type;
|
||||
typedef enum {
|
||||
db_ref_e = sizeof(Functor *),
|
||||
attvar_e = 2 * sizeof(Functor *),
|
||||
double_e = 3 * sizeof(Functor *),
|
||||
long_int_e = 4 * sizeof(Functor *),
|
||||
big_int_e = 5 * sizeof(Functor *),
|
||||
string_e = 6 * sizeof(Functor *)
|
||||
} blob_type;
|
||||
|
||||
#define FunctorDBRef ((Functor)(db_ref_e))
|
||||
#define FunctorAttVar ((Functor)(attvar_e))
|
||||
#define FunctorDouble ((Functor)(double_e))
|
||||
#define FunctorLongInt ((Functor)(long_int_e))
|
||||
#define FunctorBigInt ((Functor)(big_int_e))
|
||||
#define FunctorString ((Functor)(string_e))
|
||||
#define EndSpecials (string_e+sizeof(Functor *))
|
||||
#define FunctorDBRef ((Functor)(db_ref_e))
|
||||
#define FunctorAttVar ((Functor)(attvar_e))
|
||||
#define FunctorDouble ((Functor)(double_e))
|
||||
#define FunctorLongInt ((Functor)(long_int_e))
|
||||
#define FunctorBigInt ((Functor)(big_int_e))
|
||||
#define FunctorString ((Functor)(string_e))
|
||||
#define EndSpecials (string_e + sizeof(Functor *))
|
||||
|
||||
#include "inline-only.h"
|
||||
|
||||
#define IsAttVar(pt) __IsAttVar((pt) PASS_REGS)
|
||||
#define IsAttVar(pt) __IsAttVar((pt)PASS_REGS)
|
||||
|
||||
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
|
||||
__IsAttVar (CELL *pt USES_REGS)
|
||||
{
|
||||
INLINE_ONLY inline EXTERN int __IsAttVar(CELL *pt USES_REGS) {
|
||||
#ifdef YAP_H
|
||||
return (pt)[-1] == (CELL)attvar_e
|
||||
&& pt < HR;
|
||||
return (pt)[-1] == (CELL)attvar_e && pt < HR;
|
||||
#else
|
||||
return (pt)[-1] == (CELL)attvar_e;
|
||||
#endif
|
||||
}
|
||||
|
||||
INLINE_ONLY inline EXTERN int GlobalIsAttVar (CELL *pt);
|
||||
INLINE_ONLY inline EXTERN int GlobalIsAttVar(CELL *pt);
|
||||
|
||||
INLINE_ONLY inline EXTERN int
|
||||
GlobalIsAttVar (CELL *pt)
|
||||
{
|
||||
INLINE_ONLY inline EXTERN int GlobalIsAttVar(CELL *pt) {
|
||||
return (pt)[-1] == (CELL)attvar_e;
|
||||
}
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BIG_INT = 0x01,
|
||||
BIG_RATIONAL = 0x02,
|
||||
BIG_FLOAT = 0x04,
|
||||
EMPTY_ARENA = 0x10,
|
||||
ARRAY_INT = 0x21,
|
||||
ARRAY_FLOAT = 0x22,
|
||||
CLAUSE_LIST = 0x40,
|
||||
EXTERNAL_BLOB = 0x100, /* generic data */
|
||||
USER_BLOB_START = 0x1000, /* user defined blob */
|
||||
USER_BLOB_END = 0x1100 /* end of user defined blob */
|
||||
}
|
||||
big_blob_type;
|
||||
typedef enum {
|
||||
BIG_INT = 0x01,
|
||||
BIG_RATIONAL = 0x02,
|
||||
BIG_FLOAT = 0x04,
|
||||
EMPTY_ARENA = 0x10,
|
||||
ARRAY_INT = 0x21,
|
||||
ARRAY_FLOAT = 0x22,
|
||||
CLAUSE_LIST = 0x40,
|
||||
EXTERNAL_BLOB = 0x100, /* generic data */
|
||||
USER_BLOB_START = 0x1000, /* user defined blob */
|
||||
USER_BLOB_END = 0x1100 /* end of user defined blob */
|
||||
} 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
|
||||
BlobOfFunctor (Functor f)
|
||||
{
|
||||
return (blob_type) ((CELL)f);
|
||||
INLINE_ONLY inline EXTERN blob_type BlobOfFunctor(Functor f) {
|
||||
return (blob_type)((CELL)f);
|
||||
}
|
||||
|
||||
typedef struct cp_frame {
|
||||
@ -131,44 +113,35 @@ typedef struct cp_frame {
|
||||
#endif
|
||||
} copy_frame;
|
||||
|
||||
|
||||
#ifdef COROUTINING
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
/* what to do when someone tries to bind our term to someone else
|
||||
in some predefined context */
|
||||
void (*bind_op) (Term *, Term CACHE_TYPE);
|
||||
void (*bind_op)(Term *, Term CACHE_TYPE);
|
||||
/* what to do if someone wants to copy our constraint */
|
||||
int (*copy_term_op) (CELL *, struct cp_frame **, CELL * CACHE_TYPE);
|
||||
int (*copy_term_op)(CELL *, struct cp_frame **, CELL *CACHE_TYPE);
|
||||
/* copy the constraint into a term and back */
|
||||
Term (*to_term_op) (CELL *);
|
||||
int (*term_to_op) (Term, Term CACHE_TYPE);
|
||||
Term (*to_term_op)(CELL *);
|
||||
int (*term_to_op)(Term, Term CACHE_TYPE);
|
||||
/* op called to do marking in GC */
|
||||
void (*mark_op) (CELL *);
|
||||
void (*mark_op)(CELL *);
|
||||
} ext_op;
|
||||
|
||||
/* known delays */
|
||||
typedef enum
|
||||
{
|
||||
empty_ext = 0 * sizeof (ext_op), /* default op, this should never be called */
|
||||
attvars_ext = 1 * sizeof (ext_op) /* support for attributed variables */
|
||||
/* add your own extensions here */
|
||||
/* keep this one */
|
||||
}
|
||||
exts;
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
empty_ext = 0 * sizeof(ext_op), /* default op, this should never be called */
|
||||
attvars_ext = 1 * sizeof(ext_op) /* support for attributed variables */
|
||||
/* add your own extensions here */
|
||||
/* keep this one */
|
||||
} exts;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(YAP_H)
|
||||
/* make sure that these data structures are the first thing to be allocated
|
||||
in the heap when we start the system */
|
||||
typedef struct special_functors_struct
|
||||
{
|
||||
typedef struct special_functors_struct {
|
||||
|
||||
#if 0
|
||||
struct ExtraAtomEntryStruct AtFoundVar;
|
||||
@ -181,57 +154,43 @@ typedef struct special_functors_struct
|
||||
struct AtomEntryStruct *AtNil;
|
||||
struct AtomEntryStruct *AtDot;
|
||||
#endif
|
||||
}
|
||||
special_functors;
|
||||
} special_functors;
|
||||
#endif /* YAP_H */
|
||||
|
||||
INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr);
|
||||
|
||||
#define MkFloatTerm(fl) __MkFloatTerm((fl) PASS_REGS)
|
||||
#define MkFloatTerm(fl) __MkFloatTerm((fl)PASS_REGS)
|
||||
|
||||
INLINE_ONLY inline EXTERN Term __MkFloatTerm (Float USES_REGS);
|
||||
INLINE_ONLY inline EXTERN Term __MkFloatTerm(Float USES_REGS);
|
||||
|
||||
INLINE_ONLY inline EXTERN Float FloatOfTerm (Term t);
|
||||
INLINE_ONLY inline EXTERN Float FloatOfTerm(Term t);
|
||||
|
||||
#if SIZEOF_DOUBLE == SIZEOF_INT_P
|
||||
|
||||
INLINE_ONLY inline EXTERN Term
|
||||
__MkFloatTerm (Float dbl USES_REGS)
|
||||
{
|
||||
return (Term) ((HR[0] = (CELL) FunctorDouble, *(Float *) (HR + 1) =
|
||||
dbl, HR[2] = EndSpecials, HR +=
|
||||
3, AbsAppl (HR - 3)));
|
||||
INLINE_ONLY inline EXTERN Term __MkFloatTerm(Float dbl USES_REGS) {
|
||||
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)
|
||||
{
|
||||
return (Float) (*(Float *) (RepAppl (t) + 1));
|
||||
INLINE_ONLY inline EXTERN Float FloatOfTerm(Term t) {
|
||||
return (Float)(*(Float *)(RepAppl(t) + 1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define InitUnalignedFloat()
|
||||
|
||||
INLINE_ONLY inline EXTERN Float
|
||||
CpFloatUnaligned(CELL *ptr)
|
||||
{
|
||||
INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr) {
|
||||
return *((Float *)ptr);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if SIZEOF_DOUBLE == 2*SIZEOF_INT_P
|
||||
#if SIZEOF_DOUBLE == 2 * SIZEOF_INT_P
|
||||
|
||||
#define DOUBLE_ALIGNED(ADDR) ((CELL)(ADDR) & 0x4)
|
||||
#define DOUBLE_ALIGNED(ADDR) ((CELL)(ADDR)&0x4)
|
||||
|
||||
INLINE_ONLY EXTERN inline void
|
||||
AlignGlobalForDouble( USES_REGS1 );
|
||||
INLINE_ONLY EXTERN inline void AlignGlobalForDouble(USES_REGS1);
|
||||
|
||||
INLINE_ONLY EXTERN inline void
|
||||
AlignGlobalForDouble( USES_REGS1 )
|
||||
{
|
||||
INLINE_ONLY EXTERN inline void AlignGlobalForDouble(USES_REGS1) {
|
||||
/* Force Alignment for floats. Note that garbage collector may
|
||||
break the alignment; */
|
||||
if (!DOUBLE_ALIGNED(HR)) {
|
||||
@ -241,19 +200,14 @@ AlignGlobalForDouble( USES_REGS1 )
|
||||
}
|
||||
|
||||
#ifdef i386
|
||||
INLINE_ONLY inline EXTERN Float
|
||||
CpFloatUnaligned (CELL * ptr)
|
||||
{
|
||||
return *((Float *) (ptr + 1));
|
||||
INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr) {
|
||||
return *((Float *)(ptr + 1));
|
||||
}
|
||||
|
||||
#else
|
||||
/* first, need to address the alignment problem */
|
||||
INLINE_ONLY inline EXTERN Float
|
||||
CpFloatUnaligned (CELL * ptr)
|
||||
{
|
||||
union
|
||||
{
|
||||
INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr) {
|
||||
union {
|
||||
Float f;
|
||||
CELL d[2];
|
||||
} u;
|
||||
@ -264,28 +218,21 @@ CpFloatUnaligned (CELL * ptr)
|
||||
|
||||
#endif
|
||||
|
||||
INLINE_ONLY inline EXTERN Term
|
||||
__MkFloatTerm (Float dbl USES_REGS)
|
||||
{
|
||||
return (Term) ((AlignGlobalForDouble ( PASS_REGS1 ), HR[0] =
|
||||
(CELL) FunctorDouble, *(Float *) (HR + 1) = dbl, HR[3] =
|
||||
EndSpecials, HR +=
|
||||
4, AbsAppl (HR - 4)));
|
||||
INLINE_ONLY inline EXTERN Term __MkFloatTerm(Float dbl USES_REGS) {
|
||||
return (Term)((AlignGlobalForDouble(PASS_REGS1), HR[0] = (CELL)FunctorDouble,
|
||||
*(Float *)(HR + 1) = dbl, HR[3] = EndSpecials, HR += 4,
|
||||
AbsAppl(HR - 4)));
|
||||
}
|
||||
|
||||
|
||||
INLINE_ONLY inline EXTERN Float
|
||||
FloatOfTerm (Term t)
|
||||
{
|
||||
return (Float) ((DOUBLE_ALIGNED (RepAppl (t)) ? *(Float *) (RepAppl (t) + 1)
|
||||
: CpFloatUnaligned (RepAppl (t))));
|
||||
INLINE_ONLY inline EXTERN Float FloatOfTerm(Term t) {
|
||||
return (Float)((DOUBLE_ALIGNED(RepAppl(t)) ? *(Float *)(RepAppl(t) + 1)
|
||||
: CpFloatUnaligned(RepAppl(t))));
|
||||
}
|
||||
|
||||
|
||||
/* no alignment problems for 64 bit machines */
|
||||
#else
|
||||
/* OOPS, YAP only understands Floats that are as large as cells or that
|
||||
take two cells!!! */
|
||||
/* OOPS, YAP only understands Floats that are as large as cells or that
|
||||
take two cells!!! */
|
||||
|
||||
OOPS
|
||||
|
||||
@ -296,52 +243,38 @@ OOPS
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
INLINE_ONLY inline EXTERN int IsFloatTerm(Term);
|
||||
|
||||
INLINE_ONLY inline EXTERN int IsFloatTerm (Term);
|
||||
|
||||
INLINE_ONLY inline EXTERN int
|
||||
IsFloatTerm (Term t)
|
||||
{
|
||||
return (int) (IsApplTerm (t) && FunctorOfTerm (t) == FunctorDouble);
|
||||
INLINE_ONLY inline EXTERN int IsFloatTerm(Term t) {
|
||||
return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorDouble);
|
||||
}
|
||||
|
||||
|
||||
/* 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
|
||||
__MkLongIntTerm (Int i USES_REGS)
|
||||
{
|
||||
HR[0] = (CELL) FunctorLongInt;
|
||||
HR[1] = (CELL) (i);
|
||||
HR[2] = EndSpecials;
|
||||
INLINE_ONLY inline EXTERN Term __MkLongIntTerm(Int i USES_REGS) {
|
||||
HR[0] = (CELL)FunctorLongInt;
|
||||
HR[1] = (CELL)(i);
|
||||
HR[2] = EndSpecials;
|
||||
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
|
||||
LongIntOfTerm (Term t)
|
||||
{
|
||||
return (Int) (RepAppl (t)[1]);
|
||||
INLINE_ONLY inline EXTERN Int LongIntOfTerm(Term t) {
|
||||
return (Int)(RepAppl(t)[1]);
|
||||
}
|
||||
|
||||
INLINE_ONLY inline EXTERN int IsLongIntTerm(Term);
|
||||
|
||||
|
||||
INLINE_ONLY inline EXTERN int IsLongIntTerm (Term);
|
||||
|
||||
INLINE_ONLY inline EXTERN int
|
||||
IsLongIntTerm (Term t)
|
||||
{
|
||||
return (int) (IsApplTerm (t) && FunctorOfTerm (t) == FunctorLongInt);
|
||||
INLINE_ONLY inline EXTERN int IsLongIntTerm(Term t) {
|
||||
return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorLongInt);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************/
|
||||
|
||||
/*********** strings, coded as UTF-8 ****************/
|
||||
@ -350,67 +283,54 @@ IsLongIntTerm (Term t)
|
||||
|
||||
/* extern Functor FunctorString; */
|
||||
|
||||
#define MkStringTerm(i) __MkStringTerm((i) PASS_REGS)
|
||||
#define MkStringTerm(i) __MkStringTerm((i)PASS_REGS)
|
||||
|
||||
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
|
||||
__MkStringTerm (const char *s USES_REGS)
|
||||
{
|
||||
INLINE_ONLY inline EXTERN Term __MkStringTerm(const char *s USES_REGS) {
|
||||
Term t = AbsAppl(HR);
|
||||
size_t sz = ALIGN_BY_TYPE(strlen((char *)s)+1,CELL);
|
||||
HR[0] = (CELL) FunctorString;
|
||||
HR[1] = (CELL) sz;
|
||||
strcpy((char *)(HR+2), (const char *)s);
|
||||
HR[2+sz] = EndSpecials;
|
||||
HR += 3+sz;
|
||||
size_t sz = ALIGN_BY_TYPE(strlen((char *)s) + 1, CELL);
|
||||
HR[0] = (CELL)FunctorString;
|
||||
HR[1] = (CELL)sz;
|
||||
strcpy((char *)(HR + 2), (const char *)s);
|
||||
HR[2 + sz] = EndSpecials;
|
||||
HR += 3 + sz;
|
||||
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
|
||||
__MkUStringTerm (const unsigned char *s USES_REGS)
|
||||
{
|
||||
__MkUStringTerm(const unsigned char *s USES_REGS) {
|
||||
Term t = AbsAppl(HR);
|
||||
size_t sz = ALIGN_BY_TYPE(strlen((char *)s)+1,CELL);
|
||||
HR[0] = (CELL) FunctorString;
|
||||
HR[1] = (CELL) sz;
|
||||
strcpy((char *)(HR+2), (const char *)s);
|
||||
HR[2+sz] = EndSpecials;
|
||||
HR += 3+sz;
|
||||
size_t sz = ALIGN_BY_TYPE(strlen((char *)s) + 1, CELL);
|
||||
HR[0] = (CELL)FunctorString;
|
||||
HR[1] = (CELL)sz;
|
||||
strcpy((char *)(HR + 2), (const char *)s);
|
||||
HR[2 + sz] = EndSpecials;
|
||||
HR += 3 + sz;
|
||||
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 *
|
||||
UStringOfTerm (Term t)
|
||||
{
|
||||
return (const unsigned char *) (RepAppl (t)+2);
|
||||
INLINE_ONLY inline EXTERN const unsigned char *UStringOfTerm(Term t) {
|
||||
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 *
|
||||
StringOfTerm (Term t)
|
||||
{
|
||||
return (const char *) (RepAppl (t)+2);
|
||||
INLINE_ONLY inline EXTERN const char *StringOfTerm(Term t) {
|
||||
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
|
||||
IsStringTerm (Term t)
|
||||
{
|
||||
return (int) (IsApplTerm (t) && FunctorOfTerm (t) == FunctorString);
|
||||
INLINE_ONLY inline EXTERN int IsStringTerm(Term t) {
|
||||
return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorString);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************/
|
||||
|
||||
#ifdef USE_GMP
|
||||
@ -422,7 +342,7 @@ IsStringTerm (Term t)
|
||||
#undef __cplusplus
|
||||
#include <gmp.h>
|
||||
#define __cplusplus OCXX
|
||||
#elif !defined( __GMP_H__ )
|
||||
#elif !defined(__GMP_H__)
|
||||
#include <gmp.h>
|
||||
#endif
|
||||
|
||||
@ -442,12 +362,10 @@ typedef struct {
|
||||
|
||||
#endif
|
||||
|
||||
INLINE_ONLY inline EXTERN int IsBigIntTerm (Term);
|
||||
INLINE_ONLY inline EXTERN int IsBigIntTerm(Term);
|
||||
|
||||
INLINE_ONLY inline EXTERN int
|
||||
IsBigIntTerm (Term t)
|
||||
{
|
||||
return (int) (IsApplTerm (t) && FunctorOfTerm (t) == FunctorBigInt);
|
||||
INLINE_ONLY inline EXTERN int IsBigIntTerm(Term t) {
|
||||
return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorBigInt);
|
||||
}
|
||||
|
||||
#ifdef USE_GMP
|
||||
@ -458,237 +376,154 @@ MP_INT *Yap_BigIntOfTerm(Term);
|
||||
Term Yap_MkBigRatTerm(MP_RAT *);
|
||||
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
|
||||
MPZ_SET (mpz_t dest, MP_INT *src)
|
||||
{
|
||||
INLINE_ONLY inline EXTERN void MPZ_SET(mpz_t dest, MP_INT *src) {
|
||||
dest->_mp_size = src->_mp_size;
|
||||
dest->_mp_alloc = src->_mp_alloc;
|
||||
dest->_mp_d = src->_mp_d;
|
||||
}
|
||||
|
||||
INLINE_ONLY inline EXTERN int IsLargeIntTerm (Term);
|
||||
INLINE_ONLY inline EXTERN int IsLargeIntTerm(Term);
|
||||
|
||||
INLINE_ONLY inline EXTERN int
|
||||
IsLargeIntTerm (Term t)
|
||||
{
|
||||
return (int) (IsApplTerm (t)
|
||||
&& ((FunctorOfTerm (t) <= FunctorBigInt)
|
||||
&& (FunctorOfTerm (t) >= FunctorLongInt)));
|
||||
INLINE_ONLY inline EXTERN int IsLargeIntTerm(Term t) {
|
||||
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
|
||||
Yap_SizeOfBigInt (Term t)
|
||||
{
|
||||
CELL *pt = RepAppl(t)+1;
|
||||
return 2+(sizeof(MP_INT)+
|
||||
(((MP_INT *)pt)->_mp_alloc*sizeof(mp_limb_t)))/sizeof(CELL);
|
||||
INLINE_ONLY inline EXTERN UInt Yap_SizeOfBigInt(Term t) {
|
||||
CELL *pt = RepAppl(t) + 1;
|
||||
return 2 +
|
||||
(sizeof(MP_INT) + (((MP_INT *)pt)->_mp_alloc * sizeof(mp_limb_t))) /
|
||||
sizeof(CELL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
INLINE_ONLY inline EXTERN int IsLargeIntTerm(Term);
|
||||
|
||||
|
||||
INLINE_ONLY inline EXTERN int IsLargeIntTerm (Term);
|
||||
|
||||
INLINE_ONLY inline EXTERN int
|
||||
IsLargeIntTerm (Term t)
|
||||
{
|
||||
return (int) (IsApplTerm (t) && FunctorOfTerm (t) == FunctorLongInt);
|
||||
INLINE_ONLY inline EXTERN int IsLargeIntTerm(Term t) {
|
||||
return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorLongInt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* extern Functor FunctorLongInt; */
|
||||
|
||||
INLINE_ONLY inline EXTERN int IsLargeNumTerm (Term);
|
||||
INLINE_ONLY inline EXTERN int IsLargeNumTerm(Term);
|
||||
|
||||
INLINE_ONLY inline EXTERN int
|
||||
IsLargeNumTerm (Term t)
|
||||
{
|
||||
return (int) (IsApplTerm (t)
|
||||
&& ((FunctorOfTerm (t) <= FunctorBigInt)
|
||||
&& (FunctorOfTerm (t) >= FunctorDouble)));
|
||||
INLINE_ONLY inline EXTERN int IsLargeNumTerm(Term t) {
|
||||
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
|
||||
IsExternalBlobTerm (Term t, CELL tag)
|
||||
{
|
||||
return (int) (IsApplTerm (t) &&
|
||||
FunctorOfTerm (t) == FunctorBigInt &&
|
||||
RepAppl(t)[1] == tag);
|
||||
INLINE_ONLY inline EXTERN int IsExternalBlobTerm(Term t, CELL tag) {
|
||||
return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorBigInt &&
|
||||
RepAppl(t)[1] == tag);
|
||||
}
|
||||
|
||||
INLINE_ONLY inline EXTERN void *ExternalBlobFromTerm (Term);
|
||||
INLINE_ONLY inline EXTERN void *ExternalBlobFromTerm(Term);
|
||||
|
||||
INLINE_ONLY inline EXTERN void *
|
||||
ExternalBlobFromTerm (Term t)
|
||||
{
|
||||
MP_INT *base = (MP_INT *)(RepAppl(t)+2);
|
||||
return (void *) (base+1);
|
||||
INLINE_ONLY inline EXTERN void *ExternalBlobFromTerm(Term t) {
|
||||
MP_INT *base = (MP_INT *)(RepAppl(t) + 2);
|
||||
return (void *)(base + 1);
|
||||
}
|
||||
|
||||
INLINE_ONLY inline EXTERN int IsNumTerm(Term);
|
||||
|
||||
|
||||
|
||||
INLINE_ONLY inline EXTERN int IsNumTerm (Term);
|
||||
|
||||
INLINE_ONLY inline EXTERN int
|
||||
IsNumTerm (Term t)
|
||||
{
|
||||
return (int) ((IsIntTerm (t) || IsLargeNumTerm (t)));
|
||||
INLINE_ONLY inline EXTERN int IsNumTerm(Term 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
|
||||
IsAtomicTerm (Term t)
|
||||
{
|
||||
return (Int) (IsAtomOrIntTerm (t) || IsLargeNumTerm (t) || IsStringTerm(t));
|
||||
INLINE_ONLY inline EXTERN Int IsAtomicTerm(Term 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
|
||||
IsExtensionFunctor (Functor f)
|
||||
{
|
||||
return (Int) (f <= FunctorString);
|
||||
INLINE_ONLY inline EXTERN Int IsExtensionFunctor(Functor f) {
|
||||
return (Int)(f <= FunctorString);
|
||||
}
|
||||
|
||||
INLINE_ONLY inline EXTERN Int IsBlobFunctor(Functor);
|
||||
|
||||
|
||||
INLINE_ONLY inline EXTERN Int IsBlobFunctor (Functor);
|
||||
|
||||
INLINE_ONLY inline EXTERN Int
|
||||
IsBlobFunctor (Functor f)
|
||||
{
|
||||
return (Int) ((f <= FunctorString && f >= FunctorDBRef));
|
||||
INLINE_ONLY inline EXTERN Int IsBlobFunctor(Functor f) {
|
||||
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
|
||||
IsPrimitiveTerm (Term t)
|
||||
{
|
||||
return (Int) ((IsAtomOrIntTerm (t)
|
||||
|| (IsApplTerm (t) && IsBlobFunctor (FunctorOfTerm (t)))));
|
||||
INLINE_ONLY inline EXTERN Int IsPrimitiveTerm(Term t) {
|
||||
return (Int)((IsAtomOrIntTerm(t) ||
|
||||
(IsApplTerm(t) && IsBlobFunctor(FunctorOfTerm(t)))));
|
||||
}
|
||||
|
||||
#ifdef TERM_EXTENSIONS
|
||||
|
||||
INLINE_ONLY inline EXTERN Int IsAttachFunc(Functor);
|
||||
|
||||
INLINE_ONLY inline EXTERN Int IsAttachFunc (Functor);
|
||||
|
||||
INLINE_ONLY inline EXTERN Int
|
||||
IsAttachFunc (Functor f)
|
||||
{
|
||||
return (Int) (FALSE);
|
||||
}
|
||||
|
||||
|
||||
INLINE_ONLY inline EXTERN Int IsAttachFunc(Functor f) { return (Int)(FALSE); }
|
||||
|
||||
#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
|
||||
__IsAttachedTerm (Term t USES_REGS)
|
||||
{
|
||||
return (Int) ((IsVarTerm (t) && IsAttVar(VarOfTerm(t))));
|
||||
INLINE_ONLY inline EXTERN Int __IsAttachedTerm(Term t USES_REGS) {
|
||||
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
|
||||
GlobalIsAttachedTerm (Term t)
|
||||
{
|
||||
return (Int) ((IsVarTerm (t) && GlobalIsAttVar(VarOfTerm(t))));
|
||||
INLINE_ONLY inline EXTERN Int GlobalIsAttachedTerm(Term t) {
|
||||
return (Int)((IsVarTerm(t) && GlobalIsAttVar(VarOfTerm(t))));
|
||||
}
|
||||
|
||||
#define SafeIsAttachedTerm(t) __SafeIsAttachedTerm((t) PASS_REGS)
|
||||
#define SafeIsAttachedTerm(t) __SafeIsAttachedTerm((t)PASS_REGS)
|
||||
|
||||
INLINE_ONLY inline EXTERN Int __SafeIsAttachedTerm (Term USES_REGS);
|
||||
INLINE_ONLY inline EXTERN Int __SafeIsAttachedTerm(Term USES_REGS);
|
||||
|
||||
INLINE_ONLY inline EXTERN Int
|
||||
__SafeIsAttachedTerm (Term t USES_REGS)
|
||||
{
|
||||
return (Int) (IsVarTerm (t) && IsAttVar(VarOfTerm(t)));
|
||||
}
|
||||
|
||||
INLINE_ONLY inline EXTERN exts ExtFromCell (CELL *);
|
||||
|
||||
INLINE_ONLY inline EXTERN exts
|
||||
ExtFromCell (CELL * pt)
|
||||
{
|
||||
return attvars_ext;
|
||||
INLINE_ONLY inline EXTERN Int __SafeIsAttachedTerm(Term t USES_REGS) {
|
||||
return (Int)(IsVarTerm(t) && IsAttVar(VarOfTerm(t)));
|
||||
}
|
||||
|
||||
INLINE_ONLY inline EXTERN exts ExtFromCell(CELL *);
|
||||
|
||||
INLINE_ONLY inline EXTERN exts ExtFromCell(CELL *pt) { return attvars_ext; }
|
||||
|
||||
#else
|
||||
|
||||
INLINE_ONLY inline EXTERN Int IsAttachFunc(Functor);
|
||||
|
||||
INLINE_ONLY inline EXTERN Int IsAttachFunc (Functor);
|
||||
|
||||
INLINE_ONLY inline EXTERN Int
|
||||
IsAttachFunc (Functor f)
|
||||
{
|
||||
return (Int) (FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
INLINE_ONLY inline EXTERN Int IsAttachedTerm (Term);
|
||||
|
||||
INLINE_ONLY inline EXTERN Int
|
||||
IsAttachedTerm (Term t)
|
||||
{
|
||||
return (Int) (FALSE);
|
||||
}
|
||||
|
||||
INLINE_ONLY inline EXTERN Int IsAttachFunc(Functor f) { return (Int)(FALSE); }
|
||||
|
||||
INLINE_ONLY inline EXTERN Int IsAttachedTerm(Term);
|
||||
|
||||
INLINE_ONLY inline EXTERN Int IsAttachedTerm(Term t) { return (Int)(FALSE); }
|
||||
|
||||
#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) {
|
||||
CELL *pt = RepAppl(t);
|
||||
|
||||
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) {
|
||||
MP_INT *blobp;
|
||||
CELL *pt = RepAppl(t);
|
||||
|
||||
blobp = (MP_INT *)(pt+2);
|
||||
return (void *)(blobp+1);
|
||||
blobp = (MP_INT *)(pt + 2);
|
||||
return (void *)(blobp + 1);
|
||||
}
|
||||
|
||||
#ifdef YAP_H
|
||||
@ -697,92 +532,75 @@ INLINE_ONLY inline EXTERN int unify_extension(Functor, CELL, CELL *, CELL);
|
||||
|
||||
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
|
||||
unify_extension (Functor f, CELL d0, CELL * pt0, CELL d1)
|
||||
{
|
||||
switch (BlobOfFunctor (f))
|
||||
{
|
||||
case db_ref_e:
|
||||
return (d0 == d1);
|
||||
case attvar_e:
|
||||
return (d0 == d1);
|
||||
case long_int_e:
|
||||
return (pt0[1] == RepAppl (d1)[1]);
|
||||
case string_e:
|
||||
return strcmp( (char *)(pt0+2), (char *)(RepAppl (d1)+2) ) == 0;
|
||||
case big_int_e:
|
||||
INLINE_ONLY inline EXTERN int unify_extension(Functor f, CELL d0, CELL *pt0,
|
||||
CELL d1) {
|
||||
switch (BlobOfFunctor(f)) {
|
||||
case db_ref_e:
|
||||
return (d0 == d1);
|
||||
case attvar_e:
|
||||
return (d0 == d1);
|
||||
case long_int_e:
|
||||
return (pt0[1] == RepAppl(d1)[1]);
|
||||
case string_e:
|
||||
return strcmp((char *)(pt0 + 2), (char *)(RepAppl(d1) + 2)) == 0;
|
||||
case big_int_e:
|
||||
#ifdef USE_GMP
|
||||
return (Yap_gmp_tcmp_big_big(d0,d1) == 0);
|
||||
return (Yap_gmp_tcmp_big_big(d0, d1) == 0);
|
||||
#else
|
||||
return d0 == d1;
|
||||
return d0 == d1;
|
||||
#endif /* USE_GMP */
|
||||
case double_e:
|
||||
{
|
||||
CELL *pt1 = RepAppl (d1);
|
||||
return (pt0[1] == pt1[1]
|
||||
#if SIZEOF_DOUBLE == 2*SIZEOF_INT_P
|
||||
&& pt0[2] == pt1[2]
|
||||
case double_e: {
|
||||
CELL *pt1 = RepAppl(d1);
|
||||
return (pt0[1] == pt1[1]
|
||||
#if SIZEOF_DOUBLE == 2 * SIZEOF_INT_P
|
||||
&& pt0[2] == pt1[2]
|
||||
#endif
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
static inline
|
||||
CELL Yap_IntP_key(CELL *pt)
|
||||
{
|
||||
static inline CELL Yap_IntP_key(CELL *pt) {
|
||||
#ifdef USE_GMP
|
||||
if (((Functor)pt[-1] == FunctorBigInt)) {
|
||||
MP_INT *b1 = Yap_BigIntOfTerm(AbsAppl(pt-1));
|
||||
MP_INT *b1 = Yap_BigIntOfTerm(AbsAppl(pt - 1));
|
||||
/* first cell in program */
|
||||
CELL val = ((CELL *)(b1+1))[0];
|
||||
return MkIntTerm(val & (MAX_ABS_INT-1));
|
||||
CELL val = ((CELL *)(b1 + 1))[0];
|
||||
return MkIntTerm(val & (MAX_ABS_INT - 1));
|
||||
}
|
||||
#endif
|
||||
return MkIntTerm(pt[0] & (MAX_ABS_INT-1));
|
||||
return MkIntTerm(pt[0] & (MAX_ABS_INT - 1));
|
||||
}
|
||||
|
||||
static inline
|
||||
CELL Yap_Int_key(Term t)
|
||||
{
|
||||
return Yap_IntP_key(RepAppl(t)+1);
|
||||
}
|
||||
static inline CELL Yap_Int_key(Term t) { return Yap_IntP_key(RepAppl(t) + 1); }
|
||||
|
||||
static inline
|
||||
CELL Yap_DoubleP_key(CELL *pt)
|
||||
{
|
||||
#if SIZEOF_DOUBLE1 == 2*SIZEOF_INT_P
|
||||
CELL val = pt[0]^pt[1];
|
||||
static inline CELL Yap_DoubleP_key(CELL *pt) {
|
||||
#if SIZEOF_DOUBLE1 == 2 * SIZEOF_INT_P
|
||||
CELL val = pt[0] ^ pt[1];
|
||||
#else
|
||||
CELL val = pt[0];
|
||||
#endif
|
||||
return MkIntTerm(val & (MAX_ABS_INT-1));
|
||||
return MkIntTerm(val & (MAX_ABS_INT - 1));
|
||||
}
|
||||
|
||||
static inline
|
||||
CELL Yap_Double_key(Term t)
|
||||
{
|
||||
return Yap_DoubleP_key(RepAppl(t)+1);
|
||||
static inline CELL Yap_Double_key(Term t) {
|
||||
return Yap_DoubleP_key(RepAppl(t) + 1);
|
||||
}
|
||||
|
||||
static inline
|
||||
CELL Yap_StringP_key(CELL *pt)
|
||||
{
|
||||
static inline CELL Yap_StringP_key(CELL *pt) {
|
||||
UInt n = pt[1], i;
|
||||
CELL val = pt[2];
|
||||
for (i=1; i<n; i++) {
|
||||
val ^= pt[i+1];
|
||||
for (i = 1; i < n; i++) {
|
||||
val ^= pt[i + 1];
|
||||
}
|
||||
return MkIntTerm(val & (MAX_ABS_INT-1));
|
||||
return MkIntTerm(val & (MAX_ABS_INT - 1));
|
||||
}
|
||||
|
||||
static inline
|
||||
CELL Yap_String_key(Term t)
|
||||
{
|
||||
return Yap_StringP_key(RepAppl(t)+1);
|
||||
static inline CELL Yap_String_key(Term t) {
|
||||
return Yap_StringP_key(RepAppl(t) + 1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
28
H/Yap.h
@ -376,6 +376,17 @@ typedef volatile int lockvar;
|
||||
|
||||
#include "Regs.h"
|
||||
|
||||
/*************************************************************************************************
|
||||
OPTYAP includes
|
||||
*************************************************************************************************/
|
||||
|
||||
#if defined(YAPOR) || defined(TABLING)
|
||||
#include "opt.structs.h"
|
||||
#include "opt.proto.h"
|
||||
#include "opt.macros.h"
|
||||
#endif /* YAPOR || TABLING */
|
||||
|
||||
|
||||
/*************************************************************************************************
|
||||
variables concerned with Error Handling
|
||||
*************************************************************************************************/
|
||||
@ -733,17 +744,6 @@ typedef struct scratch_block_struct {
|
||||
/* scanner types */
|
||||
#include "ScannerTypes.h"
|
||||
|
||||
/*************************************************************************************************
|
||||
OPTYAP includes
|
||||
*************************************************************************************************/
|
||||
|
||||
#if defined(YAPOR) || defined(TABLING)
|
||||
#include "opt.structs.h"
|
||||
#include "opt.proto.h"
|
||||
#include "opt.macros.h"
|
||||
#endif /* YAPOR || TABLING */
|
||||
|
||||
|
||||
/*************************************************************************************************
|
||||
GLOBAL and LOCAL variables
|
||||
*************************************************************************************************/
|
||||
@ -771,10 +771,8 @@ extern struct worker_local Yap_local;
|
||||
|
||||
#include <stdio.h>
|
||||
#define YP_FILE FILE
|
||||
#include "hglobals.h"
|
||||
#include "dglobals.h"
|
||||
#include "hlocals.h"
|
||||
#include "dlocals.h"
|
||||
|
||||
#include <YapHeap.h>
|
||||
|
||||
|
||||
/*************************************************************************************************
|
||||
|
67
H/YapFlags.h
@ -25,37 +25,66 @@
|
||||
|
||||
// INLINE_ONLY inline EXTERN bool nat( Term inp );
|
||||
|
||||
#define SYSTEM_OPTION_0 "attributed_variables,rational_trees]"
|
||||
#if THREADS
|
||||
#define SYSTEM_OPTION_1 "threads,"
|
||||
#endif
|
||||
#if USE_GMP
|
||||
#define SYSTEM_OPTION_3 "big_numbers,"
|
||||
#endif
|
||||
#if DEPTH_LIMIT
|
||||
#define SYSTEM_OPTION_4 "depth_limit,"
|
||||
#endif
|
||||
#if LOW_LEVEL_TRACE
|
||||
#define SYSTEM_OPTION_5 "low_level_tracer,"
|
||||
#endif
|
||||
#if YAPOR
|
||||
#define SYSTEM_OPTION_6 "or_parallelism,"
|
||||
#endif
|
||||
#if USE_READLINE
|
||||
#define SYSTEM_OPTION_7 "readline,"
|
||||
#endif
|
||||
#if TABLING
|
||||
#define SYSTEM_OPTION_8 "tabling,"
|
||||
#endif
|
||||
|
||||
static inline bool nat(Term inp) {
|
||||
if (IsVarTerm(inp)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag: value must be %s", "bound");
|
||||
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag: value must be %s",
|
||||
"bound");
|
||||
return false;
|
||||
}
|
||||
if (IsIntTerm(inp)) {
|
||||
Int i = IntOfTerm(inp);
|
||||
if (i >= 0)
|
||||
return true;
|
||||
Yap_Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, inp, "set_prolog_flag: value must be %s", ">= 0");
|
||||
Yap_Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, inp,
|
||||
"set_prolog_flag: value must be %s", ">= 0");
|
||||
return false;
|
||||
}
|
||||
Yap_Error(TYPE_ERROR_INTEGER, inp, "set_prolog_flag: value must be %s", "integer");
|
||||
Yap_Error(TYPE_ERROR_INTEGER, inp, "set_prolog_flag: value must be %s",
|
||||
"integer");
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool at2n(Term inp) {
|
||||
Yap_Error(PERMISSION_ERROR_READ_ONLY_FLAG, inp, "set_prolog_flag %s", "flag is read-only");
|
||||
Yap_Error(PERMISSION_ERROR_READ_ONLY_FLAG, inp, "set_prolog_flag %s",
|
||||
"flag is read-only");
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool isfloat(Term inp) {
|
||||
if (IsVarTerm(inp)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag: value must be %s", "integer");
|
||||
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag: value must be %s",
|
||||
"integer");
|
||||
|
||||
return false;
|
||||
}
|
||||
if (IsFloatTerm(inp)) {
|
||||
return true;
|
||||
}
|
||||
Yap_Error(TYPE_ERROR_FLOAT, inp, "set_prolog_flag: value must be %s", "floating-point");
|
||||
Yap_Error(TYPE_ERROR_FLOAT, inp, "set_prolog_flag: value must be %s",
|
||||
"floating-point");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -63,20 +92,24 @@ INLINE_ONLY inline EXTERN bool ro(Term inp);
|
||||
|
||||
INLINE_ONLY inline EXTERN bool ro(Term inp) {
|
||||
if (IsVarTerm(inp)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag: value must be %s", "bound");
|
||||
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag: value must be %s",
|
||||
"bound");
|
||||
return false;
|
||||
}
|
||||
Yap_Error(PERMISSION_ERROR_READ_ONLY_FLAG, inp, "set_prolog_flag %s", "flag is read-only");
|
||||
Yap_Error(PERMISSION_ERROR_READ_ONLY_FLAG, inp, "set_prolog_flag %s",
|
||||
"flag is read-only");
|
||||
return false;
|
||||
}
|
||||
|
||||
INLINE_ONLY inline EXTERN bool aro(Term inp) {
|
||||
if (IsVarTerm(inp)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag %s", "value must be bound");
|
||||
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag %s",
|
||||
"value must be bound");
|
||||
|
||||
return false;
|
||||
}
|
||||
Yap_Error(PERMISSION_ERROR_READ_ONLY_FLAG, inp, "set_prolog_flag %s", "flag is read-only");
|
||||
Yap_Error(PERMISSION_ERROR_READ_ONLY_FLAG, inp, "set_prolog_flag %s",
|
||||
"flag is read-only");
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -87,8 +120,9 @@ static inline bool boolean(Term inp) {
|
||||
if (inp == TermTrue || inp == TermFalse || inp == TermOn || inp == TermOff)
|
||||
return true;
|
||||
if (IsVarTerm(inp)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag %s", "value must be bound");
|
||||
;
|
||||
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag %s",
|
||||
"value must be bound");
|
||||
;
|
||||
return false;
|
||||
}
|
||||
if (IsAtomTerm(inp)) {
|
||||
@ -134,7 +168,8 @@ static bool bqs(Term inp) {
|
||||
|
||||
static inline bool isatom(Term inp) {
|
||||
if (IsVarTerm(inp)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag %s", "value must be bound");
|
||||
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag %s",
|
||||
"value must be bound");
|
||||
return false;
|
||||
}
|
||||
if (IsAtomTerm(inp))
|
||||
@ -143,6 +178,8 @@ static inline bool isatom(Term inp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool options(Term inp) { return Yap_IsGroundTerm(inp); }
|
||||
|
||||
// INLINE_ONLY inline EXTERN bool ok( Term inp );
|
||||
|
||||
static inline bool ok(Term inp) { return true; }
|
||||
@ -305,6 +342,10 @@ static inline size_t indexingDepth(void) {
|
||||
return IntOfTerm(GLOBAL_Flags[INDEX_SUB_TERM_SEARCH_DEPTH_FLAG].at);
|
||||
}
|
||||
|
||||
static inline Term gcTrace(void) {
|
||||
return GLOBAL_Flags[GC_TRACE_FLAG].at;
|
||||
}
|
||||
|
||||
bool rmdot(Term inp);
|
||||
|
||||
xarg *Yap_ArgListToVector(Term listl, const param_t *def, int n);
|
||||
|
@ -63,7 +63,7 @@ Prolog exceptions. If enabled:
|
||||
~~~~
|
||||
?- X is 2/0.
|
||||
ERROR!!
|
||||
ZERO DIVISOR ERROR- X is Exp
|
||||
ZERO DIVISO]]R ERROR- X is Exp
|
||||
~~~~
|
||||
|
||||
If disabled:
|
||||
@ -364,7 +364,7 @@ bound to `off` disable strict mode, and keep the current language
|
||||
mode. The default for YAP is `off`.
|
||||
Under strict ISO Prolog mode all calls to non-ISO built-ins generate an
|
||||
error. Compilation of clauses that would call non-ISO built-ins will
|
||||
§§also generate errors. Pre-processing for grammar rules is also
|
||||
also generate errors. Pre-processing for grammar rules is also
|
||||
disabled. Module expansion is still performed.
|
||||
Arguably, ISO Prolog does not provide all the functionality required
|
||||
from a modern Prolog system. Moreover, because most Prolog
|
||||
@ -376,10 +376,9 @@ will work the same way in every Prolog and in every platform. We thus
|
||||
believe this mode is mostly useful when investigating how a program
|
||||
depends on a Prolog's platform specific features.
|
||||
|
||||
*/
|
||||
YAP_FLAG(SYSTEM_OPTIONS_FLAG, "system_options", false, ro,
|
||||
"[big_numbers,coroutining,depth_limit,low_level_tracer,rational_"
|
||||
"trees,threads,tabling]",
|
||||
*/
|
||||
YAP_FLAG(SYSTEM_OPTIONS_FLAG, "system_options", false, options,
|
||||
SYSTEM_OPTIONS,
|
||||
NULL), /**< `system_options `
|
||||
|
||||
This read only flag tells which options were used to compile
|
||||
@ -411,8 +410,8 @@ presented. Only the first solution is considered and the goal is not
|
||||
backtracked into.
|
||||
|
||||
*/
|
||||
YAP_FLAG(TOPLEVEL_PROMPT_FLAG, "toplevel_prompt", true, isatom,
|
||||
"?- ", mkprompt),
|
||||
YAP_FLAG(TOPLEVEL_PROMPT_FLAG, "toplevel_prompt", true, isatom, "?- ",
|
||||
mkprompt),
|
||||
YAP_FLAG(TTY_CONTROL_FLAG, "tty_control", true, boolean, "true", NULL),
|
||||
YAP_FLAG(UNIX_FLAG, "unix", false, ro, "true", NULL), /**< `unix`
|
||||
|
||||
@ -442,10 +441,11 @@ follows immediate semantics.
|
||||
library.
|
||||
*/
|
||||
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
|
||||
are `error`, `fail`, and `warning`.
|
||||
Corresponds to calling the unknown/2 built-in. Possible ISO values
|
||||
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,
|
||||
"variable_names_may_end_with_quotes", true, boolean, "false",
|
||||
|
104
H/YapHandles.h
@ -61,67 +61,86 @@ functions are then exported through corresponding FLI C-functions
|
||||
#define Yap_RebootSlots(wid) Yap_RebootSlots__(wid PASS_REGS)
|
||||
|
||||
static inline void Yap_RebootSlots__(int wid USES_REGS) {
|
||||
// // fprintf(stderr, " StartSlots = %ld", LOCAL_CurSlot);
|
||||
// fprintf(stderr, " StartSlots = %ld", LOCAL_CurSlot);
|
||||
REMOTE_CurSlot(wid) = 1;
|
||||
}
|
||||
|
||||
/// @brief declares a new set of slots.
|
||||
/// Used to tell how many slots we had when we entered a segment of code.
|
||||
//#define Yap_StartSlots() ( printf("[<<<%s,%s,%d-%ld\n",__FILE__,__FUNCTION__,__LINE__,LOCAL_CurSlot)?Yap_StartSlots__(PASS_REGS1): -1)
|
||||
//#define Yap_StartSlots() (
|
||||
// printf("[<<<%s,%s,%d-%ld\n",__FILE__,__FUNCTION__,__LINE__,LOCAL_CurSlot)?Yap_StartSlots__(PASS_REGS1):
|
||||
//-1)
|
||||
#define Yap_StartSlots() Yap_StartSlots__(PASS_REGS1)
|
||||
|
||||
static inline yhandle_t Yap_StartSlots__(USES_REGS1) {
|
||||
INLINE_ONLY inline EXTERN yhandle_t Yap_StartSlots__(USES_REGS1);
|
||||
INLINE_ONLY inline EXTERN yhandle_t Yap_StartSlots__(USES_REGS1) {
|
||||
// // fprintf(stderr, " StartSlots = %ld", LOCAL_CurSlot);
|
||||
// fprintf(stderr,"SS %s:%d\n", __FUNCTION__, __LINE__);;
|
||||
// fprintf(stderr,"SS %s:%d\n", __FILE__, __LINE__);;
|
||||
if (LOCAL_CurSlot < 0) {
|
||||
Yap_Error(SYSTEM_ERROR_INTERNAL, 0L, " StartSlots = %ld", LOCAL_CurSlot);
|
||||
}
|
||||
return LOCAL_CurSlot;
|
||||
}
|
||||
|
||||
|
||||
/// @brief reset slots to a well-known position in the stack
|
||||
//#define Yap_CloseSlots(slot) ( printf("- %s,%s,%d %ld>>>]\n",__FILE__,__FUNCTION__,__LINE__, slot)?Yap_CloseSlots__(slot PASS_REGS):-1)
|
||||
//#define Yap_CloseSlots(slot) ( printf("- %s,%s,%d
|
||||
//%ld>>>]\n",__FILE__,__FUNCTION__,__LINE__, slot)?Yap_CloseSlots__(slot
|
||||
// PASS_REGS):-1)
|
||||
#define Yap_CloseSlots(slot) Yap_CloseSlots__(slot PASS_REGS)
|
||||
|
||||
static inline void Yap_CloseSlots__(yhandle_t slot USES_REGS) {
|
||||
// fprintf(stderr,"CS %s:%d\n", __FUNCTION__, __LINE__);;
|
||||
INLINE_ONLY inline EXTERN void Yap_CloseSlots__(yhandle_t slot USES_REGS);
|
||||
INLINE_ONLY inline EXTERN void Yap_CloseSlots__(yhandle_t slot USES_REGS) {
|
||||
// fprintf(stderr,"CS %s:%d\n", __FILE__, __LINE__);;
|
||||
LOCAL_CurSlot = slot;
|
||||
}
|
||||
|
||||
#define Yap_CurrentSlot() Yap_CurrentSlot__(PASS_REGS1)
|
||||
/// @brief report the current position of the slots, assuming that they occupy
|
||||
/// the top of the stack.
|
||||
static inline yhandle_t Yap_CurrentSlot(USES_REGS1) { return LOCAL_CurSlot; }
|
||||
INLINE_ONLY inline EXTERN yhandle_t Yap_CurrentSlot__(USES_REGS1);
|
||||
INLINE_ONLY inline EXTERN yhandle_t Yap_CurrentSlot__(USES_REGS1) {
|
||||
return LOCAL_CurSlot;
|
||||
}
|
||||
|
||||
#define Yap_GetFromSlot(slot) Yap_GetFromSlot__(slot PASS_REGS)
|
||||
/// @brief read from a slot.
|
||||
static inline Term Yap_GetFromSlot__(yhandle_t slot USES_REGS) {
|
||||
// fprintf(stderr,"GS %s:%d\n", __FUNCTION__, __LINE__);;
|
||||
return (Deref(LOCAL_SlotBase[slot]));
|
||||
INLINE_ONLY inline EXTERN Term Yap_GetFromSlot__(yhandle_t slot USES_REGS);
|
||||
INLINE_ONLY inline EXTERN Term Yap_GetFromSlot__(yhandle_t slot USES_REGS) {
|
||||
// fprintf(stderr, "GS %s:%d\n", __FILE__, __LINE__);
|
||||
return Deref(LOCAL_SlotBase[slot]);
|
||||
}
|
||||
|
||||
#define Yap_GetDerefedFromSlot( slot ) Yap_GetDerefedFromSlot__(slot PASS_REGS)
|
||||
/// @brief read from a slot. but does not try to dereference the slot.
|
||||
static inline Term Yap_GetDerefedFromSlot(yhandle_t slot USES_REGS) {
|
||||
// fprintf(stderr,"GDS %s:%d\n", __FUNCTION__, __LINE__);
|
||||
INLINE_ONLY inline EXTERN Term Yap_GetDerefedFromSlot__(yhandle_t slot USES_REGS);
|
||||
INLINE_ONLY inline EXTERN Term Yap_GetDerefedFromSlot__(yhandle_t slot USES_REGS) {
|
||||
// fprintf(stderr,"GDS %s:%d\n", __FILE__, __LINE__);
|
||||
return LOCAL_SlotBase[slot];
|
||||
}
|
||||
|
||||
#define Yap_GetPtrFromSlot( slot ) Yap_GetPtrFromSlot__(slot PASS_REGS)
|
||||
|
||||
/// @brief read the object in a slot. but do not try to dereference the slot.
|
||||
static inline Term Yap_GetPtrFromSlot(yhandle_t slot USES_REGS) {
|
||||
// fprintf(stderr,"GPS %s:%d\n", __FUNCTION__, __LINE__);
|
||||
return LOCAL_SlotBase[slot];
|
||||
INLINE_ONLY inline EXTERN Term *Yap_GetPtrFromSlot__(yhandle_t slot USES_REGS);
|
||||
INLINE_ONLY inline EXTERN Term *Yap_GetPtrFromSlot__(yhandle_t slot USES_REGS) {
|
||||
// fprintf(stderr,"GPS %s:%d\n", __FILE__, __LINE__);
|
||||
return (Term *)LOCAL_SlotBase[slot];
|
||||
}
|
||||
|
||||
#define Yap_AddressFromSlot(slot) Yap_AddressFromSlot__(slot PASS_REGS)
|
||||
|
||||
/// @brief get the memory address of a slot
|
||||
static inline Term *Yap_AddressFromSlot__(yhandle_t slot USES_REGS) {
|
||||
INLINE_ONLY inline EXTERN CELL *Yap_AddressFromSlot__(yhandle_t slot USES_REGS);
|
||||
INLINE_ONLY inline EXTERN CELL *Yap_AddressFromSlot__(yhandle_t slot USES_REGS) {
|
||||
/// @brief get the memory address of a slot
|
||||
|
||||
return LOCAL_SlotBase + slot;
|
||||
}
|
||||
|
||||
#define Yap_PutInSlot(slot, t) Yap_PutInSlot__(slot, t PASS_REGS)
|
||||
/// @brief store term in a slot
|
||||
static inline void Yap_PutInSlot(yhandle_t slot, Term t USES_REGS) {
|
||||
// fprintf(stderr,"PS %s:%d\n", __FUNCTION__, __LINE__);
|
||||
INLINE_ONLY inline EXTERN void Yap_PutInSlot__(yhandle_t slot, Term t USES_REGS);
|
||||
INLINE_ONLY inline EXTERN void Yap_PutInSlot__(yhandle_t slot, Term t USES_REGS) {
|
||||
// fprintf(stderr,"PS %s:%d\n", __FILE__, __LINE__);
|
||||
LOCAL_SlotBase[slot] = t;
|
||||
}
|
||||
|
||||
@ -129,7 +148,7 @@ static inline void Yap_PutInSlot(yhandle_t slot, Term t USES_REGS) {
|
||||
#define max(X, Y) (X > Y ? X : Y)
|
||||
#endif
|
||||
|
||||
static inline void ensure_slots(int N USES_REGS) {
|
||||
INLINE_ONLY inline EXTERN void ensure_slots(int N USES_REGS) {
|
||||
if (LOCAL_CurSlot + N >= LOCAL_NSlots) {
|
||||
size_t inc = max(16 * 1024, LOCAL_NSlots / 2); // measured in cells
|
||||
inc = max(inc, N + 16); // measured in cells
|
||||
@ -147,12 +166,15 @@ static inline void ensure_slots(int N USES_REGS) {
|
||||
}
|
||||
|
||||
/// @brief create a new slot with term t
|
||||
//#define Yap_InitSlot(t) ( printf("+%d %s,%s,%d>>>]\n",1,__FILE__,__FUNCTION__,__LINE__)?Yap_InitSlot__(t PASS_REGS):-1)
|
||||
// #define Yap_InitSlot(t)
|
||||
// (printf("+%d %ld %s,%s,%d>>>]\n", 1, LOCAL_CurSlot,__FILE__, __FUNCTION__, __LINE__)
|
||||
// ? Yap_InitSlot__(t PASS_REGS)
|
||||
// : -1)
|
||||
#define Yap_InitSlot(t) Yap_InitSlot__(t PASS_REGS)
|
||||
|
||||
static inline yhandle_t Yap_InitSlot__(Term t USES_REGS) {
|
||||
INLINE_ONLY inline EXTERN yhandle_t Yap_InitSlot__(Term t USES_REGS);
|
||||
INLINE_ONLY inline EXTERN yhandle_t Yap_InitSlot__(Term t USES_REGS) {
|
||||
yhandle_t old_slots = LOCAL_CurSlot;
|
||||
// fprintf(stderr,"IS %s:%d\n", __FUNCTION__, __LINE__);
|
||||
|
||||
ensure_slots(1 PASS_REGS);
|
||||
LOCAL_SlotBase[old_slots] = t;
|
||||
@ -160,14 +182,14 @@ static inline yhandle_t Yap_InitSlot__(Term t USES_REGS) {
|
||||
return old_slots;
|
||||
}
|
||||
|
||||
//#define Yap_NewSlots(n) ( printf("+%d %s,%s,%d>>>]\n",n,__FILE__,__FUNCTION__,__LINE__)?Yap_NewSlots__(n PASS_REGS):-1)
|
||||
#define Yap_NewSlots(n) Yap_NewSlots__(n PASS_REGS)
|
||||
//#define Yap_NewSlots(n) ( printf("+%d %ld %s,%s,%d>>>]\n",n,LOCAL_CurSlot,__FILE__,__FUNCTION__,__LINE__) ?Yap_NewSlots__(n PASS_REGS):-1)
|
||||
#define Yap_NewSlots(n) Yap_NewSlots__(n PASS_REGS)
|
||||
|
||||
/// @brief allocate n empty new slots
|
||||
static inline yhandle_t Yap_NewSlots__(int n USES_REGS) {
|
||||
INLINE_ONLY inline EXTERN yhandle_t Yap_NewSlots__(int n USES_REGS);
|
||||
INLINE_ONLY inline EXTERN yhandle_t Yap_NewSlots__(int n USES_REGS) {
|
||||
yhandle_t old_slots = LOCAL_CurSlot;
|
||||
int i;
|
||||
// fprintf(stderr,"NS %s:%d\n", __FUNCTION__, __LINE__);
|
||||
//fprintf(stderr, "NS %s:%d\n", __FILE__, __LINE__);
|
||||
|
||||
ensure_slots(n PASS_REGS);
|
||||
for (i = 0; i < n; i++) {
|
||||
@ -177,15 +199,17 @@ static inline yhandle_t Yap_NewSlots__(int n USES_REGS) {
|
||||
return old_slots;
|
||||
}
|
||||
|
||||
//#define Yap_InitSlots(n, ts) ( printf("+%d %s,%s,%d>>>]\n",n,__FILE__,__FUNCTION__,__LINE__)?Yap_InitSlots__(n, ts PASS_REGS):-1)
|
||||
//#define Yap_InitSlots(n, ts)
|
||||
// (printf("+%d %d %s,%s,%d>>>]\n", n, LOCAL_CurSlot, __FILE__, __FUNCTION__, __LINE__)
|
||||
// ? Yap_InitSlots__(n, ts PASS_REGS)
|
||||
// : -1)
|
||||
#define Yap_InitSlots(n, ts) Yap_InitSlots__(n, ts PASS_REGS)
|
||||
|
||||
/// @brief create n new slots with terms ts[]
|
||||
static inline yhandle_t Yap_InitSlots__(int n, Term *ts USES_REGS) {
|
||||
INLINE_ONLY inline EXTERN yhandle_t Yap_InitSlots__(int n, Term *ts USES_REGS);
|
||||
INLINE_ONLY inline EXTERN yhandle_t Yap_InitSlots__(int n, Term *ts USES_REGS) {
|
||||
yhandle_t old_slots = LOCAL_CurSlot;
|
||||
int i;
|
||||
// fprintf(stderr,"1S %s:%d\n", __FUNCTION__, __LINE__);
|
||||
|
||||
ensure_slots(n PASS_REGS);
|
||||
for (i = 0; i < n; i++)
|
||||
LOCAL_SlotBase[old_slots + i] = ts[i];
|
||||
@ -193,19 +217,23 @@ static inline yhandle_t Yap_InitSlots__(int n, Term *ts USES_REGS) {
|
||||
return old_slots;
|
||||
}
|
||||
|
||||
#define Yap_RecoverSlots(n, ts) Yap_RecoverSlots__(n, ts PASS_REGS)
|
||||
|
||||
/// @brief Succeeds if it is to recover the space allocated for $n$ contiguos
|
||||
/// slots starting at topSlot.
|
||||
static inline bool Yap_RecoverSlots(int n, yhandle_t topSlot USES_REGS) {
|
||||
if (topSlot+n < LOCAL_CurSlot)
|
||||
static inline bool Yap_RecoverSlots__(int n, yhandle_t topSlot USES_REGS);
|
||||
static inline bool Yap_RecoverSlots__(int n, yhandle_t topSlot USES_REGS) {
|
||||
if (topSlot + n < LOCAL_CurSlot)
|
||||
return false;
|
||||
#ifdef DEBUG
|
||||
if (n > LOCAL_CurSlot) {
|
||||
Yap_Error(SYSTEM_ERROR_INTERNAL, 0 , "Inconsistent slot state in Yap_RecoverSlots.", 0);
|
||||
Yap_Error(SYSTEM_ERROR_INTERNAL, 0,
|
||||
"Inconsistent slot state in Yap_RecoverSlots.", 0);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
LOCAL_CurSlot -= n;
|
||||
// fprintf(stderr,"RS %s:%d\n", __FUNCTION__, __LINE__);
|
||||
//fprintf(stderr,"RS %ld %s:%d\n", LOCAL_CurSlot, __FILE__, __LINE__);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
100
H/YapHeap.h
@ -72,7 +72,7 @@ typedef struct swi_reverse_hash {
|
||||
|
||||
//#define GC_MAVARS_HASH_SIZE 512
|
||||
//
|
||||
//typedef struct gc_ma_hash_entry_struct {
|
||||
// typedef struct gc_ma_hash_entry_struct {
|
||||
// UInt timestmp;
|
||||
//#ifdef TABLING
|
||||
// tr_fr_ptr loc;
|
||||
@ -85,12 +85,12 @@ typedef struct swi_reverse_hash {
|
||||
typedef void (*HaltHookFunc)(int, void *);
|
||||
|
||||
typedef struct halt_hook {
|
||||
void * environment;
|
||||
void *environment;
|
||||
HaltHookFunc hook;
|
||||
struct halt_hook *next;
|
||||
} halt_hook_entry;
|
||||
|
||||
int Yap_HaltRegisterHook(HaltHookFunc, void *);
|
||||
int Yap_HaltRegisterHook(HaltHookFunc, void *);
|
||||
|
||||
typedef struct atom_hash_entry {
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
@ -99,7 +99,7 @@ typedef struct atom_hash_entry {
|
||||
Atom Entry;
|
||||
} AtomHashEntry;
|
||||
|
||||
//typedef struct scratch_block_struct {
|
||||
// typedef struct scratch_block_struct {
|
||||
// char *ptr;
|
||||
// UInt sz, msz;
|
||||
//} scratch_block;
|
||||
@ -112,7 +112,7 @@ typedef struct record_list {
|
||||
|
||||
/* SWI Emulation */
|
||||
#define SWI_BUF_SIZE 512
|
||||
#define SWI_TMP_BUF_SIZE 2*SWI_BUF_SIZE
|
||||
#define SWI_TMP_BUF_SIZE 2 * SWI_BUF_SIZE
|
||||
#define SWI_BUF_RINGS 16
|
||||
|
||||
/* ricardo
|
||||
@ -151,21 +151,51 @@ typedef struct thandle {
|
||||
} yap_thandle;
|
||||
#endif */
|
||||
|
||||
//typedef int (*Agc_hook)(Atom);
|
||||
// typedef int (*Agc_hook)(Atom);
|
||||
|
||||
/*******************
|
||||
this is the data base: everything here should be possible to restore
|
||||
********************/
|
||||
#if YAPOR
|
||||
typedef struct various_codes {
|
||||
/* memory allocation and management */
|
||||
special_functors funcs;
|
||||
|
||||
#include "hstruct.h"
|
||||
#include "heap/hstruct.h"
|
||||
|
||||
} all_heap_codes;
|
||||
|
||||
//#include "hglobals.h"
|
||||
//#include "hlocals.h"
|
||||
#include "heap/hglobals.h"
|
||||
|
||||
#include "heap/dhstruct.h"
|
||||
#include "heap/dglobals.h"
|
||||
#else
|
||||
typedef struct various_codes {
|
||||
/* memory allocation and management */
|
||||
special_functors funcs;
|
||||
|
||||
#include "tatoms.h"
|
||||
|
||||
} all_heap_codes;
|
||||
|
||||
#if __INIT_C__
|
||||
#define EXTERNAL
|
||||
#else
|
||||
#define EXTERNAL extern
|
||||
#endif
|
||||
|
||||
#include "heap/h0struct.h"
|
||||
|
||||
#include "heap/h0globals.h"
|
||||
|
||||
#endif
|
||||
|
||||
#include "heap/hlocals.h"
|
||||
|
||||
|
||||
|
||||
#include "heap/dlocals.h"
|
||||
|
||||
|
||||
/* ricardo
|
||||
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
|
||||
@ -191,74 +221,56 @@ extern struct worker_local Yap_local;
|
||||
#ifdef USE_SYSTEM_MALLOC
|
||||
extern struct various_codes *Yap_heap_regs;
|
||||
#else
|
||||
#define Yap_heap_regs ((all_heap_codes *)HEAP_INIT_BASE)
|
||||
#define Yap_heap_regs ((all_heap_codes *)HEAP_INIT_BASE)
|
||||
#endif
|
||||
|
||||
#include "dhstruct.h"
|
||||
//#include "dglobals.h"
|
||||
//#include "dlocals.h"
|
||||
|
||||
/**
|
||||
* gc-P: how to start-up the grbage collector in C-code
|
||||
*/
|
||||
|
||||
static inline
|
||||
yamop *
|
||||
gc_P(yamop *p, yamop *cp)
|
||||
{
|
||||
return (p->opc == EXECUTE_CPRED_OPCODE ? cp : p);
|
||||
static inline yamop *gc_P(yamop *p, yamop *cp) {
|
||||
return (p && p->opc == EXECUTE_CPRED_OPCODE ? cp : p);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Yap_CurrentModule: access the current module for looking
|
||||
up predicates
|
||||
*/
|
||||
|
||||
#define Yap_CurrentModule() Yap_CurrentModule__ (PASS_REGS1)
|
||||
#define Yap_CurrentModule() Yap_CurrentModule__(PASS_REGS1)
|
||||
|
||||
INLINE_ONLY inline EXTERN Term Yap_CurrentModule__ (USES_REGS1) ;
|
||||
INLINE_ONLY inline EXTERN Term Yap_CurrentModule__(USES_REGS1);
|
||||
|
||||
INLINE_ONLY inline EXTERN Term
|
||||
Yap_CurrentModule__ (USES_REGS1)
|
||||
{
|
||||
if (CurrentModule) return CurrentModule;
|
||||
INLINE_ONLY inline EXTERN Term Yap_CurrentModule__(USES_REGS1) {
|
||||
if (CurrentModule)
|
||||
return CurrentModule;
|
||||
return TermProlog;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************
|
||||
these are the global variables: they need not be restored...
|
||||
********************/
|
||||
|
||||
#define UPDATE_MODE_IMMEDIATE 0
|
||||
#define UPDATE_MODE_LOGICAL 1
|
||||
#define UPDATE_MODE_LOGICAL_ASSERT 2
|
||||
|
||||
|
||||
|
||||
#define UPDATE_MODE_IMMEDIATE 0
|
||||
#define UPDATE_MODE_LOGICAL 1
|
||||
#define UPDATE_MODE_LOGICAL_ASSERT 2
|
||||
|
||||
/* initially allow for files with up to 1024 predicates. This number
|
||||
is extended whenever needed */
|
||||
#define InitialConsultCapacity 1024
|
||||
#define InitialConsultCapacity 1024
|
||||
|
||||
|
||||
#if (defined(USE_SYSTEM_MALLOC) && HAVE_MALLINFO)||USE_DL_MALLOC
|
||||
#if (defined(USE_SYSTEM_MALLOC) && HAVE_MALLINFO) || USE_DL_MALLOC
|
||||
UInt Yap_givemallinfo(void);
|
||||
#endif
|
||||
|
||||
ADDR Yap_ExpandPreAllocCodeSpace(UInt, void *, int);
|
||||
ADDR Yap_ExpandPreAllocCodeSpace(UInt, void *, int);
|
||||
#define Yap_ReleasePreAllocCodeSpace(x)
|
||||
ADDR Yap_InitPreAllocCodeSpace(int);
|
||||
ADDR Yap_InitPreAllocCodeSpace(int);
|
||||
|
||||
#include "inline-only.h"
|
||||
INLINE_ONLY EXTERN inline ADDR
|
||||
Yap_PreAllocCodeSpace(void);
|
||||
INLINE_ONLY EXTERN inline ADDR Yap_PreAllocCodeSpace(void);
|
||||
|
||||
INLINE_ONLY EXTERN inline ADDR
|
||||
Yap_PreAllocCodeSpace(void)
|
||||
{
|
||||
INLINE_ONLY EXTERN inline ADDR Yap_PreAllocCodeSpace(void) {
|
||||
CACHE_REGS
|
||||
return AuxBase;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
YAP_FLAG( AUTOLOAD_FLAG, "autoload", true, boolean, "false" , NULL ),
|
||||
YAP_FLAG( BREAK_LEVEL_FLAG, "break_level", true, nat, "0" , NULL ),
|
||||
YAP_FLAG( ENCODING_FLAG, "encoding", true, isatom, "text" , getenc ),
|
||||
YAP_FLAG( ENCODING_FLAG, "encoding", true, isatom, "utf-8" , getenc ),
|
||||
YAP_FLAG( FILEERRORS_FLAG, "fileerrors", true, boolean, "true" , NULL ), /**< `fileerrors`
|
||||
|
||||
If `on` `fileerrors` is `on`, if `off` (default)
|
||||
|
11
H/YapText.h
@ -29,7 +29,7 @@
|
||||
*/
|
||||
|
||||
#include "Yap.h"
|
||||
#include "utf8proc.h"
|
||||
#include "../utf8proc/utf8proc.h"
|
||||
|
||||
/* Character types for tokenizer and write.c */
|
||||
|
||||
@ -56,7 +56,7 @@ typedef enum {
|
||||
|
||||
extern char_kind_t Yap_chtype0[];
|
||||
|
||||
#define Yap_chtype (Yap_chtype0+1)
|
||||
#define Yap_chtype (Yap_chtype0 + 1)
|
||||
|
||||
char_kind_t Yap_wide_chtype(int ch);
|
||||
|
||||
@ -483,8 +483,7 @@ static inline Term Yap_AtomToNumber(Term t0 USES_REGS) {
|
||||
inp.val.t = t0;
|
||||
inp.type = YAP_STRING_ATOM;
|
||||
out.val.uc = NULL;
|
||||
out.type =
|
||||
YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG;
|
||||
out.type = YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG;
|
||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||
return 0L;
|
||||
return out.val.t;
|
||||
@ -1213,11 +1212,9 @@ static inline Term Yap_StringToNumber(Term t0 USES_REGS) {
|
||||
}
|
||||
|
||||
static inline Term Yap_UTF8ToString(const char *s USES_REGS) {
|
||||
return MkStringTerm( s );
|
||||
return MkStringTerm(s);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static inline Term Yap_WCharsToListOfCodes(const wchar_t *s USES_REGS) {
|
||||
seq_tv_t inp, out;
|
||||
inp.val.w0 = s;
|
||||
|
@ -124,7 +124,7 @@ Atom Yap_ConsultingFile(USES_REGS1);
|
||||
struct pred_entry *Yap_PredForChoicePt(choiceptr bptr, op_numbers *op);
|
||||
void Yap_InitCdMgr(void);
|
||||
struct pred_entry *Yap_PredFromClause(Term t USES_REGS);
|
||||
bool Yap_discontiguous(struct pred_entry *ap USES_REGS);
|
||||
bool Yap_discontiguous(struct pred_entry *ap, Term mode USES_REGS);
|
||||
bool Yap_multiple(struct pred_entry *ap, int mode USES_REGS);
|
||||
void Yap_init_consult(int, const char *);
|
||||
void Yap_end_consult(void);
|
||||
@ -135,6 +135,8 @@ void Yap_ResetConsultStack(void);
|
||||
void Yap_AssertzClause(struct pred_entry *, yamop *);
|
||||
void Yap_HidePred(struct pred_entry *pe);
|
||||
int Yap_SetNoTrace(char *name, UInt arity, Term tmod);
|
||||
bool Yap_unknown(Term tflagvalue);
|
||||
struct pred_entry *Yap_MkLogPred(struct pred_entry *pe);
|
||||
|
||||
/* cmppreds.c */
|
||||
Int Yap_compare_terms(Term, Term);
|
||||
@ -176,6 +178,7 @@ bool Yap_Warning(const char *s, ...);
|
||||
bool Yap_PrintWarning(Term t);
|
||||
int Yap_HandleError(const char *msg, ...);
|
||||
int Yap_SWIHandleError(const char *, ...);
|
||||
void Yap_InitErrorPreds(void);
|
||||
|
||||
/* eval.c */
|
||||
void Yap_InitEval(void);
|
||||
@ -251,7 +254,7 @@ void Yap_CopyThreadStacks(int, int, int);
|
||||
/* heapgc.c */
|
||||
Int Yap_total_gc_time(void);
|
||||
void Yap_init_gc(void);
|
||||
int Yap_is_gc_verbose(void);
|
||||
bool Yap_is_gc_verbose(void);
|
||||
int Yap_gc(Int, CELL *, yamop *);
|
||||
int Yap_locked_gc(Int, CELL *, yamop *);
|
||||
int Yap_gcl(UInt, Int, CELL *, yamop *);
|
||||
@ -317,6 +320,8 @@ void Yap_InitModulesC(void);
|
||||
struct mod_entry *Yap_GetModuleEntry(Term tmod);
|
||||
Term Yap_GetModuleFromEntry(struct mod_entry *me);
|
||||
bool Yap_CharacterEscapes(Term mt);
|
||||
bool Yap_constPred(struct pred_entry *pt);
|
||||
bool Yap_isSystemModule(Term mod);
|
||||
|
||||
#if HAVE_MPI
|
||||
/* mpi.c */
|
||||
|
365
H/clause.h
@ -26,127 +26,126 @@
|
||||
typedef union CONSULT_OBJ {
|
||||
const unsigned char *filename;
|
||||
int mode;
|
||||
Prop p;
|
||||
Prop p;
|
||||
UInt c;
|
||||
} consult_obj;
|
||||
|
||||
/* Either we are assembling clauses or indexing code */
|
||||
|
||||
#define ASSEMBLING_CLAUSE 0
|
||||
#define ASSEMBLING_INDEX 1
|
||||
#define ASSEMBLING_EINDEX 2
|
||||
#define ASSEMBLING_CLAUSE 0
|
||||
#define ASSEMBLING_INDEX 1
|
||||
#define ASSEMBLING_EINDEX 2
|
||||
|
||||
#define NextDynamicClause(X) (((yamop *)X)->y_u.Otapl.d)
|
||||
#define NextDynamicClause(X) (((yamop *)X)->y_u.Otapl.d)
|
||||
|
||||
#define PredFirstClause 0
|
||||
#define PredMiddleClause 1
|
||||
#define PredLastClause 2
|
||||
#define PredFirstClause 0
|
||||
#define PredMiddleClause 1
|
||||
#define PredLastClause 2
|
||||
|
||||
typedef struct logic_upd_index {
|
||||
CELL ClFlags;
|
||||
UInt ClRefCount;
|
||||
CELL ClFlags;
|
||||
UInt ClRefCount;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
/* A lock for manipulating the clause */
|
||||
// lockvar ClLock;
|
||||
/* A lock for manipulating the clause */
|
||||
// lockvar ClLock;
|
||||
#endif
|
||||
UInt ClSize;
|
||||
UInt ClSize;
|
||||
struct logic_upd_index *ParentIndex;
|
||||
struct logic_upd_index *SiblingIndex;
|
||||
struct logic_upd_index *PrevSiblingIndex;
|
||||
struct logic_upd_index *ChildIndex;
|
||||
/* The instructions, at least one of the form sl */
|
||||
PredEntry *ClPred;
|
||||
yamop ClCode[MIN_ARRAY];
|
||||
yamop ClCode[MIN_ARRAY];
|
||||
} LogUpdIndex;
|
||||
|
||||
/* The ordering of the first 3 fields should be compatible with dbrefs */
|
||||
typedef struct logic_upd_clause {
|
||||
Functor Id; /* allow pointers to this struct to id */
|
||||
/* as dbref */
|
||||
Functor Id; /* allow pointers to this struct to id */
|
||||
/* as dbref */
|
||||
/* A set of flags describing info on the clause */
|
||||
/* A set of flags describing info on the clause */
|
||||
CELL ClFlags;
|
||||
CELL ClFlags;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
/* A lock for manipulating the clause */
|
||||
// lockvar ClLock;
|
||||
/* A lock for manipulating the clause */
|
||||
// lockvar ClLock;
|
||||
#endif
|
||||
UInt ClSize;
|
||||
UInt ClSize;
|
||||
/* extra clause information for logical update indices and facts */
|
||||
/* indices that may still backtrack to this clause */
|
||||
UInt ClRefCount;
|
||||
UInt ClRefCount;
|
||||
/* data for clauses with environments */
|
||||
yamop *ClExt;
|
||||
yamop *ClExt;
|
||||
union {
|
||||
DBTerm *ClSource;
|
||||
Int ClLine;
|
||||
DBTerm *ClSource;
|
||||
Int ClLine;
|
||||
} lusl;
|
||||
/* doubly linked list of clauses */
|
||||
struct logic_upd_clause *ClPrev, *ClNext;
|
||||
struct logic_upd_clause *ClPrev, *ClNext;
|
||||
/* parent pointer */
|
||||
PredEntry *ClPred;
|
||||
UInt ClTimeStart, ClTimeEnd;
|
||||
PredEntry *ClPred;
|
||||
UInt ClTimeStart, ClTimeEnd;
|
||||
/* The instructions, at least one of the form sl */
|
||||
yamop ClCode[MIN_ARRAY];
|
||||
yamop ClCode[MIN_ARRAY];
|
||||
} LogUpdClause;
|
||||
|
||||
#include "inline-only.h"
|
||||
INLINE_ONLY inline EXTERN int VALID_TIMESTAMP(UInt, struct logic_upd_clause *);
|
||||
|
||||
INLINE_ONLY inline EXTERN int
|
||||
VALID_TIMESTAMP(UInt timestamp, struct logic_upd_clause *cl)
|
||||
{
|
||||
INLINE_ONLY inline EXTERN int VALID_TIMESTAMP(UInt timestamp,
|
||||
struct logic_upd_clause *cl) {
|
||||
return IN_BETWEEN(cl->ClTimeStart, timestamp, cl->ClTimeEnd);
|
||||
}
|
||||
|
||||
typedef struct dynamic_clause {
|
||||
/* A set of flags describing info on the clause */
|
||||
CELL ClFlags;
|
||||
CELL ClFlags;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
/* A lock for manipulating the clause */
|
||||
lockvar ClLock;
|
||||
lockvar ClLock;
|
||||
#endif
|
||||
UInt ClSize;
|
||||
Int ClLine;
|
||||
UInt ClRefCount;
|
||||
yamop *ClPrevious; /* immediate update clause */
|
||||
UInt ClSize;
|
||||
Int ClLine;
|
||||
UInt ClRefCount;
|
||||
yamop *ClPrevious; /* immediate update clause */
|
||||
/* The instructions, at least one of the form sl */
|
||||
yamop ClCode[MIN_ARRAY];
|
||||
yamop ClCode[MIN_ARRAY];
|
||||
} DynamicClause;
|
||||
|
||||
typedef struct static_index {
|
||||
/* A set of flags describing info on the clause */
|
||||
CELL ClFlags;
|
||||
UInt ClSize;
|
||||
CELL ClFlags;
|
||||
UInt ClSize;
|
||||
struct static_index *SiblingIndex;
|
||||
struct static_index *ChildIndex;
|
||||
/* The instructions, at least one of the form sl */
|
||||
PredEntry *ClPred;
|
||||
yamop ClCode[MIN_ARRAY];
|
||||
yamop ClCode[MIN_ARRAY];
|
||||
} StaticIndex;
|
||||
|
||||
typedef struct static_clause {
|
||||
/* A set of flags describing info on the clause */
|
||||
CELL ClFlags;
|
||||
UInt ClSize;
|
||||
CELL ClFlags;
|
||||
UInt ClSize;
|
||||
union {
|
||||
DBTerm *ClSource;
|
||||
Int ClLine;
|
||||
DBTerm *ClSource;
|
||||
Int ClLine;
|
||||
} usc;
|
||||
struct static_clause *ClNext;
|
||||
struct static_clause *ClNext;
|
||||
/* The instructions, at least one of the form sl */
|
||||
yamop ClCode[MIN_ARRAY];
|
||||
yamop ClCode[MIN_ARRAY];
|
||||
} StaticClause;
|
||||
|
||||
typedef struct static_mega_clause {
|
||||
/* A set of flags describing info on the clause */
|
||||
CELL ClFlags;
|
||||
UInt ClSize;
|
||||
PredEntry *ClPred;
|
||||
UInt ClItemSize;
|
||||
Int ClLine;
|
||||
struct static_mega_clause *ClNext;
|
||||
CELL ClFlags;
|
||||
UInt ClSize;
|
||||
PredEntry *ClPred;
|
||||
UInt ClItemSize;
|
||||
Int ClLine;
|
||||
struct static_mega_clause *ClNext;
|
||||
/* The instructions, at least one of the form sl */
|
||||
yamop ClCode[MIN_ARRAY];
|
||||
yamop ClCode[MIN_ARRAY];
|
||||
} MegaClause;
|
||||
|
||||
typedef union clause_obj {
|
||||
@ -191,43 +190,43 @@ typedef struct index_t {
|
||||
UInt udi_arg;
|
||||
} Index_t;
|
||||
|
||||
INLINE_ONLY EXTERN inline BITS32 EXO_ADDRESS_TO_OFFSET(struct index_t *it, CELL *ptr);
|
||||
INLINE_ONLY EXTERN inline BITS32 EXO_ADDRESS_TO_OFFSET(struct index_t *it,
|
||||
CELL *ptr);
|
||||
|
||||
INLINE_ONLY EXTERN inline BITS32
|
||||
EXO_ADDRESS_TO_OFFSET(struct index_t *it, CELL* ptr)
|
||||
{
|
||||
return (ptr-it->cls)/it->arity+1;
|
||||
INLINE_ONLY EXTERN inline BITS32 EXO_ADDRESS_TO_OFFSET(struct index_t *it,
|
||||
CELL *ptr) {
|
||||
return (ptr - it->cls) / it->arity + 1;
|
||||
}
|
||||
|
||||
INLINE_ONLY EXTERN inline CELL *EXO_OFFSET_TO_ADDRESS(struct index_t *it, BITS32 off);
|
||||
INLINE_ONLY EXTERN inline CELL *EXO_OFFSET_TO_ADDRESS(struct index_t *it,
|
||||
BITS32 off);
|
||||
|
||||
INLINE_ONLY EXTERN inline CELL *
|
||||
EXO_OFFSET_TO_ADDRESS(struct index_t *it, BITS32 off)
|
||||
{
|
||||
INLINE_ONLY EXTERN inline CELL *EXO_OFFSET_TO_ADDRESS(struct index_t *it,
|
||||
BITS32 off) {
|
||||
if (off == 0L)
|
||||
return (CELL *)NULL;
|
||||
return (it->cls)+(off-1)*it->arity;
|
||||
return (it->cls) + (off - 1) * it->arity;
|
||||
}
|
||||
|
||||
INLINE_ONLY EXTERN inline BITS32 ADDRESS_TO_LINK(struct index_t *it, BITS32 *ptr);
|
||||
INLINE_ONLY EXTERN inline BITS32 ADDRESS_TO_LINK(struct index_t *it,
|
||||
BITS32 *ptr);
|
||||
|
||||
INLINE_ONLY EXTERN inline BITS32
|
||||
ADDRESS_TO_LINK(struct index_t *it, BITS32* ptr)
|
||||
{
|
||||
return ptr-it->links;
|
||||
INLINE_ONLY EXTERN inline BITS32 ADDRESS_TO_LINK(struct index_t *it,
|
||||
BITS32 *ptr) {
|
||||
return ptr - it->links;
|
||||
}
|
||||
|
||||
INLINE_ONLY EXTERN inline BITS32 *LINK_TO_ADDRESS(struct index_t *it, BITS32 off);
|
||||
INLINE_ONLY EXTERN inline BITS32 *LINK_TO_ADDRESS(struct index_t *it,
|
||||
BITS32 off);
|
||||
|
||||
INLINE_ONLY EXTERN inline BITS32 *
|
||||
LINK_TO_ADDRESS(struct index_t *it, BITS32 off)
|
||||
{
|
||||
return it->links+off;
|
||||
INLINE_ONLY EXTERN inline BITS32 *LINK_TO_ADDRESS(struct index_t *it,
|
||||
BITS32 off) {
|
||||
return it->links + off;
|
||||
}
|
||||
|
||||
typedef void (*CRefitExoIndex)(struct index_t **ip, UInt b[] USES_REGS);
|
||||
typedef yamop * (*CEnterExoIndex)(struct index_t *it USES_REGS);
|
||||
typedef int (*CRetryExoIndex)(struct index_t *it USES_REGS);
|
||||
typedef yamop *(*CEnterExoIndex)(struct index_t *it USES_REGS);
|
||||
typedef int (*CRetryExoIndex)(struct index_t *it USES_REGS);
|
||||
|
||||
typedef struct dbterm_list {
|
||||
/* a list of dbterms associated with a clause */
|
||||
@ -237,72 +236,81 @@ typedef struct dbterm_list {
|
||||
struct dbterm_list *next_dbl;
|
||||
} DBTermList;
|
||||
|
||||
#define ClauseCodeToDynamicClause(p) ((DynamicClause *)((CODEADDR)(p)-(CELL)(((DynamicClause *)NULL)->ClCode)))
|
||||
#define ClauseCodeToStaticClause(p) ((StaticClause *)((CODEADDR)(p)-(CELL)(((StaticClause *)NULL)->ClCode)))
|
||||
#define ClauseCodeToLogUpdClause(p) ((LogUpdClause *)((CODEADDR)(p)-(CELL)(((LogUpdClause *)NULL)->ClCode)))
|
||||
#define ClauseCodeToMegaClause(p) ((MegaClause *)((CODEADDR)(p)-(CELL)(((MegaClause *)NULL)->ClCode)))
|
||||
#define ClauseCodeToLogUpdIndex(p) ((LogUpdIndex *)((CODEADDR)(p)-(CELL)(((LogUpdIndex *)NULL)->ClCode)))
|
||||
#define ClauseCodeToStaticIndex(p) ((StaticIndex *)((CODEADDR)(p)-(CELL)(((StaticIndex *)NULL)->ClCode)))
|
||||
#define ClauseCodeToDynamicClause(p) \
|
||||
((DynamicClause *)((CODEADDR)(p) - (CELL)(((DynamicClause *)NULL)->ClCode)))
|
||||
#define ClauseCodeToStaticClause(p) \
|
||||
((StaticClause *)((CODEADDR)(p) - (CELL)(((StaticClause *)NULL)->ClCode)))
|
||||
#define ClauseCodeToLogUpdClause(p) \
|
||||
((LogUpdClause *)((CODEADDR)(p) - (CELL)(((LogUpdClause *)NULL)->ClCode)))
|
||||
#define ClauseCodeToMegaClause(p) \
|
||||
((MegaClause *)((CODEADDR)(p) - (CELL)(((MegaClause *)NULL)->ClCode)))
|
||||
#define ClauseCodeToLogUpdIndex(p) \
|
||||
((LogUpdIndex *)((CODEADDR)(p) - (CELL)(((LogUpdIndex *)NULL)->ClCode)))
|
||||
#define ClauseCodeToStaticIndex(p) \
|
||||
((StaticIndex *)((CODEADDR)(p) - (CELL)(((StaticIndex *)NULL)->ClCode)))
|
||||
|
||||
#define ClauseFlagsToDynamicClause(p) ((DynamicClause *)(p))
|
||||
#define ClauseFlagsToLogUpdClause(p) ((LogUpdClause *)((CODEADDR)(p)-(CELL)(&(((LogUpdClause *)NULL)->ClFlags))))
|
||||
#define ClauseFlagsToLogUpdIndex(p) ((LogUpdIndex *)((CODEADDR)(p)-(CELL)(&(((LogUpdIndex *)NULL)->ClFlags))))
|
||||
#define ClauseFlagsToStaticClause(p) ((StaticClause *)(p))
|
||||
#define ClauseFlagsToDynamicClause(p) ((DynamicClause *)(p))
|
||||
#define ClauseFlagsToLogUpdClause(p) \
|
||||
((LogUpdClause *)((CODEADDR)(p) - (CELL)(&(((LogUpdClause *)NULL)->ClFlags))))
|
||||
#define ClauseFlagsToLogUpdIndex(p) \
|
||||
((LogUpdIndex *)((CODEADDR)(p) - (CELL)(&(((LogUpdIndex *)NULL)->ClFlags))))
|
||||
#define ClauseFlagsToStaticClause(p) ((StaticClause *)(p))
|
||||
|
||||
#define DynamicFlags(X) (ClauseCodeToDynamicClause(X)->ClFlags)
|
||||
#define DynamicFlags(X) (ClauseCodeToDynamicClause(X)->ClFlags)
|
||||
|
||||
#define DynamicLock(X) (ClauseCodeToDynamicClause(X)->ClLock)
|
||||
#define DynamicLock(X) (ClauseCodeToDynamicClause(X)->ClLock)
|
||||
|
||||
#if MULTIPLE_STACKS
|
||||
#define INIT_CLREF_COUNT(X) (X)->ClRefCount = 0
|
||||
#define INC_CLREF_COUNT(X) (X)->ClRefCount++
|
||||
#define DEC_CLREF_COUNT(X) (X)->ClRefCount--
|
||||
#define INC_CLREF_COUNT(X) (X)->ClRefCount++
|
||||
#define DEC_CLREF_COUNT(X) (X)->ClRefCount--
|
||||
|
||||
#define CL_IN_USE(X) ((X)->ClRefCount)
|
||||
#define CL_IN_USE(X) ((X)->ClRefCount)
|
||||
#else
|
||||
#define INIT_CLREF_COUNT(X)
|
||||
#define INC_CLREF_COUNT(X)
|
||||
#define DEC_CLREF_COUNT(X)
|
||||
#define CL_IN_USE(X) ((X)->ClFlags & InUseMask || (X)->ClRefCount)
|
||||
#define INC_CLREF_COUNT(X)
|
||||
#define DEC_CLREF_COUNT(X)
|
||||
#define CL_IN_USE(X) ((X)->ClFlags & InUseMask || (X)->ClRefCount)
|
||||
#endif
|
||||
|
||||
/* amasm.c */
|
||||
wamreg Yap_emit_x(CELL);
|
||||
COUNT Yap_compile_cmp_flags(PredEntry *);
|
||||
void Yap_InitComma(void);
|
||||
wamreg Yap_emit_x(CELL);
|
||||
COUNT Yap_compile_cmp_flags(PredEntry *);
|
||||
void Yap_InitComma(void);
|
||||
|
||||
/* cdmgr.c */
|
||||
void Yap_IPred(PredEntry *, UInt, yamop *);
|
||||
int Yap_addclause(Term,yamop *,int,Term,Term*);
|
||||
void Yap_add_logupd_clause(PredEntry *,LogUpdClause *,int);
|
||||
void Yap_kill_iblock(ClauseUnion *,ClauseUnion *,PredEntry *);
|
||||
void Yap_EraseStaticClause(StaticClause *, PredEntry *, Term);
|
||||
void Yap_IPred(PredEntry *, UInt, yamop *);
|
||||
bool Yap_addclause(Term, yamop *, int, Term, Term *);
|
||||
void Yap_add_logupd_clause(PredEntry *, LogUpdClause *, int);
|
||||
void Yap_kill_iblock(ClauseUnion *, ClauseUnion *, PredEntry *);
|
||||
void Yap_EraseStaticClause(StaticClause *, PredEntry *, Term);
|
||||
ClauseUnion *Yap_find_owner_index(yamop *, PredEntry *);
|
||||
|
||||
/* dbase.c */
|
||||
void Yap_ErCl(DynamicClause *);
|
||||
void Yap_ErLogUpdCl(LogUpdClause *);
|
||||
void Yap_ErLogUpdIndex(LogUpdIndex *);
|
||||
Int Yap_Recordz(Atom, Term);
|
||||
Int Yap_db_nth_recorded( PredEntry *, Int USES_REGS );
|
||||
Int Yap_unify_immediate_ref(DBRef ref USES_REGS );
|
||||
void Yap_ErCl(DynamicClause *);
|
||||
void Yap_ErLogUpdCl(LogUpdClause *);
|
||||
void Yap_ErLogUpdIndex(LogUpdIndex *);
|
||||
Int Yap_Recordz(Atom, Term);
|
||||
Int Yap_db_nth_recorded(PredEntry *, Int USES_REGS);
|
||||
Int Yap_unify_immediate_ref(DBRef ref USES_REGS);
|
||||
|
||||
/* exec.c */
|
||||
Term Yap_cp_as_integer(choiceptr);
|
||||
Term Yap_cp_as_integer(choiceptr);
|
||||
|
||||
/* index.c */
|
||||
yamop *Yap_PredIsIndexable(PredEntry *, UInt, yamop *);
|
||||
yamop *Yap_ExpandIndex(PredEntry *, UInt);
|
||||
void Yap_CleanUpIndex(struct logic_upd_index *);
|
||||
void Yap_CleanKids(struct logic_upd_index *);
|
||||
void Yap_AddClauseToIndex(PredEntry *,yamop *,int);
|
||||
void Yap_RemoveClauseFromIndex(PredEntry *,yamop *);
|
||||
LogUpdClause *Yap_NthClause(PredEntry *,Int);
|
||||
LogUpdClause *Yap_FollowIndexingCode(PredEntry *,yamop *, Term *, yamop *,yamop *);
|
||||
yamop *Yap_PredIsIndexable(PredEntry *, UInt, yamop *);
|
||||
yamop *Yap_ExpandIndex(PredEntry *, UInt);
|
||||
void Yap_CleanUpIndex(struct logic_upd_index *);
|
||||
void Yap_CleanKids(struct logic_upd_index *);
|
||||
void Yap_AddClauseToIndex(PredEntry *, yamop *, int);
|
||||
void Yap_RemoveClauseFromIndex(PredEntry *, yamop *);
|
||||
LogUpdClause *Yap_NthClause(PredEntry *, Int);
|
||||
LogUpdClause *Yap_FollowIndexingCode(PredEntry *, yamop *, Term *, yamop *,
|
||||
yamop *);
|
||||
|
||||
/* exo.c */
|
||||
yamop *Yap_ExoLookup(PredEntry *ap USES_REGS);
|
||||
CELL Yap_NextExo(choiceptr cpt, struct index_t *it);
|
||||
yamop *Yap_ExoLookup(PredEntry *ap USES_REGS);
|
||||
CELL Yap_NextExo(choiceptr cpt, struct index_t *it);
|
||||
|
||||
#
|
||||
#if USE_THREADED_CODE
|
||||
@ -311,24 +319,21 @@ CELL Yap_NextExo(choiceptr cpt, struct index_t *it);
|
||||
|
||||
INLINE_ONLY inline EXTERN int rtable_hash_op(OPCODE opc, int hash_mask);
|
||||
|
||||
INLINE_ONLY inline EXTERN int
|
||||
rtable_hash_op(OPCODE opc, int hash_mask) {
|
||||
return((((CELL)opc) >> 3) & hash_mask);
|
||||
INLINE_ONLY inline EXTERN int rtable_hash_op(OPCODE opc, int hash_mask) {
|
||||
return ((((CELL)opc) >> 3) & hash_mask);
|
||||
}
|
||||
|
||||
INLINE_ONLY inline EXTERN op_numbers Yap_op_from_opcode(OPCODE opc);
|
||||
|
||||
/* given an opcode find the corresponding opnumber. This should make
|
||||
switches on ops a much easier operation */
|
||||
INLINE_ONLY inline EXTERN op_numbers
|
||||
Yap_op_from_opcode(OPCODE opc)
|
||||
{
|
||||
int j = rtable_hash_op(opc,OP_HASH_SIZE-1);
|
||||
INLINE_ONLY inline EXTERN op_numbers Yap_op_from_opcode(OPCODE opc) {
|
||||
int j = rtable_hash_op(opc, OP_HASH_SIZE - 1);
|
||||
|
||||
while (OP_RTABLE[j].opc != opc) {
|
||||
if (!OP_RTABLE[j].opc)
|
||||
return _Nstop;
|
||||
if (j == OP_HASH_SIZE-1) {
|
||||
if (j == OP_HASH_SIZE - 1) {
|
||||
j = 0;
|
||||
} else {
|
||||
j++;
|
||||
@ -337,26 +342,23 @@ Yap_op_from_opcode(OPCODE opc)
|
||||
return OP_RTABLE[j].opnum;
|
||||
}
|
||||
#else
|
||||
static inline op_numbers
|
||||
Yap_op_from_opcode(OPCODE opc)
|
||||
{
|
||||
return((op_numbers)opc);
|
||||
static inline op_numbers Yap_op_from_opcode(OPCODE opc) {
|
||||
return ((op_numbers)opc);
|
||||
}
|
||||
#endif /* USE_THREADED_CODE */
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
static inline int same_lu_block(yamop **, yamop *);
|
||||
|
||||
static inline int
|
||||
same_lu_block(yamop **paddr, yamop *p)
|
||||
{
|
||||
static inline int same_lu_block(yamop **paddr, yamop *p) {
|
||||
yamop *np = *paddr;
|
||||
if (np != p) {
|
||||
OPCODE jmp_op = Yap_opcode(_jump_if_nonvar);
|
||||
|
||||
while (np->opc == jmp_op) {
|
||||
np = NEXTOP(np, xll);
|
||||
if (np == p) return TRUE;
|
||||
if (np == p)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
} else {
|
||||
@ -365,86 +367,69 @@ same_lu_block(yamop **paddr, yamop *p)
|
||||
}
|
||||
#endif
|
||||
|
||||
#define Yap_MkStaticRefTerm(cp, ap) __Yap_MkStaticRefTerm((cp), (ap) PASS_REGS)
|
||||
#define Yap_MkStaticRefTerm(cp, ap) __Yap_MkStaticRefTerm((cp), (ap)PASS_REGS)
|
||||
|
||||
static inline Term
|
||||
__Yap_MkStaticRefTerm(StaticClause *cp, PredEntry *ap USES_REGS)
|
||||
{
|
||||
static inline Term __Yap_MkStaticRefTerm(StaticClause *cp,
|
||||
PredEntry *ap USES_REGS) {
|
||||
Term t[2];
|
||||
t[0] = MkIntegerTerm((Int)cp);
|
||||
t[1] = MkIntegerTerm((Int)ap);
|
||||
return Yap_MkApplTerm(FunctorStaticClause,2,t);
|
||||
return Yap_MkApplTerm(FunctorStaticClause, 2, t);
|
||||
}
|
||||
|
||||
static inline StaticClause *
|
||||
Yap_ClauseFromTerm(Term t)
|
||||
{
|
||||
return (StaticClause *)IntegerOfTerm(ArgOfTerm(1,t));
|
||||
static inline StaticClause *Yap_ClauseFromTerm(Term t) {
|
||||
return (StaticClause *)IntegerOfTerm(ArgOfTerm(1, t));
|
||||
}
|
||||
|
||||
#define Yap_MkMegaRefTerm(ap, ipc) __Yap_MkMegaRefTerm((ap), (ipc) PASS_REGS)
|
||||
#define Yap_MkMegaRefTerm(ap, ipc) __Yap_MkMegaRefTerm((ap), (ipc)PASS_REGS)
|
||||
|
||||
static inline Term
|
||||
__Yap_MkMegaRefTerm(PredEntry *ap,yamop *ipc USES_REGS)
|
||||
{
|
||||
static inline Term __Yap_MkMegaRefTerm(PredEntry *ap, yamop *ipc USES_REGS) {
|
||||
Term t[2];
|
||||
t[0] = MkIntegerTerm((Int)ap);
|
||||
t[1] = MkIntegerTerm((Int)ipc);
|
||||
return Yap_MkApplTerm(FunctorMegaClause,2,t);
|
||||
return Yap_MkApplTerm(FunctorMegaClause, 2, t);
|
||||
}
|
||||
|
||||
static inline yamop *
|
||||
Yap_MegaClauseFromTerm(Term t)
|
||||
{
|
||||
return (yamop *)IntegerOfTerm(ArgOfTerm(2,t));
|
||||
static inline yamop *Yap_MegaClauseFromTerm(Term t) {
|
||||
return (yamop *)IntegerOfTerm(ArgOfTerm(2, t));
|
||||
}
|
||||
|
||||
static inline PredEntry *
|
||||
Yap_MegaClausePredicateFromTerm(Term t)
|
||||
{
|
||||
return (PredEntry *)IntegerOfTerm(ArgOfTerm(1,t));
|
||||
static inline PredEntry *Yap_MegaClausePredicateFromTerm(Term t) {
|
||||
return (PredEntry *)IntegerOfTerm(ArgOfTerm(1, t));
|
||||
}
|
||||
|
||||
#define Yap_MkExoRefTerm(ap, i) __Yap_MkExoRefTerm((ap), (i) PASS_REGS)
|
||||
#define Yap_MkExoRefTerm(ap, i) __Yap_MkExoRefTerm((ap), (i)PASS_REGS)
|
||||
|
||||
static inline Term
|
||||
__Yap_MkExoRefTerm(PredEntry *ap,Int i USES_REGS)
|
||||
{
|
||||
static inline Term __Yap_MkExoRefTerm(PredEntry *ap, Int i USES_REGS) {
|
||||
Term t[2];
|
||||
t[0] = MkIntegerTerm((Int)ap);
|
||||
t[1] = MkIntegerTerm((Int)i);
|
||||
return Yap_MkApplTerm(FunctorExoClause,2,t);
|
||||
return Yap_MkApplTerm(FunctorExoClause, 2, t);
|
||||
}
|
||||
|
||||
static inline Int
|
||||
Yap_ExoClauseFromTerm(Term t)
|
||||
{
|
||||
return IntegerOfTerm(ArgOfTerm(2,t));
|
||||
static inline Int Yap_ExoClauseFromTerm(Term t) {
|
||||
return IntegerOfTerm(ArgOfTerm(2, t));
|
||||
}
|
||||
|
||||
static inline PredEntry *
|
||||
Yap_ExoClausePredicateFromTerm(Term t)
|
||||
{
|
||||
return (PredEntry *)IntegerOfTerm(ArgOfTerm(1,t));
|
||||
static inline PredEntry *Yap_ExoClausePredicateFromTerm(Term t) {
|
||||
return (PredEntry *)IntegerOfTerm(ArgOfTerm(1, t));
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
||||
EXECUTING PROLOG CLAUSES
|
||||
EXECUTING PROLOG CLAUSES
|
||||
|
||||
******************************************************************/
|
||||
|
||||
bool
|
||||
Yap_search_for_static_predicate_in_use(PredEntry *p, bool check_everything);
|
||||
bool Yap_search_for_static_predicate_in_use(PredEntry *p,
|
||||
bool check_everything);
|
||||
|
||||
static inline bool
|
||||
Yap_static_in_use(PredEntry *p, bool check_everything)
|
||||
{
|
||||
static inline bool Yap_static_in_use(PredEntry *p, bool check_everything) {
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
return TRUE;
|
||||
#else
|
||||
pred_flags_t pflags = p->PredFlags;
|
||||
if (pflags & (DynamicPredFlag|LogUpdatePredFlag)) {
|
||||
if (pflags & (DynamicPredFlag | LogUpdatePredFlag)) {
|
||||
return FALSE;
|
||||
}
|
||||
if (STATIC_PREDICATES_MARKED) {
|
||||
@ -464,24 +449,24 @@ typedef enum {
|
||||
FIND_PRED_FROM_ENV
|
||||
} find_pred_type;
|
||||
|
||||
Int Yap_PredForCode(yamop *, find_pred_type, Atom *, UInt *, Term *);
|
||||
PredEntry *Yap_PredEntryForCode(yamop *, find_pred_type, void* *, void* *);
|
||||
LogUpdClause *Yap_new_ludbe(Term, PredEntry *, UInt);
|
||||
Term Yap_LUInstance(LogUpdClause *, UInt);
|
||||
Int Yap_PredForCode(yamop *, find_pred_type, Atom *, UInt *, Term *);
|
||||
PredEntry *Yap_PredEntryForCode(yamop *, find_pred_type, void **, void **);
|
||||
LogUpdClause *Yap_new_ludbe(Term, PredEntry *, UInt);
|
||||
Term Yap_LUInstance(LogUpdClause *, UInt);
|
||||
|
||||
/* udi.c */
|
||||
int Yap_new_udi_clause(PredEntry *, yamop *, Term);
|
||||
yamop *Yap_udi_search(PredEntry *);
|
||||
int Yap_new_udi_clause(PredEntry *, yamop *, Term);
|
||||
yamop *Yap_udi_search(PredEntry *);
|
||||
|
||||
Term Yap_bug_location(yamop *p, yamop *cp, choiceptr b_ptr, CELL *env);
|
||||
Term Yap_pc_location(yamop *p, choiceptr b_ptr, CELL *env);
|
||||
Term Yap_env_location(yamop *p, choiceptr b_ptr, CELL *env, Int ignore_first);
|
||||
Term Yap_bug_location(yamop *p, yamop *cp, choiceptr b_ptr, CELL *env);
|
||||
Term Yap_pc_location(yamop *p, choiceptr b_ptr, CELL *env);
|
||||
Term Yap_env_location(yamop *p, choiceptr b_ptr, CELL *env, Int ignore_first);
|
||||
|
||||
#if LOW_PROF
|
||||
void Yap_InformOfRemoval(void *);
|
||||
void Yap_dump_code_area_for_profiler(void);
|
||||
#if LOW_PROF
|
||||
void Yap_InformOfRemoval(void *);
|
||||
void Yap_dump_code_area_for_profiler(void);
|
||||
#else
|
||||
#define Yap_InformOfRemoval(X)
|
||||
#define Yap_InformOfRemoval(X)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
303
H/dhstruct.h
@ -1,303 +0,0 @@
|
||||
|
||||
/* This file, dhstruct.h, was generated automatically by "yap -L misc/buildheap"
|
||||
please do not update, update misc/HEAPFIELDS instead */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define Yap_HoleSize Yap_heap_regs->hole_size
|
||||
#define Yap_av Yap_heap_regs->av_
|
||||
#if USE_DL_MALLOC
|
||||
#define Yap_MemoryHoles Yap_heap_regs->memory_holes
|
||||
#define Yap_NOfMemoryHoles Yap_heap_regs->nof_memory_holes
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define DLMallocLock Yap_heap_regs->dlmalloc_lock
|
||||
#endif
|
||||
#endif
|
||||
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
|
||||
#ifndef HeapUsed
|
||||
#define HeapUsed Yap_givemallinfo()
|
||||
#endif
|
||||
#define NotHeapUsed Yap_heap_regs->heap_used
|
||||
#else
|
||||
#define HeapUsed Yap_heap_regs->heap_used
|
||||
#endif
|
||||
#define HeapMax Yap_heap_regs->heap_max
|
||||
#define HeapTop Yap_heap_regs->heap_top
|
||||
#define HeapLim Yap_heap_regs->heap_lim
|
||||
#define FreeBlocks Yap_heap_regs->free_blocks
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define FreeBlocksLock Yap_heap_regs->free_blocks_lock
|
||||
#define HeapUsedLock Yap_heap_regs->heap_used_lock
|
||||
#define HeapTopLock Yap_heap_regs->heap_top_lock
|
||||
#define HeapTopOwner Yap_heap_regs->heap_top_owner
|
||||
#endif
|
||||
#define MaxStack Yap_heap_regs->MaxStack_
|
||||
#define MaxTrail Yap_heap_regs->MaxTrail_
|
||||
|
||||
|
||||
#if USE_THREADED_CODE
|
||||
#define OP_RTABLE Yap_heap_regs->op_rtable
|
||||
#endif
|
||||
|
||||
#define EXECUTE_CPRED_OP_CODE Yap_heap_regs->execute_cpred_op_code
|
||||
#define EXPAND_OP_CODE Yap_heap_regs->expand_op_code
|
||||
#define FAIL_OPCODE Yap_heap_regs->fail_op
|
||||
#define INDEX_OPCODE Yap_heap_regs->index_op
|
||||
#define LOCKPRED_OPCODE Yap_heap_regs->lockpred_op
|
||||
#define ORLAST_OPCODE Yap_heap_regs->orlast_op
|
||||
#define UNDEF_OPCODE Yap_heap_regs->undef_op
|
||||
#define RETRY_USERC_OPCODE Yap_heap_regs->retry_userc_op
|
||||
#define EXECUTE_CPRED_OPCODE Yap_heap_regs->execute_cpred_op
|
||||
|
||||
#define NOfAtoms Yap_heap_regs->n_of_atoms
|
||||
#define AtomHashTableSize Yap_heap_regs->atom_hash_table_size
|
||||
#define WideAtomHashTableSize Yap_heap_regs->wide_atom_hash_table_size
|
||||
#define NOfWideAtoms Yap_heap_regs->n_of_wide_atoms
|
||||
#define INVISIBLECHAIN Yap_heap_regs->invisiblechain
|
||||
#define WideHashChain Yap_heap_regs->wide_hash_chain
|
||||
#define HashChain Yap_heap_regs->hash_chain
|
||||
|
||||
|
||||
#ifdef EUROTRA
|
||||
#define TermDollarU Yap_heap_regs->term_dollar_u
|
||||
#endif
|
||||
|
||||
#define USER_MODULE Yap_heap_regs->user_module
|
||||
#define IDB_MODULE Yap_heap_regs->idb_module
|
||||
#define ATTRIBUTES_MODULE Yap_heap_regs->attributes_module
|
||||
#define CHARSIO_MODULE Yap_heap_regs->charsio_module
|
||||
#define CHTYPE_MODULE Yap_heap_regs->chtype_module
|
||||
#define TERMS_MODULE Yap_heap_regs->terms_module
|
||||
#define SYSTEM_MODULE Yap_heap_regs->system_module
|
||||
#define READUTIL_MODULE Yap_heap_regs->readutil_module
|
||||
#define HACKS_MODULE Yap_heap_regs->hacks_module
|
||||
#define ARG_MODULE Yap_heap_regs->arg_module
|
||||
#define GLOBALS_MODULE Yap_heap_regs->globals_module
|
||||
#define SWI_MODULE Yap_heap_regs->swi_module
|
||||
#define DBLOAD_MODULE Yap_heap_regs->dbload_module
|
||||
#define RANGE_MODULE Yap_heap_regs->range_module
|
||||
|
||||
|
||||
|
||||
#define CurrentModules Yap_heap_regs->current_modules
|
||||
|
||||
|
||||
|
||||
|
||||
#define HIDDEN_PREDICATES Yap_heap_regs->hidden_predicates
|
||||
|
||||
|
||||
|
||||
#define GLOBAL_Flags Yap_heap_regs->GLOBAL_Flags_
|
||||
#define GLOBAL_flagCount Yap_heap_regs->GLOBAL_flagCount_
|
||||
|
||||
#define Yap_ExecutionMode Yap_heap_regs->execution_mode
|
||||
|
||||
#define PredHash Yap_heap_regs->pred_hash
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define PredHashRWLock Yap_heap_regs->pred_hash_rw_lock
|
||||
#endif
|
||||
#define PredsInHashTable Yap_heap_regs->preds_in_hash_table
|
||||
#define PredHashTableSize Yap_heap_regs->pred_hash_table_size
|
||||
|
||||
#define CreepCode Yap_heap_regs->creep_code
|
||||
#define UndefCode Yap_heap_regs->undef_code
|
||||
#define SpyCode Yap_heap_regs->spy_code
|
||||
#define PredFail Yap_heap_regs->pred_fail
|
||||
#define PredTrue Yap_heap_regs->pred_true
|
||||
#ifdef COROUTINING
|
||||
#define WakeUpCode Yap_heap_regs->wake_up_code
|
||||
#endif
|
||||
#define PredGoalExpansion Yap_heap_regs->pred_goal_expansion
|
||||
#define PredMetaCall Yap_heap_regs->pred_meta_call
|
||||
#define PredTraceMetaCall Yap_heap_regs->pred_trace_meta_call
|
||||
#define PredDollarCatch Yap_heap_regs->pred_dollar_catch
|
||||
#define PredRecordedWithKey Yap_heap_regs->pred_recorded_with_key
|
||||
#define PredLogUpdClause Yap_heap_regs->pred_log_upd_clause
|
||||
#define PredLogUpdClauseErase Yap_heap_regs->pred_log_upd_clause_erase
|
||||
#define PredLogUpdClause0 Yap_heap_regs->pred_log_upd_clause0
|
||||
#define PredStaticClause Yap_heap_regs->pred_static_clause
|
||||
#define PredThrow Yap_heap_regs->pred_throw
|
||||
#define PredHandleThrow Yap_heap_regs->pred_handle_throw
|
||||
#define PredIs Yap_heap_regs->pred_is
|
||||
#define PredSafeCallCleanup Yap_heap_regs->pred_safe_call_cleanup
|
||||
#define PredRestoreRegs Yap_heap_regs->pred_restore_regs
|
||||
#define PredCommentHook Yap_heap_regs->pred_comment_hook
|
||||
#ifdef YAPOR
|
||||
#define PredGetwork Yap_heap_regs->pred_getwork
|
||||
#define PredGetworkSeq Yap_heap_regs->pred_getwork_seq
|
||||
#endif /* YAPOR */
|
||||
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
#define Yap_do_low_level_trace Yap_heap_regs->yap_do_low_level_trace
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define Yap_low_level_trace_lock Yap_heap_regs->low_level_trace_lock
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define Yap_ClauseSpace Yap_heap_regs->clause_space
|
||||
#define Yap_IndexSpace_Tree Yap_heap_regs->index_space_Tree
|
||||
#define Yap_IndexSpace_EXT Yap_heap_regs->index_space_EXT
|
||||
#define Yap_IndexSpace_SW Yap_heap_regs->index_space_SW
|
||||
#define Yap_LUClauseSpace Yap_heap_regs->lu_clause_space
|
||||
#define Yap_LUIndexSpace_Tree Yap_heap_regs->lu_index_space_Tree
|
||||
#define Yap_LUIndexSpace_CP Yap_heap_regs->lu_index_space_CP
|
||||
#define Yap_LUIndexSpace_EXT Yap_heap_regs->lu_index_space_EXT
|
||||
#define Yap_LUIndexSpace_SW Yap_heap_regs->lu_index_space_SW
|
||||
|
||||
#define COMMA_CODE Yap_heap_regs->comma_code
|
||||
#define DUMMYCODE Yap_heap_regs->dummycode
|
||||
#define FAILCODE Yap_heap_regs->failcode
|
||||
#define NOCODE Yap_heap_regs->nocode
|
||||
#define ENV_FOR_TRUSTFAIL Yap_heap_regs->env_for_trustfail
|
||||
#define TRUSTFAILCODE Yap_heap_regs->trustfailcode
|
||||
#define ENV_FOR_YESCODE Yap_heap_regs->env_for_yescode
|
||||
#define YESCODE Yap_heap_regs->yescode
|
||||
#define RTRYCODE Yap_heap_regs->rtrycode
|
||||
#ifdef BEAM
|
||||
#define BEAM_RETRY_CODE Yap_heap_regs->beam_retry_code
|
||||
#endif /* BEAM */
|
||||
#ifdef YAPOR
|
||||
#define GETWORK Yap_heap_regs->getwork_code
|
||||
#define GETWORK_SEQ Yap_heap_regs->getwork_seq_code
|
||||
#define GETWORK_FIRST_TIME Yap_heap_regs->getwork_first_time
|
||||
#endif /* YAPOR */
|
||||
#ifdef TABLING
|
||||
#define LOAD_ANSWER Yap_heap_regs->table_load_answer_code
|
||||
#define TRY_ANSWER Yap_heap_regs->table_try_answer_code
|
||||
#define ANSWER_RESOLUTION Yap_heap_regs->table_answer_resolution_code
|
||||
#define COMPLETION Yap_heap_regs->table_completion_code
|
||||
#ifdef THREADS_CONSUMER_SHARING
|
||||
#define ANSWER_RESOLUTION_COMPLETION Yap_heap_regs->table_answer_resolution_completion_code
|
||||
#endif /* THREADS_CONSUMER_SHARING */
|
||||
#endif /* TABLING */
|
||||
|
||||
|
||||
|
||||
|
||||
#define P_before_spy Yap_heap_regs->debugger_p_before_spy
|
||||
|
||||
#define RETRY_C_RECORDEDP_CODE Yap_heap_regs->retry_recordedp_code
|
||||
#define RETRY_C_RECORDED_K_CODE Yap_heap_regs->retry_recorded_k_code
|
||||
|
||||
#define PROFILING Yap_heap_regs->system_profiling
|
||||
#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 compile_mode Yap_heap_regs->compiler_compile_mode
|
||||
#define profiling Yap_heap_regs->compiler_profiling
|
||||
#define call_counting Yap_heap_regs->compiler_call_counting
|
||||
|
||||
#define compile_arrays Yap_heap_regs->compiler_compile_arrays
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define DBTermsListLock Yap_heap_regs->dbterms_list_lock
|
||||
#endif
|
||||
#define DBTermsList Yap_heap_regs->dbterms_list
|
||||
|
||||
#define ExpandClausesFirst Yap_heap_regs->expand_clauses_first
|
||||
#define ExpandClausesLast Yap_heap_regs->expand_clauses_last
|
||||
#define Yap_ExpandClauses Yap_heap_regs->expand_clauses
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define ExpandClausesListLock Yap_heap_regs->expand_clauses_list_lock
|
||||
#define OpListLock Yap_heap_regs->op_list_lock
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define Yap_NewCps Yap_heap_regs->new_cps
|
||||
#define Yap_LiveCps Yap_heap_regs->live_cps
|
||||
#define Yap_DirtyCps Yap_heap_regs->dirty_cps
|
||||
#define Yap_FreedCps Yap_heap_regs->freed_cps
|
||||
#endif
|
||||
#define Yap_expand_clauses_sz Yap_heap_regs->expand_clauses_sz
|
||||
|
||||
#define UdiControlBlocks Yap_heap_regs->udi_control_blocks
|
||||
|
||||
|
||||
#define STATIC_PREDICATES_MARKED Yap_heap_regs->static_predicates_marked
|
||||
|
||||
#define INT_KEYS Yap_heap_regs->IntKeys
|
||||
#define INT_LU_KEYS Yap_heap_regs->IntLUKeys
|
||||
#define INT_BB_KEYS Yap_heap_regs->IntBBKeys
|
||||
|
||||
#define INT_KEYS_SIZE Yap_heap_regs->int_keys_size
|
||||
#define INT_KEYS_TIMESTAMP Yap_heap_regs->int_keys_timestamp
|
||||
#define INT_BB_KEYS_SIZE Yap_heap_regs->int_bb_keys_size
|
||||
|
||||
#define UPDATE_MODE Yap_heap_regs->update_mode
|
||||
|
||||
#define DBErasedMarker Yap_heap_regs->db_erased_marker
|
||||
#define LogDBErasedMarker Yap_heap_regs->logdb_erased_marker
|
||||
|
||||
#define DeadStaticClauses Yap_heap_regs->dead_static_clauses
|
||||
#define DeadMegaClauses Yap_heap_regs->dead_mega_clauses
|
||||
#define DeadStaticIndices Yap_heap_regs->dead_static_indices
|
||||
#define DBErasedList Yap_heap_regs->db_erased_list
|
||||
#define DBErasedIList Yap_heap_regs->db_erased_ilist
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define DeadStaticClausesLock Yap_heap_regs->dead_static_clauses_lock
|
||||
#define DeadMegaClausesLock Yap_heap_regs->dead_mega_clauses_lock
|
||||
#define DeadStaticIndicesLock Yap_heap_regs->dead_static_indices_lock
|
||||
#endif
|
||||
#ifdef COROUTINING
|
||||
|
||||
#define NUM_OF_ATTS Yap_heap_regs->num_of_atts
|
||||
|
||||
#define Yap_AttsSize Yap_heap_regs->atts_size
|
||||
#endif
|
||||
|
||||
#define OpList Yap_heap_regs->op_list
|
||||
|
||||
#define ForeignCodeLoaded Yap_heap_regs->foreign_code_loaded
|
||||
#define ForeignCodeBase Yap_heap_regs->foreign_code_base
|
||||
#define ForeignCodeTop Yap_heap_regs->foreign_code_top
|
||||
#define ForeignCodeMax Yap_heap_regs->foreign_code_max
|
||||
|
||||
#define Yap_Records Yap_heap_regs->yap_records
|
||||
|
||||
#define SWI_Atoms Yap_heap_regs->swi_atoms
|
||||
#define SWI_Functors Yap_heap_regs->swi_functors
|
||||
#define SWI_ReverseHash Yap_heap_regs->swi_reverse_hash
|
||||
|
||||
#define AtomTranslations Yap_heap_regs->atom_translations
|
||||
#define MaxAtomTranslations Yap_heap_regs->max_atom_translations
|
||||
|
||||
#define FunctorTranslations Yap_heap_regs->functor_translations
|
||||
#define MaxFunctorTranslations Yap_heap_regs->max_functor_translations
|
||||
#define EmptyWakeups Yap_heap_regs->empty_wakeups
|
||||
#define MaxEmptyWakeups Yap_heap_regs->max_empty_wakeups
|
||||
|
||||
#define BlobTypes Yap_heap_regs->swi_blob_types
|
||||
#define Blobs Yap_heap_regs->swi_blobs
|
||||
#define NOfBlobs Yap_heap_regs->nofblobs
|
||||
#define NOfBlobsMax Yap_heap_regs->nofblobsmax
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define Blobs_Lock Yap_heap_regs->blobs_lock
|
||||
#endif
|
@ -142,3 +142,5 @@
|
||||
|
||||
#define GLOBAL_LastWTimePtr Yap_global->LastWTimePtr_
|
||||
|
||||
#define GLOBAL_MaxPriority Yap_global->MaxPriority_
|
||||
|
303
H/heap/dhstruct.h
Normal file
@ -0,0 +1,303 @@
|
||||
|
||||
/* This file, dhstruct.h, was generated automatically by "yap -L misc/buildlocalglobal"
|
||||
please do not update, update misc/HEAPFIELDS instead */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define Yap_HoleSize Yap_heap_regs->Yap_HoleSize_
|
||||
#define Yap_av Yap_heap_regs->Yap_av_
|
||||
#if USE_DL_MALLOC
|
||||
#define void Yap_heap_regs->void_
|
||||
#define Yap_NOfMemoryHoles Yap_heap_regs->Yap_NOfMemoryHoles_
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define DLMallocLock Yap_heap_regs->DLMallocLock_
|
||||
#endif
|
||||
#endif
|
||||
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
|
||||
#ifndef HeapUsed
|
||||
#define HeapUsed Yap_givemallinfo()
|
||||
#endif
|
||||
#define NotHeapUsed Yap_heap_regs->NotHeapUsed_
|
||||
#else
|
||||
#define HeapUsed Yap_heap_regs->HeapUsed_
|
||||
#endif
|
||||
#define HeapMax Yap_heap_regs->HeapMax_
|
||||
#define HeapTop Yap_heap_regs->HeapTop_
|
||||
#define HeapLim Yap_heap_regs->HeapLim_
|
||||
#define FreeBlocks Yap_heap_regs->FreeBlocks_
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define FreeBlocksLock Yap_heap_regs->FreeBlocksLock_
|
||||
#define HeapUsedLock Yap_heap_regs->HeapUsedLock_
|
||||
#define HeapTopLock Yap_heap_regs->HeapTopLock_
|
||||
#define HeapTopOwner Yap_heap_regs->HeapTopOwner_
|
||||
#endif
|
||||
#define MaxStack Yap_heap_regs->MaxStack_
|
||||
#define MaxTrail Yap_heap_regs->MaxTrail_
|
||||
|
||||
|
||||
#if USE_THREADED_CODE
|
||||
#define OP_RTABLE Yap_heap_regs->OP_RTABLE_
|
||||
#endif
|
||||
|
||||
#define EXECUTE_CPRED_OP_CODE Yap_heap_regs->EXECUTE_CPRED_OP_CODE_
|
||||
#define EXPAND_OP_CODE Yap_heap_regs->EXPAND_OP_CODE_
|
||||
#define FAIL_OPCODE Yap_heap_regs->FAIL_OPCODE_
|
||||
#define INDEX_OPCODE Yap_heap_regs->INDEX_OPCODE_
|
||||
#define LOCKPRED_OPCODE Yap_heap_regs->LOCKPRED_OPCODE_
|
||||
#define ORLAST_OPCODE Yap_heap_regs->ORLAST_OPCODE_
|
||||
#define UNDEF_OPCODE Yap_heap_regs->UNDEF_OPCODE_
|
||||
#define RETRY_USERC_OPCODE Yap_heap_regs->RETRY_USERC_OPCODE_
|
||||
#define EXECUTE_CPRED_OPCODE Yap_heap_regs->EXECUTE_CPRED_OPCODE_
|
||||
|
||||
#define NOfAtoms Yap_heap_regs->NOfAtoms_
|
||||
#define AtomHashTableSize Yap_heap_regs->AtomHashTableSize_
|
||||
#define WideAtomHashTableSize Yap_heap_regs->WideAtomHashTableSize_
|
||||
#define NOfWideAtoms Yap_heap_regs->NOfWideAtoms_
|
||||
#define INVISIBLECHAIN Yap_heap_regs->INVISIBLECHAIN_
|
||||
#define WideHashChain Yap_heap_regs->WideHashChain_
|
||||
#define HashChain Yap_heap_regs->HashChain_
|
||||
|
||||
|
||||
#ifdef EUROTRA
|
||||
#define TermDollarU Yap_heap_regs->TermDollarU_
|
||||
#endif
|
||||
|
||||
#define USER_MODULE Yap_heap_regs->USER_MODULE_
|
||||
#define IDB_MODULE Yap_heap_regs->IDB_MODULE_
|
||||
#define ATTRIBUTES_MODULE Yap_heap_regs->ATTRIBUTES_MODULE_
|
||||
#define CHARSIO_MODULE Yap_heap_regs->CHARSIO_MODULE_
|
||||
#define CHTYPE_MODULE Yap_heap_regs->CHTYPE_MODULE_
|
||||
#define TERMS_MODULE Yap_heap_regs->TERMS_MODULE_
|
||||
#define SYSTEM_MODULE Yap_heap_regs->SYSTEM_MODULE_
|
||||
#define READUTIL_MODULE Yap_heap_regs->READUTIL_MODULE_
|
||||
#define HACKS_MODULE Yap_heap_regs->HACKS_MODULE_
|
||||
#define ARG_MODULE Yap_heap_regs->ARG_MODULE_
|
||||
#define GLOBALS_MODULE Yap_heap_regs->GLOBALS_MODULE_
|
||||
#define SWI_MODULE Yap_heap_regs->SWI_MODULE_
|
||||
#define DBLOAD_MODULE Yap_heap_regs->DBLOAD_MODULE_
|
||||
#define RANGE_MODULE Yap_heap_regs->RANGE_MODULE_
|
||||
#define ERROR_MODULE Yap_heap_regs->ERROR_MODULE_
|
||||
|
||||
|
||||
|
||||
#define CurrentModules Yap_heap_regs->CurrentModules_
|
||||
|
||||
|
||||
|
||||
|
||||
#define HIDDEN_PREDICATES Yap_heap_regs->HIDDEN_PREDICATES_
|
||||
|
||||
|
||||
|
||||
#define GLOBAL_Flags Yap_heap_regs->GLOBAL_Flags_
|
||||
#define GLOBAL_flagCount Yap_heap_regs->GLOBAL_flagCount_
|
||||
|
||||
#define Yap_ExecutionMode Yap_heap_regs->Yap_ExecutionMode_
|
||||
|
||||
#define PredHash Yap_heap_regs->PredHash_
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define PredHashRWLock Yap_heap_regs->PredHashRWLock_
|
||||
#endif
|
||||
#define PredsInHashTable Yap_heap_regs->PredsInHashTable_
|
||||
#define PredHashTableSize Yap_heap_regs->PredHashTableSize_
|
||||
|
||||
#define CreepCode Yap_heap_regs->CreepCode_
|
||||
#define UndefCode Yap_heap_regs->UndefCode_
|
||||
#define SpyCode Yap_heap_regs->SpyCode_
|
||||
#define PredFail Yap_heap_regs->PredFail_
|
||||
#define PredTrue Yap_heap_regs->PredTrue_
|
||||
#ifdef COROUTINING
|
||||
#define WakeUpCode Yap_heap_regs->WakeUpCode_
|
||||
#endif
|
||||
#define PredGoalExpansion Yap_heap_regs->PredGoalExpansion_
|
||||
#define PredMetaCall Yap_heap_regs->PredMetaCall_
|
||||
#define PredTraceMetaCall Yap_heap_regs->PredTraceMetaCall_
|
||||
#define PredDollarCatch Yap_heap_regs->PredDollarCatch_
|
||||
#define PredRecordedWithKey Yap_heap_regs->PredRecordedWithKey_
|
||||
#define PredLogUpdClause Yap_heap_regs->PredLogUpdClause_
|
||||
#define PredLogUpdClauseErase Yap_heap_regs->PredLogUpdClauseErase_
|
||||
#define PredLogUpdClause0 Yap_heap_regs->PredLogUpdClause0_
|
||||
#define PredStaticClause Yap_heap_regs->PredStaticClause_
|
||||
#define PredThrow Yap_heap_regs->PredThrow_
|
||||
#define PredHandleThrow Yap_heap_regs->PredHandleThrow_
|
||||
#define PredIs Yap_heap_regs->PredIs_
|
||||
#define PredSafeCallCleanup Yap_heap_regs->PredSafeCallCleanup_
|
||||
#define PredRestoreRegs Yap_heap_regs->PredRestoreRegs_
|
||||
#define PredCommentHook Yap_heap_regs->PredCommentHook_
|
||||
#ifdef YAPOR
|
||||
#define PredGetwork Yap_heap_regs->PredGetwork_
|
||||
#endif /* YAPOR */
|
||||
#define PredProcedure Yap_heap_regs->PredProcedure_
|
||||
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
#define Yap_do_low_level_trace Yap_heap_regs->Yap_do_low_level_trace_
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define Yap_low_level_trace_lock Yap_heap_regs->Yap_low_level_trace_lock_
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define Yap_ClauseSpace Yap_heap_regs->Yap_ClauseSpace_
|
||||
#define Yap_IndexSpace_Tree Yap_heap_regs->Yap_IndexSpace_Tree_
|
||||
#define Yap_IndexSpace_EXT Yap_heap_regs->Yap_IndexSpace_EXT_
|
||||
#define Yap_IndexSpace_SW Yap_heap_regs->Yap_IndexSpace_SW_
|
||||
#define Yap_LUClauseSpace Yap_heap_regs->Yap_LUClauseSpace_
|
||||
#define Yap_LUIndexSpace_Tree Yap_heap_regs->Yap_LUIndexSpace_Tree_
|
||||
#define Yap_LUIndexSpace_CP Yap_heap_regs->Yap_LUIndexSpace_CP_
|
||||
#define Yap_LUIndexSpace_EXT Yap_heap_regs->Yap_LUIndexSpace_EXT_
|
||||
#define Yap_LUIndexSpace_SW Yap_heap_regs->Yap_LUIndexSpace_SW_
|
||||
|
||||
#define COMMA_CODE Yap_heap_regs->COMMA_CODE_
|
||||
#define DUMMYCODE Yap_heap_regs->DUMMYCODE_
|
||||
#define FAILCODE Yap_heap_regs->FAILCODE_
|
||||
#define NOCODE Yap_heap_regs->NOCODE_
|
||||
#define ENV_FOR_TRUSTFAIL Yap_heap_regs->ENV_FOR_TRUSTFAIL_
|
||||
#define TRUSTFAILCODE Yap_heap_regs->TRUSTFAILCODE_
|
||||
#define ENV_FOR_YESCODE Yap_heap_regs->ENV_FOR_YESCODE_
|
||||
#define YESCODE Yap_heap_regs->YESCODE_
|
||||
#define RTRYCODE Yap_heap_regs->RTRYCODE_
|
||||
#ifdef BEAM
|
||||
#define BEAM_RETRY_CODE Yap_heap_regs->BEAM_RETRY_CODE_
|
||||
#endif /* BEAM */
|
||||
#ifdef YAPOR
|
||||
#define GETWORK Yap_heap_regs->GETWORK_
|
||||
#define GETWORK_SEQ Yap_heap_regs->GETWORK_SEQ_
|
||||
#define GETWORK_FIRST_TIME Yap_heap_regs->GETWORK_FIRST_TIME_
|
||||
#endif /* YAPOR */
|
||||
#ifdef TABLING
|
||||
#define LOAD_ANSWER Yap_heap_regs->LOAD_ANSWER_
|
||||
#define TRY_ANSWER Yap_heap_regs->TRY_ANSWER_
|
||||
#define ANSWER_RESOLUTION Yap_heap_regs->ANSWER_RESOLUTION_
|
||||
#define COMPLETION Yap_heap_regs->COMPLETION_
|
||||
#ifdef THREADS_CONSUMER_SHARING
|
||||
#define ANSWER_RESOLUTION_COMPLETION Yap_heap_regs->ANSWER_RESOLUTION_COMPLETION_
|
||||
#endif /* THREADS_CONSUMER_SHARING */
|
||||
#endif /* TABLING */
|
||||
|
||||
|
||||
|
||||
|
||||
#define P_before_spy Yap_heap_regs->P_before_spy_
|
||||
|
||||
#define RETRY_C_RECORDEDP_CODE Yap_heap_regs->RETRY_C_RECORDEDP_CODE_
|
||||
#define RETRY_C_RECORDED_K_CODE Yap_heap_regs->RETRY_C_RECORDED_K_CODE_
|
||||
|
||||
#define PROFILING Yap_heap_regs->PROFILING_
|
||||
#define CALL_COUNTING Yap_heap_regs->CALL_COUNTING_
|
||||
#define optimizer_on Yap_heap_regs->optimizer_on_
|
||||
#define compile_mode Yap_heap_regs->compile_mode_
|
||||
#define profiling Yap_heap_regs->profiling_
|
||||
#define call_counting Yap_heap_regs->call_counting_
|
||||
|
||||
#define compile_arrays Yap_heap_regs->compile_arrays_
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define DBTermsListLock Yap_heap_regs->DBTermsListLock_
|
||||
#endif
|
||||
#define DBTermsList Yap_heap_regs->DBTermsList_
|
||||
|
||||
#define ExpandClausesFirst Yap_heap_regs->ExpandClausesFirst_
|
||||
#define ExpandClausesLast Yap_heap_regs->ExpandClausesLast_
|
||||
#define Yap_ExpandClauses Yap_heap_regs->Yap_ExpandClauses_
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define ExpandClausesListLock Yap_heap_regs->ExpandClausesListLock_
|
||||
#define OpListLock Yap_heap_regs->OpListLock_
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define Yap_NewCps Yap_heap_regs->Yap_NewCps_
|
||||
#define Yap_LiveCps Yap_heap_regs->Yap_LiveCps_
|
||||
#define Yap_DirtyCps Yap_heap_regs->Yap_DirtyCps_
|
||||
#define Yap_FreedCps Yap_heap_regs->Yap_FreedCps_
|
||||
#endif
|
||||
#define Yap_expand_clauses_sz Yap_heap_regs->Yap_expand_clauses_sz_
|
||||
|
||||
#define UdiControlBlocks Yap_heap_regs->UdiControlBlocks_
|
||||
|
||||
|
||||
#define STATIC_PREDICATES_MARKED Yap_heap_regs->STATIC_PREDICATES_MARKED_
|
||||
|
||||
#define INT_KEYS Yap_heap_regs->INT_KEYS_
|
||||
#define INT_LU_KEYS Yap_heap_regs->INT_LU_KEYS_
|
||||
#define INT_BB_KEYS Yap_heap_regs->INT_BB_KEYS_
|
||||
|
||||
#define INT_KEYS_SIZE Yap_heap_regs->INT_KEYS_SIZE_
|
||||
#define INT_KEYS_TIMESTAMP Yap_heap_regs->INT_KEYS_TIMESTAMP_
|
||||
#define INT_BB_KEYS_SIZE Yap_heap_regs->INT_BB_KEYS_SIZE_
|
||||
|
||||
#define UPDATE_MODE Yap_heap_regs->UPDATE_MODE_
|
||||
|
||||
#define DBErasedMarker Yap_heap_regs->DBErasedMarker_
|
||||
#define LogDBErasedMarker Yap_heap_regs->LogDBErasedMarker_
|
||||
|
||||
#define DeadStaticClauses Yap_heap_regs->DeadStaticClauses_
|
||||
#define DeadMegaClauses Yap_heap_regs->DeadMegaClauses_
|
||||
#define DeadStaticIndices Yap_heap_regs->DeadStaticIndices_
|
||||
#define DBErasedList Yap_heap_regs->DBErasedList_
|
||||
#define DBErasedIList Yap_heap_regs->DBErasedIList_
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define DeadStaticClausesLock Yap_heap_regs->DeadStaticClausesLock_
|
||||
#define DeadMegaClausesLock Yap_heap_regs->DeadMegaClausesLock_
|
||||
#define DeadStaticIndicesLock Yap_heap_regs->DeadStaticIndicesLock_
|
||||
#endif
|
||||
#ifdef COROUTINING
|
||||
|
||||
#define NUM_OF_ATTS Yap_heap_regs->NUM_OF_ATTS_
|
||||
|
||||
#define Yap_AttsSize Yap_heap_regs->Yap_AttsSize_
|
||||
#endif
|
||||
|
||||
#define OpList Yap_heap_regs->OpList_
|
||||
|
||||
#define ForeignCodeLoaded Yap_heap_regs->ForeignCodeLoaded_
|
||||
#define ForeignCodeBase Yap_heap_regs->ForeignCodeBase_
|
||||
#define ForeignCodeTop Yap_heap_regs->ForeignCodeTop_
|
||||
#define ForeignCodeMax Yap_heap_regs->ForeignCodeMax_
|
||||
|
||||
#define Yap_Records Yap_heap_regs->Yap_Records_
|
||||
|
||||
#define SWI_Atoms Yap_heap_regs->SWI_Atoms_
|
||||
#define SWI_Functors Yap_heap_regs->SWI_Functors_
|
||||
#define SWI_ReverseHash Yap_heap_regs->SWI_ReverseHash_
|
||||
|
||||
#define AtomTranslations Yap_heap_regs->AtomTranslations_
|
||||
#define MaxAtomTranslations Yap_heap_regs->MaxAtomTranslations_
|
||||
|
||||
#define FunctorTranslations Yap_heap_regs->FunctorTranslations_
|
||||
#define MaxFunctorTranslations Yap_heap_regs->MaxFunctorTranslations_
|
||||
#define EmptyWakeups Yap_heap_regs->EmptyWakeups_
|
||||
#define MaxEmptyWakeups Yap_heap_regs->MaxEmptyWakeups_
|
||||
|
||||
#define BlobTypes Yap_heap_regs->BlobTypes_
|
||||
#define Blobs Yap_heap_regs->Blobs_
|
||||
#define NOfBlobs Yap_heap_regs->NOfBlobs_
|
||||
#define NOfBlobsMax Yap_heap_regs->NOfBlobsMax_
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define Blobs_Lock Yap_heap_regs->Blobs_Lock_
|
||||
#endif
|
||||
|
@ -453,8 +453,6 @@
|
||||
#define REMOTE_ImportDBRefHashTableNum(wid) REMOTE(wid)->ImportDBRefHashTableNum_
|
||||
#define LOCAL_ImportFAILCODE LOCAL->ImportFAILCODE_
|
||||
#define REMOTE_ImportFAILCODE(wid) REMOTE(wid)->ImportFAILCODE_
|
||||
#define LOCAL_FunctorVar LOCAL->FunctorVar_
|
||||
#define REMOTE_FunctorVar(wid) REMOTE(wid)->FunctorVar_
|
||||
#if __ANDROID__
|
||||
|
||||
#define LOCAL_assetManager LOCAL->assetManager_
|
146
H/heap/h0globals.h
Normal file
@ -0,0 +1,146 @@
|
||||
|
||||
/* This file, hglobals.h, was generated automatically by "yap -L misc/buildlocalglobal"
|
||||
please do not update, update misc/GLOBALS instead */
|
||||
|
||||
//
|
||||
// File defining fields in the Yap_GLOBAL global structure
|
||||
//
|
||||
// these fields used to spread all over the place, because they must be used in 3 ways:
|
||||
// - they must be defined somewhere
|
||||
// - they have an #ifdef to get a shorter name
|
||||
// - they must be initialised somewhere
|
||||
// - they may be of interest to restore
|
||||
//
|
||||
// The defs include 3+ components:
|
||||
// Type
|
||||
// name in structured / global name
|
||||
// init code (optional)
|
||||
// restore code (optional)
|
||||
//
|
||||
// Stuff that must be shared by all threads or workers
|
||||
|
||||
// initialization: tell whether the system has been initialised and by whom.
|
||||
EXTERNAL int GLOBAL_Initialised;
|
||||
EXTERNAL int GLOBAL_InitialisedFromPL;
|
||||
EXTERNAL int GLOBAL_PL_Argc;
|
||||
EXTERNAL char** GLOBAL_PL_Argv;
|
||||
EXTERNAL bool GLOBAL_FAST_BOOT_FLAG;
|
||||
// halt hooks
|
||||
EXTERNAL struct halt_hook* GLOBAL_HaltHooks;
|
||||
EXTERNAL fptr_t GLOBAL_JIT_finalizer;
|
||||
// stack overflow expansion/gc control
|
||||
EXTERNAL int GLOBAL_AllowLocalExpansion;
|
||||
EXTERNAL int GLOBAL_AllowGlobalExpansion;
|
||||
EXTERNAL int GLOBAL_AllowTrailExpansion;
|
||||
EXTERNAL UInt GLOBAL_SizeOfOverflow;
|
||||
// amount of space recovered in all garbage collections
|
||||
EXTERNAL UInt GLOBAL_AGcThreshold;
|
||||
EXTERNAL Agc_hook GLOBAL_AGCHook;
|
||||
#if __ANDROID__
|
||||
// no need to perform initialization, it is done before we start the Prolog engine.
|
||||
EXTERNAL struct AAssetManager* GLOBAL_assetManager;
|
||||
EXTERNAL char* GLOBAL_AssetsWD;
|
||||
#endif
|
||||
/* multi-thread support */
|
||||
#if THREADS
|
||||
/* number of threads and processes in system */
|
||||
EXTERNAL UInt GLOBAL_NOfThreads;
|
||||
/* number of threads created since start */
|
||||
EXTERNAL UInt GLOBAL_NOfThreadsCreated;
|
||||
/* total run time for dead threads */
|
||||
EXTERNAL UInt GLOBAL_ThreadsTotalTime;
|
||||
// Threads Array
|
||||
EXTERNAL lockvar GLOBAL_ThreadHandlesLock;
|
||||
#endif
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
// protect long critical regions
|
||||
EXTERNAL lockvar GLOBAL_BGL;
|
||||
#endif
|
||||
#if defined(YAPOR) || defined(TABLING)
|
||||
EXTERNAL struct global_optyap_data GLOBAL_optyap_data;
|
||||
#endif /* YAPOR || TABLING */
|
||||
// whether Yap is responsible for signal handling
|
||||
EXTERNAL int GLOBAL_PrologShouldHandleInterrupts;
|
||||
/* This is the guy who actually started the system, and who has the correct registers */
|
||||
#if defined(THREADS)
|
||||
EXTERNAL pthread_t GLOBAL_master_thread;
|
||||
EXTERNAL struct thread_mbox* GLOBAL_named_mboxes;
|
||||
EXTERNAL lockvar GLOBAL_mboxq_lock;
|
||||
EXTERNAL UInt GLOBAL_mbox_count;
|
||||
EXTERNAL struct swi_mutex* GLOBAL_WithMutex;
|
||||
#endif /* THREADS */
|
||||
// streams
|
||||
EXTERNAL struct stream_desc* GLOBAL_Stream;
|
||||
#if defined(THREADS)||defined(YAPOR)
|
||||
EXTERNAL lockvar GLOBAL_StreamDescLock;
|
||||
#endif
|
||||
// access to yap initial arguments
|
||||
EXTERNAL char** GLOBAL_argv;
|
||||
EXTERNAL int GLOBAL_argc;
|
||||
// extensions to Terms
|
||||
#ifdef COROUTINING
|
||||
/* array with the ops for your favourite extensions */
|
||||
EXTERNAL ext_op GLOBAL_attas[attvars_ext+1];
|
||||
#endif
|
||||
// agc.c
|
||||
EXTERNAL int GLOBAL_agc_calls;
|
||||
EXTERNAL YAP_ULONG_LONG GLOBAL_agc_collected;
|
||||
/* total time spent in GC */
|
||||
EXTERNAL Int GLOBAL_tot_agc_time;
|
||||
/* number of heap objects in all garbage collections */
|
||||
EXTERNAL Int GLOBAL_tot_agc_recovered;
|
||||
//arrays.c
|
||||
#if HAVE_MMAP
|
||||
EXTERNAL struct MMAP_ARRAY_BLOCK* GLOBAL_mmap_arrays;
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
//computils.c
|
||||
EXTERNAL char GLOBAL_Option[20];
|
||||
EXTERNAL YP_FILE* GLOBAL_logfile;
|
||||
//init.c
|
||||
//int output_msg =FALSE
|
||||
#endif
|
||||
#if defined(COFF) || defined(A_OUT)
|
||||
// loada_coff.c && load_aout.c
|
||||
EXTERNAL char GLOBAL_Executable[YAP_FILENAME_MAX];
|
||||
#endif
|
||||
EXTERNAL int GLOBAL_OpaqueHandlersCount;
|
||||
EXTERNAL struct opaque_handler_struct* GLOBAL_OpaqueHandlers;
|
||||
#if __simplescalar__
|
||||
EXTERNAL char GLOBAL_pwd[YAP_FILENAME_MAX];
|
||||
#endif
|
||||
//udi.c
|
||||
//struct udi_control_block RtreeCmd void
|
||||
EXTERNAL char* GLOBAL_RestoreFile;
|
||||
//gprof.c
|
||||
EXTERNAL Int GLOBAL_ProfCalls;
|
||||
EXTERNAL Int GLOBAL_ProfGCs;
|
||||
EXTERNAL Int GLOBAL_ProfHGrows;
|
||||
EXTERNAL Int GLOBAL_ProfSGrows;
|
||||
EXTERNAL Int GLOBAL_ProfMallocs;
|
||||
EXTERNAL Int GLOBAL_ProfIndexing;
|
||||
EXTERNAL Int GLOBAL_ProfOn;
|
||||
EXTERNAL Int GLOBAL_ProfOns;
|
||||
EXTERNAL struct RB_red_blk_node* GLOBAL_ProfilerRoot;
|
||||
EXTERNAL struct RB_red_blk_node* GLOBAL_ProfilerNil;
|
||||
EXTERNAL char* GLOBAL_DIRNAME;
|
||||
#if LOW_PROF
|
||||
EXTERNAL int GLOBAL_ProfilerOn;
|
||||
EXTERNAL FILE* GLOBAL_FProf;
|
||||
EXTERNAL FILE* GLOBAL_FPreds;
|
||||
#endif /* LOW_PROF */
|
||||
// Mutexes
|
||||
#if THREADS
|
||||
EXTERNAL struct swi_mutex* GLOBAL_FreeMutexes;
|
||||
EXTERNAL struct swi_mutex* GLOBAL_mutex_backbone;
|
||||
EXTERNAL lockvar GLOBAL_MUT_ACCESS;
|
||||
#endif
|
||||
EXTERNAL char* GLOBAL_Home;
|
||||
/* ISO char conversion: I will make no comments */
|
||||
EXTERNAL char* GLOBAL_CharConversionTable;
|
||||
EXTERNAL char* GLOBAL_CharConversionTable2;
|
||||
/* time */
|
||||
EXTERNAL void* GLOBAL_LastWTimePtr;
|
||||
/* max priority */
|
||||
EXTERNAL int GLOBAL_MaxPriority;
|
||||
|
303
H/heap/h0struct.h
Normal file
@ -0,0 +1,303 @@
|
||||
|
||||
/* This file, d0hstruct.h, was generated automatically by "yap -L misc/buildlocalglobal"
|
||||
please do not update, update misc/HEAPFIELDS instead */
|
||||
|
||||
//
|
||||
// File defining fields in the Yap_heap_codes global structure
|
||||
//
|
||||
// these fields used to spread all over the place, because they must be used in 4 ways:
|
||||
// - they must be defined somewhere
|
||||
// - they have an #ifdef to get a shorter name
|
||||
// - they must be initialised somewhere
|
||||
// - they must be restorable and collectable (from the atom gc).
|
||||
//
|
||||
//
|
||||
// The defs include 4+ components:
|
||||
// Type
|
||||
// name in structured
|
||||
// global name
|
||||
// init code and restore code (optional)
|
||||
//
|
||||
//
|
||||
//
|
||||
// MkAT (MkAtomTerm) cvts from a predefined atom to a term
|
||||
// MkPred constructs a pred_entry
|
||||
// MkOp gets an opcode
|
||||
// void does nothing
|
||||
// =VALUE inits as VALUE
|
||||
// Init... sets up call to InitFunc
|
||||
// Restore... sets up call to RestoreFunc
|
||||
//
|
||||
|
||||
/* memory management */
|
||||
EXTERNAL UInt Yap_HoleSize;
|
||||
EXTERNAL struct malloc_state *Yap_av;
|
||||
#if USE_DL_MALLOC
|
||||
EXTERNAL struct Yap_MemoryHoles[MAX_DLMALLOC_HOLES] void;
|
||||
EXTERNAL UInt Yap_NOfMemoryHoles;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
EXTERNAL lockvar DLMallocLock;
|
||||
#endif
|
||||
#endif
|
||||
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
|
||||
#ifndef HeapUsed
|
||||
#define HeapUsed Yap_givemallinfo()
|
||||
#endif
|
||||
EXTERNAL Int NotHeapUsed;
|
||||
#else
|
||||
EXTERNAL Int HeapUsed;
|
||||
#endif
|
||||
EXTERNAL Int HeapMax;
|
||||
EXTERNAL ADDR HeapTop;
|
||||
EXTERNAL ADDR HeapLim;
|
||||
EXTERNAL struct FREEB *FreeBlocks;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
EXTERNAL lockvar FreeBlocksLock;
|
||||
EXTERNAL lockvar HeapUsedLock;
|
||||
EXTERNAL lockvar HeapTopLock;
|
||||
EXTERNAL int HeapTopOwner;
|
||||
#endif
|
||||
EXTERNAL UInt MaxStack;
|
||||
EXTERNAL UInt MaxTrail;
|
||||
/* execution info */
|
||||
/* OPCODE REVERSE TABLE, needed to recover op tables */
|
||||
#if USE_THREADED_CODE
|
||||
EXTERNAL op_entry *OP_RTABLE;
|
||||
#endif
|
||||
/* popular opcodes */
|
||||
EXTERNAL OPCODE EXECUTE_CPRED_OP_CODE;
|
||||
EXTERNAL OPCODE EXPAND_OP_CODE;
|
||||
EXTERNAL OPCODE FAIL_OPCODE;
|
||||
EXTERNAL OPCODE INDEX_OPCODE;
|
||||
EXTERNAL OPCODE LOCKPRED_OPCODE;
|
||||
EXTERNAL OPCODE ORLAST_OPCODE;
|
||||
EXTERNAL OPCODE UNDEF_OPCODE;
|
||||
EXTERNAL OPCODE RETRY_USERC_OPCODE;
|
||||
EXTERNAL OPCODE EXECUTE_CPRED_OPCODE;
|
||||
/* atom tables */
|
||||
EXTERNAL UInt NOfAtoms;
|
||||
EXTERNAL UInt AtomHashTableSize;
|
||||
EXTERNAL UInt WideAtomHashTableSize;
|
||||
EXTERNAL UInt NOfWideAtoms;
|
||||
EXTERNAL AtomHashEntry INVISIBLECHAIN;
|
||||
EXTERNAL AtomHashEntry *WideHashChain;
|
||||
EXTERNAL AtomHashEntry *HashChain;
|
||||
/* use atom defs here */
|
||||
#include "tatoms.h"
|
||||
#ifdef EUROTRA
|
||||
EXTERNAL Term TermDollarU;
|
||||
#endif
|
||||
//modules
|
||||
EXTERNAL Term USER_MODULE;
|
||||
EXTERNAL Term IDB_MODULE;
|
||||
EXTERNAL Term ATTRIBUTES_MODULE;
|
||||
EXTERNAL Term CHARSIO_MODULE;
|
||||
EXTERNAL Term CHTYPE_MODULE;
|
||||
EXTERNAL Term TERMS_MODULE;
|
||||
EXTERNAL Term SYSTEM_MODULE;
|
||||
EXTERNAL Term READUTIL_MODULE;
|
||||
EXTERNAL Term HACKS_MODULE;
|
||||
EXTERNAL Term ARG_MODULE;
|
||||
EXTERNAL Term GLOBALS_MODULE;
|
||||
EXTERNAL Term SWI_MODULE;
|
||||
EXTERNAL Term DBLOAD_MODULE;
|
||||
EXTERNAL Term RANGE_MODULE;
|
||||
EXTERNAL Term ERROR_MODULE;
|
||||
//
|
||||
// Module list
|
||||
//
|
||||
EXTERNAL struct mod_entry *CurrentModules;
|
||||
// make sure we have the modules set at this point.
|
||||
// don't actually want to define a field
|
||||
|
||||
// hidden predicates
|
||||
EXTERNAL Prop HIDDEN_PREDICATES;
|
||||
// make sure we have the streams set at this point.
|
||||
// don't actually want to define a field
|
||||
|
||||
EXTERNAL union flagTerm* GLOBAL_Flags;
|
||||
EXTERNAL UInt GLOBAL_flagCount;
|
||||
/* Anderson's JIT */
|
||||
EXTERNAL yap_exec_mode Yap_ExecutionMode;
|
||||
/* The Predicate Hash Table: fast access to predicates. */
|
||||
EXTERNAL struct pred_entry **PredHash;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
EXTERNAL rwlock_t PredHashRWLock;
|
||||
#endif
|
||||
EXTERNAL UInt PredsInHashTable;
|
||||
EXTERNAL UInt PredHashTableSize;
|
||||
/* Well-Known Predicates */
|
||||
EXTERNAL struct pred_entry *CreepCode;
|
||||
EXTERNAL struct pred_entry *UndefCode;
|
||||
EXTERNAL struct pred_entry *SpyCode;
|
||||
EXTERNAL struct pred_entry *PredFail;
|
||||
EXTERNAL struct pred_entry *PredTrue;
|
||||
#ifdef COROUTINING
|
||||
EXTERNAL struct pred_entry *WakeUpCode;
|
||||
#endif
|
||||
EXTERNAL struct pred_entry *PredGoalExpansion;
|
||||
EXTERNAL struct pred_entry *PredMetaCall;
|
||||
EXTERNAL struct pred_entry *PredTraceMetaCall;
|
||||
EXTERNAL struct pred_entry *PredDollarCatch;
|
||||
EXTERNAL struct pred_entry *PredRecordedWithKey;
|
||||
EXTERNAL struct pred_entry *PredLogUpdClause;
|
||||
EXTERNAL struct pred_entry *PredLogUpdClauseErase;
|
||||
EXTERNAL struct pred_entry *PredLogUpdClause0;
|
||||
EXTERNAL struct pred_entry *PredStaticClause;
|
||||
EXTERNAL struct pred_entry *PredThrow;
|
||||
EXTERNAL struct pred_entry *PredHandleThrow;
|
||||
EXTERNAL struct pred_entry *PredIs;
|
||||
EXTERNAL struct pred_entry *PredSafeCallCleanup;
|
||||
EXTERNAL struct pred_entry *PredRestoreRegs;
|
||||
EXTERNAL struct pred_entry *PredCommentHook;
|
||||
#ifdef YAPOR
|
||||
EXTERNAL struct pred_entry *PredGetwork;
|
||||
#endif /* YAPOR */
|
||||
EXTERNAL struct pred_entry *PredProcedure;
|
||||
/* low-level tracer */
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
EXTERNAL int Yap_do_low_level_trace;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
EXTERNAL lockvar Yap_low_level_trace_lock;
|
||||
#endif
|
||||
#endif
|
||||
/* code management info */
|
||||
EXTERNAL UInt Yap_ClauseSpace;
|
||||
EXTERNAL UInt Yap_IndexSpace_Tree;
|
||||
EXTERNAL UInt Yap_IndexSpace_EXT;
|
||||
EXTERNAL UInt Yap_IndexSpace_SW;
|
||||
EXTERNAL UInt Yap_LUClauseSpace;
|
||||
EXTERNAL UInt Yap_LUIndexSpace_Tree;
|
||||
EXTERNAL UInt Yap_LUIndexSpace_CP;
|
||||
EXTERNAL UInt Yap_LUIndexSpace_EXT;
|
||||
EXTERNAL UInt Yap_LUIndexSpace_SW;
|
||||
/* static code: may be shared by many predicate or may be used for meta-execution */
|
||||
EXTERNAL yamop COMMA_CODE[5];
|
||||
EXTERNAL yamop DUMMYCODE[1];
|
||||
EXTERNAL yamop FAILCODE[1];
|
||||
EXTERNAL yamop NOCODE[1];
|
||||
EXTERNAL yamop ENV_FOR_TRUSTFAIL[2];
|
||||
EXTERNAL yamop *TRUSTFAILCODE;
|
||||
EXTERNAL yamop ENV_FOR_YESCODE[2];
|
||||
EXTERNAL yamop *YESCODE;
|
||||
EXTERNAL yamop RTRYCODE[1];
|
||||
#ifdef BEAM
|
||||
EXTERNAL yamop BEAM_RETRY_CODE[1];
|
||||
#endif /* BEAM */
|
||||
#ifdef YAPOR
|
||||
EXTERNAL yamop GETWORK[1];
|
||||
EXTERNAL yamop GETWORK_SEQ[1];
|
||||
EXTERNAL yamop GETWORK_FIRST_TIME[1];
|
||||
#endif /* YAPOR */
|
||||
#ifdef TABLING
|
||||
EXTERNAL yamop LOAD_ANSWER[1];
|
||||
EXTERNAL yamop TRY_ANSWER[1];
|
||||
EXTERNAL yamop ANSWER_RESOLUTION[1];
|
||||
EXTERNAL yamop COMPLETION[1];
|
||||
#ifdef THREADS_CONSUMER_SHARING
|
||||
EXTERNAL yamop ANSWER_RESOLUTION_COMPLETION[1];
|
||||
#endif /* THREADS_CONSUMER_SHARING */
|
||||
#endif /* TABLING */
|
||||
/* */
|
||||
/* PREG just before we enter $spy. We use that to find out the clause which */
|
||||
/* was calling the debugged goal. */
|
||||
/* */
|
||||
EXTERNAL yamop *P_before_spy;
|
||||
/* support recorded_k */
|
||||
EXTERNAL yamop *RETRY_C_RECORDEDP_CODE;
|
||||
EXTERNAL yamop *RETRY_C_RECORDED_K_CODE;
|
||||
/* compiler flags */
|
||||
EXTERNAL int PROFILING;
|
||||
EXTERNAL int CALL_COUNTING;
|
||||
EXTERNAL int optimizer_on;
|
||||
EXTERNAL int compile_mode;
|
||||
EXTERNAL int profiling;
|
||||
EXTERNAL int call_counting;
|
||||
/********* whether we should try to compile array references ******************/
|
||||
EXTERNAL int compile_arrays;
|
||||
/* DBTerms: pre-compiled ground terms */
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
EXTERNAL lockvar DBTermsListLock;
|
||||
#endif
|
||||
EXTERNAL struct dbterm_list *DBTermsList;
|
||||
/* JITI support */
|
||||
EXTERNAL yamop *ExpandClausesFirst;
|
||||
EXTERNAL yamop *ExpandClausesLast;
|
||||
EXTERNAL UInt Yap_ExpandClauses;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
EXTERNAL lockvar ExpandClausesListLock;
|
||||
EXTERNAL lockvar OpListLock;
|
||||
#endif
|
||||
/* instrumentation */
|
||||
#ifdef DEBUG
|
||||
EXTERNAL UInt Yap_NewCps;
|
||||
EXTERNAL UInt Yap_LiveCps;
|
||||
EXTERNAL UInt Yap_DirtyCps;
|
||||
EXTERNAL UInt Yap_FreedCps;
|
||||
#endif
|
||||
EXTERNAL UInt Yap_expand_clauses_sz;
|
||||
/* UDI support */
|
||||
EXTERNAL struct udi_info *UdiControlBlocks;
|
||||
/* data-base statistics */
|
||||
/* system boots in compile mode */
|
||||
EXTERNAL Int STATIC_PREDICATES_MARKED;
|
||||
/* Internal Database */
|
||||
EXTERNAL Prop *INT_KEYS;
|
||||
EXTERNAL Prop *INT_LU_KEYS;
|
||||
EXTERNAL Prop *INT_BB_KEYS;
|
||||
/* Internal Database Statistics */
|
||||
EXTERNAL UInt INT_KEYS_SIZE;
|
||||
EXTERNAL UInt INT_KEYS_TIMESTAMP;
|
||||
EXTERNAL UInt INT_BB_KEYS_SIZE;
|
||||
/* Internal Data-Base Control */
|
||||
EXTERNAL int UPDATE_MODE;
|
||||
/* nasty IDB stuff */
|
||||
EXTERNAL struct DB_STRUCT *DBErasedMarker;
|
||||
EXTERNAL struct logic_upd_clause *LogDBErasedMarker;
|
||||
/* Dead clauses and IDB entries */
|
||||
EXTERNAL struct static_clause *DeadStaticClauses;
|
||||
EXTERNAL struct static_mega_clause *DeadMegaClauses;
|
||||
EXTERNAL struct static_index *DeadStaticIndices;
|
||||
EXTERNAL struct logic_upd_clause *DBErasedList;
|
||||
EXTERNAL struct logic_upd_index *DBErasedIList;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
EXTERNAL lockvar DeadStaticClausesLock;
|
||||
EXTERNAL lockvar DeadMegaClausesLock;
|
||||
EXTERNAL lockvar DeadStaticIndicesLock;
|
||||
#endif
|
||||
#ifdef COROUTINING
|
||||
/* number of attribute modules */
|
||||
EXTERNAL int NUM_OF_ATTS;
|
||||
/* initialised by memory allocator */
|
||||
EXTERNAL UInt Yap_AttsSize;
|
||||
#endif
|
||||
/* Operators */
|
||||
EXTERNAL struct operator_entry *OpList;
|
||||
/* foreign code loaded */
|
||||
EXTERNAL struct ForeignLoadItem *ForeignCodeLoaded;
|
||||
EXTERNAL ADDR ForeignCodeBase;
|
||||
EXTERNAL ADDR ForeignCodeTop;
|
||||
EXTERNAL ADDR ForeignCodeMax;
|
||||
/* recorded terms */
|
||||
EXTERNAL struct record_list *Yap_Records;
|
||||
/* SWI atoms and functors */
|
||||
EXTERNAL Atom *SWI_Atoms;
|
||||
EXTERNAL Functor *SWI_Functors;
|
||||
EXTERNAL swi_rev_hash SWI_ReverseHash[N_SWI_HASH];
|
||||
/* integer access to atoms */
|
||||
EXTERNAL Int AtomTranslations;
|
||||
EXTERNAL Int MaxAtomTranslations;
|
||||
/* integer access to functors */
|
||||
EXTERNAL Int FunctorTranslations;
|
||||
EXTERNAL Int MaxFunctorTranslations;
|
||||
EXTERNAL Atom EmptyWakeups[MAX_EMPTY_WAKEUPS];
|
||||
EXTERNAL int MaxEmptyWakeups;
|
||||
/* SWI blobs */
|
||||
EXTERNAL struct YAP_blob_t *BlobTypes;
|
||||
EXTERNAL struct AtomEntryStruct *Blobs;
|
||||
EXTERNAL UInt NOfBlobs;
|
||||
EXTERNAL UInt NOfBlobsMax;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
EXTERNAL lockvar Blobs_Lock;
|
||||
#endif
|
||||
|
@ -2,66 +2,66 @@
|
||||
/* This file, hglobals.h, was generated automatically by "yap -L misc/buildlocalglobal"
|
||||
please do not update, update misc/GLOBALS instead */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// File defining fields in the Yap_GLOBAL global structure
|
||||
//
|
||||
// these fields used to spread all over the place, because they must be used in 3 ways:
|
||||
// - they must be defined somewhere
|
||||
// - they have an #ifdef to get a shorter name
|
||||
// - they must be initialised somewhere
|
||||
// - they may be of interest to restore
|
||||
//
|
||||
// The defs include 3+ components:
|
||||
// Type
|
||||
// name in structured / global name
|
||||
// init code (optional)
|
||||
// restore code (optional)
|
||||
//
|
||||
// Stuff that must be shared by all threads or workers
|
||||
typedef struct global_data {
|
||||
|
||||
// initialization: tell whether the system has been initialised and by whom.
|
||||
int Initialised_;
|
||||
int InitialisedFromPL_;
|
||||
int PL_Argc_;
|
||||
char** PL_Argv_;
|
||||
bool FAST_BOOT_FLAG_;
|
||||
|
||||
// halt hooks
|
||||
struct halt_hook* HaltHooks_;
|
||||
fptr_t JIT_finalizer_;
|
||||
|
||||
// stack overflow expansion/gc control
|
||||
int AllowLocalExpansion_;
|
||||
int AllowGlobalExpansion_;
|
||||
int AllowTrailExpansion_;
|
||||
UInt SizeOfOverflow_;
|
||||
|
||||
// amount of space recovered in all garbage collections
|
||||
UInt AGcThreshold_;
|
||||
Agc_hook AGCHook_;
|
||||
#if __ANDROID__
|
||||
|
||||
// no need to perform initialization, it is done before we start the Prolog engine.
|
||||
struct AAssetManager* assetManager_;
|
||||
char* AssetsWD_;
|
||||
#endif
|
||||
|
||||
/* multi-thread support */
|
||||
#if THREADS
|
||||
|
||||
/* number of threads and processes in system */
|
||||
UInt NOfThreads_;
|
||||
|
||||
/* number of threads created since start */
|
||||
UInt NOfThreadsCreated_;
|
||||
|
||||
/* total run time for dead threads */
|
||||
UInt ThreadsTotalTime_;
|
||||
|
||||
// Threads Array
|
||||
lockvar ThreadHandlesLock_;
|
||||
#endif
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
|
||||
// protect long critical regions
|
||||
lockvar BGL_;
|
||||
#endif
|
||||
#if defined(YAPOR) || defined(TABLING)
|
||||
struct global_optyap_data optyap_data_;
|
||||
#endif /* YAPOR || TABLING */
|
||||
|
||||
// whether Yap is responsible for signal handling
|
||||
int PrologShouldHandleInterrupts_;
|
||||
|
||||
/* This is the guy who actually started the system, and who has the correct registers */
|
||||
#if defined(THREADS)
|
||||
pthread_t master_thread_;
|
||||
struct thread_mbox* named_mboxes_;
|
||||
@ -69,39 +69,39 @@ typedef struct global_data {
|
||||
UInt mbox_count_;
|
||||
struct swi_mutex* WithMutex_;
|
||||
#endif /* THREADS */
|
||||
|
||||
// streams
|
||||
struct stream_desc* Stream_;
|
||||
#if defined(THREADS)||defined(YAPOR)
|
||||
lockvar StreamDescLock_;
|
||||
#endif
|
||||
|
||||
// access to yap initial arguments
|
||||
char** argv_;
|
||||
int argc_;
|
||||
|
||||
// extensions to Terms
|
||||
#ifdef COROUTINING
|
||||
|
||||
/* array with the ops for your favourite extensions */
|
||||
ext_op attas_[attvars_ext+1];
|
||||
#endif
|
||||
|
||||
// agc.c
|
||||
int agc_calls_;
|
||||
YAP_ULONG_LONG agc_collected_;
|
||||
|
||||
/* total time spent in GC */
|
||||
Int tot_agc_time_;
|
||||
|
||||
/* number of heap objects in all garbage collections */
|
||||
Int tot_agc_recovered_;
|
||||
|
||||
//arrays.c
|
||||
#if HAVE_MMAP
|
||||
struct MMAP_ARRAY_BLOCK* mmap_arrays_;
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
|
||||
//computils.c
|
||||
char Option_[20];
|
||||
YP_FILE* logfile_;
|
||||
|
||||
|
||||
//init.c
|
||||
//int output_msg =FALSE
|
||||
#endif
|
||||
#if defined(COFF) || defined(A_OUT)
|
||||
|
||||
// loada_coff.c && load_aout.c
|
||||
char Executable_[YAP_FILENAME_MAX];
|
||||
#endif
|
||||
int OpaqueHandlersCount_;
|
||||
@ -109,10 +109,10 @@ typedef struct global_data {
|
||||
#if __simplescalar__
|
||||
char pwd_[YAP_FILENAME_MAX];
|
||||
#endif
|
||||
|
||||
|
||||
//udi.c
|
||||
//struct udi_control_block RtreeCmd void
|
||||
char* RestoreFile_;
|
||||
|
||||
//gprof.c
|
||||
Int ProfCalls_;
|
||||
Int ProfGCs_;
|
||||
Int ProfHGrows_;
|
||||
@ -129,16 +129,18 @@ typedef struct global_data {
|
||||
FILE* FProf_;
|
||||
FILE* FPreds_;
|
||||
#endif /* LOW_PROF */
|
||||
|
||||
// Mutexes
|
||||
#if THREADS
|
||||
struct swi_mutex* FreeMutexes_;
|
||||
struct swi_mutex* mutex_backbone_;
|
||||
lockvar MUT_ACCESS_;
|
||||
#endif
|
||||
char* Home_;
|
||||
|
||||
/* ISO char conversion: I will make no comments */
|
||||
char* CharConversionTable_;
|
||||
char* CharConversionTable2_;
|
||||
|
||||
/* time */
|
||||
void* LastWTimePtr_;
|
||||
/* max priority */
|
||||
int MaxPriority_;
|
||||
} w_shared;
|
@ -2,9 +2,9 @@
|
||||
/* This file, hlocals.h, was generated automatically by "yap -L misc/buildlocalglobal"
|
||||
please do not update, update misc/LOCALS instead */
|
||||
|
||||
|
||||
// Stuff that must be considered local to a thread or worker
|
||||
typedef struct worker_local {
|
||||
|
||||
// Streams
|
||||
struct AliasDescS* FileAliases_;
|
||||
int NOfFileAliases_;
|
||||
int SzOfFileAliases_;
|
||||
@ -13,10 +13,10 @@ typedef struct worker_local {
|
||||
int c_error_stream_;
|
||||
bool sockets_io_;
|
||||
bool within_print_message_;
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Used by the prompts to check if they are after a newline, and then a
|
||||
// prompt should be output, or if we are in the middle of a line.
|
||||
//
|
||||
bool newline_;
|
||||
Atom AtPrompt_;
|
||||
char Prompt_[MAX_PROMPT+1];
|
||||
@ -27,7 +27,7 @@ typedef struct worker_local {
|
||||
UInt max_depth_;
|
||||
UInt max_list_;
|
||||
UInt max_write_args_;
|
||||
|
||||
// Restore info
|
||||
CELL* OldASP_;
|
||||
CELL* OldLCL0_;
|
||||
tr_fr_ptr OldTR_;
|
||||
@ -48,26 +48,26 @@ typedef struct worker_local {
|
||||
Int XDiff_;
|
||||
Int DelayDiff_;
|
||||
Int BaseDiff_;
|
||||
|
||||
// Reduction counters
|
||||
YAP_ULONG_LONG ReductionsCounter_;
|
||||
YAP_ULONG_LONG PredEntriesCounter_;
|
||||
YAP_ULONG_LONG RetriesCounter_;
|
||||
int ReductionsCounterOn_;
|
||||
int PredEntriesCounterOn_;
|
||||
int RetriesCounterOn_;
|
||||
|
||||
|
||||
// support for consulting files
|
||||
/* current consult stack */
|
||||
union CONSULT_OBJ* ConsultSp_;
|
||||
|
||||
/* current maximum number of cells in consult stack */
|
||||
UInt ConsultCapacity_;
|
||||
|
||||
/* top of consult stack */
|
||||
union CONSULT_OBJ* ConsultBase_;
|
||||
|
||||
/* low-water mark for consult */
|
||||
union CONSULT_OBJ* ConsultLow_;
|
||||
Term VarNames_;
|
||||
Atom SourceFileName_;
|
||||
UInt SourceFileLineno_;
|
||||
|
||||
//global variables
|
||||
Term GlobalArena_;
|
||||
UInt GlobalArenaOverflows_;
|
||||
Int ArenaOverflows_;
|
||||
@ -92,7 +92,7 @@ typedef struct worker_local {
|
||||
Term WokenGoals_;
|
||||
Term AttsMutableList_;
|
||||
#endif
|
||||
|
||||
// gc_stuff
|
||||
Term GcGeneration_;
|
||||
Term GcPhase_;
|
||||
UInt GcCurrentPhase_;
|
||||
@ -102,7 +102,7 @@ typedef struct worker_local {
|
||||
Int LastGcTime_;
|
||||
Int LastSSTime_;
|
||||
CELL* OpenArray_;
|
||||
|
||||
/* in a single gc */
|
||||
Int total_marked_;
|
||||
Int total_oldies_;
|
||||
struct choicept* current_B_;
|
||||
@ -135,16 +135,16 @@ typedef struct worker_local {
|
||||
struct static_array_entry* StaticArrays_;
|
||||
struct global_entry* GlobalVariables_;
|
||||
int AllowRestart_;
|
||||
|
||||
// Thread Local Area for Fast Storage of Intermediate Compiled Code
|
||||
struct mem_blk* CMemFirstBlock_;
|
||||
UInt CMemFirstBlockSz_;
|
||||
|
||||
// Variable used by the compiler to store number of permanent vars in a clause
|
||||
int nperm_;
|
||||
|
||||
// Thread Local Area for Labels
|
||||
Int* LabelFirstArray_;
|
||||
UInt LabelFirstArraySz_;
|
||||
|
||||
|
||||
// Thread Local Area for SWI-Prolog emulation routines.
|
||||
// struct PL_local_data* PL_local_data_p =Yap_InitThreadIO(wid)
|
||||
#ifdef THREADS
|
||||
struct thandle ThreadHandle_;
|
||||
#endif /* THREADS */
|
||||
@ -158,7 +158,7 @@ typedef struct worker_local {
|
||||
Int total_choicepoints_;
|
||||
#endif
|
||||
int consult_level_;
|
||||
|
||||
// Variables related to memory allocation
|
||||
ADDR LocalBase_;
|
||||
ADDR GlobalBase_;
|
||||
ADDR TrailBase_;
|
||||
@ -185,27 +185,27 @@ const char* Error_Function_;
|
||||
sigjmp_buf RestartEnv_;
|
||||
char FileNameBuf_[YAP_FILENAME_MAX];
|
||||
char FileNameBuf2_[YAP_FILENAME_MAX];
|
||||
|
||||
// Prolog State
|
||||
UInt BreakLevel_;
|
||||
Int PrologMode_;
|
||||
int CritLocks_;
|
||||
|
||||
// Prolog execution and state flags
|
||||
union flagTerm* Flags_;
|
||||
UInt flagCount_;
|
||||
|
||||
|
||||
//analyst.c
|
||||
/* used to find out how many instructions of each kind are executed */
|
||||
#ifdef ANALYST
|
||||
YAP_ULONG_LONG opcount_[_std_top+1];
|
||||
YAP_ULONG_LONG 2opcount[_std_top+1][_std_top+1]_;
|
||||
#endif /* ANALYST */
|
||||
|
||||
//dbase.c
|
||||
struct db_globs* s_dbg_;
|
||||
|
||||
//eval.c
|
||||
yap_error_number matherror_;
|
||||
Term mathtt_;
|
||||
char* mathstring_;
|
||||
yap_error_number CurrentError_;
|
||||
|
||||
//grow.c
|
||||
int heap_overflows_;
|
||||
Int total_heap_overflow_time_;
|
||||
int stack_overflows_;
|
||||
@ -216,15 +216,15 @@ const char* Error_Function_;
|
||||
Int total_trail_overflow_time_;
|
||||
int atom_table_overflows_;
|
||||
Int total_atom_table_overflow_time_;
|
||||
|
||||
//load_dyld
|
||||
#ifdef LOAD_DYLD
|
||||
int dl_errno_;
|
||||
#endif
|
||||
|
||||
//tracer.c
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
int do_trace_primitives_;
|
||||
#endif
|
||||
|
||||
//quick loader
|
||||
struct export_atom_hash_entry_struct *ExportAtomHashChain_;
|
||||
UInt ExportAtomHashTableSize_;
|
||||
UInt ExportAtomHashTableNum_;
|
||||
@ -252,25 +252,24 @@ const char* Error_Function_;
|
||||
UInt ImportDBRefHashTableSize_;
|
||||
UInt ImportDBRefHashTableNum_;
|
||||
yamop *ImportFAILCODE_;
|
||||
Functor FunctorVar_;
|
||||
#if __ANDROID__
|
||||
|
||||
// current virtual directory.
|
||||
struct AAssetManager* assetManager_;
|
||||
char* InAssetDir_;
|
||||
#endif
|
||||
|
||||
// exo indexing
|
||||
UInt ibnds_[256];
|
||||
struct index_t* exo_it_;
|
||||
CELL* exo_base_;
|
||||
UInt exo_arity_;
|
||||
UInt exo_arg_;
|
||||
|
||||
// atom completion
|
||||
struct scan_atoms* search_atoms_;
|
||||
|
||||
// Slots
|
||||
yhandle_t CurSlot_;
|
||||
yhandle_t NSlots_;
|
||||
CELL* SlotBase_;
|
||||
|
||||
// Mutexes
|
||||
struct swi_mutex* Mutexes_;
|
||||
Term SourceModule_;
|
||||
Term Including_;
|
303
H/heap/hstruct.h
Executable file
@ -0,0 +1,303 @@
|
||||
|
||||
/* This file, hstruct.h, was generated automatically by "yap -L misc/buildlocalglobal"
|
||||
please do not update, update misc/HEAPFIELDS instead */
|
||||
|
||||
//
|
||||
// File defining fields in the Yap_heap_codes global structure
|
||||
//
|
||||
// these fields used to spread all over the place, because they must be used in 4 ways:
|
||||
// - they must be defined somewhere
|
||||
// - they have an #ifdef to get a shorter name
|
||||
// - they must be initialised somewhere
|
||||
// - they must be restorable and collectable (from the atom gc).
|
||||
//
|
||||
//
|
||||
// The defs include 4+ components:
|
||||
// Type
|
||||
// name in structured
|
||||
// global name
|
||||
// init code and restore code (optional)
|
||||
//
|
||||
//
|
||||
//
|
||||
// MkAT (MkAtomTerm) cvts from a predefined atom to a term
|
||||
// MkPred constructs a pred_entry
|
||||
// MkOp gets an opcode
|
||||
// void does nothing
|
||||
// =VALUE inits as VALUE
|
||||
// Init... sets up call to InitFunc
|
||||
// Restore... sets up call to RestoreFunc
|
||||
//
|
||||
|
||||
/* memory management */
|
||||
UInt Yap_HoleSize_;
|
||||
struct malloc_state *Yap_av_;
|
||||
#if USE_DL_MALLOC
|
||||
struct Yap_MemoryHoles[MAX_DLMALLOC_HOLES] void_;
|
||||
UInt Yap_NOfMemoryHoles_;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar DLMallocLock_;
|
||||
#endif
|
||||
#endif
|
||||
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
|
||||
#ifndef HeapUsed
|
||||
#define HeapUsed Yap_givemallinfo()
|
||||
#endif
|
||||
Int NotHeapUsed_;
|
||||
#else
|
||||
Int HeapUsed_;
|
||||
#endif
|
||||
Int HeapMax_;
|
||||
ADDR HeapTop_;
|
||||
ADDR HeapLim_;
|
||||
struct FREEB *FreeBlocks_;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar FreeBlocksLock_;
|
||||
lockvar HeapUsedLock_;
|
||||
lockvar HeapTopLock_;
|
||||
int HeapTopOwner_;
|
||||
#endif
|
||||
UInt MaxStack_;
|
||||
UInt MaxTrail_;
|
||||
/* execution info */
|
||||
/* OPCODE REVERSE TABLE, needed to recover op tables */
|
||||
#if USE_THREADED_CODE
|
||||
op_entry *OP_RTABLE_;
|
||||
#endif
|
||||
/* popular opcodes */
|
||||
OPCODE EXECUTE_CPRED_OP_CODE_;
|
||||
OPCODE EXPAND_OP_CODE_;
|
||||
OPCODE FAIL_OPCODE_;
|
||||
OPCODE INDEX_OPCODE_;
|
||||
OPCODE LOCKPRED_OPCODE_;
|
||||
OPCODE ORLAST_OPCODE_;
|
||||
OPCODE UNDEF_OPCODE_;
|
||||
OPCODE RETRY_USERC_OPCODE_;
|
||||
OPCODE EXECUTE_CPRED_OPCODE_;
|
||||
/* atom tables */
|
||||
UInt NOfAtoms_;
|
||||
UInt AtomHashTableSize_;
|
||||
UInt WideAtomHashTableSize_;
|
||||
UInt NOfWideAtoms_;
|
||||
AtomHashEntry INVISIBLECHAIN_;
|
||||
AtomHashEntry *WideHashChain_;
|
||||
AtomHashEntry *HashChain_;
|
||||
/* use atom defs here */
|
||||
#include "tatoms.h"
|
||||
#ifdef EUROTRA
|
||||
Term TermDollarU_;
|
||||
#endif
|
||||
//modules
|
||||
Term USER_MODULE_;
|
||||
Term IDB_MODULE_;
|
||||
Term ATTRIBUTES_MODULE_;
|
||||
Term CHARSIO_MODULE_;
|
||||
Term CHTYPE_MODULE_;
|
||||
Term TERMS_MODULE_;
|
||||
Term SYSTEM_MODULE_;
|
||||
Term READUTIL_MODULE_;
|
||||
Term HACKS_MODULE_;
|
||||
Term ARG_MODULE_;
|
||||
Term GLOBALS_MODULE_;
|
||||
Term SWI_MODULE_;
|
||||
Term DBLOAD_MODULE_;
|
||||
Term RANGE_MODULE_;
|
||||
Term ERROR_MODULE_;
|
||||
//
|
||||
// Module list
|
||||
//
|
||||
struct mod_entry *CurrentModules_;
|
||||
// make sure we have the modules set at this point.
|
||||
// don't actually want to define a field
|
||||
|
||||
// hidden predicates
|
||||
Prop HIDDEN_PREDICATES_;
|
||||
// make sure we have the streams set at this point.
|
||||
// don't actually want to define a field
|
||||
|
||||
union flagTerm* GLOBAL_Flags_;
|
||||
UInt GLOBAL_flagCount_;
|
||||
/* Anderson's JIT */
|
||||
yap_exec_mode Yap_ExecutionMode_;
|
||||
/* The Predicate Hash Table: fast access to predicates. */
|
||||
struct pred_entry **PredHash_;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
rwlock_t PredHashRWLock_;
|
||||
#endif
|
||||
UInt PredsInHashTable_;
|
||||
UInt PredHashTableSize_;
|
||||
/* Well-Known Predicates */
|
||||
struct pred_entry *CreepCode_;
|
||||
struct pred_entry *UndefCode_;
|
||||
struct pred_entry *SpyCode_;
|
||||
struct pred_entry *PredFail_;
|
||||
struct pred_entry *PredTrue_;
|
||||
#ifdef COROUTINING
|
||||
struct pred_entry *WakeUpCode_;
|
||||
#endif
|
||||
struct pred_entry *PredGoalExpansion_;
|
||||
struct pred_entry *PredMetaCall_;
|
||||
struct pred_entry *PredTraceMetaCall_;
|
||||
struct pred_entry *PredDollarCatch_;
|
||||
struct pred_entry *PredRecordedWithKey_;
|
||||
struct pred_entry *PredLogUpdClause_;
|
||||
struct pred_entry *PredLogUpdClauseErase_;
|
||||
struct pred_entry *PredLogUpdClause0_;
|
||||
struct pred_entry *PredStaticClause_;
|
||||
struct pred_entry *PredThrow_;
|
||||
struct pred_entry *PredHandleThrow_;
|
||||
struct pred_entry *PredIs_;
|
||||
struct pred_entry *PredSafeCallCleanup_;
|
||||
struct pred_entry *PredRestoreRegs_;
|
||||
struct pred_entry *PredCommentHook_;
|
||||
#ifdef YAPOR
|
||||
struct pred_entry *PredGetwork_;
|
||||
#endif /* YAPOR */
|
||||
struct pred_entry *PredProcedure_;
|
||||
/* low-level tracer */
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
int Yap_do_low_level_trace_;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar Yap_low_level_trace_lock_;
|
||||
#endif
|
||||
#endif
|
||||
/* code management info */
|
||||
UInt Yap_ClauseSpace_;
|
||||
UInt Yap_IndexSpace_Tree_;
|
||||
UInt Yap_IndexSpace_EXT_;
|
||||
UInt Yap_IndexSpace_SW_;
|
||||
UInt Yap_LUClauseSpace_;
|
||||
UInt Yap_LUIndexSpace_Tree_;
|
||||
UInt Yap_LUIndexSpace_CP_;
|
||||
UInt Yap_LUIndexSpace_EXT_;
|
||||
UInt Yap_LUIndexSpace_SW_;
|
||||
/* static code: may be shared by many predicate or may be used for meta-execution */
|
||||
yamop COMMA_CODE_[5];
|
||||
yamop DUMMYCODE_[1];
|
||||
yamop FAILCODE_[1];
|
||||
yamop NOCODE_[1];
|
||||
yamop ENV_FOR_TRUSTFAIL_[2];
|
||||
yamop *TRUSTFAILCODE_;
|
||||
yamop ENV_FOR_YESCODE_[2];
|
||||
yamop *YESCODE_;
|
||||
yamop RTRYCODE_[1];
|
||||
#ifdef BEAM
|
||||
yamop BEAM_RETRY_CODE_[1];
|
||||
#endif /* BEAM */
|
||||
#ifdef YAPOR
|
||||
yamop GETWORK_[1];
|
||||
yamop GETWORK_SEQ_[1];
|
||||
yamop GETWORK_FIRST_TIME_[1];
|
||||
#endif /* YAPOR */
|
||||
#ifdef TABLING
|
||||
yamop LOAD_ANSWER_[1];
|
||||
yamop TRY_ANSWER_[1];
|
||||
yamop ANSWER_RESOLUTION_[1];
|
||||
yamop COMPLETION_[1];
|
||||
#ifdef THREADS_CONSUMER_SHARING
|
||||
yamop ANSWER_RESOLUTION_COMPLETION_[1];
|
||||
#endif /* THREADS_CONSUMER_SHARING */
|
||||
#endif /* TABLING */
|
||||
/* */
|
||||
/* PREG just before we enter $spy. We use that to find out the clause which */
|
||||
/* was calling the debugged goal. */
|
||||
/* */
|
||||
yamop *P_before_spy_;
|
||||
/* support recorded_k */
|
||||
yamop *RETRY_C_RECORDEDP_CODE_;
|
||||
yamop *RETRY_C_RECORDED_K_CODE_;
|
||||
/* compiler flags */
|
||||
int PROFILING_;
|
||||
int CALL_COUNTING_;
|
||||
int optimizer_on_;
|
||||
int compile_mode_;
|
||||
int profiling_;
|
||||
int call_counting_;
|
||||
/********* whether we should try to compile array references ******************/
|
||||
int compile_arrays_;
|
||||
/* DBTerms: pre-compiled ground terms */
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar DBTermsListLock_;
|
||||
#endif
|
||||
struct dbterm_list *DBTermsList_;
|
||||
/* JITI support */
|
||||
yamop *ExpandClausesFirst_;
|
||||
yamop *ExpandClausesLast_;
|
||||
UInt Yap_ExpandClauses_;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar ExpandClausesListLock_;
|
||||
lockvar OpListLock_;
|
||||
#endif
|
||||
/* instrumentation */
|
||||
#ifdef DEBUG
|
||||
UInt Yap_NewCps_;
|
||||
UInt Yap_LiveCps_;
|
||||
UInt Yap_DirtyCps_;
|
||||
UInt Yap_FreedCps_;
|
||||
#endif
|
||||
UInt Yap_expand_clauses_sz_;
|
||||
/* UDI support */
|
||||
struct udi_info *UdiControlBlocks_;
|
||||
/* data-base statistics */
|
||||
/* system boots in compile mode */
|
||||
Int STATIC_PREDICATES_MARKED_;
|
||||
/* Internal Database */
|
||||
Prop *INT_KEYS_;
|
||||
Prop *INT_LU_KEYS_;
|
||||
Prop *INT_BB_KEYS_;
|
||||
/* Internal Database Statistics */
|
||||
UInt INT_KEYS_SIZE_;
|
||||
UInt INT_KEYS_TIMESTAMP_;
|
||||
UInt INT_BB_KEYS_SIZE_;
|
||||
/* Internal Data-Base Control */
|
||||
int UPDATE_MODE_;
|
||||
/* nasty IDB stuff */
|
||||
struct DB_STRUCT *DBErasedMarker_;
|
||||
struct logic_upd_clause *LogDBErasedMarker_;
|
||||
/* Dead clauses and IDB entries */
|
||||
struct static_clause *DeadStaticClauses_;
|
||||
struct static_mega_clause *DeadMegaClauses_;
|
||||
struct static_index *DeadStaticIndices_;
|
||||
struct logic_upd_clause *DBErasedList_;
|
||||
struct logic_upd_index *DBErasedIList_;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar DeadStaticClausesLock_;
|
||||
lockvar DeadMegaClausesLock_;
|
||||
lockvar DeadStaticIndicesLock_;
|
||||
#endif
|
||||
#ifdef COROUTINING
|
||||
/* number of attribute modules */
|
||||
int NUM_OF_ATTS_;
|
||||
/* initialised by memory allocator */
|
||||
UInt Yap_AttsSize_;
|
||||
#endif
|
||||
/* Operators */
|
||||
struct operator_entry *OpList_;
|
||||
/* foreign code loaded */
|
||||
struct ForeignLoadItem *ForeignCodeLoaded_;
|
||||
ADDR ForeignCodeBase_;
|
||||
ADDR ForeignCodeTop_;
|
||||
ADDR ForeignCodeMax_;
|
||||
/* recorded terms */
|
||||
struct record_list *Yap_Records_;
|
||||
/* SWI atoms and functors */
|
||||
Atom *SWI_Atoms_;
|
||||
Functor *SWI_Functors_;
|
||||
swi_rev_hash SWI_ReverseHash_[N_SWI_HASH];
|
||||
/* integer access to atoms */
|
||||
Int AtomTranslations_;
|
||||
Int MaxAtomTranslations_;
|
||||
/* integer access to functors */
|
||||
Int FunctorTranslations_;
|
||||
Int MaxFunctorTranslations_;
|
||||
Atom EmptyWakeups_[MAX_EMPTY_WAKEUPS];
|
||||
int MaxEmptyWakeups_;
|
||||
/* SWI blobs */
|
||||
struct YAP_blob_t *BlobTypes_;
|
||||
struct AtomEntryStruct *Blobs_;
|
||||
UInt NOfBlobs_;
|
||||
UInt NOfBlobsMax_;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar Blobs_Lock_;
|
||||
#endif
|
||||
|
@ -141,4 +141,6 @@ static void InitGlobal(void) {
|
||||
GLOBAL_CharConversionTable2 = NULL;
|
||||
|
||||
GLOBAL_LastWTimePtr = NULL;
|
||||
|
||||
GLOBAL_MaxPriority = 1200;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
|
||||
/* This file, ihstruct.h, was generated automatically by "yap -L misc/buildheap"
|
||||
/* This file, ihstruct.h, was generated automatically by "yap -L misc/buildlocalglobal"
|
||||
please do not update, update misc/HEAPFIELDS instead */
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if USE_DL_MALLOC
|
||||
@ -101,6 +102,7 @@
|
||||
SWI_MODULE = MkAtomTerm(AtomSwi);
|
||||
DBLOAD_MODULE = MkAtomTerm(AtomDBLoad);
|
||||
RANGE_MODULE = MkAtomTerm(AtomRange);
|
||||
ERROR_MODULE = MkAtomTerm(AtomError);
|
||||
|
||||
|
||||
|
||||
@ -150,8 +152,8 @@
|
||||
PredCommentHook = RepPredProp(PredPropByFunc(FunctorCommentHook,PROLOG_MODULE));
|
||||
#ifdef YAPOR
|
||||
PredGetwork = RepPredProp(PredPropByAtom(AtomGetwork,PROLOG_MODULE));
|
||||
PredGetworkSeq = RepPredProp(PredPropByAtom(AtomGetworkSeq,PROLOG_MODULE));
|
||||
#endif /* YAPOR */
|
||||
PredProcedure = Yap_MkLogPred(RepPredProp(PredPropByFunc(FunctorProcedure,PROLOG_MODULE)));
|
||||
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
Yap_do_low_level_trace = FALSE;
|
||||
@ -207,9 +209,6 @@
|
||||
|
||||
PROFILING = FALSE;
|
||||
CALL_COUNTING = FALSE;
|
||||
PRED_GOAL_EXPANSION_ALL = FALSE;
|
||||
PRED_GOAL_EXPANSION_FUNC = FALSE;
|
||||
PRED_GOAL_EXPANSION_ON = FALSE;
|
||||
optimizer_on = TRUE;
|
||||
compile_mode = 0;
|
||||
profiling = FALSE;
|
||||
@ -301,3 +300,4 @@
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
INIT_LOCK(Blobs_Lock);
|
||||
#endif
|
||||
|
@ -252,7 +252,6 @@ static void InitWorker(int wid) {
|
||||
REMOTE_ImportDBRefHashTableSize(wid) = 0;
|
||||
REMOTE_ImportDBRefHashTableNum(wid) = 0;
|
||||
REMOTE_ImportFAILCODE(wid) = NULL;
|
||||
REMOTE_FunctorVar(wid) = FunctorVar;
|
||||
#if __ANDROID__
|
||||
|
||||
REMOTE_assetManager(wid) = GLOBAL_assetManager;
|
@ -141,4 +141,6 @@ static void RestoreGlobal(void) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
|
||||
/* This file, rhstruct.h, was generated automatically by "yap -L misc/buildheap"
|
||||
/* This file, rhstruct.h, was generated automatically by "yap -L misc/buildlocalglobal"
|
||||
please do not update, update misc/HEAPFIELDS instead */
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if USE_DL_MALLOC
|
||||
@ -101,6 +102,7 @@
|
||||
SWI_MODULE = AtomTermAdjust(SWI_MODULE);
|
||||
DBLOAD_MODULE = AtomTermAdjust(DBLOAD_MODULE);
|
||||
RANGE_MODULE = AtomTermAdjust(RANGE_MODULE);
|
||||
ERROR_MODULE = AtomTermAdjust(ERROR_MODULE);
|
||||
|
||||
|
||||
|
||||
@ -150,8 +152,8 @@
|
||||
PredCommentHook = PtoPredAdjust(PredCommentHook);
|
||||
#ifdef YAPOR
|
||||
PredGetwork = PtoPredAdjust(PredGetwork);
|
||||
PredGetworkSeq = PtoPredAdjust(PredGetworkSeq);
|
||||
#endif /* YAPOR */
|
||||
PredProcedure = PtoPredAdjust(PredProcedure);
|
||||
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
|
||||
@ -214,9 +216,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
REINIT_LOCK(DBTermsListLock);
|
||||
#endif
|
||||
@ -301,3 +300,4 @@
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
REINIT_LOCK(Blobs_Lock);
|
||||
#endif
|
||||
|
@ -250,7 +250,6 @@ static void RestoreWorker(int wid USES_REGS) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if __ANDROID__
|
303
H/hstruct.h
@ -1,303 +0,0 @@
|
||||
|
||||
/* This file, hstruct.h, was generated automatically by "yap -L misc/buildheap"
|
||||
please do not update, update misc/HEAPFIELDS instead */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
UInt hole_size;
|
||||
struct malloc_state *av_;
|
||||
#if USE_DL_MALLOC
|
||||
struct memory_hole memory_holes[MAX_DLMALLOC_HOLES];
|
||||
UInt nof_memory_holes;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar dlmalloc_lock;
|
||||
#endif
|
||||
#endif
|
||||
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
|
||||
#ifndef HeapUsed
|
||||
#define HeapUsed Yap_givemallinfo()
|
||||
#endif
|
||||
Int heap_used;
|
||||
#else
|
||||
Int heap_used;
|
||||
#endif
|
||||
Int heap_max;
|
||||
ADDR heap_top;
|
||||
ADDR heap_lim;
|
||||
struct FREEB *free_blocks;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar free_blocks_lock;
|
||||
lockvar heap_used_lock;
|
||||
lockvar heap_top_lock;
|
||||
int heap_top_owner;
|
||||
#endif
|
||||
UInt MaxStack_;
|
||||
UInt MaxTrail_;
|
||||
|
||||
|
||||
#if USE_THREADED_CODE
|
||||
op_entry *op_rtable;
|
||||
#endif
|
||||
|
||||
OPCODE execute_cpred_op_code;
|
||||
OPCODE expand_op_code;
|
||||
OPCODE fail_op;
|
||||
OPCODE index_op;
|
||||
OPCODE lockpred_op;
|
||||
OPCODE orlast_op;
|
||||
OPCODE undef_op;
|
||||
OPCODE retry_userc_op;
|
||||
OPCODE execute_cpred_op;
|
||||
|
||||
UInt n_of_atoms;
|
||||
UInt atom_hash_table_size;
|
||||
UInt wide_atom_hash_table_size;
|
||||
UInt n_of_wide_atoms;
|
||||
AtomHashEntry invisiblechain;
|
||||
AtomHashEntry *wide_hash_chain;
|
||||
AtomHashEntry *hash_chain;
|
||||
|
||||
#include "tatoms.h"
|
||||
#ifdef EUROTRA
|
||||
Term term_dollar_u;
|
||||
#endif
|
||||
|
||||
Term user_module;
|
||||
Term idb_module;
|
||||
Term attributes_module;
|
||||
Term charsio_module;
|
||||
Term chtype_module;
|
||||
Term terms_module;
|
||||
Term system_module;
|
||||
Term readutil_module;
|
||||
Term hacks_module;
|
||||
Term arg_module;
|
||||
Term globals_module;
|
||||
Term swi_module;
|
||||
Term dbload_module;
|
||||
Term range_module;
|
||||
|
||||
|
||||
|
||||
struct mod_entry *current_modules;
|
||||
|
||||
|
||||
|
||||
|
||||
Prop hidden_predicates;
|
||||
|
||||
|
||||
|
||||
union flagTerm* GLOBAL_Flags_;
|
||||
UInt GLOBAL_flagCount_;
|
||||
|
||||
yap_exec_mode execution_mode;
|
||||
|
||||
struct pred_entry **pred_hash;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
rwlock_t pred_hash_rw_lock;
|
||||
#endif
|
||||
UInt preds_in_hash_table;
|
||||
UInt pred_hash_table_size;
|
||||
|
||||
struct pred_entry *creep_code;
|
||||
struct pred_entry *undef_code;
|
||||
struct pred_entry *spy_code;
|
||||
struct pred_entry *pred_fail;
|
||||
struct pred_entry *pred_true;
|
||||
#ifdef COROUTINING
|
||||
struct pred_entry *wake_up_code;
|
||||
#endif
|
||||
struct pred_entry *pred_goal_expansion;
|
||||
struct pred_entry *pred_meta_call;
|
||||
struct pred_entry *pred_trace_meta_call;
|
||||
struct pred_entry *pred_dollar_catch;
|
||||
struct pred_entry *pred_recorded_with_key;
|
||||
struct pred_entry *pred_log_upd_clause;
|
||||
struct pred_entry *pred_log_upd_clause_erase;
|
||||
struct pred_entry *pred_log_upd_clause0;
|
||||
struct pred_entry *pred_static_clause;
|
||||
struct pred_entry *pred_throw;
|
||||
struct pred_entry *pred_handle_throw;
|
||||
struct pred_entry *pred_is;
|
||||
struct pred_entry *pred_safe_call_cleanup;
|
||||
struct pred_entry *pred_restore_regs;
|
||||
struct pred_entry *pred_comment_hook;
|
||||
#ifdef YAPOR
|
||||
struct pred_entry *pred_getwork;
|
||||
struct pred_entry *pred_getwork_seq;
|
||||
#endif /* YAPOR */
|
||||
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
int yap_do_low_level_trace;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar low_level_trace_lock;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
UInt clause_space;
|
||||
UInt index_space_Tree;
|
||||
UInt index_space_EXT;
|
||||
UInt index_space_SW;
|
||||
UInt lu_clause_space;
|
||||
UInt lu_index_space_Tree;
|
||||
UInt lu_index_space_CP;
|
||||
UInt lu_index_space_EXT;
|
||||
UInt lu_index_space_SW;
|
||||
|
||||
yamop comma_code[5];
|
||||
yamop dummycode[1];
|
||||
yamop failcode[1];
|
||||
yamop nocode[1];
|
||||
yamop env_for_trustfail[2];
|
||||
yamop *trustfailcode;
|
||||
yamop env_for_yescode[2];
|
||||
yamop *yescode;
|
||||
yamop rtrycode[1];
|
||||
#ifdef BEAM
|
||||
yamop beam_retry_code[1];
|
||||
#endif /* BEAM */
|
||||
#ifdef YAPOR
|
||||
yamop getwork_code[1];
|
||||
yamop getwork_seq_code[1];
|
||||
yamop getwork_first_time[1];
|
||||
#endif /* YAPOR */
|
||||
#ifdef TABLING
|
||||
yamop table_load_answer_code[1];
|
||||
yamop table_try_answer_code[1];
|
||||
yamop table_answer_resolution_code[1];
|
||||
yamop table_completion_code[1];
|
||||
#ifdef THREADS_CONSUMER_SHARING
|
||||
yamop table_answer_resolution_completion_code[1];
|
||||
#endif /* THREADS_CONSUMER_SHARING */
|
||||
#endif /* TABLING */
|
||||
|
||||
|
||||
|
||||
|
||||
yamop *debugger_p_before_spy;
|
||||
|
||||
yamop *retry_recordedp_code;
|
||||
yamop *retry_recorded_k_code;
|
||||
|
||||
int system_profiling;
|
||||
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_compile_mode;
|
||||
int compiler_profiling;
|
||||
int compiler_call_counting;
|
||||
|
||||
int compiler_compile_arrays;
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar dbterms_list_lock;
|
||||
#endif
|
||||
struct dbterm_list *dbterms_list;
|
||||
|
||||
yamop *expand_clauses_first;
|
||||
yamop *expand_clauses_last;
|
||||
UInt expand_clauses;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar expand_clauses_list_lock;
|
||||
lockvar op_list_lock;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
UInt new_cps;
|
||||
UInt live_cps;
|
||||
UInt dirty_cps;
|
||||
UInt freed_cps;
|
||||
#endif
|
||||
UInt expand_clauses_sz;
|
||||
|
||||
struct udi_info *udi_control_blocks;
|
||||
|
||||
|
||||
Int static_predicates_marked;
|
||||
|
||||
Prop *IntKeys;
|
||||
Prop *IntLUKeys;
|
||||
Prop *IntBBKeys;
|
||||
|
||||
UInt int_keys_size;
|
||||
UInt int_keys_timestamp;
|
||||
UInt int_bb_keys_size;
|
||||
|
||||
int update_mode;
|
||||
|
||||
struct DB_STRUCT *db_erased_marker;
|
||||
struct logic_upd_clause *logdb_erased_marker;
|
||||
|
||||
struct static_clause *dead_static_clauses;
|
||||
struct static_mega_clause *dead_mega_clauses;
|
||||
struct static_index *dead_static_indices;
|
||||
struct logic_upd_clause *db_erased_list;
|
||||
struct logic_upd_index *db_erased_ilist;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar dead_static_clauses_lock;
|
||||
lockvar dead_mega_clauses_lock;
|
||||
lockvar dead_static_indices_lock;
|
||||
#endif
|
||||
#ifdef COROUTINING
|
||||
|
||||
int num_of_atts;
|
||||
|
||||
UInt atts_size;
|
||||
#endif
|
||||
|
||||
struct operator_entry *op_list;
|
||||
|
||||
struct ForeignLoadItem *foreign_code_loaded;
|
||||
ADDR foreign_code_base;
|
||||
ADDR foreign_code_top;
|
||||
ADDR foreign_code_max;
|
||||
|
||||
struct record_list *yap_records;
|
||||
|
||||
Atom *swi_atoms;
|
||||
Functor *swi_functors;
|
||||
struct swi_reverse_hash swi_reverse_hash[N_SWI_HASH];
|
||||
|
||||
Int atom_translations;
|
||||
Int max_atom_translations;
|
||||
|
||||
Int functor_translations;
|
||||
Int max_functor_translations;
|
||||
Atom empty_wakeups[MAX_EMPTY_WAKEUPS];
|
||||
int max_empty_wakeups;
|
||||
|
||||
struct YAP_blob_t *swi_blob_types;
|
||||
struct AtomEntryStruct *swi_blobs;
|
||||
UInt nofblobs;
|
||||
UInt nofblobsmax;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar blobs_lock;
|
||||
#endif
|
17
H/iatoms.h
@ -20,11 +20,16 @@
|
||||
AtomArrayOverflow = Yap_LookupAtom("array_overflow");
|
||||
AtomArrayType = Yap_LookupAtom("array_type");
|
||||
AtomArrow = Yap_LookupAtom("->");
|
||||
AtomAttributedModule = Yap_LookupAtom("attributes_module");
|
||||
AtomDoubleArrow = Yap_LookupAtom("-->");
|
||||
AtomAssert = Yap_LookupAtom(":-");
|
||||
AtomEmptyBrackets = Yap_LookupAtom("()");
|
||||
AtomEmptySquareBrackets = 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");
|
||||
AtomAtom = Yap_LookupAtom("atom");
|
||||
AtomAtomic = Yap_LookupAtom("atomic");
|
||||
@ -66,6 +71,7 @@
|
||||
AtomCompact = Yap_LookupAtom("compact");
|
||||
AtomCompound = Yap_LookupAtom("compound");
|
||||
AtomConsistencyError = Yap_LookupAtom("consistency_error");
|
||||
AtomConsult = Yap_LookupAtom("consult");
|
||||
AtomConsultOnBoot = Yap_FullLookupAtom("$consult_on_boot");
|
||||
AtomContext = Yap_LookupAtom("context");
|
||||
AtomCputime = Yap_LookupAtom("cputime");
|
||||
@ -102,6 +108,7 @@
|
||||
AtomDoStaticClause = Yap_FullLookupAtom("$do_static_clause");
|
||||
AtomDots = Yap_LookupAtom("dots");
|
||||
AtomDOUBLE = Yap_FullLookupAtom("Double");
|
||||
AtomDoubleSlash = Yap_FullLookupAtom("//");
|
||||
AtomE = Yap_LookupAtom("e");
|
||||
AtomEOFBeforeEOT = Yap_LookupAtom("end_of_file_found_before_end_of_term");
|
||||
AtomEQ = Yap_LookupAtom("=");
|
||||
@ -133,6 +140,7 @@
|
||||
AtomFail = Yap_LookupAtom("fail");
|
||||
AtomFalse = Yap_LookupAtom("false");
|
||||
AtomFast = Yap_FullLookupAtom("$fast");
|
||||
AtomFastFail = Yap_LookupAtom("fast_fail");
|
||||
AtomFileErrors = Yap_LookupAtom("file_errors");
|
||||
AtomFileerrors = Yap_LookupAtom("fileerrors");
|
||||
AtomFileType = Yap_LookupAtom("file_type");
|
||||
@ -288,6 +296,7 @@
|
||||
AtomReadOnly = Yap_LookupAtom("read_only");
|
||||
AtomReadWrite = Yap_LookupAtom("read_write");
|
||||
AtomReadutil = Yap_LookupAtom("readutil");
|
||||
AtomReconsult = Yap_LookupAtom("reconsult");
|
||||
AtomRecordedP = Yap_FullLookupAtom("$recordep");
|
||||
AtomRecordedWithKey = Yap_FullLookupAtom("$recorded_with_key");
|
||||
AtomRedefineWarnings = Yap_LookupAtom("redefine_warnings");
|
||||
@ -390,14 +399,16 @@
|
||||
AtomUserErr = Yap_LookupAtom("user_error");
|
||||
AtomUserIn = Yap_LookupAtom("user_input");
|
||||
AtomUserOut = Yap_LookupAtom("user_output");
|
||||
AtomDollarVar = Yap_LookupAtom("$VAR");
|
||||
AtomVBar = Yap_LookupAtom("|");
|
||||
AtomVar = Yap_FullLookupAtom("$VAR");
|
||||
AtomVarBranches = Yap_LookupAtom("var_branches");
|
||||
AtomVariableNames = Yap_LookupAtom("variable_names");
|
||||
AtomHiddenVar = Yap_FullLookupAtom("$V");
|
||||
AtomVariable = Yap_LookupAtom("variable");
|
||||
AtomVerbose = Yap_LookupAtom("verbose");
|
||||
AtomVerboseFileSearch = Yap_LookupAtom("verbose_file_search");
|
||||
AtomVersionNumber = Yap_FullLookupAtom("$version_name");
|
||||
AtomVeryVerbose = Yap_LookupAtom("very_verbose");
|
||||
AtomWakeUpGoal = Yap_FullLookupAtom("$wake_up_goal");
|
||||
AtomWarning = Yap_LookupAtom("warning");
|
||||
AtomWhen = Yap_FullLookupAtom("$when");
|
||||
@ -443,6 +454,7 @@
|
||||
FunctorDoLogUpdClause0 = Yap_MkFunctor(AtomDoLogUpdClause0,6);
|
||||
FunctorDoLogUpdClauseErase = Yap_MkFunctor(AtomDoLogUpdClauseErase,6);
|
||||
FunctorDoStaticClause = Yap_MkFunctor(AtomDoStaticClause,5);
|
||||
FunctorDollarVar = Yap_MkFunctor(AtomDollarVar,1);
|
||||
FunctorDomainError = Yap_MkFunctor(AtomDomainError,2);
|
||||
FunctorDot = Yap_MkFunctor(AtomDot,2);
|
||||
FunctorDot10 = Yap_MkFunctor(AtomDot,10);
|
||||
@ -456,6 +468,7 @@
|
||||
FunctorDot7 = Yap_MkFunctor(AtomDot,7);
|
||||
FunctorDot8 = Yap_MkFunctor(AtomDot,8);
|
||||
FunctorDot9 = Yap_MkFunctor(AtomDot,9);
|
||||
FunctorDoubleSlash = Yap_MkFunctor(AtomDoubleSlash,2);
|
||||
FunctorEmptySquareBrackets = Yap_MkFunctor(AtomEmptySquareBrackets,2);
|
||||
FunctorEmptyCurlyBrackets = Yap_MkFunctor(AtomEmptyCurlyBrackets,2);
|
||||
FunctorEq = Yap_MkFunctor(AtomEq,2);
|
||||
@ -501,6 +514,7 @@
|
||||
FunctorPlus = Yap_MkFunctor(AtomPlus,2);
|
||||
FunctorPortray = Yap_MkFunctor(AtomPortray,1);
|
||||
FunctorPrintMessage = Yap_MkFunctor(AtomPrintMessage,2);
|
||||
FunctorProcedure = Yap_MkFunctor(AtomProcedure,5);
|
||||
FunctorPrologConstraint = Yap_MkFunctor(AtomProlog,2);
|
||||
FunctorQuery = Yap_MkFunctor(AtomQuery,1);
|
||||
FunctorRecordedWithKey = Yap_MkFunctor(AtomRecordedWithKey,6);
|
||||
@ -531,5 +545,4 @@
|
||||
FunctorUMinus = Yap_MkFunctor(AtomMinus,1);
|
||||
FunctorUPlus = Yap_MkFunctor(AtomPlus,1);
|
||||
FunctorVBar = Yap_MkFunctor(AtomVBar,2);
|
||||
FunctorVar = Yap_MkFunctor(AtomVar,1);
|
||||
FunctorHiddenVar = Yap_MkFunctor(AtomHiddenVar,1);
|
||||
|
2
H/qly.h
@ -104,7 +104,7 @@ typedef enum {
|
||||
#define STATIC_PRED_FLAGS (SourcePredFlag|DynamicPredFlag|LogUpdatePredFlag|CompiledPredFlag|MultiFileFlag|TabledPredFlag|MegaClausePredFlag|CountPredFlag|ProfiledPredFlag|ThreadLocalPredFlag|AtomDBPredFlag|ModuleTransparentPredFlag|NumberDBPredFlag|MetaPredFlag|SyncPredFlag|BackCPredFlag)
|
||||
#define EXTRA_PRED_FLAGS (QuasiQuotationPredFlag|NoTracePredFlag|NoSpyPredFlag)
|
||||
|
||||
#define SYSTEM_PRED_FLAGS (BackCPredFlag|UserCPredFlag|CArgsPredFlag|AsmPredFlag|CPredFlag|BinaryPredFlag|StandardPredFlag)
|
||||
#define SYSTEM_PRED_FLAGS (BackCPredFlag|UserCPredFlag|CArgsPredFlag|AsmPredFlag|CPredFlag|BinaryPredFlag)
|
||||
|
||||
#define CHECK(F) { size_t r = (F); if (!r) return r; }
|
||||
#define RCHECK(F) if(!(F)) { QLYR_ERROR(MISMATCH); return; }
|
||||
|
17
H/ratoms.h
@ -20,11 +20,16 @@
|
||||
AtomArrayOverflow = AtomAdjust(AtomArrayOverflow);
|
||||
AtomArrayType = AtomAdjust(AtomArrayType);
|
||||
AtomArrow = AtomAdjust(AtomArrow);
|
||||
AtomAttributedModule = AtomAdjust(AtomAttributedModule);
|
||||
AtomDoubleArrow = AtomAdjust(AtomDoubleArrow);
|
||||
AtomAssert = AtomAdjust(AtomAssert);
|
||||
AtomEmptyBrackets = AtomAdjust(AtomEmptyBrackets);
|
||||
AtomEmptySquareBrackets = AtomAdjust(AtomEmptySquareBrackets);
|
||||
AtomEmptyCurlyBrackets = AtomAdjust(AtomEmptyCurlyBrackets);
|
||||
AtomAsserta = AtomAdjust(AtomAsserta);
|
||||
AtomAssertaStatic = AtomAdjust(AtomAssertaStatic);
|
||||
AtomAssertz = AtomAdjust(AtomAssertz);
|
||||
AtomAssertzStatic = AtomAdjust(AtomAssertzStatic);
|
||||
AtomAt = AtomAdjust(AtomAt);
|
||||
AtomAtom = AtomAdjust(AtomAtom);
|
||||
AtomAtomic = AtomAdjust(AtomAtomic);
|
||||
@ -66,6 +71,7 @@
|
||||
AtomCompact = AtomAdjust(AtomCompact);
|
||||
AtomCompound = AtomAdjust(AtomCompound);
|
||||
AtomConsistencyError = AtomAdjust(AtomConsistencyError);
|
||||
AtomConsult = AtomAdjust(AtomConsult);
|
||||
AtomConsultOnBoot = AtomAdjust(AtomConsultOnBoot);
|
||||
AtomContext = AtomAdjust(AtomContext);
|
||||
AtomCputime = AtomAdjust(AtomCputime);
|
||||
@ -102,6 +108,7 @@
|
||||
AtomDoStaticClause = AtomAdjust(AtomDoStaticClause);
|
||||
AtomDots = AtomAdjust(AtomDots);
|
||||
AtomDOUBLE = AtomAdjust(AtomDOUBLE);
|
||||
AtomDoubleSlash = AtomAdjust(AtomDoubleSlash);
|
||||
AtomE = AtomAdjust(AtomE);
|
||||
AtomEOFBeforeEOT = AtomAdjust(AtomEOFBeforeEOT);
|
||||
AtomEQ = AtomAdjust(AtomEQ);
|
||||
@ -133,6 +140,7 @@
|
||||
AtomFail = AtomAdjust(AtomFail);
|
||||
AtomFalse = AtomAdjust(AtomFalse);
|
||||
AtomFast = AtomAdjust(AtomFast);
|
||||
AtomFastFail = AtomAdjust(AtomFastFail);
|
||||
AtomFileErrors = AtomAdjust(AtomFileErrors);
|
||||
AtomFileerrors = AtomAdjust(AtomFileerrors);
|
||||
AtomFileType = AtomAdjust(AtomFileType);
|
||||
@ -288,6 +296,7 @@
|
||||
AtomReadOnly = AtomAdjust(AtomReadOnly);
|
||||
AtomReadWrite = AtomAdjust(AtomReadWrite);
|
||||
AtomReadutil = AtomAdjust(AtomReadutil);
|
||||
AtomReconsult = AtomAdjust(AtomReconsult);
|
||||
AtomRecordedP = AtomAdjust(AtomRecordedP);
|
||||
AtomRecordedWithKey = AtomAdjust(AtomRecordedWithKey);
|
||||
AtomRedefineWarnings = AtomAdjust(AtomRedefineWarnings);
|
||||
@ -390,14 +399,16 @@
|
||||
AtomUserErr = AtomAdjust(AtomUserErr);
|
||||
AtomUserIn = AtomAdjust(AtomUserIn);
|
||||
AtomUserOut = AtomAdjust(AtomUserOut);
|
||||
AtomDollarVar = AtomAdjust(AtomDollarVar);
|
||||
AtomVBar = AtomAdjust(AtomVBar);
|
||||
AtomVar = AtomAdjust(AtomVar);
|
||||
AtomVarBranches = AtomAdjust(AtomVarBranches);
|
||||
AtomVariableNames = AtomAdjust(AtomVariableNames);
|
||||
AtomHiddenVar = AtomAdjust(AtomHiddenVar);
|
||||
AtomVariable = AtomAdjust(AtomVariable);
|
||||
AtomVerbose = AtomAdjust(AtomVerbose);
|
||||
AtomVerboseFileSearch = AtomAdjust(AtomVerboseFileSearch);
|
||||
AtomVersionNumber = AtomAdjust(AtomVersionNumber);
|
||||
AtomVeryVerbose = AtomAdjust(AtomVeryVerbose);
|
||||
AtomWakeUpGoal = AtomAdjust(AtomWakeUpGoal);
|
||||
AtomWarning = AtomAdjust(AtomWarning);
|
||||
AtomWhen = AtomAdjust(AtomWhen);
|
||||
@ -443,6 +454,7 @@
|
||||
FunctorDoLogUpdClause0 = FuncAdjust(FunctorDoLogUpdClause0);
|
||||
FunctorDoLogUpdClauseErase = FuncAdjust(FunctorDoLogUpdClauseErase);
|
||||
FunctorDoStaticClause = FuncAdjust(FunctorDoStaticClause);
|
||||
FunctorDollarVar = FuncAdjust(FunctorDollarVar);
|
||||
FunctorDomainError = FuncAdjust(FunctorDomainError);
|
||||
FunctorDot = FuncAdjust(FunctorDot);
|
||||
FunctorDot10 = FuncAdjust(FunctorDot10);
|
||||
@ -456,6 +468,7 @@
|
||||
FunctorDot7 = FuncAdjust(FunctorDot7);
|
||||
FunctorDot8 = FuncAdjust(FunctorDot8);
|
||||
FunctorDot9 = FuncAdjust(FunctorDot9);
|
||||
FunctorDoubleSlash = FuncAdjust(FunctorDoubleSlash);
|
||||
FunctorEmptySquareBrackets = FuncAdjust(FunctorEmptySquareBrackets);
|
||||
FunctorEmptyCurlyBrackets = FuncAdjust(FunctorEmptyCurlyBrackets);
|
||||
FunctorEq = FuncAdjust(FunctorEq);
|
||||
@ -501,6 +514,7 @@
|
||||
FunctorPlus = FuncAdjust(FunctorPlus);
|
||||
FunctorPortray = FuncAdjust(FunctorPortray);
|
||||
FunctorPrintMessage = FuncAdjust(FunctorPrintMessage);
|
||||
FunctorProcedure = FuncAdjust(FunctorProcedure);
|
||||
FunctorPrologConstraint = FuncAdjust(FunctorPrologConstraint);
|
||||
FunctorQuery = FuncAdjust(FunctorQuery);
|
||||
FunctorRecordedWithKey = FuncAdjust(FunctorRecordedWithKey);
|
||||
@ -531,5 +545,4 @@
|
||||
FunctorUMinus = FuncAdjust(FunctorUMinus);
|
||||
FunctorUPlus = FuncAdjust(FunctorUPlus);
|
||||
FunctorVBar = FuncAdjust(FunctorVBar);
|
||||
FunctorVar = FuncAdjust(FunctorVar);
|
||||
FunctorHiddenVar = FuncAdjust(FunctorHiddenVar);
|
||||
|
47
H/tatoms.h
@ -56,6 +56,9 @@
|
||||
Atom AtomArrow_;
|
||||
#define AtomArrow Yap_heap_regs->AtomArrow_
|
||||
#define TermArrow MkAtomTerm( Yap_heap_regs->AtomArrow_ )
|
||||
Atom AtomAttributedModule_;
|
||||
#define AtomAttributedModule Yap_heap_regs->AtomAttributedModule_
|
||||
#define TermAttributedModule MkAtomTerm( Yap_heap_regs->AtomAttributedModule_ )
|
||||
Atom AtomDoubleArrow_;
|
||||
#define AtomDoubleArrow Yap_heap_regs->AtomDoubleArrow_
|
||||
#define TermDoubleArrow MkAtomTerm( Yap_heap_regs->AtomDoubleArrow_ )
|
||||
@ -71,6 +74,18 @@
|
||||
Atom AtomEmptyCurlyBrackets_;
|
||||
#define AtomEmptyCurlyBrackets 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_;
|
||||
#define AtomAt Yap_heap_regs->AtomAt_
|
||||
#define TermAt MkAtomTerm( Yap_heap_regs->AtomAt_ )
|
||||
@ -194,6 +209,9 @@
|
||||
Atom AtomConsistencyError_;
|
||||
#define AtomConsistencyError 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_;
|
||||
#define AtomConsultOnBoot Yap_heap_regs->AtomConsultOnBoot_
|
||||
#define TermConsultOnBoot MkAtomTerm( Yap_heap_regs->AtomConsultOnBoot_ )
|
||||
@ -302,6 +320,9 @@
|
||||
Atom AtomDOUBLE_;
|
||||
#define AtomDOUBLE Yap_heap_regs->AtomDOUBLE_
|
||||
#define TermDOUBLE MkAtomTerm( Yap_heap_regs->AtomDOUBLE_ )
|
||||
Atom AtomDoubleSlash_;
|
||||
#define AtomDoubleSlash Yap_heap_regs->AtomDoubleSlash_
|
||||
#define TermDoubleSlash MkAtomTerm( Yap_heap_regs->AtomDoubleSlash_ )
|
||||
Atom AtomE_;
|
||||
#define AtomE Yap_heap_regs->AtomE_
|
||||
#define TermE MkAtomTerm( Yap_heap_regs->AtomE_ )
|
||||
@ -395,6 +416,9 @@
|
||||
Atom AtomFast_;
|
||||
#define AtomFast 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_;
|
||||
#define AtomFileErrors Yap_heap_regs->AtomFileErrors_
|
||||
#define TermFileErrors MkAtomTerm( Yap_heap_regs->AtomFileErrors_ )
|
||||
@ -860,6 +884,9 @@
|
||||
Atom AtomReadutil_;
|
||||
#define AtomReadutil 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_;
|
||||
#define AtomRecordedP Yap_heap_regs->AtomRecordedP_
|
||||
#define TermRecordedP MkAtomTerm( Yap_heap_regs->AtomRecordedP_ )
|
||||
@ -1166,12 +1193,12 @@
|
||||
Atom AtomUserOut_;
|
||||
#define AtomUserOut Yap_heap_regs->AtomUserOut_
|
||||
#define TermUserOut MkAtomTerm( Yap_heap_regs->AtomUserOut_ )
|
||||
Atom AtomDollarVar_;
|
||||
#define AtomDollarVar Yap_heap_regs->AtomDollarVar_
|
||||
#define TermDollarVar MkAtomTerm( Yap_heap_regs->AtomDollarVar_ )
|
||||
Atom AtomVBar_;
|
||||
#define AtomVBar Yap_heap_regs->AtomVBar_
|
||||
#define TermVBar MkAtomTerm( Yap_heap_regs->AtomVBar_ )
|
||||
Atom AtomVar_;
|
||||
#define AtomVar Yap_heap_regs->AtomVar_
|
||||
#define TermVar MkAtomTerm( Yap_heap_regs->AtomVar_ )
|
||||
Atom AtomVarBranches_;
|
||||
#define AtomVarBranches Yap_heap_regs->AtomVarBranches_
|
||||
#define TermVarBranches MkAtomTerm( Yap_heap_regs->AtomVarBranches_ )
|
||||
@ -1184,12 +1211,18 @@
|
||||
Atom AtomVariable_;
|
||||
#define AtomVariable Yap_heap_regs->AtomVariable_
|
||||
#define TermVariable MkAtomTerm( Yap_heap_regs->AtomVariable_ )
|
||||
Atom AtomVerbose_;
|
||||
#define AtomVerbose Yap_heap_regs->AtomVerbose_
|
||||
#define TermVerbose MkAtomTerm( Yap_heap_regs->AtomVerbose_ )
|
||||
Atom AtomVerboseFileSearch_;
|
||||
#define AtomVerboseFileSearch Yap_heap_regs->AtomVerboseFileSearch_
|
||||
#define TermVerboseFileSearch MkAtomTerm( Yap_heap_regs->AtomVerboseFileSearch_ )
|
||||
Atom AtomVersionNumber_;
|
||||
#define AtomVersionNumber Yap_heap_regs->AtomVersionNumber_
|
||||
#define TermVersionNumber MkAtomTerm( Yap_heap_regs->AtomVersionNumber_ )
|
||||
Atom AtomVeryVerbose_;
|
||||
#define AtomVeryVerbose Yap_heap_regs->AtomVeryVerbose_
|
||||
#define TermVeryVerbose MkAtomTerm( Yap_heap_regs->AtomVeryVerbose_ )
|
||||
Atom AtomWakeUpGoal_;
|
||||
#define AtomWakeUpGoal Yap_heap_regs->AtomWakeUpGoal_
|
||||
#define TermWakeUpGoal MkAtomTerm( Yap_heap_regs->AtomWakeUpGoal_ )
|
||||
@ -1287,6 +1320,8 @@
|
||||
#define FunctorDoLogUpdClauseErase Yap_heap_regs->FunctorDoLogUpdClauseErase_
|
||||
Functor FunctorDoStaticClause_;
|
||||
#define FunctorDoStaticClause Yap_heap_regs->FunctorDoStaticClause_
|
||||
Functor FunctorDollarVar_;
|
||||
#define FunctorDollarVar Yap_heap_regs->FunctorDollarVar_
|
||||
Functor FunctorDomainError_;
|
||||
#define FunctorDomainError Yap_heap_regs->FunctorDomainError_
|
||||
Functor FunctorDot_;
|
||||
@ -1313,6 +1348,8 @@
|
||||
#define FunctorDot8 Yap_heap_regs->FunctorDot8_
|
||||
Functor FunctorDot9_;
|
||||
#define FunctorDot9 Yap_heap_regs->FunctorDot9_
|
||||
Functor FunctorDoubleSlash_;
|
||||
#define FunctorDoubleSlash Yap_heap_regs->FunctorDoubleSlash_
|
||||
Functor FunctorEmptySquareBrackets_;
|
||||
#define FunctorEmptySquareBrackets Yap_heap_regs->FunctorEmptySquareBrackets_
|
||||
Functor FunctorEmptyCurlyBrackets_;
|
||||
@ -1403,6 +1440,8 @@
|
||||
#define FunctorPortray Yap_heap_regs->FunctorPortray_
|
||||
Functor FunctorPrintMessage_;
|
||||
#define FunctorPrintMessage Yap_heap_regs->FunctorPrintMessage_
|
||||
Functor FunctorProcedure_;
|
||||
#define FunctorProcedure Yap_heap_regs->FunctorProcedure_
|
||||
Functor FunctorPrologConstraint_;
|
||||
#define FunctorPrologConstraint Yap_heap_regs->FunctorPrologConstraint_
|
||||
Functor FunctorQuery_;
|
||||
@ -1463,7 +1502,5 @@
|
||||
#define FunctorUPlus Yap_heap_regs->FunctorUPlus_
|
||||
Functor FunctorVBar_;
|
||||
#define FunctorVBar Yap_heap_regs->FunctorVBar_
|
||||
Functor FunctorVar_;
|
||||
#define FunctorVar Yap_heap_regs->FunctorVar_
|
||||
Functor FunctorHiddenVar_;
|
||||
#define FunctorHiddenVar Yap_heap_regs->FunctorHiddenVar_
|
||||
|
@ -35,7 +35,8 @@ if (WITH_TABLING)
|
||||
#this macro should realy be in config.h or other like it
|
||||
#and it is used across several files outside OPTYap
|
||||
set_property(DIRECTORY .. APPEND PROPERTY COMPILE_DEFINITIONS TABLING=1)
|
||||
include_directories (OPTYap)
|
||||
include_directories (OPTYap )
|
||||
set(YAP_SYSTEM_OPTIONS "tabling " ${YAP_SYSTEM_OPTIONS} PARENT_SCOPE)
|
||||
endif(WITH_TABLING)
|
||||
|
||||
option (WITH_YAPOR "Experimental Support for Or-parallelism" OFF)
|
||||
@ -43,33 +44,37 @@ option (WITH_YAPOR "Experimental Support for Or-parallelism" OFF)
|
||||
OPTION (WITH_YAPOR_COPY "Copy-based Or-parallelism" OFF)
|
||||
if (WITH_YAPOR_COPY)
|
||||
set_property(DIRECTORY .. APPEND PROPERTY COMPILE_DEFINITIONS YAPOR_COPY=1;USE_DL_MALLOC=1)
|
||||
set(WITH_YAPOR ON)
|
||||
endif (WITH_YAPOR_COPY)
|
||||
set(WITH_YAPOR ON)
|
||||
set(YAP_SYSTEM_OPTIONS "or_parallelism " ${YAP_SYSTEM_OPTIONS} PARENT_SCOPE)
|
||||
endif (WITH_YAPOR_COPY)
|
||||
|
||||
OPTION (WITH_YAPOR_THOR "Thread-based Or-parallelism" OFF)
|
||||
if (WITH_YAPOR_THOR)
|
||||
set_property(DIRECTORY .. APPEND PROPERTY COMPILE_DEFINITIONS YAPOR_THREADS=1;USE_SYSTEM_MALLOC=1)
|
||||
set(WITH_YAPOR ON)
|
||||
set(WITH_YAPOR ON)
|
||||
set(YAP_SYSTEM_OPTIONS "or_parallelism " ${YAP_SYSTEM_OPTIONS} PARENT_SCOPE)
|
||||
endif (WITH_YAPOR_THOR)
|
||||
|
||||
OPTION (WITH_YAPOR_ACOW "Process-based Copy-On-Write Or-parallelism" OFF)
|
||||
if (WITH_YAPOR_ACOW)
|
||||
set_property(DIRECTORY .. APPEND PROPERTY COMPILE_DEFINITIONS YAPOR_COW=1;USE_SYSTEM_MALLOC=1)
|
||||
set(WITH_YAPOR ON)
|
||||
set(WITH_YAPOR ON)
|
||||
set(YAP_SYSTEM_OPTIONS "or_parallelism " ${YAP_SYSTEM_OPTIONS} PARENT_SCOPE)
|
||||
endif (WITH_YAPOR_ACOW)
|
||||
|
||||
OPTION (WITH_YAPOR_SBA "Sparse Bind Array-based Or-parallelism" OFF)
|
||||
if (WITH_YAPOR_SBA)
|
||||
set_property(DIRECTORY .. APPEND PROPERTY COMPILE_DEFINITIONS YAPOR_SBA=1;USE_SYSTEM_MALLOC=1)
|
||||
set(WITH_YAPOR ON)
|
||||
set(WITH_YAPOR ON)
|
||||
set(YAP_SYSTEM_OPTIONS "or_parallelism, " ${YAP_SYSTEM_OPTIONS} PARENT_SCOPE)
|
||||
endif (WITH_YAPOR_SBA)
|
||||
|
||||
|
||||
|
||||
if (WITH_YAPOR)
|
||||
set_property(DIRECTORY .. APPEND PROPERTY COMPILE_DEFINITIONS YAPOR=1)
|
||||
set_property(DIRECTORY .. APPEND PROPERTY COMPILE_DEFINITIONS YAPOR=1)
|
||||
else()
|
||||
set_property(DIRECTORY .. APPEND PROPERTY COMPILE_DEFINITIONS USE_SYSTEM_MALLOC=1)
|
||||
set_property(DIRECTORY .. APPEND PROPERTY COMPILE_DEFINITIONS USE_SYSTEM_MALLOC=1)
|
||||
endif ()
|
||||
|
||||
|
||||
@ -77,7 +82,8 @@ endif ()
|
||||
set (POSITION_INDEPENDENT_CODE TRUE)
|
||||
|
||||
add_library (libOPTYap OBJECT
|
||||
${OPTYap_SOURCES} )
|
||||
${OPTYap_SOURCES} )
|
||||
|
||||
|
||||
set_target_properties(libOPTYap
|
||||
PROPERTIES
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <signal.h>
|
||||
#ifdef YAPOR
|
||||
#include "or.macros.h"
|
||||
#endif /* YAPOR */
|
||||
#endif /* YAPOR */
|
||||
#ifdef TABLING
|
||||
#include "tab.macros.h"
|
||||
#elif !defined(YAPOR_COW)
|
||||
@ -34,43 +34,42 @@
|
||||
#include "sys/wait.h"
|
||||
#endif /* YAPOR_COW */
|
||||
|
||||
|
||||
|
||||
/*********************
|
||||
** Macros **
|
||||
*********************/
|
||||
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#define STRUCTS_PER_PAGE(STR_TYPE) ((Yap_page_size - ADJUST_SIZE(sizeof(struct page_header))) / ADJUST_SIZE(sizeof(STR_TYPE)))
|
||||
#define STRUCTS_PER_PAGE(STR_TYPE) \
|
||||
((Yap_page_size - ADJUST_SIZE(sizeof(struct page_header))) / \
|
||||
ADJUST_SIZE(sizeof(STR_TYPE)))
|
||||
|
||||
#define INIT_GLOBAL_PAGE_ENTRY(PG,STR_TYPE) \
|
||||
INIT_LOCK(PgEnt_lock(PG)); \
|
||||
PgEnt_pages_in_use(PG) = 0; \
|
||||
PgEnt_strs_in_use(PG) = 0; \
|
||||
PgEnt_strs_per_page(PG) = STRUCTS_PER_PAGE(STR_TYPE); \
|
||||
PgEnt_first(PG) = NULL; \
|
||||
PgEnt_last(PG) = NULL;
|
||||
#define INIT_LOCAL_PAGE_ENTRY(PG,STR_TYPE) \
|
||||
PgEnt_pages_in_use(PG) = 0; \
|
||||
PgEnt_strs_in_use(PG) = 0; \
|
||||
PgEnt_strs_per_page(PG) = STRUCTS_PER_PAGE(STR_TYPE); \
|
||||
PgEnt_first(PG) = NULL; \
|
||||
PgEnt_last(PG) = NULL;
|
||||
#define INIT_GLOBAL_PAGE_ENTRY(PG, STR_TYPE) \
|
||||
INIT_LOCK(PgEnt_lock(PG)); \
|
||||
PgEnt_pages_in_use(PG) = 0; \
|
||||
PgEnt_strs_in_use(PG) = 0; \
|
||||
PgEnt_strs_per_page(PG) = STRUCTS_PER_PAGE(STR_TYPE); \
|
||||
PgEnt_first(PG) = NULL; \
|
||||
PgEnt_last(PG) = NULL;
|
||||
#define INIT_LOCAL_PAGE_ENTRY(PG, STR_TYPE) \
|
||||
PgEnt_pages_in_use(PG) = 0; \
|
||||
PgEnt_strs_in_use(PG) = 0; \
|
||||
PgEnt_strs_per_page(PG) = STRUCTS_PER_PAGE(STR_TYPE); \
|
||||
PgEnt_first(PG) = NULL; \
|
||||
PgEnt_last(PG) = NULL;
|
||||
#else
|
||||
#define INIT_GLOBAL_PAGE_ENTRY(PG,STR_TYPE) PgEnt_strs_in_use(PG) = 0
|
||||
#define INIT_LOCAL_PAGE_ENTRY(PG,STR_TYPE) PgEnt_strs_in_use(PG) = 0
|
||||
#define INIT_GLOBAL_PAGE_ENTRY(PG, STR_TYPE) PgEnt_strs_in_use(PG) = 0
|
||||
#define INIT_LOCAL_PAGE_ENTRY(PG, STR_TYPE) PgEnt_strs_in_use(PG) = 0
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
|
||||
|
||||
|
||||
/*******************************
|
||||
** Global functions **
|
||||
*******************************/
|
||||
|
||||
void Yap_init_global_optyap_data(int max_table_size, int n_workers, int sch_loop, int delay_load) {
|
||||
void Yap_init_global_optyap_data(int max_table_size, int n_workers,
|
||||
int sch_loop, int delay_load) {
|
||||
int i;
|
||||
|
||||
/* global data related to memory management */
|
||||
/* global data related to memory management */
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_alloc, void *);
|
||||
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_void, void *);
|
||||
@ -94,29 +93,34 @@ void Yap_init_global_optyap_data(int max_table_size, int n_workers, int sch_loop
|
||||
#endif /* TABLING */
|
||||
#ifdef YAPOR
|
||||
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_or_fr, struct or_frame);
|
||||
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_qg_sol_fr, struct query_goal_solution_frame);
|
||||
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_qg_ans_fr, struct query_goal_answer_frame);
|
||||
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_qg_sol_fr,
|
||||
struct query_goal_solution_frame);
|
||||
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_qg_ans_fr,
|
||||
struct query_goal_answer_frame);
|
||||
#ifdef TABLING
|
||||
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_susp_fr, struct suspension_frame);
|
||||
#endif
|
||||
#ifdef TABLING_INNER_CUTS
|
||||
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_tg_sol_fr, struct table_subgoal_solution_frame);
|
||||
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_tg_ans_fr, struct table_subgoal_answer_frame);
|
||||
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_tg_sol_fr,
|
||||
struct table_subgoal_solution_frame);
|
||||
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_tg_ans_fr,
|
||||
struct table_subgoal_answer_frame);
|
||||
#endif
|
||||
#endif /* YAPOR */
|
||||
|
||||
#ifdef YAPOR
|
||||
/* global static data */
|
||||
GLOBAL_number_workers= n_workers;
|
||||
GLOBAL_number_workers = n_workers;
|
||||
GLOBAL_worker_pid(0) = getpid();
|
||||
for (i = 1; i < GLOBAL_number_workers; i++) GLOBAL_worker_pid(i) = 0;
|
||||
for (i = 1; i < GLOBAL_number_workers; i++)
|
||||
GLOBAL_worker_pid(i) = 0;
|
||||
GLOBAL_scheduler_loop = sch_loop;
|
||||
GLOBAL_delayed_release_load = delay_load;
|
||||
|
||||
/* global data related to or-parallelism */
|
||||
ALLOC_OR_FRAME(GLOBAL_root_or_fr);
|
||||
BITMAP_clear(GLOBAL_bm_present_workers);
|
||||
for (i = 0; i < GLOBAL_number_workers; i++)
|
||||
for (i = 0; i < GLOBAL_number_workers; i++)
|
||||
BITMAP_insert(GLOBAL_bm_present_workers, i);
|
||||
BITMAP_copy(GLOBAL_bm_idle_workers, GLOBAL_bm_present_workers);
|
||||
BITMAP_clear(GLOBAL_bm_root_cp_workers);
|
||||
@ -146,7 +150,8 @@ void Yap_init_global_optyap_data(int max_table_size, int n_workers, int sch_loop
|
||||
GLOBAL_root_tab_ent = NULL;
|
||||
#ifdef LIMIT_TABLING
|
||||
if (max_table_size)
|
||||
GLOBAL_max_pages = ((max_table_size - 1) * 1024 * 1024 / SHMMAX + 1) * SHMMAX / Yap_page_size;
|
||||
GLOBAL_max_pages = ((max_table_size - 1) * 1024 * 1024 / SHMMAX + 1) *
|
||||
SHMMAX / Yap_page_size;
|
||||
else
|
||||
GLOBAL_max_pages = -1;
|
||||
GLOBAL_first_sg_fr = NULL;
|
||||
@ -154,7 +159,8 @@ void Yap_init_global_optyap_data(int max_table_size, int n_workers, int sch_loop
|
||||
GLOBAL_check_sg_fr = NULL;
|
||||
#endif /* LIMIT_TABLING */
|
||||
#ifdef YAPOR
|
||||
new_dependency_frame(GLOBAL_root_dep_fr, FALSE, NULL, NULL, NULL, NULL, FALSE, NULL);
|
||||
new_dependency_frame(GLOBAL_root_dep_fr, FALSE, NULL, NULL, NULL, NULL, FALSE,
|
||||
NULL);
|
||||
#endif /* YAPOR */
|
||||
for (i = 0; i < MAX_TABLE_VARS; i++) {
|
||||
CELL *pt = GLOBAL_table_var_enumerator_addr(i);
|
||||
@ -169,14 +175,13 @@ void Yap_init_global_optyap_data(int max_table_size, int n_workers, int sch_loop
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void Yap_init_local_optyap_data(int wid) {
|
||||
#if defined(YAPOR_THREADS) || defined(THREADS_CONSUMER_SHARING)
|
||||
CACHE_REGS
|
||||
#endif /* YAPOR_THREADS || THREADS_CONSUMER_SHARING */
|
||||
|
||||
#if defined(TABLING) && (defined(YAPOR) || defined(THREADS))
|
||||
/* local data related to memory management */
|
||||
/* local data related to memory management */
|
||||
#ifdef YAPOR
|
||||
REMOTE_next_free_ans_node(wid) = NULL;
|
||||
#elif THREADS
|
||||
@ -203,7 +208,7 @@ void Yap_init_local_optyap_data(int wid) {
|
||||
|
||||
#ifdef YAPOR
|
||||
/* local data related to or-parallelism */
|
||||
Set_REMOTE_top_cp(wid, (choiceptr) LOCAL_LocalBase);
|
||||
Set_REMOTE_top_cp(wid, (choiceptr)LOCAL_LocalBase);
|
||||
REMOTE_top_or_fr(wid) = GLOBAL_root_or_fr;
|
||||
REMOTE_load(wid) = 0;
|
||||
REMOTE_share_request(wid) = MAX_WORKERS;
|
||||
@ -217,11 +222,11 @@ void Yap_init_local_optyap_data(int wid) {
|
||||
|
||||
#ifdef TABLING
|
||||
/* local data related to tabling */
|
||||
REMOTE_top_sg_fr(wid) = NULL;
|
||||
REMOTE_top_dep_fr(wid) = NULL;
|
||||
REMOTE_top_sg_fr(wid) = NULL;
|
||||
REMOTE_top_dep_fr(wid) = NULL;
|
||||
#ifdef YAPOR
|
||||
REMOTE_top_dep_fr(wid) = GLOBAL_root_dep_fr;
|
||||
Set_REMOTE_top_cp_on_stack(wid, (choiceptr) LOCAL_LocalBase); /* ??? */
|
||||
REMOTE_top_dep_fr(wid) = GLOBAL_root_dep_fr;
|
||||
Set_REMOTE_top_cp_on_stack(wid, (choiceptr)LOCAL_LocalBase); /* ??? */
|
||||
REMOTE_top_susp_or_fr(wid) = GLOBAL_root_or_fr;
|
||||
#endif /* YAPOR */
|
||||
#ifdef THREADS_CONSUMER_SHARING
|
||||
@ -234,7 +239,6 @@ void Yap_init_local_optyap_data(int wid) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void Yap_init_root_frames(void) {
|
||||
CACHE_REGS
|
||||
|
||||
@ -244,7 +248,7 @@ void Yap_init_root_frames(void) {
|
||||
INIT_LOCK(OrFr_lock(or_fr));
|
||||
OrFr_alternative(or_fr) = NULL;
|
||||
BITMAP_copy(OrFr_members(or_fr), GLOBAL_bm_present_workers);
|
||||
SetOrFr_node(or_fr, (choiceptr) LOCAL_LocalBase);
|
||||
SetOrFr_node(or_fr, (choiceptr)LOCAL_LocalBase);
|
||||
OrFr_nearest_livenode(or_fr) = NULL;
|
||||
OrFr_depth(or_fr) = 0;
|
||||
Set_OrFr_pend_prune_cp(or_fr, NULL);
|
||||
@ -265,23 +269,26 @@ void Yap_init_root_frames(void) {
|
||||
#ifdef TABLING
|
||||
/* root global trie node */
|
||||
new_global_trie_node(GLOBAL_root_gt, 0, NULL, NULL, NULL);
|
||||
/* root dependency frame */
|
||||
/* root dependency frame */
|
||||
#ifdef YAPOR
|
||||
DepFr_cons_cp(GLOBAL_root_dep_fr) = B; /* with YAPOR, at that point, LOCAL_top_dep_fr shouldn't be the same as GLOBAL_root_dep_fr ? */
|
||||
DepFr_cons_cp(GLOBAL_root_dep_fr) = B; /* with YAPOR, at that point,
|
||||
LOCAL_top_dep_fr shouldn't be the
|
||||
same as GLOBAL_root_dep_fr ? */
|
||||
#else
|
||||
new_dependency_frame(LOCAL_top_dep_fr, FALSE, NULL, NULL, B, NULL, FALSE, NULL);
|
||||
new_dependency_frame(LOCAL_top_dep_fr, FALSE, NULL, NULL, B, NULL, FALSE,
|
||||
NULL);
|
||||
#endif /* YAPOR */
|
||||
#endif /* TABLING */
|
||||
}
|
||||
|
||||
|
||||
void itos(int i, char *s) {
|
||||
int n,r,j;
|
||||
int n, r, j;
|
||||
n = 10;
|
||||
while (n <= i) n *= 10;
|
||||
while (n <= i)
|
||||
n *= 10;
|
||||
j = 0;
|
||||
while (n > 1) {
|
||||
n = n / 10;
|
||||
n = n / 10;
|
||||
r = i / n;
|
||||
i = i - r * n;
|
||||
s[j++] = r + '0';
|
||||
|
1415
OPTYap/tab.tries.c
@ -13,13 +13,14 @@ ENDIF (MYSQL_INCLUDE_DIR)
|
||||
FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
|
||||
/usr/local/include/mysql
|
||||
/usr/include/mysql
|
||||
/usr/include/mariadb
|
||||
)
|
||||
|
||||
SET(MYSQL_NAMES mysqlclient mysqlclient_r)
|
||||
SET(MYSQL_NAMES mysqlclient mysqlclient_r mariadb )
|
||||
FIND_LIBRARY(MYSQL_LIBRARY
|
||||
NAMES ${MYSQL_NAMES}
|
||||
PATHS /usr/lib /usr/local/lib
|
||||
PATH_SUFFIXES mysql
|
||||
PATH_SUFFIXES mysql mariadb
|
||||
)
|
||||
|
||||
IF (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY)
|
||||
|
192
cmake/FindPostgreSQL.cmake
Normal file
@ -0,0 +1,192 @@
|
||||
#.rst:
|
||||
# FindPostgreSQL
|
||||
# --------------
|
||||
#
|
||||
# Find the PostgreSQL installation.
|
||||
#
|
||||
# This module defines
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# PostgreSQL_LIBRARIES - the PostgreSQL libraries needed for linking
|
||||
# PostgreSQL_INCLUDE_DIRS - the directories of the PostgreSQL headers
|
||||
# PostgreSQL_LIBRARY_DIRS - the link directories for PostgreSQL libraries
|
||||
# PostgreSQL_VERSION_STRING - the version of PostgreSQL found (since CMake 2.8.8)
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2004-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# History:
|
||||
# This module is derived from the module originally found in the VTK source tree.
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Note:
|
||||
# PostgreSQL_ADDITIONAL_VERSIONS is a variable that can be used to set the
|
||||
# version mumber of the implementation of PostgreSQL.
|
||||
# In Windows the default installation of PostgreSQL uses that as part of the path.
|
||||
# E.g C:\Program Files\PostgreSQL\8.4.
|
||||
# Currently, the following version numbers are known to this module:
|
||||
# "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0"
|
||||
#
|
||||
# To use this variable just do something like this:
|
||||
# set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4")
|
||||
# before calling find_package(PostgreSQL) in your CMakeLists.txt file.
|
||||
# This will mean that the versions you set here will be found first in the order
|
||||
# specified before the default ones are searched.
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# You may need to manually set:
|
||||
# PostgreSQL_INCLUDE_DIR - the path to where the PostgreSQL include files are.
|
||||
# PostgreSQL_LIBRARY_DIR - The path to where the PostgreSQL library files are.
|
||||
# If FindPostgreSQL.cmake cannot find the include files or the library files.
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# The following variables are set if PostgreSQL is found:
|
||||
# PostgreSQL_FOUND - Set to true when PostgreSQL is found.
|
||||
# PostgreSQL_INCLUDE_DIRS - Include directories for PostgreSQL
|
||||
# PostgreSQL_LIBRARY_DIRS - Link directories for PostgreSQL libraries
|
||||
# PostgreSQL_LIBRARIES - The PostgreSQL libraries.
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# If you have installed PostgreSQL in a non-standard location.
|
||||
# (Please note that in the following comments, it is assumed that <Your Path>
|
||||
# points to the root directory of the include directory of PostgreSQL.)
|
||||
# Then you have three options.
|
||||
# 1) After CMake runs, set PostgreSQL_INCLUDE_DIR to <Your Path>/include and
|
||||
# PostgreSQL_LIBRARY_DIR to wherever the library pq (or libpq in windows) is
|
||||
# 2) Use CMAKE_INCLUDE_PATH to set a path to <Your Path>/PostgreSQL<-version>. This will allow find_path()
|
||||
# to locate PostgreSQL_INCLUDE_DIR by utilizing the PATH_SUFFIXES option. e.g. In your CMakeLists.txt file
|
||||
# set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "<Your Path>/include")
|
||||
# 3) Set an environment variable called ${PostgreSQL_ROOT} that points to the root of where you have
|
||||
# installed PostgreSQL, e.g. <Your Path>.
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
set(PostgreSQL_INCLUDE_PATH_DESCRIPTION "top-level directory containing the PostgreSQL include directories. E.g /usr/local/include/PostgreSQL/8.4 or C:/Program Files/PostgreSQL/8.4/include")
|
||||
set(PostgreSQL_INCLUDE_DIR_MESSAGE "Set the PostgreSQL_INCLUDE_DIR cmake cache entry to the ${PostgreSQL_INCLUDE_PATH_DESCRIPTION}")
|
||||
set(PostgreSQL_LIBRARY_PATH_DESCRIPTION "top-level directory containing the PostgreSQL libraries.")
|
||||
set(PostgreSQL_LIBRARY_DIR_MESSAGE "Set the PostgreSQL_LIBRARY_DIR cmake cache entry to the ${PostgreSQL_LIBRARY_PATH_DESCRIPTION}")
|
||||
set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to where PostgreSQL is found on the machine E.g C:/Program Files/PostgreSQL/8.4")
|
||||
|
||||
|
||||
set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS}
|
||||
"9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
|
||||
|
||||
# Define additional search paths for root directories.
|
||||
set( PostgreSQL_ROOT_DIRECTORIES
|
||||
ENV PostgreSQL_ROOT
|
||||
${PostgreSQL_ROOT}
|
||||
)
|
||||
foreach(suffix ${PostgreSQL_KNOWN_VERSIONS})
|
||||
if(WIN32)
|
||||
list(APPEND PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES
|
||||
"PostgreSQL/${suffix}/lib")
|
||||
list(APPEND PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES
|
||||
"PostgreSQL/${suffix}/include")
|
||||
list(APPEND PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES
|
||||
"PostgreSQL/${suffix}/include/server")
|
||||
endif()
|
||||
if(UNIX)
|
||||
list(APPEND PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES
|
||||
"postgresql/${suffix}/server")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
#
|
||||
# Look for an installation.
|
||||
#
|
||||
find_path(PostgreSQL_INCLUDE_DIR
|
||||
NAMES libpq-fe.h
|
||||
PATHS
|
||||
# Look in other places.
|
||||
${PostgreSQL_ROOT_DIRECTORIES}
|
||||
PATH_SUFFIXES
|
||||
pgsql
|
||||
postgresql
|
||||
include
|
||||
${PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES}
|
||||
# Help the user find it if we cannot.
|
||||
DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}"
|
||||
)
|
||||
|
||||
find_path(PostgreSQL_TYPE_INCLUDE_DIR
|
||||
NAMES catalog/pg_type.h
|
||||
PATHS
|
||||
# Look in other places.
|
||||
${PostgreSQL_ROOT_DIRECTORIES}
|
||||
PATH_SUFFIXES
|
||||
postgresql
|
||||
pgsql/server
|
||||
postgresql/server
|
||||
include/server
|
||||
${PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES}
|
||||
# Help the user find it if we cannot.
|
||||
DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}"
|
||||
)
|
||||
|
||||
# The PostgreSQL library.
|
||||
set (PostgreSQL_LIBRARY_TO_FIND pq)
|
||||
# Setting some more prefixes for the library
|
||||
set (PostgreSQL_LIB_PREFIX "")
|
||||
if ( WIN32 )
|
||||
set (PostgreSQL_LIB_PREFIX ${PostgreSQL_LIB_PREFIX} "lib")
|
||||
set (PostgreSQL_LIBRARY_TO_FIND ${PostgreSQL_LIB_PREFIX}${PostgreSQL_LIBRARY_TO_FIND})
|
||||
endif()
|
||||
|
||||
find_library(PostgreSQL_LIBRARY
|
||||
NAMES ${PostgreSQL_LIBRARY_TO_FIND}
|
||||
PATHS
|
||||
${PostgreSQL_ROOT_DIRECTORIES}
|
||||
PATH_SUFFIXES
|
||||
lib
|
||||
${PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES}
|
||||
# Help the user find it if we cannot.
|
||||
DOC "The ${PostgreSQL_LIBRARY_DIR_MESSAGE}"
|
||||
)
|
||||
get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH)
|
||||
|
||||
if (PostgreSQL_INCLUDE_DIR)
|
||||
# Some platforms include multiple pg_config.hs for multi-lib configurations
|
||||
# This is a temporary workaround. A better solution would be to compile
|
||||
# a dummy c file and extract the value of the symbol.
|
||||
file(GLOB _PG_CONFIG_HEADERS "${PostgreSQL_INCLUDE_DIR}/pg_config*.h")
|
||||
foreach(_PG_CONFIG_HEADER ${_PG_CONFIG_HEADERS})
|
||||
if(EXISTS "${_PG_CONFIG_HEADER}")
|
||||
file(STRINGS "${_PG_CONFIG_HEADER}" pgsql_version_str
|
||||
REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"")
|
||||
if(pgsql_version_str)
|
||||
string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*"
|
||||
"\\1" PostgreSQL_VERSION_STRING "${pgsql_version_str}")
|
||||
break()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
unset(pgsql_version_str)
|
||||
endif()
|
||||
|
||||
# Did we find anything?
|
||||
#nclude(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
||||
find_package_handle_standard_args(PostgreSQL
|
||||
REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR
|
||||
VERSION_VAR PostgreSQL_VERSION_STRING)
|
||||
set(PostgreSQL_FOUND ${POSTGRESQL_FOUND})
|
||||
|
||||
# Now try to get the include and library path.
|
||||
if(PostgreSQL_FOUND)
|
||||
set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR} ${PostgreSQL_TYPE_INCLUDE_DIR} )
|
||||
set(PostgreSQL_LIBRARY_DIRS ${PostgreSQL_LIBRARY_DIR} )
|
||||
set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY_TO_FIND})
|
||||
endif()
|
||||
|
||||
mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR PostgreSQL_LIBRARY )
|
@ -128,26 +128,26 @@ set(C_INTERFACE_SOURCES
|
||||
H/compile.h
|
||||
H/corout.h
|
||||
H/dlmalloc.h
|
||||
H/dglobals.h
|
||||
H/dlocals.h
|
||||
H/dhstruct.h
|
||||
H/heap/dglobals.h
|
||||
H/heap/dlocals.h
|
||||
H/heap/dhstruct.h
|
||||
H/eval.h
|
||||
H/heapgc.h
|
||||
H/hglobals.h
|
||||
H/hlocals.h
|
||||
H/hstruct.h
|
||||
H/iglobals.h
|
||||
H/ihstruct.h
|
||||
H/ilocals.h
|
||||
H/heap/hglobals.h
|
||||
H/heap/hlocals.h
|
||||
H/heap/hstruct.h
|
||||
H/heap/iglobals.h
|
||||
H/heap/ihstruct.h
|
||||
H/heap/ilocals.h
|
||||
H/index.h
|
||||
H/inline-only.h
|
||||
H/iswiatoms.h
|
||||
H/qly.h
|
||||
H/rclause.h
|
||||
H/rglobals.h
|
||||
H/rlocals.h
|
||||
H/heap/rglobals.h
|
||||
H/heap/rlocals.h
|
||||
H/rheap.h
|
||||
H/rhstruct.h
|
||||
H/heap/rhstruct.h
|
||||
H/threads.h
|
||||
H/tracer.h
|
||||
H/trim_trail.h
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define CONFIG_H
|
||||
|
||||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
#define SYSTEM_OPTIONS "${YAP_SYSTEM_OPTIONS}"
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
#ifndef AC_APPLE_UNIVERSAL_BUILD
|
||||
|
@ -1,23 +1,11 @@
|
||||
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
|
||||
theme.css
|
||||
yap.css
|
||||
bootstrap.min.css
|
||||
bootstrap.min.js
|
||||
font-awesome.min.css
|
||||
jquery-2.0.3.min.js
|
||||
application.js
|
||||
pygments.css
|
||||
misc/icons/yap_64x64x32.png
|
||||
misc/icons/yap_256x256x32.png
|
||||
misc/icons/yap_128x128x32.png
|
||||
misc/icons/yap_48x48x32.png
|
||||
icons/yap_64x64x32.png
|
||||
icons/yap_256x256x32.png
|
||||
icons/yap_128x128x32.png
|
||||
icons/yap_48x48x32.png
|
||||
)
|
||||
|
||||
SET (DOCS
|
||||
@ -42,6 +30,7 @@ yap.md
|
||||
find_package(Doxygen)
|
||||
option(WITH_DOCUMENTATION "Create and install the HTML based API documentation (requires Doxygen)" ${DOXYGEN_FOUND})
|
||||
|
||||
|
||||
if(WITH_DOCUMENTATION)
|
||||
if(NOT DOXYGEN_FOUND)
|
||||
message(FATAL_ERROR "Doxygen is needed to build the documentation.")
|
||||
|
2427
docs/Doxyfile
Normal file
@ -8,9 +8,9 @@
|
||||
#
|
||||
# All text after a single hash (#) is considered a comment and will be ignored.
|
||||
# The format is:
|
||||
# TAG = value [value, ...]
|
||||
# TAG = value [value, file.]
|
||||
# For lists, items can also be appended using:
|
||||
# TAG += value [value, ...]
|
||||
# TAG += value [value, file.]
|
||||
# Values that contain spaces should be placed between quotes (\" \").
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@ -51,7 +51,7 @@ PROJECT_BRIEF = "The YAP Prolog Compiler Manual"
|
||||
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
|
||||
# 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
|
||||
# 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
|
||||
# the documentation of the scope in which they are defined (i.e. file,
|
||||
# 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).
|
||||
# The default value is: NO.
|
||||
|
||||
@ -407,7 +407,7 @@ TYPEDEF_HIDES_STRUCT = NO
|
||||
# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
|
||||
# doxygen will become slower. If the cache is too large, memory is wasted. The
|
||||
# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
|
||||
# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
|
||||
# is 0file9, the default is 0, corresponding to a cache size of 2^16=65536
|
||||
# symbols. At the end of a run doxygen will report the cache usage and suggest
|
||||
# the optimal cache size from a speed point of view.
|
||||
# Minimum value: 0, maximum value: 9, default value: 0.
|
||||
@ -636,8 +636,8 @@ GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
|
||||
# The ENABLED_SECTIONS tag can be used to enable conditional documentation
|
||||
# sections, marked by \if <section_label> ... \endif and \cond <section_label>
|
||||
# ... \endcond blocks.
|
||||
# sections, marked by \if <section_label> file. \endif and \cond <section_label>
|
||||
# file. \endcond blocks.
|
||||
|
||||
ENABLED_SECTIONS =
|
||||
|
||||
@ -728,7 +728,7 @@ WARNINGS = YES
|
||||
|
||||
# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
|
||||
# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
|
||||
# will automatically be disabled.
|
||||
# will automatically be disabled.
|
||||
# The default value is: YES.
|
||||
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
@ -776,15 +776,15 @@ WARN_LOGFILE =
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = @PROJECT_SOURCE_DIR@/pl \
|
||||
@PROJECT_SOURCE_DIR@/swi \
|
||||
@PROJECT_SOURCE_DIR@/CXX \
|
||||
@PROJECT_SOURCE_DIR@/OPTYap \
|
||||
@PROJECT_SOURCE_DIR@/C \
|
||||
@PROJECT_SOURCE_DIR@/H \
|
||||
@PROJECT_SOURCE_DIR@/include \
|
||||
@PROJECT_SOURCE_DIR@/os \
|
||||
@PROJECT_SOURCE_DIR@/packages \
|
||||
@PROJECT_SOURCE_DIR@/library \
|
||||
@PROJECT_SOURCE_DIR@/packages \
|
||||
@PROJECT_SOURCE_DIR@/swi/library \
|
||||
@PROJECT_SOURCE_DIR@/docs/yap.md \
|
||||
@PROJECT_SOURCE_DIR@/docs/chr.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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# (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
|
||||
# \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
|
||||
# invoke to filter for each input file. Doxygen will invoke the filter program
|
||||
@ -1094,6 +1094,7 @@ HTML_FILE_EXTENSION = .html
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_HEADER =
|
||||
|
||||
#@CMAKE_SOURCE_DIR@/docs/web/bootstrap/header.html
|
||||
|
||||
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
|
||||
@ -1105,7 +1106,8 @@ HTML_HEADER =
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
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
|
||||
# sheet that is used by each HTML page. It can be used to fine-tune the look of
|
||||
@ -1118,6 +1120,7 @@ HTML_FOOTER =
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_STYLESHEET =
|
||||
|
||||
#@CMAKE_SOURCE_DIR@/docs/web/bootstrap/customdoxygen.css
|
||||
|
||||
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
|
||||
@ -1131,7 +1134,9 @@ HTML_STYLESHEET =
|
||||
# list). For an example see the documentation.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_EXTRA_STYLESHEET = @CMAKE_SOURCE_DIR@/docs/solarized-light.css
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
|
||||
# @CMAKE_SOURCE_DIR@/docs/solarized-light.css
|
||||
|
||||
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
|
||||
# other source files which should be copied to the HTML output directory. Note
|
||||
@ -1142,6 +1147,7 @@ HTML_EXTRA_STYLESHEET = @CMAKE_SOURCE_DIR@/docs/solarized-light.css
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_EXTRA_FILES =
|
||||
|
||||
#@CMAKE_SOURCE_DIR@/docs/web/bootstrap/doxy-boot.js
|
||||
|
||||
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
|
||||
@ -1489,7 +1495,7 @@ MATHJAX_FORMAT = HTML-CSS
|
||||
# output directory using the MATHJAX_RELPATH option. The destination directory
|
||||
# should contain the MathJax.js script. For instance, if the mathjax directory
|
||||
# is located at the same level as the HTML output directory, then
|
||||
# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
|
||||
# MATHJAX_RELPATH should be file/mathjax. The default value points to the MathJax
|
||||
# Content Delivery Network so you can quickly see the result without installing
|
||||
# MathJax. However, it is strongly recommended to install a local copy of
|
||||
# MathJax from http://www.mathjax.org before deployment.
|
||||
@ -1886,7 +1892,7 @@ MAN_LINKS = NO
|
||||
# captures the structure of the code including all documentation.
|
||||
# The default value is: NO.
|
||||
|
||||
GENERATE_XML = NO
|
||||
GENERATE_XML = YES
|
||||
|
||||
# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
|
||||
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
|
||||
@ -2069,7 +2075,7 @@ SKIP_FUNCTION_MACROS = YES
|
||||
# a tag file without this location is as follows:
|
||||
# TAGFILES = file1 file2 ...
|
||||
# Adding location for the tag files is done as follows:
|
||||
# TAGFILES = file1=loc1 "file2 = loc2" ...
|
||||
# TAGFILES = file1=loc1 "file2 = loc2" file.
|
||||
# where loc1 and loc2 can be relative or absolute paths or URLs. See the
|
||||
# section "Linking to external documentation" for more information about the use
|
||||
# of tag files.
|
||||
|
4
docs/application.js
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
$(function () {
|
||||
$('a').tooltip();
|
||||
});
|
7
docs/bootstrap.min.css
vendored
Normal file
7
docs/bootstrap.min.js
vendored
Normal file
0
docs/builtins.md
Normal file
32
docs/chr.md
@ -2,6 +2,8 @@
|
||||
CHR: Constraint Handling Rules {#chr}
|
||||
==============================
|
||||
|
||||
@ingroup packages
|
||||
|
||||
This chapter is written by Tom Schrijvers, K.U. Leuven for the hProlog
|
||||
system. Adjusted by Jan Wielemaker to fit the SWI-Prolog documentation
|
||||
infrastructure and remove hProlog specific references.
|
||||
@ -59,7 +61,7 @@ actual_rule --> simpagation_rule.
|
||||
|
||||
simplification_rule --> constraints, [atom(`<=>`)], guard, body.
|
||||
propagation_rule --> constraints, [atom(`==>`)], guard, body.
|
||||
simpagation_rule --> constraints, [atom(`\`)], constraints, [atom(`<=>`)],
|
||||
simpagation_rule --> constraints, [atom(`\`)], constraints, [atom(`<=>`)],
|
||||
guard, body.
|
||||
|
||||
constraints --> constraint, constraint_id.
|
||||
@ -98,7 +100,7 @@ informally. They do not differ essentially from other CHR systems.
|
||||
|
||||
When a constraint is called, it is considered an active constraint and
|
||||
the system will try to apply the rules to it. Rules are tried and executed
|
||||
sequentially in the order they are written.
|
||||
sequentially in the order they are written.
|
||||
|
||||
A rule is conceptually tried for an active constraint in the following
|
||||
way. The active constraint is matched with a constraint in the head of
|
||||
@ -140,7 +142,7 @@ its head.
|
||||
The simpagation rule removes the constraints in its head after the
|
||||
`\` and then calls its body. It is an optimization of
|
||||
simplification rules of the form: \[constraints_1, constraints_2 <=>
|
||||
constraints_1, body \] Namely, in the simpagation form:
|
||||
constraints_1, body \] Namely, in the simpagation form:
|
||||
|
||||
~~~~~
|
||||
constraints1 \ constraints2 <=> body
|
||||
@ -186,7 +188,7 @@ checks.
|
||||
+ optimize
|
||||
This is an experimental option controlling the degree of optimization.
|
||||
Possible values are `full`, to enable all available
|
||||
optimizations, and `off` (default), to disable all optimizations.
|
||||
optimizations, and `off` (default), to disable all optimizations.
|
||||
The default is derived from the SWI-Prolog flag `optimise`, where
|
||||
`true` is mapped to `full`. Therefore the commandline
|
||||
option `-O` provides full CHR optimization.
|
||||
@ -209,7 +211,7 @@ The latter is the default. The meaning is the following:
|
||||
+ -
|
||||
The corresponding argument of every occurrence
|
||||
of the constraint is always unbound.
|
||||
+ +
|
||||
+ +
|
||||
The corresponding argument of every occurrence
|
||||
of the constraint is always ground.
|
||||
+ ?
|
||||
@ -217,7 +219,7 @@ The corresponding argument of every occurrence
|
||||
of the constraint can have any instantiation, which may change
|
||||
over time. This is the default value.
|
||||
|
||||
The declaration is used by the compiler for various optimizations.
|
||||
The declaration is used by the compiler for various optimizations.
|
||||
Note that it is up to the user the ensure that the mode declaration
|
||||
is correct with respect to the use of the constraint.
|
||||
This option may occur once for each constraint.
|
||||
@ -251,7 +253,7 @@ type declarations. The value is a term of the form
|
||||
`type(` _name_`,` _list_`)`, where
|
||||
_name_ is a term and _list_ is a list of alternatives.
|
||||
Variables can be used to define generic types. Recursive definitions
|
||||
are allowed. Examples are
|
||||
are allowed. Examples are
|
||||
|
||||
~~~~~
|
||||
type(bool,[true,false]).
|
||||
@ -266,8 +268,8 @@ The mode, type_declaration and type_definition options are provided
|
||||
for backward compatibility. The new syntax is described below.
|
||||
|
||||
|
||||
|
||||
### CHR in Prolog Programs
|
||||
|
||||
### CHR in Prolog Programs
|
||||
|
||||
|
||||
The CHR constraints defined in a particulary chr file are
|
||||
@ -295,7 +297,7 @@ The new style is as follows:
|
||||
:- chr_type list(T) ---> [] ; [T|list(T)].
|
||||
:- constraints foo(+list(int),?float), bar.
|
||||
~~~~~
|
||||
|
||||
|
||||
|
||||
|
||||
#### Compilation
|
||||
@ -327,7 +329,7 @@ pl files and the operator definitions required by CHR do not
|
||||
leak into modules where they might cause conflicts.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#### CHR Debugging
|
||||
@ -433,8 +435,8 @@ notrace/0.
|
||||
|
||||
Here are two example constraint solvers written in CHR.
|
||||
|
||||
+
|
||||
The program below defines a solver with one constraint,
|
||||
+
|
||||
The program below defines a solver with one constraint,
|
||||
`leq/2`, which is a less-than-or-equal constraint.
|
||||
|
||||
~~~~~
|
||||
@ -453,7 +455,7 @@ cycle(X,Y,Z):-
|
||||
leq(Z,X).
|
||||
~~~~~
|
||||
|
||||
+
|
||||
+
|
||||
The program below implements a simple finite domain
|
||||
constraint solver.
|
||||
|
||||
@ -461,7 +463,7 @@ constraint solver.
|
||||
:- module(dom,[dom/2]).
|
||||
:- use_module(library(chr)).
|
||||
|
||||
:- constraints dom/2.
|
||||
:- constraints dom/2.
|
||||
|
||||
dom(X,[]) <=> fail.
|
||||
dom(X,[Y]) <=> X = Y.
|
||||
|
@ -1,6 +1,7 @@
|
||||
Constraint Logic Programming over Rationals and Reals {#clpqr}
|
||||
=====================================================
|
||||
|
||||
@ingroup paackages
|
||||
|
||||
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
|
||||
@ -27,7 +28,7 @@ explicitely before using it:
|
||||
|
||||
The following predicates are provided to work with constraints:
|
||||
|
||||
|
||||
|
||||
### Syntax of the predicate arguments {#CLPQR_Syntax}
|
||||
|
||||
|
||||
@ -103,19 +104,19 @@ They are given in the following table.
|
||||
A = B * C when B or C is ground or // A = 5 * C or A = B * 4 \\
|
||||
A and (B or C) are ground // 20 = 5 * C or 20 = B * 4 \\
|
||||
|
||||
A = B / C when C is ground or // A = B / 3
|
||||
A and B are ground // 4 = 12 / C
|
||||
A = B / C when C is ground or // A = B / 3
|
||||
A and B are ground // 4 = 12 / C
|
||||
|
||||
X = min(Y,Z) when Y and Z are ground or // X = min(4,3)
|
||||
X = max(Y,Z) Y and Z are ground // X = max(4,3)
|
||||
X = abs(Y) Y is ground // X = abs(-7)
|
||||
X = min(Y,Z) when Y and Z are ground or // X = min(4,3)
|
||||
X = max(Y,Z) Y and Z are ground // X = max(4,3)
|
||||
X = abs(Y) Y is ground // X = abs(-7)
|
||||
|
||||
X = pow(Y,Z) when X and Y are ground or // 8 = 2 ^ Z
|
||||
X = exp(Y,Z) X and Z are ground // 8 = Y ^ 3
|
||||
X = Y ^ Z Y and Z are ground // X = 2 ^ 3
|
||||
X = pow(Y,Z) when X and Y are ground or // 8 = 2 ^ Z
|
||||
X = exp(Y,Z) X and Z are ground // 8 = Y ^ 3
|
||||
X = Y ^ Z Y and Z are ground // X = 2 ^ 3
|
||||
|
||||
X = sin(Y) when X is ground or // 1 = sin(Y)
|
||||
X = cos(Y) Y is ground // X = sin(1.5707)
|
||||
X = sin(Y) when X is ground or // 1 = sin(Y)
|
||||
X = cos(Y) Y is ground // X = sin(1.5707)
|
||||
X = tan(Y)
|
||||
~~~~~
|
||||
|
||||
|
0
docs/download.md
Normal file
121
docs/doxy-boot.js
Normal 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()==" ") {
|
||||
$(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
0
docs/fli.md
Normal file
4
docs/font-awesome.min.css
vendored
Normal file
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 274 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 755 B After Width: | Height: | Size: 755 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |