This commit is contained in:
Vitor Santos Costa 2018-06-18 12:16:36 +01:00
parent d5b96ef518
commit 18c74933af
44 changed files with 931 additions and 975 deletions

View File

@ -1191,7 +1191,6 @@ Int Yap_absmi(int inp) {
#ifdef SHADOW_S
register CELL *SREG = Yap_REGS.S_;
#else
#define SREG S
#endif /* SHADOW_S */
/* The indexing register so that we will not destroy ARG1 without

View File

@ -1794,7 +1794,6 @@ X_API bool YAP_RetryGoal(YAP_dogoalinfo *dgi) {
X_API bool YAP_LeaveGoal(bool successful, YAP_dogoalinfo *dgi) {
CACHE_REGS
choiceptr myB, handler;
bool backtrack = false;
// fprintf(stderr,"LeaveGoal success=%d: H=%d ENV=%p B=%ld myB=%ld TR=%d P=%p CP=%p Slots=%d\n", successful,HR-H0,LCL0-ENV,LCL0-(CELL*)B,dgi->b0,(CELL*)TR-LCL0, P, CP, LOCAL_CurSlot);
BACKUP_MACHINE_REGS();
@ -2162,7 +2161,11 @@ X_API FILE *YAP_TermToStream(Term t) {
X_API void YAP_EndConsult(int sno, int *osnop, const char *full) {
BACKUP_MACHINE_REGS();
Yap_CloseStream(sno);
#if __unix__
Yap_ChDir(dirname(full));
#else
Yap_ChDir(full);
#endif
if (osnop >= 0)
Yap_AddAlias(AtomLoopStream, *osnop);
Yap_end_consult();

View File

@ -1581,14 +1581,12 @@ static bool do_goal(yamop *CodeAdr, int arity, CELL *pt, bool top USES_REGS) {
choiceptr saved_b = B;
bool out;
Yap_PrepGoal(arity, pt, saved_b PASS_REGS);
CACHE_S();
CACHE_A1();
// CACHE_A1();
P = (yamop *)CodeAdr;
// S = CellPtr(RepPredProp(
// PredPropByFunc(Yap_MkFunctor(AtomCall, 1), 0))); /* A1 mishaps */
out = exec_absmi(top, YAP_EXEC_ABSMI PASS_REGS);
ENDCACHE_S();
// if (out) {
// out = Yap_GetFromSlot(sl);
// }

16
C/exo.c
View File

@ -87,10 +87,10 @@ inline BITS32 fmix32 ( BITS32 h )
return h;
}
//-----------------------------------------------------------------------------
INLINE_ONLY inline BITS32
INLINE_ONLY BITS32
HASH_MURMUR3_32 (UInt arity, CELL *cl, UInt bnds[], UInt sz);
INLINE_ONLY inline BITS32
INLINE_ONLY BITS32
HASH_MURMUR3_32 (UInt arity, CELL *cl, UInt bnds[], UInt sz)
{
UInt hash;
@ -139,10 +139,10 @@ HASH_MURMUR3_32 (UInt arity, CELL *cl, UInt bnds[], UInt sz)
/*DJB2*/
#define DJB2_OFFSET 5381
INLINE_ONLY inline BITS32
INLINE_ONLY BITS32
HASH_DJB2(UInt arity, CELL *cl, UInt bnds[], UInt sz);
INLINE_ONLY inline BITS32
INLINE_ONLY BITS32
HASH_DJB2(UInt arity, CELL *cl, UInt bnds[], UInt sz)
{
BITS32 hash;
@ -165,11 +165,11 @@ HASH_DJB2(UInt arity, CELL *cl, UInt bnds[], UInt sz)
return hash;
}
INLINE_ONLY inline BITS32
INLINE_ONLY BITS32
HASH_RS(UInt arity, CELL *cl, UInt bnds[], UInt sz);
/* RS Hash Function */
INLINE_ONLY inline BITS32
INLINE_ONLY BITS32
HASH_RS(UInt arity, CELL *cl, UInt bnds[], UInt sz)
{
UInt hash=0;
@ -194,7 +194,7 @@ HASH_RS(UInt arity, CELL *cl, UInt bnds[], UInt sz)
return hash;
}
INLINE_ONLY inline BITS32
INLINE_ONLY BITS32
HASH_FVN_1A(UInt arity, CELL *cl, UInt bnds[], UInt sz);
/* Simple hash function:
@ -203,7 +203,7 @@ HASH_FVN_1A(UInt arity, CELL *cl, UInt bnds[], UInt sz);
hash0 spreads extensions coming from different elements.
spread over j quadrants.
*/
INLINE_ONLY inline BITS32
INLINE_ONLY BITS32
HASH_FVN_1A(UInt arity, CELL *cl, UInt bnds[], UInt sz)
{
UInt hash;

View File

@ -15,12 +15,11 @@
* *
*************************************************************************/
/* static char SccsId[] = "X 4.3.3"; */
#include "config.h"
#include "Yap.h"
#include "YapHeap.h"
#include "YapInterface.h"
#include "YapStreams.h"
#include "config.h"
#include "iopreds.h"
#if HAVE_UNISTD_H
@ -183,7 +182,7 @@ static void consult(const char *b_file USES_REGS) {
Yap_StartSlots();
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "read %s <%d>", b_file,
GLOBAL_Stream[c_stream].linecount);
Term vs = YAP_MkVarTerm(), pos = MkVarTerm();
Term vs = MkVarTerm(), pos = MkVarTerm();
t = YAP_ReadClauseFromStream(c_stream, vs, pos);
// Yap_GetNèwSlot(t);
if (t == 0) {
@ -316,7 +315,7 @@ static void Yap_set_locations(YAP_init_args *iap) {
/// BOOTPLDIR: where we can find Prolog bootstrap files
Yap_BOOTSTRAP = sel(true, iap->BOOTSTRAP != NULL, iap->BOOTSTRAP, true,
#if __ANDROID__
"/assets/Yap/pl/boot,yap",
"/assets/Yap/pl/boot.yap",
#else
join(getenv("DESTDIR"), YAP_BOOTSTRAP),
#endif

View File

@ -152,10 +152,10 @@ public:
/// It also communicates the array of arguments t[]
/// and the array of variables
/// back to yapquery
YAPPredicate(const char *s0, Term &tout, Term &tnames, CELL *&nts) {
YAPPredicate(const char *s0, Term &tout, YAPPairTerm &names, CELL *&nts) {
CACHE_REGS
const char *s = (const char *)s0;
tnames = MkVarTerm();
Term tnames = MkVarTerm();
tout =
Yap_BufferToTermWithPrioBindings(s, TermNil, tnames, strlen(s0), 1200);
// fprintf(stderr,"ap=%p arity=%d text=%s", ap, ap->ArityOfPE, s);
@ -165,7 +165,7 @@ public:
}
ap = getPred(tout, nts);
tout = Yap_SaveTerm(tout);
tnames = Yap_SaveTerm(tnames);
names = YAPPairTerm(tnames);
}

View File

@ -1,4 +1,6 @@
#include "inline-only.h"
#define _EXPORT_KERNEL 1
#include "yapi.hh"
@ -327,7 +329,7 @@ std::vector<Term> YAPPairTerm::listToArray() {
if (l < 0) {
throw YAPError(SOURCE(), TYPE_ERROR_LIST, (t), nullptr);
}
std::vector<Term> o = std::vector<Term>(l);
std::vector<Term> o = * new std::vector<Term>(l);
int i = 0;
Term t = gt();
while (t != TermNil) {
@ -639,7 +641,7 @@ YAPQuery::YAPQuery(YAPFunctor f, YAPTerm mod, YAPTerm ts[])
goal = MkVarTerm();
}
openQuery();
names = TermNil;
names = YAPPairTerm(TermNil);
RECOVER_MACHINE_REGS();
}

View File

@ -32,9 +32,9 @@
extern "C" {
#include <stdlib.h>
#include <string>
#include <stdlib.h>
// Bad export from Python
@ -81,7 +81,6 @@ extern bool python_in_python;
#if _MSC_VER || defined(__MINGW32__)
//#include <windows.h>
#endif
// taken from yap_structs.h
#include "iopreds.h"

View File

@ -42,7 +42,7 @@ class X_API YAPQuery : public YAPPredicate {
struct yami *q_p, *q_cp;
int q_flags;
YAP_dogoalinfo q_h;
Term names;
YAPPairTerm names;
Term goal;
CELL *nts;
// temporaries
@ -117,7 +117,7 @@ public:
YAPQuery(YAPTerm t) : YAPPredicate((goal = t.term()), nts) {
BACKUP_MACHINE_REGS();
openQuery();
names = TermNil ;
names = YAPPairTerm(TermNil) ;
RECOVER_MACHINE_REGS();
}
/// set flags for query execution, currently only for exception handling
@ -142,10 +142,10 @@ public:
void close();
/// query variables.
void cut();
Term namedVars() { return names; };
Term namedVars() { return names.term(); };
YAPPairTerm namedVarTerms() { return names; };
/// query variables, but copied out
std::vector<Term> namedVarsVector() { return YAPPairTerm(names).listToArray(); };
std::vector<Term> namedVarsVector() { return names.listToArray(); };
/// convert a ref to a binding.
YAPTerm getTerm(yhandle_t t);
/// simple YAP Query;

105
H/Regs.h
View File

@ -24,32 +24,31 @@
#define MaxTemps 512
#define MaxArithms 32
#if defined(i386) && CELLSIZE == 4
#define PUSH_REGS 1
#undef PUSH_X
#endif
#if defined(__x86_64__)
#ifdef sparc
#define PUSH_REGS 1
#undef PUSH_X
#endif
#if defined(__x86_64__) && CELLSIZE == 8
#define PUSH_REGS 1
#undef PUSH_X
#endif
#ifdef __alpha
#elif defined(i386)
#undef PUSH_REGS
#undef PUSH_X
#elif defined(sparc)
#define PUSH_REGS 1
#undef PUSH_X
#elif defined(__alpha)
#undef PUSH_REGS
#undef PUSH_X
#endif
#if defined(_POWER) || defined(__POWERPC__)
#elif defined(_POWER) || defined(__POWERPC__)
#undef PUSH_REGS
#undef PUSH_X
#endif
#ifdef hppa
#elif defined( hppa )
#undef PUSH_REGS
#undef PUSH_X
#endif
@ -72,12 +71,12 @@
#include "inline-only.h"
INLINE_ONLY inline EXTERN void restore_machine_regs(void);
INLINE_ONLY inline EXTERN void save_machine_regs(void);
INLINE_ONLY inline EXTERN void restore_H(void);
INLINE_ONLY inline EXTERN void save_H(void);
INLINE_ONLY inline EXTERN void restore_B(void);
INLINE_ONLY inline EXTERN void save_B(void);
INLINE_ONLY void restore_machine_regs(void);
INLINE_ONLY void save_machine_regs(void);
INLINE_ONLY void restore_H(void);
INLINE_ONLY void save_H(void);
INLINE_ONLY void restore_B(void);
INLINE_ONLY void save_B(void);
#define CACHE_REGS
#define REFRESH_CACHE_REGS
@ -160,7 +159,7 @@ extern REGSTORE *Yap_regp;
#ifdef PUSH_X
#define XREGS (Yap_REGS.XTERMS)
#define XREGS (Yapregp->XTERMS)
#else
@ -243,7 +242,7 @@ register CELL CreepFlag asm ("$15");
/* Interface with foreign code, make sure the foreign code sees all the
registers the way they used to be */
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
INLINE_ONLY void save_machine_regs(void) {
Yap_REGS.H_ = HR;
Yap_REGS.HB_ = HB;
Yap_REGS.B_ = B;
@ -254,7 +253,7 @@ INLINE_ONLY EXTERN inline void save_machine_regs(void) {
Yap_REGS.TR_ = TR;
}
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
INLINE_ONLY void restore_machine_regs(void) {
HR = Yap_REGS.H_;
HB = Yap_REGS.HB_;
B = Yap_REGS.B_;
@ -283,11 +282,11 @@ INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
CP = BK_CP; \
TR = BK_TR
INLINE_ONLY EXTERN inline void save_H(void) {
INLINE_ONLY void save_H(void) {
Yap_REGS.H_ = HR;
}
INLINE_ONLY EXTERN inline void restore_H(void) {
INLINE_ONLY void restore_H(void) {
HR = Yap_REGS.H_;
}
@ -295,11 +294,11 @@ INLINE_ONLY EXTERN inline void restore_H(void) {
#define RECOVER_H() save_H(); HR = BK_H
INLINE_ONLY EXTERN inline void save_B(void) {
INLINE_ONLY void save_B(void) {
Yap_REGS.B_ = B;
}
INLINE_ONLY EXTERN inline void restore_B(void) {
INLINE_ONLY void restore_B(void) {
B = Yap_REGS.B_;
}
@ -310,11 +309,11 @@ INLINE_ONLY EXTERN inline void restore_B(void) {
INLINE_ONLY EXTERN void restore_TR(void);
INLINE_ONLY EXTERN void save_TR(void);
INLINE_ONLY EXTERN inline void save_TR(void) {
INLINE_ONLY void save_TR(void) {
Yap_REGS.TR_ = TR;
}
INLINE_ONLY EXTERN inline void restore_TR(void) {
INLINE_ONLY void restore_TR(void) {
TR = Yap_REGS.TR_;
}
@ -330,7 +329,7 @@ register CELL *S asm ("r16");
register CELL CreepFlag asm ("r17");
register tr_fr_ptr TR asm ("r18");
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
INLINE_ONLY void save_machine_regs(void) {
Yap_REGS.H_ = HR;
Yap_REGS.HB_ = HB;
Yap_REGS.B_ = B;
@ -339,7 +338,7 @@ INLINE_ONLY EXTERN inline void save_machine_regs(void) {
Yap_REGS.TR_ = TR;
}
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
INLINE_ONLY void restore_machine_regs(void) {
HR = Yap_REGS.H_;
HB = Yap_REGS.HB_;
B = Yap_REGS.B_;
@ -366,11 +365,11 @@ INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
CP = BK_CP; \
TR = BK_TR
INLINE_ONLY EXTERN inline void save_H(void) {
INLINE_ONLY void save_H(void) {
Yap_REGS.H_ = HR;
}
INLINE_ONLY EXTERN inline void restore_H(void) {
INLINE_ONLY void restore_H(void) {
HR = Yap_REGS.H_;
}
@ -378,11 +377,11 @@ INLINE_ONLY EXTERN inline void restore_H(void) {
#define RECOVER_H() save_H(); HR = BK_H
INLINE_ONLY EXTERN inline void save_B(void) {
INLINE_ONLY void save_B(void) {
Yap_REGS.B_ = B;
}
INLINE_ONLY EXTERN inline void restore_B(void) {
INLINE_ONLY void restore_B(void) {
B = Yap_REGS.B_;
}
@ -393,11 +392,11 @@ INLINE_ONLY EXTERN inline void restore_B(void) {
INLINE_ONLY EXTERN void restore_TR(void);
INLINE_ONLY EXTERN void save_TR(void);
INLINE_ONLY EXTERN inline void save_TR(void) {
INLINE_ONLY void save_TR(void) {
Yap_REGS.TR_ = TR;
}
INLINE_ONLY EXTERN inline void restore_TR(void) {
INLINE_ONLY void restore_TR(void) {
TR = Yap_REGS.TR_;
}
@ -442,7 +441,7 @@ register CELL *YENV asm ("r19");
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
INLINE_ONLY void save_machine_regs(void) {
Yap_REGS.H_ = HR;
Yap_REGS.HB_ = HB;
Yap_REGS.B_ = B;
@ -451,7 +450,7 @@ INLINE_ONLY EXTERN inline void save_machine_regs(void) {
Yap_REGS.TR_ = TR;
}
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
INLINE_ONLY void restore_machine_regs(void) {
HR = Yap_REGS.H_;
HB = Yap_REGS.HB_;
B = Yap_REGS.B_;
@ -476,11 +475,11 @@ INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
CP = BK_CP; \
TR = BK_TR
INLINE_ONLY EXTERN inline void save_H(void) {
INLINE_ONLY void save_H(void) {
Yap_REGS.H_ = HR;
}
INLINE_ONLY EXTERN inline void restore_H(void) {
INLINE_ONLY void restore_H(void) {
HR = Yap_REGS.H_;
}
@ -488,11 +487,11 @@ INLINE_ONLY EXTERN inline void restore_H(void) {
#define RECOVER_H() save_H(); HR = BK_H
INLINE_ONLY EXTERN inline void save_B(void) {
INLINE_ONLY void save_B(void) {
Yap_REGS.B_ = B;
}
INLINE_ONLY EXTERN inline void restore_B(void) {
INLINE_ONLY void restore_B(void) {
B = Yap_REGS.B_;
}
@ -503,11 +502,11 @@ INLINE_ONLY EXTERN inline void restore_B(void) {
INLINE_ONLY EXTERN void restore_TR(void);
INLINE_ONLY EXTERN void save_TR(void);
INLINE_ONLY EXTERN inline void save_TR(void) {
INLINE_ONLY void save_TR(void) {
Yap_REGS.TR_ = TR;
}
INLINE_ONLY EXTERN inline void restore_TR(void) {
INLINE_ONLY void restore_TR(void) {
TR = Yap_REGS.TR_;
}
@ -524,30 +523,30 @@ INLINE_ONLY EXTERN inline void restore_TR(void) {
#define HB Yap_REGS.HB_ /* heap (global) stack top at time of latest c.p. */
#define CreepFlag Yap_REGS.CreepFlag_
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
INLINE_ONLY void save_machine_regs(void) {
}
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
INLINE_ONLY void restore_machine_regs(void) {
}
#define BACKUP_MACHINE_REGS()
#define RECOVER_MACHINE_REGS()
INLINE_ONLY EXTERN inline void save_H(void) {
INLINE_ONLY void save_H(void) {
}
INLINE_ONLY EXTERN inline void restore_H(void) {
INLINE_ONLY void restore_H(void) {
}
#define BACKUP_H()
#define RECOVER_H()
INLINE_ONLY EXTERN inline void save_B(void) {
INLINE_ONLY void save_B(void) {
}
INLINE_ONLY EXTERN inline void restore_B(void) {
INLINE_ONLY void restore_B(void) {
}
#define BACKUP_B()

View File

@ -79,9 +79,9 @@
#define YAP_PROTECTED_MASK 0xc0000000L
#include "inline-only.h"
INLINE_ONLY inline EXTERN int IsVarTerm (Term);
INLINE_ONLY int IsVarTerm (Term);
INLINE_ONLY inline EXTERN int
INLINE_ONLY int
IsVarTerm (Term t)
{
return (int) (!((t) & LowTagBits));
@ -89,9 +89,9 @@ IsVarTerm (Term t)
INLINE_ONLY inline EXTERN int IsNonVarTerm (Term);
INLINE_ONLY int IsNonVarTerm (Term);
INLINE_ONLY inline EXTERN int
INLINE_ONLY int
IsNonVarTerm (Term t)
{
return (int) (((t) & LowTagBits));
@ -99,9 +99,9 @@ IsNonVarTerm (Term t)
INLINE_ONLY inline EXTERN Term *RepPair (Term);
INLINE_ONLY Term *RepPair (Term);
INLINE_ONLY inline EXTERN Term *
INLINE_ONLY Term *
RepPair (Term t)
{
return (Term *) ((t) - PairBits);
@ -109,9 +109,9 @@ RepPair (Term t)
INLINE_ONLY inline EXTERN Term AbsPair (Term *);
INLINE_ONLY Term AbsPair (Term *);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AbsPair (Term * p)
{
return (Term) (Unsigned (p) + PairBits);
@ -119,9 +119,9 @@ AbsPair (Term * p)
INLINE_ONLY inline EXTERN Int IsPairTerm (Term);
INLINE_ONLY Int IsPairTerm (Term);
INLINE_ONLY inline EXTERN Int
INLINE_ONLY Int
IsPairTerm (Term t)
{
return (Int) ((((t) & LowTagBits) == PairBits));
@ -129,9 +129,9 @@ IsPairTerm (Term t)
INLINE_ONLY inline EXTERN Term *RepAppl (Term);
INLINE_ONLY Term *RepAppl (Term);
INLINE_ONLY inline EXTERN Term *
INLINE_ONLY Term *
RepAppl (Term t)
{
return (Term *) (((t) - ApplBit));
@ -139,9 +139,9 @@ RepAppl (Term t)
INLINE_ONLY inline EXTERN Term AbsAppl (Term *);
INLINE_ONLY Term AbsAppl (Term *);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AbsAppl (Term * p)
{
return (Term) (Unsigned (p) + ApplBit);
@ -149,9 +149,9 @@ AbsAppl (Term * p)
INLINE_ONLY inline EXTERN Int IsApplTerm (Term);
INLINE_ONLY Int IsApplTerm (Term);
INLINE_ONLY inline EXTERN Int
INLINE_ONLY Int
IsApplTerm (Term t)
{
return (Int) ((((t) & LowTagBits) == ApplBit));
@ -159,9 +159,9 @@ IsApplTerm (Term t)
INLINE_ONLY inline EXTERN Int IsAtomOrIntTerm (Term);
INLINE_ONLY Int IsAtomOrIntTerm (Term);
INLINE_ONLY inline EXTERN Int
INLINE_ONLY Int
IsAtomOrIntTerm (Term t)
{
return (Int) ((((t) & LowTagBits) == 2));
@ -170,9 +170,9 @@ IsAtomOrIntTerm (Term t)
INLINE_ONLY inline EXTERN Term AdjustPtr (Term t, Term off);
INLINE_ONLY Term AdjustPtr (Term t, Term off);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AdjustPtr (Term t, Term off)
{
return (Term) ((t) + off);
@ -180,9 +180,9 @@ AdjustPtr (Term t, Term off)
INLINE_ONLY inline EXTERN Term AdjustIDBPtr (Term t, Term off);
INLINE_ONLY Term AdjustIDBPtr (Term t, Term off);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AdjustIDBPtr (Term t, Term off)
{
return (Term) ((t) + off);
@ -191,9 +191,9 @@ AdjustIDBPtr (Term t, Term off)
INLINE_ONLY inline EXTERN Int IntOfTerm (Term);
INLINE_ONLY Int IntOfTerm (Term);
INLINE_ONLY inline EXTERN Int
INLINE_ONLY Int
IntOfTerm (Term t)
{
return (Int) (((Int) (t << 1)) >> (SHIFT_LOW_TAG + SHIFT_HIGH_TAG + 1));

View File

@ -104,9 +104,9 @@ are now 1 in compound terms and structures.
/* never forget to surround arguments to a macro by brackets */
#include "inline-only.h"
INLINE_ONLY inline EXTERN int IsVarTerm (Term);
INLINE_ONLY int IsVarTerm (Term);
INLINE_ONLY inline EXTERN int
INLINE_ONLY int
IsVarTerm (Term t)
{
return (int) (Signed (t) >= 0);
@ -114,9 +114,9 @@ IsVarTerm (Term t)
INLINE_ONLY inline EXTERN int IsNonVarTerm (Term);
INLINE_ONLY int IsNonVarTerm (Term);
INLINE_ONLY inline EXTERN int
INLINE_ONLY int
IsNonVarTerm (Term t)
{
return (int) (Signed (t) < 0);
@ -125,9 +125,9 @@ IsNonVarTerm (Term t)
#if UNIQUE_TAG_FOR_PAIRS
INLINE_ONLY inline EXTERN Term *RepPair (Term);
INLINE_ONLY Term *RepPair (Term);
INLINE_ONLY inline EXTERN Term *
INLINE_ONLY Term *
RepPair (Term t)
{
return (Term *) ((~(t)));
@ -135,9 +135,9 @@ RepPair (Term t)
INLINE_ONLY inline EXTERN Term AbsPair (Term *);
INLINE_ONLY Term AbsPair (Term *);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AbsPair (Term * p)
{
return (Term) ((~Unsigned (p)));
@ -145,9 +145,9 @@ AbsPair (Term * p)
INLINE_ONLY inline EXTERN Int IsPairTerm (Term);
INLINE_ONLY Int IsPairTerm (Term);
INLINE_ONLY inline EXTERN Int
INLINE_ONLY Int
IsPairTerm (Term t)
{
return (Int) (((t) & PairBit));
@ -155,9 +155,9 @@ IsPairTerm (Term t)
INLINE_ONLY inline EXTERN Term *RepAppl (Term);
INLINE_ONLY Term *RepAppl (Term);
INLINE_ONLY inline EXTERN Term *
INLINE_ONLY Term *
RepAppl (Term t)
{
return (Term *) ((-Signed (t)));
@ -165,9 +165,9 @@ RepAppl (Term t)
INLINE_ONLY inline EXTERN Term AbsAppl (Term *);
INLINE_ONLY Term AbsAppl (Term *);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AbsAppl (Term * p)
{
return (Term) ((-Signed (p)));
@ -175,9 +175,9 @@ AbsAppl (Term * p)
INLINE_ONLY inline EXTERN Int IsApplTerm (Term);
INLINE_ONLY Int IsApplTerm (Term);
INLINE_ONLY inline EXTERN Int
INLINE_ONLY Int
IsApplTerm (Term t)
{
return (Int) ((!((t) & LowTagBits)));
@ -186,9 +186,9 @@ IsApplTerm (Term t)
#else
INLINE_ONLY inline EXTERN Term *RepPair (Term);
INLINE_ONLY Term *RepPair (Term);
INLINE_ONLY inline EXTERN Term *
INLINE_ONLY Term *
RepPair (Term t)
{
return (Term *) ((-Signed (t)));
@ -196,9 +196,9 @@ RepPair (Term t)
INLINE_ONLY inline EXTERN Term AbsPair (Term *);
INLINE_ONLY Term AbsPair (Term *);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AbsPair (Term * p)
{
return (Term) (((CELL) (-Signed (p))));
@ -206,9 +206,9 @@ AbsPair (Term * p)
INLINE_ONLY inline EXTERN Int IsPairTerm (Term);
INLINE_ONLY Int IsPairTerm (Term);
INLINE_ONLY inline EXTERN Int
INLINE_ONLY Int
IsPairTerm (Term t)
{
return (Int) ((!((t) & LowTagBits)));
@ -216,9 +216,9 @@ IsPairTerm (Term t)
INLINE_ONLY inline EXTERN Term *RepAppl (Term);
INLINE_ONLY Term *RepAppl (Term);
INLINE_ONLY inline EXTERN Term *
INLINE_ONLY Term *
RepAppl (Term t)
{
return (Term *) ((~(t)));
@ -226,9 +226,9 @@ RepAppl (Term t)
INLINE_ONLY inline EXTERN Term AbsAppl (Term *);
INLINE_ONLY Term AbsAppl (Term *);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AbsAppl (Term * p)
{
return (Term) ((~Unsigned (p)));
@ -236,9 +236,9 @@ AbsAppl (Term * p)
INLINE_ONLY inline EXTERN Int IsApplTerm (Term);
INLINE_ONLY Int IsApplTerm (Term);
INLINE_ONLY inline EXTERN Int
INLINE_ONLY Int
IsApplTerm (Term t)
{
return (Int) (((t) & ApplBit));
@ -247,9 +247,9 @@ IsApplTerm (Term t)
#endif
INLINE_ONLY inline EXTERN Int IsAtomOrIntTerm (Term);
INLINE_ONLY Int IsAtomOrIntTerm (Term);
INLINE_ONLY inline EXTERN Int
INLINE_ONLY Int
IsAtomOrIntTerm (Term t)
{
return (Int) (((Unsigned (t) & LowTagBits) == 0x2));
@ -258,9 +258,9 @@ IsAtomOrIntTerm (Term t)
INLINE_ONLY inline EXTERN Int IntOfTerm (Term);
INLINE_ONLY Int IntOfTerm (Term);
INLINE_ONLY inline EXTERN Int
INLINE_ONLY Int
IntOfTerm (Term t)
{
return (Int) ((Int) (Unsigned (t) << 3) >> 5);
@ -270,9 +270,9 @@ IntOfTerm (Term t)
#if UNIQUE_TAG_FOR_PAIRS
INLINE_ONLY inline EXTERN Term AdjustPtr (Term t, Term off);
INLINE_ONLY Term AdjustPtr (Term t, Term off);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AdjustPtr (Term t, Term off)
{
return (Term) (((IsVarTerm (t)
@ -284,9 +284,9 @@ AdjustPtr (Term t, Term off)
INLINE_ONLY inline EXTERN Term AdjustIDBPtr (Term t, Term off);
INLINE_ONLY Term AdjustIDBPtr (Term t, Term off);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AdjustIDBPtr (Term t, Term off)
{
return (Term) (IsVarTerm (t) ? (t) + (off) : (t) - (off));
@ -295,9 +295,9 @@ AdjustIDBPtr (Term t, Term off)
#else
INLINE_ONLY inline EXTERN Term AdjustPtr (Term t, Term off);
INLINE_ONLY Term AdjustPtr (Term t, Term off);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AdjustPtr (Term t, Term off)
{
return (Term) (((IsVarTerm (t)
@ -309,9 +309,9 @@ AdjustPtr (Term t, Term off)
INLINE_ONLY inline EXTERN Term AdjustIDBPtr (Term t, Term off);
INLINE_ONLY Term AdjustIDBPtr (Term t, Term off);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AdjustIDBPtr (Term t, Term off)
{
return (Term) (IsVarTerm (t) ? (t) +

View File

@ -71,9 +71,9 @@ property list
#define CHKTAG(t,Tag) ((Unsigned(t)&TagBits)==Tag)
#include "inline-only.h"
INLINE_ONLY inline EXTERN int IsVarTerm (Term);
INLINE_ONLY int IsVarTerm (Term);
INLINE_ONLY inline EXTERN int
INLINE_ONLY int
IsVarTerm (Term t)
{
return (int) (Signed (t) >= 0);
@ -81,9 +81,9 @@ IsVarTerm (Term t)
INLINE_ONLY inline EXTERN int IsNonVarTerm (Term);
INLINE_ONLY int IsNonVarTerm (Term);
INLINE_ONLY inline EXTERN int
INLINE_ONLY int
IsNonVarTerm (Term t)
{
return (int) (Signed (t) < 0);
@ -91,9 +91,9 @@ IsNonVarTerm (Term t)
INLINE_ONLY inline EXTERN Term *RepPair (Term);
INLINE_ONLY Term *RepPair (Term);
INLINE_ONLY inline EXTERN Term *
INLINE_ONLY Term *
RepPair (Term t)
{
return (Term *) (NonTagPart (t));
@ -101,9 +101,9 @@ RepPair (Term t)
INLINE_ONLY inline EXTERN Term AbsPair (Term *);
INLINE_ONLY Term AbsPair (Term *);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AbsPair (Term * p)
{
return (Term) (TAGGEDA (PairTag, (p)));
@ -111,9 +111,9 @@ AbsPair (Term * p)
INLINE_ONLY inline EXTERN Int IsPairTerm (Term);
INLINE_ONLY Int IsPairTerm (Term);
INLINE_ONLY inline EXTERN Int
INLINE_ONLY Int
IsPairTerm (Term t)
{
return (Int) (BitOn (PairBit, (t)));
@ -121,9 +121,9 @@ IsPairTerm (Term t)
INLINE_ONLY inline EXTERN Term *RepAppl (Term);
INLINE_ONLY Term *RepAppl (Term);
INLINE_ONLY inline EXTERN Term *
INLINE_ONLY Term *
RepAppl (Term t)
{
return (Term *) (NonTagPart (t));
@ -131,9 +131,9 @@ RepAppl (Term t)
INLINE_ONLY inline EXTERN Term AbsAppl (Term *);
INLINE_ONLY Term AbsAppl (Term *);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AbsAppl (Term * p)
{
return (Term) (TAGGEDA (ApplTag, (p)));
@ -141,9 +141,9 @@ AbsAppl (Term * p)
INLINE_ONLY inline EXTERN Int IsApplTerm (Term);
INLINE_ONLY Int IsApplTerm (Term);
INLINE_ONLY inline EXTERN Int
INLINE_ONLY Int
IsApplTerm (Term t)
{
return (Int) (BitOn (ApplBit, (t)));
@ -151,9 +151,9 @@ IsApplTerm (Term t)
INLINE_ONLY inline EXTERN int IsAtomOrIntTerm (Term);
INLINE_ONLY int IsAtomOrIntTerm (Term);
INLINE_ONLY inline EXTERN int
INLINE_ONLY int
IsAtomOrIntTerm (Term t)
{
return (int) (((Unsigned (t) & LowTagBits) == 0));
@ -162,9 +162,9 @@ IsAtomOrIntTerm (Term t)
INLINE_ONLY inline EXTERN Term AdjustPtr (Term t, Term off);
INLINE_ONLY Term AdjustPtr (Term t, Term off);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AdjustPtr (Term t, Term off)
{
return (Term) ((t) + off);
@ -172,9 +172,9 @@ AdjustPtr (Term t, Term off)
INLINE_ONLY inline EXTERN Term AdjustIDBPtr (Term t, Term off);
INLINE_ONLY Term AdjustIDBPtr (Term t, Term off);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AdjustIDBPtr (Term t, Term off)
{
return (Term) ((t) + off);
@ -183,9 +183,9 @@ AdjustIDBPtr (Term t, Term off)
INLINE_ONLY inline EXTERN Int IntOfTerm (Term);
INLINE_ONLY Int IntOfTerm (Term);
INLINE_ONLY inline EXTERN Int
INLINE_ONLY Int
IntOfTerm (Term t)
{
return (Int) (((Int) (t << 3)) >> (3 + 2));

View File

@ -69,9 +69,9 @@ property list
#define CHKTAG(t,Tag) ((Unsigned(t)&TagBits)==Tag)
#include "inline-only.h"
INLINE_ONLY inline EXTERN int IsVarTerm (Term);
INLINE_ONLY int IsVarTerm (Term);
INLINE_ONLY inline EXTERN int
INLINE_ONLY int
IsVarTerm (Term t)
{
return (int) ((!((t) & 0x1)));
@ -79,9 +79,9 @@ IsVarTerm (Term t)
INLINE_ONLY inline EXTERN int IsNonVarTerm (Term);
INLINE_ONLY int IsNonVarTerm (Term);
INLINE_ONLY inline EXTERN int
INLINE_ONLY int
IsNonVarTerm (Term t)
{
return (int) (((t) & 0x1));
@ -89,9 +89,9 @@ IsNonVarTerm (Term t)
INLINE_ONLY inline EXTERN Term *RepPair (Term);
INLINE_ONLY Term *RepPair (Term);
INLINE_ONLY inline EXTERN Term *
INLINE_ONLY Term *
RepPair (Term t)
{
return (Term *) (((t) - PairBits));
@ -99,9 +99,9 @@ RepPair (Term t)
INLINE_ONLY inline EXTERN Term AbsPair (Term *);
INLINE_ONLY Term AbsPair (Term *);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AbsPair (Term * p)
{
return (Term) (((CELL) (p) + PairBits));
@ -109,9 +109,9 @@ AbsPair (Term * p)
INLINE_ONLY inline EXTERN Int IsPairTerm (Term);
INLINE_ONLY Int IsPairTerm (Term);
INLINE_ONLY inline EXTERN Int
INLINE_ONLY Int
IsPairTerm (Term t)
{
return (Int) (((t) & 0x2));
@ -119,9 +119,9 @@ IsPairTerm (Term t)
INLINE_ONLY inline EXTERN Term *RepAppl (Term);
INLINE_ONLY Term *RepAppl (Term);
INLINE_ONLY inline EXTERN Term *
INLINE_ONLY Term *
RepAppl (Term t)
{
return (Term *) (((t) - ApplBits));
@ -129,9 +129,9 @@ RepAppl (Term t)
INLINE_ONLY inline EXTERN Term AbsAppl (Term *);
INLINE_ONLY Term AbsAppl (Term *);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AbsAppl (Term * p)
{
return (Term) (((CELL) (p) + ApplBits));
@ -139,9 +139,9 @@ AbsAppl (Term * p)
INLINE_ONLY inline EXTERN Int IsApplTerm (Term);
INLINE_ONLY Int IsApplTerm (Term);
INLINE_ONLY inline EXTERN Int
INLINE_ONLY Int
IsApplTerm (Term t)
{
return (Int) ((((t) & 0x4)));
@ -149,9 +149,9 @@ IsApplTerm (Term t)
INLINE_ONLY inline EXTERN Int IsAtomOrIntTerm (Term);
INLINE_ONLY Int IsAtomOrIntTerm (Term);
INLINE_ONLY inline EXTERN Int
INLINE_ONLY Int
IsAtomOrIntTerm (Term t)
{
return (Int) ((((t) & LowTagBits) == 0x1));
@ -160,9 +160,9 @@ IsAtomOrIntTerm (Term t)
INLINE_ONLY inline EXTERN Term AdjustPtr (Term t, Term off);
INLINE_ONLY Term AdjustPtr (Term t, Term off);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AdjustPtr (Term t, Term off)
{
return (Term) (((t) + off));
@ -170,9 +170,9 @@ AdjustPtr (Term t, Term off)
INLINE_ONLY inline EXTERN Term AdjustIDBPtr (Term t, Term off);
INLINE_ONLY Term AdjustIDBPtr (Term t, Term off);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
AdjustIDBPtr (Term t, Term off)
{
return (Term) ((t) + off);
@ -181,9 +181,9 @@ AdjustIDBPtr (Term t, Term off)
INLINE_ONLY inline EXTERN Int IntOfTerm (Term);
INLINE_ONLY Int IntOfTerm (Term);
INLINE_ONLY inline EXTERN Int
INLINE_ONLY Int
IntOfTerm (Term t)
{
return (Int) ((Int) (Unsigned (t) << 3) >> 6);

View File

@ -71,9 +71,9 @@ typedef enum {
#define IsAttVar(pt) __IsAttVar((pt)PASS_REGS)
INLINE_ONLY inline EXTERN int __IsAttVar(CELL *pt USES_REGS);
INLINE_ONLY int __IsAttVar(CELL *pt USES_REGS);
INLINE_ONLY inline EXTERN int __IsAttVar(CELL *pt USES_REGS) {
INLINE_ONLY int __IsAttVar(CELL *pt USES_REGS) {
#ifdef YAP_H
return (pt)[-1] == (CELL)attvar_e && pt < HR;
#else
@ -81,9 +81,9 @@ INLINE_ONLY inline EXTERN int __IsAttVar(CELL *pt USES_REGS) {
#endif
}
INLINE_ONLY inline EXTERN int GlobalIsAttVar(CELL *pt);
INLINE_ONLY int GlobalIsAttVar(CELL *pt);
INLINE_ONLY inline EXTERN int GlobalIsAttVar(CELL *pt) {
INLINE_ONLY int GlobalIsAttVar(CELL *pt) {
return (pt)[-1] == (CELL)attvar_e;
}
@ -101,9 +101,9 @@ typedef enum {
USER_BLOB_END = 0x0200 /* end of user defined blob */
} big_blob_type;
INLINE_ONLY inline EXTERN blob_type BlobOfFunctor(Functor f);
INLINE_ONLY blob_type BlobOfFunctor(Functor f);
INLINE_ONLY inline EXTERN blob_type BlobOfFunctor(Functor f) {
INLINE_ONLY blob_type BlobOfFunctor(Functor f) {
return (blob_type)((CELL)f);
}
@ -161,28 +161,28 @@ typedef struct special_functors_struct {
} special_functors;
#endif /* YAP_H */
INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr);
INLINE_ONLY Float CpFloatUnaligned(CELL *ptr);
#define MkFloatTerm(fl) __MkFloatTerm((fl)PASS_REGS)
INLINE_ONLY inline EXTERN Term __MkFloatTerm(Float USES_REGS);
INLINE_ONLY Term __MkFloatTerm(Float USES_REGS);
INLINE_ONLY inline EXTERN Float FloatOfTerm(Term t);
INLINE_ONLY Float FloatOfTerm(Term t);
#if SIZEOF_DOUBLE == SIZEOF_INT_P
INLINE_ONLY inline EXTERN Term __MkFloatTerm(Float dbl USES_REGS) {
INLINE_ONLY Term __MkFloatTerm(Float dbl USES_REGS) {
return (Term)((HR[0] = (CELL)FunctorDouble, *(Float *)(HR + 1) = dbl,
HR[2] = EndSpecials, HR += 3, AbsAppl(HR - 3)));
}
INLINE_ONLY inline EXTERN Float FloatOfTerm(Term t) {
INLINE_ONLY Float FloatOfTerm(Term t) {
return (Float)(*(Float *)(RepAppl(t) + 1));
}
#define InitUnalignedFloat()
INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr) {
INLINE_ONLY Float CpFloatUnaligned(CELL *ptr) {
return *((Float *)ptr);
}
@ -192,9 +192,9 @@ INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr) {
#define DOUBLE_ALIGNED(ADDR) ((CELL)(ADDR)&0x4)
INLINE_ONLY EXTERN inline void AlignGlobalForDouble(USES_REGS1);
INLINE_ONLY void AlignGlobalForDouble(USES_REGS1);
INLINE_ONLY EXTERN inline void AlignGlobalForDouble(USES_REGS1) {
INLINE_ONLY void AlignGlobalForDouble(USES_REGS1) {
/* Force Alignment for floats. Note that garbage collector may
break the alignment; */
if (!DOUBLE_ALIGNED(HR)) {
@ -204,13 +204,13 @@ INLINE_ONLY EXTERN inline void AlignGlobalForDouble(USES_REGS1) {
}
#ifdef i386
INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr) {
INLINE_ONLY Float CpFloatUnaligned(CELL *ptr) {
return *((Float *)(ptr + 1));
}
#else
/* first, need to address the alignment problem */
INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr) {
INLINE_ONLY Float CpFloatUnaligned(CELL *ptr) {
union {
Float f;
CELL d[2];
@ -222,13 +222,13 @@ INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr) {
#endif
INLINE_ONLY inline EXTERN Term __MkFloatTerm(Float dbl USES_REGS) {
INLINE_ONLY Term __MkFloatTerm(Float dbl USES_REGS) {
return (Term)((AlignGlobalForDouble(PASS_REGS1), HR[0] = (CELL)FunctorDouble,
*(Float *)(HR + 1) = dbl, HR[3] = EndSpecials, HR += 4,
AbsAppl(HR - 4)));
}
INLINE_ONLY inline EXTERN Float FloatOfTerm(Term t) {
INLINE_ONLY Float FloatOfTerm(Term t) {
return (Float)((DOUBLE_ALIGNED(RepAppl(t)) ? *(Float *)(RepAppl(t) + 1)
: CpFloatUnaligned(RepAppl(t))));
}
@ -247,9 +247,9 @@ OOPS
#include <stddef.h>
#endif
INLINE_ONLY inline EXTERN bool IsFloatTerm(Term);
INLINE_ONLY bool IsFloatTerm(Term);
INLINE_ONLY inline EXTERN bool IsFloatTerm(Term t) {
INLINE_ONLY bool IsFloatTerm(Term t) {
return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorDouble);
}
@ -257,9 +257,9 @@ INLINE_ONLY inline EXTERN bool IsFloatTerm(Term t) {
#define MkLongIntTerm(i) __MkLongIntTerm((i)PASS_REGS)
INLINE_ONLY inline EXTERN Term __MkLongIntTerm(Int USES_REGS);
INLINE_ONLY Term __MkLongIntTerm(Int USES_REGS);
INLINE_ONLY inline EXTERN Term __MkLongIntTerm(Int i USES_REGS) {
INLINE_ONLY Term __MkLongIntTerm(Int i USES_REGS) {
HR[0] = (CELL)FunctorLongInt;
HR[1] = (CELL)(i);
HR[2] = EndSpecials;
@ -267,15 +267,15 @@ INLINE_ONLY inline EXTERN Term __MkLongIntTerm(Int i USES_REGS) {
return AbsAppl(HR - 3);
}
INLINE_ONLY inline EXTERN Int LongIntOfTerm(Term t);
INLINE_ONLY Int LongIntOfTerm(Term t);
INLINE_ONLY inline EXTERN Int LongIntOfTerm(Term t) {
INLINE_ONLY Int LongIntOfTerm(Term t) {
return (Int)(RepAppl(t)[1]);
}
INLINE_ONLY inline EXTERN bool IsLongIntTerm(Term);
INLINE_ONLY bool IsLongIntTerm(Term);
INLINE_ONLY inline EXTERN bool IsLongIntTerm(Term t) {
INLINE_ONLY bool IsLongIntTerm(Term t) {
return IsApplTerm(t) &&
FunctorOfTerm(t) == FunctorLongInt;
}
@ -290,9 +290,9 @@ INLINE_ONLY inline EXTERN bool IsLongIntTerm(Term t) {
#define MkStringTerm(i) __MkStringTerm((i)PASS_REGS)
INLINE_ONLY inline EXTERN Term __MkStringTerm(const char *s USES_REGS);
INLINE_ONLY Term __MkStringTerm(const char *s USES_REGS);
INLINE_ONLY inline EXTERN Term __MkStringTerm(const char *s USES_REGS) {
INLINE_ONLY Term __MkStringTerm(const char *s USES_REGS) {
Term t = AbsAppl(HR);
size_t sz = ALIGN_BY_TYPE(strlen((char *)s) + 1, CELL);
HR[0] = (CELL)FunctorString;
@ -305,10 +305,10 @@ INLINE_ONLY inline EXTERN Term __MkStringTerm(const char *s USES_REGS) {
#define MkUStringTerm(i) __MkUStringTerm((i)PASS_REGS)
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
__MkUStringTerm(const unsigned char *s USES_REGS);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
__MkUStringTerm(const unsigned char *s USES_REGS) {
Term t = AbsAppl(HR);
size_t sz = ALIGN_BY_TYPE(strlen((char *)s) + 1, CELL);
@ -320,21 +320,21 @@ __MkUStringTerm(const unsigned char *s USES_REGS) {
return t;
}
INLINE_ONLY inline EXTERN const unsigned char *UStringOfTerm(Term t);
INLINE_ONLY const unsigned char *UStringOfTerm(Term t);
INLINE_ONLY inline EXTERN const unsigned char *UStringOfTerm(Term t) {
INLINE_ONLY const unsigned char *UStringOfTerm(Term t) {
return (const unsigned char *)(RepAppl(t) + 2);
}
INLINE_ONLY inline EXTERN const char *StringOfTerm(Term t);
INLINE_ONLY const char *StringOfTerm(Term t);
INLINE_ONLY inline EXTERN const char *StringOfTerm(Term t) {
INLINE_ONLY const char *StringOfTerm(Term t) {
return (const char *)(RepAppl(t) + 2);
}
INLINE_ONLY inline EXTERN bool IsStringTerm(Term);
INLINE_ONLY bool IsStringTerm(Term);
INLINE_ONLY inline EXTERN bool IsStringTerm(Term t) {
INLINE_ONLY bool IsStringTerm(Term t) {
return IsApplTerm(t) &&
FunctorOfTerm(t) == FunctorString;
}
@ -365,9 +365,9 @@ typedef struct {
#endif
INLINE_ONLY inline EXTERN bool IsBigIntTerm(Term);
INLINE_ONLY bool IsBigIntTerm(Term);
INLINE_ONLY inline EXTERN bool IsBigIntTerm(Term t) {
INLINE_ONLY bool IsBigIntTerm(Term t) {
return IsApplTerm(t) &&
FunctorOfTerm(t) == FunctorBigInt;
}
@ -380,25 +380,25 @@ MP_INT *Yap_BigIntOfTerm(Term);
Term Yap_MkBigRatTerm(MP_RAT *);
MP_RAT *Yap_BigRatOfTerm(Term);
INLINE_ONLY inline EXTERN void MPZ_SET(mpz_t, MP_INT *);
INLINE_ONLY void MPZ_SET(mpz_t, MP_INT *);
INLINE_ONLY inline EXTERN void MPZ_SET(mpz_t dest, MP_INT *src) {
INLINE_ONLY void MPZ_SET(mpz_t dest, MP_INT *src) {
dest->_mp_size = src->_mp_size;
dest->_mp_alloc = src->_mp_alloc;
dest->_mp_d = src->_mp_d;
}
INLINE_ONLY inline EXTERN bool IsLargeIntTerm(Term);
INLINE_ONLY bool IsLargeIntTerm(Term);
INLINE_ONLY inline EXTERN bool IsLargeIntTerm(Term t) {
INLINE_ONLY bool IsLargeIntTerm(Term t) {
return IsApplTerm(t) &&
((FunctorOfTerm(t) <= FunctorBigInt) &&
(FunctorOfTerm(t) >= FunctorLongInt));
}
INLINE_ONLY inline EXTERN UInt Yap_SizeOfBigInt(Term);
INLINE_ONLY UInt Yap_SizeOfBigInt(Term);
INLINE_ONLY inline EXTERN UInt Yap_SizeOfBigInt(Term t) {
INLINE_ONLY UInt Yap_SizeOfBigInt(Term t) {
CELL *pt = RepAppl(t) + 1;
return 2 +
(sizeof(MP_INT) + (((MP_INT *)pt)->_mp_alloc * sizeof(mp_limb_t))) /
@ -407,9 +407,9 @@ INLINE_ONLY inline EXTERN UInt Yap_SizeOfBigInt(Term t) {
#else
INLINE_ONLY inline EXTERN int IsLargeIntTerm(Term);
INLINE_ONLY int IsLargeIntTerm(Term);
INLINE_ONLY inline EXTERN int IsLargeIntTerm(Term t) {
INLINE_ONLY int IsLargeIntTerm(Term t) {
return (int)(IsApplTerm(t) && FunctorOfTerm(t) == FunctorLongInt);
}
@ -417,59 +417,59 @@ INLINE_ONLY inline EXTERN int IsLargeIntTerm(Term t) {
/* extern Functor FunctorLongInt; */
INLINE_ONLY inline EXTERN bool IsLargeNumTerm(Term);
INLINE_ONLY bool IsLargeNumTerm(Term);
INLINE_ONLY inline EXTERN bool IsLargeNumTerm(Term t) {
INLINE_ONLY bool IsLargeNumTerm(Term t) {
return IsApplTerm(t) &&
((FunctorOfTerm(t) <= FunctorBigInt) &&
(FunctorOfTerm(t) >= FunctorDouble));
}
INLINE_ONLY inline EXTERN bool IsExternalBlobTerm(Term, CELL);
INLINE_ONLY bool IsExternalBlobTerm(Term, CELL);
INLINE_ONLY inline EXTERN bool IsExternalBlobTerm(Term t, CELL tag) {
INLINE_ONLY bool IsExternalBlobTerm(Term t, CELL tag) {
return IsApplTerm(t) &&
FunctorOfTerm(t) == FunctorBigInt &&
RepAppl(t)[1] == tag;
}
INLINE_ONLY inline EXTERN void *ExternalBlobFromTerm(Term);
INLINE_ONLY void *ExternalBlobFromTerm(Term);
INLINE_ONLY inline EXTERN void *ExternalBlobFromTerm(Term t) {
INLINE_ONLY void *ExternalBlobFromTerm(Term t) {
MP_INT *base = (MP_INT *)(RepAppl(t) + 2);
return (void *)(base + 1);
}
INLINE_ONLY inline EXTERN bool IsNumTerm(Term);
INLINE_ONLY bool IsNumTerm(Term);
INLINE_ONLY inline EXTERN bool IsNumTerm(Term t) {
INLINE_ONLY bool IsNumTerm(Term t) {
return (IsIntTerm(t) || IsLargeNumTerm(t));
}
INLINE_ONLY inline EXTERN bool IsAtomicTerm(Term);
INLINE_ONLY bool IsAtomicTerm(Term);
INLINE_ONLY inline EXTERN bool IsAtomicTerm(Term t) {
INLINE_ONLY bool IsAtomicTerm(Term t) {
return IsAtomOrIntTerm(t) ||
IsLargeNumTerm(t) ||
IsStringTerm(t);
}
INLINE_ONLY inline EXTERN bool IsExtensionFunctor(Functor);
INLINE_ONLY bool IsExtensionFunctor(Functor);
INLINE_ONLY inline EXTERN bool IsExtensionFunctor(Functor f) {
INLINE_ONLY bool IsExtensionFunctor(Functor f) {
return f <= FunctorString;
}
INLINE_ONLY inline EXTERN bool IsBlobFunctor(Functor);
INLINE_ONLY bool IsBlobFunctor(Functor);
INLINE_ONLY inline EXTERN bool IsBlobFunctor(Functor f) {
INLINE_ONLY bool IsBlobFunctor(Functor f) {
return (f <= FunctorString &&
f >= FunctorDBRef);
}
INLINE_ONLY inline EXTERN bool IsPrimitiveTerm(Term);
INLINE_ONLY bool IsPrimitiveTerm(Term);
INLINE_ONLY inline EXTERN bool IsPrimitiveTerm(Term t) {
INLINE_ONLY bool IsPrimitiveTerm(Term t) {
return (IsAtomOrIntTerm(t) ||
(IsApplTerm(t) &&
IsBlobFunctor(FunctorOfTerm(t))));
@ -477,61 +477,61 @@ INLINE_ONLY inline EXTERN bool IsPrimitiveTerm(Term t) {
#ifdef TERM_EXTENSIONS
INLINE_ONLY inline EXTERN bool IsAttachFunc(Functor);
INLINE_ONLY bool IsAttachFunc(Functor);
INLINE_ONLY inline EXTERN bool IsAttachFunc(Functor f) { return (Int)(FALSE); }
INLINE_ONLY bool IsAttachFunc(Functor f) { return (Int)(FALSE); }
#define IsAttachedTerm(t) __IsAttachedTerm(t PASS_REGS)
INLINE_ONLY inline EXTERN bool __IsAttachedTerm(Term USES_REGS);
INLINE_ONLY bool __IsAttachedTerm(Term USES_REGS);
INLINE_ONLY inline EXTERN bool __IsAttachedTerm(Term t USES_REGS) {
INLINE_ONLY bool __IsAttachedTerm(Term t USES_REGS) {
return (IsVarTerm(t) &&
IsAttVar(VarOfTerm(t)));
}
INLINE_ONLY inline EXTERN bool GlobalIsAttachedTerm(Term);
INLINE_ONLY bool GlobalIsAttachedTerm(Term);
INLINE_ONLY inline EXTERN bool GlobalIsAttachedTerm(Term t) {
INLINE_ONLY bool GlobalIsAttachedTerm(Term t) {
return (IsVarTerm(t) &&
GlobalIsAttVar(VarOfTerm(t)));
}
#define SafeIsAttachedTerm(t) __SafeIsAttachedTerm((t)PASS_REGS)
INLINE_ONLY inline EXTERN bool __SafeIsAttachedTerm(Term USES_REGS);
INLINE_ONLY bool __SafeIsAttachedTerm(Term USES_REGS);
INLINE_ONLY inline EXTERN bool __SafeIsAttachedTerm(Term t USES_REGS) {
INLINE_ONLY bool __SafeIsAttachedTerm(Term t USES_REGS) {
return IsVarTerm(t) && IsAttVar(VarOfTerm(t));
}
INLINE_ONLY inline EXTERN exts ExtFromCell(CELL *);
INLINE_ONLY exts ExtFromCell(CELL *);
INLINE_ONLY inline EXTERN exts ExtFromCell(CELL *pt) { return attvars_ext; }
INLINE_ONLY exts ExtFromCell(CELL *pt) { return attvars_ext; }
#else
INLINE_ONLY inline EXTERN Int IsAttachFunc(Functor);
INLINE_ONLY Int IsAttachFunc(Functor);
INLINE_ONLY inline EXTERN Int IsAttachFunc(Functor f) { return (Int)(FALSE); }
INLINE_ONLY Int IsAttachFunc(Functor f) { return (Int)(FALSE); }
INLINE_ONLY inline EXTERN Int IsAttachedTerm(Term);
INLINE_ONLY Int IsAttachedTerm(Term);
INLINE_ONLY inline EXTERN Int IsAttachedTerm(Term t) { return (Int)(FALSE); }
INLINE_ONLY Int IsAttachedTerm(Term t) { return (Int)(FALSE); }
#endif
INLINE_ONLY inline EXTERN Int Yap_BlobTag(Term t);
INLINE_ONLY Int Yap_BlobTag(Term t);
INLINE_ONLY inline EXTERN Int Yap_BlobTag(Term t) {
INLINE_ONLY Int Yap_BlobTag(Term t) {
CELL *pt = RepAppl(t);
return pt[1];
}
INLINE_ONLY inline EXTERN void *Yap_BlobInfo(Term t);
INLINE_ONLY void *Yap_BlobInfo(Term t);
INLINE_ONLY inline EXTERN void *Yap_BlobInfo(Term t) {
INLINE_ONLY void *Yap_BlobInfo(Term t) {
MP_INT *blobp;
CELL *pt = RepAppl(t);
@ -541,13 +541,13 @@ INLINE_ONLY inline EXTERN void *Yap_BlobInfo(Term t) {
#ifdef YAP_H
INLINE_ONLY inline EXTERN bool unify_extension(Functor, CELL, CELL *, CELL);
INLINE_ONLY bool unify_extension(Functor, CELL, CELL *, CELL);
EXTERN bool unify_extension(Functor, CELL, CELL *, CELL);
int Yap_gmp_tcmp_big_big(Term, Term);
INLINE_ONLY inline EXTERN bool unify_extension(Functor f, CELL d0, CELL *pt0,
INLINE_ONLY bool unify_extension(Functor f, CELL d0, CELL *pt0,
CELL d1) {
switch (BlobOfFunctor(f)) {
case db_ref_e:

View File

@ -188,9 +188,9 @@ extern const char *Yap_BINDIR, *Yap_ROOTDIR, *Yap_SHAREDIR, *Yap_LIBDIR, *Yap_DL
#endif
#if !defined(HAVE_STRNLEN)
INLINE_ONLY inline EXTERN size_t strnlen(const char *s, size_t maxlen);
INLINE_ONLY size_t strnlen(const char *s, size_t maxlen);
INLINE_ONLY inline EXTERN size_t strnlen(const char *s, size_t maxlen) {
INLINE_ONLY size_t strnlen(const char *s, size_t maxlen) {
size_t i = 0;
while (s[i]) {
if (i == maxlen)

View File

@ -25,9 +25,9 @@
EXTERN bool Yap_unify(Term a, Term b);
INLINE_ONLY EXTERN inline Term Deref(Term a);
INLINE_ONLY Term Deref(Term a);
INLINE_ONLY EXTERN inline Term Deref(Term a) {
INLINE_ONLY Term Deref(Term a) {
while (IsVarTerm(a)) {
Term *b = (Term *)a;
a = *b;
@ -37,11 +37,11 @@ INLINE_ONLY EXTERN inline Term Deref(Term a) {
return (a);
}
INLINE_ONLY EXTERN inline CELL *GetTermAdress(Term a);
INLINE_ONLY CELL *GetTermAdress(Term a);
INLINE_ONLY EXTERN inline Term Derefa(CELL *b);
INLINE_ONLY Term Derefa(CELL *b);
INLINE_ONLY EXTERN inline Term Derefa(CELL *b) {
INLINE_ONLY Term Derefa(CELL *b) {
Term a = *b;
restart:
if (!IsVarTerm(a)) {
@ -55,41 +55,41 @@ restart:
}
}
INLINE_ONLY inline EXTERN Term ArgOfTerm(int i, Term t);
INLINE_ONLY Term ArgOfTerm(int i, Term t);
INLINE_ONLY inline EXTERN Term ArgOfTerm(int i, Term t)
INLINE_ONLY Term ArgOfTerm(int i, Term t)
{
return (Term)(Derefa(RepAppl(t) + (i)));
}
INLINE_ONLY inline EXTERN Term HeadOfTerm(Term);
INLINE_ONLY Term HeadOfTerm(Term);
INLINE_ONLY inline EXTERN Term HeadOfTerm(Term t) {
INLINE_ONLY Term HeadOfTerm(Term t) {
return (Term)(Derefa(RepPair(t)));
}
INLINE_ONLY inline EXTERN Term TailOfTerm(Term);
INLINE_ONLY Term TailOfTerm(Term);
INLINE_ONLY inline EXTERN Term TailOfTerm(Term t) {
INLINE_ONLY Term TailOfTerm(Term t) {
return (Term)(Derefa(RepPair(t) + 1));
}
INLINE_ONLY inline EXTERN Term ArgOfTermCell(int i, Term t);
INLINE_ONLY Term ArgOfTermCell(int i, Term t);
INLINE_ONLY inline EXTERN Term ArgOfTermCell(int i, Term t) {
INLINE_ONLY Term ArgOfTermCell(int i, Term t) {
return (Term)((CELL)(RepAppl(t) + (i)));
}
INLINE_ONLY inline EXTERN Term HeadOfTermCell(Term);
INLINE_ONLY Term HeadOfTermCell(Term);
INLINE_ONLY inline EXTERN Term HeadOfTermCell(Term t) {
INLINE_ONLY Term HeadOfTermCell(Term t) {
return (Term)((CELL)(RepPair(t)));
}
INLINE_ONLY inline EXTERN Term TailOfTermCell(Term);
INLINE_ONLY Term TailOfTermCell(Term);
INLINE_ONLY inline EXTERN Term TailOfTermCell(Term t) {
INLINE_ONLY Term TailOfTermCell(Term t) {
return (Term)((CELL)(RepPair(t) + 1));
}

View File

@ -462,9 +462,9 @@ static inline bool Yap_CheckArithError(void)
}
INLINE_ONLY inline EXTERN Term Yap_Eval__(Term t USES_REGS);
INLINE_ONLY Term Yap_Eval__(Term t USES_REGS);
INLINE_ONLY inline EXTERN Term Yap_Eval__(Term t USES_REGS) {
INLINE_ONLY Term Yap_Eval__(Term t USES_REGS) {
if (t == 0L || (!IsVarTerm(t) && IsNumTerm(t)))
return t;
return Yap_InnerEval(t);
@ -616,9 +616,9 @@ void Yap_gmp_set_bit(Int i, Term t);
#define Yap_Mk64IntegerTerm(i) __Yap_Mk64IntegerTerm((i)PASS_REGS)
INLINE_ONLY inline EXTERN Term __Yap_Mk64IntegerTerm(YAP_LONG_LONG USES_REGS);
INLINE_ONLY Term __Yap_Mk64IntegerTerm(YAP_LONG_LONG USES_REGS);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
__Yap_Mk64IntegerTerm(YAP_LONG_LONG i USES_REGS) {
if (i <= Int_MAX && i >= Int_MIN) {
return MkIntegerTerm((Int)i);

View File

@ -25,7 +25,7 @@
#ifndef YAP_FLAGS_H
#define YAP_FLAGS_H 1
// INLINE_ONLY inline EXTERN bool nat( Term inp );
// INLINE_ONLY bool nat( Term inp );
#define SYSTEM_OPTION_0 "attributed_variables,rational_trees]"
#if THREADS
@ -103,7 +103,7 @@ static inline Term ro(Term inp) {
return TermZERO;
}
INLINE_ONLY inline EXTERN Term aro(Term inp) {
INLINE_ONLY Term aro(Term inp) {
if (IsVarTerm(inp)) {
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag %s",
"value must be bound");
@ -116,7 +116,7 @@ INLINE_ONLY inline EXTERN Term aro(Term inp) {
return TermZERO;
}
// INLINE_ONLY inline EXTERN Term booleanFlag( Term inp );
// INLINE_ONLY Term booleanFlag( Term inp );
static inline Term booleanFlag(Term inp) {
if (inp == TermTrue || inp == TermOn)
@ -164,7 +164,7 @@ static inline Term list_filler(Term inp) {
return TermZERO;
}
// INLINE_ONLY inline EXTERN Term isatom( Term inp );
// INLINE_ONLY Term isatom( Term inp );
static inline Term isatom(Term inp) {
if (IsVarTerm(inp)) {
@ -186,7 +186,7 @@ static inline const char *
return Yap_ROOTDIR;
}
// INLINE_ONLY inline EXTERN Term ok( Term inp );
// INLINE_ONLY Term ok( Term inp );
static inline Term ok(Term inp) { return inp; }

View File

@ -16,7 +16,7 @@
#ifndef YAP_HANDLES_H
#define YAP_HANDLES_H 1
#include "Regs.h"
#include "inline-only.h"
#include "Yatom.h"
#define LOCAL_CurHandle LOCAL_CurSlot
@ -71,7 +71,7 @@ functions are then exported through corresponding FLI C-functions
#define Yap_RebootHandles(wid) Yap_RebootHandles__(wid PASS_REGS)
#define Yap_RebootSlots(wid) Yap_RebootHandles__(wid PASS_REGS)
static inline void Yap_RebootHandles__(int wid USES_REGS) {
INLINE_ONLY void Yap_RebootHandles__(int wid USES_REGS) {
// fprintf(stderr, " StartHandles = %ld", LOCAL_CurHandle);
REMOTE_CurHandle(wid) = 1;
}
@ -85,8 +85,8 @@ static inline void Yap_RebootHandles__(int wid USES_REGS) {
#define Yap_StartHandles() Yap_StartHandles__(PASS_REGS1)
#define Yap_StartSlots() Yap_StartHandles__(PASS_REGS1)
INLINE_ONLY inline EXTERN yhandle_t Yap_StartHandles__(USES_REGS1);
INLINE_ONLY inline EXTERN yhandle_t Yap_StartHandles__(USES_REGS1) {
INLINE_ONLY yhandle_t Yap_StartHandles__(USES_REGS1);
INLINE_ONLY yhandle_t Yap_StartHandles__(USES_REGS1) {
// // fprintf(stderr, " StartHandles = %ld", LOCAL_CurHandle);
// fprintf(stderr,"SS %s:%d\n", __FILE__, __LINE__);;
if (LOCAL_CurHandle < 0) {
@ -105,8 +105,8 @@ INLINE_ONLY inline EXTERN yhandle_t Yap_StartHandles__(USES_REGS1) {
#define Yap_CloseHandles(slot) Yap_CloseHandles__(slot PASS_REGS)
#define Yap_CloseSlots(slot) Yap_CloseHandles__(slot PASS_REGS)
INLINE_ONLY inline EXTERN void Yap_CloseHandles__(yhandle_t slot USES_REGS);
INLINE_ONLY inline EXTERN void Yap_CloseHandles__(yhandle_t slot USES_REGS) {
INLINE_ONLY void Yap_CloseHandles__(yhandle_t slot USES_REGS);
INLINE_ONLY void Yap_CloseHandles__(yhandle_t slot USES_REGS) {
// fprintf(stderr,"CS %s:%d\n", __FILE__, __LINE__);
LOCAL_CurHandle = slot;
}
@ -116,8 +116,8 @@ INLINE_ONLY inline EXTERN void Yap_CloseHandles__(yhandle_t slot USES_REGS) {
/// @brief report the current position of the slots, assuming that they occupy
/// the top of the stack.
INLINE_ONLY inline EXTERN yhandle_t Yap_CurrentHandle__(USES_REGS1);
INLINE_ONLY inline EXTERN yhandle_t Yap_CurrentHandle__(USES_REGS1) {
INLINE_ONLY yhandle_t Yap_CurrentHandle__(USES_REGS1);
INLINE_ONLY yhandle_t Yap_CurrentHandle__(USES_REGS1) {
return LOCAL_CurHandle;
}
@ -125,8 +125,8 @@ INLINE_ONLY inline EXTERN yhandle_t Yap_CurrentHandle__(USES_REGS1) {
#define Yap_GetFromSlot(slot) Yap_GetFromHandle__(slot PASS_REGS)
/// @brief read from a slot.
INLINE_ONLY inline EXTERN Term Yap_GetFromHandle__(yhandle_t slot USES_REGS);
INLINE_ONLY inline EXTERN Term Yap_GetFromHandle__(yhandle_t slot USES_REGS) {
INLINE_ONLY Term Yap_GetFromHandle__(yhandle_t slot USES_REGS);
INLINE_ONLY Term Yap_GetFromHandle__(yhandle_t slot USES_REGS) {
// fprintf(stderr, "GS %s:%d\n", __FILE__, __LINE__);
return Deref(LOCAL_HandleBase[slot]);
}
@ -136,9 +136,9 @@ INLINE_ONLY inline EXTERN Term Yap_GetFromHandle__(yhandle_t slot USES_REGS) {
#define Yap_GetDerefedFromSlot(slot) Yap_GetDerefedFromHandle__(slot PASS_REGS)
/// @brief read from a slot. but does not try to dereference the slot.
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
Yap_GetDerefedFromHandle__(yhandle_t slot USES_REGS);
INLINE_ONLY inline EXTERN Term
INLINE_ONLY Term
Yap_GetDerefedFromHandle__(yhandle_t slot USES_REGS) {
// fprintf(stderr,"GDS %s:%d\n", __FILE__, __LINE__);
return LOCAL_HandleBase[slot];
@ -148,9 +148,9 @@ Yap_GetDerefedFromHandle__(yhandle_t slot USES_REGS) {
#define Yap_GetPtrFromSlot(slot) Yap_GetPtrFromHandle__(slot PASS_REGS)
/// @brief read the object in a slot. but do not try to dereference the slot.
INLINE_ONLY inline EXTERN Term *
INLINE_ONLY Term *
Yap_GetPtrFromHandle__(yhandle_t slot USES_REGS);
INLINE_ONLY inline EXTERN Term *
INLINE_ONLY Term *
Yap_GetPtrFromHandle__(yhandle_t slot USES_REGS) {
// fprintf(stderr,"GPS %s:%d\n", __FILE__, __LINE__);
return (Term *)LOCAL_HandleBase[slot];
@ -159,9 +159,9 @@ Yap_GetPtrFromHandle__(yhandle_t slot USES_REGS) {
#define Yap_AddressFromHandle(slot) Yap_AddressFromHandle__(slot PASS_REGS)
#define Yap_AddressFromSlot(slot) Yap_AddressFromHandle__(slot PASS_REGS)
INLINE_ONLY inline EXTERN CELL *
INLINE_ONLY CELL *
Yap_AddressFromHandle__(yhandle_t slot USES_REGS);
INLINE_ONLY inline EXTERN CELL *
INLINE_ONLY CELL *
Yap_AddressFromHandle__(yhandle_t slot USES_REGS) {
/// @brief get the memory address of a slot
@ -171,9 +171,9 @@ Yap_AddressFromHandle__(yhandle_t slot USES_REGS) {
#define Yap_PutInSlot(slot, t) Yap_PutInHandle__(slot, t PASS_REGS)
#define Yap_PutInHandle(slot, t) Yap_PutInHandle__(slot, t PASS_REGS)
/// @brief store term in a slot
INLINE_ONLY inline EXTERN void Yap_PutInHandle__(yhandle_t slot,
INLINE_ONLY void Yap_PutInHandle__(yhandle_t slot,
Term t USES_REGS);
INLINE_ONLY inline EXTERN void Yap_PutInHandle__(yhandle_t slot,
INLINE_ONLY void Yap_PutInHandle__(yhandle_t slot,
Term t USES_REGS) {
// fprintf(stderr,"PS %s:%d\n", __FILE__, __LINE__);
LOCAL_HandleBase[slot] = t;
@ -184,7 +184,7 @@ INLINE_ONLY inline EXTERN void Yap_PutInHandle__(yhandle_t slot,
#endif
#define ensure_handles ensure_slots
INLINE_ONLY inline EXTERN void ensure_slots(int N USES_REGS) {
INLINE_ONLY void ensure_slots(int N USES_REGS) {
if (LOCAL_CurHandle + N >= LOCAL_NHandles) {
size_t inc = Yap_Max(16 * 1024, LOCAL_NHandles / 2); // measured in cells
inc = Yap_Max(inc, (size_t)N + 16); // measured in cells
@ -211,14 +211,14 @@ INLINE_ONLY inline EXTERN void ensure_slots(int N USES_REGS) {
#define Yap_PushHandle(t) Yap_InitHandle__(t PASS_REGS)
#define Yap_InitSlot(t) Yap_InitHandle__(t PASS_REGS)
INLINE_ONLY inline EXTERN yhandle_t Yap_InitHandle__(Term t USES_REGS);
INLINE_ONLY inline EXTERN yhandle_t Yap_InitHandle__(Term t USES_REGS) {
INLINE_ONLY yhandle_t Yap_InitHandle__(Term t USES_REGS);
INLINE_ONLY yhandle_t Yap_InitHandle__(Term t USES_REGS) {
yhandle_t old_slots = LOCAL_CurHandle;
ensure_slots(1 PASS_REGS);
if (t==0) {
t = MkVarTerm();
} else if (IsVarTerm(t) && (H0 > (CELL*)t || (CELL*)t > HR)) {
} else if (IsVarTerm(t) ) {
Term tg = MkVarTerm();
Bind_Global( VarOfTerm(t), tg);
}
@ -233,8 +233,8 @@ INLINE_ONLY inline EXTERN yhandle_t Yap_InitHandle__(Term t USES_REGS) {
#define Yap_NewHandles(n) Yap_NewHandles__(n PASS_REGS)
#define Yap_NewSlots(n) Yap_NewHandles__(n PASS_REGS)
INLINE_ONLY inline EXTERN yhandle_t Yap_NewHandles__(int n USES_REGS);
INLINE_ONLY inline EXTERN yhandle_t Yap_NewHandles__(int n USES_REGS) {
INLINE_ONLY yhandle_t Yap_NewHandles__(int n USES_REGS);
INLINE_ONLY yhandle_t Yap_NewHandles__(int n USES_REGS) {
yhandle_t old_slots = LOCAL_CurHandle;
int i;
// fprintf(stderr, "NS %s:%d\n", __FILE__, __LINE__);
@ -256,9 +256,9 @@ INLINE_ONLY inline EXTERN yhandle_t Yap_NewHandles__(int n USES_REGS) {
#define Yap_InitSlots(n, ts) Yap_InitHandles__(n, ts PASS_REGS)
/// @brief create n new slots with terms ts[]
INLINE_ONLY inline EXTERN yhandle_t Yap_InitHandles__(int n,
INLINE_ONLY yhandle_t Yap_InitHandles__(int n,
Term *ts USES_REGS);
INLINE_ONLY inline EXTERN yhandle_t Yap_InitHandles__(int n,
INLINE_ONLY yhandle_t Yap_InitHandles__(int n,
Term *ts USES_REGS) {
yhandle_t old_slots = LOCAL_CurHandle;
int i;

View File

@ -230,9 +230,9 @@ static inline yamop *gc_P(yamop *p, yamop *cp) {
#define Yap_CurrentModule() Yap_CurrentModule__(PASS_REGS1)
INLINE_ONLY inline EXTERN Term Yap_CurrentModule__(USES_REGS1);
INLINE_ONLY Term Yap_CurrentModule__(USES_REGS1);
INLINE_ONLY inline EXTERN Term Yap_CurrentModule__(USES_REGS1) {
INLINE_ONLY Term Yap_CurrentModule__(USES_REGS1) {
if (CurrentModule)
return CurrentModule;
return TermProlog;
@ -259,9 +259,9 @@ extern ADDR Yap_ExpandPreAllocCodeSpace(UInt, void *, int);
extern ADDR Yap_InitPreAllocCodeSpace(int);
#include "inline-only.h"
INLINE_ONLY EXTERN inline ADDR Yap_PreAllocCodeSpace(void);
INLINE_ONLY ADDR Yap_PreAllocCodeSpace(void);
INLINE_ONLY EXTERN inline ADDR Yap_PreAllocCodeSpace(void) {
INLINE_ONLY ADDR Yap_PreAllocCodeSpace(void) {
CACHE_REGS
return AuxBase;
}

View File

@ -77,34 +77,34 @@ typedef enum
#define Yap_has_signal(S) Yap_has_signal__(S PASS_REGS)
#define Yap_only_has_signal(S) Yap_only_has_signal__(S PASS_REGS)
INLINE_ONLY inline EXTERN uint64_t SIGNAL_TO_BIT( yap_signals sig);
INLINE_ONLY uint64_t SIGNAL_TO_BIT( yap_signals sig);
INLINE_ONLY inline EXTERN uint64_t
INLINE_ONLY uint64_t
SIGNAL_TO_BIT( yap_signals sig)
{
return ((uint64_t)1 << (sig-1));
}
INLINE_ONLY inline EXTERN int Yap_has_a_signal__ ( USES_REGS1 );
INLINE_ONLY int Yap_has_a_signal__ ( USES_REGS1 );
INLINE_ONLY inline EXTERN int Yap_has_signal__ ( yap_signals sig USES_REGS );
INLINE_ONLY int Yap_has_signal__ ( yap_signals sig USES_REGS );
INLINE_ONLY inline EXTERN int Yap_only_has_signal__(yap_signals sig USES_REGS);
INLINE_ONLY int Yap_only_has_signal__(yap_signals sig USES_REGS);
INLINE_ONLY inline EXTERN int
INLINE_ONLY int
Yap_has_a_signal__ (USES_REGS1)
{
return LOCAL_Signals != ((uint64_t)0);
}
INLINE_ONLY inline EXTERN int
INLINE_ONLY int
Yap_has_signal__(yap_signals sig USES_REGS)
{
return (LOCAL_Signals & SIGNAL_TO_BIT(sig)) != ((uint64_t)0);
}
INLINE_ONLY inline EXTERN int
INLINE_ONLY int
Yap_only_has_signal__(yap_signals sig USES_REGS)
{
return (LOCAL_Signals & SIGNAL_TO_BIT(sig)) == SIGNAL_TO_BIT(sig);

View File

@ -156,106 +156,95 @@
applies to unbound variables
*************************************************************************************************/
INLINE_ONLY inline EXTERN Term *VarOfTerm(Term t);
INLINE_ONLY Term *VarOfTerm(Term t);
INLINE_ONLY inline EXTERN Term *VarOfTerm(Term t) { return (Term *)(t); }
INLINE_ONLY Term *VarOfTerm(Term t) { return (Term *)(t); }
#ifdef YAPOR_SBA
#define RESET_VARIABLE(V) (*(CELL *)(V) = 0)
INLINE_ONLY inline EXTERN Term MkVarTerm__(USES_REGS1);
INLINE_ONLY Term MkVarTerm__(USES_REGS1);
INLINE_ONLY
inline EXTERN Term MkVarTerm__(USES_REGS1) {
INLINE_ONLY Term MkVarTerm__(USES_REGS1) {
return (Term)((*HR = 0, HR++));
}
INLINE_ONLY inline EXTERN bool IsUnboundVar(Term *);
INLINE_ONLY bool IsUnboundVar(Term *);
INLINE_ONLY
inline EXTERN bool IsUnboundVar(Term *t) { return (int)(*(t) ==
INLINE_ONLY bool IsUnboundVar(Term *t) { return (int)(*(t) ==
0); }
#else
#define RESET_VARIABLE(V) (*(CELL *)(V) = Unsigned(V))
INLINE_ONLY inline EXTERN Term MkVarTerm__(USES_REGS1);
INLINE_ONLY Term MkVarTerm__(USES_REGS1);
INLINE_ONLY
inline EXTERN Term MkVarTerm__(USES_REGS1) {
INLINE_ONLY Term MkVarTerm__(USES_REGS1) {
return (Term)((*HR = (CELL)HR, HR++));
}
INLINE_ONLY inline EXTERN bool IsUnboundVar(Term *);
INLINE_ONLY bool IsUnboundVar(Term *);
INLINE_ONLY
inline EXTERN bool IsUnboundVar(Term *t) {
INLINE_ONLY bool IsUnboundVar(Term *t) {
return *(t) == (Term)(t);
}
#endif
INLINE_ONLY inline EXTERN CELL *PtrOfTerm(Term);
INLINE_ONLY CELL *PtrOfTerm(Term);
INLINE_ONLY
inline EXTERN CELL *PtrOfTerm(Term t) {
INLINE_ONLY CELL *PtrOfTerm(Term t) {
return (CELL *)(*(CELL *)(t));
}
INLINE_ONLY inline EXTERN Functor FunctorOfTerm(Term);
INLINE_ONLY Functor FunctorOfTerm(Term);
INLINE_ONLY
inline EXTERN Functor FunctorOfTerm(Term t) {
INLINE_ONLY Functor FunctorOfTerm(Term t) {
return (Functor)(*RepAppl(t));
}
#if USE_LOW32_TAGS
INLINE_ONLY inline EXTERN Term MkAtomTerm(Atom);
INLINE_ONLY Term MkAtomTerm(Atom);
INLINE_ONLY
inline EXTERN Term MkAtomTerm(Atom a) {
INLINE_ONLY Term MkAtomTerm(Atom a) {
return (Term)(AtomTag | (CELL)(a));
}
INLINE_ONLY inline EXTERN Atom AtomOfTerm(Term t);
INLINE_ONLY Atom AtomOfTerm(Term t);
INLINE_ONLY
inline EXTERN Atom AtomOfTerm(Term t) {
INLINE_ONLY Atom AtomOfTerm(Term t) {
return (Atom)((~AtomTag & (CELL)(t)));
}
#else
INLINE_ONLY inline EXTERN Term MkAtomTerm(Atom);
INLINE_ONLY Term MkAtomTerm(Atom);
INLINE_ONLY
inline EXTERN Term MkAtomTerm(Atom at) {
INLINE_ONLY Term MkAtomTerm(Atom at) {
return (Term)(TAGGEDA((CELL)AtomTag, (CELL)(at)));
}
INLINE_ONLY inline EXTERN Atom AtomOfTerm(Term t);
INLINE_ONLY Atom AtomOfTerm(Term t);
INLINE_ONLY
inline EXTERN Atom AtomOfTerm(Term t) {
INLINE_ONLY Atom AtomOfTerm(Term t) {
return (Atom)(NonTagPart(t));
}
#endif
INLINE_ONLY inline EXTERN bool IsAtomTerm(Term);
INLINE_ONLY bool IsAtomTerm(Term);
INLINE_ONLY
inline EXTERN bool IsAtomTerm(Term t) {
INLINE_ONLY bool IsAtomTerm(Term t) {
return CHKTAG((t), AtomTag);
}
INLINE_ONLY inline EXTERN Term MkIntTerm(Int);
INLINE_ONLY Term MkIntTerm(Int);
INLINE_ONLY
inline EXTERN Term MkIntTerm(Int n) {
Term MkIntTerm(Int n) {
return (Term)(TAGGED(NumberTag, (n)));
}
@ -264,24 +253,24 @@ INLINE_ONLY
overflow problems are possible
*/
INLINE_ONLY inline EXTERN Term MkIntConstant(Int);
INLINE_ONLY Term MkIntConstant(Int);
INLINE_ONLY
inline EXTERN Term MkIntConstant(Int n) {
Term MkIntConstant(Int n) {
return (Term)(NONTAGGED(NumberTag, (n)));
}
INLINE_ONLY inline EXTERN bool IsIntTerm(Term);
INLINE_ONLY bool IsIntTerm(Term);
INLINE_ONLY
inline EXTERN bool IsIntTerm(Term t) {
bool IsIntTerm(Term t) {
return CHKTAG((t), NumberTag);
}
INLINE_ONLY EXTERN inline Term MkPairTerm__(Term head, Term tail USES_REGS);
INLINE_ONLY Term MkPairTerm__(Term head, Term tail USES_REGS);
INLINE_ONLY
EXTERN inline Term MkPairTerm__(Term head, Term tail USES_REGS) {
Term MkPairTerm__(Term head, Term tail USES_REGS) {
CELL *p = HR;
HR[0] = head;
@ -321,25 +310,22 @@ INLINE_ONLY
#define MkIntegerTerm(i) __MkIntegerTerm(i PASS_REGS)
INLINE_ONLY inline EXTERN Term __MkIntegerTerm(Int USES_REGS);
INLINE_ONLY Term __MkIntegerTerm(Int USES_REGS);
INLINE_ONLY
inline EXTERN Term __MkIntegerTerm(Int n USES_REGS) {
INLINE_ONLY Term __MkIntegerTerm(Int n USES_REGS) {
return (Term)(IntInBnd(n) ? MkIntTerm(n) : MkLongIntTerm(n));
}
#endif
INLINE_ONLY inline EXTERN bool IsIntegerTerm(Term);
INLINE_ONLY bool IsIntegerTerm(Term);
INLINE_ONLY
inline EXTERN bool IsIntegerTerm(Term t) {
INLINE_ONLY bool IsIntegerTerm(Term t) {
return (int)(IsIntTerm(t) || IsLongIntTerm(t));
}
INLINE_ONLY inline EXTERN Int IntegerOfTerm(Term);
INLINE_ONLY Int IntegerOfTerm(Term);
INLINE_ONLY
inline EXTERN Int IntegerOfTerm(Term t) {
INLINE_ONLY Int IntegerOfTerm(Term t) {
return (Int)(IsIntTerm(t) ? IntOfTerm(t) : LongIntOfTerm(t));
}
@ -348,34 +334,30 @@ INLINE_ONLY
#define MkAddressTerm(i) __MkAddressTerm(i PASS_REGS)
INLINE_ONLY inline EXTERN Term __MkAddressTerm(void *USES_REGS);
INLINE_ONLY Term __MkAddressTerm(void *USES_REGS);
INLINE_ONLY
inline EXTERN Term __MkAddressTerm(void *n USES_REGS) {
INLINE_ONLY Term __MkAddressTerm(void *n USES_REGS) {
return __MkIntegerTerm((Int)n PASS_REGS);
}
#endif
INLINE_ONLY inline EXTERN bool IsAddressTerm(Term);
INLINE_ONLY bool IsAddressTerm(Term);
INLINE_ONLY
inline EXTERN bool IsAddressTerm(Term t) {
INLINE_ONLY bool IsAddressTerm(Term t) {
return (bool)IsIntegerTerm(t);
}
INLINE_ONLY inline EXTERN void *AddressOfTerm(Term);
INLINE_ONLY void *AddressOfTerm(Term);
INLINE_ONLY
inline EXTERN void *AddressOfTerm(Term t) {
INLINE_ONLY void *AddressOfTerm(Term t) {
return (void *)(IsIntTerm(t) ? IntOfTerm(t) : LongIntOfTerm(t));
}
INLINE_ONLY inline EXTERN Int IsPairTermOrNil (Term);
INLINE_ONLY Int IsPairTermOrNil (Term);
INLINE_ONLY
inline EXTERN Int
INLINE_ONLY Int
IsPairOrNilTerm (Term t)
{
return IsPairTerm(t) || t == TermNil;

View File

@ -93,7 +93,7 @@ extern char_kind_t Yap_chtype0[];
char_kind_t Yap_wide_chtype(int ch);
INLINE_ONLY EXTERN inline char_kind_t Yap_wide_chtype(int ch) {
INLINE_ONLY char_kind_t Yap_wide_chtype(int ch) {
if (ch < 256)
return Yap_chtype[ch];
switch (utf8proc_category(ch)) {
@ -164,7 +164,7 @@ INLINE_ONLY EXTERN inline char_kind_t Yap_wide_chtype(int ch) {
return BS;
}
INLINE_ONLY EXTERN inline char_kind_t chtype(Int ch) {
INLINE_ONLY char_kind_t chtype(Int ch) {
if (ch < NUMBER_OF_CHARS)
return Yap_chtype[ch];
return Yap_wide_chtype(ch);

432
H/Yatom.h

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,7 @@
/*
* Machine and compiler dependent definitions
*/
#ifdef __GNUC__
#if 1 //def __GNUC__
#ifdef hppa
#define SHADOW_P 1
@ -51,19 +51,31 @@
#define SHADOW_Y 1
#define SHADOW_REGS 1
#define USE_PREFETCH 1
#endif
#if defined(_POWER) || defined(__POWERPC__)
#elif defined(_POWER) || defined(__POWERPC__)
#define SHADOW_P 1
#define SHADOW_REGS 1
#define USE_PREFETCH 1
#elif defined(__x86_64__)
#define SHADOW_P 1
#ifdef BP_FREE
#undef BP_FREE
#endif
#undef SHADOW_S
//#define SHADOW_Y 1
#define S_IN_MEM 1
#define Y_IN_MEM 1
#define TR_IN_MEM 1
#define LIMITED_PREFETCH 1
#elif defined(__i386__)
#undef SHADOW_S
#if defined(i386) && CELLSIZE == 4
#define Y_IN_MEM 1
#define S_IN_MEM 1
#define TR_IN_MEM 1
#define HAVE_FEW_REGS 1
#define LIMITED_PREFETCH 1
#ifdef BP_FREE
/***************************************************************
* Use bp as PREG for X86 machines *
@ -86,18 +98,6 @@ register struct yami *P1REG asm("bp"); /* can't use yamop before Yap.h */
#define TR_IN_MEM 1
#endif /* sparc_ */
#if defined(__x86_64__) && CELLSIZE == 8
#define SHADOW_P 1
#ifdef BP_FREE
#undef BP_FREE
#endif
#define SHADOW_S 1
//#define SHADOW_Y 1
#define S_IN_MEM 1
#define Y_IN_MEM 1
#define TR_IN_MEM 1
#define LIMITED_PREFETCH 1
#endif /* __x86_64__ */
#if defined(__arm__) || defined(__thumb__) || defined(mips) || \
defined(__mips64) || defined(__arch64__)
@ -119,9 +119,11 @@ register struct yami *P1REG asm("bp"); /* can't use yamop before Yap.h */
#define SHADOW_S 1
#endif
#if defined(i386) && CELLSIZE == 4
#if defined(__x86_64__)
#define Y_IN_MEM 1
#define TR_IN_MEM 1
#elif defined(i386)
#define Y_IN_MEM 1
#define S_IN_MEM 1
#define TR_IN_MEM 1
#define HAVE_FEW_REGS 1
#endif
@ -173,18 +175,18 @@ register struct yami *P1REG asm("bp"); /* can't use yamop before Yap.h */
/***************************************************************
* Trick to copy REGS into absmi local environment *
***************************************************************/
INLINE_ONLY inline EXTERN void init_absmi_regs(REGSTORE *absmi_regs);
INLINE_ONLY void init_absmi_regs(REGSTORE *absmi_regs);
/* regp is a global variable */
INLINE_ONLY inline EXTERN void init_absmi_regs(REGSTORE *absmi_regs) {
INLINE_ONLY void init_absmi_regs(REGSTORE *absmi_regs) {
CACHE_REGS
memcpy(absmi_regs, Yap_regp, sizeof(REGSTORE));
}
INLINE_ONLY inline EXTERN void restore_absmi_regs(REGSTORE *old_regs);
INLINE_ONLY void restore_absmi_regs(REGSTORE *old_regs);
INLINE_ONLY inline EXTERN void restore_absmi_regs(REGSTORE *old_regs) {
INLINE_ONLY void restore_absmi_regs(REGSTORE *old_regs) {
CACHE_REGS
memcpy(old_regs, Yap_regp, sizeof(REGSTORE));
#ifdef THREADS
@ -295,7 +297,7 @@ INLINE_ONLY inline EXTERN void restore_absmi_regs(REGSTORE *old_regs) {
{ \
YREG = (A)
#define FETCH_Y_FROM_ENV(A) (A)
#define FETCH_Y_FROM_ENV(A) ((YENV) = (A))
#define ENDCACHE_Y_AS_ENV() }
@ -335,6 +337,10 @@ INLINE_ONLY inline EXTERN void restore_absmi_regs(REGSTORE *old_regs) {
* This affects unification instructions *
***************************************************************/
#if !SHADOW_S
#define SREG S
#endif
#if S_IN_MEM
/* jump through hoops because idiotic gcc will go and read S from
@ -2445,7 +2451,7 @@ extern yamop *headoftrace;
#define Yap_AsmError(e, d) \
{ \
saveregs(); \
Yap_ThrowError(e, d, "while exwcuting inlined built-in"); \
Yap_ThrowError(e, d, "while executing inlined built-in"); \
setregs(); \
}

View File

@ -10,57 +10,12 @@
* *
* File: amidefs.h *
* comments: Abstract machine peculiarities *
* *
* Last rev: $Date: 2008-07-22 23:34:49 $ *
* $Log: not supported by cvs2svn $
* Revision 1.33 2007/11/26 23:43:09 vsc
* fixes to support threads and assert correctly, even if inefficiently.
*
* Revision 1.32 2006/10/10 14:08:17 vsc
* small fixes on threaded implementation.
*
* Revision 1.31 2006/09/20 20:03:51 vsc
* improve indexing on floats
* fix sending large lists to DB
*
* Revision 1.30 2005/12/17 03:25:39 vsc
* major changes to support online event-based profiling
* improve error discovery and restart on scanner.
*
* Revision 1.29 2005/07/06 15:10:15 vsc
* improvements to compiler: merged instructions and fixes for ->
*
* Revision 1.28 2005/05/30 06:07:35 vsc
* changes to support more tagging schemes from tabulation.
*
* Revision 1.27 2005/04/10 04:01:13 vsc
* bug fixes, I hope!
*
* Revision 1.26 2004/09/30 21:37:41 vsc
* fixes for thread support
*
* Revision 1.25 2004/09/27 20:45:04 vsc
* Mega clauses
* Fixes to sizeof(expand_clauses) which was being overestimated
* Fixes to profiling+indexing
* Fixes to reallocation of memory after restoring
* Make sure all clauses, even for C, end in _Ystop
* Don't reuse space for Streams
* Fix Stream_F on StreaNo+1
*
* Revision 1.24 2004/04/14 19:10:40 vsc
* expand_clauses: keep a list of clauses to expand
* fix new trail scheme for multi-assignment variables
*
* Revision 1.23 2004/03/31 01:03:10 vsc
* support expand group of clauses
*
* Revision 1.22 2004/03/10 14:59:55 vsc
* optimise -> for type tests
* *
* *
* *
*************************************************************************/
#ifndef AMIDEFS_H
#define AMIDEFS_H 1
#ifndef NULL
#include <stdio.h>
#endif
@ -865,7 +820,7 @@ typedef yamop yamopp;
#define PREVOP(V,TYPE) ((yamop *)((CODEADDR)(V)-(CELL)NEXTOP((yamop *)NULL,TYPE)))
#if defined(TABLING) || defined(YAPOR_SBA)
typedef struct trail_frame {
typedef struct trail_frame {
Term term;
CELL value;
} *tr_fr_ptr;
@ -1087,3 +1042,5 @@ extern void **Yap_ABSMI_OPCODES;
#else
#endif
#endif

View File

@ -164,9 +164,9 @@ Dereferencing macros
goto LabelList; \
} while (TRUE);
INLINE_ONLY inline EXTERN CELL *deref_ptr(CELL *A);
INLINE_ONLY CELL *deref_ptr(CELL *A);
INLINE_ONLY inline EXTERN CELL *deref_ptr(CELL *A) {
INLINE_ONLY CELL *deref_ptr(CELL *A) {
Term D = *A;
do {
if (!IsVarTerm(D))
@ -424,9 +424,9 @@ Unification Routines
*************************************************************/
INLINE_ONLY inline EXTERN void reset_trail(tr_fr_ptr TR0);
INLINE_ONLY void reset_trail(tr_fr_ptr TR0);
INLINE_ONLY inline EXTERN void reset_trail(tr_fr_ptr TR0) {
INLINE_ONLY void reset_trail(tr_fr_ptr TR0) {
CACHE_REGS
while (TR != TR0) {
CELL d1;
@ -455,9 +455,9 @@ INLINE_ONLY inline EXTERN void reset_trail(tr_fr_ptr TR0) {
}
}
INLINE_ONLY inline EXTERN void reset_attvars(CELL *dvarsmin, CELL *dvarsmax);
INLINE_ONLY void reset_attvars(CELL *dvarsmin, CELL *dvarsmax);
INLINE_ONLY inline EXTERN void reset_attvars(CELL *dvarsmin, CELL *dvarsmax) {
INLINE_ONLY void reset_attvars(CELL *dvarsmin, CELL *dvarsmax) {
if (dvarsmin) {
dvarsmin += 1;
do {
@ -472,10 +472,10 @@ INLINE_ONLY inline EXTERN void reset_attvars(CELL *dvarsmin, CELL *dvarsmax) {
}
}
INLINE_ONLY inline EXTERN void close_attvar_chain(CELL *dvarsmin,
INLINE_ONLY void close_attvar_chain(CELL *dvarsmin,
CELL *dvarsmax);
INLINE_ONLY inline EXTERN void close_attvar_chain(CELL *dvarsmin,
INLINE_ONLY void close_attvar_chain(CELL *dvarsmin,
CELL *dvarsmax) {
CACHE_REGS
if (dvarsmin) {
@ -492,9 +492,9 @@ INLINE_ONLY inline EXTERN void close_attvar_chain(CELL *dvarsmin,
}
}
INLINE_ONLY EXTERN inline bool Yap_unify(Term t0, Term t1);
INLINE_ONLY bool Yap_unify(Term t0, Term t1);
INLINE_ONLY EXTERN inline bool Yap_unify(Term t0, Term t1) {
INLINE_ONLY bool Yap_unify(Term t0, Term t1) {
CACHE_REGS
tr_fr_ptr TR0 = TR;
@ -506,9 +506,9 @@ INLINE_ONLY EXTERN inline bool Yap_unify(Term t0, Term t1) {
}
}
INLINE_ONLY EXTERN inline Int Yap_unify_constant(Term a, Term cons);
INLINE_ONLY Int Yap_unify_constant(Term a, Term cons);
INLINE_ONLY EXTERN inline Int Yap_unify_constant(Term a, Term cons) {
INLINE_ONLY Int Yap_unify_constant(Term a, Term cons) {
CACHE_REGS
CELL *pt;
deref_head(a, unify_cons_unk);

View File

@ -91,9 +91,9 @@ typedef struct logic_upd_clause {
} LogUpdClause;
#include "inline-only.h"
INLINE_ONLY inline EXTERN int VALID_TIMESTAMP(UInt, struct logic_upd_clause *);
INLINE_ONLY int VALID_TIMESTAMP(UInt, struct logic_upd_clause *);
INLINE_ONLY inline EXTERN int VALID_TIMESTAMP(UInt timestamp,
INLINE_ONLY int VALID_TIMESTAMP(UInt timestamp,
struct logic_upd_clause *cl) {
return IN_BETWEEN(cl->ClTimeStart, timestamp, cl->ClTimeEnd);
}
@ -191,36 +191,36 @@ typedef struct index_t {
UInt udi_arg;
} Index_t;
INLINE_ONLY EXTERN inline BITS32 EXO_ADDRESS_TO_OFFSET(struct index_t *it,
INLINE_ONLY BITS32 EXO_ADDRESS_TO_OFFSET(struct index_t *it,
CELL *ptr);
INLINE_ONLY EXTERN inline BITS32 EXO_ADDRESS_TO_OFFSET(struct index_t *it,
INLINE_ONLY BITS32 EXO_ADDRESS_TO_OFFSET(struct index_t *it,
CELL *ptr) {
return (ptr - it->cls) / it->arity + 1;
}
INLINE_ONLY EXTERN inline CELL *EXO_OFFSET_TO_ADDRESS(struct index_t *it,
INLINE_ONLY CELL *EXO_OFFSET_TO_ADDRESS(struct index_t *it,
BITS32 off);
INLINE_ONLY EXTERN inline CELL *EXO_OFFSET_TO_ADDRESS(struct index_t *it,
INLINE_ONLY CELL *EXO_OFFSET_TO_ADDRESS(struct index_t *it,
BITS32 off) {
if (off == 0L)
return (CELL *)NULL;
return (it->cls) + (off - 1) * it->arity;
}
INLINE_ONLY EXTERN inline BITS32 ADDRESS_TO_LINK(struct index_t *it,
INLINE_ONLY BITS32 ADDRESS_TO_LINK(struct index_t *it,
BITS32 *ptr);
INLINE_ONLY EXTERN inline BITS32 ADDRESS_TO_LINK(struct index_t *it,
INLINE_ONLY BITS32 ADDRESS_TO_LINK(struct index_t *it,
BITS32 *ptr) {
return ptr - it->links;
}
INLINE_ONLY EXTERN inline BITS32 *LINK_TO_ADDRESS(struct index_t *it,
INLINE_ONLY BITS32 *LINK_TO_ADDRESS(struct index_t *it,
BITS32 off);
INLINE_ONLY EXTERN inline BITS32 *LINK_TO_ADDRESS(struct index_t *it,
INLINE_ONLY BITS32 *LINK_TO_ADDRESS(struct index_t *it,
BITS32 off) {
return it->links + off;
}
@ -319,17 +319,17 @@ CELL Yap_NextExo(choiceptr cpt, struct index_t *it);
#define OP_HASH_SIZE 2048
INLINE_ONLY inline EXTERN int rtable_hash_op(OPCODE opc, int hash_mask);
INLINE_ONLY int rtable_hash_op(OPCODE opc, int hash_mask);
INLINE_ONLY inline EXTERN int rtable_hash_op(OPCODE opc, int hash_mask) {
INLINE_ONLY int rtable_hash_op(OPCODE opc, int hash_mask) {
return ((((CELL)opc) >> 3) & hash_mask);
}
INLINE_ONLY inline EXTERN op_numbers Yap_op_from_opcode(OPCODE opc);
INLINE_ONLY op_numbers Yap_op_from_opcode(OPCODE opc);
/* given an opcode find the corresponding opnumber. This should make
switches on ops a much easier operation */
INLINE_ONLY inline EXTERN op_numbers Yap_op_from_opcode(OPCODE opc) {
INLINE_ONLY op_numbers Yap_op_from_opcode(OPCODE opc) {
int j = rtable_hash_op(opc, OP_HASH_SIZE - 1);
while (OP_RTABLE[j].opc != opc) {

View File

@ -2,10 +2,10 @@
#define _YAP_INLINE_ONLY_H_
#if defined(__GNUC__ )
#define INLINE_ONLY __attribute__((gnu_inline,always_inline))
#define INLINE_ONLY EXTERN inline __attribute__((gnu_inline,always_inline))
//#define INLINE_ONLY
#else
#define INLINE_ONLY
#define INLINE_ONLY EXTERN inline
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -110,16 +110,16 @@ typedef struct jit_compiler JIT_Compiler;
EXTERN void* (*Yap_JitCall)(JIT_Compiler* jc, yamop* p);
INLINE_ONLY inline EXTERN void* call_JIT_Compiler(JIT_Compiler* jc, yamop* p);
INLINE_ONLY void* call_JIT_Compiler(JIT_Compiler* jc, yamop* p);
INLINE_ONLY inline EXTERN void* call_JIT_Compiler(JIT_Compiler* jc, yamop* p) {
INLINE_ONLY void* call_JIT_Compiler(JIT_Compiler* jc, yamop* p) {
return Yap_JitCall (jc,p); }
INLINE_ONLY inline EXTERN void shutdown_llvm(void ) ;
INLINE_ONLY void shutdown_llvm(void ) ;
EXTERN void (* Yap_llvmShutdown)(void ) ;
INLINE_ONLY inline EXTERN void shutdown_llvm(void ) { Yap_llvmShutdown (); }
INLINE_ONLY void shutdown_llvm(void ) { Yap_llvmShutdown (); }
#endif

View File

@ -74,7 +74,7 @@ extern void Yap_ThrowError__(const char *file, const char *function, int lineno,
{ if ( (TF = Yap_ensure_atom__(__FILE__, __FUNCTION__, __LINE__, T0 ) == 0L ) return false; \
}
INLINE_ONLY extern inline Term Yap_ensure_atom__(const char *fu, const char *fi,
INLINE_ONLY Term Yap_ensure_atom__(const char *fu, const char *fi,
int line, Term in) {
Term t = Deref(in);
// Term Context = Deref(ARG2);

View File

@ -12,7 +12,7 @@
#endif
#if defined(TABLING) || defined(YAPOR_SBA)
typedef struct trail_frame {
typedef struct trail_frame {
Term term;
CELL value;
} *tr_fr_ptr;

View File

@ -36,11 +36,11 @@
#define INLINE_ONLY
#endif
INLINE_ONLY inline EXTERN utf8proc_ssize_t get_utf8(const utf8proc_uint8_t *ptr,
INLINE_ONLY utf8proc_ssize_t get_utf8(const utf8proc_uint8_t *ptr,
size_t n,
utf8proc_int32_t *valp);
INLINE_ONLY inline EXTERN utf8proc_ssize_t get_utf8(const utf8proc_uint8_t *ptr,
INLINE_ONLY utf8proc_ssize_t get_utf8(const utf8proc_uint8_t *ptr,
size_t n,
utf8proc_int32_t *valp) {
utf8proc_ssize_t rc = utf8proc_iterate(ptr, n, valp);
@ -50,10 +50,10 @@ INLINE_ONLY inline EXTERN utf8proc_ssize_t get_utf8(const utf8proc_uint8_t *ptr,
return rc < 1 ? 1 : rc;
}
INLINE_ONLY inline EXTERN utf8proc_ssize_t put_utf8(utf8proc_uint8_t *ptr,
INLINE_ONLY utf8proc_ssize_t put_utf8(utf8proc_uint8_t *ptr,
utf8proc_int32_t val);
INLINE_ONLY inline EXTERN utf8proc_ssize_t put_utf8(utf8proc_uint8_t *ptr,
INLINE_ONLY utf8proc_ssize_t put_utf8(utf8proc_uint8_t *ptr,
utf8proc_int32_t val) {
utf8proc_ssize_t rc = utf8proc_encode_char(val, ptr);
if (rc < 0) {

View File

@ -119,19 +119,19 @@ bp_get_arity(TERM t)
// TERM bp_insert_pred(char *name, int arity, int (*func)())
#define bp_insert_pred(name, arity, func) YAP_UserCPredicate(name, func, arity)
INLINE_ONLY extern inline int bp_call_string(const char *goal);
INLINE_ONLY extern inline int bp_call_term(TERM t);
INLINE_ONLY extern inline int bp_next_solution(void);
INLINE_ONLY extern inline int bp_mount_query_term(TERM goal);
INLINE_ONLY int bp_call_string(const char *goal);
INLINE_ONLY int bp_call_term(TERM t);
INLINE_ONLY int bp_next_solution(void);
INLINE_ONLY int bp_mount_query_term(TERM goal);
// int bp_call_string(char *goal)
INLINE_ONLY extern inline int
INLINE_ONLY int
bp_call_string(const char *goal) {
return YAP_RunGoal(YAP_ReadBuffer(goal, NULL));
}
// int bp_call_term(TERM goal)
INLINE_ONLY extern inline int
INLINE_ONLY int
bp_call_term(TERM t) {
return YAP_RunGoal(t);
}
@ -151,7 +151,7 @@ extern YAP_Term YAP_BPROLOG_curr_toam_status;
extern YAP_Int YAP_BPROLOG_exception;
// TERM bp_next_solution()
INLINE_ONLY extern inline int bp_next_solution(void)
INLINE_ONLY int bp_next_solution(void)
{
if (curr_toam_status) {
TERM goal = curr_toam_status;
@ -165,7 +165,7 @@ INLINE_ONLY extern inline int bp_next_solution(void)
#define bp_mount_query_string(goal) (curr_toam_status = YAP_ReadBuffer(goal, NULL))
// void bp_mount_query_term(TERM goal)
INLINE_ONLY extern inline int
INLINE_ONLY int
bp_mount_query_term(TERM goal)
{
curr_toam_status = goal;

View File

@ -85,7 +85,7 @@ static Int flush_output(USES_REGS1);
*
* @return the char .
*/
INLINE_ONLY inline EXTERN Int CharOfAtom(Atom at) {
INLINE_ONLY Int CharOfAtom(Atom at) {
int32_t val;
get_utf8(at->UStrOfAE, 1, &val);

View File

@ -24,8 +24,8 @@
#include "YapStreams.h"
INLINE_ONLY EXTERN inline UInt PRED_HASH(FunctorEntry *, Term, UInt);
INLINE_ONLY EXTERN inline bool IsStreamTerm(Term t) {
INLINE_ONLY UInt PRED_HASH(FunctorEntry *, Term, UInt);
INLINE_ONLY bool IsStreamTerm(Term t) {
return !IsVarTerm(t) &&
(IsAtomTerm(t) ||
(IsApplTerm(t) && (FunctorOfTerm(t) == FunctorStream)));
@ -210,11 +210,11 @@ extern void Yap_DeleteAliases(int sno);
extern bool Yap_FindStreamForAlias(Atom al);
extern bool Yap_FetchStreamAlias(int sno, Term t2 USES_REGS);
INLINE_ONLY inline EXTERN void count_output_char(int ch, StreamDesc *s);
INLINE_ONLY void count_output_char(int ch, StreamDesc *s);
extern Term Yap_StreamUserName(int sno);
INLINE_ONLY inline EXTERN void count_output_char(int ch, StreamDesc *s) {
INLINE_ONLY void count_output_char(int ch, StreamDesc *s) {
if (ch == '\n') {
#if MPWSHELL
if (mpwshell && (sno == StdOutStream || sno == StdErrStream) &&

View File

@ -1052,7 +1052,7 @@ Term Yap_read_term(int sno, Term opts, bool clause) {
pop_text_stack(lvl);
Yap_popErrorContext(err, true);
if (LOCAL_Error_TYPE != YAP_NO_ERROR) {
Yap_Error(LOCAL_Error_TYPE, ARG1, LOCAL_ErrorMessage);
Yap_Error(LOCAL_Error_TYPE, Yap_MkStream(sno), LOCAL_ErrorMessage);
}
return fe.t;
}

View File

@ -346,6 +346,7 @@ bool Yap_ChDir(const char *path) {
bool rc = false;
int lvl = push_text_stack();
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "chdir %s", path);
VFS_t *v;
if ((v = vfs_owner(path))) {
rc = v->chdir(v, path);
@ -1134,7 +1135,9 @@ const char *Yap_getcwd(char *cwd, size_t cwdlen) {
}
return (char *)cwd;
#endif
return getcwd(cwd, FILENAME_MAX);
const char *rc = getcwd(cwd, FILENAME_MAX);
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "chdir %s", rc);
return rc;
}
static Int working_directory(USES_REGS1) {

View File

@ -137,7 +137,7 @@ extern bool Yap_flush(int sno);
extern uint64_t HashFunction(const unsigned char *);
extern uint64_t WideHashFunction(wchar_t *);
INLINE_ONLY inline EXTERN Term MkCharTerm(Int c);
INLINE_ONLY Term MkCharTerm(Int c);
/**
* MkCharTerm: convert a character into a single atom.
@ -146,7 +146,7 @@ INLINE_ONLY inline EXTERN Term MkCharTerm(Int c);
*
* @return the term.
*/
INLINE_ONLY inline EXTERN Term MkCharTerm(Int c) {
INLINE_ONLY Term MkCharTerm(Int c) {
unsigned char cs[10];
if (c < 0)
return TermEof;
@ -160,7 +160,7 @@ INLINE_ONLY inline EXTERN Term MkCharTerm(Int c) {
extern char *GLOBAL_cwd;
INLINE_ONLY inline EXTERN char *Yap_VF(const char *path){
INLINE_ONLY char *Yap_VF(const char *path){
char *out;
out = (char *)malloc(YAP_FILENAME_MAX+1);
@ -174,7 +174,7 @@ INLINE_ONLY inline EXTERN char *Yap_VF(const char *path){
}
INLINE_ONLY inline EXTERN char *Yap_VFAlloc(const char *path){
INLINE_ONLY char *Yap_VFAlloc(const char *path){
char *out;
out = (char *)malloc(YAP_FILENAME_MAX+1);

View File

@ -1,5 +1,9 @@
message( " * Sqlite3 Data-Base (http://www.sqlite3ql.org), distributed with MYDDAS" )
set (SQLITE_EXTRA
chinook.db
test.yap)
set( YAPSQLITE3_SOURCES
myddas_sqlite3.c
src/sqlite3.h
@ -54,5 +58,8 @@ install(TARGETS sqlite4YAP
)
endif()
install(FILES ${SQLITE_EXTRA}
DESTINATION ${libpl}
)
# file (INSTALL chinook.db test.yap DESTINATION ${libpl})

View File

@ -12,6 +12,8 @@ main_ .
init :-
db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _),
db_open(sqlite3, '/assets/Yap/chinook.db', _, _),
writeln('chinook has landed'),
db_import('Artist', artist),
db_import('Album', album),

View File

@ -82,17 +82,17 @@ long int XTAG(TERM t)
#include "inline-only.h"
INLINE_ONLY extern inline TERM ADDTAG(void * t,int tag);
INLINE_ONLY extern inline int is_UNIFIABLE(TERM t1, TERM t2);
INLINE_ONLY extern inline int is_IDENTICAL(TERM t1, TERM t2);
INLINE_ONLY extern inline char *bp_term_2_string(TERM t);
INLINE_ONLY extern inline int bp_string_2_term(const char *s, TERM to, TERM tv);
INLINE_ONLY extern inline SYM_REC_PTR insert(const char *name, int size, int arity);
INLINE_ONLY extern inline int compare(TERM t1, TERM t2);
INLINE_ONLY extern inline void write_term(TERM t);
INLINE_ONLY extern inline void numberVarTermOpt(TERM t);
INLINE_ONLY extern inline TERM unnumberVarTerm(TERM t, BPLONG_PTR pt1, BPLONG_PTR pt2);
INLINE_ONLY extern inline int unifyNumberedTerms(TERM t1, TERM t2);
INLINE_ONLY TERM ADDTAG(void * t,int tag);
INLINE_ONLY int is_UNIFIABLE(TERM t1, TERM t2);
INLINE_ONLY int is_IDENTICAL(TERM t1, TERM t2);
INLINE_ONLY char *bp_term_2_string(TERM t);
INLINE_ONLY int bp_string_2_term(const char *s, TERM to, TERM tv);
INLINE_ONLY SYM_REC_PTR insert(const char *name, int size, int arity);
INLINE_ONLY int compare(TERM t1, TERM t2);
INLINE_ONLY void write_term(TERM t);
INLINE_ONLY void numberVarTermOpt(TERM t);
INLINE_ONLY TERM unnumberVarTerm(TERM t, BPLONG_PTR pt1, BPLONG_PTR pt2);
INLINE_ONLY int unifyNumberedTerms(TERM t1, TERM t2);
int bpx_call_term(TERM t);
int bpx_call_string(const char *s);
@ -103,7 +103,7 @@ void bpx_write(TERM t);
int bpx_printf(const char *fmt, ...);
INLINE_ONLY extern inline TERM ADDTAG(void * t,int tag) {
INLINE_ONLY TERM ADDTAG(void * t,int tag) {
if (tag == ATM)
return MkAtomTerm((Atom)t);
if (tag == LST)
@ -133,12 +133,12 @@ TERM encodefloat1(double f USES_REGS)
return MkFloatTerm((Float)f);
}
INLINE_ONLY extern inline int is_UNIFIABLE(TERM t1, TERM t2)
INLINE_ONLY int is_UNIFIABLE(TERM t1, TERM t2)
{
return YAP_Unifiable(t1, t2);
}
INLINE_ONLY extern inline int is_IDENTICAL(TERM t1, TERM t2)
INLINE_ONLY int is_IDENTICAL(TERM t1, TERM t2)
{
return YAP_ExactlyEqual(t1, t2);
}
@ -183,7 +183,7 @@ extern BPLONG toam_signal_vec;
extern inline INLINE_ONLY int YAP_UnifyINT(YAP_Term t1, YAP_Term t2);
extern inline INLINE_ONLY int YAP_UnifyINT(YAP_Term t1, YAP_Term t2) { return YAP_Unify(t1,t2); }
INLINE_ONLY extern inline char *
INLINE_ONLY char *
bp_term_2_string(TERM t)
{
char *buf = malloc(256);
@ -193,7 +193,7 @@ bp_term_2_string(TERM t)
}
// char *bp_get_name(TERM t)
INLINE_ONLY extern inline int
INLINE_ONLY int
bp_string_2_term(const char *s, TERM to, TERM tv)
{
TERM t0 = YAP_ReadBuffer(s, NULL);
@ -201,7 +201,7 @@ bp_string_2_term(const char *s, TERM to, TERM tv)
return unify(t0, to) && unify(t1,tv);
}
INLINE_ONLY extern inline SYM_REC_PTR
INLINE_ONLY SYM_REC_PTR
insert(const char *name, int size, int arity)
{
if (!arity) {
@ -210,30 +210,30 @@ insert(const char *name, int size, int arity)
return (SYM_REC_PTR)YAP_MkFunctor(YAP_LookupAtom(name), arity);
}
INLINE_ONLY extern inline int
INLINE_ONLY int
compare(TERM t1, TERM t2)
{
// compare terms??
return YAP_CompareTerms(t1,t2);
}
INLINE_ONLY extern inline void
INLINE_ONLY void
write_term(TERM t)
{
YAP_Write(t,NULL,0);
}
INLINE_ONLY inline EXTERN NORET quit(const char *s);
INLINE_ONLY inline EXTERN NORET myquit(int i, const char *s);
INLINE_ONLY NORET quit(const char *s);
INLINE_ONLY NORET myquit(int i, const char *s);
INLINE_ONLY inline EXTERN NORET quit(const char *s)
INLINE_ONLY NORET quit(const char *s)
{
fprintf(stderr,"PRISM QUIT: %s\n",s);
exit(0);
}
INLINE_ONLY inline EXTERN NORET myquit(int i, const char *s)
INLINE_ONLY NORET myquit(int i, const char *s)
{
fprintf(stderr,"PRISM QUIT: %s\n",s);
exit(i);
@ -248,19 +248,19 @@ list_length(BPLONG t1, BPLONG t2)
#define PRE_NUMBER_VAR(X)
INLINE_ONLY extern inline void
INLINE_ONLY void
numberVarTermOpt(TERM t)
{
YAP_NumberVars(t, 0);
}
INLINE_ONLY extern inline TERM
INLINE_ONLY TERM
unnumberVarTerm(TERM t, BPLONG_PTR pt1, BPLONG_PTR pt2)
{
return YAP_UnNumberVars(t);
}
INLINE_ONLY extern inline int
INLINE_ONLY int
unifyNumberedTerms(TERM t1, TERM t2)
{
if (YAP_Unify(t1,t2))