Merge branch 'master' of git://yap.git.sourceforge.net/gitroot/yap/yap-6.3

This commit is contained in:
Joao 2011-09-15 15:44:26 +01:00
commit 1a6aff8aa1
338 changed files with 13523 additions and 2160 deletions

3
.gitignore vendored
View File

@ -9,4 +9,5 @@
*.o
*.so
*.dylib
docs/yap.info*
docs/yap.info*
.build

12
C/absmi.c Executable file → Normal file
View File

@ -1679,18 +1679,18 @@ Yap_absmi(int inp)
*****************************************************************/
/* ensure_space */
BOp(ensure_space, Osbpi);
BOp(ensure_space, Osbpa);
{
Int sz = PREG->u.Osbpi.i;
UInt arity = PREG->u.Osbpi.p->ArityOfPE;
Int sz = PREG->u.Osbpa.i;
UInt arity = PREG->u.Osbpa.p->ArityOfPE;
if (Unsigned(H) + sz > Unsigned(YREG)-CreepFlag) {
YENV[E_CP] = (CELL) CPREG;
YENV[E_E] = (CELL) ENV;
#ifdef DEPTH_LIMIT
YENV[E_DEPTH] = DEPTH;
#endif /* DEPTH_LIMIT */
SET_ASP(YREG, PREG->u.Osbpi.s);
PREG = NEXTOP(PREG,Osbpi);
SET_ASP(YREG, PREG->u.Osbpa.s);
PREG = NEXTOP(PREG,Osbpa);
saveregs();
if (!Yap_gcl(sz, arity, YENV, PREG)) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
@ -1700,7 +1700,7 @@ Yap_absmi(int inp)
setregs();
}
} else {
PREG = NEXTOP(PREG,Osbpi);
PREG = NEXTOP(PREG,Osbpa);
}
}
JMPNext();

90
C/adtdefs.c Executable file → Normal file
View File

@ -69,9 +69,9 @@ InlinedUnlockedMkFunctor(AtomEntry *ae, unsigned int arity)
p->NameOfFE = AbsAtom(ae);
p->ArityOfFE = arity;
p->PropsOfFE = NIL;
p->NextOfPE = ae->PropsOfAE;
INIT_RWLOCK(p->FRWLock);
ae->PropsOfAE = AbsProp((PropEntry *) p);
/* respect the first property, in case this is a wide atom */
AddPropToAtom(ae, (PropEntry *)p);
return ((Functor) p);
}
@ -104,8 +104,7 @@ Yap_MkFunctorWithAddress(Atom ap, unsigned int arity, FunctorEntry *p)
p->KindOfPE = FunctorProperty;
p->NameOfFE = ap;
p->ArityOfFE = arity;
p->NextOfPE = RepAtom(ap)->PropsOfAE;
ae->PropsOfAE = AbsProp((PropEntry *) p);
AddPropToAtom(ae, (PropEntry *)p);
WRITE_UNLOCK(ae->ARWLock);
}
@ -488,11 +487,51 @@ Yap_HasOp(Atom a)
}
}
OpEntry *
Yap_OpPropForModule(Atom a, Term mod)
{ /* look property list of atom a for kind */
CACHE_REGS
AtomEntry *ae = RepAtom(a);
PropEntry *pp;
OpEntry *info = NULL;
if (mod == TermProlog)
mod = PROLOG_MODULE;
WRITE_LOCK(ae->ARWLock);
pp = RepProp(ae->PropsOfAE);
while (!EndOfPAEntr(pp)) {
if ( pp->KindOfPE == OpProperty) {
info = (OpEntry *)pp;
if (info->OpModule == mod) {
WRITE_LOCK(info->OpRWLock);
WRITE_UNLOCK(ae->ARWLock);
return info;
}
}
pp = pp->NextOfPE;
}
info = (OpEntry *) Yap_AllocAtomSpace(sizeof(OpEntry));
info->KindOfPE = Ord(OpProperty);
info->OpModule = mod;
info->OpName = a;
LOCK(OpListLock);
info->OpNext = OpList;
OpList = info;
UNLOCK(OpListLock);
AddPropToAtom(ae, (PropEntry *)info);
INIT_RWLOCK(info->OpRWLock);
WRITE_LOCK(info->OpRWLock);
WRITE_UNLOCK(ae->ARWLock);
info->Prefix = info->Infix = info->Posfix = 0;
return info;
}
OpEntry *
Yap_GetOpProp(Atom a, op_type type USES_REGS)
{ /* look property list of atom a for kind */
AtomEntry *ae = RepAtom(a);
PropEntry *pp;
OpEntry *oinfo = NULL;
READ_LOCK(ae->ARWLock);
pp = RepProp(ae->PropsOfAE);
@ -524,9 +563,21 @@ Yap_GetOpProp(Atom a, op_type type USES_REGS)
continue;
}
}
READ_LOCK(info->OpRWLock);
/* if it is not the latest module */
if (info->OpModule == PROLOG_MODULE) {
/* cannot commit now */
oinfo = info;
pp = RepProp(pp->NextOfPE);
} else {
READ_LOCK(info->OpRWLock);
READ_UNLOCK(ae->ARWLock);
return info;
}
}
if (oinfo) {
READ_LOCK(oinfo->OpRWLock);
READ_UNLOCK(ae->ARWLock);
return info;
return oinfo;
}
READ_UNLOCK(ae->ARWLock);
return NULL;
@ -898,7 +949,6 @@ Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
p->beamTable = NULL;
#endif
/* careful that they don't cross MkFunctor */
p->NextOfPE = ae->PropsOfAE;
if (PRED_GOAL_EXPANSION_FUNC) {
Prop p1 = ae->PropsOfAE;
@ -914,7 +964,8 @@ Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
p1 = pe->NextOfPE;
}
}
ae->PropsOfAE = p0 = AbsPredProp(p);
AddPropToAtom(ae, (PropEntry *)p);
p0 = AbsPredProp(p);
p->FunctorOfPred = (Functor)AbsAtom(ae);
WRITE_UNLOCK(ae->ARWLock);
#ifdef LOW_PROF
@ -940,8 +991,14 @@ Yap_PredPropByFunctorNonThreadLocal(Functor f, Term cur_mod)
return Yap_NewPredPropByFunctor(f,cur_mod);
if ((p->ModuleOfPred == cur_mod || !(p->ModuleOfPred))) {
WRITE_UNLOCK(f->FRWLock);
return AbsPredProp(p);
/* don't match multi-files */
if (!(p->PredFlags & MultiFileFlag) ||
p->ModuleOfPred ||
!cur_mod ||
cur_mod == TermProlog) {
WRITE_UNLOCK(f->FRWLock);
return AbsPredProp(p);
}
}
if (p->NextOfPE) {
UInt hash = PRED_HASH(f,cur_mod,PredHashTableSize);
@ -976,8 +1033,14 @@ Yap_PredPropByAtomNonThreadLocal(Atom at, Term cur_mod)
PredEntry *pe = RepPredProp(p0);
if ( pe->KindOfPE == PEProp &&
(pe->ModuleOfPred == cur_mod || !pe->ModuleOfPred)) {
WRITE_UNLOCK(ae->ARWLock);
return(p0);
/* don't match multi-files */
if (!(pe->PredFlags & MultiFileFlag) ||
pe->ModuleOfPred ||
!cur_mod ||
cur_mod == TermProlog) {
WRITE_UNLOCK(ae->ARWLock);
return(p0);
}
}
p0 = pe->NextOfPE;
}
@ -1033,10 +1096,9 @@ Yap_PutValue(Atom a, Term v)
WRITE_UNLOCK(ae->ARWLock);
return;
}
p->NextOfPE = RepAtom(a)->PropsOfAE;
RepAtom(a)->PropsOfAE = AbsValProp(p);
p->KindOfPE = ValProperty;
p->ValueOfVE = TermNil;
AddPropToAtom(RepAtom(a), (PropEntry *)p);
/* take care that the lock for the property will be inited even
if someone else searches for the property */
INIT_RWLOCK(p->VRWLock);

0
C/agc.c Executable file → Normal file
View File

2
C/alloc.c Executable file → Normal file
View File

@ -1065,7 +1065,7 @@ mmap_extension(Int s, MALLOC_T base, int fixed_allocation)
#else
char file[YAP_FILENAME_MAX];
strcpy(file,"/tmp/mapfile");
itos(getpid(), &file[12]);
itos(getpid(), &file[12]);
#endif /* HAVE_TMPNAM */
#endif /* HAVE_MKSTEMP */
fd = open(file, O_CREAT|O_RDWR, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);

13
C/amasm.c Executable file → Normal file
View File

@ -1104,12 +1104,12 @@ a_ensure_space(op_numbers opcode, yamop *code_p, int pass_no, struct intermediat
if (cip->cpc->rnd1 > 4096) {
if (pass_no) {
code_p->opc = emit_op(opcode);
code_p->u.Osbpi.i = sizeof(CELL) * cip->cpc->rnd1;
code_p->u.Osbpi.p = clinfo->CurrentPred;
code_p->u.Osbpi.bmap = NULL;
code_p->u.Osbpi.s = emit_count(-Signed(RealEnvSize));
code_p->u.Osbpa.i = sizeof(CELL) * cip->cpc->rnd1;
code_p->u.Osbpa.p = clinfo->CurrentPred;
code_p->u.Osbpa.bmap = NULL;
code_p->u.Osbpa.s = emit_count(-Signed(RealEnvSize));
}
GONEXT(Osbpi);
GONEXT(Osbpa);
}
return code_p;
}
@ -3037,7 +3037,6 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
cl_u->luc.ClFlags |= HasCutMask;
cl_u->luc.ClRefCount = 0;
cl_u->luc.ClPred = cip->CurrentPred;
cl_u->luc.ClSize = size;
/* Support for timestamps */
if (cip->CurrentPred->LastCallOfPred != LUCALL_ASSERT) {
if (cip->CurrentPred->TimeStampOfPred >= TIMESTAMP_RESET)
@ -3948,8 +3947,10 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
}
if (mode == ASSEMBLING_CLAUSE) {
if (ap->PredFlags & LogUpdatePredFlag) {
((LogUpdClause *)(cip->code_addr))->ClSize = size;
Yap_LUClauseSpace += size;
} else
((StaticClause *)(cip->code_addr))->ClSize = size;
Yap_ClauseSpace += size;
} else {
if (ap->PredFlags & LogUpdatePredFlag) {

View File

@ -198,8 +198,7 @@ Yap_InitConstExps(void)
p->ArityOfEE = 0;
p->ENoOfEE = 0;
p->FOfEE = InitConstTab[i].f;
p->NextOfPE = ae->PropsOfAE;
ae->PropsOfAE = AbsExpProp(p);
AddPropToAtom(ae, (PropEntry *)p);
WRITE_UNLOCK(ae->ARWLock);
}
}

3
C/arith1.c Executable file → Normal file
View File

@ -835,8 +835,7 @@ Yap_InitUnaryExps(void)
p->ArityOfEE = 1;
p->ENoOfEE = 1;
p->FOfEE = InitUnTab[i].f;
p->NextOfPE = ae->PropsOfAE;
ae->PropsOfAE = AbsExpProp(p);
AddPropToAtom(ae, (PropEntry *)p);
WRITE_UNLOCK(ae->ARWLock);
}
Yap_InitCPred("is", 3, p_unary_is, TestPredFlag | SafePredFlag);

3
C/arith2.c Executable file → Normal file
View File

@ -1217,8 +1217,7 @@ Yap_InitBinaryExps(void)
p->ArityOfEE = 2;
p->ENoOfEE = 2;
p->FOfEE = InitBinTab[i].f;
p->NextOfPE = ae->PropsOfAE;
ae->PropsOfAE = AbsExpProp(p);
AddPropToAtom(ae, (PropEntry *)p);
WRITE_UNLOCK(ae->ARWLock);
}
Yap_InitCPred("is", 4, p_binary_is, TestPredFlag | SafePredFlag);

View File

@ -566,9 +566,8 @@ CreateNamedArray(PropEntry * pp, Int dim, AtomEntry *ae USES_REGS)
p = (ArrayEntry *) Yap_AllocAtomSpace(sizeof(*p));
p->KindOfPE = ArrayProperty;
p->NextOfPE = ae->PropsOfAE;
AddPropToAtom(ae, (PropEntry *)p);
INIT_RWLOCK(p->ArRWLock);
ae->PropsOfAE = AbsArrayProp(p);
#if THREADS
p->owner_id = worker_id;
#endif
@ -629,15 +628,14 @@ CreateStaticArray(AtomEntry *ae, Int dim, static_array_types type, CODEADDR star
}
}
p->KindOfPE = ArrayProperty;
p->NextOfPE = ae->PropsOfAE;
INIT_RWLOCK(p->ArRWLock);
AddPropToAtom(ae, (PropEntry *)p);
p->NextAE = LOCAL_StaticArrays;
LOCAL_StaticArrays = p;
}
WRITE_LOCK(p->ArRWLock);
p->ArrayEArity = -dim;
p->ArrayType = type;
ae->PropsOfAE = AbsArrayProp((ArrayEntry *)p);
if (start_addr == NULL) {
int i;

3
C/bb.c
View File

@ -43,8 +43,7 @@ PutBBProp(AtomEntry *ae, Term mod USES_REGS) /* get BBentry for at; */
Yap_Error(OUT_OF_HEAP_ERROR,ARG1,"could not allocate space in bb_put/2");
return(NULL);
}
p->NextOfPE = ae->PropsOfAE;
ae->PropsOfAE = AbsBBProp(p);
AddPropToAtom(ae, (PropEntry *)p);
p->ModuleOfBB = mod;
p->Element = 0L;
p->KeyOfBB = AbsAtom(ae);

0
C/bignum.c Executable file → Normal file
View File

27
C/c_interface.c Executable file → Normal file
View File

@ -2378,10 +2378,18 @@ YAP_RunGoalOnce(Term t)
CACHE_REGS
Term out;
yamop *old_CP = CP;
Int oldPrologMode = LOCAL_PrologMode;
BACKUP_MACHINE_REGS();
LOCAL_PrologMode = UserMode;
out = Yap_RunTopGoal(t);
LOCAL_PrologMode = UserCCallMode;
LOCAL_PrologMode = oldPrologMode;
if (!(oldPrologMode & UserCCallMode)) {
/* called from top-level */
LOCAL_AllowRestart = FALSE;
RECOVER_MACHINE_REGS();
return out;
}
if (out) {
choiceptr cut_pt, ob;
@ -2810,7 +2818,7 @@ construct_init_file(char *boot_file, char *BootFile)
/* this routine is supposed to be called from an external program
that wants to control Yap */
#if defined(USE_SYSTEM_MALLOC)
#if defined(USE_SYSTEM_MALLOC) && FALSE
#define BOOT_FROM_SAVED_STATE FALSE
#else
#define BOOT_FROM_SAVED_STATE TRUE
@ -2840,8 +2848,8 @@ YAP_Init(YAP_init_args *yap_init)
yap_init->SavedState = NULL;
}
#endif
if (BOOT_FROM_SAVED_STATE && !do_bootstrap) {
if (Yap_SavedInfo (yap_init->SavedState, yap_init->YapLibDir, &Trail, &Stack, &Heap) != 1) {
if (FALSE && BOOT_FROM_SAVED_STATE && !do_bootstrap) {
if (Yap_SavedInfo (yap_init->SavedState, yap_init->YapLibDir, &Trail, &Stack, &Heap)) {
yap_init->ErrorNo = LOCAL_Error_TYPE;
yap_init->ErrorCause = LOCAL_ErrorMessage;
return YAP_BOOT_ERROR;
@ -3146,9 +3154,14 @@ YAP_Reset(void)
if (B != NULL) {
while (B->cp_b != NULL)
B = B->cp_b;
P = (yamop *)FAILCODE;
if (Yap_exec_absmi(0) != 0)
return(FALSE);
P = FAILCODE;
if (Yap_exec_absmi(0) != 0) {
GLOBAL_Initialised = TRUE;
Yap_InitYaamRegs();
RECOVER_MACHINE_REGS();
return FALSE;
}
}
/* reinitialise the engine */
Yap_InitYaamRegs();

View File

@ -838,7 +838,9 @@ Yap_BuildMegaClause(PredEntry *ap)
required = sz*ap->cs.p_code.NOfClauses+sizeof(MegaClause)+(UInt)NEXTOP((yamop *)NULL,l);
#ifdef DEBUG
total_megaclause += required;
total_released += ap->cs.p_code.NOfClauses*(sz+sizeof(StaticClause));
cl =
ClauseCodeToStaticClause(ap->cs.p_code.FirstClause);
total_released += ap->cs.p_code.NOfClauses*cl->ClSize;
nof_megaclauses++;
#endif
while (!(mcl = (MegaClause *)Yap_AllocCodeSpace(required))) {
@ -850,7 +852,7 @@ Yap_BuildMegaClause(PredEntry *ap)
Yap_ClauseSpace += required;
/* cool, it's our turn to do the conversion */
mcl->ClFlags = MegaMask | has_blobs;
mcl->ClSize = sz*ap->cs.p_code.NOfClauses;
mcl->ClSize = required;
mcl->ClPred = ap;
mcl->ClItemSize = sz;
mcl->ClNext = NULL;
@ -1603,7 +1605,7 @@ retract_all(PredEntry *p, int in_use)
}
p->cs.p_code.FirstClause = NULL;
p->cs.p_code.LastClause = NULL;
if (p->PredFlags & (DynamicPredFlag|LogUpdatePredFlag)) {
if (p->PredFlags & (DynamicPredFlag|LogUpdatePredFlag|MultiFileFlag)) {
p->OpcodeOfPred = FAIL_OPCODE;
} else {
p->OpcodeOfPred = UNDEF_OPCODE;
@ -1631,6 +1633,19 @@ retract_all(PredEntry *p, int in_use)
Yap_PutValue(AtomAbol, MkAtomTerm(AtomTrue));
}
static int
source_pred(PredEntry *p, yamop *q)
{
if (p->PredFlags & (DynamicPredFlag|LogUpdatePredFlag))
return FALSE;
if (p->PredFlags & MultiFileFlag)
return TRUE;
if (yap_flags[SOURCE_MODE_FLAG]) {
return TRUE;
}
return FALSE;
}
/* p is already locked */
static void
add_first_static(PredEntry *p, yamop *cp, int spy_flag)
@ -1682,12 +1697,8 @@ add_first_static(PredEntry *p, yamop *cp, int spy_flag)
p->OpcodeOfPred = Yap_opcode(_spy_pred);
p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
}
if ((yap_flags[SOURCE_MODE_FLAG] ||
(p->PredFlags & MultiFileFlag)) &&
!(p->PredFlags & (DynamicPredFlag|LogUpdatePredFlag))) {
if (source_pred(p, cp)) {
p->PredFlags |= SourcePredFlag;
} else {
p->PredFlags &= ~SourcePredFlag;
}
}
@ -1938,6 +1949,24 @@ assertz_dynam_clause(PredEntry *p, yamop *cp)
p->cs.p_code.NOfClauses++;
}
void
Yap_AssertzClause(PredEntry *p, yamop *cp)
{
if (p->PredFlags & DynamicPredFlag) {
if (p->cs.p_code.FirstClause == NULL) {
add_first_dynamic(p, cp, FALSE);
} else {
assertz_dynam_clause(p, cp);
}
} else {
if (p->cs.p_code.FirstClause == NULL) {
add_first_static(p, cp, FALSE);
} else {
assertz_stat_clause(p, cp, FALSE);
}
}
}
static void expand_consult( void )
{
CACHE_REGS
@ -2070,7 +2099,6 @@ mark_preds_with_this_func(Functor f, Prop p0)
}
}
static int
addclause(Term t, yamop *cp, int mode, Term mod, Term *t4ref)
/*
@ -2609,8 +2637,6 @@ purge_clauses(PredEntry *pred)
retract_all(pred, static_in_use(pred,TRUE));
}
pred->src.OwnerFile = AtomNil;
if (pred->PredFlags & MultiFileFlag)
pred->PredFlags ^= MultiFileFlag;
}
void
@ -2856,6 +2882,7 @@ p_new_multifile( USES_REGS1 )
pe = RepPredProp(PredPropByFunc(Yap_MkFunctor(at, arity),mod));
PELOCK(26,pe);
pe->PredFlags |= MultiFileFlag;
/* mutifile-predicates are weird, they do not seat really on the default module */
if (pe->ModuleOfPred == PROLOG_MODULE)
pe->ModuleOfPred = TermProlog;
if (!(pe->PredFlags & (DynamicPredFlag|LogUpdatePredFlag))) {

2
C/compiler.c Executable file → Normal file
View File

@ -737,7 +737,7 @@ c_arg(Int argno, Term t, unsigned int arity, unsigned int level, compiler_struct
if (optimizer_on && level < 6) {
#if !defined(THREADS) && !defined(YAPOR)
/* discard code sharing because we cannot write on shared stuff */
if (!(cglobs->cint.CurrentPred->PredFlags & (DynamicPredFlag|LogUpdatePredFlag))) {
if (FALSE && !(cglobs->cint.CurrentPred->PredFlags & (DynamicPredFlag|LogUpdatePredFlag))) {
if (try_store_as_dbterm(t, argno, arity, level, cglobs))
return;
}

0
C/computils.c Executable file → Normal file
View File

0
C/cut_c.c Executable file → Normal file
View File

64
C/dbase.c Executable file → Normal file
View File

@ -1221,19 +1221,22 @@ CreateDBWithDBRef(Term Tm, DBProp p, struct db_globs *dbg)
DBTerm *ppt;
if (p == NULL) {
ppt = (DBTerm *)AllocDBSpace(sizeof(DBTerm)+2*sizeof(CELL));
UInt sz = sizeof(DBTerm)+2*sizeof(CELL);
ppt = (DBTerm *)AllocDBSpace(sz);
if (ppt == NULL) {
return generate_dberror_msg(OUT_OF_HEAP_ERROR, TermNil, "could not allocate space");
return generate_dberror_msg(OUT_OF_HEAP_ERROR, TermNil, "could not allocate heap");
}
dbg->sz = sizeof(DBTerm)+2*sizeof(CELL);
Yap_LUClauseSpace += sizeof(DBTerm)+2*sizeof(CELL);
dbg->sz = sz;
Yap_LUClauseSpace += sz;
pp = (DBRef)ppt;
} else {
pp = AllocDBSpace(DBLength(2*sizeof(DBRef)));
UInt sz = DBLength(2*sizeof(DBRef));
pp = AllocDBSpace(sz);
if (pp == NULL) {
return generate_dberror_msg(OUT_OF_HEAP_ERROR, 0, "could not allocate space");
}
Yap_LUClauseSpace += DBLength(2*sizeof(DBRef));
Yap_LUClauseSpace += sz;
dbg->sz = sz;
pp->id = FunctorDBRef;
pp->Flags = DBNoVars|DBComplex|DBWithRefs;
INIT_LOCK(pp->lock);
@ -1261,13 +1264,14 @@ static DBTerm *
CreateDBTermForAtom(Term Tm, UInt extra_size, struct db_globs *dbg) {
DBTerm *ppt;
ADDR ptr;
UInt sz = extra_size+sizeof(DBTerm);
ptr = (ADDR)AllocDBSpace(extra_size+sizeof(DBTerm));
ptr = (ADDR)AllocDBSpace(sz);
if (ptr == NULL) {
return (DBTerm *)generate_dberror_msg(OUT_OF_HEAP_ERROR, 0, "could not allocate space");
}
Yap_LUClauseSpace += extra_size+sizeof(DBTerm);
dbg->sz = extra_size+sizeof(DBTerm);
Yap_LUClauseSpace += sz;
dbg->sz = sz;
ppt = (DBTerm *)(ptr+extra_size);
ppt->NOfCells = 0;
ppt->DBRefs = NULL;
@ -1284,13 +1288,14 @@ CreateDBTermForVar(UInt extra_size, struct db_globs *dbg)
{
DBTerm *ppt;
ADDR ptr;
UInt sz = extra_size+sizeof(DBTerm);
ptr = (ADDR)AllocDBSpace(extra_size+sizeof(DBTerm));
ptr = (ADDR)AllocDBSpace(sz);
if (ptr == NULL) {
return (DBTerm *)generate_dberror_msg(OUT_OF_HEAP_ERROR, 0, "could not allocate space");
}
Yap_LUClauseSpace += extra_size+sizeof(DBTerm);
dbg->sz = extra_size+sizeof(DBTerm);
Yap_LUClauseSpace += sz;
dbg->sz = sz;
ppt = (DBTerm *)(ptr+extra_size);
ppt->NOfCells = 0;
ppt->DBRefs = NULL;
@ -1306,16 +1311,17 @@ static DBRef
CreateDBRefForAtom(Term Tm, DBProp p, int InFlag, struct db_globs *dbg) {
Register DBRef pp;
SMALLUNSGN flag;
UInt sz = DBLength(NIL);
flag = DBAtomic;
if (InFlag & MkIfNot && (dbg->found_one = check_if_cons(p->First, Tm)))
return dbg->found_one;
pp = AllocDBSpace(DBLength(NIL));
pp = AllocDBSpace(sz);
if (pp == NIL) {
return generate_dberror_msg(OUT_OF_HEAP_ERROR, 0, "could not allocate space");
}
Yap_LUClauseSpace += DBLength(NIL);
dbg->sz = DBLength(NIL);
Yap_LUClauseSpace += sz;
dbg->sz = sz;
pp->id = FunctorDBRef;
INIT_LOCK(pp->lock);
INIT_DBREF_COUNT(pp);
@ -1333,15 +1339,16 @@ CreateDBRefForAtom(Term Tm, DBProp p, int InFlag, struct db_globs *dbg) {
static DBRef
CreateDBRefForVar(Term Tm, DBProp p, int InFlag, struct db_globs *dbg) {
Register DBRef pp;
UInt sz = DBLength(NULL);
if (InFlag & MkIfNot && (dbg->found_one = check_if_var(p->First)))
return dbg->found_one;
pp = AllocDBSpace(DBLength(NULL));
pp = AllocDBSpace(sz);
if (pp == NULL) {
return generate_dberror_msg(OUT_OF_HEAP_ERROR, 0, "could not allocate space");
}
Yap_LUClauseSpace += DBLength(NULL);
dbg->sz = DBLength(NULL);
Yap_LUClauseSpace += sz;
dbg->sz = sz;
pp->id = FunctorDBRef;
pp->Flags = DBVar;
pp->DBT.Entry = (CELL) Tm;
@ -1549,23 +1556,25 @@ CreateDBStruct(Term Tm, DBProp p, int InFlag, int *pstat, UInt extra_size, struc
}
#endif
if (p == NULL) {
ADDR ptr = Yap_AllocCodeSpace((CELL)CodeAbs+extra_size+sizeof(DBTerm));
UInt sz = (CELL)CodeAbs+extra_size+sizeof(DBTerm);
ADDR ptr = Yap_AllocCodeSpace(sz);
ppt = (DBTerm *)(ptr+extra_size);
if (ptr == NULL) {
Yap_ReleasePreAllocCodeSpace((ADDR)pp0);
return generate_dberror_msg(OUT_OF_HEAP_ERROR, (UInt)DBLength(CodeAbs), "heap crashed against stacks");
return generate_dberror_msg(OUT_OF_HEAP_ERROR, sz, "heap crashed against stacks");
}
Yap_LUClauseSpace += (CELL)CodeAbs+extra_size+sizeof(DBTerm);
dbg->sz = (CELL)CodeAbs+extra_size+sizeof(DBTerm);
Yap_LUClauseSpace += sz;
dbg->sz = sz;
pp = (DBRef)ppt;
} else {
pp = AllocDBSpace(DBLength(CodeAbs));
UInt sz = DBLength(CodeAbs);
pp = AllocDBSpace(sz);
if (pp == NULL) {
Yap_ReleasePreAllocCodeSpace((ADDR)pp0);
return generate_dberror_msg(OUT_OF_HEAP_ERROR, (UInt)DBLength(CodeAbs), "heap crashed against stacks");
return generate_dberror_msg(OUT_OF_HEAP_ERROR, sz, "heap crashed against stacks");
}
Yap_LUClauseSpace += DBLength(CodeAbs);
dbg->sz = DBLength(CodeAbs);
Yap_LUClauseSpace += sz;
dbg->sz = sz;
pp->id = FunctorDBRef;
pp->Flags = flag;
INIT_LOCK(pp->lock);
@ -2896,8 +2905,7 @@ FetchDBPropFromKey(Term twork, int flag, int new, char *error_mssg)
p->FunctorOfDB = (Functor) At;
else
p->FunctorOfDB = Yap_UnlockedMkFunctor(ae,arity);
p->NextOfPE = ae->PropsOfAE;
ae->PropsOfAE = AbsDBProp(p);
AddPropToAtom(ae, (PropEntry *)p);
}
WRITE_UNLOCK(ae->ARWLock);
return

0
C/dlmalloc.c Executable file → Normal file
View File

0
C/errors.c Executable file → Normal file
View File

View File

@ -984,7 +984,7 @@ exec_absmi(int top USES_REGS)
break;
case 3:
{ /* saved state */
return(FALSE);
return FALSE;
}
default:
/* do nothing */

View File

@ -858,8 +858,7 @@ GetGlobalEntry(Atom at USES_REGS)
new->NextGE = LOCAL_GlobalVariables;
LOCAL_GlobalVariables = new;
new->AtomOfGE = ae;
new->NextOfPE = ae->PropsOfAE;
ae->PropsOfAE = AbsGlobalProp(new);
AddPropToAtom(ae, (PropEntry *)new);
RESET_VARIABLE(&new->global);
WRITE_UNLOCK(ae->ARWLock);
return new;

0
C/gmp_support.c Executable file → Normal file
View File

0
C/gprof.c Executable file → Normal file
View File

9
C/grow.c Executable file → Normal file
View File

@ -1216,13 +1216,16 @@ fix_tabling_info( USES_REGS1 )
while (df) {
if (DepFr_backchain_cp(df))
DepFr_backchain_cp(df) = ChoicePtrAdjust(DepFr_backchain_cp(df));
DepFr_leader_cp(df) = ChoicePtrAdjust(DepFr_leader_cp(df));
DepFr_cons_cp(df) = ConsumerChoicePtrAdjust(DepFr_cons_cp(df));
if (DepFr_leader_cp(df))
DepFr_leader_cp(df) = ChoicePtrAdjust(DepFr_leader_cp(df));
if (DepFr_cons_cp(df))
DepFr_cons_cp(df) = ConsumerChoicePtrAdjust(DepFr_cons_cp(df));
df = DepFr_next(df);
}
sg = LOCAL_top_sg_fr;
while (sg) {
SgFr_gen_cp(sg) = GeneratorChoicePtrAdjust(SgFr_gen_cp(sg));
if (SgFr_gen_cp(sg))
SgFr_gen_cp(sg) = GeneratorChoicePtrAdjust(SgFr_gen_cp(sg));
sg = SgFr_next(sg);
}
}

2
C/heapgc.c Executable file → Normal file
View File

@ -1915,7 +1915,7 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose
if (pe == NULL) {
fprintf(GLOBAL_stderr,"%% marked " UInt_FORMAT " (%s)\n", LOCAL_total_marked, Yap_op_names[opnum]);
} else if (pe->ArityOfPE) {
fprintf(GLOBAL_stderr,"%% %s/%d marked " UInt_FORMAT " (%s)\n", RepAtom(NameOfFunctor(pe->FunctorOfPred))->StrOfAE, pe->ArityOfPE, LOCAL_total_marked, Yap_op_names[opnum]);
fprintf(GLOBAL_stderr,"%% %s/" UInt_FORMAT " marked " UInt_FORMAT " (%s)\n", RepAtom(NameOfFunctor(pe->FunctorOfPred))->StrOfAE, pe->ArityOfPE, LOCAL_total_marked, Yap_op_names[opnum]);
} else {
fprintf(GLOBAL_stderr,"%% %s marked " UInt_FORMAT " (%s)\n", RepAtom((Atom)(pe->FunctorOfPred))->StrOfAE, LOCAL_total_marked, Yap_op_names[opnum]);
}

View File

@ -2671,7 +2671,8 @@ init_clauses(ClauseDef *cl, PredEntry *ap)
{
if (ap->PredFlags & MegaClausePredFlag) {
MegaClause *mcl = ClauseCodeToMegaClause(ap->cs.p_code.FirstClause);
yamop *end = (yamop *)((char *)mcl->ClCode+mcl->ClSize);
UInt nclauses = mcl->ClPred->cs.p_code.NOfClauses;
yamop *end = (yamop *)((char *)mcl->ClCode+nclauses*mcl->ClItemSize);
yamop *cd = mcl->ClCode;
while (cd < end) {
cl->Code = cl->CurrentCode = cd;
@ -2926,7 +2927,8 @@ install_clauses(ClauseDef *cls, PredEntry *ap, istack_entry *stack, yamop *beg,
istack_entry *sp = stack;
if (ap->PredFlags & MegaClausePredFlag) {
MegaClause *mcl = ClauseCodeToMegaClause(beg);
yamop *end = (yamop *)((char *)mcl->ClCode+mcl->ClSize);
UInt nclauses = mcl->ClPred->cs.p_code.NOfClauses;
yamop *end = (yamop *)((char *)mcl->ClCode+nclauses*mcl->ClItemSize);
yamop *cd = mcl->ClCode;
if (stack[0].pos == 0) {
@ -3211,7 +3213,7 @@ count_clauses_left(yamop *cl, PredEntry *ap)
return i;
} else if (ap->PredFlags & MegaClausePredFlag) {
MegaClause *mcl = ClauseCodeToMegaClause(ap->cs.p_code.FirstClause);
UInt ncls = mcl->ClSize/mcl->ClItemSize;
UInt ncls = mcl->ClPred->cs.p_code.NOfClauses;
return (ncls-1)-((char *)cl-(char *)mcl->ClCode)/mcl->ClItemSize;
} else {
@ -5979,7 +5981,7 @@ Yap_RemoveClauseFromIndex(PredEntry *ap, yamop *beg) {
}
#endif
ap->OpcodeOfPred = Yap_opcode(_op_fail);
} else {
} else if (ap->PredFlags & IndexedPredFlag) {
remove_from_index(ap, sp, &cl, beg, last, &cint);
}
}

9
C/init.c Executable file → Normal file
View File

@ -151,14 +151,13 @@ OpDec(int p, char *type, Atom a, Term m)
if (EndOfPAEntr(info)) {
info = (OpEntry *) Yap_AllocAtomSpace(sizeof(OpEntry));
info->KindOfPE = Ord(OpProperty);
info->NextOfPE = RepAtom(a)->PropsOfAE;
info->OpModule = m;
info->OpName = a;
LOCK(OpListLock);
info->OpNext = OpList;
OpList = info;
UNLOCK(OpListLock);
RepAtom(a)->PropsOfAE = AbsOpProp(info);
AddPropToAtom(ae, (PropEntry *)info);
INIT_RWLOCK(info->OpRWLock);
WRITE_LOCK(info->OpRWLock);
WRITE_UNLOCK(ae->ARWLock);
@ -391,8 +390,6 @@ update_flags_from_prolog(UInt flags, PredEntry *pe)
flags |= SourcePredFlag;
if (pe->PredFlags & SequentialPredFlag)
flags |= SequentialPredFlag;
if (pe->PredFlags & MyddasPredFlag)
flags |= MyddasPredFlag;
if (pe->PredFlags & UDIPredFlag)
flags |= UDIPredFlag;
if (pe->PredFlags & ModuleTransparentPredFlag)
@ -799,9 +796,9 @@ Yap_InitCPredBack(char *Name, unsigned long int Arity,
StaticClause *cl;
yamop *code = ((StaticClause *)NULL)->ClCode;
if (flags & UserCPredFlag)
pe->PredFlags = UserCPredFlag | CompiledPredFlag | StandardPredFlag | flags;
pe->PredFlags = UserCPredFlag | BackCPredFlag| CompiledPredFlag | StandardPredFlag | flags;
else
pe->PredFlags = CompiledPredFlag | StandardPredFlag;
pe->PredFlags = CompiledPredFlag | StandardPredFlag | BackCPredFlag;
#ifdef YAPOR
pe->PredFlags |= SequentialPredFlag;

0
C/inlines.c Executable file → Normal file
View File

View File

@ -754,8 +754,10 @@ p_read2 ( USES_REGS1 )
Int out;
if (!Yap_getInputStream(Yap_InitSlot(Deref(ARG8) PASS_REGS), &inp_stream)) {
Yap_RecoverSlots(1 PASS_REGS);
return(FALSE);
}
Yap_RecoverSlots(1 PASS_REGS);
out = do_read(inp_stream, 8 PASS_REGS);
return out;
}
@ -1077,33 +1079,6 @@ p_float_format( USES_REGS1 )
return TRUE;
}
extern IOENC Yap_DefaultEncoding(void);
extern void Yap_SetDefaultEncoding(IOENC);
extern int PL_get_stream_handle(Int, IOSTREAM **);
static Int
p_get_default_encoding( USES_REGS1 )
{
Term out = MkIntegerTerm(Yap_DefaultEncoding());
return Yap_unify(ARG1, out);
}
static Int
p_encoding ( USES_REGS1 )
{ /* '$encoding'(Stream,N) */
IOSTREAM *st;
Term t = Deref(ARG2);
if (!PL_get_stream_handle(Yap_InitSlot(Deref(ARG1) PASS_REGS), &st)) {
return FALSE;
}
if (IsVarTerm(t)) {
return Yap_unify(ARG2, MkIntegerTerm(st->encoding));
}
st->encoding = IntegerOfTerm(Deref(ARG2));
return TRUE;
}
void
Yap_InitBackIO (void)
{
@ -1128,8 +1103,6 @@ Yap_InitIOPreds(void)
Yap_InitCPred ("$all_char_conversions", 1, p_all_char_conversions, SyncPredFlag|HiddenPredFlag);
Yap_InitCPred ("$force_char_conversion", 0, p_force_char_conversion, SyncPredFlag|HiddenPredFlag);
Yap_InitCPred ("$disable_char_conversion", 0, p_disable_char_conversion, SyncPredFlag|HiddenPredFlag);
Yap_InitCPred ("$get_default_encoding", 1, p_get_default_encoding, SafePredFlag|TestPredFlag);
Yap_InitCPred ("$encoding", 2, p_encoding, SafePredFlag|SyncPredFlag),
#if HAVE_SELECT
// Yap_InitCPred ("stream_select", 3, p_stream_select, SafePredFlag|SyncPredFlag);
#endif

2
C/load_dl.c Executable file → Normal file
View File

@ -168,7 +168,7 @@ Yap_ShutdownLoadForeign(void)
objs = f_code->objs;
while (objs != NULL) {
if (dlclose(objs->handle) != 0)
return; /* ERROR */
return; /* ERROR */
objs = objs->next;
}
libs = f_code->libs;

0
C/load_dll.c Executable file → Normal file
View File

0
C/load_foreign.c Executable file → Normal file
View File

View File

@ -72,8 +72,7 @@ GetModuleEntry(Atom at)
new->NextME = CurrentModules;
CurrentModules = new;
new->AtomOfME = ae;
new->NextOfPE = ae->PropsOfAE;
ae->PropsOfAE = AbsModProp(new);
AddPropToAtom(ae, (PropEntry *)new);
return new;
}

23
packages/PLStream/pl-yap.c → C/pl-yap.c Executable file → Normal file
View File

@ -993,6 +993,14 @@ int Yap_getInputStream(term_t t, IOSTREAM **s)
return getInputStream(t, s);
}
extern int Yap_getOutputStream(term_t t, IOSTREAM **s);
int Yap_getOutputStream(term_t t, IOSTREAM **s)
{
GET_LD
return getOutputStream(t, s);
}
#ifdef _WIN32
#include <windows.h>
@ -1157,6 +1165,20 @@ Yap_dowrite(Term t, IOSTREAM *stream, int flags, int priority)
return res;
}
int
isWideAtom(atom_t atom)
{
Atom a = (Atom)atomValue(atom);
return IsWideAtom(a);
}
wchar_t *
nameOfWideAtom(atom_t atom)
{
Atom a = (Atom)atomValue(atom);
return RepAtom(a)->WStrOfAE;
}
#if THREADS
@ -1207,7 +1229,6 @@ error:
return rc;
}
int
recursiveMutexInit(recursiveMutex *m)
{

1007
C/qlyr.c Normal file

File diff suppressed because it is too large Load Diff

730
C/qlyw.c Normal file
View File

@ -0,0 +1,730 @@
/*************************************************************************
* *
* YAP Prolog *
* *
* Yap Prolog was developed at NCCUP - Universidade do Porto *
* *
* Copyright L.Damas, V. Santos Costa and Universidade do Porto 1985-- *
* *
**************************************************************************
* *
* File: qlyw.c *
* comments: quick saver/loader *
* *
* Last rev: $Date: 2011-08-29$,$Author: vsc $ *
* $Log: not supported by cvs2svn $ *
* *
*************************************************************************/
#include <SWI-Stream.h>
#include "absmi.h"
#include "Foreign.h"
#include "alloc.h"
#include "yapio.h"
#include "iopreds.h"
#include "attvar.h"
#if HAVE_STRING_H
#include <string.h>
#endif
#include "qly.h"
STATIC_PROTO(void RestoreEntries, (PropEntry *, int USES_REGS));
STATIC_PROTO(void CleanCode, (PredEntry * USES_REGS));
static void
LookupAtom(Atom at)
{
char *p = RepAtom(at)->StrOfAE;
CELL hash = HashFunction((unsigned char *)p) % LOCAL_ExportAtomHashTableSize;
export_atom_hash_entry_t *a;
a = LOCAL_ExportAtomHashChain[hash];
while (a) {
if (a->val == at) {
return;
}
a = a->next;
}
a = (export_atom_hash_entry_t *)malloc(sizeof(export_atom_hash_entry_t));
if (!a) {
return;
}
a->val = at;
a->next = LOCAL_ExportAtomHashChain[hash];
LOCAL_ExportAtomHashChain[hash] = a;
LOCAL_ExportAtomHashTableNum++;
}
static void
LookupFunctor(Functor fun)
{
CELL hash = (CELL)(fun) % LOCAL_ExportFunctorHashTableSize;
export_functor_hash_entry_t *f;
Atom name = NameOfFunctor(fun);
UInt arity = ArityOfFunctor(fun);
f = LOCAL_ExportFunctorHashChain[hash];
while (f) {
if (f->name == name && f->arity == arity) {
return;
}
f = f->next;
}
f = (export_functor_hash_entry_t *)malloc(sizeof(export_functor_hash_entry_t));
if (!f) {
return;
}
LookupAtom(name);
f->val = fun;
f->name = name;
f->arity = arity;
f->next = LOCAL_ExportFunctorHashChain[hash];
LOCAL_ExportFunctorHashChain[hash] = f;
LOCAL_ExportFunctorHashTableNum++;
}
static void
LookupPredEntry(PredEntry *pe)
{
CELL hash = (CELL)(pe) % LOCAL_ExportPredEntryHashTableSize;
export_pred_entry_hash_entry_t *p;
UInt arity = pe->ArityOfPE;
p = LOCAL_ExportPredEntryHashChain[hash];
while (p) {
if (p->val == pe) {
return;
}
p = p->next;
}
p = (export_pred_entry_hash_entry_t *)malloc(sizeof(export_pred_entry_hash_entry_t));
if (!p) {
return;
}
p->arity = arity;
p->val = pe;
if (pe->ModuleOfPred != IDB_MODULE) {
if (arity) {
p->u.f = pe->FunctorOfPred;
LookupFunctor(pe->FunctorOfPred);
} else {
p->u.a = (Atom)(pe->FunctorOfPred);
LookupAtom((Atom)(pe->FunctorOfPred));
}
} else {
if (pe->PredFlags & AtomDBPredFlag) {
p->u.a = (Atom)(pe->FunctorOfPred);
p->arity = (CELL)(-2);
LookupAtom((Atom)(pe->FunctorOfPred));
} else if (!(pe->PredFlags & NumberDBPredFlag)) {
p->u.f = pe->FunctorOfPred;
p->arity = (CELL)(-1);
LookupFunctor(pe->FunctorOfPred);
} else {
p->u.f = pe->FunctorOfPred;
}
}
if (pe->ModuleOfPred) {
p->module = AtomOfTerm(pe->ModuleOfPred);
} else {
p->module = AtomProlog;
}
LookupAtom(p->module);
p->next = LOCAL_ExportPredEntryHashChain[hash];
LOCAL_ExportPredEntryHashChain[hash] = p;
LOCAL_ExportPredEntryHashTableNum++;
}
static void
LookupDBRef(DBRef ref)
{
CELL hash = Unsigned(ref) % LOCAL_ExportDBRefHashTableSize;
export_dbref_hash_entry_t *a;
a = LOCAL_ExportDBRefHashChain[hash];
while (a) {
if (a->val == ref) {
a->refs++;
return;
}
a = a->next;
}
a = (export_dbref_hash_entry_t *)malloc(sizeof(export_dbref_hash_entry_t));
if (!a) {
return;
}
a->val = ref;
a->sz = ((LogUpdClause *)ref)->ClSize;
a->refs = 1;
a->next = LOCAL_ExportDBRefHashChain[hash];
LOCAL_ExportDBRefHashChain[hash] = a;
LOCAL_ExportDBRefHashTableNum++;
}
static void
InitHash(void)
{
LOCAL_ExportFunctorHashTableNum = 0;
LOCAL_ExportFunctorHashTableSize = EXPORT_FUNCTOR_TABLE_SIZE;
LOCAL_ExportFunctorHashChain = (export_functor_hash_entry_t **)calloc(1, sizeof(export_functor_hash_entry_t *)* LOCAL_ExportFunctorHashTableSize);
LOCAL_ExportAtomHashTableNum = 0;
LOCAL_ExportAtomHashTableSize = EXPORT_ATOM_TABLE_SIZE;
LOCAL_ExportAtomHashChain = (export_atom_hash_entry_t **)calloc(1, sizeof(export_atom_hash_entry_t *)* LOCAL_ExportAtomHashTableSize);
LOCAL_ExportPredEntryHashTableNum = 0;
LOCAL_ExportPredEntryHashTableSize = EXPORT_PRED_ENTRY_TABLE_SIZE;
LOCAL_ExportPredEntryHashChain = (export_pred_entry_hash_entry_t **)calloc(1, sizeof(export_pred_entry_hash_entry_t *)* LOCAL_ExportPredEntryHashTableSize);
LOCAL_ExportDBRefHashTableNum = 0;
LOCAL_ExportDBRefHashTableSize = EXPORT_DBREF_TABLE_SIZE;
LOCAL_ExportDBRefHashChain = (export_dbref_hash_entry_t **)calloc(1, sizeof(export_dbref_hash_entry_t *)* LOCAL_ExportDBRefHashTableSize);
}
static void
CloseHash(void)
{
LOCAL_ExportFunctorHashTableNum = 0;
LOCAL_ExportFunctorHashTableSize = 0L;
free(LOCAL_ExportFunctorHashChain);
LOCAL_ExportAtomHashTableNum = 0;
LOCAL_ExportAtomHashTableSize = 0L;
free(LOCAL_ExportAtomHashChain);
LOCAL_ExportPredEntryHashTableNum = 0;
LOCAL_ExportPredEntryHashTableSize = 0L;
free(LOCAL_ExportPredEntryHashChain);
LOCAL_ExportDBRefHashTableNum = 0;
LOCAL_ExportDBRefHashTableSize = 0L;
free(LOCAL_ExportDBRefHashChain);
}
static inline Atom
AtomAdjust(Atom a)
{
LookupAtom(a);
return a;
}
static inline Functor
FuncAdjust(Functor f)
{
LookupFunctor(f);
return f;
}
static inline Term
AtomTermAdjust(Term t)
{
LookupAtom(AtomOfTerm(t));
return t;
}
static inline Term
TermToGlobalOrAtomAdjust(Term t)
{
if (t && IsAtomTerm(t))
return AtomTermAdjust(t);
return t;
}
#define IsOldCode(P) FALSE
#define IsOldCodeCellPtr(P) FALSE
#define IsOldDelay(P) FALSE
#define IsOldDelayPtr(P) FALSE
#define IsOldLocalInTR(P) FALSE
#define IsOldLocalInTRPtr(P) FALSE
#define IsOldGlobal(P) FALSE
#define IsOldGlobalPtr(P) FALSE
#define IsOldTrail(P) FALSE
#define IsOldTrailPtr(P) FALSE
#define CharP(X) ((char *)(X))
#define REINIT_LOCK(P)
#define REINIT_RWLOCK(P)
#define BlobTypeAdjust(P) (P)
#define NoAGCAtomAdjust(P) (P)
#define OrArgAdjust(P)
#define TabEntryAdjust(P)
#define IntegerAdjust(D) (D)
#define AddrAdjust(P) (P)
#define MFileAdjust(P) (P)
#define CodeVarAdjust(P) (P)
#define ConstantAdjust(P) (P)
#define ArityAdjust(P) (P)
#define DoubleInCodeAdjust(P)
#define IntegerInCodeAdjust(P)
#define OpcodeAdjust(P) (P)
static inline Term
ModuleAdjust(Term t)
{
if (!t) return t;
return AtomTermAdjust(t);
}
static inline PredEntry *
PredEntryAdjust(PredEntry *pe)
{
LookupPredEntry(pe);
return pe;
}
static inline PredEntry *
PtoPredAdjust(PredEntry *pe)
{
LookupPredEntry(pe);
return pe;
}
#define ExternalFunctionAdjust(P) (P)
#define DBRecordAdjust(P) (P)
#define ModEntryPtrAdjust(P) (P)
#define AtomEntryAdjust(P) (P)
#define GlobalEntryAdjust(P) (P)
#define BlobTermInCodeAdjust(P) (P)
#define CellPtoHeapAdjust(P) (P)
#define PtoAtomHashEntryAdjust(P) (P)
#define CellPtoHeapCellAdjust(P) (P)
#define CellPtoTRAdjust(P) (P)
#define CodeAddrAdjust(P) (P)
#define ConsultObjAdjust(P) (P)
#define DelayAddrAdjust(P) (P)
#define DelayAdjust(P) (P)
#define GlobalAdjust(P) (P)
#define DBRefAdjust(P) DBRefAdjust__(P PASS_REGS)
static inline DBRef
DBRefAdjust__ (DBRef dbt USES_REGS)
{
LookupDBRef(dbt);
return dbt;
}
#define DBRefPAdjust(P) (P)
#define DBTermAdjust(P) (P)
#define LUIndexAdjust(P) (P)
#define SIndexAdjust(P) (P)
#define LocalAddrAdjust(P) (P)
#define GlobalAddrAdjust(P) (P)
#define OpListAdjust(P) (P)
#define PtoLUCAdjust(P) (P)
#define PtoStCAdjust(P) (P)
#define PtoArrayEAdjust(P) (P)
#define PtoArraySAdjust(P) (P)
#define PtoGlobalEAdjust(P) (P)
#define PtoDelayAdjust(P) (P)
#define PtoGloAdjust(P) (P)
#define PtoLocAdjust(P) (P)
#define PtoHeapCellAdjust(P) (P)
#define TermToGlobalAdjust(P) (P)
#define PtoOpAdjust(P) (P)
#define PtoLUClauseAdjust(P) (P)
#define PtoLUIndexAdjust(P) (P)
#define PtoDBTLAdjust(P) (P)
#define PtoPtoPredAdjust(P) (P)
#define OpRTableAdjust(P) (P)
#define OpEntryAdjust(P) (P)
#define PropAdjust(P) (P)
#define TrailAddrAdjust(P) (P)
#define XAdjust(P) (P)
#define YAdjust(P) (P)
#define HoldEntryAdjust(P) (P)
#define CodeCharPAdjust(P) (P)
#define CodeVoidPAdjust(P) (P)
#define HaltHookAdjust(P) (P)
#define recompute_mask(dbr)
#define rehash(oldcode, NOfE, KindOfEntries)
#define RestoreSWIHash()
#include "rheap.h"
static void
RestoreHashPreds( USES_REGS1 )
{
}
static void
RestoreAtomList(Atom atm USES_REGS)
{
}
static size_t save_bytes(IOSTREAM *stream, void *ptr, size_t sz)
{
return Sfwrite(ptr, sz, 1, stream);
}
static size_t save_byte(IOSTREAM *stream, int byte)
{
Sputc(byte, stream);
return 1;
}
static size_t save_bits16(IOSTREAM *stream, BITS16 val)
{
BITS16 v = val;
return save_bytes(stream, &v, sizeof(BITS16));
}
static size_t save_uint(IOSTREAM *stream, UInt val)
{
UInt v = val;
return save_bytes(stream, &v, sizeof(UInt));
}
static size_t save_int(IOSTREAM *stream, int val)
{
UInt v = val;
return save_bytes(stream, &v, sizeof(int));
}
static size_t save_tag(IOSTREAM *stream, qlf_tag_t tag)
{
return save_byte(stream, tag);
}
static int
SaveHash(IOSTREAM *stream)
{
UInt i;
/* first, current opcodes */
CHECK(save_tag(stream, QLY_START_X));
save_uint(stream, (UInt)&ARG1);
CHECK(save_tag(stream, QLY_START_OPCODES));
save_int(stream, _std_top);
for (i= 0; i <= _std_top; i++) {
save_uint(stream, (UInt)Yap_opcode(i));
}
CHECK(save_tag(stream, QLY_START_ATOMS));
CHECK(save_uint(stream, LOCAL_ExportAtomHashTableNum));
for (i = 0; i < LOCAL_ExportAtomHashTableSize; i++) {
export_atom_hash_entry_t *a = LOCAL_ExportAtomHashChain[i];
while (a) {
export_atom_hash_entry_t *a0 = a;
Atom at = a->val;
CHECK(save_uint(stream, (UInt)at));
if (IsWideAtom(at)) {
CHECK(save_tag(stream, QLY_ATOM_WIDE));
CHECK(save_uint(stream, wcslen(RepAtom(at)->WStrOfAE)));
CHECK(save_bytes(stream, at->WStrOfAE, (wcslen(at->WStrOfAE)+1)*sizeof(wchar_t)));
} else {
CHECK(save_tag(stream, QLY_ATOM));
CHECK(save_uint(stream, strlen(RepAtom(at)->StrOfAE)));
CHECK(save_bytes(stream, at->StrOfAE, (strlen(at->StrOfAE)+1)*sizeof(char)));
}
a = a->next;
free(a0);
}
}
save_tag(stream, QLY_START_FUNCTORS);
save_uint(stream, LOCAL_ExportFunctorHashTableNum);
for (i = 0; i < LOCAL_ExportFunctorHashTableSize; i++) {
export_functor_hash_entry_t *f = LOCAL_ExportFunctorHashChain[i];
while (f) {
export_functor_hash_entry_t *f0 = f;
CHECK(save_uint(stream, (UInt)(f->val)));
CHECK(save_uint(stream, f->arity));
CHECK(save_uint(stream, (CELL)(f->name)));
f = f->next;
free(f0);
}
}
save_tag(stream, QLY_START_PRED_ENTRIES);
save_uint(stream, LOCAL_ExportPredEntryHashTableNum);
for (i = 0; i < LOCAL_ExportPredEntryHashTableSize; i++) {
export_pred_entry_hash_entry_t *p = LOCAL_ExportPredEntryHashChain[i];
while (p) {
export_pred_entry_hash_entry_t *p0 = p;
CHECK(save_uint(stream, (UInt)(p->val)));
CHECK(save_uint(stream, p->arity));
CHECK(save_uint(stream, (UInt)p->module));
CHECK(save_uint(stream, (UInt)p->u.f));
p = p->next;
free(p0);
}
}
save_tag(stream, QLY_START_DBREFS);
save_uint(stream, LOCAL_ExportDBRefHashTableNum);
for (i = 0; i < LOCAL_ExportDBRefHashTableSize; i++) {
export_dbref_hash_entry_t *p = LOCAL_ExportDBRefHashChain[i];
while (p) {
export_dbref_hash_entry_t *p0 = p;
CHECK(save_uint(stream, (UInt)(p->val)));
CHECK(save_uint(stream, p->sz));
CHECK(save_uint(stream, p->refs));
p = p->next;
free(p0);
}
}
save_tag(stream, QLY_FAILCODE);
save_uint(stream, (UInt)FAILCODE);
return 1;
}
static size_t
save_clauses(IOSTREAM *stream, PredEntry *pp) {
yamop *FirstC, *LastC;
FirstC = pp->cs.p_code.FirstClause;
LastC = pp->cs.p_code.LastClause;
if (FirstC == NULL && LastC == NULL) {
return 1;
}
if (pp->PredFlags & LogUpdatePredFlag) {
LogUpdClause *cl = ClauseCodeToLogUpdClause(FirstC);
while (cl != NULL) {
if (pp->TimeStampOfPred >= cl->ClTimeStart &&
pp->TimeStampOfPred <= cl->ClTimeEnd) {
UInt size = cl->ClSize;
CHECK(save_tag(stream, QLY_START_LU_CLAUSE));
CHECK(save_uint(stream, (UInt)cl));
CHECK(save_uint(stream, size));
CHECK(save_bytes(stream, cl, size));
}
cl = cl->ClNext;
}
CHECK(save_tag(stream, QLY_END_LU_CLAUSES));
} else if (pp->PredFlags & MegaClausePredFlag) {
MegaClause *cl = ClauseCodeToMegaClause(FirstC);
UInt size = cl->ClSize;
CHECK(save_uint(stream, (UInt)cl));
CHECK(save_uint(stream, size));
CHECK(save_bytes(stream, cl, size));
} else if (pp->PredFlags & DynamicPredFlag) {
yamop *cl = FirstC;
do {
DynamicClause *dcl = ClauseCodeToDynamicClause(cl);
UInt size = dcl->ClSize;
CHECK(save_uint(stream, (UInt)cl));
CHECK(save_uint(stream, size));
CHECK(save_bytes(stream, dcl, size));
if (cl == LastC) return 1;
cl = NextDynamicClause(cl);
} while (TRUE);
} else {
StaticClause *cl = ClauseCodeToStaticClause(FirstC);
if (pp->PredFlags & SYSTEM_PRED_FLAGS) {
return 1;
}
do {
UInt size = cl->ClSize;
CHECK(save_uint(stream, (UInt)cl));
CHECK(save_uint(stream, size));
CHECK(save_bytes(stream, cl, size));
if (cl->ClCode == LastC) return 1;
cl = cl->ClNext;
} while (TRUE);
}
return 1;
}
static size_t
save_pred(IOSTREAM *stream, PredEntry *ap) {
CHECK(save_uint(stream, (UInt)ap));
CHECK(save_uint(stream, ap->PredFlags));
CHECK(save_uint(stream, ap->cs.p_code.NOfClauses));
CHECK(save_uint(stream, ap->src.IndxId));
return save_clauses(stream, 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);
}
} else {
CleanClauses(pp->cs.p_code.FirstClause, pp->cs.p_code.LastClause, pp PASS_REGS);
}
return TRUE;
}
static size_t
mark_pred(PredEntry *ap)
{
if (ap->ModuleOfPred != IDB_MODULE) {
if (ap->ArityOfPE) {
FuncAdjust(ap->FunctorOfPred);
} else {
AtomAdjust((Atom)(ap->FunctorOfPred));
}
} else {
if (ap->PredFlags & AtomDBPredFlag) {
AtomAdjust((Atom)(ap->FunctorOfPred));
} else if (!(ap->PredFlags & NumberDBPredFlag)) {
FuncAdjust(ap->FunctorOfPred);
}
}
if (!(ap->PredFlags & (MultiFileFlag|NumberDBPredFlag)) &&
ap->src.OwnerFile) {
AtomAdjust(ap->src.OwnerFile);
}
CHECK(clean_pred(ap PASS_REGS));
return 1;
}
static size_t
mark_ops(IOSTREAM *stream, Term mod) {
OpEntry *op = OpList;
while (op) {
if (!mod || op->OpModule == mod) {
AtomAdjust(op->OpName);
if (op->OpModule)
AtomTermAdjust(op->OpModule);
}
op = op->OpNext;
}
return 1;
}
static size_t
save_ops(IOSTREAM *stream, Term mod) {
OpEntry *op = OpList;
while (op) {
if (!mod || op->OpModule == mod) {
CHECK(save_tag(stream, QLY_NEW_OP));
save_uint(stream, (UInt)op->OpName);
save_uint(stream, (UInt)op->OpModule);
save_bits16(stream, op->Prefix);
save_bits16(stream, op->Infix);
save_bits16(stream, op->Posfix);
}
op = op->OpNext;
}
CHECK(save_tag(stream, QLY_END_OPS));
return 1;
}
static size_t
save_module(IOSTREAM *stream, Term mod) {
CACHE_REGS
PredEntry *ap = Yap_ModulePred(mod);
InitHash();
ModuleAdjust(mod);
while (ap) {
ap = PredEntryAdjust(ap);
CHECK(mark_pred(ap));
ap = ap->NextPredOfModule;
}
/* just to make sure */
mark_ops(stream, mod);
SaveHash(stream);
CHECK(save_tag(stream, QLY_START_MODULE));
CHECK(save_uint(stream, (UInt)mod));
ap = Yap_ModulePred(mod);
while (ap) {
CHECK(save_tag(stream, QLY_START_PREDICATE));
CHECK(save_pred(stream, ap));
ap = ap->NextPredOfModule;
}
CHECK(save_tag(stream, QLY_END_PREDICATES));
CHECK(save_tag(stream, QLY_END_MODULES));
save_ops(stream, mod);
CloseHash();
return 1;
}
static int
save_header(IOSTREAM *stream)
{
char msg[256];
sprintf(msg, "#!/bin/sh\nexec_dir=${YAPBINDIR:-%s}\nexec $exec_dir/yap $0 \"$@\"\n%s", YAP_BINDIR, YAP_SVERSION);
return save_bytes(stream, msg, strlen(msg)+1);
}
static size_t
save_program(IOSTREAM *stream) {
CACHE_REGS
ModEntry *me = CurrentModules;
InitHash();
save_header( stream );
/* should we allow the user to see hidden predicates? */
while (me) {
PredEntry *pp;
pp = me->PredForME;
AtomAdjust(me->AtomOfME);
while (pp != NULL) {
pp = PredEntryAdjust(pp);
CHECK(mark_pred(pp));
pp = pp->NextPredOfModule;
}
me = me->NextME;
}
/* just to make sure */
mark_ops(stream, 0);
SaveHash(stream);
me = CurrentModules;
while (me) {
PredEntry *pp;
pp = me->PredForME;
CHECK(save_tag(stream, QLY_START_MODULE));
CHECK(save_uint(stream, (UInt)MkAtomTerm(me->AtomOfME)));
while (pp != NULL) {
CHECK(save_tag(stream, QLY_START_PREDICATE));
CHECK(save_pred(stream, pp));
pp = pp->NextPredOfModule;
}
CHECK(save_tag(stream, QLY_END_PREDICATES));
me = me->NextME;
}
CHECK(save_tag(stream, QLY_END_MODULES));
save_ops(stream, 0);
CloseHash();
return 1;
}
static Int
p_save_module_preds( USES_REGS1 )
{
IOSTREAM *stream;
Term tmod = Deref(ARG2);
if (!Yap_getOutputStream(Yap_InitSlot(Deref(ARG1) PASS_REGS), &stream)) {
return FALSE;
}
if (IsVarTerm(tmod)) {
Yap_Error(INSTANTIATION_ERROR,tmod,"save_module/2");
return FALSE;
}
if (!IsAtomTerm(tmod)) {
Yap_Error(TYPE_ERROR_ATOM,tmod,"save_module/2");
return FALSE;
}
return save_module(stream, tmod) != 0;
}
static Int
p_save_program( USES_REGS1 )
{
IOSTREAM *stream;
if (!Yap_getOutputStream(Yap_InitSlot(Deref(ARG1) PASS_REGS), &stream)) {
return FALSE;
}
return save_program(stream) != 0;
}
void Yap_InitQLY(void)
{
Yap_InitCPred("$qsave_module_preds", 2, p_save_module_preds, SyncPredFlag|HiddenPredFlag|UserCPredFlag);
Yap_InitCPred("$qsave_program", 1, p_save_program, SyncPredFlag|HiddenPredFlag|UserCPredFlag);
if (FALSE) {
restore_codes();
}
}

45
C/save.c Executable file → Normal file
View File

@ -18,6 +18,7 @@
static char SccsId[] = "@(#)save.c 1.3 3/15/90";
#endif
#include "SWI-Stream.h"
#if _MSC_VER || defined(__MINGW32__)
#include <windows.h>
#include <psapi.h>
@ -122,7 +123,7 @@ STATIC_PROTO(void restore_heap, (void));
STATIC_PROTO(void ShowAtoms, (void));
STATIC_PROTO(void ShowEntries, (PropEntry *));
#endif
STATIC_PROTO(int OpenRestore, (char *, char *, CELL *, CELL *, CELL *, CELL *));
STATIC_PROTO(int OpenRestore, (char *, char *, CELL *, CELL *, CELL *, CELL *, IOSTREAM **));
STATIC_PROTO(void CloseRestore, (void));
#ifndef _WIN32
STATIC_PROTO(int check_opcodes, (OPCODE []));
@ -1414,10 +1415,15 @@ cat_file_name(char *s, char *prefix, char *name, unsigned int max_length)
strncat(s, name, max_length-1);
}
static int try_open(char *inpf, CELL *Astate, CELL *ATrail, CELL *AStack, CELL *AHeap, char *buf) {
static int try_open(char *inpf, CELL *Astate, CELL *ATrail, CELL *AStack, CELL *AHeap, char *buf, IOSTREAM **streamp) {
int mode;
if (streamp) {
if ((*streamp = Sopen_file(inpf, "rb"))) {
return DO_ONLY_CODE;
}
return FAIL_RESTORE;
}
if ((splfild = open_file(inpf, O_RDONLY)) < 0) {
return FAIL_RESTORE;
}
@ -1432,11 +1438,13 @@ static int try_open(char *inpf, CELL *Astate, CELL *ATrail, CELL *AStack, CELL *
}
static int
OpenRestore(char *inpf, char *YapLibDir, CELL *Astate, CELL *ATrail, CELL *AStack, CELL *AHeap)
OpenRestore(char *inpf, char *YapLibDir, CELL *Astate, CELL *ATrail, CELL *AStack, CELL *AHeap, IOSTREAM **streamp)
{
CACHE_REGS
int mode = FAIL_RESTORE;
char save_buffer[YAP_FILENAME_MAX+1];
save_buffer[0] = '\0';
// LOCAL_ErrorMessage = NULL;
if (inpf == NULL) {
#if _MSC_VER || defined(__MINGW32__)
@ -1462,7 +1470,7 @@ OpenRestore(char *inpf, char *YapLibDir, CELL *Astate, CELL *ATrail, CELL *AStac
strncat(LOCAL_FileNameBuf, inpf, YAP_FILENAME_MAX-1);
}
if (inpf != NULL && (splfild = open_file(inpf, O_RDONLY)) > 0) {
if ((mode = try_open(inpf,Astate,ATrail,AStack,AHeap,save_buffer)) != FAIL_RESTORE) {
if ((mode = try_open(inpf,Astate,ATrail,AStack,AHeap,save_buffer,streamp)) != FAIL_RESTORE) {
return mode;
}
}
@ -1473,11 +1481,11 @@ OpenRestore(char *inpf, char *YapLibDir, CELL *Astate, CELL *ATrail, CELL *AStac
*/
if (YapLibDir != NULL) {
cat_file_name(LOCAL_FileNameBuf, Yap_LibDir, inpf, YAP_FILENAME_MAX);
if ((mode = try_open(LOCAL_FileNameBuf,Astate,ATrail,AStack,AHeap,save_buffer)) != FAIL_RESTORE) {
if ((mode = try_open(LOCAL_FileNameBuf,Astate,ATrail,AStack,AHeap,save_buffer,streamp)) != FAIL_RESTORE) {
return mode;
}
} else {
if ((mode = try_open(LOCAL_FileNameBuf,Astate,ATrail,AStack,AHeap,save_buffer)) != FAIL_RESTORE) {
if ((mode = try_open(LOCAL_FileNameBuf,Astate,ATrail,AStack,AHeap,save_buffer,streamp)) != FAIL_RESTORE) {
return mode;
}
}
@ -1486,7 +1494,7 @@ OpenRestore(char *inpf, char *YapLibDir, CELL *Astate, CELL *ATrail, CELL *AStac
char *yap_env = getenv("YAPLIBDIR");
if (yap_env != NULL) {
cat_file_name(LOCAL_FileNameBuf, yap_env, inpf, YAP_FILENAME_MAX);
if ((mode = try_open(LOCAL_FileNameBuf,Astate,ATrail,AStack,AHeap,save_buffer)) != FAIL_RESTORE) {
if ((mode = try_open(LOCAL_FileNameBuf,Astate,ATrail,AStack,AHeap,save_buffer,streamp)) != FAIL_RESTORE) {
return mode;
}
}
@ -1495,7 +1503,7 @@ OpenRestore(char *inpf, char *YapLibDir, CELL *Astate, CELL *ATrail, CELL *AStac
if (YAP_LIBDIR != NULL) {
cat_file_name(LOCAL_FileNameBuf, YAP_LIBDIR, inpf, YAP_FILENAME_MAX);
if ((splfild = open_file(LOCAL_FileNameBuf, O_RDONLY)) > 0) {
if ((mode = try_open(LOCAL_FileNameBuf,Astate,ATrail,AStack,AHeap,save_buffer)) != FAIL_RESTORE) {
if ((mode = try_open(LOCAL_FileNameBuf,Astate,ATrail,AStack,AHeap,save_buffer,streamp)) != FAIL_RESTORE) {
return mode;
}
}
@ -1535,7 +1543,7 @@ OpenRestore(char *inpf, char *YapLibDir, CELL *Astate, CELL *ATrail, CELL *AStac
pt[1] = '\0';
strncat(LOCAL_FileNameBuf,"lib/Yap/startup.yss",YAP_FILENAME_MAX);
}
if ((mode = try_open(LOCAL_FileNameBuf,Astate,ATrail,AStack,AHeap,save_buffer)) != FAIL_RESTORE) {
if ((mode = try_open(LOCAL_FileNameBuf,Astate,ATrail,AStack,AHeap,save_buffer,streamp)) != FAIL_RESTORE) {
return mode;
}
}
@ -1555,6 +1563,15 @@ OpenRestore(char *inpf, char *YapLibDir, CELL *Astate, CELL *ATrail, CELL *AStac
return FAIL_RESTORE;
}
IOSTREAM *
Yap_OpenRestore(char *inpf, char *YapLibDir)
{
IOSTREAM *stream = NULL;
OpenRestore(inpf, YapLibDir, NULL, NULL, NULL, NULL, &stream);
return stream;
}
static void
CloseRestore(void)
{
@ -1634,10 +1651,12 @@ RestoreHeap(OPCODE old_ops[] USES_REGS)
int
Yap_SavedInfo(char *FileName, char *YapLibDir, CELL *ATrail, CELL *AStack, CELL *AHeap)
{
return DO_ONLY_CODE;
CELL MyTrail, MyStack, MyHeap, MyState;
int mode;
mode = OpenRestore(FileName, YapLibDir, &MyState, &MyTrail, &MyStack, &MyHeap);
mode = OpenRestore(FileName, YapLibDir, &MyState, &MyTrail, &MyStack, &MyHeap, NULL);
if (mode == FAIL_RESTORE) {
return -1;
}
@ -1728,7 +1747,7 @@ Restore(char *s, char *lib_dir USES_REGS)
OPCODE old_ops[_std_top+1];
CELL MyTrail, MyStack, MyHeap, MyState;
if ((restore_mode = OpenRestore(s, lib_dir, &MyState, &MyTrail, &MyStack, &MyHeap)) == FAIL_RESTORE)
if ((restore_mode = OpenRestore(s, lib_dir, &MyState, &MyTrail, &MyStack, &MyHeap, NULL)) == FAIL_RESTORE)
return(FALSE);
Yap_ShutdownLoadForeign();
in_limbo = TRUE;
@ -1782,7 +1801,7 @@ Restore(char *s, char *lib_dir USES_REGS)
}
int
Yap_Restore(char *s, char *lib_dir)
Yap_SavedStateRestore(char *s, char *lib_dir)
{
CACHE_REGS
return Restore(s, lib_dir PASS_REGS);

29
C/scanner.c Executable file → Normal file
View File

@ -1260,13 +1260,32 @@ Yap_tokenizer(IOSTREAM *inp_stream, int store_comments, Term *tposp)
while ((ch = getchr(inp_stream)) != 10 && chtype(ch) != EF);
t->Tok = Ord(kind = eot_tok);
} else {
Atom ae;
TokImage = ((AtomEntry *) ( Yap_PreAllocCodeSpace()))->StrOfAE;
charp = TokImage;
*charp++ = och;
for (; chtype(ch) == SY; ch = getchr(inp_stream))
*charp++ = ch;
*charp = '\0';
t->TokInfo = Unsigned(Yap_LookupAtom(TokImage));
wcharp = NULL;
add_ch_to_buff(och);
for (; chtype(ch) == SY; ch = getchr(inp_stream)) {
if (charp == (char *)AuxSp-1024) {
goto huge_var_error;
}
add_ch_to_buff(ch);
}
add_ch_to_buff('\0');
if (wcharp) {
ae = Yap_LookupWideAtom((wchar_t *)TokImage);
} else {
ae = Yap_LookupAtom(TokImage);
}
if (ae == NIL) {
LOCAL_Error_TYPE = OUT_OF_HEAP_ERROR;
LOCAL_ErrorMessage = "Code Space Overflow";
if (p)
t->Tok = Ord(kind = eot_tok);
/* serious error now */
return l;
}
t->TokInfo = Unsigned(ae);
if (t->TokInfo == (CELL)NIL) {
LOCAL_Error_TYPE = OUT_OF_HEAP_ERROR;
LOCAL_ErrorMessage = "Code Space Overflow";

2
C/stdpreds.c Executable file → Normal file
View File

@ -4481,6 +4481,8 @@ Yap_InitCPreds(void)
Yap_InitSavePreds();
Yap_InitSysPreds();
Yap_InitUnify();
Yap_InitQLY();
Yap_InitQLYR();
#if defined CUT_C && defined MYDDAS_MYSQL
Yap_InitMYDDAS_MySQLPreds();
#endif

0
C/sysbits.c Executable file → Normal file
View File

0
C/threads.c Executable file → Normal file
View File

8
C/tracer.c Executable file → Normal file
View File

@ -23,6 +23,7 @@
#include "YapHeap.h"
#include "attvar.h"
#include "yapio.h"
#include "clause.h"
#include "tracer.h"
STATIC_PROTO(int TracePutchar, (int, int));
@ -167,6 +168,13 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
LOCAL_ThreadHandle.thread_inst_count++;
#endif
#ifdef COMMENTED
{
choiceptr b_p = B;
while (b_p) {
fprintf(stderr,"%p %ld\n",b_p,Yap_op_from_opcode(b_p->cp_ap->opc));
b_p = b_p->cp_b;
}
}
{ choiceptr myB = B;
while (myB) myB = myB->cp_b;
}

View File

@ -686,9 +686,8 @@ p_softfunctor()
WRITE_LOCK(RepAtom(a)->ARWLock);
if ((p0 = Yap_GetAProp(a, SFProperty)) == NIL) {
pe = (SFEntry *) Yap_AllocAtomSpace(sizeof(*pe));
pe->NextOfPE = RepAtom(a)->PropsOfAE;
pe->KindOfPE = SFProperty;
RepAtom(a)->PropsOfAE = AbsSFProp(pe);
AddPropToAtom(RepAtom(a), (PropEntry *)pe);
} else
pe = RepSFProp(p0);
WRITE_UNLOCK(RepAtom(a)->ARWLock);

0
C/write.c Executable file → Normal file
View File

0
COPYING Executable file → Normal file
View File

0
CVSROOT/syncmail Executable file → Normal file
View File

0
H/TermExt.h Executable file → Normal file
View File

10
H/Yap.h Executable file → Normal file
View File

@ -691,7 +691,13 @@ typedef enum
if you place things in the lower addresses (power to the libc people).
*/
#if (defined(_AIX) || (defined(__APPLE__) && !defined(__LP64__)) || defined(_WIN32) || defined(sparc) || defined(__sparc) || defined(mips) || defined(__FreeBSD__) || defined(_POWER) || defined(__POWERPC__) || defined(__linux__) || defined(IN_SECOND_QUADRANT) || defined(__CYGWIN__)) || defined(__NetBSD__) || defined(__DragonFly__)
#if defined(__APPLE__)
/* mmap on __APPLE__ is not the greatest idea. It overwrites memory allocated by malloc */
#undef USE_DL_MALLOC
#ifndef USE_SYSTEM_MALLOC
#define USE_SYSTEM_MALLOC 1
#endif
#elif (defined(_AIX) || (defined(__APPLE__) && !defined(__LP64__)) || defined(_WIN32) || defined(sparc) || defined(__sparc) || defined(mips) || defined(__FreeBSD__) || defined(_POWER) || defined(__POWERPC__) || defined(__linux__) || defined(IN_SECOND_QUADRANT) || defined(__CYGWIN__)) || defined(__NetBSD__) || defined(__DragonFly__)
#define USE_LOW32_TAGS 1
#endif
@ -1377,6 +1383,8 @@ Yap_StartSlots( USES_REGS1 ) {
static inline void
Yap_CloseSlots( USES_REGS1 ) {
Int old_slots;
if (CurSlot < LCL0-ASP)
return;
old_slots = IntOfTerm(ASP[0]);
ASP += (old_slots+1);
CurSlot = IntOfTerm(*ASP);

0
H/YapHeap.h Executable file → Normal file
View File

View File

@ -24,7 +24,7 @@
OPCODE(alloc_for_logical_pred ,L),
OPCODE(copy_idb_term ,e),
OPCODE(unify_idb_term ,e),
OPCODE(ensure_space ,Osbpi),
OPCODE(ensure_space ,Osbpa),
OPCODE(spy_or_trymark ,Otapl),
OPCODE(try_and_mark ,Otapl),
OPCODE(count_retry_and_mark ,Otapl),

17
H/Yapproto.h Executable file → Normal file
View File

@ -58,7 +58,7 @@ Term STD_PROTO(Yap_NWideStringToListOfAtoms,(wchar_t *, size_t));
Term STD_PROTO(Yap_NWideStringToDiffListOfAtoms,(wchar_t *, Term, size_t));
int STD_PROTO(Yap_AtomIncreaseHold,(Atom));
int STD_PROTO(Yap_AtomDecreaseHold,(Atom));
struct operator_entry *STD_PROTO(Yap_OpPropForModule,(Atom, Term));
Int STD_PROTO(Yap_InitSlot,(Term CACHE_TYPE));
Int STD_PROTO(Yap_NewSlots,(int CACHE_TYPE));
int STD_PROTO(Yap_RecoverSlots,(int CACHE_TYPE));
@ -136,6 +136,7 @@ void STD_PROTO(Yap_Abolish,(struct pred_entry *));
void STD_PROTO(Yap_BuildMegaClause,(struct pred_entry *));
void STD_PROTO(Yap_EraseMegaClause,(yamop *,struct pred_entry *));
void STD_PROTO(Yap_ResetConsultStack,(void));
void STD_PROTO(Yap_AssertzClause,(struct pred_entry *, yamop *));
/* cmppreds.c */
@ -307,9 +308,15 @@ Term STD_PROTO(Yap_Parse,(void));
/* readutil.c */
void STD_PROTO(Yap_InitReadUtil,(void));
/* qly.c */
void STD_PROTO(Yap_InitQLY,(void));
int STD_PROTO(Yap_Restore,(char *, char *));
void STD_PROTO(Yap_InitQLYR,(void));
/* save.c */
int STD_PROTO(Yap_SavedInfo,(char *,char *,CELL *,CELL *,CELL *));
int STD_PROTO(Yap_Restore,(char *, char *));
int STD_PROTO(Yap_SavedStateRestore,(char *, char *));
struct io_stream *STD_PROTO(Yap_OpenRestore,(char *, char *));
void STD_PROTO(Yap_InitSavePreds,(void));
/* scanner.c */
@ -487,3 +494,9 @@ gc_P(yamop *p, yamop *cp)
{
return (p->opc == Yap_opcode(_execute_cpred) ? cp : p);
}
#ifdef _PL_STREAM_H
extern int Yap_getInputStream(Int t, IOSTREAM **s);
extern int Yap_getOutputStream(Int t, IOSTREAM **s);
#endif

114
H/Yatom.h Executable file → Normal file
View File

@ -674,7 +674,7 @@ typedef enum
TabledPredFlag = 0x00000040L, /* is tabled */
SequentialPredFlag = 0x00000020L, /* may not create parallel choice points! */
ProfiledPredFlag = 0x00000010L, /* pred is being profiled */
MyddasPredFlag = 0x00000008L, /* Myddas Imported pred */
BackCPredFlag = 0x00000008L, /* Myddas Imported pred */
ModuleTransparentPredFlag = 0x00000004L, /* ModuleTransparent pred */
SWIEnvPredFlag = 0x00000002L, /* new SWI interface */
UDIPredFlag = 0x00000001L /* User Defined Indexing */
@ -708,7 +708,7 @@ typedef struct pred_entry
struct yami *CodeOfPred;
OPCODE OpcodeOfPred; /* undefcode, indexcode, spycode, .... */
CELL PredFlags;
unsigned int ArityOfPE; /* arity of property */
UInt ArityOfPE; /* arity of property */
union
{
struct
@ -727,7 +727,6 @@ typedef struct pred_entry
{
Atom OwnerFile; /* File where the predicate was defined */
Int IndxId; /* Index for a certain key */
struct mfile *file_srcs; /* for multifile predicates */
} src;
#if defined(YAPOR) || defined(THREADS)
lockvar PELock; /* a simple lock to protect expansion */
@ -1481,6 +1480,9 @@ PRED_HASH(FunctorEntry *fe, Term cur_mod, UInt size)
return (((CELL)fe+cur_mod)>>2) % size;
}
EXTERN inline Prop STD_PROTO(GetPredPropByFuncAndModHavingLock, (FunctorEntry *, Term));
EXTERN inline Prop STD_PROTO(PredPropByFuncAndMod, (FunctorEntry *, Term));
EXTERN inline Prop STD_PROTO(PredPropByAtomAndMod, (Atom, Term));
EXTERN inline Prop STD_PROTO(GetPredPropByFuncHavingLock, (FunctorEntry *, Term));
#ifdef THREADS
@ -1565,6 +1567,64 @@ PredPropByFunc (Functor fe, Term cur_mod)
return Yap_NewPredPropByFunctor (fe, cur_mod);
}
EXTERN inline Prop
GetPredPropByFuncAndModHavingLock (FunctorEntry *fe, Term cur_mod)
{
PredEntry *p;
if (!(p = RepPredProp(fe->PropsOfFE))) {
return NIL;
}
if (p->ModuleOfPred == cur_mod) {
#ifdef THREADS
/* Thread Local Predicates */
if (p->PredFlags & ThreadLocalPredFlag) {
return AbsPredProp (Yap_GetThreadPred (p INIT_REGS));
}
#endif
return AbsPredProp(p);
}
if (p->NextOfPE) {
UInt hash = PRED_HASH(fe,cur_mod,PredHashTableSize);
READ_LOCK(PredHashRWLock);
p = PredHash[hash];
while (p) {
if (p->FunctorOfPred == fe &&
p->ModuleOfPred == cur_mod)
{
#ifdef THREADS
/* Thread Local Predicates */
if (p->PredFlags & ThreadLocalPredFlag) {
READ_UNLOCK(PredHashRWLock);
return AbsPredProp (Yap_GetThreadPred (p INIT_REGS));
}
#endif
READ_UNLOCK(PredHashRWLock);
return AbsPredProp(p);
}
p = RepPredProp(p->NextOfPE);
}
READ_UNLOCK(PredHashRWLock);
}
return NIL;
}
EXTERN inline Prop
PredPropByFuncAndMod (Functor fe, Term cur_mod)
/* get predicate entry for ap/arity; create it if neccessary. */
{
Prop p0;
WRITE_LOCK (fe->FRWLock);
p0 = GetPredPropByFuncAndModHavingLock(fe, cur_mod);
if (p0) {
WRITE_UNLOCK (fe->FRWLock);
return p0;
}
return Yap_NewPredPropByFunctor (fe, cur_mod);
}
EXTERN inline Prop
PredPropByAtom (Atom at, Term cur_mod)
/* get predicate entry for ap/arity; create it if neccessary. */
@ -1596,6 +1656,37 @@ PredPropByAtom (Atom at, Term cur_mod)
return Yap_NewPredPropByAtom (ae, cur_mod);
}
EXTERN inline Prop
PredPropByAtomAndMod (Atom at, Term cur_mod)
/* get predicate entry for ap/arity; create it if neccessary. */
{
Prop p0;
AtomEntry *ae = RepAtom (at);
WRITE_LOCK (ae->ARWLock);
p0 = ae->PropsOfAE;
while (p0)
{
PredEntry *pe = RepPredProp (p0);
if (pe->KindOfPE == PEProp &&
(pe->ModuleOfPred == cur_mod))
{
#ifdef THREADS
/* Thread Local Predicates */
if (pe->PredFlags & ThreadLocalPredFlag)
{
WRITE_UNLOCK (ae->ARWLock);
return AbsPredProp (Yap_GetThreadPred (pe INIT_REGS));
}
#endif
WRITE_UNLOCK (ae->ARWLock);
return (p0);
}
p0 = pe->NextOfPE;
}
return Yap_NewPredPropByAtom (ae, cur_mod);
}
#if DEBUG_PELOCKING
#define PELOCK(I,Z) \
{ LOCK((Z)->PELock); (Z)->StatisticsForPred.NOfEntries=(I);(Z)->StatisticsForPred.NOfHeadSuccesses=pthread_self(); }
@ -1606,5 +1697,22 @@ PredPropByAtom (Atom at, Term cur_mod)
#define UNLOCKPE(I,Z) UNLOCK((Z)->PELock)
#endif
EXTERN inline void STD_PROTO(AddPropToAtom, (AtomEntry *, PropEntry *p));
EXTERN inline void
AddPropToAtom(AtomEntry *ae, PropEntry *p)
{
/* old properties should be always last, and wide atom properties
should always be first */
if (ae->PropsOfAE != NIL &&
RepProp(ae->PropsOfAE)->KindOfPE == WideAtomProperty) {
PropEntry *pp = RepProp(ae->PropsOfAE);
p->NextOfPE = pp->NextOfPE;
pp->NextOfPE = AbsProp(p);
} else {
p->NextOfPE = ae->PropsOfAE;
ae->PropsOfAE = AbsProp(p);
}
}
#endif

0
H/alloc.h Executable file → Normal file
View File

View File

@ -693,7 +693,7 @@ typedef struct yami {
struct pred_entry *p;
Int i;
CELL next;
} Osbpi;
} Osbpa;
struct {
#ifdef YAPOR
unsigned int or_arg;

0
H/compile.h Executable file → Normal file
View File

0
H/cut_c.h Executable file → Normal file
View File

0
H/dlmalloc.h Executable file → Normal file
View File

View File

@ -329,3 +329,58 @@
#define REMOTE_do_trace_primitives(wid) REMOTE(wid)->do_trace_primitives_
#endif
#define LOCAL_ExportAtomHashChain LOCAL->ExportAtomHashChain_
#define REMOTE_ExportAtomHashChain(wid) REMOTE(wid)->ExportAtomHashChain_
#define LOCAL_ExportAtomHashTableSize LOCAL->ExportAtomHashTableSize_
#define REMOTE_ExportAtomHashTableSize(wid) REMOTE(wid)->ExportAtomHashTableSize_
#define LOCAL_ExportAtomHashTableNum LOCAL->ExportAtomHashTableNum_
#define REMOTE_ExportAtomHashTableNum(wid) REMOTE(wid)->ExportAtomHashTableNum_
#define LOCAL_ExportFunctorHashChain LOCAL->ExportFunctorHashChain_
#define REMOTE_ExportFunctorHashChain(wid) REMOTE(wid)->ExportFunctorHashChain_
#define LOCAL_ExportFunctorHashTableSize LOCAL->ExportFunctorHashTableSize_
#define REMOTE_ExportFunctorHashTableSize(wid) REMOTE(wid)->ExportFunctorHashTableSize_
#define LOCAL_ExportFunctorHashTableNum LOCAL->ExportFunctorHashTableNum_
#define REMOTE_ExportFunctorHashTableNum(wid) REMOTE(wid)->ExportFunctorHashTableNum_
#define LOCAL_ExportPredEntryHashChain LOCAL->ExportPredEntryHashChain_
#define REMOTE_ExportPredEntryHashChain(wid) REMOTE(wid)->ExportPredEntryHashChain_
#define LOCAL_ExportPredEntryHashTableSize LOCAL->ExportPredEntryHashTableSize_
#define REMOTE_ExportPredEntryHashTableSize(wid) REMOTE(wid)->ExportPredEntryHashTableSize_
#define LOCAL_ExportPredEntryHashTableNum LOCAL->ExportPredEntryHashTableNum_
#define REMOTE_ExportPredEntryHashTableNum(wid) REMOTE(wid)->ExportPredEntryHashTableNum_
#define LOCAL_ExportDBRefHashChain LOCAL->ExportDBRefHashChain_
#define REMOTE_ExportDBRefHashChain(wid) REMOTE(wid)->ExportDBRefHashChain_
#define LOCAL_ExportDBRefHashTableSize LOCAL->ExportDBRefHashTableSize_
#define REMOTE_ExportDBRefHashTableSize(wid) REMOTE(wid)->ExportDBRefHashTableSize_
#define LOCAL_ExportDBRefHashTableNum LOCAL->ExportDBRefHashTableNum_
#define REMOTE_ExportDBRefHashTableNum(wid) REMOTE(wid)->ExportDBRefHashTableNum_
#define LOCAL_ImportAtomHashChain LOCAL->ImportAtomHashChain_
#define REMOTE_ImportAtomHashChain(wid) REMOTE(wid)->ImportAtomHashChain_
#define LOCAL_ImportAtomHashTableSize LOCAL->ImportAtomHashTableSize_
#define REMOTE_ImportAtomHashTableSize(wid) REMOTE(wid)->ImportAtomHashTableSize_
#define LOCAL_ImportAtomHashTableNum LOCAL->ImportAtomHashTableNum_
#define REMOTE_ImportAtomHashTableNum(wid) REMOTE(wid)->ImportAtomHashTableNum_
#define LOCAL_ImportFunctorHashChain LOCAL->ImportFunctorHashChain_
#define REMOTE_ImportFunctorHashChain(wid) REMOTE(wid)->ImportFunctorHashChain_
#define LOCAL_ImportFunctorHashTableSize LOCAL->ImportFunctorHashTableSize_
#define REMOTE_ImportFunctorHashTableSize(wid) REMOTE(wid)->ImportFunctorHashTableSize_
#define LOCAL_ImportFunctorHashTableNum LOCAL->ImportFunctorHashTableNum_
#define REMOTE_ImportFunctorHashTableNum(wid) REMOTE(wid)->ImportFunctorHashTableNum_
#define LOCAL_ImportOPCODEHashChain LOCAL->ImportOPCODEHashChain_
#define REMOTE_ImportOPCODEHashChain(wid) REMOTE(wid)->ImportOPCODEHashChain_
#define LOCAL_ImportOPCODEHashTableSize LOCAL->ImportOPCODEHashTableSize_
#define REMOTE_ImportOPCODEHashTableSize(wid) REMOTE(wid)->ImportOPCODEHashTableSize_
#define LOCAL_ImportPredEntryHashChain LOCAL->ImportPredEntryHashChain_
#define REMOTE_ImportPredEntryHashChain(wid) REMOTE(wid)->ImportPredEntryHashChain_
#define LOCAL_ImportPredEntryHashTableSize LOCAL->ImportPredEntryHashTableSize_
#define REMOTE_ImportPredEntryHashTableSize(wid) REMOTE(wid)->ImportPredEntryHashTableSize_
#define LOCAL_ImportPredEntryHashTableNum LOCAL->ImportPredEntryHashTableNum_
#define REMOTE_ImportPredEntryHashTableNum(wid) REMOTE(wid)->ImportPredEntryHashTableNum_
#define LOCAL_ImportDBRefHashChain LOCAL->ImportDBRefHashChain_
#define REMOTE_ImportDBRefHashChain(wid) REMOTE(wid)->ImportDBRefHashChain_
#define LOCAL_ImportDBRefHashTableSize LOCAL->ImportDBRefHashTableSize_
#define REMOTE_ImportDBRefHashTableSize(wid) REMOTE(wid)->ImportDBRefHashTableSize_
#define LOCAL_ImportDBRefHashTableNum LOCAL->ImportDBRefHashTableNum_
#define REMOTE_ImportDBRefHashTableNum(wid) REMOTE(wid)->ImportDBRefHashTableNum_
#define LOCAL_ImportFAILCODE LOCAL->ImportFAILCODE_
#define REMOTE_ImportFAILCODE(wid) REMOTE(wid)->ImportFAILCODE_

View File

@ -16,7 +16,7 @@
cl = NEXTOP(cl,N);
break;
case _ensure_space:
cl = NEXTOP(cl,Osbpi);
cl = NEXTOP(cl,Osbpa);
break;
case _native_me:
cl = NEXTOP(cl,aFlp);

0
H/heapgc.h Executable file → Normal file
View File

View File

@ -182,10 +182,38 @@ typedef struct worker_local {
Int total_atom_table_overflow_time_;
#ifdef LOAD_DYLD
static dl_errno_;
int dl_errno_;
#endif
#ifdef LOW_LEVEL_TRACER
int do_trace_primitives_;
#endif
struct export_atom_hash_entry_struct **ExportAtomHashChain_;
UInt ExportAtomHashTableSize_;
UInt ExportAtomHashTableNum_;
struct export_functor_hash_entry_struct **ExportFunctorHashChain_;
UInt ExportFunctorHashTableSize_;
UInt ExportFunctorHashTableNum_;
struct export_pred_entry_hash_entry_struct **ExportPredEntryHashChain_;
UInt ExportPredEntryHashTableSize_;
UInt ExportPredEntryHashTableNum_;
struct export_dbref_hash_entry_struct **ExportDBRefHashChain_;
UInt ExportDBRefHashTableSize_;
UInt ExportDBRefHashTableNum_;
struct import_atom_hash_entry_struct **ImportAtomHashChain_;
UInt ImportAtomHashTableSize_;
UInt ImportAtomHashTableNum_;
struct import_functor_hash_entry_struct **ImportFunctorHashChain_;
UInt ImportFunctorHashTableSize_;
UInt ImportFunctorHashTableNum_;
struct import_opcode_hash_entry_struct **ImportOPCODEHashChain_;
UInt ImportOPCODEHashTableSize_;
struct import_pred_entry_hash_entry_struct **ImportPredEntryHashChain_;
UInt ImportPredEntryHashTableSize_;
UInt ImportPredEntryHashTableNum_;
struct import_dbref_hash_entry_struct **ImportDBRefHashChain_;
UInt ImportDBRefHashTableSize_;
UInt ImportDBRefHashTableNum_;
yamop *ImportFAILCODE_;
} w_local;

View File

@ -188,4 +188,32 @@ static void InitWorker(int wid) {
#ifdef LOW_LEVEL_TRACER
REMOTE_do_trace_primitives(wid) = TRUE;
#endif
REMOTE_ExportAtomHashChain(wid) = NULL;
REMOTE_ExportAtomHashTableSize(wid) = 0;
REMOTE_ExportAtomHashTableNum(wid) = 0;
REMOTE_ExportFunctorHashChain(wid) = NULL;
REMOTE_ExportFunctorHashTableSize(wid) = 0;
REMOTE_ExportFunctorHashTableNum(wid) = 0;
REMOTE_ExportPredEntryHashChain(wid) = NULL;
REMOTE_ExportPredEntryHashTableSize(wid) = 0;
REMOTE_ExportPredEntryHashTableNum(wid) = 0;
REMOTE_ExportDBRefHashChain(wid) = NULL;
REMOTE_ExportDBRefHashTableSize(wid) = 0;
REMOTE_ExportDBRefHashTableNum(wid) = 0;
REMOTE_ImportAtomHashChain(wid) = NULL;
REMOTE_ImportAtomHashTableSize(wid) = 0;
REMOTE_ImportAtomHashTableNum(wid) = 0;
REMOTE_ImportFunctorHashChain(wid) = NULL;
REMOTE_ImportFunctorHashTableSize(wid) = 0;
REMOTE_ImportFunctorHashTableNum(wid) = 0;
REMOTE_ImportOPCODEHashChain(wid) = NULL;
REMOTE_ImportOPCODEHashTableSize(wid) = 0;
REMOTE_ImportPredEntryHashChain(wid) = NULL;
REMOTE_ImportPredEntryHashTableSize(wid) = 0;
REMOTE_ImportPredEntryHashTableNum(wid) = 0;
REMOTE_ImportDBRefHashChain(wid) = NULL;
REMOTE_ImportDBRefHashTableSize(wid) = 0;
REMOTE_ImportDBRefHashTableNum(wid) = 0;
REMOTE_ImportFAILCODE(wid) = NULL;
}

View File

@ -76,7 +76,6 @@ typedef struct stream_desc
int (* stream_wgetc_for_read)(int);
int (* stream_wgetc)(int);
int (* stream_wputc)(int,wchar_t);
encoding_t encoding;
mbstate_t mbstate;
}
StreamDesc;

6
packages/PLStream/pl-incl.h → H/pl-incl.h Executable file → Normal file
View File

@ -20,6 +20,12 @@
#define O_XOS 1
#endif
#ifndef __unix__
#if defined(_AIX) || defined(__APPLE__) || defined(__unix) || defined(__BEOS__) || defined(__NetBSD__)
#define __unix__ 1
#endif
#endif
#ifdef THREADS
#define O_PLMT 1
#endif

View File

@ -129,7 +129,15 @@ void PL_license(const char *license, const char *module);
#define atomFromTerm(term) YAP_SWIAtomFromAtom(YAP_AtomOfTerm(term))
#define atomName(atom) ((char *)YAP_AtomName(atom))
#define nameOfAtom(atom) ((char *)YAP_AtomName(atom))
#define atomLength(atom) YAP_AtomNameLength(atom)
inline static size_t
atomLength(Atom atom)
{
if (YAP_IsWideAtom(atom))
return wcslen(atom->WStrOfAE)*sizeof(wchar_t);
return(strlen(atom->StrOfAE));
}
#define atomBlobType(at) YAP_find_blob_type(at)
#define argTermP(w,i) ((Word)((YAP_ArgsOfTerm(w)+(i))))
#define deRef(t) while (IsVarTerm(*(t)) && !IsUnboundVar(t)) { t = (CELL *)(*(t)); }
@ -148,6 +156,9 @@ extern term_t Yap_CvtTerm(term_t ts);
#define clearNumber(n)
wchar_t *nameOfWideAtom(atom_t atom);
int isWideAtom(atom_t atom);
inline static int
charCode(Term w)
{ if ( IsAtomTerm(w) )

119
H/qly.h Normal file
View File

@ -0,0 +1,119 @@
/*************************************************************************
* *
* YAP Prolog *
* *
* Yap Prolog was developed at NCCUP - Universidade do Porto *
* *
* Copyright L.Damas, V. Santos Costa and Universidade do Porto 1985-- *
* *
**************************************************************************
* *
* File: qly.h *
* comments: quick saver/loader *
* *
* Last rev: $Date: 2011-08-29$,$Author: vsc $ *
* $Log: not supported by cvs2svn $ *
* *
*************************************************************************/
#define EXPORT_ATOM_TABLE_SIZE (16*4096)
#define EXPORT_FUNCTOR_TABLE_SIZE (16*4096)
#define EXPORT_OPCODE_TABLE_SIZE (4096)
#define EXPORT_PRED_ENTRY_TABLE_SIZE (128)
#define EXPORT_DBREF_TABLE_SIZE (128)
typedef struct export_atom_hash_entry_struct {
Atom val;
struct export_atom_hash_entry_struct *next;
} export_atom_hash_entry_t;
typedef struct import_atom_hash_entry_struct {
Atom oval;
Atom val;
struct import_atom_hash_entry_struct *next;
} import_atom_hash_entry_t;
typedef struct export_functor_hash_entry_struct {
Functor val;
Atom name;
UInt arity;
struct export_functor_hash_entry_struct *next;
} export_functor_hash_entry_t;
typedef struct import_functor_hash_entry_struct {
Functor val;
Functor oval;
struct import_functor_hash_entry_struct *next;
} import_functor_hash_entry_t;
typedef struct import_opcode_hash_entry_struct {
OPCODE val;
int id;
OPCODE oval;
struct import_opcode_hash_entry_struct *next;
} import_opcode_hash_entry_t;
typedef struct export_pred_entry_hash_entry_struct {
PredEntry *val;
union {
Functor f;
Atom a;
} u;
Atom module;
UInt arity;
struct export_pred_entry_hash_entry_struct *next;
} export_pred_entry_hash_entry_t;
typedef struct import_pred_entry_hash_entry_struct {
PredEntry *val;
PredEntry *oval;
struct import_pred_entry_hash_entry_struct *next;
} import_pred_entry_hash_entry_t;
typedef struct export_dbref_hash_entry_struct {
DBRef val;
UInt sz;
UInt refs;
struct export_dbref_hash_entry_struct *next;
} export_dbref_hash_entry_t;
typedef struct import_dbref_hash_entry_struct {
DBRef val;
DBRef oval;
int count;
struct import_dbref_hash_entry_struct *next;
} import_dbref_hash_entry_t;
typedef enum {
QLY_START_X = 0,
QLY_START_OPCODES = 1,
QLY_START_ATOMS = 2,
QLY_START_FUNCTORS = 3,
QLY_START_PRED_ENTRIES = 4,
QLY_START_DBREFS = 5,
QLY_START_MODULE = 6,
QLY_END_MODULES = 7,
QLY_START_LU_CLAUSE = 8,
QLY_END_LU_CLAUSES = 9,
QLY_NEW_OP = 10,
QLY_END_OPS = 11,
QLY_START_PREDICATE = 12,
QLY_END_PREDICATES = 13,
QLY_ATOM_WIDE = 14,
QLY_FAILCODE = 15,
QLY_ATOM = 16
} qlf_tag_t;
#define STATIC_PRED_FLAGS (SourcePredFlag|DynamicPredFlag|LogUpdatePredFlag|CompiledPredFlag|MultiFileFlag|TabledPredFlag|MegaClausePredFlag|CountPredFlag|ProfiledPredFlag|ThreadLocalPredFlag|AtomDBPredFlag|ModuleTransparentPredFlag|NumberDBPredFlag|MetaPredFlag|SyncPredFlag|BackCPredFlag)
#define SYSTEM_PRED_FLAGS (BackCPredFlag|UserCPredFlag|CArgsPredFlag|AsmPredFlag|CPredFlag|BinaryPredFlag)
#define NEXTOP(V,TYPE) ((yamop *)(&((V)->u.TYPE.next)))
#define CHECK(F) { size_t r = (F); if (!r) return r; }
#define RCHECK(F) if(!(F)) { ERROR(MISMATCH); return; }
#define AllocTempSpace() (H)
#define EnoughTempSpace(sz) ((ASP-H)*sizeof(CELL) > sz)

View File

@ -60,14 +60,14 @@ restore_opcodes(yamop *pc, yamop *max USES_REGS)
pc->u.Osbmp.p0 = PtoPredAdjust(pc->u.Osbmp.p0);
pc = NEXTOP(pc,Osbmp);
break;
/* instructions type Osbpi */
/* instructions type Osbpa */
case _ensure_space:
OrArgAdjust(pc->u.Osbpi.or_arg);
pc->u.Osbpi.s = ConstantAdjust(pc->u.Osbpi.s);
pc->u.Osbpi.bmap = CellPtoHeapAdjust(pc->u.Osbpi.bmap);
pc->u.Osbpi.p = PtoPredAdjust(pc->u.Osbpi.p);
IntegerInCodeAdjust(pc->u.Osbpi.i);
pc = NEXTOP(pc,Osbpi);
OrArgAdjust(pc->u.Osbpa.or_arg);
pc->u.Osbpa.s = ConstantAdjust(pc->u.Osbpa.s);
pc->u.Osbpa.bmap = CellPtoHeapAdjust(pc->u.Osbpa.bmap);
pc->u.Osbpa.p = PtoPredAdjust(pc->u.Osbpa.p);
pc->u.Osbpa.i = ArityAdjust(pc->u.Osbpa.i);
pc = NEXTOP(pc,Osbpa);
break;
/* instructions type Osbpp */
case _call:

25
H/rheap.h Executable file → Normal file
View File

@ -547,10 +547,16 @@ RestoreStaticClause(StaticClause *cl USES_REGS)
* clause for this predicate or not
*/
{
if (cl->ClFlags & FactMask) {
cl->usc.ClPred = PtoPredAdjust(cl->usc.ClPred);
} else {
cl->usc.ClSource = DBTermAdjust(cl->usc.ClSource);
if (cl->usc.ClSource) {
char *x = (char *)DBTermAdjust(cl->usc.ClSource);
char *base = (char *)cl;
if (x < base || x > base+cl->ClSize) {
cl->usc.ClPred = PtoPredAdjust(cl->usc.ClPred);
} else {
cl->usc.ClSource = DBTermAdjust(cl->usc.ClSource);
RestoreDBTerm(cl->usc.ClSource, TRUE PASS_REGS);
}
}
if (cl->ClNext) {
cl->ClNext = PtoStCAdjust(cl->ClNext);
@ -1110,9 +1116,10 @@ RestoreDB(DBEntry *pp USES_REGS)
static void
CleanClauses(yamop *First, yamop *Last, PredEntry *pp USES_REGS)
{
if (!First)
return;
if (pp->PredFlags & LogUpdatePredFlag) {
LogUpdClause *cl = ClauseCodeToLogUpdClause(First);
while (cl != NULL) {
RestoreLUClause(cl, pp PASS_REGS);
cl = cl->ClNext;
@ -1332,12 +1339,8 @@ CleanCode(PredEntry *pp USES_REGS)
pp->FunctorOfPred = (Functor)AtomAdjust((Atom)(pp->FunctorOfPred));
}
if (!(pp->PredFlags & NumberDBPredFlag)) {
if (pp->PredFlags & MultiFileFlag) {
if (pp->src.file_srcs)
pp->src.file_srcs = MFileAdjust(pp->src.file_srcs);
} else {
if (pp->src.OwnerFile)
pp->src.OwnerFile = AtomAdjust(pp->src.OwnerFile);
if (pp->src.OwnerFile) {
pp->src.OwnerFile = AtomAdjust(pp->src.OwnerFile);
}
}
pp->OpcodeOfPred = Yap_opcode(Yap_op_from_opcode(pp->OpcodeOfPred));

View File

@ -188,4 +188,32 @@ static void RestoreWorker(int wid USES_REGS) {
#ifdef LOW_LEVEL_TRACER
#endif
}

938
H/saveclause.h Normal file
View File

@ -0,0 +1,938 @@
/* This file was generated automatically by "yap -L misc/buildops"
please do not update */
while (TRUE) {
op_numbers op;
if (max && pc >= max) return 1;
op = Yap_op_from_opcode(pc->opc);
save_Opcode(stream, op);
/* C-code, maybe indexing */
switch (op) {
/* instructions type D */
case _write_dbterm:
CHECK(save_DBGroundTerm(stream, pc->u.D.D));
pc = NEXTOP(pc,D);
break;
/* instructions type Illss */
case _enter_lu_pred:
CHECK(save_PtoLUIndex(stream, pc->u.Illss.I));
CHECK(save_PtoOp(stream, pc->u.Illss.l1));
CHECK(save_PtoOp(stream, pc->u.Illss.l2));
CHECK(save_Constant(stream, pc->u.Illss.s));
CHECK(save_Constant(stream, pc->u.Illss.e));
pc = NEXTOP(pc,Illss);
break;
/* instructions type L */
case _alloc_for_logical_pred:
CHECK(save_PtoLUClause(stream, pc->u.L.ClBase));
pc = NEXTOP(pc,L);
break;
/* instructions type N */
case _write_bigint:
CHECK(save_BlobTermInCode(stream, pc->u.N.b));
pc = NEXTOP(pc,N);
break;
/* instructions type Osblp */
case _either:
case _or_else:
#ifdef YAPOR
CHECK(save_OrArg(stream, pc->u.Osblp.or_arg));
#endif
CHECK(save_Constant(stream, pc->u.Osblp.s));
CHECK(save_CellPtoHeap(stream, pc->u.Osblp.bmap));
CHECK(save_PtoOp(stream, pc->u.Osblp.l));
CHECK(save_PtoPred(stream, pc->u.Osblp.p0));
pc = NEXTOP(pc,Osblp);
break;
/* instructions type Osbmp */
case _p_execute:
#ifdef YAPOR
CHECK(save_OrArg(stream, pc->u.Osbmp.or_arg));
#endif
CHECK(save_Constant(stream, pc->u.Osbmp.s));
CHECK(save_CellPtoHeap(stream, pc->u.Osbmp.bmap));
CHECK(save_Module(stream, pc->u.Osbmp.mod));
CHECK(save_PtoPred(stream, pc->u.Osbmp.p0));
pc = NEXTOP(pc,Osbmp);
break;
/* instructions type Osbpa */
case _ensure_space:
#ifdef YAPOR
CHECK(save_OrArg(stream, pc->u.Osbpa.or_arg));
#endif
CHECK(save_Constant(stream, pc->u.Osbpa.s));
CHECK(save_CellPtoHeap(stream, pc->u.Osbpa.bmap));
CHECK(save_PtoPred(stream, pc->u.Osbpa.p));
CHECK(save_Arity(stream, pc->u.Osbpa.i));
pc = NEXTOP(pc,Osbpa);
break;
/* instructions type Osbpp */
case _call:
case _call_cpred:
case _call_usercpred:
case _fcall:
case _p_execute2:
case _p_execute_tail:
#ifdef YAPOR
CHECK(save_OrArg(stream, pc->u.Osbpp.or_arg));
#endif
CHECK(save_Constant(stream, pc->u.Osbpp.s));
CHECK(save_CellPtoHeap(stream, pc->u.Osbpp.bmap));
CHECK(save_PtoPred(stream, pc->u.Osbpp.p));
CHECK(save_PtoPred(stream, pc->u.Osbpp.p0));
pc = NEXTOP(pc,Osbpp);
break;
/* instructions type OtILl */
case _count_trust_logical:
case _profiled_trust_logical:
case _trust_logical:
#ifdef YAPOR
CHECK(save_OrArg(stream, pc->u.OtILl.or_arg));
#endif
#ifdef TABLING
CHECK(save_TabEntry(stream, pc->u.OtILl.te));
#endif
CHECK(save_PtoLUIndex(stream, pc->u.OtILl.block));
CHECK(save_PtoLUClause(stream, pc->u.OtILl.d));
CHECK(save_PtoOp(stream, pc->u.OtILl.n));
pc = NEXTOP(pc,OtILl);
break;
/* instructions type OtaLl */
case _count_retry_logical:
case _profiled_retry_logical:
case _retry_logical:
case _try_logical:
#ifdef YAPOR
CHECK(save_OrArg(stream, pc->u.OtaLl.or_arg));
#endif
#ifdef TABLING
CHECK(save_TabEntry(stream, pc->u.OtaLl.te));
#endif
CHECK(save_Arity(stream, pc->u.OtaLl.s));
CHECK(save_PtoLUClause(stream, pc->u.OtaLl.d));
CHECK(save_PtoOp(stream, pc->u.OtaLl.n));
pc = NEXTOP(pc,OtaLl);
break;
/* instructions type OtapFs */
#ifdef CUT_C
case _cut_c:
#endif
#ifdef CUT_C
case _cut_userc:
#endif
case _retry_c:
case _retry_userc:
case _try_c:
case _try_userc:
#ifdef YAPOR
CHECK(save_OrArg(stream, pc->u.OtapFs.or_arg));
#endif
#ifdef TABLING
CHECK(save_TabEntry(stream, pc->u.OtapFs.te));
#endif
CHECK(save_Arity(stream, pc->u.OtapFs.s));
CHECK(save_PtoPred(stream, pc->u.OtapFs.p));
CHECK(save_ExternalFunction(stream, pc->u.OtapFs.f));
CHECK(save_Constant(stream, pc->u.OtapFs.extra));
pc = NEXTOP(pc,OtapFs);
break;
/* instructions type Otapl */
case _count_retry_and_mark:
case _count_retry_me:
case _count_trust_me:
case _profiled_retry_and_mark:
case _profiled_retry_me:
case _profiled_trust_me:
case _retry:
case _retry_and_mark:
case _retry_me:
case _spy_or_trymark:
case _trust:
case _trust_me:
case _try_and_mark:
case _try_clause:
case _try_me:
#ifdef YAPOR
CHECK(save_OrArg(stream, pc->u.Otapl.or_arg));
#endif
#ifdef TABLING
CHECK(save_TabEntry(stream, pc->u.Otapl.te));
#endif
CHECK(save_Arity(stream, pc->u.Otapl.s));
CHECK(save_PtoPred(stream, pc->u.Otapl.p));
CHECK(save_PtoOp(stream, pc->u.Otapl.d));
pc = NEXTOP(pc,Otapl);
break;
/* instructions type aFlp */
case _native_me:
CHECK(save_Arity(stream, pc->u.aFlp.n));
CHECK(save_ExternalFunction(stream, pc->u.aFlp.native));
CHECK(save_PtoOp(stream, pc->u.aFlp.native_next));
CHECK(save_PtoPred(stream, pc->u.aFlp.p));
pc = NEXTOP(pc,aFlp);
break;
/* instructions type c */
case _write_atom:
CHECK(save_ConstantTerm(stream, pc->u.c.c));
pc = NEXTOP(pc,c);
break;
/* instructions type cc */
case _get_2atoms:
CHECK(save_ConstantTerm(stream, pc->u.cc.c1));
CHECK(save_ConstantTerm(stream, pc->u.cc.c2));
pc = NEXTOP(pc,cc);
break;
/* instructions type ccc */
case _get_3atoms:
CHECK(save_ConstantTerm(stream, pc->u.ccc.c1));
CHECK(save_ConstantTerm(stream, pc->u.ccc.c2));
CHECK(save_ConstantTerm(stream, pc->u.ccc.c3));
pc = NEXTOP(pc,ccc);
break;
/* instructions type cccc */
case _get_4atoms:
CHECK(save_ConstantTerm(stream, pc->u.cccc.c1));
CHECK(save_ConstantTerm(stream, pc->u.cccc.c2));
CHECK(save_ConstantTerm(stream, pc->u.cccc.c3));
CHECK(save_ConstantTerm(stream, pc->u.cccc.c4));
pc = NEXTOP(pc,cccc);
break;
/* instructions type ccccc */
case _get_5atoms:
CHECK(save_ConstantTerm(stream, pc->u.ccccc.c1));
CHECK(save_ConstantTerm(stream, pc->u.ccccc.c2));
CHECK(save_ConstantTerm(stream, pc->u.ccccc.c3));
CHECK(save_ConstantTerm(stream, pc->u.ccccc.c4));
CHECK(save_ConstantTerm(stream, pc->u.ccccc.c5));
pc = NEXTOP(pc,ccccc);
break;
/* instructions type cccccc */
case _get_6atoms:
CHECK(save_ConstantTerm(stream, pc->u.cccccc.c1));
CHECK(save_ConstantTerm(stream, pc->u.cccccc.c2));
CHECK(save_ConstantTerm(stream, pc->u.cccccc.c3));
CHECK(save_ConstantTerm(stream, pc->u.cccccc.c4));
CHECK(save_ConstantTerm(stream, pc->u.cccccc.c5));
CHECK(save_ConstantTerm(stream, pc->u.cccccc.c6));
pc = NEXTOP(pc,cccccc);
break;
/* instructions type clll */
case _if_not_then:
CHECK(save_ConstantTerm(stream, pc->u.clll.c));
CHECK(save_PtoOp(stream, pc->u.clll.l1));
CHECK(save_PtoOp(stream, pc->u.clll.l2));
CHECK(save_PtoOp(stream, pc->u.clll.l3));
pc = NEXTOP(pc,clll);
break;
/* instructions type d */
case _write_float:
CHECK(save_DoubleInCode(stream, pc->u.d.d));
pc = NEXTOP(pc,d);
break;
/* instructions type e */
case _Nstop:
case _allocate:
case _copy_idb_term:
case _expand_index:
case _index_blob:
case _index_dbref:
case _index_long:
case _index_pred:
case _lock_pred:
case _op_fail:
case _p_equal:
case _p_functor:
case _pop:
#ifdef BEAM
case _retry_eam:
#endif
case _spy_pred:
#ifdef THREADS
case _thread_local:
#endif
case _trust_fail:
case _undef_p:
case _unify_idb_term:
case _unlock_lu:
case _write_l_list:
case _write_list:
case _write_void:
if (op == _Nstop || op == _copy_idb_term || op == _unify_idb_term) return 1;
pc = NEXTOP(pc,e);
break;
/* instructions type fa */
case _write_l_struc:
case _write_struct:
CHECK(save_Func(stream, pc->u.fa.f));
CHECK(save_Arity(stream, pc->u.fa.a));
pc = NEXTOP(pc,fa);
break;
/* instructions type i */
case _write_longint:
CHECK(save_IntegerInCode(stream, pc->u.i.i));
pc = NEXTOP(pc,i);
break;
/* instructions type l */
case _Ystop:
case _jump:
case _jump_if_var:
case _move_back:
case _p_dif:
case _p_eq:
case _retry2:
case _retry3:
case _retry4:
case _skip:
case _try_clause2:
case _try_clause3:
case _try_clause4:
case _try_in:
CHECK(save_PtoOp(stream, pc->u.l.l));
pc = NEXTOP(pc,l);
break;
/* instructions type llll */
case _switch_on_type:
CHECK(save_PtoOp(stream, pc->u.llll.l1));
CHECK(save_PtoOp(stream, pc->u.llll.l2));
CHECK(save_PtoOp(stream, pc->u.llll.l3));
CHECK(save_PtoOp(stream, pc->u.llll.l4));
pc = NEXTOP(pc,llll);
break;
/* instructions type lp */
case _user_switch:
CHECK(save_PtoOp(stream, pc->u.lp.l));
CHECK(save_PtoPred(stream, pc->u.lp.p));
pc = NEXTOP(pc,lp);
break;
/* instructions type o */
case _unify_l_list:
case _unify_l_list_write:
case _unify_l_void:
case _unify_l_void_write:
case _unify_list:
case _unify_list_write:
case _unify_void:
case _unify_void_write:
CHECK(save_Opcode(stream, pc->u.o.opcw));
pc = NEXTOP(pc,o);
break;
/* instructions type oD */
case _unify_dbterm:
case _unify_l_dbterm:
CHECK(save_Opcode(stream, pc->u.oD.opcw));
CHECK(save_DBGroundTerm(stream, pc->u.oD.D));
pc = NEXTOP(pc,oD);
break;
/* instructions type oN */
case _unify_bigint:
case _unify_l_bigint:
CHECK(save_Opcode(stream, pc->u.oN.opcw));
CHECK(save_BlobTermInCode(stream, pc->u.oN.b));
pc = NEXTOP(pc,oN);
break;
/* instructions type oc */
case _unify_atom:
case _unify_atom_write:
case _unify_l_atom:
case _unify_l_atom_write:
CHECK(save_Opcode(stream, pc->u.oc.opcw));
CHECK(save_ConstantTerm(stream, pc->u.oc.c));
pc = NEXTOP(pc,oc);
break;
/* instructions type od */
case _unify_float:
case _unify_float_write:
case _unify_l_float:
case _unify_l_float_write:
CHECK(save_Opcode(stream, pc->u.od.opcw));
CHECK(save_DoubleInCode(stream, pc->u.od.d));
pc = NEXTOP(pc,od);
break;
/* instructions type ofa */
case _unify_l_struc:
case _unify_l_struc_write:
case _unify_struct:
case _unify_struct_write:
CHECK(save_Opcode(stream, pc->u.ofa.opcw));
CHECK(save_Func(stream, pc->u.ofa.f));
CHECK(save_Arity(stream, pc->u.ofa.a));
pc = NEXTOP(pc,ofa);
break;
/* instructions type oi */
case _unify_l_longint:
case _unify_l_longint_write:
case _unify_longint:
case _unify_longint_write:
CHECK(save_Opcode(stream, pc->u.oi.opcw));
CHECK(save_IntegerInCode(stream, pc->u.oi.i));
pc = NEXTOP(pc,oi);
break;
/* instructions type ollll */
case _switch_list_nl:
CHECK(save_Opcode(stream, pc->u.ollll.pop));
CHECK(save_PtoOp(stream, pc->u.ollll.l1));
CHECK(save_PtoOp(stream, pc->u.ollll.l2));
CHECK(save_PtoOp(stream, pc->u.ollll.l3));
CHECK(save_PtoOp(stream, pc->u.ollll.l4));
pc = NEXTOP(pc,ollll);
break;
/* instructions type os */
#ifdef BEAM
case _run_eam:
#endif
case _unify_l_n_voids:
case _unify_l_n_voids_write:
case _unify_n_voids:
case _unify_n_voids_write:
CHECK(save_Opcode(stream, pc->u.os.opcw));
CHECK(save_Constant(stream, pc->u.os.s));
pc = NEXTOP(pc,os);
break;
/* instructions type osc */
case _unify_n_atoms:
case _unify_n_atoms_write:
CHECK(save_Opcode(stream, pc->u.osc.opcw));
CHECK(save_Constant(stream, pc->u.osc.s));
CHECK(save_ConstantTerm(stream, pc->u.osc.c));
pc = NEXTOP(pc,osc);
break;
/* instructions type ox */
case _save_appl_x:
case _save_appl_x_write:
case _save_pair_x:
case _save_pair_x_write:
case _unify_l_x_loc:
case _unify_l_x_loc_write:
case _unify_l_x_val:
case _unify_l_x_val_write:
case _unify_l_x_var:
case _unify_l_x_var_write:
case _unify_x_loc:
case _unify_x_loc_write:
case _unify_x_val:
case _unify_x_val_write:
case _unify_x_var:
case _unify_x_var_write:
CHECK(save_Opcode(stream, pc->u.ox.opcw));
CHECK(save_X(stream, pc->u.ox.x));
pc = NEXTOP(pc,ox);
break;
/* instructions type oxx */
case _unify_l_x_var2:
case _unify_l_x_var2_write:
case _unify_x_var2:
case _unify_x_var2_write:
CHECK(save_Opcode(stream, pc->u.oxx.opcw));
CHECK(save_X(stream, pc->u.oxx.xl));
CHECK(save_X(stream, pc->u.oxx.xr));
pc = NEXTOP(pc,oxx);
break;
/* instructions type oy */
case _save_appl_y:
case _save_appl_y_write:
case _save_pair_y:
case _save_pair_y_write:
case _unify_l_y_loc:
case _unify_l_y_loc_write:
case _unify_l_y_val:
case _unify_l_y_val_write:
case _unify_l_y_var:
case _unify_l_y_var_write:
case _unify_y_loc:
case _unify_y_loc_write:
case _unify_y_val:
case _unify_y_val_write:
case _unify_y_var:
case _unify_y_var_write:
CHECK(save_Opcode(stream, pc->u.oy.opcw));
CHECK(save_Y(stream, pc->u.oy.y));
pc = NEXTOP(pc,oy);
break;
/* instructions type p */
case _count_call:
case _count_retry:
case _deallocate:
case _enter_profiling:
case _lock_lu:
case _procceed:
case _retry_profiled:
CHECK(save_PtoPred(stream, pc->u.p.p));
pc = NEXTOP(pc,p);
break;
/* instructions type plxxs */
case _call_bfunc_xx:
CHECK(save_PtoPred(stream, pc->u.plxxs.p));
CHECK(save_PtoOp(stream, pc->u.plxxs.f));
CHECK(save_X(stream, pc->u.plxxs.x1));
CHECK(save_X(stream, pc->u.plxxs.x2));
CHECK(save_Constant(stream, pc->u.plxxs.flags));
pc = NEXTOP(pc,plxxs);
break;
/* instructions type plxys */
case _call_bfunc_xy:
case _call_bfunc_yx:
CHECK(save_PtoPred(stream, pc->u.plxys.p));
CHECK(save_PtoOp(stream, pc->u.plxys.f));
CHECK(save_X(stream, pc->u.plxys.x));
CHECK(save_Y(stream, pc->u.plxys.y));
CHECK(save_Constant(stream, pc->u.plxys.flags));
pc = NEXTOP(pc,plxys);
break;
/* instructions type plyys */
case _call_bfunc_yy:
CHECK(save_PtoPred(stream, pc->u.plyys.p));
CHECK(save_PtoOp(stream, pc->u.plyys.f));
CHECK(save_Y(stream, pc->u.plyys.y1));
CHECK(save_Y(stream, pc->u.plyys.y2));
CHECK(save_Constant(stream, pc->u.plyys.flags));
pc = NEXTOP(pc,plyys);
break;
/* instructions type pp */
case _dexecute:
case _execute:
case _execute_cpred:
CHECK(save_PtoPred(stream, pc->u.pp.p));
CHECK(save_PtoPred(stream, pc->u.pp.p0));
pc = NEXTOP(pc,pp);
break;
/* instructions type s */
case _cut:
case _cut_e:
case _cut_t:
case _pop_n:
case _write_n_voids:
CHECK(save_Constant(stream, pc->u.s.s));
pc = NEXTOP(pc,s);
break;
/* instructions type sc */
case _write_n_atoms:
CHECK(save_Constant(stream, pc->u.sc.s));
CHECK(save_ConstantTerm(stream, pc->u.sc.c));
pc = NEXTOP(pc,sc);
break;
/* instructions type sllll */
case _switch_on_sub_arg_type:
CHECK(save_Constant(stream, pc->u.sllll.s));
CHECK(save_PtoOp(stream, pc->u.sllll.l1));
CHECK(save_PtoOp(stream, pc->u.sllll.l2));
CHECK(save_PtoOp(stream, pc->u.sllll.l3));
CHECK(save_PtoOp(stream, pc->u.sllll.l4));
pc = NEXTOP(pc,sllll);
break;
/* instructions type slp */
case _call_c_wfail:
CHECK(save_Constant(stream, pc->u.slp.s));
CHECK(save_PtoOp(stream, pc->u.slp.l));
CHECK(save_PtoPred(stream, pc->u.slp.p));
pc = NEXTOP(pc,slp);
break;
/* instructions type sssl */
case _go_on_cons:
case _go_on_func:
case _if_cons:
case _if_func:
case _switch_on_cons:
case _switch_on_func:
CHECK(save_Constant(stream, pc->u.sssl.s));
CHECK(save_Constant(stream, pc->u.sssl.e));
CHECK(save_Constant(stream, pc->u.sssl.w));
CHECK(save_PtoOp(stream, pc->u.sssl.l));
pc = NEXTOP(pc,sssl);
break;
/* instructions type sssllp */
case _expand_clauses:
CHECK(save_Constant(stream, pc->u.sssllp.s1));
CHECK(save_Constant(stream, pc->u.sssllp.s2));
CHECK(save_Constant(stream, pc->u.sssllp.s3));
CHECK(save_PtoOp(stream, pc->u.sssllp.sprev));
CHECK(save_PtoOp(stream, pc->u.sssllp.snext));
CHECK(save_PtoPred(stream, pc->u.sssllp.p));
pc = NEXTOP(pc,sssllp);
break;
/* instructions type x */
case _get_list:
case _put_list:
case _save_b_x:
case _write_x_loc:
case _write_x_val:
case _write_x_var:
CHECK(save_X(stream, pc->u.x.x));
pc = NEXTOP(pc,x);
break;
/* instructions type xD */
case _get_dbterm:
case _put_dbterm:
CHECK(save_X(stream, pc->u.xD.x));
CHECK(save_DBGroundTerm(stream, pc->u.xD.D));
pc = NEXTOP(pc,xD);
break;
/* instructions type xN */
case _get_bigint:
case _put_bigint:
CHECK(save_X(stream, pc->u.xN.x));
CHECK(save_BlobTermInCode(stream, pc->u.xN.b));
pc = NEXTOP(pc,xN);
break;
/* instructions type xc */
case _get_atom:
case _put_atom:
CHECK(save_X(stream, pc->u.xc.x));
CHECK(save_ConstantTerm(stream, pc->u.xc.c));
pc = NEXTOP(pc,xc);
break;
/* instructions type xd */
case _get_float:
case _put_float:
CHECK(save_X(stream, pc->u.xd.x));
CHECK(save_DoubleInCode(stream, pc->u.xd.d));
pc = NEXTOP(pc,xd);
break;
/* instructions type xfa */
case _get_struct:
case _put_struct:
CHECK(save_X(stream, pc->u.xfa.x));
CHECK(save_Func(stream, pc->u.xfa.f));
CHECK(save_Arity(stream, pc->u.xfa.a));
pc = NEXTOP(pc,xfa);
break;
/* instructions type xi */
case _get_longint:
case _put_longint:
CHECK(save_X(stream, pc->u.xi.x));
CHECK(save_IntegerInCode(stream, pc->u.xi.i));
pc = NEXTOP(pc,xi);
break;
/* instructions type xl */
case _p_atom_x:
case _p_atomic_x:
case _p_compound_x:
case _p_db_ref_x:
case _p_float_x:
case _p_integer_x:
case _p_nonvar_x:
case _p_number_x:
case _p_primitive_x:
case _p_var_x:
CHECK(save_X(stream, pc->u.xl.x));
CHECK(save_PtoOp(stream, pc->u.xl.F));
pc = NEXTOP(pc,xl);
break;
/* instructions type xll */
case _jump_if_nonvar:
CHECK(save_X(stream, pc->u.xll.x));
CHECK(save_PtoOp(stream, pc->u.xll.l1));
CHECK(save_PtoOp(stream, pc->u.xll.l2));
pc = NEXTOP(pc,xll);
break;
/* instructions type xllll */
case _switch_on_arg_type:
CHECK(save_X(stream, pc->u.xllll.x));
CHECK(save_PtoOp(stream, pc->u.xllll.l1));
CHECK(save_PtoOp(stream, pc->u.xllll.l2));
CHECK(save_PtoOp(stream, pc->u.xllll.l3));
CHECK(save_PtoOp(stream, pc->u.xllll.l4));
pc = NEXTOP(pc,xllll);
break;
/* instructions type xps */
case _commit_b_x:
CHECK(save_X(stream, pc->u.xps.x));
CHECK(save_PtoPred(stream, pc->u.xps.p0));
CHECK(save_Constant(stream, pc->u.xps.s));
pc = NEXTOP(pc,xps);
break;
/* instructions type xx */
case _get_x_val:
case _get_x_var:
case _gl_void_valx:
case _gl_void_varx:
case _glist_valx:
case _put_x_val:
case _put_x_var:
CHECK(save_X(stream, pc->u.xx.xl));
CHECK(save_X(stream, pc->u.xx.xr));
pc = NEXTOP(pc,xx);
break;
/* instructions type xxc */
case _p_func2s_cv:
CHECK(save_X(stream, pc->u.xxc.x));
CHECK(save_X(stream, pc->u.xxc.xi));
CHECK(save_ConstantTerm(stream, pc->u.xxc.c));
pc = NEXTOP(pc,xxc);
break;
/* instructions type xxn */
case _p_and_vc:
case _p_arg_cv:
case _p_div_cv:
case _p_div_vc:
case _p_func2s_vc:
case _p_minus_cv:
case _p_or_vc:
case _p_plus_vc:
case _p_sll_cv:
case _p_sll_vc:
case _p_slr_cv:
case _p_slr_vc:
case _p_times_vc:
CHECK(save_X(stream, pc->u.xxn.x));
CHECK(save_X(stream, pc->u.xxn.xi));
CHECK(save_Integer(stream, pc->u.xxn.c));
pc = NEXTOP(pc,xxn);
break;
/* instructions type xxx */
case _p_and_vv:
case _p_arg_vv:
case _p_div_vv:
case _p_func2f_xx:
case _p_func2s_vv:
case _p_minus_vv:
case _p_or_vv:
case _p_plus_vv:
case _p_sll_vv:
case _p_slr_vv:
case _p_times_vv:
CHECK(save_X(stream, pc->u.xxx.x));
CHECK(save_X(stream, pc->u.xxx.x1));
CHECK(save_X(stream, pc->u.xxx.x2));
pc = NEXTOP(pc,xxx);
break;
/* instructions type xxxx */
case _put_xx_val:
CHECK(save_X(stream, pc->u.xxxx.xl1));
CHECK(save_X(stream, pc->u.xxxx.xl2));
CHECK(save_X(stream, pc->u.xxxx.xr1));
CHECK(save_X(stream, pc->u.xxxx.xr2));
pc = NEXTOP(pc,xxxx);
break;
/* instructions type xxy */
case _p_func2f_xy:
CHECK(save_X(stream, pc->u.xxy.x));
CHECK(save_X(stream, pc->u.xxy.x1));
CHECK(save_Y(stream, pc->u.xxy.y2));
pc = NEXTOP(pc,xxy);
break;
/* instructions type y */
case _save_b_y:
case _write_y_loc:
case _write_y_val:
case _write_y_var:
CHECK(save_Y(stream, pc->u.y.y));
pc = NEXTOP(pc,y);
break;
/* instructions type yl */
case _p_atom_y:
case _p_atomic_y:
case _p_compound_y:
case _p_db_ref_y:
case _p_float_y:
case _p_integer_y:
case _p_nonvar_y:
case _p_number_y:
case _p_primitive_y:
case _p_var_y:
CHECK(save_Y(stream, pc->u.yl.y));
CHECK(save_PtoOp(stream, pc->u.yl.F));
pc = NEXTOP(pc,yl);
break;
/* instructions type yps */
case _commit_b_y:
CHECK(save_Y(stream, pc->u.yps.y));
CHECK(save_PtoPred(stream, pc->u.yps.p0));
CHECK(save_Constant(stream, pc->u.yps.s));
pc = NEXTOP(pc,yps);
break;
/* instructions type yx */
case _get_y_val:
case _get_y_var:
case _gl_void_valy:
case _gl_void_vary:
case _glist_valy:
case _put_unsafe:
case _put_y_val:
case _put_y_var:
CHECK(save_Y(stream, pc->u.yx.y));
CHECK(save_X(stream, pc->u.yx.x));
pc = NEXTOP(pc,yx);
break;
/* instructions type yxn */
case _p_and_y_vc:
case _p_arg_y_cv:
case _p_div_y_cv:
case _p_div_y_vc:
case _p_func2s_y_cv:
case _p_func2s_y_vc:
case _p_minus_y_cv:
case _p_or_y_vc:
case _p_plus_y_vc:
case _p_sll_y_cv:
case _p_sll_y_vc:
case _p_slr_y_cv:
case _p_slr_y_vc:
case _p_times_y_vc:
CHECK(save_Y(stream, pc->u.yxn.y));
CHECK(save_X(stream, pc->u.yxn.xi));
CHECK(save_Integer(stream, pc->u.yxn.c));
pc = NEXTOP(pc,yxn);
break;
/* instructions type yxx */
case _p_and_y_vv:
case _p_arg_y_vv:
case _p_div_y_vv:
case _p_func2f_yx:
case _p_func2s_y_vv:
case _p_minus_y_vv:
case _p_or_y_vv:
case _p_plus_y_vv:
case _p_sll_y_vv:
case _p_slr_y_vv:
case _p_times_y_vv:
CHECK(save_Y(stream, pc->u.yxx.y));
CHECK(save_X(stream, pc->u.yxx.x1));
CHECK(save_X(stream, pc->u.yxx.x2));
pc = NEXTOP(pc,yxx);
break;
/* instructions type yyx */
case _p_func2f_yy:
CHECK(save_Y(stream, pc->u.yyx.y1));
CHECK(save_Y(stream, pc->u.yyx.y2));
CHECK(save_X(stream, pc->u.yyx.x));
pc = NEXTOP(pc,yyx);
break;
/* instructions type yyxx */
case _get_yy_var:
case _put_y_vals:
CHECK(save_Y(stream, pc->u.yyxx.y1));
CHECK(save_Y(stream, pc->u.yyxx.y2));
CHECK(save_X(stream, pc->u.yyxx.x1));
CHECK(save_X(stream, pc->u.yyxx.x2));
pc = NEXTOP(pc,yyxx);
break;
#ifdef YAPOR
/* instructions type Otapl */
case _getwork:
case _getwork_seq:
case _sync:
#ifdef YAPOR
CHECK(save_OrArg(stream, pc->u.Otapl.or_arg));
#endif
#ifdef TABLING
CHECK(save_TabEntry(stream, pc->u.Otapl.te));
#endif
CHECK(save_Arity(stream, pc->u.Otapl.s));
CHECK(save_PtoPred(stream, pc->u.Otapl.p));
CHECK(save_PtoOp(stream, pc->u.Otapl.d));
pc = NEXTOP(pc,Otapl);
break;
/* instructions type e */
case _getwork_first_time:
if (op == _Nstop || op == _copy_idb_term || op == _unify_idb_term) return 1;
pc = NEXTOP(pc,e);
break;
#endif
#ifdef TABLING
/* instructions type Otapl */
case _table_answer_resolution:
case _table_completion:
case _table_load_answer:
case _table_retry:
case _table_retry_me:
case _table_trust:
case _table_trust_me:
case _table_try:
case _table_try_answer:
case _table_try_me:
case _table_try_single:
#ifdef YAPOR
CHECK(save_OrArg(stream, pc->u.Otapl.or_arg));
#endif
#ifdef TABLING
CHECK(save_TabEntry(stream, pc->u.Otapl.te));
#endif
CHECK(save_Arity(stream, pc->u.Otapl.s));
CHECK(save_PtoPred(stream, pc->u.Otapl.p));
CHECK(save_PtoOp(stream, pc->u.Otapl.d));
pc = NEXTOP(pc,Otapl);
break;
/* instructions type e */
#ifdef TABLING_INNER_CUTS
case _clause_with_cut:
#endif
if (op == _Nstop || op == _copy_idb_term || op == _unify_idb_term) return 1;
pc = NEXTOP(pc,e);
break;
/* instructions type s */
case _table_new_answer:
CHECK(save_Constant(stream, pc->u.s.s));
pc = NEXTOP(pc,s);
break;
/* instructions type e */
case _trie_do_appl:
case _trie_do_appl_in_pair:
case _trie_do_atom:
case _trie_do_atom_in_pair:
case _trie_do_double:
case _trie_do_extension:
case _trie_do_gterm:
case _trie_do_longint:
case _trie_do_null:
case _trie_do_null_in_pair:
case _trie_do_pair:
case _trie_do_val:
case _trie_do_val_in_pair:
case _trie_do_var:
case _trie_do_var_in_pair:
case _trie_retry_appl:
case _trie_retry_appl_in_pair:
case _trie_retry_atom:
case _trie_retry_atom_in_pair:
case _trie_retry_double:
case _trie_retry_extension:
case _trie_retry_gterm:
case _trie_retry_longint:
case _trie_retry_null:
case _trie_retry_null_in_pair:
case _trie_retry_pair:
case _trie_retry_val:
case _trie_retry_val_in_pair:
case _trie_retry_var:
case _trie_retry_var_in_pair:
case _trie_trust_appl:
case _trie_trust_appl_in_pair:
case _trie_trust_atom:
case _trie_trust_atom_in_pair:
case _trie_trust_double:
case _trie_trust_extension:
case _trie_trust_gterm:
case _trie_trust_longint:
case _trie_trust_null:
case _trie_trust_null_in_pair:
case _trie_trust_pair:
case _trie_trust_val:
case _trie_trust_val_in_pair:
case _trie_trust_var:
case _trie_trust_var_in_pair:
case _trie_try_appl:
case _trie_try_appl_in_pair:
case _trie_try_atom:
case _trie_try_atom_in_pair:
case _trie_try_double:
case _trie_try_extension:
case _trie_try_gterm:
case _trie_try_longint:
case _trie_try_null:
case _trie_try_null_in_pair:
case _trie_try_pair:
case _trie_try_val:
case _trie_try_val_in_pair:
case _trie_try_var:
case _trie_try_var_in_pair:
if (op == _Nstop || op == _copy_idb_term || op == _unify_idb_term) return 1;
pc = NEXTOP(pc,e);
break;
#endif
default:
return -1;
}
}

9
H/sshift.h Executable file → Normal file
View File

@ -49,7 +49,6 @@
// #define IntegerAdjust(D) IntegerAdjust__(P PASS_REGS)
#define AddrAdjust(P) AddrAdjust__(P PASS_REGS)
#define BlockAdjust(P) BlockAdjust__(P PASS_REGS)
#define MFileAdjust(P) MFileAdjust__(P PASS_REGS)
#define CodeVarAdjust(P) CodeVarAdjust__(P PASS_REGS)
#define ConstantAdjust(P) ConstantAdjust__(P PASS_REGS)
#define ArityAdjust(P) ArityAdjust__(P PASS_REGS)
@ -607,14 +606,6 @@ AtomEntryAdjust__ (AtomEntry * at USES_REGS)
return (AtomEntry *) ((AtomEntry *) (CharP (at) + LOCAL_HDiff));
}
inline EXTERN struct mfile *MFileAdjust__ (struct mfile * CACHE_TYPE);
inline EXTERN struct mfile *
MFileAdjust__ (struct mfile * at USES_REGS)
{
return (struct mfile *) (CharP (at) + LOCAL_HDiff);
}
inline EXTERN GlobalEntry *GlobalEntryAdjust__ (GlobalEntry * CACHE_TYPE);
inline EXTERN GlobalEntry *

View File

@ -34,9 +34,9 @@
case _p_execute:
pc = NEXTOP(pc,Osbmp);
break;
/* instructions type Osbpi */
/* instructions type Osbpa */
case _ensure_space:
pc = NEXTOP(pc,Osbpi);
pc = NEXTOP(pc,Osbpa);
break;
/* instructions type Osbpp */
case _call_cpred:

View File

@ -221,28 +221,6 @@ typedef struct AliasDescS {
/************ SWI compatible support for different encodings ************/
#ifndef _PL_STREAM_H
typedef enum {
ENC_OCTET = 0,
ENC_ISO_LATIN1 = 1,
ENC_ISO_ASCII = 2,
ENC_ISO_ANSI = 4,
ENC_ISO_UTF8 = 8,
ENC_UNICODE_BE = 16,
ENC_UNICODE_LE = 32,
ENC_ISO_UTF32_BE = 64,
ENC_ISO_UTF32_LE = 128
} encoding_t;
#else
#define ENC_ISO_LATIN1 ENC_ISO_LATIN_1
#define ENC_ISO_UTF32_BE ENC_UNKNOWN //bogus
#define ENC_ISO_UTF32_LE ENC_WCHAR // bogus
#define ENC_ISO_UTF8 ENC_UTF8
#define ENC_ISO_ASCII ENC_ASCII
#define ENC_ISO_ANSI ENC_ANSI
typedef IOENC encoding_t;
#endif
#define MAX_ISO_LATIN1 255
/****************** character definition table **************************/

0
LGPL/swi_console/Makefile.in Executable file → Normal file
View File

0
LGPL/swi_console/complete.c Executable file → Normal file
View File

0
LGPL/swi_console/console.c Executable file → Normal file
View File

0
LGPL/swi_console/console.h Executable file → Normal file
View File

0
LGPL/swi_console/edit.c Executable file → Normal file
View File

0
LGPL/swi_console/menu.c Executable file → Normal file
View File

0
LGPL/swi_console/menu.h Executable file → Normal file
View File

View File

@ -414,5 +414,5 @@ wait_reply(Value) :-
prolog:message(thread_pool(Message)) -->
message(Message).
message(manager_died(Status)) -->
prolog:message(manager_died(Status)) -->
[ 'Thread-pool: manager died on status ~p; restarting'-[Status] ].

0
MYDDAS/myddas_mysql.c Executable file → Normal file
View File

0
MYDDAS/myddas_odbc.c Executable file → Normal file
View File

0
MYDDAS/myddas_util.c Executable file → Normal file
View File

204
Makefile.in Executable file → Normal file
View File

@ -60,7 +60,7 @@ YAPSTARTUP=startup.yss
#
CC=@CC@
MPI_CC=@MPI_CC@
CPPFLAGS=@CPPFLAGS@ -I. -I$(srcdir)/H -I$(srcdir)/include -I$(srcdir)/OPTYap -I$(srcdir)/BEAM -I$(srcdir)/MYDDAS
CPPFLAGS=@CPPFLAGS@ -I. -I$(srcdir)/H -I$(srcdir)/include -I$(srcdir)/os -I$(srcdir)/OPTYap -I$(srcdir)/BEAM -I$(srcdir)/MYDDAS
EXECUTABLE_CFLAGS= @CFLAGS@ $(YAP_EXTRAS) $(DEFS) $(CPPFLAGS)
CFLAGS= @YAPLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) $(CPPFLAGS)
C_INTERF_FLAGS= @YAPLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) $(CPPFLAGS) -I$(srcdir)/include
@ -115,25 +115,24 @@ INTERFACE_HEADERS = \
$(srcdir)/include/yap_structs.h \
$(srcdir)/include/YapInterface.h \
$(srcdir)/include/SWI-Prolog.h \
$(srcdir)/include/SWI-Stream.h
$(srcdir)/os/SWI-Stream.h
IOLIB_HEADERS=$(srcdir)/packages/PLStream/pl-buffer.h \
$(srcdir)/packages/PLStream/pl-ctype.h \
$(srcdir)/packages/PLStream/pl-codelist.h \
$(srcdir)/packages/PLStream/pl-dtoa.h \
$(srcdir)/packages/PLStream/dtoa.c \
$(srcdir)/packages/PLStream/pl-incl.h \
$(srcdir)/packages/PLStream/pl-global.h \
$(srcdir)/packages/PLStream/pl-mswchar.h \
$(srcdir)/packages/PLStream/pl-option.h \
$(srcdir)/packages/PLStream/pl-opts.h \
$(srcdir)/packages/PLStream/pl-os.h \
$(srcdir)/packages/PLStream/pl-privitf.h \
$(srcdir)/packages/PLStream/pl-stream.h \
$(srcdir)/packages/PLStream/pl-table.h \
$(srcdir)/packages/PLStream/pl-text.h \
$(srcdir)/packages/PLStream/pl-utf8.h \
$(srcdir)/packages/PLStream/pl-yap.h @ENABLE_WINCONSOLE@ $(srcdir)/packages/PLStream/windows/dirent.h $(srcdir)/packages/PLStream/windows/utf8.h $(srcdir)/packages/PLStream/windows/utf8.c $(srcdir)/packages/PLStream/windows/uxnt.h $(srcdir)/packages/PLStream/windows/mswchar.h $(srcdir)/packages/PLStream/windows/popen.c
IOLIB_HEADERS=$(srcdir)/os/pl-buffer.h \
$(srcdir)/os/pl-ctype.h \
$(srcdir)/H/pl-codelist.h \
$(srcdir)/os/pl-dtoa.h \
$(srcdir)/os/dtoa.c \
$(srcdir)/H/pl-incl.h \
$(srcdir)/H/pl-global.h \
$(srcdir)/os/pl-mswchar.h \
$(srcdir)/os/pl-option.h \
$(srcdir)/os/pl-os.h \
$(srcdir)/os/pl-privitf.h \
$(srcdir)/os/pl-stream.h \
$(srcdir)/os/pl-table.h \
$(srcdir)/os/pl-text.h \
$(srcdir)/os/pl-utf8.h \
$(srcdir)/H/pl-yap.h @ENABLE_WINCONSOLE@ $(srcdir)/os/windows/dirent.h $(srcdir)/os/windows/utf8.h $(srcdir)/os/windows/utf8.c $(srcdir)/os/windows/uxnt.h $(srcdir)/os/windows/mswchar.h $(srcdir)/os/windows/popen.c
HEADERS = \
$(srcdir)/H/TermExt.h \
@ -174,6 +173,7 @@ HEADERS = \
$(srcdir)/H/index.h \
$(srcdir)/H/iopreds.h \
$(srcdir)/H/iswiatoms.h \
$(srcdir)/H/qly.h \
$(srcdir)/H/rclause.h \
$(srcdir)/H/rglobals.h \
$(srcdir)/H/rlocals.h \
@ -201,26 +201,26 @@ HEADERS = \
$(srcdir)/MYDDAS/myddas_statistics_structs.h \
$(srcdir)/MYDDAS/myddas_wkb.h $(srcdir)/MYDDAS/myddas_wkb2prolog.h
IOLIB_SOURCES=$(srcdir)/packages/PLStream/pl-buffer.c $(srcdir)/packages/PLStream/pl-ctype.c \
$(srcdir)/packages/PLStream/pl-codelist.c \
$(srcdir)/packages/PLStream/pl-dtoa.c \
$(srcdir)/packages/PLStream/pl-error.c \
$(srcdir)/packages/PLStream/pl-file.c \
$(srcdir)/packages/PLStream/pl-files.c \
$(srcdir)/packages/PLStream/pl-fmt.c \
$(srcdir)/packages/PLStream/pl-glob.c \
$(srcdir)/packages/PLStream/pl-option.c \
$(srcdir)/packages/PLStream/pl-os.c \
$(srcdir)/packages/PLStream/pl-prologflag.c \
$(srcdir)/packages/PLStream/pl-privitf.c \
$(srcdir)/packages/PLStream/pl-read.c \
$(srcdir)/packages/PLStream/pl-rl.c \
$(srcdir)/packages/PLStream/pl-stream.c $(srcdir)/packages/PLStream/pl-string.c \
$(srcdir)/packages/PLStream/pl-table.c \
$(srcdir)/packages/PLStream/pl-tai.c \
$(srcdir)/packages/PLStream/pl-text.c \
$(srcdir)/packages/PLStream/pl-write.c \
$(srcdir)/packages/PLStream/pl-yap.c @ENABLE_WINCONSOLE@$(srcdir)/packages/PLStream/windows/uxnt.c
IOLIB_SOURCES=$(srcdir)/os/pl-buffer.c $(srcdir)/os/pl-ctype.c \
$(srcdir)/os/pl-codelist.c \
$(srcdir)/os/pl-dtoa.c \
$(srcdir)/os/pl-error.c \
$(srcdir)/os/pl-file.c \
$(srcdir)/os/pl-files.c \
$(srcdir)/os/pl-fmt.c \
$(srcdir)/os/pl-glob.c \
$(srcdir)/os/pl-option.c \
$(srcdir)/os/pl-os.c \
$(srcdir)/os/pl-prologflag.c \
$(srcdir)/os/pl-privitf.c \
$(srcdir)/os/pl-read.c \
$(srcdir)/os/pl-rl.c \
$(srcdir)/os/pl-stream.c $(srcdir)/os/pl-string.c \
$(srcdir)/os/pl-table.c \
$(srcdir)/os/pl-tai.c \
$(srcdir)/os/pl-text.c \
$(srcdir)/os/pl-write.c \
$(srcdir)/C/pl-yap.c @ENABLE_WINCONSOLE@$(srcdir)/os/windows/uxnt.c
C_SOURCES= \
$(IOLIB_SOURCES) \
@ -248,6 +248,8 @@ C_SOURCES= \
$(srcdir)/C/load_shl.c $(srcdir)/C/load_dyld.c \
$(srcdir)/C/mavar.c $(srcdir)/C/modules.c $(srcdir)/C/other.c \
$(srcdir)/C/parser.c \
$(srcdir)/C/qlyr.c \
$(srcdir)/C/qlyw.c \
$(srcdir)/C/save.c $(srcdir)/C/scanner.c \
$(srcdir)/C/sort.c $(srcdir)/C/stdpreds.c $(srcdir)/C/sysbits.c \
$(srcdir)/C/threads.c \
@ -315,6 +317,7 @@ PL_SOURCES= \
$(srcdir)/pl/modules.yap $(srcdir)/pl/preds.yap \
$(srcdir)/pl/profile.yap \
$(srcdir)/pl/protect.yap \
$(srcdir)/pl/qly.yap \
$(srcdir)/pl/save.yap \
$(srcdir)/pl/setof.yap \
$(srcdir)/pl/signals.yap \
@ -356,7 +359,7 @@ ENGINE_OBJECTS = \
myddas_mysql.o myddas_odbc.o myddas_shared.o myddas_initialization.o \
myddas_util.o myddas_statistics.o myddas_top_level.o \
myddas_wkb2prolog.o modules.o other.o \
parser.o save.o scanner.o sort.o stdpreds.o \
parser.o qlyr.o qlyw.o save.o scanner.o sort.o stdpreds.o \
sysbits.o threads.o tracer.o \
udi.o rtree.o rtree_udi.o\
unify.o userpreds.o utilpreds.o \
@ -442,6 +445,12 @@ init.o: $(srcdir)/C/init.c config.h
load_foreign.o: $(srcdir)/C/load_foreign.c config.h
$(CC) -c $(CFLAGS) $(srcdir)/C/load_foreign.c -o $@
qlyr.o: $(srcdir)/C/qlyr.c config.h
$(CC) -c $(CFLAGS) $(srcdir)/C/qlyr.c -o $@
qlyw.o: $(srcdir)/C/qlyw.c config.h
$(CC) -c $(CFLAGS) $(srcdir)/C/qlyw.c -o $@
save.o: $(srcdir)/C/save.c config.h
$(CC) -c $(CFLAGS) $(srcdir)/C/save.c -o $@
@ -538,7 +547,7 @@ eamindex.o: $(srcdir)/BEAM/eamindex.c config.h
sys.o: $(srcdir)/library/system/sys.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include $(srcdir)/library/system/sys.c -o $@
swi.o: $(srcdir)/library/dialect/swi/fli/swi.c $(srcdir)/library/dialect/swi/fli/swi.h $(srcdir)/include/SWI-Prolog.h $(srcdir)/include/SWI-Stream.h config.h
swi.o: $(srcdir)/library/dialect/swi/fli/swi.c $(srcdir)/library/dialect/swi/fli/swi.h $(srcdir)/include/SWI-Prolog.h $(srcdir)/os/SWI-Stream.h config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir)/library/dialect/swi/fli $(srcdir)/library/dialect/swi/fli/swi.c -o $@
blobs.o: $(srcdir)/library/dialect/swi/fli/blobs.c $(srcdir)/library/dialect/swi/fli/swi.h $(srcdir)/include/SWI-Prolog.h config.h
@ -562,92 +571,92 @@ regfree.o: $(srcdir)/library/regex/regfree.c $(srcdir)/library/regex/regex2.h co
regexec.o: $(srcdir)/library/regex/regexec.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir)/library/regex $(srcdir)/library/regex/regexec.c -o regexec.o
pl-nt.o: $(srcdir)/packages/PLStream/pl-nt.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-nt.c -o $@
pl-nt.o: $(srcdir)/os/pl-nt.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-nt.c -o $@
pl-ntcon.o: $(srcdir)/console/LGPL/pl-ntcon.c config.h
$(CC) -municode -DUNICODE -D_UNICODE -c $(CFLAGS) -DPL_CONSOLE=1 -I$(srcdir)/include $(srcdir)/console/LGPL/pl-ntcon.c -o $@
pl-ntconsole.o: $(srcdir)/console/LGPL/pl-ntconsole.c config.h
$(CC) -municode -DUNICODE -D_UNICODE -c $(CFLAGS) -DPL_CONSOLE=1 -I$(srcdir) -I$(srcdir)/include -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/console/LGPL/pl-ntconsole.c -o $@
$(CC) -municode -DUNICODE -D_UNICODE -c $(CFLAGS) -DPL_CONSOLE=1 -I$(srcdir) -I$(srcdir)/include -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/console/LGPL/pl-ntconsole.c -o $@
pl-ntmain.o: $(srcdir)/console/LGPL/pl-ntmain.c config.h
$(CC) -municode -DUNICODE -D_UNICODE -c $(CFLAGS) -DPL_CONSOLE=1 -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/console/LGPL/pl-ntmain.c -o $@
$(CC) -municode -DUNICODE -D_UNICODE -c $(CFLAGS) -DPL_CONSOLE=1 -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/console/LGPL/pl-ntmain.c -o $@
pl-buffer.o: $(srcdir)/packages/PLStream/pl-buffer.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-buffer.c -o $@
pl-buffer.o: $(srcdir)/os/pl-buffer.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-buffer.c -o $@
pl-codelist.o: $(srcdir)/packages/PLStream/pl-codelist.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-codelist.c -o $@
pl-codelist.o: $(srcdir)/os/pl-codelist.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-codelist.c -o $@
pl-ctype.o: $(srcdir)/packages/PLStream/pl-ctype.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-ctype.c -o $@
pl-ctype.o: $(srcdir)/os/pl-ctype.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-ctype.c -o $@
pl-dtoa.o: $(srcdir)/packages/PLStream/pl-dtoa.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-dtoa.c -o $@
pl-dtoa.o: $(srcdir)/os/pl-dtoa.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-dtoa.c -o $@
pl-error.o: $(srcdir)/packages/PLStream/pl-error.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-error.c -o $@
pl-error.o: $(srcdir)/os/pl-error.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-error.c -o $@
pl-file.o: $(srcdir)/packages/PLStream/pl-file.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-file.c -o $@
pl-file.o: $(srcdir)/os/pl-file.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-file.c -o $@
pl-files.o: $(srcdir)/packages/PLStream/pl-files.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-files.c -o $@
pl-files.o: $(srcdir)/os/pl-files.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-files.c -o $@
pl-fmt.o: $(srcdir)/packages/PLStream/pl-fmt.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-fmt.c -o $@
pl-fmt.o: $(srcdir)/os/pl-fmt.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-fmt.c -o $@
pl-glob.o: $(srcdir)/packages/PLStream/pl-glob.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-glob.c -o $@
pl-glob.o: $(srcdir)/os/pl-glob.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-glob.c -o $@
pl-option.o: $(srcdir)/packages/PLStream/pl-option.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-option.c -o $@
pl-option.o: $(srcdir)/os/pl-option.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-option.c -o $@
pl-os.o: $(srcdir)/packages/PLStream/pl-os.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-os.c -o $@
pl-os.o: $(srcdir)/os/pl-os.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-os.c -o $@
pl-privitf.o: $(srcdir)/packages/PLStream/pl-privitf.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-privitf.c -o $@
pl-privitf.o: $(srcdir)/os/pl-privitf.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-privitf.c -o $@
pl-prologflag.o: $(srcdir)/packages/PLStream/pl-prologflag.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-prologflag.c -o $@
pl-prologflag.o: $(srcdir)/os/pl-prologflag.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-prologflag.c -o $@
pl-rl.o: $(srcdir)/packages/PLStream/pl-rl.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-rl.c -o $@
pl-rl.o: $(srcdir)/os/pl-rl.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-rl.c -o $@
pl-read.o: $(srcdir)/packages/PLStream/pl-read.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-read.c -o $@
pl-read.o: $(srcdir)/os/pl-read.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-read.c -o $@
pl-stream.o: $(srcdir)/packages/PLStream/pl-stream.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-stream.c -o $@
pl-stream.o: $(srcdir)/os/pl-stream.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-stream.c -o $@
pl-string.o: $(srcdir)/packages/PLStream/pl-string.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-string.c -o $@
pl-string.o: $(srcdir)/os/pl-string.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-string.c -o $@
pl-table.o: $(srcdir)/packages/PLStream/pl-table.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-table.c -o $@
pl-table.o: $(srcdir)/os/pl-table.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-table.c -o $@
pl-text.o: $(srcdir)/packages/PLStream/pl-text.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-text.c -o $@
pl-text.o: $(srcdir)/os/pl-text.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-text.c -o $@
pl-utf8.o: $(srcdir)/packages/PLStream/pl-utf8.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-utf8.c -o $@
pl-utf8.o: $(srcdir)/os/pl-utf8.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-utf8.c -o $@
pl-write.o: $(srcdir)/packages/PLStream/pl-write.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-write.c -o $@
pl-write.o: $(srcdir)/os/pl-write.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-write.c -o $@
pl-yap.o: $(srcdir)/packages/PLStream/pl-yap.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-yap.c -o $@
pl-yap.o: $(srcdir)/C/pl-yap.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/C/pl-yap.c -o $@
pl-tai.o: $(srcdir)/packages/PLStream/pl-tai.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-tai.c -o $@
pl-tai.o: $(srcdir)/os/pl-tai.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/pl-tai.c -o $@
uxnt.o: $(srcdir)/packages/PLStream/windows/uxnt.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/windows/uxnt.c -o $@
uxnt.o: $(srcdir)/os/windows/uxnt.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/os/windows/uxnt.c -o $@
# libtai rule
%.o : $(srcdir)/packages/PLStream/libtai/%.c config.h
%.o : $(srcdir)/os/libtai/%.c config.h
$(CC) -c $(CFLAGS) $< -o $@
@ -672,6 +681,7 @@ mycb: $(srcdir)/mycb.c
$(CC) $(CFLAGS) $(srcdir)/mycb.c -o mycb
all: startup.yss
@ENABLE_GECODE@ @INSTALL_DLLS@ (cd library/gecode; $(MAKE))
@INSTALL_DLLS@ (cd library/lammpi; $(MAKE))
@INSTALL_MATLAB@ (cd library/matlab; $(MAKE))
@INSTALL_DLLS@ (cd library/matrix; $(MAKE))
@ -701,7 +711,7 @@ all: startup.yss
startup.yss: yap@EXEC_SUFFIX@ $(PL_SOURCES)
-rm -f startup.yss
echo "bootstrap('$(srcdir)/pl/init.yap'). module(user). save_program('startup.yss')." | @PRE_INSTALL_ENV@ ./yap -b $(srcdir)/pl/boot.yap
echo "bootstrap('$(srcdir)/pl/init.yap'). module(user). qsave_program('startup.yss')." | @PRE_INSTALL_ENV@ ./yap -b $(srcdir)/pl/boot.yap
yap@EXEC_SUFFIX@: $(HEADERS) yap.o @YAPLIB@
$(MPI_CC) $(EXECUTABLE_CFLAGS) $(LDFLAGS) -o yap yap.o @YAPLIB@ $(LIBS) @MPI_LIBS@
@ -744,6 +754,7 @@ install_unix: startup.yss libYap.a
@INSTALL_DLLS@ (cd library/rltree; $(MAKE) install)
@INSTALL_DLLS@ (cd library/system; $(MAKE) install)
@INSTALL_DLLS@ (cd library/tries; $(MAKE) install)
@ENABLE_GECODE@ @INSTALL_DLLS@ (cd library/gecode; $(MAKE) install)
@ENABLE_CLIB@ @INSTALL_DLLS@ (cd packages/clib; $(MAKE) install)
@ENABLE_HTTP@ @INSTALL_DLLS@ (cd packages/http; $(MAKE) install)
@ENABLE_PLDOC@ @INSTALL_DLLS@ (cd packages/pldoc; $(MAKE) install)
@ -843,7 +854,7 @@ TAGS: $(C_SOURCES) $(PL_SOURCES) $(HEADERS)
depend: $(HEADERS) $(C_SOURCES)
-@if test "$(GCC)" = yes; then\
$(CC) -MM $(CFLAGS) -I$(srcdir)/include $(C_SOURCES) >> Makefile;\
$(CC) -MM $(CFLAGS) -I$(srcdir) -I$(srcdir)/include -I$(srcdir)/os $(C_SOURCES) >> Makefile;\
else\
makedepend -f - -- $(CFLAGS) -I$(srcdir)/include -- $(C_SOURCES) |\
sed 's|.*/\([^:]*\):|\1:|' >> Makefile ;\
@ -851,6 +862,7 @@ depend: $(HEADERS) $(C_SOURCES)
clean: clean_docs
rm -f *.o *~ *.BAK *.a
@ENABLE_GECODE@ @INSTALL_DLLS@ (cd library/gecode; $(MAKE) clean)
@INSTALL_DLLS@ (cd library/lammpi; $(MAKE) clean)
@INSTALL_MATLAB@ (cd library/matlab; $(MAKE) clean)
@INSTALL_DLLS@ (cd library/matrix; $(MAKE) clean)

0
VC/include/Atoms.h Executable file → Normal file
View File

0
VC/wyap.mak Executable file → Normal file
View File

0
VC/yapdll.mak Executable file → Normal file
View File

0
build-distr Executable file → Normal file
View File

0
config.guess vendored Executable file → Normal file
View File

3
config.h.in Executable file → Normal file
View File

@ -1,6 +1,9 @@
#include "parms.h"
/* are dynamic arrays supported? */
#undef HAVE_DYNARRAY
/* are we using gcc */
#undef HAVE_GCC

0
config.sub vendored Executable file → Normal file
View File

2178
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -55,6 +55,41 @@ AC_PROG_AWK
AC_SUBST(GCC)
AC_SUBST(C_INTERF_FLAGS)
AC_SUBST(C_PARSER_FLAGS)
AC_LANG(C)
dnl Gecode support
AC_CHECK_HEADER(gecode/support/config.hpp,
have_gecode=yes, have_gecode=no)
use_gecode_default=no
AC_SUBST(PYTHON)
if test "$have_gecode" = yes; then
AC_CHECK_PROGS(PYTHON, [python2.78 python], [none])
if test "$PYTHON" != none; then
use_gecode_default=yes
fi
else
PYTHON=none
fi
AC_ARG_ENABLE(gecode,
[ --enable-gecode install gecode library],
[use_gecode="$enableval"
if test "$use_gecode" = yes; then
if test "$have_gecode" = no; then
AC_MSG_ERROR([cannot enable gecode: gecode library not found])
fi
if test "$PYTHON" = none; then
AC_MSG_ERROR([cannot enable gecode: python not found])
fi
fi], use_gecode=$use_gecode_default)
AC_MSG_CHECKING([if dynamic arrays are supported])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[void foo(int n) { int a[n]; a[1]=0; }]],[[foo(3);]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_DYNARRAY],[1],[Define if dynamic arrays are supported])
],[
AC_MSG_RESULT([no])
])
AC_ARG_ENABLE(tabling,
[ --enable-tabling support tabling ],
@ -198,7 +233,7 @@ AC_ARG_WITH(cudd,
[yap_cv_cudd=no])
AC_ARG_ENABLE(myddas,
v [ --enable-myddas[[=DIR]] enable the MYDDAS library],
[ --enable-myddas[[=DIR]] enable the MYDDAS library],
if test "$enableval" = yes; then
yap_cv_myddas=/usr
elif test "$enableval" = no; then
@ -475,11 +510,11 @@ if test "$GCC" = "yes"
then
if test "$debugyap" = "yes"
then
CXXFLAGS="-O -g -Wall $CFLAGS"
CXXFLAGS="-O -g -Wall $CXXFLAGS"
C_INTERF_FLAGS="-O -g -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
CFLAGS="-O -g -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
else
CXXFLAGS="-O3 -fomit-frame-pointer -Wall $CFLAGS"
CXXFLAGS="-O3 -fomit-frame-pointer -Wall $CXXFLAGS"
C_INTERF_FLAGS="-O3 -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
C_PARSER_FLAGS="-O3 -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
CFLAGS="-O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
@ -495,7 +530,7 @@ then
case "$target_os" in
*solaris[2-9]*) dnl
CFLAGS="-mno-app-regs -DOPTIMISE_ALL_REGS_FOR_SPARC=1 $CFLAGS"
CXXFLAGS="-mno-app-regs -DOPTIMISE_ALL_REGS_FOR_SPARC=1 $CFPPLAGS"
CXXFLAGS="-mno-app-regs -DOPTIMISE_ALL_REGS_FOR_SPARC=1 $CXXFLAGS"
;;
esac
;;
@ -544,7 +579,7 @@ else
CFLAGS="-A -A $CFLAGS"
elif test "$CC" = "cl"
then
CXXFLAGS="-/nologo $CFLAGS"
CXXFLAGS="-/nologo $CXXFLAGS"
CFLAGS="/nologo $CFLAGS"
CPP="/nologo /E"
fi
@ -554,10 +589,10 @@ else
then
if test "$debugyap" = "yes"
then
CXXFLAGS="-Ae -g -O $CFLAGS"
CXXFLAGS="-Ae -g -O $CXXFLAGS"
CFLAGS="-Ae -g -O $CFLAGS"
else
CXXFLAGS="-Ae +O3 +Onolimit $CFLAGS"
CXXFLAGS="-Ae +O3 +Onolimit $CXXFLAGS"
CFLAGS="-Ae +O3 +Onolimit $CFLAGS"
fi
fi
@ -747,6 +782,13 @@ fi
CMFLAGS=-fpic
CIFLAGS=-I.
if test "$use_gecode" = no; then
ENABLE_GECODE="@# "
else
ENABLE_GECODE=""
fi
AC_SUBST(ENABLE_GECODE)
if test "$use_chr" = no; then
ENABLE_CHR="@# "
elif test -e "$srcdir"/packages/chr/Makefile.in; then
@ -2225,5 +2267,9 @@ if test "$ENABLE_CLPBN_BP" = ""; then
AC_CONFIG_FILES([packages/CLPBN/clpbn/bp/Makefile])
fi
if test "$ENABLE_GECODE" = ""; then
AC_CONFIG_FILES([library/gecode/Makefile])
fi
AC_OUTPUT()

0
console/LGPL/pl-ntcon.c Executable file → Normal file
View File

0
console/LGPL/pl-ntconsole.c Executable file → Normal file
View File

0
console/LGPL/pl-ntmain.c Executable file → Normal file
View File

0
distribute Executable file → Normal file
View File

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