C++ & swig
This commit is contained in:
parent
a8a63a31ca
commit
88e3d637ec
@ -388,7 +388,8 @@ Yap_FullLookupAtom(const char *atom)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Yap_LookupAtomWithAddress(const char *atom, AtomEntry *ae)
|
Yap_LookupAtomWithAddress(const char *atom,
|
||||||
|
AtomEntry *ae)
|
||||||
{ /* lookup atom in atom table */
|
{ /* lookup atom in atom table */
|
||||||
register CELL hash;
|
register CELL hash;
|
||||||
register unsigned char *p;
|
register unsigned char *p;
|
||||||
|
65
C/init.c
65
C/init.c
@ -593,6 +593,54 @@ Yap_InitCPred(const char *Name, UInt Arity, CPredicate code, pred_flags_t flags)
|
|||||||
pe->OpcodeOfPred = pe->CodeOfPred->opc;
|
pe->OpcodeOfPred = pe->CodeOfPred->opc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Yap_AddCallToFli( PredEntry *pe, CPredicate call )
|
||||||
|
{
|
||||||
|
yamop *p_code;
|
||||||
|
|
||||||
|
if (pe->PredFlags & BackCPredFlag) {
|
||||||
|
p_code = (yamop *)(pe->cs.p_code.FirstClause);
|
||||||
|
p_code->y_u.OtapFs.f = call;
|
||||||
|
return true;
|
||||||
|
} else if (pe->PredFlags & CPredFlag) {
|
||||||
|
pe->cs.f_code = call;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Yap_AddRetryToFli( PredEntry *pe, CPredicate re )
|
||||||
|
{
|
||||||
|
yamop *p_code;
|
||||||
|
|
||||||
|
if (pe->PredFlags & BackCPredFlag) {
|
||||||
|
p_code = (yamop *)(pe->cs.p_code.FirstClause);
|
||||||
|
p_code = NEXTOP(p_code,OtapFs);
|
||||||
|
p_code->y_u.OtapFs.f = re;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Yap_AddCutToFli( PredEntry *pe, CPredicate CUT )
|
||||||
|
{
|
||||||
|
yamop *p_code;
|
||||||
|
|
||||||
|
if (pe->PredFlags & BackCPredFlag) {
|
||||||
|
p_code = (yamop *)(pe->cs.p_code.FirstClause);
|
||||||
|
p_code = NEXTOP(p_code,OtapFs);
|
||||||
|
p_code = NEXTOP(p_code,OtapFs);
|
||||||
|
p_code->y_u.OtapFs.f = CUT;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Yap_InitCmpPred(const char *Name, UInt Arity, CmpPredicate cmp_code, pred_flags_t flags)
|
Yap_InitCmpPred(const char *Name, UInt Arity, CmpPredicate cmp_code, pred_flags_t flags)
|
||||||
{
|
{
|
||||||
@ -1082,21 +1130,12 @@ InitAtoms(void)
|
|||||||
HashChain[i].Entry = NIL;
|
HashChain[i].Entry = NIL;
|
||||||
}
|
}
|
||||||
NOfAtoms = 0;
|
NOfAtoms = 0;
|
||||||
#if THREADS
|
Yap_LookupAtomWithAddress("**",(AtomEntry *)&(SF_STORE->AtFoundVar));
|
||||||
SF_STORE->AtFoundVar = Yap_LookupAtom("**");
|
|
||||||
Yap_ReleaseAtom(AtomFoundVar);
|
Yap_ReleaseAtom(AtomFoundVar);
|
||||||
SF_STORE->AtFreeTerm = Yap_LookupAtom("?");
|
Yap_LookupAtomWithAddress("?",(AtomEntry *)&(SF_STORE->AtFreeTerm));
|
||||||
Yap_ReleaseAtom(AtomFreeTerm);
|
Yap_ReleaseAtom(AtomFreeTerm);
|
||||||
SF_STORE->AtNil = Yap_LookupAtom("[]");
|
Yap_LookupAtomWithAddress("[]",(AtomEntry *)&(SF_STORE->AtNil));
|
||||||
SF_STORE->AtDot = Yap_LookupAtom(".");
|
Yap_LookupAtomWithAddress(".",(AtomEntry *)&(SF_STORE->AtDot));
|
||||||
#else
|
|
||||||
Yap_LookupAtomWithAddress("**",&(SF_STORE->AtFoundVar));
|
|
||||||
Yap_ReleaseAtom(AtomFoundVar);
|
|
||||||
Yap_LookupAtomWithAddress("?",&(SF_STORE->AtFreeTerm));
|
|
||||||
Yap_ReleaseAtom(AtomFreeTerm);
|
|
||||||
Yap_LookupAtomWithAddress("[]",&(SF_STORE->AtNil));
|
|
||||||
Yap_LookupAtomWithAddress(".",&(SF_STORE->AtDot));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -14570,20 +14570,5 @@ S_SREG = RepAppl(d0);
|
|||||||
BOp(try_udi ,p);
|
BOp(try_udi ,p);
|
||||||
goto Ystop;
|
goto Ystop;
|
||||||
ENDBOp();
|
ENDBOp();
|
||||||
/* BOp(table_answer_resolution_completion, Otapl);
|
|
||||||
goto Ystop;
|
|
||||||
ENDBOp();
|
|
||||||
BOp(run_eam, os);
|
|
||||||
goto Ystop;
|
|
||||||
ENDBOp();
|
|
||||||
BOp(retry_eam, e);
|
|
||||||
goto Ystop;
|
|
||||||
ENDBOp();
|
|
||||||
BOp(thread_local, e);
|
|
||||||
goto Ystop;
|
|
||||||
ENDBOp();
|
|
||||||
BOp(clause_with_cut, e);
|
|
||||||
goto Ystop;
|
|
||||||
ENDBOp(); */
|
|
||||||
|
|
||||||
|
|
||||||
|
17
H/Atoms.h
17
H/Atoms.h
@ -66,6 +66,23 @@ typedef struct AtomEntryStruct
|
|||||||
}
|
}
|
||||||
AtomEntry;
|
AtomEntry;
|
||||||
|
|
||||||
|
// compatible with C and C++;
|
||||||
|
typedef struct ExtraAtomEntryStruct
|
||||||
|
{
|
||||||
|
Atom NextOfAE; /* used to build hash chains */
|
||||||
|
Prop PropsOfAE; /* property list for this atom */
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
rwlock_t ARWLock;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
union {
|
||||||
|
char uStrOfAE[4]; /* representation of atom as a string */
|
||||||
|
wchar_t uWStrOfAE[1]; /* representation of atom as a string */
|
||||||
|
struct atom_blob blob[1];
|
||||||
|
} rep;
|
||||||
|
}
|
||||||
|
ExtraAtomEntry;
|
||||||
|
|
||||||
#define StrOfAE rep.uStrOfAE
|
#define StrOfAE rep.uStrOfAE
|
||||||
#define WStrOfAE rep.uWStrOfAE
|
#define WStrOfAE rep.uWStrOfAE
|
||||||
|
|
||||||
|
38
H/TermExt.h
38
H/TermExt.h
@ -37,16 +37,11 @@ language. Next, we discuss support to the most important ones.
|
|||||||
#define AtomFreeTerm ((Atom)(&(((special_functors *)(NULL))->AtFreeTerm)))
|
#define AtomFreeTerm ((Atom)(&(((special_functors *)(NULL))->AtFreeTerm)))
|
||||||
#define AtomNil ((Atom)(&(((special_functors *)(NULL))->AtNil)))
|
#define AtomNil ((Atom)(&(((special_functors *)(NULL))->AtNil)))
|
||||||
#define AtomDot ((Atom)(&(((special_functors *)(NULL))->AtDot)))
|
#define AtomDot ((Atom)(&(((special_functors *)(NULL))->AtDot)))
|
||||||
#elif defined(THREADS)
|
|
||||||
#define AtomFoundVar AbsAtom(SF_STORE->AtFoundVar)
|
|
||||||
#define AtomFreeTerm AbsAtom(SF_STORE->AtFreeTerm)
|
|
||||||
#define AtomNil AbsAtom(SF_STORE->AtNil)
|
|
||||||
#define AtomDot AbsAtom(SF_STORE->AtDot)
|
|
||||||
#else
|
#else
|
||||||
#define AtomFoundVar AbsAtom(&(SF_STORE->AtFoundVar))
|
#define AtomFoundVar AbsAtom((AtomEntry *)&(SF_STORE->AtFoundVar))
|
||||||
#define AtomFreeTerm AbsAtom(&(SF_STORE->AtFreeTerm))
|
#define AtomFreeTerm AbsAtom((AtomEntry *)&(SF_STORE->AtFreeTerm))
|
||||||
#define AtomNil AbsAtom(&(SF_STORE->AtNil))
|
#define AtomNil AbsAtom((AtomEntry *)&(SF_STORE->AtNil))
|
||||||
#define AtomDot AbsAtom(&(SF_STORE->AtDot))
|
#define AtomDot AbsAtom((AtomEntry *)&(SF_STORE->AtDot))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TermFoundVar MkAtomTerm(AtomFoundVar)
|
#define TermFoundVar MkAtomTerm(AtomFoundVar)
|
||||||
@ -164,32 +159,17 @@ exts;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef YAP_H
|
#if defined(YAP_H)
|
||||||
/* make sure that these data structures are the first thing to be allocated
|
/* make sure that these data structures are the first thing to be allocated
|
||||||
in the heap when we start the system */
|
in the heap when we start the system */
|
||||||
#ifdef THREADS
|
|
||||||
typedef struct special_functors_struct
|
typedef struct special_functors_struct
|
||||||
{
|
{
|
||||||
AtomEntry *AtFoundVar;
|
struct ExtraAtomEntryStruct AtFoundVar;
|
||||||
AtomEntry *AtFreeTerm;
|
struct ExtraAtomEntryStruct AtFreeTerm;
|
||||||
AtomEntry *AtNil;
|
struct ExtraAtomEntryStruct AtNil;
|
||||||
AtomEntry *AtDot;
|
struct ExtraAtomEntryStruct AtDot;
|
||||||
} special_functors;
|
|
||||||
#else
|
|
||||||
typedef struct special_functors_struct
|
|
||||||
{
|
|
||||||
AtomEntry AtFoundVar;
|
|
||||||
char AtFoundVarChars[8];
|
|
||||||
AtomEntry AtFreeTerm;
|
|
||||||
char AtFreeTermChars[8];
|
|
||||||
AtomEntry AtNil;
|
|
||||||
char AtNilChars[8];
|
|
||||||
AtomEntry AtDot;
|
|
||||||
char AtDotChars[8];
|
|
||||||
}
|
}
|
||||||
special_functors;
|
special_functors;
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* YAP_H */
|
#endif /* YAP_H */
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr);
|
INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr);
|
||||||
|
2
H/Yap.h
2
H/Yap.h
@ -166,7 +166,7 @@
|
|||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
#endif /* __MINGW32__ */
|
#endif /* __MINGW32__ */
|
||||||
|
|
||||||
#if HAVE_GCC
|
#if HAVE_GCC && !defined(__cplusplus)
|
||||||
#define MIN_ARRAY 0
|
#define MIN_ARRAY 0
|
||||||
#define DUMMY_FILLER_FOR_ABS_TYPE
|
#define DUMMY_FILLER_FOR_ABS_TYPE
|
||||||
#else
|
#else
|
||||||
|
13
H/Yapproto.h
13
H/Yapproto.h
@ -24,19 +24,19 @@ Term Yap_ArrayToList(Term *,size_t);
|
|||||||
int Yap_GetName(char *,UInt,Term);
|
int Yap_GetName(char *,UInt,Term);
|
||||||
Term Yap_GetValue(Atom);
|
Term Yap_GetValue(Atom);
|
||||||
int Yap_HasOp(Atom);
|
int Yap_HasOp(Atom);
|
||||||
struct operator_entry *Yap_GetOpPropForAModuleHavingALock(AtomEntry *, Term);
|
struct operator_entry *Yap_GetOpPropForAModuleHavingALock(struct AtomEntryStruct *, Term);
|
||||||
Atom Yap_LookupAtom(const char *);
|
Atom Yap_LookupAtom(const char *);
|
||||||
Atom Yap_LookupAtomWithLength(const char *, size_t);
|
Atom Yap_LookupAtomWithLength(const char *, size_t);
|
||||||
Atom Yap_LookupUTF8Atom(const char *);
|
Atom Yap_LookupUTF8Atom(const char *);
|
||||||
Atom Yap_LookupMaybeWideAtom(const wchar_t *);
|
Atom Yap_LookupMaybeWideAtom(const wchar_t *);
|
||||||
Atom Yap_LookupMaybeWideAtomWithLength(const wchar_t *, size_t);
|
Atom Yap_LookupMaybeWideAtomWithLength(const wchar_t *, size_t);
|
||||||
Atom Yap_FullLookupAtom(const char *);
|
Atom Yap_FullLookupAtom(const char *);
|
||||||
void Yap_LookupAtomWithAddress(const char *,AtomEntry *);
|
void Yap_LookupAtomWithAddress(const char *,struct AtomEntryStruct *);
|
||||||
Prop Yap_NewPredPropByFunctor(struct FunctorEntryStruct *, Term);
|
Prop Yap_NewPredPropByFunctor(struct FunctorEntryStruct *, Term);
|
||||||
Prop Yap_NewPredPropByAtom(struct AtomEntryStruct *, Term);
|
Prop Yap_NewPredPropByAtom(struct AtomEntryStruct *, Term);
|
||||||
Prop Yap_PredPropByFunctorNonThreadLocal(struct FunctorEntryStruct *, Term);
|
Prop Yap_PredPropByFunctorNonThreadLocal(struct FunctorEntryStruct *, Term);
|
||||||
Prop Yap_PredPropByAtomNonThreadLocal(struct AtomEntryStruct *, Term);
|
Prop Yap_PredPropByAtomNonThreadLocal(struct AtomEntryStruct *, Term);
|
||||||
Functor Yap_UnlockedMkFunctor(AtomEntry *,unsigned int);
|
Functor Yap_UnlockedMkFunctor(struct AtomEntryStruct *,unsigned int);
|
||||||
Functor Yap_MkFunctor(Atom,unsigned int);
|
Functor Yap_MkFunctor(Atom,unsigned int);
|
||||||
void Yap_MkFunctorWithAddress(Atom,unsigned int,FunctorEntry *);
|
void Yap_MkFunctorWithAddress(Atom,unsigned int,FunctorEntry *);
|
||||||
void Yap_PutValue(Atom,Term);
|
void Yap_PutValue(Atom,Term);
|
||||||
@ -57,7 +57,7 @@ Prop Yap_GetPredPropByAtomInThisModule(Atom, Term);
|
|||||||
Prop Yap_GetPredPropByFuncInThisModule(Functor, Term);
|
Prop Yap_GetPredPropByFuncInThisModule(Functor, Term);
|
||||||
Prop Yap_GetPredPropHavingLock(Atom,unsigned int, Term);
|
Prop Yap_GetPredPropHavingLock(Atom,unsigned int, Term);
|
||||||
Prop Yap_GetExpProp(Atom,unsigned int);
|
Prop Yap_GetExpProp(Atom,unsigned int);
|
||||||
Prop Yap_GetExpPropHavingLock(AtomEntry *,unsigned int);
|
Prop Yap_GetExpPropHavingLock(struct AtomEntryStruct *,unsigned int);
|
||||||
|
|
||||||
/* agc.c */
|
/* agc.c */
|
||||||
void Yap_atom_gc( CACHE_TYPE1 );
|
void Yap_atom_gc( CACHE_TYPE1 );
|
||||||
@ -251,6 +251,9 @@ int Yap_DebugGetc(void);
|
|||||||
#endif
|
#endif
|
||||||
int Yap_IsOpType(char *);
|
int Yap_IsOpType(char *);
|
||||||
void Yap_InitWorkspace(UInt,UInt,UInt,UInt,UInt,int,int,int);
|
void Yap_InitWorkspace(UInt,UInt,UInt,UInt,UInt,int,int,int);
|
||||||
|
bool Yap_AddCallToFli( struct pred_entry *pe, CPredicate call );
|
||||||
|
bool Yap_AddRetryToFli( struct pred_entry *pe, CPredicate re );
|
||||||
|
bool Yap_AddCutToFli( struct pred_entry *pe, CPredicate cut );
|
||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
void Yap_init_yapor_workers(void);
|
void Yap_init_yapor_workers(void);
|
||||||
@ -443,7 +446,7 @@ void Yap_swi_install(void);
|
|||||||
void Yap_InitSWIHash(void);
|
void Yap_InitSWIHash(void);
|
||||||
int Yap_get_stream_handle(Term, int, int, void *);
|
int Yap_get_stream_handle(Term, int, int, void *);
|
||||||
Term Yap_get_stream_position(void *);
|
Term Yap_get_stream_position(void *);
|
||||||
AtomEntry *Yap_lookupBlob(void *blob, size_t len, void *type, int *newp);
|
struct AtomEntryStruct *Yap_lookupBlob(void *blob, size_t len, void *type, int *newp);
|
||||||
|
|
||||||
/* opt.preds.c */
|
/* opt.preds.c */
|
||||||
void Yap_init_optyap_preds(void);
|
void Yap_init_optyap_preds(void);
|
||||||
|
@ -153,7 +153,7 @@ AbsFunctorProp (FunctorEntry * p)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN Int ArityOfFunctor (Functor);
|
INLINE_ONLY inline EXTERN Int ArityOfFunctor (Functor);
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN Int
|
INLINE_ONLY inline EXTERN Int
|
||||||
ArityOfFunctor (Functor Fun)
|
ArityOfFunctor (Functor Fun)
|
||||||
@ -491,7 +491,7 @@ typedef enum
|
|||||||
} op_type;
|
} op_type;
|
||||||
|
|
||||||
|
|
||||||
OpEntry *Yap_GetOpProp(Atom, op_type CACHE_TYPE);
|
OpEntry *Yap_GetOpProp(Atom, op_type CACHE_TYPE);
|
||||||
|
|
||||||
int Yap_IsPrefixOp(Atom,int *,int *);
|
int Yap_IsPrefixOp(Atom,int *,int *);
|
||||||
int Yap_IsOp(Atom);
|
int Yap_IsOp(Atom);
|
||||||
|
@ -2220,10 +2220,11 @@ prune(choiceptr cp USES_REGS)
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
|
#if YAP_JIT
|
||||||
|
|
||||||
extern Environment ExpEnv;
|
extern Environment ExpEnv;
|
||||||
extern char fin[1024];
|
extern char fin[1024];
|
||||||
|
|
||||||
#if YAP_JIT
|
|
||||||
#ifndef _NATIVE
|
#ifndef _NATIVE
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
@ -177,9 +177,9 @@ typedef struct printt_struc {
|
|||||||
CELL msg_after; // If I print, what message should come after?
|
CELL msg_after; // If I print, what message should come after?
|
||||||
} PrinttStruc;
|
} PrinttStruc;
|
||||||
|
|
||||||
|
#if YAP_JIT
|
||||||
/* This struct represents our experimental environment for YAP */
|
/* This struct represents our experimental environment for YAP */
|
||||||
typedef struct environment {
|
typedef struct environment {
|
||||||
#if YAP_JIT
|
|
||||||
// struct for analysis predicates -- all fields are modified by analysis predicates (JIT_AnalysisPreds.c)
|
// struct for analysis predicates -- all fields are modified by analysis predicates (JIT_AnalysisPreds.c)
|
||||||
struct {
|
struct {
|
||||||
CELL outfile; // Where will analysis results be printed?
|
CELL outfile; // Where will analysis results be printed?
|
||||||
@ -331,8 +331,8 @@ typedef struct environment {
|
|||||||
Int exit_on_error; // Should I exit when any error occur?
|
Int exit_on_error; // Should I exit when any error occur?
|
||||||
} act_predicate_actions;
|
} act_predicate_actions;
|
||||||
} debug_struc;
|
} debug_struc;
|
||||||
#endif
|
|
||||||
} Environment;
|
} Environment;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if YAP_JIT
|
#if YAP_JIT
|
||||||
/* Enumeration for types of basic blocks -- used on trace construction */
|
/* Enumeration for types of basic blocks -- used on trace construction */
|
||||||
|
@ -192,7 +192,7 @@ HEADERS = \
|
|||||||
H/inline-only.h \
|
H/inline-only.h \
|
||||||
H/iopreds.h \
|
H/iopreds.h \
|
||||||
H/iswiatoms.h \
|
H/iswiatoms.h \
|
||||||
H/qly.h \
|
H/qly.h \
|
||||||
H/rclause.h \
|
H/rclause.h \
|
||||||
H/rglobals.h \
|
H/rglobals.h \
|
||||||
H/rlocals.h \
|
H/rlocals.h \
|
||||||
@ -206,6 +206,7 @@ HEADERS = \
|
|||||||
H/YapText.h \
|
H/YapText.h \
|
||||||
H/cut_c.h \
|
H/cut_c.h \
|
||||||
H/iatoms.h H/ratoms.h H/tatoms.h \
|
H/iatoms.h H/ratoms.h H/tatoms.h \
|
||||||
|
CXX/yapdb.hh \
|
||||||
CXX/yapi.hh \
|
CXX/yapi.hh \
|
||||||
BEAM/eam.h BEAM/eamamasm.h \
|
BEAM/eam.h BEAM/eamamasm.h \
|
||||||
OPTYap/opt.config.h \
|
OPTYap/opt.config.h \
|
||||||
@ -302,6 +303,7 @@ C_SOURCES= \
|
|||||||
# library/lammpi/yap_mpi.c library/lamm1pi/hash.c library/lammpi/prologterms2c.c
|
# library/lammpi/yap_mpi.c library/lamm1pi/hash.c library/lammpi/prologterms2c.c
|
||||||
CXX_SOURCES = \
|
CXX_SOURCES = \
|
||||||
CXX/yapi.cpp \
|
CXX/yapi.cpp \
|
||||||
|
CXX/yapi.cpp \
|
||||||
JIT/JIT_Compiler.cpp
|
JIT/JIT_Compiler.cpp
|
||||||
|
|
||||||
PLCONS_SOURCES = \
|
PLCONS_SOURCES = \
|
||||||
|
@ -12,6 +12,14 @@ srcdir=@srcdir@
|
|||||||
CPPFLAGS= -I../.. -I$(srcdir)/../../H -I$(srcdir)/../../include -I$(srcdir)/../../os -I$(srcdir)/../../OPTYap -I$(srcdir)/../../BEAM -I$(srcdir)/../../CXX
|
CPPFLAGS= -I../.. -I$(srcdir)/../../H -I$(srcdir)/../../include -I$(srcdir)/../../os -I$(srcdir)/../../OPTYap -I$(srcdir)/../../BEAM -I$(srcdir)/../../CXX
|
||||||
CXXFLAGS= $(YAP_EXTRAS) $(DEFS) $(CPPFLAGS)
|
CXXFLAGS= $(YAP_EXTRAS) $(DEFS) $(CPPFLAGS)
|
||||||
|
|
||||||
|
YAP_SWIG_INTERFACE= $(srcdir)/yap.i \
|
||||||
|
$(srcdir)/../../CXX/yapi.hh \
|
||||||
|
$(srcdir)/../../CXX/yapa.hh \
|
||||||
|
$(srcdir)/../../CXX/yapdb.hh \
|
||||||
|
$(srcdir)/../../CXX/yapie.hh \
|
||||||
|
$(srcdir)/../../CXX/yapq.hh \
|
||||||
|
$(srcdir)/../../CXX/yapi.cpp
|
||||||
|
|
||||||
JNI_SQLITE="$(srcdir)/android/jni/sqlite"
|
JNI_SQLITE="$(srcdir)/android/jni/sqlite"
|
||||||
|
|
||||||
JAVA_SQLITE="$(srcdir)/android/src/org"
|
JAVA_SQLITE="$(srcdir)/android/src/org"
|
||||||
@ -47,7 +55,7 @@ python: $(SWIG_FILES) python/_yap.so python/yap.py
|
|||||||
python/_yap.so: python/yap_wrap.o
|
python/_yap.so: python/yap_wrap.o
|
||||||
$(CXX) -shared $(LDSOFLAGS) -o python/_yap.so python/yap_wrap.o ../../yapi.o $(LIBS) @PYTHON_LIBS@ -L ../.. -lYap -lpthread
|
$(CXX) -shared $(LDSOFLAGS) -o python/_yap.so python/yap_wrap.o ../../yapi.o $(LIBS) @PYTHON_LIBS@ -L ../.. -lYap -lpthread
|
||||||
|
|
||||||
python/yap_wrap.cpp python/yap.py: $(srcdir)/yap.i
|
python/yap_wrap.cpp python/yap.py: $(YAP_SWIG_INTERFACE)
|
||||||
mkdir -p python
|
mkdir -p python
|
||||||
$(SWIG) -c++ -python -outdir python -o $@ $(CXXFLAGS) -Wall $<
|
$(SWIG) -c++ -python -outdir python -o $@ $(CXXFLAGS) -Wall $<
|
||||||
|
|
||||||
@ -60,7 +68,7 @@ java: jni/libyap.@SO@ java/yap.java
|
|||||||
jni/libyap.@SO@: jni/yap_wrap.o
|
jni/libyap.@SO@: jni/yap_wrap.o
|
||||||
$(CXX) -shared $(LDSOFLAGS) -o $@ ../../yapi.o $< $(LIBS) @JPLLDFLAGS@ -L ../.. -lYap -lpthread
|
$(CXX) -shared $(LDSOFLAGS) -o $@ ../../yapi.o $< $(LIBS) @JPLLDFLAGS@ -L ../.. -lYap -lpthread
|
||||||
|
|
||||||
jni/yap_wrap.cpp java/yap.java: $(srcdir)/yap.i
|
jni/yap_wrap.cpp java/yap.java: $(YAP_SWIG_INTERFACE)
|
||||||
$(SWIG) -c++ -java -package pt.up.fc.dcc.yap -outdir java -o jni/yap_wrap.cpp $(CXXFLAGS) -Wall $<
|
$(SWIG) -c++ -java -package pt.up.fc.dcc.yap -outdir java -o jni/yap_wrap.cpp $(CXXFLAGS) -Wall $<
|
||||||
|
|
||||||
jni/yap_wrap.o: jni/yap_wrap.cpp
|
jni/yap_wrap.o: jni/yap_wrap.cpp
|
||||||
@ -104,7 +112,7 @@ android/AndroidManifest.xml: $(ANDROID_PKG)
|
|||||||
mkdir -p android/assets/lib/Yap
|
mkdir -p android/assets/lib/Yap
|
||||||
mkdir -p android/jni
|
mkdir -p android/jni
|
||||||
|
|
||||||
android/jni/yap_wrap.cpp: $(srcdir)/yap.i $(srcdir)/../../CXX/yapi.hh $(srcdir)/../../CXX/yapi.cpp android/AndroidManifest.xml
|
android/jni/yap_wrap.cpp: $(YAP_SWIG_INTERF) android/AndroidManifest.xml
|
||||||
$(SWIG) -c++ -java -I$(srcdir)/../../CXX -package pt.up.fc.dcc.yap -outdir android/src/pt/up/fc/dcc/yap -o android/jni/yap_wrap.cpp $<
|
$(SWIG) -c++ -java -I$(srcdir)/../../CXX -package pt.up.fc.dcc.yap -outdir android/src/pt/up/fc/dcc/yap -o android/jni/yap_wrap.cpp $<
|
||||||
|
|
||||||
install-android: android
|
install-android: android
|
||||||
|
@ -9,12 +9,12 @@ engine = yap.YAPEngine();
|
|||||||
def go():
|
def go():
|
||||||
while True:
|
while True:
|
||||||
s = raw_input("Prolog Query: ")
|
s = raw_input("Prolog Query: ")
|
||||||
try:
|
|
||||||
q = engine.query(s)
|
q = engine.query(s)
|
||||||
except:
|
|
||||||
print "Oops! That was no valid number. Try again..."
|
|
||||||
while q.next():
|
while q.next():
|
||||||
vs = q.namedVars();
|
vs = q.namedVars();
|
||||||
|
if vs.length() == 0:
|
||||||
|
print "yes"
|
||||||
|
else:
|
||||||
while vs.length() > 0:
|
while vs.length() > 0:
|
||||||
eq = vs.car()
|
eq = vs.car()
|
||||||
print eq.getArg(1).text() + " = " + eq.getArg(2).text()
|
print eq.getArg(1).text() + " = " + eq.getArg(2).text()
|
||||||
|
@ -68,6 +68,16 @@
|
|||||||
|
|
||||||
%include "yapi.hh"
|
%include "yapi.hh"
|
||||||
|
|
||||||
|
%include "yapa.hh"
|
||||||
|
|
||||||
|
%include "yapie.hh"
|
||||||
|
|
||||||
|
%include "yapt.hh"
|
||||||
|
|
||||||
|
%include "yapdb.hh"
|
||||||
|
|
||||||
|
%include "yapq.hh"
|
||||||
|
|
||||||
#ifdef SWIGJAVA
|
#ifdef SWIGJAVA
|
||||||
%javaexception("java.text.ParseException") YAPPredicate {
|
%javaexception("java.text.ParseException") YAPPredicate {
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user