This commit is contained in:
Vitor Santos Costa 2017-11-11 02:15:59 +00:00
parent 4271f3debe
commit d23f7c149f
13 changed files with 902 additions and 1026 deletions

View File

@ -1,20 +1,20 @@
/************************************************************************* /*************************************************************************
* * * *
* YAP Prolog * * YAP Prolog *
* * * *
* Yap Prolog was developed at NCCUP - Universidade do Porto * * Yap Prolog was developed at NCCUP - Universidade do Porto *
* * * *
* Copyright L.Damas, V. Santos Costa and Universidade do Porto 1985-- * * Copyright L.Damas, V. Santos Costa and Universidade do Porto 1985-- *
* * * *
************************************************************************** **************************************************************************
* * * *
* File: qlyr.c * * File: qlyr.c *
* comments: quick saver/loader * * comments: quick saver/loader *
* * * *
* Last rev: $Date: 2011-08-29$,$Author: vsc $ * * Last rev: $Date: 2011-08-29$,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * * $Log: not supported by cvs2svn $ *
* * * *
*************************************************************************/ *************************************************************************/
/** /**
* *
* @file qlyr.c * @file qlyr.c
@ -638,7 +638,7 @@ static bool checkChars(FILE *stream, char s[]) {
} }
static Atom do_header(FILE *stream) { static Atom do_header(FILE *stream) {
char s[256], *p = s, ch; char s[2560], *p = s, ch;
Atom at; Atom at;
if (!checkChars(stream, "#!/bin/sh\nexec_dir=${YAPBINDIR:-")) if (!checkChars(stream, "#!/bin/sh\nexec_dir=${YAPBINDIR:-"))
@ -696,7 +696,7 @@ static void ReadHash(FILE *stream) {
Atom at; Atom at;
qlf_tag_t tg = read_tag(stream); qlf_tag_t tg = read_tag(stream);
if (tg == QLY_ATOM) { if (tg == QLY_ATOM) {
char *rep = (char *)AllocTempSpace(); char *rep = (char *)AllocTempSpace();
UInt len; UInt len;

445
C/qlyw.c
View File

@ -1,20 +1,20 @@
/************************************************************************* /*************************************************************************
* * * *
* YAP Prolog * * YAP Prolog *
* * * *
* Yap Prolog was developed at NCCUP - Universidade do Porto * * Yap Prolog was developed at NCCUP - Universidade do Porto *
* * * *
* Copyright L.Damas, V. Santos Costa and Universidade do Porto 1985-- * * Copyright L.Damas, V. Santos Costa and Universidade do Porto 1985-- *
* * * *
************************************************************************** **************************************************************************
* * * *
* File: qlyw.c * * File: qlyw.c *
* comments: quick saver/loader * * comments: quick saver/loader *
* * * *
* Last rev: $Date: 2011-08-29$,$Author: vsc $ * * Last rev: $Date: 2011-08-29$,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * * $Log: not supported by cvs2svn $ *
* * * *
*************************************************************************/ *************************************************************************/
/** /**
* *
@ -25,49 +25,49 @@
* *
*/ */
#include "absmi.h"
#include "Foreign.h" #include "Foreign.h"
#include "absmi.h"
#include "alloc.h" #include "alloc.h"
#include "yapio.h"
#include "iopreds.h"
#include "attvar.h" #include "attvar.h"
#include "iopreds.h"
#include "yapio.h"
#if HAVE_STRING_H #if HAVE_STRING_H
#include <string.h> #include <string.h>
#endif #endif
#include "qly.h" #include "qly.h"
static void RestoreEntries(PropEntry *, int USES_REGS); static void RestoreEntries(PropEntry *, int USES_REGS);
static void CleanCode(PredEntry * USES_REGS); static void CleanCode(PredEntry *USES_REGS);
static void static void GrowAtomTable(void) {
GrowAtomTable(void) {
CACHE_REGS CACHE_REGS
UInt size = LOCAL_ExportAtomHashTableSize; UInt size = LOCAL_ExportAtomHashTableSize;
export_atom_hash_entry_t *p, *newt, *oldt = LOCAL_ExportAtomHashChain; export_atom_hash_entry_t *p, *newt, *oldt = LOCAL_ExportAtomHashChain;
UInt new_size = size + (size > 1024 ? size : 1024); UInt new_size = size + (size > 1024 ? size : 1024);
UInt i; UInt i;
newt = (export_atom_hash_entry_t *)calloc(new_size,sizeof(export_atom_hash_entry_t)); newt = (export_atom_hash_entry_t *)calloc(new_size,
sizeof(export_atom_hash_entry_t));
if (!newt) { if (!newt) {
return; return;
} }
p = oldt; p = oldt;
for (i = 0 ; i < size ; p++,i++) { for (i = 0; i < size; p++, i++) {
Atom a = p->val; Atom a = p->val;
export_atom_hash_entry_t *newp; export_atom_hash_entry_t *newp;
CELL hash; CELL hash;
const unsigned char *apt; const unsigned char *apt;
if (!a)
if (!a) continue; continue;
apt = RepAtom(a)->UStrOfAE; apt = RepAtom(a)->UStrOfAE;
hash = HashFunction(apt)/(2*sizeof(CELL)) % new_size; hash = HashFunction(apt) / (2 * sizeof(CELL)) % new_size;
newp = newt+hash; newp = newt + hash;
while (newp->val) { while (newp->val) {
newp++; newp++;
if (newp == newt+new_size) if (newp == newt + new_size)
newp = newt; newp = newt;
} }
newp->val = a; newp->val = a;
} }
@ -76,29 +76,24 @@ GrowAtomTable(void) {
free(oldt); free(oldt);
} }
static void static void LookupAtom(Atom at) {
LookupAtom(Atom at)
{
CACHE_REGS CACHE_REGS
const unsigned char *p = RepAtom(at)->UStrOfAE; const unsigned char *p = RepAtom(at)->UStrOfAE;
CELL hash = HashFunction(p) % LOCAL_ExportAtomHashTableSize; CELL hash = HashFunction(p) % LOCAL_ExportAtomHashTableSize;
export_atom_hash_entry_t *a; export_atom_hash_entry_t *a;
a = LOCAL_ExportAtomHashChain+hash; a = LOCAL_ExportAtomHashChain + hash;
while (a->val) { while (a->val) {
if (a->val == at) { if (a->val == at) {
return; return;
} }
a++; a++;
if (a == LOCAL_ExportAtomHashChain+LOCAL_ExportAtomHashTableSize) if (a == LOCAL_ExportAtomHashChain + LOCAL_ExportAtomHashTableSize)
a = LOCAL_ExportAtomHashChain; a = LOCAL_ExportAtomHashChain;
} }
a->val = at; a->val = at;
LOCAL_ExportAtomHashTableNum++; LOCAL_ExportAtomHashTableNum++;
if (LOCAL_ExportAtomHashTableNum > if (LOCAL_ExportAtomHashTableNum > LOCAL_ExportAtomHashTableSize / 2) {
LOCAL_ExportAtomHashTableSize/2
) {
GrowAtomTable(); GrowAtomTable();
if (!LOCAL_ExportAtomHashChain) { if (!LOCAL_ExportAtomHashChain) {
return; return;
@ -106,31 +101,32 @@ LookupAtom(Atom at)
} }
} }
static void static void GrowFunctorTable(void) {
GrowFunctorTable(void) {
CACHE_REGS CACHE_REGS
UInt size = LOCAL_ExportFunctorHashTableSize; UInt size = LOCAL_ExportFunctorHashTableSize;
export_functor_hash_entry_t *p, *newt, *oldt = LOCAL_ExportFunctorHashChain; export_functor_hash_entry_t *p, *newt, *oldt = LOCAL_ExportFunctorHashChain;
UInt new_size = size + (size > 1024 ? size : 1024); UInt new_size = size + (size > 1024 ? size : 1024);
UInt i; UInt i;
newt = (export_functor_hash_entry_t *)calloc(new_size,sizeof(export_functor_hash_entry_t)); newt = (export_functor_hash_entry_t *)calloc(
new_size, sizeof(export_functor_hash_entry_t));
if (!newt) { if (!newt) {
return; return;
} }
p = oldt; p = oldt;
for (i = 0 ; i < size ; p++,i++) { for (i = 0; i < size; p++, i++) {
Functor f = p->val; Functor f = p->val;
export_functor_hash_entry_t *newp; export_functor_hash_entry_t *newp;
CELL hash; CELL hash;
if (!f) continue; if (!f)
hash = ((CELL)(f))/(2*sizeof(CELL)) % new_size; continue;
newp = newt+hash; hash = ((CELL)(f)) / (2 * sizeof(CELL)) % new_size;
newp = newt + hash;
while (newp->val) { while (newp->val) {
newp++; newp++;
if (newp == newt+new_size) if (newp == newt + new_size)
newp = newt; newp = newt;
} }
newp->val = p->val; newp->val = p->val;
newp->arity = p->arity; newp->arity = p->arity;
@ -141,22 +137,21 @@ GrowFunctorTable(void) {
free(oldt); free(oldt);
} }
static void static void LookupFunctor(Functor fun) {
LookupFunctor(Functor fun)
{
CACHE_REGS CACHE_REGS
CELL hash = ((CELL)(fun))/(2*sizeof(CELL)) % LOCAL_ExportFunctorHashTableSize; CELL hash =
((CELL)(fun)) / (2 * sizeof(CELL)) % LOCAL_ExportFunctorHashTableSize;
export_functor_hash_entry_t *f; export_functor_hash_entry_t *f;
Atom name = NameOfFunctor(fun); Atom name = NameOfFunctor(fun);
UInt arity = ArityOfFunctor(fun); UInt arity = ArityOfFunctor(fun);
f = LOCAL_ExportFunctorHashChain+hash; f = LOCAL_ExportFunctorHashChain + hash;
while (f->val) { while (f->val) {
if (f->val == fun) { if (f->val == fun) {
return; return;
} }
f++; f++;
if (f == LOCAL_ExportFunctorHashChain+LOCAL_ExportFunctorHashTableSize) if (f == LOCAL_ExportFunctorHashChain + LOCAL_ExportFunctorHashTableSize)
f = LOCAL_ExportFunctorHashChain; f = LOCAL_ExportFunctorHashChain;
} }
LookupAtom(name); LookupAtom(name);
@ -164,9 +159,7 @@ LookupFunctor(Functor fun)
f->name = name; f->name = name;
f->arity = arity; f->arity = arity;
LOCAL_ExportFunctorHashTableNum++; LOCAL_ExportFunctorHashTableNum++;
if (LOCAL_ExportFunctorHashTableNum > if (LOCAL_ExportFunctorHashTableNum > LOCAL_ExportFunctorHashTableSize / 2) {
LOCAL_ExportFunctorHashTableSize/2
) {
GrowFunctorTable(); GrowFunctorTable();
if (!LOCAL_ExportFunctorHashChain) { if (!LOCAL_ExportFunctorHashChain) {
return; return;
@ -174,31 +167,33 @@ LookupFunctor(Functor fun)
} }
} }
static void static void GrowPredTable(void) {
GrowPredTable(void) {
CACHE_REGS CACHE_REGS
UInt size = LOCAL_ExportPredEntryHashTableSize; UInt size = LOCAL_ExportPredEntryHashTableSize;
export_pred_entry_hash_entry_t *p, *newt, *oldt = LOCAL_ExportPredEntryHashChain; export_pred_entry_hash_entry_t *p, *newt,
*oldt = LOCAL_ExportPredEntryHashChain;
UInt new_size = size + (size > 1024 ? size : 1024); UInt new_size = size + (size > 1024 ? size : 1024);
UInt i; UInt i;
newt = (export_pred_entry_hash_entry_t *)calloc(new_size,sizeof(export_pred_entry_hash_entry_t)); newt = (export_pred_entry_hash_entry_t *)calloc(
new_size, sizeof(export_pred_entry_hash_entry_t));
if (!newt) { if (!newt) {
return; return;
} }
p = oldt; p = oldt;
for (i = 0 ; i < size ; p++,i++) { for (i = 0; i < size; p++, i++) {
PredEntry *pe = p->val; PredEntry *pe = p->val;
export_pred_entry_hash_entry_t *newp; export_pred_entry_hash_entry_t *newp;
CELL hash; CELL hash;
if (!pe) continue; if (!pe)
hash = ((CELL)(pe))/(2*sizeof(CELL)) % new_size; continue;
newp = newt+hash; hash = ((CELL)(pe)) / (2 * sizeof(CELL)) % new_size;
newp = newt + hash;
while (newp->val) { while (newp->val) {
newp++; newp++;
if (newp == newt+new_size) if (newp == newt + new_size)
newp = newt; newp = newt;
} }
newp->val = p->val; newp->val = p->val;
newp->arity = p->arity; newp->arity = p->arity;
@ -210,21 +205,21 @@ GrowPredTable(void) {
free(oldt); free(oldt);
} }
static void static void LookupPredEntry(PredEntry *pe) {
LookupPredEntry(PredEntry *pe)
{
CACHE_REGS CACHE_REGS
CELL hash = (((CELL)(pe))/(2*sizeof(CELL))) % LOCAL_ExportPredEntryHashTableSize; CELL hash =
(((CELL)(pe)) / (2 * sizeof(CELL))) % LOCAL_ExportPredEntryHashTableSize;
export_pred_entry_hash_entry_t *p; export_pred_entry_hash_entry_t *p;
UInt arity = pe->ArityOfPE; UInt arity = pe->ArityOfPE;
p = LOCAL_ExportPredEntryHashChain+hash; p = LOCAL_ExportPredEntryHashChain + hash;
while (p->val) { while (p->val) {
if (p->val == pe) { if (p->val == pe) {
return; return;
} }
p++; p++;
if (p == LOCAL_ExportPredEntryHashChain+LOCAL_ExportPredEntryHashTableSize) if (p ==
LOCAL_ExportPredEntryHashChain + LOCAL_ExportPredEntryHashTableSize)
p = LOCAL_ExportPredEntryHashChain; p = LOCAL_ExportPredEntryHashChain;
} }
p->arity = arity; p->arity = arity;
@ -258,8 +253,7 @@ LookupPredEntry(PredEntry *pe)
LookupAtom(p->module); LookupAtom(p->module);
LOCAL_ExportPredEntryHashTableNum++; LOCAL_ExportPredEntryHashTableNum++;
if (LOCAL_ExportPredEntryHashTableNum > if (LOCAL_ExportPredEntryHashTableNum >
LOCAL_ExportPredEntryHashTableSize/2 LOCAL_ExportPredEntryHashTableSize / 2) {
) {
GrowPredTable(); GrowPredTable();
if (!LOCAL_ExportPredEntryHashChain) { if (!LOCAL_ExportPredEntryHashChain) {
return; return;
@ -267,32 +261,32 @@ LookupPredEntry(PredEntry *pe)
} }
} }
static void GrowDBRefTable(void) {
static void
GrowDBRefTable(void) {
CACHE_REGS CACHE_REGS
UInt size = LOCAL_ExportDBRefHashTableSize; UInt size = LOCAL_ExportDBRefHashTableSize;
export_dbref_hash_entry_t *p, *newt, *oldt = LOCAL_ExportDBRefHashChain; export_dbref_hash_entry_t *p, *newt, *oldt = LOCAL_ExportDBRefHashChain;
UInt new_size = size + (size > 1024 ? size : 1024); UInt new_size = size + (size > 1024 ? size : 1024);
UInt i; UInt i;
newt = (export_dbref_hash_entry_t *)calloc(new_size,sizeof(export_dbref_hash_entry_t)); newt = (export_dbref_hash_entry_t *)calloc(new_size,
sizeof(export_dbref_hash_entry_t));
if (!newt) { if (!newt) {
return; return;
} }
p = oldt; p = oldt;
for (i = 0 ; i < size ; p++,i++) { for (i = 0; i < size; p++, i++) {
DBRef dbr = p->val; DBRef dbr = p->val;
export_dbref_hash_entry_t *newp; export_dbref_hash_entry_t *newp;
CELL hash; CELL hash;
if (!dbr) continue; if (!dbr)
hash = ((CELL)(dbr))/(2*sizeof(CELL)) % new_size; continue;
newp = newt+hash; hash = ((CELL)(dbr)) / (2 * sizeof(CELL)) % new_size;
newp = newt + hash;
while (newp->val) { while (newp->val) {
newp++; newp++;
if (newp == newt+new_size) if (newp == newt + new_size)
newp = newt; newp = newt;
} }
newp->val = p->val; newp->val = p->val;
newp->sz = p->sz; newp->sz = p->sz;
@ -303,30 +297,27 @@ GrowDBRefTable(void) {
free(oldt); free(oldt);
} }
static void static void LookupDBRef(DBRef ref) {
LookupDBRef(DBRef ref)
{
CACHE_REGS CACHE_REGS
CELL hash = ((CELL)(ref))/(2*sizeof(CELL)) % LOCAL_ExportDBRefHashTableSize; CELL hash =
((CELL)(ref)) / (2 * sizeof(CELL)) % LOCAL_ExportDBRefHashTableSize;
export_dbref_hash_entry_t *a; export_dbref_hash_entry_t *a;
a = LOCAL_ExportDBRefHashChain+hash; a = LOCAL_ExportDBRefHashChain + hash;
while (a->val) { while (a->val) {
if (a->val == ref) { if (a->val == ref) {
a->refs++; a->refs++;
return; return;
} }
a++; a++;
if (a == LOCAL_ExportDBRefHashChain+LOCAL_ExportDBRefHashTableSize) if (a == LOCAL_ExportDBRefHashChain + LOCAL_ExportDBRefHashTableSize)
a = LOCAL_ExportDBRefHashChain; a = LOCAL_ExportDBRefHashChain;
} }
a->val = ref; a->val = ref;
a->sz = ((LogUpdClause *)ref)->ClSize; a->sz = ((LogUpdClause *)ref)->ClSize;
a->refs = 1; a->refs = 1;
LOCAL_ExportDBRefHashTableNum++; LOCAL_ExportDBRefHashTableNum++;
if (LOCAL_ExportDBRefHashTableNum > if (LOCAL_ExportDBRefHashTableNum > LOCAL_ExportDBRefHashTableSize / 2) {
LOCAL_ExportDBRefHashTableSize/2
) {
GrowDBRefTable(); GrowDBRefTable();
if (!LOCAL_ExportDBRefHashChain) { if (!LOCAL_ExportDBRefHashChain) {
return; return;
@ -334,27 +325,28 @@ LookupDBRef(DBRef ref)
} }
} }
static void static void InitHash(void) {
InitHash(void)
{
CACHE_REGS CACHE_REGS
LOCAL_ExportFunctorHashTableNum = 0; LOCAL_ExportFunctorHashTableNum = 0;
LOCAL_ExportFunctorHashTableSize = EXPORT_FUNCTOR_TABLE_SIZE; LOCAL_ExportFunctorHashTableSize = EXPORT_FUNCTOR_TABLE_SIZE;
LOCAL_ExportFunctorHashChain = (export_functor_hash_entry_t *)calloc(LOCAL_ExportFunctorHashTableSize, sizeof(export_functor_hash_entry_t )); LOCAL_ExportFunctorHashChain = (export_functor_hash_entry_t *)calloc(
LOCAL_ExportFunctorHashTableSize, sizeof(export_functor_hash_entry_t));
LOCAL_ExportAtomHashTableNum = 0; LOCAL_ExportAtomHashTableNum = 0;
LOCAL_ExportAtomHashTableSize = EXPORT_ATOM_TABLE_SIZE; LOCAL_ExportAtomHashTableSize = EXPORT_ATOM_TABLE_SIZE;
LOCAL_ExportAtomHashChain = (export_atom_hash_entry_t *)calloc( LOCAL_ExportAtomHashTableSize, sizeof(export_atom_hash_entry_t)); LOCAL_ExportAtomHashChain = (export_atom_hash_entry_t *)calloc(
LOCAL_ExportAtomHashTableSize, sizeof(export_atom_hash_entry_t));
LOCAL_ExportPredEntryHashTableNum = 0; LOCAL_ExportPredEntryHashTableNum = 0;
LOCAL_ExportPredEntryHashTableSize = EXPORT_PRED_ENTRY_TABLE_SIZE; LOCAL_ExportPredEntryHashTableSize = EXPORT_PRED_ENTRY_TABLE_SIZE;
LOCAL_ExportPredEntryHashChain = (export_pred_entry_hash_entry_t *)calloc(LOCAL_ExportPredEntryHashTableSize, sizeof(export_pred_entry_hash_entry_t)); LOCAL_ExportPredEntryHashChain = (export_pred_entry_hash_entry_t *)calloc(
LOCAL_ExportPredEntryHashTableSize,
sizeof(export_pred_entry_hash_entry_t));
LOCAL_ExportDBRefHashTableNum = 0; LOCAL_ExportDBRefHashTableNum = 0;
LOCAL_ExportDBRefHashTableSize = EXPORT_DBREF_TABLE_SIZE; LOCAL_ExportDBRefHashTableSize = EXPORT_DBREF_TABLE_SIZE;
LOCAL_ExportDBRefHashChain = (export_dbref_hash_entry_t *)calloc(EXPORT_DBREF_TABLE_SIZE, sizeof(export_dbref_hash_entry_t)); LOCAL_ExportDBRefHashChain = (export_dbref_hash_entry_t *)calloc(
EXPORT_DBREF_TABLE_SIZE, sizeof(export_dbref_hash_entry_t));
} }
static void static void CloseHash(void) {
CloseHash(void)
{
CACHE_REGS CACHE_REGS
LOCAL_ExportFunctorHashTableNum = 0; LOCAL_ExportFunctorHashTableNum = 0;
LOCAL_ExportFunctorHashTableSize = 0L; LOCAL_ExportFunctorHashTableSize = 0L;
@ -370,37 +362,27 @@ CloseHash(void)
free(LOCAL_ExportDBRefHashChain); free(LOCAL_ExportDBRefHashChain);
} }
static inline Atom static inline Atom AtomAdjust(Atom a) {
AtomAdjust(Atom a)
{
LookupAtom(a); LookupAtom(a);
return a; return a;
} }
static inline Functor static inline Functor FuncAdjust(Functor f) {
FuncAdjust(Functor f)
{
LookupFunctor(f); LookupFunctor(f);
return f; return f;
} }
static inline Term AtomTermAdjust(Term t) {
static inline Term
AtomTermAdjust(Term t)
{
LookupAtom(AtomOfTerm(t)); LookupAtom(AtomOfTerm(t));
return t; return t;
} }
static inline Term static inline Term TermToGlobalOrAtomAdjust(Term t) {
TermToGlobalOrAtomAdjust(Term t)
{
if (t && IsAtomTerm(t)) if (t && IsAtomTerm(t))
return AtomTermAdjust(t); return AtomTermAdjust(t);
return t; return t;
} }
#define IsOldCode(P) FALSE #define IsOldCode(P) FALSE
#define IsOldCodeCellPtr(P) FALSE #define IsOldCodeCellPtr(P) FALSE
#define IsOldDelay(P) FALSE #define IsOldDelay(P) FALSE
@ -420,7 +402,7 @@ TermToGlobalOrAtomAdjust(Term t)
#define NoAGCAtomAdjust(P) (P) #define NoAGCAtomAdjust(P) (P)
#define OrArgAdjust(P) #define OrArgAdjust(P)
#define TabEntryAdjust(P) #define TabEntryAdjust(P)
#define IntegerAdjust(D) (D) #define IntegerAdjust(D) (D)
#define AddrAdjust(P) (P) #define AddrAdjust(P) (P)
#define MFileAdjust(P) (P) #define MFileAdjust(P) (P)
#define CodeVarAdjust(P) (P) #define CodeVarAdjust(P) (P)
@ -430,28 +412,22 @@ TermToGlobalOrAtomAdjust(Term t)
#define IntegerInCodeAdjust(P) #define IntegerInCodeAdjust(P)
#define OpcodeAdjust(P) (P) #define OpcodeAdjust(P) (P)
static inline Term static inline Term ModuleAdjust(Term t) {
ModuleAdjust(Term t) if (!t)
{ return t;
if (!t) return t;
return AtomTermAdjust(t); return AtomTermAdjust(t);
} }
static inline PredEntry * static inline PredEntry *PredEntryAdjust(PredEntry *pe) {
PredEntryAdjust(PredEntry *pe)
{
LookupPredEntry(pe); LookupPredEntry(pe);
return pe; return pe;
} }
static inline PredEntry * static inline PredEntry *PtoPredAdjust(PredEntry *pe) {
PtoPredAdjust(PredEntry *pe)
{
LookupPredEntry(pe); LookupPredEntry(pe);
return pe; return pe;
} }
#define ExternalFunctionAdjust(P) (P) #define ExternalFunctionAdjust(P) (P)
#define DBRecordAdjust(P) (P) #define DBRecordAdjust(P) (P)
#define ModEntryPtrAdjust(P) (P) #define ModEntryPtrAdjust(P) (P)
@ -468,10 +444,8 @@ PtoPredAdjust(PredEntry *pe)
#define DelayAdjust(P) (P) #define DelayAdjust(P) (P)
#define GlobalAdjust(P) (P) #define GlobalAdjust(P) (P)
#define DBRefAdjust(P,DoRef) DBRefAdjust__(P PASS_REGS) #define DBRefAdjust(P, DoRef) DBRefAdjust__(P PASS_REGS)
static inline DBRef static inline DBRef DBRefAdjust__(DBRef dbt USES_REGS) {
DBRefAdjust__ (DBRef dbt USES_REGS)
{
LookupDBRef(dbt); LookupDBRef(dbt);
return dbt; return dbt;
} }
@ -514,67 +488,48 @@ DBRefAdjust__ (DBRef dbt USES_REGS)
#define rehash(oldcode, NOfE, KindOfEntries) #define rehash(oldcode, NOfE, KindOfEntries)
static void RestoreFlags(UInt NFlags) {}
static void RestoreFlags( UInt NFlags )
{
}
#include "rheap.h" #include "rheap.h"
static void static void RestoreHashPreds(USES_REGS1) {}
RestoreHashPreds( USES_REGS1 )
{
}
static void RestoreAtomList(Atom atm USES_REGS) {}
static void static size_t save_bytes(FILE *stream, void *ptr, size_t sz) {
RestoreAtomList(Atom atm USES_REGS)
{
}
static size_t save_bytes(FILE *stream, void *ptr, size_t sz)
{
return fwrite(ptr, sz, 1, stream); return fwrite(ptr, sz, 1, stream);
} }
static size_t save_byte(FILE *stream, int byte) static size_t save_byte(FILE *stream, int byte) {
{
fputc(byte, stream); fputc(byte, stream);
return 1; return 1;
} }
static size_t save_bits16(FILE *stream, BITS16 val) static size_t save_bits16(FILE *stream, BITS16 val) {
{
BITS16 v = val; BITS16 v = val;
return save_bytes(stream, &v, sizeof(BITS16)); return save_bytes(stream, &v, sizeof(BITS16));
} }
static size_t save_UInt(FILE *stream, UInt val) static size_t save_UInt(FILE *stream, UInt val) {
{
UInt v = val; UInt v = val;
return save_bytes(stream, &v, sizeof(UInt)); return save_bytes(stream, &v, sizeof(UInt));
} }
static size_t save_Int(FILE *stream, Int val) static size_t save_Int(FILE *stream, Int val) {
{
Int v = val; Int v = val;
return save_bytes(stream, &v, sizeof(Int)); return save_bytes(stream, &v, sizeof(Int));
} }
static size_t save_tag(FILE *stream, qlf_tag_t tag) static size_t save_tag(FILE *stream, qlf_tag_t tag) {
{
return save_byte(stream, tag); return save_byte(stream, tag);
} }
static size_t save_predFlags(FILE *stream, pred_flags_t predFlags) static size_t save_predFlags(FILE *stream, pred_flags_t predFlags) {
{
pred_flags_t v = predFlags; pred_flags_t v = predFlags;
return save_bytes(stream, &v, sizeof(pred_flags_t)); return save_bytes(stream, &v, sizeof(pred_flags_t));
} }
static int static int SaveHash(FILE *stream) {
SaveHash(FILE *stream)
{
CACHE_REGS CACHE_REGS
UInt i; UInt i;
/* first, current opcodes */ /* first, current opcodes */
@ -582,25 +537,26 @@ SaveHash(FILE *stream)
save_UInt(stream, (UInt)&ARG1); save_UInt(stream, (UInt)&ARG1);
CHECK(save_tag(stream, QLY_START_OPCODES)); CHECK(save_tag(stream, QLY_START_OPCODES));
save_Int(stream, _std_top); save_Int(stream, _std_top);
for (i= 0; i <= _std_top; i++) { for (i = 0; i <= _std_top; i++) {
save_UInt(stream, (UInt)Yap_opcode(i)); save_UInt(stream, (UInt)Yap_opcode(i));
} }
CHECK(save_tag(stream, QLY_START_ATOMS)); CHECK(save_tag(stream, QLY_START_ATOMS));
CHECK(save_UInt(stream, LOCAL_ExportAtomHashTableNum)); CHECK(save_UInt(stream, LOCAL_ExportAtomHashTableNum));
for (i = 0; i < LOCAL_ExportAtomHashTableSize; i++) { for (i = 0; i < LOCAL_ExportAtomHashTableSize; i++) {
export_atom_hash_entry_t *a = LOCAL_ExportAtomHashChain+i; export_atom_hash_entry_t *a = LOCAL_ExportAtomHashChain + i;
if (a->val) { if (a->val) {
Atom at = a->val; Atom at = a->val;
CHECK(save_UInt(stream, (UInt)at)); CHECK(save_UInt(stream, (UInt)at));
CHECK(save_tag(stream, QLY_ATOM)); CHECK(save_tag(stream, QLY_ATOM));
CHECK(save_UInt(stream, strlen((char *)RepAtom(at)->StrOfAE))); CHECK(save_UInt(stream, strlen((char *)RepAtom(at)->StrOfAE)));
CHECK(save_bytes(stream, (char *)at->StrOfAE, (strlen((char *)at->StrOfAE)+1)*sizeof(char))); CHECK(save_bytes(stream, (char *)at->StrOfAE,
(strlen((char *)at->StrOfAE) + 1) * sizeof(char)));
} }
} }
save_tag(stream, QLY_START_FUNCTORS); save_tag(stream, QLY_START_FUNCTORS);
save_UInt(stream, LOCAL_ExportFunctorHashTableNum); save_UInt(stream, LOCAL_ExportFunctorHashTableNum);
for (i = 0; i < LOCAL_ExportFunctorHashTableSize; i++) { for (i = 0; i < LOCAL_ExportFunctorHashTableSize; i++) {
export_functor_hash_entry_t *f = LOCAL_ExportFunctorHashChain+i; export_functor_hash_entry_t *f = LOCAL_ExportFunctorHashChain + i;
if (!(f->val)) if (!(f->val))
continue; continue;
CHECK(save_UInt(stream, (UInt)(f->val))); CHECK(save_UInt(stream, (UInt)(f->val)));
@ -610,7 +566,7 @@ SaveHash(FILE *stream)
save_tag(stream, QLY_START_PRED_ENTRIES); save_tag(stream, QLY_START_PRED_ENTRIES);
save_UInt(stream, LOCAL_ExportPredEntryHashTableNum); save_UInt(stream, LOCAL_ExportPredEntryHashTableNum);
for (i = 0; i < LOCAL_ExportPredEntryHashTableSize; i++) { for (i = 0; i < LOCAL_ExportPredEntryHashTableSize; i++) {
export_pred_entry_hash_entry_t *p = LOCAL_ExportPredEntryHashChain+i; export_pred_entry_hash_entry_t *p = LOCAL_ExportPredEntryHashChain + i;
if (!(p->val)) if (!(p->val))
continue; continue;
CHECK(save_UInt(stream, (UInt)(p->val))); CHECK(save_UInt(stream, (UInt)(p->val)));
@ -621,7 +577,7 @@ SaveHash(FILE *stream)
save_tag(stream, QLY_START_DBREFS); save_tag(stream, QLY_START_DBREFS);
save_UInt(stream, LOCAL_ExportDBRefHashTableNum); save_UInt(stream, LOCAL_ExportDBRefHashTableNum);
for (i = 0; i < LOCAL_ExportDBRefHashTableSize; i++) { for (i = 0; i < LOCAL_ExportDBRefHashTableSize; i++) {
export_dbref_hash_entry_t *p = LOCAL_ExportDBRefHashChain+i; export_dbref_hash_entry_t *p = LOCAL_ExportDBRefHashChain + i;
if (p->val) { if (p->val) {
CHECK(save_UInt(stream, (UInt)(p->val))); CHECK(save_UInt(stream, (UInt)(p->val)));
CHECK(save_UInt(stream, p->sz)); CHECK(save_UInt(stream, p->sz));
@ -633,9 +589,8 @@ SaveHash(FILE *stream)
return 1; return 1;
} }
static size_t static size_t save_clauses(FILE *stream, PredEntry *pp) {
save_clauses(FILE *stream, PredEntry *pp) { yamop *FirstC, *LastC;
yamop *FirstC, *LastC;
FirstC = pp->cs.p_code.FirstClause; FirstC = pp->cs.p_code.FirstClause;
LastC = pp->cs.p_code.LastClause; LastC = pp->cs.p_code.LastClause;
@ -647,11 +602,11 @@ save_clauses(FILE *stream, PredEntry *pp) {
while (cl != NULL) { while (cl != NULL) {
if (IN_BETWEEN(cl->ClTimeStart, pp->TimeStampOfPred, cl->ClTimeEnd)) { if (IN_BETWEEN(cl->ClTimeStart, pp->TimeStampOfPred, cl->ClTimeEnd)) {
UInt size = cl->ClSize; UInt size = cl->ClSize;
CHECK(save_tag(stream, QLY_START_LU_CLAUSE)); CHECK(save_tag(stream, QLY_START_LU_CLAUSE));
CHECK(save_UInt(stream, (UInt)cl)); CHECK(save_UInt(stream, (UInt)cl));
CHECK(save_UInt(stream, size)); CHECK(save_UInt(stream, size));
CHECK(save_bytes(stream, cl, size)); CHECK(save_bytes(stream, cl, size));
} }
cl = cl->ClNext; cl = cl->ClNext;
} }
@ -674,7 +629,8 @@ save_clauses(FILE *stream, PredEntry *pp) {
CHECK(save_UInt(stream, (UInt)cl)); CHECK(save_UInt(stream, (UInt)cl));
CHECK(save_UInt(stream, size)); CHECK(save_UInt(stream, size));
CHECK(save_bytes(stream, dcl, size)); CHECK(save_bytes(stream, dcl, size));
if (cl == LastC) return 1; if (cl == LastC)
return 1;
cl = NextDynamicClause(cl); cl = NextDynamicClause(cl);
} while (TRUE); } while (TRUE);
} else { } else {
@ -689,15 +645,15 @@ save_clauses(FILE *stream, PredEntry *pp) {
CHECK(save_UInt(stream, (UInt)cl)); CHECK(save_UInt(stream, (UInt)cl));
CHECK(save_UInt(stream, size)); CHECK(save_UInt(stream, size));
CHECK(save_bytes(stream, cl, size)); CHECK(save_bytes(stream, cl, size));
if (cl->ClCode == LastC) return 1; if (cl->ClCode == LastC)
return 1;
cl = cl->ClNext; cl = cl->ClNext;
} while (TRUE); } while (TRUE);
} }
return 1; return 1;
} }
static size_t static size_t save_pred(FILE *stream, PredEntry *ap) {
save_pred(FILE *stream, PredEntry *ap) {
CHECK(save_UInt(stream, (UInt)ap)); CHECK(save_UInt(stream, (UInt)ap));
CHECK(save_predFlags(stream, ap->PredFlags)); CHECK(save_predFlags(stream, ap->PredFlags));
if (ap->PredFlags & ForeignPredFlags) if (ap->PredFlags & ForeignPredFlags)
@ -708,19 +664,17 @@ save_pred(FILE *stream, PredEntry *ap) {
return save_clauses(stream, ap); return save_clauses(stream, ap);
} }
static int static int clean_pred(PredEntry *pp USES_REGS) {
clean_pred(PredEntry *pp USES_REGS) {
if (pp->PredFlags & ForeignPredFlags) { if (pp->PredFlags & ForeignPredFlags) {
return true; return true;
} else { } else {
CleanClauses(pp->cs.p_code.FirstClause, pp->cs.p_code.LastClause, pp PASS_REGS); CleanClauses(pp->cs.p_code.FirstClause, pp->cs.p_code.LastClause,
pp PASS_REGS);
} }
return true; return true;
} }
static size_t static size_t mark_pred(PredEntry *ap) {
mark_pred(PredEntry *ap)
{
CACHE_REGS CACHE_REGS
if (ap->ModuleOfPred != IDB_MODULE) { if (ap->ModuleOfPred != IDB_MODULE) {
if (ap->ArityOfPE) { if (ap->ArityOfPE) {
@ -735,7 +689,7 @@ mark_pred(PredEntry *ap)
FuncAdjust(ap->FunctorOfPred); FuncAdjust(ap->FunctorOfPred);
} }
} }
if (!(ap->PredFlags & (MultiFileFlag|NumberDBPredFlag)) && if (!(ap->PredFlags & (MultiFileFlag | NumberDBPredFlag)) &&
ap->src.OwnerFile) { ap->src.OwnerFile) {
AtomAdjust(ap->src.OwnerFile); AtomAdjust(ap->src.OwnerFile);
} }
@ -743,22 +697,20 @@ mark_pred(PredEntry *ap)
return 1; return 1;
} }
static size_t static size_t mark_ops(FILE *stream, Term mod) {
mark_ops(FILE *stream, Term mod) {
OpEntry *op = OpList; OpEntry *op = OpList;
while (op) { while (op) {
if (!mod || op->OpModule == mod) { if (!mod || op->OpModule == mod) {
AtomAdjust(op->OpName); AtomAdjust(op->OpName);
if (op->OpModule) if (op->OpModule)
AtomTermAdjust(op->OpModule); AtomTermAdjust(op->OpModule);
} }
op = op->OpNext; op = op->OpNext;
} }
return 1; return 1;
} }
static size_t static size_t save_ops(FILE *stream, Term mod) {
save_ops(FILE *stream, Term mod) {
OpEntry *op = OpList; OpEntry *op = OpList;
while (op) { while (op) {
if (!mod || op->OpModule == mod) { if (!mod || op->OpModule == mod) {
@ -775,19 +727,19 @@ save_ops(FILE *stream, Term mod) {
return 1; return 1;
} }
static int static int save_header(FILE *stream, char type[]) {
save_header(FILE *stream, char type[]) char msg[256 * 16];
{
char msg[256];
sprintf(msg, "#!/bin/sh\nexec_dir=${YAPBINDIR:-%s}\nexec $exec_dir/yap $0 \"$@\"\n%s %s\n", YAP_BINDIR, type, YAP_FULL_VERSION); sprintf(msg,
return save_bytes(stream, msg, strlen(msg)+1); "#!/bin/sh\nexec_dir=${YAPBINDIR:-%s}\nexec $exec_dir/yap $0 "
"\"$@\"\n%s %s\n",
YAP_BINDIR, type, YAP_FULL_VERSION);
return save_bytes(stream, msg, strlen(msg) + 1);
} }
static size_t static size_t save_module(FILE *stream, Term mod) {
save_module(FILE *stream, Term mod) {
PredEntry *ap = Yap_ModulePred(mod); PredEntry *ap = Yap_ModulePred(mod);
save_header( stream, "saved module," ); save_header(stream, "saved module,");
InitHash(); InitHash();
ModuleAdjust(mod); ModuleAdjust(mod);
while (ap) { while (ap) {
@ -813,12 +765,11 @@ save_module(FILE *stream, Term mod) {
return 1; return 1;
} }
static size_t static size_t save_program(FILE *stream) {
save_program(FILE *stream) {
ModEntry *me = CurrentModules; ModEntry *me = CurrentModules;
InitHash(); InitHash();
save_header( stream, "saved state," ); save_header(stream, "saved state,");
/* should we allow the user to see hidden predicates? */ /* should we allow the user to see hidden predicates? */
while (me) { while (me) {
PredEntry *pp; PredEntry *pp;
@ -826,7 +777,7 @@ save_program(FILE *stream) {
AtomAdjust(me->AtomOfME); AtomAdjust(me->AtomOfME);
while (pp != NULL) { while (pp != NULL) {
#if DEBUG #if DEBUG
// Yap_PrintPredName( pp ); // Yap_PrintPredName( pp );
#endif #endif
pp = PredEntryAdjust(pp); pp = PredEntryAdjust(pp);
CHECK(mark_pred(pp)); CHECK(mark_pred(pp));
@ -858,12 +809,11 @@ save_program(FILE *stream) {
return 1; return 1;
} }
static size_t static size_t save_file(FILE *stream, Atom FileName) {
save_file(FILE *stream, Atom FileName) {
ModEntry *me = CurrentModules; ModEntry *me = CurrentModules;
InitHash(); InitHash();
save_header( stream, "saved file," ); save_header(stream, "saved file,");
/* should we allow the user to see hidden predicates? */ /* should we allow the user to see hidden predicates? */
while (me) { while (me) {
PredEntry *pp; PredEntry *pp;
@ -872,10 +822,10 @@ save_file(FILE *stream, Atom FileName) {
while (pp != NULL) { while (pp != NULL) {
pp = PredEntryAdjust(pp); pp = PredEntryAdjust(pp);
if (pp && if (pp &&
!(pp->PredFlags & (MultiFileFlag|NumberDBPredFlag|AtomDBPredFlag|CPredFlag|AsmPredFlag|UserCPredFlag)) && !(pp->PredFlags & (MultiFileFlag | NumberDBPredFlag | AtomDBPredFlag |
pp->ModuleOfPred != IDB_MODULE && CPredFlag | AsmPredFlag | UserCPredFlag)) &&
pp->src.OwnerFile == FileName) { pp->ModuleOfPred != IDB_MODULE && pp->src.OwnerFile == FileName) {
CHECK(mark_pred(pp)); CHECK(mark_pred(pp));
} }
pp = pp->NextPredOfModule; pp = pp->NextPredOfModule;
} }
@ -893,10 +843,11 @@ save_file(FILE *stream, Atom FileName) {
CHECK(save_UInt(stream, (UInt)MkAtomTerm(me->AtomOfME))); CHECK(save_UInt(stream, (UInt)MkAtomTerm(me->AtomOfME)));
while (pp != NULL) { while (pp != NULL) {
if (pp && if (pp &&
!(pp->PredFlags & (MultiFileFlag|NumberDBPredFlag|AtomDBPredFlag|CPredFlag|AsmPredFlag|UserCPredFlag)) && !(pp->PredFlags & (MultiFileFlag | NumberDBPredFlag | AtomDBPredFlag |
pp->src.OwnerFile == FileName) { CPredFlag | AsmPredFlag | UserCPredFlag)) &&
CHECK(save_tag(stream, QLY_START_PREDICATE)); pp->src.OwnerFile == FileName) {
CHECK(save_pred(stream, pp)); CHECK(save_tag(stream, QLY_START_PREDICATE));
CHECK(save_pred(stream, pp));
} }
pp = pp->NextPredOfModule; pp = pp->NextPredOfModule;
} }
@ -909,78 +860,72 @@ save_file(FILE *stream, Atom FileName) {
return 1; return 1;
} }
static Int static Int qsave_module_preds(USES_REGS1) {
qsave_module_preds( USES_REGS1 )
{
FILE *stream; FILE *stream;
Term tmod = Deref(ARG2); Term tmod = Deref(ARG2);
Term t1 = Deref(ARG1); Term t1 = Deref(ARG1);
if (IsVarTerm(t1)) { if (IsVarTerm(t1)) {
Yap_Error(INSTANTIATION_ERROR,t1,"save_module/3"); Yap_Error(INSTANTIATION_ERROR, t1, "save_module/3");
return FALSE; return FALSE;
} }
if (!IsAtomTerm(t1)) { if (!IsAtomTerm(t1)) {
Yap_Error(TYPE_ERROR_ATOM,t1,"save_module/3"); Yap_Error(TYPE_ERROR_ATOM, t1, "save_module/3");
return(FALSE); return (FALSE);
} }
if (!(stream = Yap_GetOutputStream(t1, "save_module") )){ if (!(stream = Yap_GetOutputStream(t1, "save_module"))) {
return FALSE; return FALSE;
} }
if (IsVarTerm(tmod)) { if (IsVarTerm(tmod)) {
Yap_Error(INSTANTIATION_ERROR,tmod,"save_module/2"); Yap_Error(INSTANTIATION_ERROR, tmod, "save_module/2");
return FALSE; return FALSE;
} }
if (!IsAtomTerm(tmod)) { if (!IsAtomTerm(tmod)) {
Yap_Error(TYPE_ERROR_ATOM,tmod,"save_module/2"); Yap_Error(TYPE_ERROR_ATOM, tmod, "save_module/2");
return FALSE; return FALSE;
} }
return save_module(stream, tmod) != 0; return save_module(stream, tmod) != 0;
} }
static Int static Int qsave_program(USES_REGS1) {
qsave_program( USES_REGS1 )
{
FILE *stream; FILE *stream;
Term t1 = Deref(ARG1); Term t1 = Deref(ARG1);
if (!(stream = Yap_GetOutputStream(t1,"save_program")) ) { if (!(stream = Yap_GetOutputStream(t1, "save_program"))) {
return FALSE; return FALSE;
} }
return save_program(stream) != 0; return save_program(stream) != 0;
} }
static Int static Int qsave_file(USES_REGS1) {
qsave_file( USES_REGS1 )
{
FILE *stream; FILE *stream;
Term t1 = Deref(ARG1); Term t1 = Deref(ARG1);
Term tfile = Deref(ARG2); Term tfile = Deref(ARG2);
if (!(stream = Yap_GetOutputStream(t1, "save_file/2") ) ) { if (!(stream = Yap_GetOutputStream(t1, "save_file/2"))) {
return FALSE; return FALSE;
} }
if (IsVarTerm(tfile)) { if (IsVarTerm(tfile)) {
Yap_Error(INSTANTIATION_ERROR,tfile,"save_file/2"); Yap_Error(INSTANTIATION_ERROR, tfile, "save_file/2");
return FALSE; return FALSE;
} }
if (!IsAtomTerm(tfile)) { if (!IsAtomTerm(tfile)) {
Yap_Error(TYPE_ERROR_ATOM,tfile,"save_file/2"); Yap_Error(TYPE_ERROR_ATOM, tfile, "save_file/2");
return FALSE; return FALSE;
} }
return save_file(stream, AtomOfTerm(tfile) ) != 0; return save_file(stream, AtomOfTerm(tfile)) != 0;
} }
void Yap_InitQLY(void) void Yap_InitQLY(void) {
{ Yap_InitCPred("$qsave_module_preds", 2, qsave_module_preds,
Yap_InitCPred("$qsave_module_preds", 2, qsave_module_preds, SyncPredFlag|UserCPredFlag); SyncPredFlag | UserCPredFlag);
Yap_InitCPred("$qsave_program", 1, qsave_program, SyncPredFlag|UserCPredFlag); Yap_InitCPred("$qsave_program", 1, qsave_program,
Yap_InitCPred("$qsave_file_preds", 2, qsave_file, SyncPredFlag|UserCPredFlag); SyncPredFlag | UserCPredFlag);
Yap_InitCPred("$qsave_file_preds", 2, qsave_file,
SyncPredFlag | UserCPredFlag);
if (FALSE) { if (FALSE) {
restore_codes(); restore_codes();
} }
} }
/// @} /// @}

863
C/save.c

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,23 @@
/************************************************************************* /*************************************************************************
* * * *
* YAP Prolog * * YAP Prolog *
* * * *
* Yap Prolog was developed at NCCUP - Universidade do Porto * * Yap Prolog was developed at NCCUP - Universidade do Porto *
* * * *
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-97 * * Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-97 *
* * * *
************************************************************************** **************************************************************************
* * * *
* File: Foreign.h * * File: Foreign.h *
* comments: header file for dynamic loading routines * * comments: header file for dynamic loading routines *
*************************************************************************/ *************************************************************************/
#define NO_DYN 1 #define NO_DYN 1
#ifndef FOREIGN_H #ifndef FOREIGN_H
#define FOREIGN_H #define FOREIGN_H
/** /**
@: @:
@file Foreign.h @file Foreign.h
@ -25,27 +25,30 @@
load_foreign_files/3 has works for the following configurations: load_foreign_files/3 has works for the following configurations:
- linux: should work both for a.out (untested by me) and ELF; - linux: should work both for a.out (untested by me) and ELF;
- WIN32: works (notice that symbols are not exported by default) - WIN32: works (notice that symbols are not exported by default)
- OSX: works using Mach dynamic libs. - OSX: works using Mach dynamic libs.
- osf: should work, but isn't working yet. - osf: should work, but isn't working yet.
- sunos4: should work, using A.OUT format; - sunos4: should work, using A.OUT format;
- svr4, eg solaris: should work, using ELF format; - svr4, eg solaris: should work, using ELF format;
- AIX: should work for 3.2 and 4.1 at least, using ECOFF; - AIX: should work for 3.2 and 4.1 at least, using ECOFF;
YAP should be able to load on most BSD Unixes, but you will need to YAP should be able to load on most BSD Unixes, but you will need to
say that here. say that here.
YAP also supports COFF loading (pretty much the same technique as YAP also supports COFF loading (pretty much the same technique as
used for A.OUT loading) but that is untested so far. used for A.OUT loading) but that is untested so far.
*/ */
#include "Yap.h"
#include "YapHeap.h"
#ifdef _AIX #ifdef _AIX
#undef NO_DYN #undef NO_DYN
#endif /* __AIX */ #endif /* __AIX */
@ -96,8 +99,8 @@
#endif #endif
#endif /* LOAD_DYLD */ #endif /* LOAD_DYLD */
#define LOAD_SUCCEEDED 0 #define LOAD_SUCCEEDED 0
#define LOAD_FAILLED -1 #define LOAD_FAILLED -1
typedef struct StringListItem { typedef struct StringListItem {
Atom name; Atom name;
@ -115,16 +118,15 @@ typedef struct ForeignLoadItem {
typedef void (*YapInitProc)(void); typedef void (*YapInitProc)(void);
void *Yap_LoadForeignFile(char *, int);
int Yap_CallForeignFile(void *, char *);
int Yap_CloseForeignFile(void *);
Int Yap_LoadForeign(StringList, StringList, char *, YapInitProc *);
Int Yap_ReLoadForeign(StringList, StringList, char *, YapInitProc *);
void Yap_ReOpenLoadForeign(void);
void Yap_ShutdownLoadForeign(void);
void *Yap_LoadForeignFile(char *, int); #define EAGER_LOADING 1
int Yap_CallForeignFile(void *, char *);
int Yap_CloseForeignFile(void *);
Int Yap_LoadForeign(StringList, StringList, char *, YapInitProc *);
Int Yap_ReLoadForeign(StringList, StringList, char *, YapInitProc *);
void Yap_ReOpenLoadForeign(void);
void Yap_ShutdownLoadForeign(void);
#define EAGER_LOADING 1
#define GLOBAL_LOADING 2 #define GLOBAL_LOADING 2
#endif #endif

View File

@ -822,6 +822,8 @@ inline static void LOG0(const char *f, int l, const char *fmt, ...) {
extern bool Yap_embedded, Yap_Server; extern bool Yap_embedded, Yap_Server;
#include "YapText.h"
#endif /* YAP_H */ #endif /* YAP_H */
#include "YapText.h"

View File

@ -18,6 +18,9 @@
#ifndef HEAP_H #ifndef HEAP_H
#define HEAP_H 1 #define HEAP_H 1
#include "Atoms.h"
#include "Yap.h"
#if LOW_PROF #if LOW_PROF
#include <stdio.h> #include <stdio.h>
#endif #endif

480
H/rheap.h
View File

@ -1,243 +1,251 @@
/************************************************************************* /*************************************************************************
* * * *
* YAP Prolog * * YAP Prolog *
* * * *
* Yap Prolog was developed at NCCUP - Universidade do Porto * * Yap Prolog was developed at NCCUP - Universidade do Porto *
* * * *
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * * Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
* * * *
************************************************************************** **************************************************************************
* * * *
* File: rheap.h * * File: rheap.h *
* comments: walk through heap code * * comments: walk through heap code *
* * * *
* Last rev: $Date: 2008-08-07 20:51:23 $,$Author: vsc $ * Last rev: $Date: 2008-08-07 20:51:23 $,$Author: vsc $
** **
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.99 2008/07/22 23:34:49 vsc * Revision 1.99 2008/07/22 23:34:49 vsc
* SWI and module fixes * SWI and module fixes
* *
* Revision 1.98 2008/05/12 22:31:37 vsc * Revision 1.98 2008/05/12 22:31:37 vsc
* fix previous fixes * fix previous fixes
* *
* Revision 1.97 2008/05/12 14:04:23 vsc * Revision 1.97 2008/05/12 14:04:23 vsc
* updates to restore * updates to restore
* *
* Revision 1.96 2008/04/11 16:58:17 ricroc * Revision 1.96 2008/04/11 16:58:17 ricroc
* yapor: seq_def initialization * yapor: seq_def initialization
* *
* Revision 1.95 2008/04/06 12:06:48 vsc * Revision 1.95 2008/04/06 12:06:48 vsc
* more small fixes * more small fixes
* *
* Revision 1.94 2008/04/06 11:53:02 vsc * Revision 1.94 2008/04/06 11:53:02 vsc
* fix some restore bugs * fix some restore bugs
* *
* Revision 1.93 2008/04/04 09:10:02 vsc * Revision 1.93 2008/04/04 09:10:02 vsc
* restore was restoring twice * restore was restoring twice
* *
* Revision 1.92 2008/04/03 11:34:47 vsc * Revision 1.92 2008/04/03 11:34:47 vsc
* fix restorebb in cases entry key is not an atom (obs from Nicos * fix restorebb in cases entry key is not an atom (obs from Nicos
* Angelopoulos) * Angelopoulos)
* *
* Revision 1.91 2008/04/01 15:31:43 vsc * Revision 1.91 2008/04/01 15:31:43 vsc
* more saved state fixes * more saved state fixes
* *
* Revision 1.90 2008/04/01 14:09:43 vsc * Revision 1.90 2008/04/01 14:09:43 vsc
* improve restore * improve restore
* *
* Revision 1.89 2008/04/01 09:41:05 vsc * Revision 1.89 2008/04/01 09:41:05 vsc
* more fixes to restore * more fixes to restore
* *
* Revision 1.88 2008/04/01 08:42:46 vsc * Revision 1.88 2008/04/01 08:42:46 vsc
* fix restore and small VISTA thingies * fix restore and small VISTA thingies
* *
* Revision 1.87 2008/03/25 22:03:14 vsc * Revision 1.87 2008/03/25 22:03:14 vsc
* fix some icc warnings * fix some icc warnings
* *
* Revision 1.86 2008/03/25 16:45:53 vsc * Revision 1.86 2008/03/25 16:45:53 vsc
* make or-parallelism compile again * make or-parallelism compile again
* *
* Revision 1.85 2008/02/12 17:03:52 vsc * Revision 1.85 2008/02/12 17:03:52 vsc
* SWI-portability changes * SWI-portability changes
* *
* Revision 1.84 2008/02/07 21:39:51 vsc * Revision 1.84 2008/02/07 21:39:51 vsc
* fix case where predicate is for an integer (DBEntry). * fix case where predicate is for an integer (DBEntry).
* *
* Revision 1.83 2008/01/23 17:57:55 vsc * Revision 1.83 2008/01/23 17:57:55 vsc
* valgrind it! * valgrind it!
* enable atom garbage collection. * enable atom garbage collection.
* *
* Revision 1.82 2007/12/05 12:17:23 vsc * Revision 1.82 2007/12/05 12:17:23 vsc
* improve JT * improve JT
* fix graph compatibility with SICStus * fix graph compatibility with SICStus
* re-export declaration. * re-export declaration.
* *
* Revision 1.81 2007/11/26 23:43:09 vsc * Revision 1.81 2007/11/26 23:43:09 vsc
* fixes to support threads and assert correctly, even if inefficiently. * fixes to support threads and assert correctly, even if inefficiently.
* *
* Revision 1.80 2007/11/07 09:35:53 vsc * Revision 1.80 2007/11/07 09:35:53 vsc
* small fix * small fix
* *
* Revision 1.79 2007/11/07 09:25:27 vsc * Revision 1.79 2007/11/07 09:25:27 vsc
* speedup meta-calls * speedup meta-calls
* *
* Revision 1.78 2007/11/06 17:02:12 vsc * Revision 1.78 2007/11/06 17:02:12 vsc
* compile ground terms away. * compile ground terms away.
* *
* Revision 1.77 2007/10/10 09:44:24 vsc * Revision 1.77 2007/10/10 09:44:24 vsc
* some more fixes to make YAP swi compatible * some more fixes to make YAP swi compatible
* fix absolute_file_name (again) * fix absolute_file_name (again)
* fix setarg * fix setarg
* *
* Revision 1.76 2007/09/28 23:18:17 vsc * Revision 1.76 2007/09/28 23:18:17 vsc
* handle learning from interpretations. * handle learning from interpretations.
* *
* Revision 1.75 2007/04/10 22:13:21 vsc * Revision 1.75 2007/04/10 22:13:21 vsc
* fix max modules limitation * fix max modules limitation
* *
* Revision 1.74 2007/03/22 11:12:21 vsc * Revision 1.74 2007/03/22 11:12:21 vsc
* make sure that YAP_Restart does not restart a failed goal. * make sure that YAP_Restart does not restart a failed goal.
* *
* Revision 1.73 2007/02/18 00:26:36 vsc * Revision 1.73 2007/02/18 00:26:36 vsc
* fix atom garbage collector (although it is still off by default) * fix atom garbage collector (although it is still off by default)
* make valgrind feel better * make valgrind feel better
* *
* Revision 1.72 2007/01/08 08:27:19 vsc * Revision 1.72 2007/01/08 08:27:19 vsc
* fix restore (Trevor) * fix restore (Trevor)
* make indexing a bit faster on IDB * make indexing a bit faster on IDB
* *
* Revision 1.71 2006/11/27 17:42:03 vsc * Revision 1.71 2006/11/27 17:42:03 vsc
* support for UNICODE, and other bug fixes. * support for UNICODE, and other bug fixes.
* *
* Revision 1.70 2006/08/25 19:50:35 vsc * Revision 1.70 2006/08/25 19:50:35 vsc
* global data structures * global data structures
* *
* Revision 1.69 2006/08/22 16:12:46 vsc * Revision 1.69 2006/08/22 16:12:46 vsc
* global variables * global variables
* *
* Revision 1.68 2006/08/02 18:18:30 vsc * Revision 1.68 2006/08/02 18:18:30 vsc
* preliminary support for readutil library (SWI compatible). * preliminary support for readutil library (SWI compatible).
* *
* Revision 1.67 2006/05/17 18:38:11 vsc * Revision 1.67 2006/05/17 18:38:11 vsc
* make system library use true file name * make system library use true file name
* *
* Revision 1.66 2006/04/28 15:48:33 vsc * Revision 1.66 2006/04/28 15:48:33 vsc
* do locking on streams * do locking on streams
* *
* Revision 1.65 2006/04/28 13:23:23 vsc * Revision 1.65 2006/04/28 13:23:23 vsc
* fix number of overflow bugs affecting threaded version * fix number of overflow bugs affecting threaded version
* make current_op faster. * make current_op faster.
* *
* Revision 1.64 2006/03/22 20:07:28 vsc * Revision 1.64 2006/03/22 20:07:28 vsc
* take better care of zombies * take better care of zombies
* *
* Revision 1.63 2006/03/06 14:04:56 vsc * Revision 1.63 2006/03/06 14:04:56 vsc
* fixes to garbage collector * fixes to garbage collector
* fixes to debugger * fixes to debugger
* *
* Revision 1.62 2006/02/24 14:03:42 vsc * Revision 1.62 2006/02/24 14:03:42 vsc
* fix refs to old LogUpd implementation (pre 5). * fix refs to old LogUpd implementation (pre 5).
* *
* Revision 1.61 2006/01/02 02:16:18 vsc * Revision 1.61 2006/01/02 02:16:18 vsc
* support new interface between YAP and GMP, so that we don't rely on our own * support new interface between YAP and GMP, so that we don't rely on our own
* allocation routines. * allocation routines.
* Several big fixes. * Several big fixes.
* *
* Revision 1.60 2005/12/17 03:25:39 vsc * Revision 1.60 2005/12/17 03:25:39 vsc
* major changes to support online event-based profiling * major changes to support online event-based profiling
* improve error discovery and restart on scanner. * improve error discovery and restart on scanner.
* *
* Revision 1.59 2005/12/05 17:16:11 vsc * Revision 1.59 2005/12/05 17:16:11 vsc
* write_depth/3 * write_depth/3
* overflow handlings and garbage collection * overflow handlings and garbage collection
* Several ipdates to CLPBN * Several ipdates to CLPBN
* dif/2 could be broken in the presence of attributed variables. * dif/2 could be broken in the presence of attributed variables.
* *
* Revision 1.58 2005/11/23 03:01:33 vsc * Revision 1.58 2005/11/23 03:01:33 vsc
* fix several bugs in save/restore.b * fix several bugs in save/restore.b
* *
* Revision 1.57 2005/10/28 17:38:50 vsc * Revision 1.57 2005/10/28 17:38:50 vsc
* sveral updates * sveral updates
* *
* Revision 1.56 2005/10/21 16:09:03 vsc * Revision 1.56 2005/10/21 16:09:03 vsc
* SWI compatible module only operators * SWI compatible module only operators
* *
* Revision 1.55 2005/10/19 19:00:48 vsc * Revision 1.55 2005/10/19 19:00:48 vsc
* extend arrays with nb_terms so that we can implement nb_ builtins * extend arrays with nb_terms so that we can implement nb_ builtins
* correctly. * correctly.
* *
* Revision 1.54 2005/09/09 17:24:39 vsc * Revision 1.54 2005/09/09 17:24:39 vsc
* a new and hopefully much better implementation of atts. * a new and hopefully much better implementation of atts.
* *
* Revision 1.53 2005/08/01 15:40:38 ricroc * Revision 1.53 2005/08/01 15:40:38 ricroc
* TABLING NEW: better support for incomplete tabling * TABLING NEW: better support for incomplete tabling
* *
* Revision 1.52 2005/07/06 19:34:11 ricroc * Revision 1.52 2005/07/06 19:34:11 ricroc
* TABLING: answers for completed calls can now be obtained by loading (new * TABLING: answers for completed calls can now be obtained by loading (new
*option) or executing (default) them from the trie data structure. *option) or executing (default) them from the trie data structure.
* *
* Revision 1.51 2005/07/06 15:10:15 vsc * Revision 1.51 2005/07/06 15:10:15 vsc
* improvements to compiler: merged instructions and fixes for -> * improvements to compiler: merged instructions and fixes for ->
* *
* Revision 1.50 2005/06/01 13:53:46 vsc * Revision 1.50 2005/06/01 13:53:46 vsc
* improve bb routines to use the DB efficiently * improve bb routines to use the DB efficiently
* change interface between DB and BB. * change interface between DB and BB.
* *
* Revision 1.49 2005/05/30 03:26:37 vsc * Revision 1.49 2005/05/30 03:26:37 vsc
* add some atom gc fixes * add some atom gc fixes
* *
* Revision 1.48 2005/01/04 02:50:21 vsc * Revision 1.48 2005/01/04 02:50:21 vsc
* - allow MegaClauses with blobs * - allow MegaClauses with blobs
* - change Diffs to be thread specific * - change Diffs to be thread specific
* - include Christian's updates * - include Christian's updates
* *
* Revision 1.47 2004/12/02 06:06:47 vsc * Revision 1.47 2004/12/02 06:06:47 vsc
* fix threads so that they at least start * fix threads so that they at least start
* allow error handling to work with threads * allow error handling to work with threads
* replace heap_base by Yap_heap_base, according to Yap's convention for globals. * replace heap_base by Yap_heap_base, according to Yap's convention for
* *globals.
* Revision 1.46 2004/11/23 21:16:21 vsc *
* A few extra fixes for saved states. * Revision 1.46 2004/11/23 21:16:21 vsc
* * A few extra fixes for saved states.
* Revision 1.45 2004/10/26 20:16:18 vsc *
* More bug fixes for overflow handling * Revision 1.45 2004/10/26 20:16:18 vsc
* * More bug fixes for overflow handling
* Revision 1.44 2004/10/06 16:55:47 vsc *
* change configure to support big mem configs * Revision 1.44 2004/10/06 16:55:47 vsc
* get rid of extra globals * change configure to support big mem configs
* fix trouble with multifile preds * get rid of extra globals
* * fix trouble with multifile preds
* Revision 1.43 2004/09/27 20:45:04 vsc *
* Mega clauses * Revision 1.43 2004/09/27 20:45:04 vsc
* Fixes to sizeof(expand_clauses) which was being overestimated * Mega clauses
* Fixes to profiling+indexing * Fixes to sizeof(expand_clauses) which was being overestimated
* Fixes to reallocation of memory after restoring * Fixes to profiling+indexing
* Make sure all clauses, even for C, end in _Ystop * Fixes to reallocation of memory after restoring
* Don't reuse space for Streams * Make sure all clauses, even for C, end in _Ystop
* Fix Stream_F on StreaNo+1 * Don't reuse space for Streams
* * Fix Stream_F on StreaNo+1
* Revision 1.42 2004/06/05 03:37:00 vsc *
* coroutining is now a part of attvars. * Revision 1.42 2004/06/05 03:37:00 vsc
* some more fixes. * coroutining is now a part of attvars.
* * some more fixes.
* Revision 1.41 2004/04/29 03:45:50 vsc *
* fix garbage collection in execute_tail * Revision 1.41 2004/04/29 03:45:50 vsc
* * fix garbage collection in execute_tail
* Revision 1.40 2004/03/31 01:03:10 vsc *
* support expand group of clauses * Revision 1.40 2004/03/31 01:03:10 vsc
* * support expand group of clauses
* Revision 1.39 2004/03/19 11:35:42 vsc *
* trim_trail for default machine * Revision 1.39 2004/03/19 11:35:42 vsc
* be more aggressive about try-retry-trust chains. * trim_trail for default machine
* - handle cases where block starts with a wait * be more aggressive about try-retry-trust chains.
* - don't use _killed instructions, just let the thing rot by itself. * - handle cases where block starts with a wait
* * * - don't use _killed instructions, just let the thing rot by itself.
* * * *
*************************************************************************/ * *
*************************************************************************/
#ifdef SCCS #ifdef SCCS
static char SccsId[] = "@(#)rheap.c 1.3 3/15/90"; static char SccsId[] = "@(#)rheap.c 1.3 3/15/90";
#endif #endif
#ifndef RHEAP_H
#define RHEAP_H 1
#include "YapHeap.h"
#include "absmi.h"
#include "clause.h"
#define Atomics 0 #define Atomics 0
#define Funcs 1 #define Funcs 1
@ -1495,3 +1503,5 @@ static void RestoreAtom(AtomEntry *at USES_REGS) {
if (nat) if (nat)
at->NextOfAE = AbsAtom(AtomEntryAdjust(nat)); at->NextOfAE = AbsAtom(AtomEntryAdjust(nat));
} }
#endif

View File

@ -6,13 +6,13 @@ export MACOSX_DEPLOYMENT_TARGET=10.9
export R_COMMAND=$R export R_COMMAND=$R
export CMAKE_BUILD_TYPE=Debug export CMAKE_BUILD_TYPE=Debug
export CMAKE=$PREFIX/bin/cmake export CMAKE=$PREFIX/bin/cmake
export CMAKE_INCLUDE_PATH=$SYS_PREFIX/include export CMAKE_INCLUDE_PATH=$PREFIX/include
export CMAKE_LIBRARY_PATH=$SYS_PREFIX/lib export CMAKE_LIBRARY_PATH=$PREFIX/lib
export CMAKE_INSTALL_PREFIX=$PREFIX export CMAKE_INSTALL_PREFIX=$PREFIX
export GENERATOR="-GNinja" export GENERATOR="-GNinja"
export PYTHON_EXECUTABLE="$PYTHON" export PYTHON_EXECUTABLE="$PYTHON"
export PYTHON_LIBRARY="$STDLIB_DIR/../libPython${PY_VER}m$SHLIB_EXT" export PYTHON_LIBRARY="$CMAKE_LIBRARY_PATH/libpython${PY_VER}m$SHLIB_EXT"
export PYTHON_INCLUDE_DIR="$STDLIB_DIR/../../include/python$PY_VER"m export PYTHON_INCLUDE_DIR="$CMAKE_INCLUDE_PATH/python$PY_VER"m
mkdir $PREFIX/conda mkdir $PREFIX/conda
cd $PREFIX/conda cd $PREFIX/conda
@ -27,7 +27,7 @@ cd $PREFIX/conda
-DPYTHON_INCLUDE_DIR:PATH="$PYTHON_INCLUDE_DIR" \ -DPYTHON_INCLUDE_DIR:PATH="$PYTHON_INCLUDE_DIR" \
$RECIPE_DIR/.. $RECIPE_DIR/..
make -j install CMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" make install CMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX"
# Remove the created lib64 directory # Remove the created lib64 directory

View File

@ -12,6 +12,8 @@ requirements:
- r - r
- notebook - notebook
run: run:
- python
- pythonlab
- readline - readline
- gmp - gmp
- r - r

View File

@ -134,7 +134,7 @@ static YAP_Bool compute_prob(void)
expr expression; expr expression;
DdNode * function; DdNode * function;
DdManager * mgr; DdManager * mgr;
int nBVar,i,intBits,create_dot; int nBVar,i,create_dot;
FILE * file; FILE * file;
DdNode * array[1]; DdNode * array[1];
double prob; double prob;
@ -184,11 +184,10 @@ static YAP_Bool compute_prob(void)
array[0]=function; array[0]=function;
onames[0]="Out"; onames[0]="Out";
file = open_file("cpl.dot", "w"); file = open_file("cpl.dot", "w");
Cudd_DumpDot(mgr,1,array,names,onames,file); Cudd_DumpDot(mgr,1,array,names,( char * const*)onames,file);
fclose(file); fclose(file);
} }
nodes=init_table(vars.nBVar); nodes=init_table(vars.nBVar);
intBits=sizeof(unsigned int)*8;
prob=Prob(function,vars,nodes); prob=Prob(function,vars,nodes);
out=YAP_MkFloatTerm(prob); out=YAP_MkFloatTerm(prob);
destroy_table(nodes,vars.nBVar); destroy_table(nodes,vars.nBVar);

View File

@ -24,9 +24,8 @@ PROPERTIES VERSION ${YAP_FULL_VERSION}
SOVERSION ${YAP_MAJOR_VERSION}.${YAP_MINOR_VERSION} SOVERSION ${YAP_MAJOR_VERSION}.${YAP_MINOR_VERSION}
) )
target_link_libraries(Py4YAP libYap ${PYTHON_LIBRARIES})
# arithmetic hassle. # arithmetic hassle.
target_link_libraries(Py4YAP YAPPython libYap ${PYTHON_LIBRARIES})
install(TARGETS Py4YAP install(TARGETS Py4YAP
@ -36,16 +35,9 @@ install(TARGETS Py4YAP
) )
install(TARGETS YAPPython
LIBRARY DESTINATION ${dlls}
RUNTIME DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls} )
target_link_libraries( YAPPython Py4YAP )
endif() endif()
target_link_libraries(YAPPython libYap ${PYTHON_LIBRARIES}) target_link_libraries(YAPPython libYap)
# arithmetic hassle. # arithmetic hassle.
set_property(TARGET YAPPython PROPERTY CXX_STANDARD_REQUIRED ON) set_property(TARGET YAPPython PROPERTY CXX_STANDARD_REQUIRED ON)

View File

@ -271,21 +271,18 @@ bool python_assign(term_t t, PyObject *exp, PyObject *context) {
if (PL_skip_list(t, tail, &len) && if (PL_skip_list(t, tail, &len) &&
PL_get_nil(tail)) { // true list PL_get_nil(tail)) { // true list
bool o = true;
if (PySequence_Check(exp) && PySequence_Length(exp) == len) if (PySequence_Check(exp) && PySequence_Length(exp) == len)
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
PyObject *p; PyObject *p;
if (!PL_get_list(t, arg, t)) { if (!PL_get_list(t, arg, t)) {
PL_reset_term_refs(tail); PL_reset_term_refs(tail);
o = false;
p = Py_None; p = Py_None;
} }
if ((p = PySequence_GetItem(exp, i)) == NULL) if ((p = PySequence_GetItem(exp, i)) == NULL)
p = Py_None; p = Py_None;
if (!python_assign(arg, p, context)) { if (!python_assign(arg, p, context)) {
PL_reset_term_refs(tail); PL_reset_term_refs(tail);
o = false;
} }
} }
} }

View File

@ -23,7 +23,6 @@ configure_file("MANIFEST.in" ${CMAKE_CURRENT_BINARY_DIR}/MANIFEST.in)
configure_file("YAP4PY.md" README.md) configure_file("YAP4PY.md" README.md)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH} ${CMAKE_CURRENT_BINARY_DIR}/yap4py/include INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH} ${CMAKE_CURRENT_BINARY_DIR}/yap4py/include
DEPENDS ${SWIG_SOURCES} YAP++
) )
@ -43,7 +42,9 @@ INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH} ${CMAKE_CURRENT_BINARY_DIR}/yap4py/i
# LIBRARY DESTINATION ${PYTHON_MODULE_PATH} # LIBRARY DESTINATION ${PYTHON_MODULE_PATH}
# ) # )
if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/yap4py)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/yap4py)
endif()
if (CONDA) if (CONDA)
set(bdist bdist_conda) set(bdist bdist_conda)