Merge branch 'master' of git.dcc.fc.up.pt:yap-6.3

This commit is contained in:
Vitor Santos Costa 2013-05-01 11:54:51 -05:00
commit 75d607aaec
84 changed files with 1918 additions and 1696 deletions

View File

@ -26,9 +26,8 @@ static char SccsId[] = "%W% %G%";
#endif #endif
#include "Yap.h" #include "Yap.h"
ADDR STD_PROTO(Yap_PreAllocCodeSpace, (void)); static Prop PredPropByFunc(Functor, Term);
Prop STD_PROTO(PredPropByFunc,(Functor, Term)); static Prop PredPropByAtom(Atom, Term);
Prop STD_PROTO(PredPropByAtom,(Atom, Term));
#include "Yatom.h" #include "Yatom.h"
#include "yapio.h" #include "yapio.h"
#include <stdio.h> #include <stdio.h>

View File

@ -32,8 +32,8 @@ static char SccsId[] = "@(#)agc.c 1.3 3/15/90";
#define errout GLOBAL_stderr #define errout GLOBAL_stderr
#endif #endif
STATIC_PROTO(void RestoreEntries, (PropEntry *, int USES_REGS)); static void RestoreEntries(PropEntry *, int USES_REGS);
STATIC_PROTO(void CleanCode, (PredEntry * USES_REGS)); static void CleanCode(PredEntry * USES_REGS);
#define AtomMarkedBit 1 #define AtomMarkedBit 1

View File

@ -482,11 +482,11 @@ Yap_givemallinfo(void)
#if !USE_DL_MALLOC #if !USE_DL_MALLOC
STATIC_PROTO(void FreeBlock, (BlockHeader *)); static void FreeBlock(BlockHeader *);
STATIC_PROTO(BlockHeader *GetBlock, (unsigned long int)); static BlockHeader *GetBlock(unsigned long int);
STATIC_PROTO(char *AllocHeap, (unsigned long int)); static char *AllocHeap(unsigned long int);
STATIC_PROTO(void RemoveFromFreeList, (BlockHeader *)); static void RemoveFromFreeList(BlockHeader *);
STATIC_PROTO(void AddToFreeList, (BlockHeader *)); static void AddToFreeList(BlockHeader *);
#define MinHGap 256*K #define MinHGap 256*K
@ -1273,7 +1273,7 @@ Yap_FreeWorkSpace(void)
\***********************************************************************/ \***********************************************************************/
#ifdef _AIX #ifdef _AIX
char *STD_PROTO(sbrk, (int)); char *sbrk(int);
#endif #endif

120
C/amasm.c
View File

@ -214,73 +214,73 @@ typedef struct clause_info_struct {
struct pred_entry *CurrentPred; struct pred_entry *CurrentPred;
} clause_info; } clause_info;
STATIC_PROTO(OPREG Var_Ref, (Ventry *, int)); static OPREG Var_Ref(Ventry *, int);
STATIC_PROTO(wamreg emit_xreg, (CELL)); static wamreg emit_xreg(CELL);
STATIC_PROTO(yslot emit_yreg, (CELL)); static yslot emit_yreg(CELL);
STATIC_PROTO(wamreg emit_x, (CELL)); static wamreg emit_x(CELL);
STATIC_PROTO(yslot emit_y, (Ventry *)); static yslot emit_y(Ventry *);
STATIC_PROTO(yamop *emit_a, (CELL)); static yamop *emit_a(CELL);
STATIC_PROTO(CELL *emit_bmlabel, (CELL, struct intermediates *)); static CELL *emit_bmlabel(CELL, struct intermediates *);
STATIC_PROTO(yamop *emit_ilabel, (CELL, struct intermediates *)); static yamop *emit_ilabel(CELL, struct intermediates *);
STATIC_PROTO(Functor emit_f, (CELL)); static Functor emit_f(CELL);
STATIC_PROTO(CELL emit_c, (CELL)); static CELL emit_c(CELL);
STATIC_PROTO(COUNT emit_count, (CELL)); static COUNT emit_count(CELL);
STATIC_PROTO(OPCODE emit_op, (op_numbers)); static OPCODE emit_op(op_numbers);
STATIC_PROTO(yamop *a_cle, (op_numbers, yamop *, int, struct intermediates *)); static yamop *a_cle(op_numbers, yamop *, int, struct intermediates *);
STATIC_PROTO(yamop *a_e, (op_numbers, yamop *, int)); static yamop *a_e(op_numbers, yamop *, int);
STATIC_PROTO(yamop *a_ue, (op_numbers, op_numbers, yamop *, int)); static yamop *a_ue(op_numbers, op_numbers, yamop *, int);
STATIC_PROTO(yamop *a_v, (op_numbers, op_numbers, yamop *, int, struct PSEUDO *)); static yamop *a_v(op_numbers, op_numbers, yamop *, int, struct PSEUDO *);
STATIC_PROTO(yamop *a_uv, (Ventry *,op_numbers, op_numbers, op_numbers, op_numbers, yamop *, int)); static yamop *a_uv(Ventry *,op_numbers, op_numbers, op_numbers, op_numbers, yamop *, int);
STATIC_PROTO(yamop *a_vr, (op_numbers, op_numbers, yamop *, int, struct intermediates *)); static yamop *a_vr(op_numbers, op_numbers, yamop *, int, struct intermediates *);
STATIC_PROTO(yamop *a_rv, (op_numbers, op_numbers, OPREG, yamop *, int, struct PSEUDO *)); static yamop *a_rv(op_numbers, op_numbers, OPREG, yamop *, int, struct PSEUDO *);
STATIC_PROTO(yamop *a_vv, (op_numbers, op_numbers, yamop *, int, struct intermediates *)); static yamop *a_vv(op_numbers, op_numbers, yamop *, int, struct intermediates *);
STATIC_PROTO(yamop *a_glist, (int *, yamop *, int, struct intermediates *)); static yamop *a_glist(int *, yamop *, int, struct intermediates *);
STATIC_PROTO(void a_pair, (CELL *, int, struct intermediates *)); static void a_pair(CELL *, int, struct intermediates *);
STATIC_PROTO(yamop *a_f, (CELL, op_numbers, yamop *, int)); static yamop *a_f(CELL, op_numbers, yamop *, int);
STATIC_PROTO(yamop *a_c, (CELL, op_numbers, yamop *, int)); static yamop *a_c(CELL, op_numbers, yamop *, int);
STATIC_PROTO(yamop *a_uc, (CELL, op_numbers, op_numbers, yamop *, int)); static yamop *a_uc(CELL, op_numbers, op_numbers, yamop *, int);
STATIC_PROTO(yamop *a_n, (op_numbers, int, yamop *, int)); static yamop *a_n(op_numbers, int, yamop *, int);
STATIC_PROTO(yamop *a_un, (op_numbers, op_numbers, int, yamop *, int)); static yamop *a_un(op_numbers, op_numbers, int, yamop *, int);
STATIC_PROTO(yamop *a_nc, (CELL, op_numbers, int, yamop *, int)); static yamop *a_nc(CELL, op_numbers, int, yamop *, int);
STATIC_PROTO(yamop *a_unc, (CELL, op_numbers, op_numbers, int, yamop *, int)); static yamop *a_unc(CELL, op_numbers, op_numbers, int, yamop *, int);
STATIC_PROTO(yamop *a_r, (CELL, op_numbers, yamop *, int)); static yamop *a_r(CELL, op_numbers, yamop *, int);
STATIC_PROTO(yamop *a_p, (op_numbers, clause_info *, yamop *, int, struct intermediates *)); static yamop *a_p(op_numbers, clause_info *, yamop *, int, struct intermediates *);
STATIC_PROTO(yamop *a_pl, (op_numbers, PredEntry *, yamop *, int)); static yamop *a_pl(op_numbers, PredEntry *, yamop *, int);
STATIC_PROTO(yamop *a_l, (CELL, op_numbers, yamop *, int, struct intermediates *)); static yamop *a_l(CELL, op_numbers, yamop *, int, struct intermediates *);
STATIC_PROTO(yamop *a_hx, (op_numbers, union clause_obj *, int, yamop *, int, struct intermediates *)); static yamop *a_hx(op_numbers, union clause_obj *, int, yamop *, int, struct intermediates *);
STATIC_PROTO(yamop *a_if, (op_numbers, union clause_obj *, int, yamop *, int, struct intermediates *cip)); static yamop *a_if(op_numbers, union clause_obj *, int, yamop *, int, struct intermediates *cip);
STATIC_PROTO(yamop *a_cut, (clause_info *,yamop *, int, struct intermediates *)); static yamop *a_cut(clause_info *,yamop *, int, struct intermediates *);
#ifdef YAPOR #ifdef YAPOR
STATIC_PROTO(yamop *a_try, (op_numbers, CELL, CELL, int, int, yamop *, int, struct intermediates *)); static yamop *a_try(op_numbers, CELL, CELL, int, int, yamop *, int, struct intermediates *);
STATIC_PROTO(yamop *a_either, (op_numbers, CELL, CELL, int, yamop *, int, struct intermediates *)); static yamop *a_either(op_numbers, CELL, CELL, int, yamop *, int, struct intermediates *);
#else #else
STATIC_PROTO(yamop *a_try, (op_numbers, CELL, CELL, yamop *, int, struct intermediates *)); static yamop *a_try(op_numbers, CELL, CELL, yamop *, int, struct intermediates *);
STATIC_PROTO(yamop *a_either, (op_numbers, CELL, CELL, yamop *, int, struct intermediates *)); static yamop *a_either(op_numbers, CELL, CELL, yamop *, int, struct intermediates *);
#endif /* YAPOR */ #endif /* YAPOR */
STATIC_PROTO(yamop *a_gl, (op_numbers, yamop *, int, struct PSEUDO *, struct intermediates * CACHE_TYPE)); static yamop *a_gl(op_numbers, yamop *, int, struct PSEUDO *, struct intermediates * CACHE_TYPE);
STATIC_PROTO(yamop *a_bfunc, (CELL, clause_info *, yamop *, int, struct intermediates *)); static yamop *a_bfunc(CELL, clause_info *, yamop *, int, struct intermediates *);
STATIC_PROTO( static
COUNT compile_cmp_flags, (char *)); COUNT compile_cmp_flags(char *);
STATIC_PROTO(yamop *a_igl, (CELL, op_numbers, yamop *, int, struct intermediates *)); static yamop *a_igl(CELL, op_numbers, yamop *, int, struct intermediates *);
STATIC_PROTO(yamop *a_xigl, (op_numbers, yamop *, int, struct PSEUDO *)); static yamop *a_xigl(op_numbers, yamop *, int, struct PSEUDO *);
STATIC_PROTO(yamop *a_ucons, (int *, compiler_vm_op, yamop *, int, struct intermediates *)); static yamop *a_ucons(int *, compiler_vm_op, yamop *, int, struct intermediates *);
STATIC_PROTO(yamop *a_uvar, (yamop *, int, struct intermediates *)); static yamop *a_uvar(yamop *, int, struct intermediates *);
STATIC_PROTO(yamop *a_wvar, (yamop *, int, struct intermediates *)); static yamop *a_wvar(yamop *, int, struct intermediates *);
STATIC_PROTO(yamop *do_pass, (int, yamop **, int, int *, int *,struct intermediates *, UInt CACHE_TYPE)); static yamop *do_pass(int, yamop **, int, int *, int *,struct intermediates *, UInt CACHE_TYPE);
#ifdef DEBUG_OPCODES #ifdef DEBUG_OPCODES
STATIC_PROTO(void DumpOpCodes, (void)); static void DumpOpCodes(void);
#endif #endif
#ifdef SFUNC #ifdef SFUNC
STATIC_PROTO(void a_vsf, (int, yamop *, int, struct PSEUDO *)); static void a_vsf(int, yamop *, int, struct PSEUDO *);
STATIC_PROTO(void a_asf, (int, yamop *, int, struct PSEUDO *)); static void a_asf(int, yamop *, int, struct PSEUDO *);
#endif #endif
STATIC_PROTO(yamop *check_alloc, (clause_info *, yamop *, int, struct intermediates *)); static yamop *check_alloc(clause_info *, yamop *, int, struct intermediates *);
STATIC_PROTO(yamop *a_deallocate, (clause_info *, yamop *, int, struct intermediates *)); static yamop *a_deallocate(clause_info *, yamop *, int, struct intermediates *);
STATIC_PROTO(yamop *a_bmap, (yamop *, int, struct PSEUDO *)); static yamop *a_bmap(yamop *, int, struct PSEUDO *);
STATIC_PROTO(void a_fetch_vv, (cmp_op_info *, int, struct intermediates *)); static void a_fetch_vv(cmp_op_info *, int, struct intermediates *);
STATIC_PROTO(void a_fetch_cv, (cmp_op_info *, int, struct intermediates *)); static void a_fetch_cv(cmp_op_info *, int, struct intermediates *);
STATIC_PROTO(void a_fetch_vc, (cmp_op_info *, int, struct intermediates *)); static void a_fetch_vc(cmp_op_info *, int, struct intermediates *);
STATIC_PROTO(yamop *a_f2, (cmp_op_info *, yamop *, int, struct intermediates *)); static yamop *a_f2(cmp_op_info *, yamop *, int, struct intermediates *);
#define CELLSIZE sizeof(CELL) #define CELLSIZE sizeof(CELL)

View File

@ -31,9 +31,9 @@ static char SccsId[] = "%W% %G%";
STATIC_PROTO(Int p_reset_op_counters, (void)); static Int p_reset_op_counters(void);
STATIC_PROTO(Int p_show_op_counters, (void)); static Int p_show_op_counters(void);
STATIC_PROTO(Int p_show_ops_by_group, (void)); static Int p_show_ops_by_group(void);
static Int static Int
p_reset_op_counters() p_reset_op_counters()

View File

@ -34,9 +34,9 @@ extern int errno;
#endif #endif
#endif #endif
STATIC_PROTO(Int p_compile_array_refs, ( USES_REGS1 )); static Int p_compile_array_refs( USES_REGS1 );
STATIC_PROTO(Int p_array_refs_compiled, ( USES_REGS1 )); static Int p_array_refs_compiled( USES_REGS1 );
STATIC_PROTO(Int p_sync_mmapped_arrays, ( USES_REGS1 )); static Int p_sync_mmapped_arrays( USES_REGS1 );
/* /*
* *
@ -122,15 +122,15 @@ STATIC_PROTO(Int p_sync_mmapped_arrays, ( USES_REGS1 ));
* *
*/ */
STATIC_PROTO(Int p_create_array, ( USES_REGS1 )); static Int p_create_array( USES_REGS1 );
STATIC_PROTO(Int p_create_mmapped_array, ( USES_REGS1 )); static Int p_create_mmapped_array( USES_REGS1 );
STATIC_PROTO(Int p_array_references, ( USES_REGS1 )); static Int p_array_references( USES_REGS1 );
STATIC_PROTO(Int p_create_static_array, ( USES_REGS1 )); static Int p_create_static_array( USES_REGS1 );
STATIC_PROTO(Int p_resize_static_array, ( USES_REGS1 )); static Int p_resize_static_array( USES_REGS1 );
STATIC_PROTO(Int p_close_static_array, ( USES_REGS1 )); static Int p_close_static_array( USES_REGS1 );
STATIC_PROTO(Int p_access_array, ( USES_REGS1 )); static Int p_access_array( USES_REGS1 );
STATIC_PROTO(Int p_assign_static, ( USES_REGS1 )); static Int p_assign_static( USES_REGS1 );
STATIC_PROTO(Int p_assign_dynamic, ( USES_REGS1 )); static Int p_assign_dynamic( USES_REGS1 );
#if HAVE_MMAP #if HAVE_MMAP

View File

@ -118,6 +118,27 @@ AttVarToTerm(CELL *orig)
return attv->Atts; return attv->Atts;
} }
static int
IsEmptyWakeUp(Term atts)
{
Atom name = NameOfFunctor(FunctorOfTerm(atts));
Atom *pt = EmptyWakeups;
int i = 0;
while (i < MaxEmptyWakeups) {
if (pt[i++] == name) return TRUE;
}
return FALSE;
}
void
Yap_MkEmptyWakeUp(Atom mod)
{
if (MaxEmptyWakeups == MAX_EMPTY_WAKEUPS)
Yap_Error(SYSTEM_ERROR, TermNil, "too many modules that do not wake up");
EmptyWakeups[MaxEmptyWakeups++] = mod;
}
static int static int
TermToAttVar(Term attvar, Term to USES_REGS) TermToAttVar(Term attvar, Term to USES_REGS)
{ {
@ -165,6 +186,11 @@ WakeAttVar(CELL* pt1, CELL reg2 USES_REGS)
return; return;
} }
} }
if (IsEmptyWakeUp(attv->Atts)) {
Bind_Global_NonAtt(&(attv->Value), reg2);
Bind_Global_NonAtt(&(attv->Done), attv->Value);
return;
}
if (!IsVarTerm(attv->Value) || !IsUnboundVar(&attv->Value)) { if (!IsVarTerm(attv->Value) || !IsUnboundVar(&attv->Value)) {
/* oops, our goal is on the queue to be woken */ /* oops, our goal is on the queue to be woken */
if (!Yap_unify(attv->Value, reg2)) { if (!Yap_unify(attv->Value, reg2)) {

View File

@ -377,196 +377,196 @@
#define X_API #define X_API
#endif #endif
X_API Term STD_PROTO(YAP_A,(int)); X_API Term YAP_A(int);
X_API Term STD_PROTO(YAP_Deref,(Term)); X_API Term YAP_Deref(Term);
X_API Term STD_PROTO(YAP_MkVarTerm,(void)); X_API Term YAP_MkVarTerm(void);
X_API Bool STD_PROTO(YAP_IsVarTerm,(Term)); X_API Bool YAP_IsVarTerm(Term);
X_API Bool STD_PROTO(YAP_IsNonVarTerm,(Term)); X_API Bool YAP_IsNonVarTerm(Term);
X_API Bool STD_PROTO(YAP_IsIntTerm,(Term)); X_API Bool YAP_IsIntTerm(Term);
X_API Bool STD_PROTO(YAP_IsLongIntTerm,(Term)); X_API Bool YAP_IsLongIntTerm(Term);
X_API Bool STD_PROTO(YAP_IsBigNumTerm,(Term)); X_API Bool YAP_IsBigNumTerm(Term);
X_API Bool STD_PROTO(YAP_IsNumberTerm,(Term)); X_API Bool YAP_IsNumberTerm(Term);
X_API Bool STD_PROTO(YAP_IsRationalTerm,(Term)); X_API Bool YAP_IsRationalTerm(Term);
X_API Bool STD_PROTO(YAP_IsFloatTerm,(Term)); X_API Bool YAP_IsFloatTerm(Term);
X_API Bool STD_PROTO(YAP_IsDbRefTerm,(Term)); X_API Bool YAP_IsDbRefTerm(Term);
X_API Bool STD_PROTO(YAP_IsAtomTerm,(Term)); X_API Bool YAP_IsAtomTerm(Term);
X_API Bool STD_PROTO(YAP_IsPairTerm,(Term)); X_API Bool YAP_IsPairTerm(Term);
X_API Bool STD_PROTO(YAP_IsApplTerm,(Term)); X_API Bool YAP_IsApplTerm(Term);
X_API Bool STD_PROTO(YAP_IsCompoundTerm,(Term)); X_API Bool YAP_IsCompoundTerm(Term);
X_API Bool STD_PROTO(YAP_IsExternalDataInStackTerm,(Term)); X_API Bool YAP_IsExternalDataInStackTerm(Term);
X_API Bool STD_PROTO(YAP_IsOpaqueObjectTerm,(Term, int)); X_API Bool YAP_IsOpaqueObjectTerm(Term, int);
X_API Term STD_PROTO(YAP_MkIntTerm,(Int)); X_API Term YAP_MkIntTerm(Int);
X_API Term STD_PROTO(YAP_MkBigNumTerm,(void *)); X_API Term YAP_MkBigNumTerm(void *);
X_API Term STD_PROTO(YAP_MkRationalTerm,(void *)); X_API Term YAP_MkRationalTerm(void *);
X_API Int STD_PROTO(YAP_IntOfTerm,(Term)); X_API Int YAP_IntOfTerm(Term);
X_API void STD_PROTO(YAP_BigNumOfTerm,(Term, void *)); X_API void YAP_BigNumOfTerm(Term, void *);
X_API void STD_PROTO(YAP_RationalOfTerm,(Term, void *)); X_API void YAP_RationalOfTerm(Term, void *);
X_API Term STD_PROTO(YAP_MkFloatTerm,(flt)); X_API Term YAP_MkFloatTerm(flt);
X_API flt STD_PROTO(YAP_FloatOfTerm,(Term)); X_API flt YAP_FloatOfTerm(Term);
X_API Term STD_PROTO(YAP_MkAtomTerm,(Atom)); X_API Term YAP_MkAtomTerm(Atom);
X_API Atom STD_PROTO(YAP_AtomOfTerm,(Term)); X_API Atom YAP_AtomOfTerm(Term);
X_API Atom STD_PROTO(YAP_LookupAtom,(char *)); X_API Atom YAP_LookupAtom(char *);
X_API Atom STD_PROTO(YAP_LookupWideAtom,(wchar_t *)); X_API Atom YAP_LookupWideAtom(wchar_t *);
X_API size_t STD_PROTO(YAP_AtomNameLength,(Atom)); X_API size_t YAP_AtomNameLength(Atom);
X_API Atom STD_PROTO(YAP_FullLookupAtom,(char *)); X_API Atom YAP_FullLookupAtom(char *);
X_API int STD_PROTO(YAP_IsWideAtom,(Atom)); X_API int YAP_IsWideAtom(Atom);
X_API char *STD_PROTO(YAP_AtomName,(Atom)); X_API char *YAP_AtomName(Atom);
X_API wchar_t *STD_PROTO(YAP_WideAtomName,(Atom)); X_API wchar_t *YAP_WideAtomName(Atom);
X_API Term STD_PROTO(YAP_MkPairTerm,(Term,Term)); X_API Term YAP_MkPairTerm(Term,Term);
X_API Term STD_PROTO(YAP_MkListFromTerms,(Term *,Int)); X_API Term YAP_MkListFromTerms(Term *,Int);
X_API Term STD_PROTO(YAP_MkNewPairTerm,(void)); X_API Term YAP_MkNewPairTerm(void);
X_API Term STD_PROTO(YAP_HeadOfTerm,(Term)); X_API Term YAP_HeadOfTerm(Term);
X_API Term STD_PROTO(YAP_TailOfTerm,(Term)); X_API Term YAP_TailOfTerm(Term);
X_API Int STD_PROTO(YAP_SkipList,(Term *, Term **)); X_API Int YAP_SkipList(Term *, Term **);
X_API Term STD_PROTO(YAP_MkApplTerm,(Functor,UInt,Term *)); X_API Term YAP_MkApplTerm(Functor,UInt,Term *);
X_API Term STD_PROTO(YAP_MkNewApplTerm,(Functor,UInt)); X_API Term YAP_MkNewApplTerm(Functor,UInt);
X_API Functor STD_PROTO(YAP_FunctorOfTerm,(Term)); X_API Functor YAP_FunctorOfTerm(Term);
X_API Term STD_PROTO(YAP_ArgOfTerm,(Int,Term)); X_API Term YAP_ArgOfTerm(Int,Term);
X_API Term *STD_PROTO(YAP_ArgsOfTerm,(Term)); X_API Term *YAP_ArgsOfTerm(Term);
X_API Functor STD_PROTO(YAP_MkFunctor,(Atom,Int)); X_API Functor YAP_MkFunctor(Atom,Int);
X_API Atom STD_PROTO(YAP_NameOfFunctor,(Functor)); X_API Atom YAP_NameOfFunctor(Functor);
X_API Int STD_PROTO(YAP_ArityOfFunctor,(Functor)); X_API Int YAP_ArityOfFunctor(Functor);
X_API void *STD_PROTO(YAP_ExtraSpace,(void)); X_API void *YAP_ExtraSpace(void);
X_API void STD_PROTO(YAP_cut_up,(void)); X_API void YAP_cut_up(void);
X_API Int STD_PROTO(YAP_Unify,(Term,Term)); X_API Int YAP_Unify(Term,Term);
X_API int STD_PROTO(YAP_Unifiable,(Term,Term)); X_API int YAP_Unifiable(Term,Term);
X_API int STD_PROTO(YAP_Reset,(void)); X_API int YAP_Reset(void);
X_API Int STD_PROTO(YAP_ListLength,(Term)); X_API Int YAP_ListLength(Term);
X_API Int STD_PROTO(YAP_Init,(YAP_init_args *)); X_API Int YAP_Init(YAP_init_args *);
X_API Int STD_PROTO(YAP_FastInit,(char *)); X_API Int YAP_FastInit(char *);
X_API PredEntry *STD_PROTO(YAP_FunctorToPred,(Functor)); X_API PredEntry *YAP_FunctorToPred(Functor);
X_API PredEntry *STD_PROTO(YAP_AtomToPred,(Atom)); X_API PredEntry *YAP_AtomToPred(Atom);
X_API PredEntry *STD_PROTO(YAP_FunctorToPredInModule,(Functor, Term)); X_API PredEntry *YAP_FunctorToPredInModule(Functor, Term);
X_API PredEntry *STD_PROTO(YAP_AtomToPredInModule,(Atom, Term)); X_API PredEntry *YAP_AtomToPredInModule(Atom, Term);
X_API Int STD_PROTO(YAP_CallProlog,(Term)); X_API Int YAP_CallProlog(Term);
X_API void *STD_PROTO(YAP_AllocSpaceFromYap,(size_t)); X_API void *YAP_AllocSpaceFromYap(size_t);
X_API void *STD_PROTO(YAP_ReallocSpaceFromYap,(void*,size_t)); X_API void *YAP_ReallocSpaceFromYap(void*,size_t);
X_API void STD_PROTO(YAP_FreeSpaceFromYap,(void *)); X_API void YAP_FreeSpaceFromYap(void *);
X_API int STD_PROTO(YAP_StringToBuffer, (Term, char *, unsigned int)); X_API int YAP_StringToBuffer(Term, char *, unsigned int);
X_API Term STD_PROTO(YAP_ReadBuffer, (char *,Term *)); X_API Term YAP_ReadBuffer(char *,Term *);
X_API Term STD_PROTO(YAP_FloatsToList, (double *, size_t)); X_API Term YAP_FloatsToList(double *, size_t);
X_API Int STD_PROTO(YAP_ListToFloats, (Term, double *, size_t)); X_API Int YAP_ListToFloats(Term, double *, size_t);
X_API Term STD_PROTO(YAP_IntsToList, (Int *, size_t)); X_API Term YAP_IntsToList(Int *, size_t);
X_API Int STD_PROTO(YAP_ListToInts, (Term, Int *, size_t)); X_API Int YAP_ListToInts(Term, Int *, size_t);
X_API Term STD_PROTO(YAP_BufferToString, (char *)); X_API Term YAP_BufferToString(char *);
X_API Term STD_PROTO(YAP_NBufferToString, (char *, size_t)); X_API Term YAP_NBufferToString(char *, size_t);
X_API Term STD_PROTO(YAP_WideBufferToString, (wchar_t *)); X_API Term YAP_WideBufferToString(wchar_t *);
X_API Term STD_PROTO(YAP_NWideBufferToString, (wchar_t *, size_t)); X_API Term YAP_NWideBufferToString(wchar_t *, size_t);
X_API Term STD_PROTO(YAP_BufferToAtomList, (char *)); X_API Term YAP_BufferToAtomList(char *);
X_API Term STD_PROTO(YAP_NBufferToAtomList, (char *,size_t)); X_API Term YAP_NBufferToAtomList(char *,size_t);
X_API Term STD_PROTO(YAP_WideBufferToAtomList, (wchar_t *)); X_API Term YAP_WideBufferToAtomList(wchar_t *);
X_API Term STD_PROTO(YAP_NWideBufferToAtomList, (wchar_t *, size_t)); X_API Term YAP_NWideBufferToAtomList(wchar_t *, size_t);
X_API Term STD_PROTO(YAP_NWideBufferToAtomDiffList, (wchar_t *, Term, size_t)); X_API Term YAP_NWideBufferToAtomDiffList(wchar_t *, Term, size_t);
X_API Term STD_PROTO(YAP_BufferToDiffList, (char *, Term)); X_API Term YAP_BufferToDiffList(char *, Term);
X_API Term STD_PROTO(YAP_NBufferToDiffList, (char *, Term, size_t)); X_API Term YAP_NBufferToDiffList(char *, Term, size_t);
X_API Term STD_PROTO(YAP_WideBufferToDiffList, (wchar_t *, Term)); X_API Term YAP_WideBufferToDiffList(wchar_t *, Term);
X_API Term STD_PROTO(YAP_NWideBufferToDiffList, (wchar_t *, Term, size_t)); X_API Term YAP_NWideBufferToDiffList(wchar_t *, Term, size_t);
X_API void STD_PROTO(YAP_Error,(int, Term, char *, ...)); X_API void YAP_Error(int, Term, char *, ...);
X_API Int STD_PROTO(YAP_RunPredicate,(PredEntry *, Term *)); X_API Int YAP_RunPredicate(PredEntry *, Term *);
X_API Int STD_PROTO(YAP_RunGoal,(Term)); X_API Int YAP_RunGoal(Term);
X_API Int STD_PROTO(YAP_RunGoalOnce,(Term)); X_API Int YAP_RunGoalOnce(Term);
X_API int STD_PROTO(YAP_RestartGoal,(void)); X_API int YAP_RestartGoal(void);
X_API int STD_PROTO(YAP_ShutdownGoal,(int)); X_API int YAP_ShutdownGoal(int);
X_API int STD_PROTO(YAP_EnterGoal,(PredEntry *, Term *, YAP_dogoalinfo *)); X_API int YAP_EnterGoal(PredEntry *, Term *, YAP_dogoalinfo *);
X_API int STD_PROTO(YAP_RetryGoal,(YAP_dogoalinfo *)); X_API int YAP_RetryGoal(YAP_dogoalinfo *);
X_API int STD_PROTO(YAP_LeaveGoal,(int, YAP_dogoalinfo *)); X_API int YAP_LeaveGoal(int, YAP_dogoalinfo *);
X_API int STD_PROTO(YAP_GoalHasException,(Term *)); X_API int YAP_GoalHasException(Term *);
X_API void STD_PROTO(YAP_ClearExceptions,(void)); X_API void YAP_ClearExceptions(void);
X_API int STD_PROTO(YAP_ContinueGoal,(void)); X_API int YAP_ContinueGoal(void);
X_API void STD_PROTO(YAP_PruneGoal,(YAP_dogoalinfo *)); X_API void YAP_PruneGoal(YAP_dogoalinfo *);
X_API IOSTREAM *STD_PROTO(YAP_TermToStream,(Term)); X_API IOSTREAM *YAP_TermToStream(Term);
X_API IOSTREAM *STD_PROTO(YAP_InitConsult,(int, char *)); X_API IOSTREAM *YAP_InitConsult(int, char *);
X_API void STD_PROTO(YAP_EndConsult,(IOSTREAM *)); X_API void YAP_EndConsult(IOSTREAM *);
X_API Term STD_PROTO(YAP_Read, (IOSTREAM *)); X_API Term YAP_Read(IOSTREAM *);
X_API void STD_PROTO(YAP_Write, (Term, IOSTREAM *, int)); X_API void YAP_Write(Term, IOSTREAM *, int);
X_API Term STD_PROTO(YAP_CopyTerm, (Term)); X_API Term YAP_CopyTerm(Term);
X_API int STD_PROTO(YAP_WriteBuffer, (Term, char *, size_t, int)); X_API int YAP_WriteBuffer(Term, char *, size_t, int);
X_API char *STD_PROTO(YAP_WriteDynamicBuffer, (Term, char *, size_t, size_t *, int *, int)); X_API char *YAP_WriteDynamicBuffer(Term, char *, size_t, size_t *, int *, int);
X_API char *STD_PROTO(YAP_CompileClause, (Term)); X_API char *YAP_CompileClause(Term);
X_API void STD_PROTO(YAP_PutValue, (Atom,Term)); X_API void YAP_PutValue(Atom,Term);
X_API Term STD_PROTO(YAP_GetValue, (Atom)); X_API Term YAP_GetValue(Atom);
X_API int STD_PROTO(YAP_CompareTerms, (Term,Term)); X_API int YAP_CompareTerms(Term,Term);
X_API void STD_PROTO(YAP_Exit, (int)); X_API void YAP_Exit(int);
X_API void STD_PROTO(YAP_InitSocks, (char *, long)); X_API void YAP_InitSocks(char *, long);
X_API void STD_PROTO(YAP_SetOutputMessage, (void)); X_API void YAP_SetOutputMessage(void);
X_API int STD_PROTO(YAP_StreamToFileNo, (Term)); X_API int YAP_StreamToFileNo(Term);
X_API void STD_PROTO(YAP_CloseAllOpenStreams,(void)); X_API void YAP_CloseAllOpenStreams(void);
X_API void STD_PROTO(YAP_FlushAllStreams,(void)); X_API void YAP_FlushAllStreams(void);
X_API Int STD_PROTO(YAP_CurrentSlot,(void)); X_API Int YAP_CurrentSlot(void);
X_API Int STD_PROTO(YAP_NewSlots,(int)); X_API Int YAP_NewSlots(int);
X_API Int STD_PROTO(YAP_InitSlot,(Term)); X_API Int YAP_InitSlot(Term);
X_API Term STD_PROTO(YAP_GetFromSlot,(Int)); X_API Term YAP_GetFromSlot(Int);
X_API Term *STD_PROTO(YAP_AddressFromSlot,(Int)); X_API Term *YAP_AddressFromSlot(Int);
X_API Term *STD_PROTO(YAP_AddressOfTermInSlot,(Int)); X_API Term *YAP_AddressOfTermInSlot(Int);
X_API void STD_PROTO(YAP_PutInSlot,(Int, Term)); X_API void YAP_PutInSlot(Int, Term);
X_API int STD_PROTO(YAP_RecoverSlots,(int)); X_API int YAP_RecoverSlots(int);
X_API Int STD_PROTO(YAP_ArgsToSlots,(int)); X_API Int YAP_ArgsToSlots(int);
X_API void STD_PROTO(YAP_SlotsToArgs,(int, Int)); X_API void YAP_SlotsToArgs(int, Int);
X_API void STD_PROTO(YAP_Throw,(Term)); X_API void YAP_Throw(Term);
X_API void STD_PROTO(YAP_AsyncThrow,(Term)); X_API void YAP_AsyncThrow(Term);
X_API void STD_PROTO(YAP_Halt,(int)); X_API void YAP_Halt(int);
X_API Term *STD_PROTO(YAP_TopOfLocalStack,(void)); X_API Term *YAP_TopOfLocalStack(void);
X_API void *STD_PROTO(YAP_Predicate,(Atom,UInt,Term)); X_API void *YAP_Predicate(Atom,UInt,Term);
X_API void STD_PROTO(YAP_PredicateInfo,(void *,Atom *,UInt *,Term *)); X_API void YAP_PredicateInfo(void *,Atom *,UInt *,Term *);
X_API void STD_PROTO(YAP_UserCPredicate,(char *,CPredicate,UInt)); X_API void YAP_UserCPredicate(char *,CPredicate,UInt);
X_API void STD_PROTO(YAP_UserBackCPredicate,(char *,CPredicate,CPredicate,UInt,unsigned int)); X_API void YAP_UserBackCPredicate(char *,CPredicate,CPredicate,UInt,unsigned int);
X_API void STD_PROTO(YAP_UserCPredicateWithArgs,(char *,CPredicate,UInt,Term)); X_API void YAP_UserCPredicateWithArgs(char *,CPredicate,UInt,Term);
#ifdef CUT_C #ifdef CUT_C
X_API void STD_PROTO(YAP_UserBackCutCPredicate,(char *,CPredicate,CPredicate,CPredicate,UInt,unsigned int)); X_API void YAP_UserBackCutCPredicate(char *,CPredicate,CPredicate,CPredicate,UInt,unsigned int);
X_API void *STD_PROTO(YAP_ExtraSpaceCut,(void)); X_API void *YAP_ExtraSpaceCut(void);
#endif #endif
X_API Term STD_PROTO(YAP_SetCurrentModule,(Term)); X_API Term YAP_SetCurrentModule(Term);
X_API Term STD_PROTO(YAP_CurrentModule,(void)); X_API Term YAP_CurrentModule(void);
X_API Term STD_PROTO(YAP_CreateModule,(Atom)); X_API Term YAP_CreateModule(Atom);
X_API Term STD_PROTO(YAP_StripModule,(Term, Term *)); X_API Term YAP_StripModule(Term, Term *);
X_API int STD_PROTO(YAP_ThreadSelf,(void)); X_API int YAP_ThreadSelf(void);
X_API int STD_PROTO(YAP_ThreadCreateEngine,(struct thread_attr_struct *)); X_API int YAP_ThreadCreateEngine(struct thread_attr_struct *);
X_API int STD_PROTO(YAP_ThreadAttachEngine,(int)); X_API int YAP_ThreadAttachEngine(int);
X_API int STD_PROTO(YAP_ThreadDetachEngine,(int)); X_API int YAP_ThreadDetachEngine(int);
X_API int STD_PROTO(YAP_ThreadDestroyEngine,(int)); X_API int YAP_ThreadDestroyEngine(int);
X_API Term STD_PROTO(YAP_MkBlobTerm,(unsigned int)); X_API Term YAP_MkBlobTerm(unsigned int);
X_API void *STD_PROTO(YAP_BlobOfTerm,(Term)); X_API void *YAP_BlobOfTerm(Term);
X_API Term STD_PROTO(YAP_TermNil,(void)); X_API Term YAP_TermNil(void);
X_API int STD_PROTO(YAP_IsTermNil,(Term)); X_API int YAP_IsTermNil(Term);
X_API int STD_PROTO(YAP_AtomGetHold,(Atom)); X_API int YAP_AtomGetHold(Atom);
X_API int STD_PROTO(YAP_AtomReleaseHold,(Atom)); X_API int YAP_AtomReleaseHold(Atom);
X_API Agc_hook STD_PROTO(YAP_AGCRegisterHook,(Agc_hook)); X_API Agc_hook YAP_AGCRegisterHook(Agc_hook);
X_API int STD_PROTO(YAP_HaltRegisterHook,(HaltHookFunc, void *)); X_API int YAP_HaltRegisterHook(HaltHookFunc, void *);
X_API char *STD_PROTO(YAP_cwd,(void)); X_API char *YAP_cwd(void);
X_API Term STD_PROTO(YAP_OpenList,(int)); X_API Term YAP_OpenList(int);
X_API Term STD_PROTO(YAP_ExtendList,(Term, Term)); X_API Term YAP_ExtendList(Term, Term);
X_API int STD_PROTO(YAP_CloseList,(Term, Term)); X_API int YAP_CloseList(Term, Term);
X_API int STD_PROTO(YAP_IsAttVar,(Term)); X_API int YAP_IsAttVar(Term);
X_API Term STD_PROTO(YAP_AttsOfVar,(Term)); X_API Term YAP_AttsOfVar(Term);
X_API int STD_PROTO(YAP_FileNoFromStream,(Term)); X_API int YAP_FileNoFromStream(Term);
X_API void *STD_PROTO(YAP_FileDescriptorFromStream,(Term)); X_API void *YAP_FileDescriptorFromStream(Term);
X_API void *STD_PROTO(YAP_Record,(Term)); X_API void *YAP_Record(Term);
X_API Term STD_PROTO(YAP_Recorded,(void *)); X_API Term YAP_Recorded(void *);
X_API int STD_PROTO(YAP_Erase,(void *)); X_API int YAP_Erase(void *);
X_API int STD_PROTO(YAP_Variant,(Term, Term)); X_API int YAP_Variant(Term, Term);
X_API Int STD_PROTO(YAP_NumberVars,(Term, Int)); X_API Int YAP_NumberVars(Term, Int);
X_API Term STD_PROTO(YAP_UnNumberVars,(Term)); X_API Term YAP_UnNumberVars(Term);
X_API int STD_PROTO(YAP_IsNumberedVariable,(Term)); X_API int YAP_IsNumberedVariable(Term);
X_API int STD_PROTO(YAP_ExactlyEqual,(Term, Term)); X_API int YAP_ExactlyEqual(Term, Term);
X_API Int STD_PROTO(YAP_TermHash,(Term, Int, Int, int)); X_API Int YAP_TermHash(Term, Int, Int, int);
X_API void STD_PROTO(YAP_signal,(int)); X_API void YAP_signal(int);
X_API int STD_PROTO(YAP_SetYAPFlag,(yap_flag_t, int)); X_API int YAP_SetYAPFlag(yap_flag_t, int);
X_API Int STD_PROTO(YAP_VarSlotToNumber,(Int)); X_API Int YAP_VarSlotToNumber(Int);
X_API Term STD_PROTO(YAP_ModuleUser,(void)); X_API Term YAP_ModuleUser(void);
X_API Int STD_PROTO(YAP_NumberOfClausesForPredicate,(PredEntry *)); X_API Int YAP_NumberOfClausesForPredicate(PredEntry *);
X_API int STD_PROTO(YAP_MaxOpPriority,(Atom, Term)); X_API int YAP_MaxOpPriority(Atom, Term);
X_API int STD_PROTO(YAP_OpInfo,(Atom, Term, int, int *, int *)); X_API int YAP_OpInfo(Atom, Term, int, int *, int *);
X_API Term STD_PROTO(YAP_AllocExternalDataInStack,(size_t)); X_API Term YAP_AllocExternalDataInStack(size_t);
X_API void *STD_PROTO(YAP_ExternalDataInStackFromTerm,(Term)); X_API void *YAP_ExternalDataInStackFromTerm(Term);
X_API int STD_PROTO(YAP_NewOpaqueType,(void *)); X_API int YAP_NewOpaqueType(void *);
X_API Term STD_PROTO(YAP_NewOpaqueObject,(int, size_t)); X_API Term YAP_NewOpaqueObject(int, size_t);
X_API void *STD_PROTO(YAP_OpaqueObjectFromTerm,(Term)); X_API void *YAP_OpaqueObjectFromTerm(Term);
X_API int STD_PROTO(YAP_Argv,(char *** argvp)); X_API int YAP_Argv(char *** argvp);
X_API YAP_tag_t STD_PROTO(YAP_TagOfTerm,(Term)); X_API YAP_tag_t YAP_TagOfTerm(Term);
X_API size_t STD_PROTO(YAP_ExportTerm,(Term, char *, size_t)); X_API size_t YAP_ExportTerm(Term, char *, size_t);
X_API size_t STD_PROTO(YAP_SizeOfExportedTerm,(char *)); X_API size_t YAP_SizeOfExportedTerm(char *);
X_API Term STD_PROTO(YAP_ImportTerm,(char *)); X_API Term YAP_ImportTerm(char *);
X_API int STD_PROTO(YAP_RequiresExtraStack,(size_t)); X_API int YAP_RequiresExtraStack(size_t);
static UInt static UInt
current_arity(void) current_arity(void)

View File

@ -473,53 +473,53 @@ static char SccsId[] = "@(#)cdmgr.c 1.1 05/02/98";
#endif #endif
STATIC_PROTO(void retract_all, (PredEntry *, int)); static void retract_all(PredEntry *, int);
STATIC_PROTO(void add_first_static, (PredEntry *, yamop *, int)); static void add_first_static(PredEntry *, yamop *, int);
STATIC_PROTO(void add_first_dynamic, (PredEntry *, yamop *, int)); static void add_first_dynamic(PredEntry *, yamop *, int);
STATIC_PROTO(void asserta_stat_clause, (PredEntry *, yamop *, int)); static void asserta_stat_clause(PredEntry *, yamop *, int);
STATIC_PROTO(void asserta_dynam_clause, (PredEntry *, yamop *)); static void asserta_dynam_clause(PredEntry *, yamop *);
STATIC_PROTO(void assertz_stat_clause, (PredEntry *, yamop *, int)); static void assertz_stat_clause(PredEntry *, yamop *, int);
STATIC_PROTO(void assertz_dynam_clause, (PredEntry *, yamop *)); static void assertz_dynam_clause(PredEntry *, yamop *);
STATIC_PROTO(void expand_consult, ( void )); static void expand_consult( void );
STATIC_PROTO(int not_was_reconsulted, (PredEntry *, Term, int)); static int not_was_reconsulted(PredEntry *, Term, int);
STATIC_PROTO(int RemoveIndexation, (PredEntry *)); static int RemoveIndexation(PredEntry *);
STATIC_PROTO(int static_in_use, (PredEntry *, int)); static int static_in_use(PredEntry *, int);
#if !defined(YAPOR) && !defined(THREADS) #if !defined(YAPOR) && !defined(THREADS)
STATIC_PROTO(Int search_for_static_predicate_in_use, (PredEntry *, int)); static Int search_for_static_predicate_in_use(PredEntry *, int);
STATIC_PROTO(void mark_pred, (int, PredEntry *)); static void mark_pred(int, PredEntry *);
STATIC_PROTO(void do_toggle_static_predicates_in_use, (int)); static void do_toggle_static_predicates_in_use(int);
#endif #endif
STATIC_PROTO(Int p_number_of_clauses, ( USES_REGS1 )); static Int p_number_of_clauses( USES_REGS1 );
STATIC_PROTO(Int p_compile, ( USES_REGS1 )); static Int p_compile( USES_REGS1 );
STATIC_PROTO(Int p_compile_dynamic, ( USES_REGS1 )); static Int p_compile_dynamic( USES_REGS1 );
STATIC_PROTO(Int p_purge_clauses, ( USES_REGS1 )); static Int p_purge_clauses( USES_REGS1 );
STATIC_PROTO(Int p_setspy, ( USES_REGS1 )); static Int p_setspy( USES_REGS1 );
STATIC_PROTO(Int p_rmspy, ( USES_REGS1 )); static Int p_rmspy( USES_REGS1 );
STATIC_PROTO(Int p_startconsult, ( USES_REGS1 )); static Int p_startconsult( USES_REGS1 );
STATIC_PROTO(Int p_showconslultlev, ( USES_REGS1 )); static Int p_showconslultlev( USES_REGS1 );
STATIC_PROTO(Int p_endconsult, ( USES_REGS1 )); static Int p_endconsult( USES_REGS1 );
STATIC_PROTO(Int p_undefined, ( USES_REGS1 )); static Int p_undefined( USES_REGS1 );
STATIC_PROTO(Int p_in_use, ( USES_REGS1 )); static Int p_in_use( USES_REGS1 );
STATIC_PROTO(Int p_new_multifile, ( USES_REGS1 )); static Int p_new_multifile( USES_REGS1 );
STATIC_PROTO(Int p_is_multifile, ( USES_REGS1 )); static Int p_is_multifile( USES_REGS1 );
STATIC_PROTO(Int p_optimizer_on, ( USES_REGS1 )); static Int p_optimizer_on( USES_REGS1 );
STATIC_PROTO(Int p_optimizer_off, ( USES_REGS1 )); static Int p_optimizer_off( USES_REGS1 );
STATIC_PROTO(Int p_is_dynamic, ( USES_REGS1 )); static Int p_is_dynamic( USES_REGS1 );
STATIC_PROTO(Int p_kill_dynamic, ( USES_REGS1 )); static Int p_kill_dynamic( USES_REGS1 );
STATIC_PROTO(Int p_compile_mode, ( USES_REGS1 )); static Int p_compile_mode( USES_REGS1 );
STATIC_PROTO(Int p_is_profiled, ( USES_REGS1 )); static Int p_is_profiled( USES_REGS1 );
STATIC_PROTO(Int p_profile_info, ( USES_REGS1 )); static Int p_profile_info( USES_REGS1 );
STATIC_PROTO(Int p_profile_reset, ( USES_REGS1 )); static Int p_profile_reset( USES_REGS1 );
STATIC_PROTO(Int p_is_call_counted, ( USES_REGS1 )); static Int p_is_call_counted( USES_REGS1 );
STATIC_PROTO(Int p_call_count_info, ( USES_REGS1 )); static Int p_call_count_info( USES_REGS1 );
STATIC_PROTO(Int p_call_count_set, ( USES_REGS1 )); static Int p_call_count_set( USES_REGS1 );
STATIC_PROTO(Int p_call_count_reset, ( USES_REGS1 )); static Int p_call_count_reset( USES_REGS1 );
STATIC_PROTO(Int p_toggle_static_predicates_in_use, ( USES_REGS1 )); static Int p_toggle_static_predicates_in_use( USES_REGS1 );
STATIC_PROTO(Atom YapConsultingFile, ( USES_REGS1 )); static Atom YapConsultingFile( USES_REGS1 );
STATIC_PROTO(Int PredForCode,(yamop *, Atom *, UInt *, Term *)); static Int PredForCode(yamop *, Atom *, UInt *, Term *);
STATIC_PROTO(void kill_first_log_iblock,(LogUpdIndex *, LogUpdIndex *, PredEntry *)); static void kill_first_log_iblock(LogUpdIndex *, LogUpdIndex *, PredEntry *);
STATIC_PROTO(LogUpdIndex *find_owner_log_index,(LogUpdIndex *, yamop *)); static LogUpdIndex *find_owner_log_index(LogUpdIndex *, yamop *);
STATIC_PROTO(StaticIndex *find_owner_static_index,(StaticIndex *, yamop *)); static StaticIndex *find_owner_static_index(StaticIndex *, yamop *);
#define PredArity(p) (p->ArityOfPE) #define PredArity(p) (p->ArityOfPE)
#define TRYCODE(G,F,N) ( (N)<5 ? (op_numbers)((int)F+(N)*3) : G) #define TRYCODE(G,F,N) ( (N)<5 ? (op_numbers)((int)F+(N)*3) : G)

View File

@ -27,20 +27,20 @@ static char SccsId[] = "%W% %G%";
#endif #endif
#include <wchar.h> #include <wchar.h>
STATIC_PROTO(Int compare, (Term, Term)); static Int compare(Term, Term);
STATIC_PROTO(Int p_compare, ( USES_REGS1 )); static Int p_compare( USES_REGS1 );
STATIC_PROTO(Int p_acomp, ( USES_REGS1 )); static Int p_acomp( USES_REGS1 );
STATIC_PROTO(Int a_eq, (Term,Term)); static Int a_eq(Term,Term);
STATIC_PROTO(Int a_dif, (Term,Term)); static Int a_dif(Term,Term);
STATIC_PROTO(Int a_gt, (Term, Term)); static Int a_gt(Term, Term);
STATIC_PROTO(Int a_ge, (Term,Term)); static Int a_ge(Term,Term);
STATIC_PROTO(Int a_lt, (Term,Term)); static Int a_lt(Term,Term);
STATIC_PROTO(Int a_le, (Term,Term)); static Int a_le(Term,Term);
STATIC_PROTO(Int a_noteq, (Term,Term)); static Int a_noteq(Term,Term);
STATIC_PROTO(Int a_gen_lt, (Term,Term)); static Int a_gen_lt(Term,Term);
STATIC_PROTO(Int a_gen_le, (Term,Term)); static Int a_gen_le(Term,Term);
STATIC_PROTO(Int a_gen_gt, (Term,Term)); static Int a_gen_gt(Term,Term);
STATIC_PROTO(Int a_gen_ge, (Term,Term)); static Int a_gen_ge(Term,Term);
#define rfloat(X) ( X > 0.0 ? 1 : ( X == 0.0 ? 0 : -1)) #define rfloat(X) ( X > 0.0 ? 1 : ( X == 0.0 ? 0 : -1))
@ -599,6 +599,13 @@ a_cmp(Term t1, Term t2 USES_REGS)
} }
} }
Int
Yap_acmp(Term t1, Term t2 USES_REGS)
{
Int out = a_cmp(t1, t2 PASS_REGS);
if (LOCAL_ArithError) { Yap_Error(LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage); return FALSE; }
return out;
}
static Int static Int
p_acomp( USES_REGS1 ) p_acomp( USES_REGS1 )

View File

@ -224,35 +224,35 @@ typedef struct compiler_struct_struct {
CIntermediates cint; CIntermediates cint;
} compiler_struct; } compiler_struct;
STATIC_PROTO(int active_branch, (int, int)); static int active_branch(int, int);
STATIC_PROTO(void c_var, (Term, Int, unsigned int, unsigned int, compiler_struct *)); static void c_var(Term, Int, unsigned int, unsigned int, compiler_struct *);
STATIC_PROTO(void reset_vars, (Ventry *)); static void reset_vars(Ventry *);
STATIC_PROTO(Term optimize_ce, (Term, unsigned int, unsigned int, compiler_struct *)); static Term optimize_ce(Term, unsigned int, unsigned int, compiler_struct *);
STATIC_PROTO(void c_arg, (Int, Term, unsigned int, unsigned int, compiler_struct *)); static void c_arg(Int, Term, unsigned int, unsigned int, compiler_struct *);
STATIC_PROTO(void c_args, (Term, unsigned int, compiler_struct *)); static void c_args(Term, unsigned int, compiler_struct *);
STATIC_PROTO(void c_eq, (Term, Term, compiler_struct *)); static void c_eq(Term, Term, compiler_struct *);
STATIC_PROTO(void c_test, (Int, Term, compiler_struct *)); static void c_test(Int, Term, compiler_struct *);
STATIC_PROTO(void c_bifun, (basic_preds, Term, Term, Term, Term, Term, compiler_struct *)); static void c_bifun(basic_preds, Term, Term, Term, Term, Term, compiler_struct *);
STATIC_PROTO(void c_goal, (Term, Term, compiler_struct *)); static void c_goal(Term, Term, compiler_struct *);
STATIC_PROTO(void c_body, (Term, Term, compiler_struct *)); static void c_body(Term, Term, compiler_struct *);
STATIC_PROTO(void c_head, (Term, compiler_struct *)); static void c_head(Term, compiler_struct *);
STATIC_PROTO(int usesvar, (compiler_vm_op)); static int usesvar(compiler_vm_op);
STATIC_PROTO(CELL *init_bvarray, (int, compiler_struct *)); static CELL *init_bvarray(int, compiler_struct *);
#ifdef DEBUG #ifdef DEBUG
STATIC_PROTO(void clear_bvarray, (int, CELL *, compiler_struct *)); static void clear_bvarray(int, CELL *, compiler_struct *);
#else #else
STATIC_PROTO(void clear_bvarray, (int, CELL *)); static void clear_bvarray(int, CELL *);
#endif #endif
STATIC_PROTO(void add_bvarray_op, (PInstr *,CELL *, int, compiler_struct *)); static void add_bvarray_op(PInstr *,CELL *, int, compiler_struct *);
STATIC_PROTO(void AssignPerm, (PInstr *, compiler_struct *)); static void AssignPerm(PInstr *, compiler_struct *);
STATIC_PROTO(void CheckUnsafe, (PInstr *, compiler_struct *)); static void CheckUnsafe(PInstr *, compiler_struct *);
STATIC_PROTO(void CheckVoids, (compiler_struct *)); static void CheckVoids(compiler_struct *);
STATIC_PROTO( int checktemp, (Int, Int, compiler_vm_op, compiler_struct *)); static int checktemp(Int, Int, compiler_vm_op, compiler_struct *);
STATIC_PROTO( Int checkreg, (Int, Int, compiler_vm_op, int, compiler_struct *)); static Int checkreg(Int, Int, compiler_vm_op, int, compiler_struct *);
STATIC_PROTO(void c_layout, (compiler_struct *)); static void c_layout(compiler_struct *);
STATIC_PROTO(void c_optimize, (PInstr *)); static void c_optimize(PInstr *);
#ifdef SFUNC #ifdef SFUNC
STATIC_PROTO(void compile_sf_term, (Term, int)); static void compile_sf_term(Term, int);
#endif #endif
static void static void

View File

@ -67,7 +67,7 @@ static char SccsId[] = "%W% %G%";
#endif #endif
#ifdef DEBUG #ifdef DEBUG
STATIC_PROTO (void ShowOp, (char *, struct PSEUDO *)); static void ShowOp(char *, struct PSEUDO *);
#endif /* DEBUG */ #endif /* DEBUG */
/* /*

118
C/dbase.c
View File

@ -174,70 +174,70 @@ typedef table {
} hash_db_table; } hash_db_table;
#endif #endif
STATIC_PROTO(CELL *cpcells,(CELL *,CELL*,Int)); static CELL *cpcells(CELL *,CELL*,Int);
STATIC_PROTO(void linkblk,(link_entry *,CELL *,CELL)); static void linkblk(link_entry *,CELL *,CELL);
STATIC_PROTO(Int cmpclls,(CELL *,CELL *,Int)); static Int cmpclls(CELL *,CELL *,Int);
STATIC_PROTO(Prop FindDBProp,(AtomEntry *, int, unsigned int, Term)); static Prop FindDBProp(AtomEntry *, int, unsigned int, Term);
STATIC_PROTO(CELL CalcKey, (Term)); static CELL CalcKey(Term);
#ifdef COROUTINING #ifdef COROUTINING
STATIC_PROTO(CELL *MkDBTerm, (CELL *, CELL *, CELL *, CELL *, CELL *, CELL *,int *, struct db_globs *)); static CELL *MkDBTerm(CELL *, CELL *, CELL *, CELL *, CELL *, CELL *,int *, struct db_globs *);
#else #else
STATIC_PROTO(CELL *MkDBTerm, (CELL *, CELL *, CELL *, CELL *, CELL *, int *, struct db_globs *)); static CELL *MkDBTerm(CELL *, CELL *, CELL *, CELL *, CELL *, int *, struct db_globs *);
#endif #endif
STATIC_PROTO(DBRef CreateDBStruct, (Term, DBProp, int, int *, UInt, struct db_globs *)); static DBRef CreateDBStruct(Term, DBProp, int, int *, UInt, struct db_globs *);
STATIC_PROTO(DBRef record, (int, Term, Term, Term CACHE_TYPE)); static DBRef record(int, Term, Term, Term CACHE_TYPE);
STATIC_PROTO(DBRef check_if_cons, (DBRef, Term)); static DBRef check_if_cons(DBRef, Term);
STATIC_PROTO(DBRef check_if_var, (DBRef)); static DBRef check_if_var(DBRef);
STATIC_PROTO(DBRef check_if_wvars, (DBRef, unsigned int, CELL *)); static DBRef check_if_wvars(DBRef, unsigned int, CELL *);
STATIC_PROTO(int scheckcells, (int, CELL *, CELL *, link_entry *, CELL)); static int scheckcells(int, CELL *, CELL *, link_entry *, CELL);
STATIC_PROTO(DBRef check_if_nvars, (DBRef, unsigned int, CELL *, struct db_globs *)); static DBRef check_if_nvars(DBRef, unsigned int, CELL *, struct db_globs *);
STATIC_PROTO(Int p_rcda, ( USES_REGS1 )); static Int p_rcda( USES_REGS1 );
STATIC_PROTO(Int p_rcdap, ( USES_REGS1 )); static Int p_rcdap( USES_REGS1 );
STATIC_PROTO(Int p_rcdz, ( USES_REGS1 )); static Int p_rcdz( USES_REGS1 );
STATIC_PROTO(Int p_rcdzp, ( USES_REGS1 )); static Int p_rcdzp( USES_REGS1 );
STATIC_PROTO(Int p_drcdap, ( USES_REGS1 )); static Int p_drcdap( USES_REGS1 );
STATIC_PROTO(Int p_drcdzp, ( USES_REGS1 )); static Int p_drcdzp( USES_REGS1 );
STATIC_PROTO(Term GetDBTerm, (DBTerm * CACHE_TYPE)); static Term GetDBTerm(DBTerm * CACHE_TYPE);
STATIC_PROTO(DBProp FetchDBPropFromKey, (Term, int, int, char *)); static DBProp FetchDBPropFromKey(Term, int, int, char *);
STATIC_PROTO(Int i_recorded, (DBProp,Term CACHE_TYPE)); static Int i_recorded(DBProp,Term CACHE_TYPE);
STATIC_PROTO(Int c_recorded, (int CACHE_TYPE)); static Int c_recorded(int CACHE_TYPE);
STATIC_PROTO(Int co_rded, ( USES_REGS1 )); static Int co_rded( USES_REGS1 );
STATIC_PROTO(Int in_rdedp, ( USES_REGS1 )); static Int in_rdedp( USES_REGS1 );
STATIC_PROTO(Int co_rdedp, ( USES_REGS1 )); static Int co_rdedp( USES_REGS1 );
STATIC_PROTO(Int p_first_instance, ( USES_REGS1 )); static Int p_first_instance( USES_REGS1 );
STATIC_PROTO(void ErasePendingRefs, (DBTerm * CACHE_TYPE)); static void ErasePendingRefs(DBTerm * CACHE_TYPE);
STATIC_PROTO(void RemoveDBEntry, (DBRef CACHE_TYPE)); static void RemoveDBEntry(DBRef CACHE_TYPE);
STATIC_PROTO(void EraseLogUpdCl, (LogUpdClause *)); static void EraseLogUpdCl(LogUpdClause *);
STATIC_PROTO(void MyEraseClause, (DynamicClause * CACHE_TYPE)); static void MyEraseClause(DynamicClause * CACHE_TYPE);
STATIC_PROTO(void PrepareToEraseClause, (DynamicClause *, DBRef)); static void PrepareToEraseClause(DynamicClause *, DBRef);
STATIC_PROTO(void EraseEntry, (DBRef)); static void EraseEntry(DBRef);
STATIC_PROTO(Int p_erase, ( USES_REGS1 )); static Int p_erase( USES_REGS1 );
STATIC_PROTO(Int p_eraseall, ( USES_REGS1 )); static Int p_eraseall( USES_REGS1 );
STATIC_PROTO(Int p_erased, ( USES_REGS1 )); static Int p_erased( USES_REGS1 );
STATIC_PROTO(Int p_instance, ( USES_REGS1 )); static Int p_instance( USES_REGS1 );
STATIC_PROTO(int NotActiveDB, (DBRef)); static int NotActiveDB(DBRef);
STATIC_PROTO(DBEntry *NextDBProp, (PropEntry *)); static DBEntry *NextDBProp(PropEntry *);
STATIC_PROTO(Int init_current_key, ( USES_REGS1 )); static Int init_current_key( USES_REGS1 );
STATIC_PROTO(Int cont_current_key, ( USES_REGS1 )); static Int cont_current_key( USES_REGS1 );
STATIC_PROTO(Int cont_current_key_integer, ( USES_REGS1 )); static Int cont_current_key_integer( USES_REGS1 );
STATIC_PROTO(Int p_rcdstatp, ( USES_REGS1 )); static Int p_rcdstatp( USES_REGS1 );
STATIC_PROTO(Int p_somercdedp, ( USES_REGS1 )); static Int p_somercdedp( USES_REGS1 );
STATIC_PROTO(yamop * find_next_clause, (DBRef USES_REGS)); static yamop * find_next_clause(DBRef USES_REGS);
STATIC_PROTO(Int p_jump_to_next_dynamic_clause, ( USES_REGS1 )); static Int p_jump_to_next_dynamic_clause( USES_REGS1 );
#ifdef SFUNC #ifdef SFUNC
STATIC_PROTO(void SFVarIn, (Term)); static void SFVarIn(Term);
STATIC_PROTO(void sf_include, (SFKeep *)); static void sf_include(SFKeep *);
#endif #endif
STATIC_PROTO(Int p_init_queue, ( USES_REGS1 )); static Int p_init_queue( USES_REGS1 );
STATIC_PROTO(Int p_enqueue, ( USES_REGS1 )); static Int p_enqueue( USES_REGS1 );
STATIC_PROTO(void keepdbrefs, (DBTerm * CACHE_TYPE)); static void keepdbrefs(DBTerm * CACHE_TYPE);
STATIC_PROTO(Int p_dequeue, ( USES_REGS1 )); static Int p_dequeue( USES_REGS1 );
STATIC_PROTO(void ErDBE, (DBRef CACHE_TYPE)); static void ErDBE(DBRef CACHE_TYPE);
STATIC_PROTO(void ReleaseTermFromDB, (DBTerm * CACHE_TYPE)); static void ReleaseTermFromDB(DBTerm * CACHE_TYPE);
STATIC_PROTO(PredEntry *new_lu_entry, (Term)); static PredEntry *new_lu_entry(Term);
STATIC_PROTO(PredEntry *new_lu_int_key, (Int)); static PredEntry *new_lu_int_key(Int);
STATIC_PROTO(PredEntry *find_lu_entry, (Term)); static PredEntry *find_lu_entry(Term);
STATIC_PROTO(DBProp find_int_key, (Int)); static DBProp find_int_key(Int);
#define db_check_trail(x) { \ #define db_check_trail(x) { \
if (Unsigned(dbg->tofref) == Unsigned(x)) { \ if (Unsigned(dbg->tofref) == Unsigned(x)) { \

View File

@ -29,8 +29,8 @@ static char SccsId[] = "%W% %G%";
#include "Yatom.h" #include "Yatom.h"
STD_PROTO(static Int p_get_depth_limit, ( USES_REGS1 )); static Int p_get_depth_limit( USES_REGS1 );
STD_PROTO(static Int p_set_depth_limit, ( USES_REGS1 )); static Int p_set_depth_limit( USES_REGS1 );
static Int p_get_depth_limit( USES_REGS1 ) static Int p_get_depth_limit( USES_REGS1 )
{ {

View File

@ -41,10 +41,10 @@ Yap_RestartYap ( int flag )
} }
#ifdef DEBUG #ifdef DEBUG
STATIC_PROTO (int hidden, (Atom)); static int hidden(Atom);
STATIC_PROTO (int legal_env, (CELL * CACHE_TYPE)); static int legal_env(CELL * CACHE_TYPE);
void STD_PROTO (DumpActiveGoals, ( CACHE_TYPE1 )); void DumpActiveGoals( CACHE_TYPE1 );
STATIC_PROTO (void detect_bug_location, (yamop *,find_pred_type,char *, int)); static void detect_bug_location(yamop *,find_pred_type,char *, int);
#define ONHEAP(ptr) (CellPtr(ptr) >= CellPtr(Yap_HeapBase) && CellPtr(ptr) < CellPtr(HeapTop)) #define ONHEAP(ptr) (CellPtr(ptr) >= CellPtr(Yap_HeapBase) && CellPtr(ptr) < CellPtr(HeapTop))

130
C/eval.c
View File

@ -223,6 +223,135 @@ Yap_ArithError(yap_error_number type, Term where, char *format,...)
return 0L; return 0L;
} }
static Int cont_between( USES_REGS1 )
{
Term t1 = EXTRA_CBACK_ARG(3,1);
Term t2 = EXTRA_CBACK_ARG(3,2);
Yap_unify(ARG3, t1);
if (IsIntegerTerm(t1)) {
Int i1;
Term tn;
if (t1 == t2)
cut_succeed();
i1 = IntegerOfTerm(t1);
tn = add_int(i1, 1 PASS_REGS);
EXTRA_CBACK_ARG(3,1) = tn;
HB = B->cp_h = H;
return TRUE;
} else {
Term t[2];
Term tn;
Int cmp;
cmp = Yap_acmp(t1, t2);
if (cmp == 0)
cut_succeed();
t[0] = t1;
t[1] = MkIntTerm(1);
tn = Eval(Yap_MkApplTerm(FunctorPlus, 2, t));
EXTRA_CBACK_ARG(3,1) = tn;
HB = B->cp_h = H;
return TRUE;
}
}
static Int
init_between( USES_REGS1 )
{
Term t1 = Deref(ARG1);
Term t2 = Deref(ARG2);
if (IsVarTerm(t1)) {
Yap_Error(INSTANTIATION_ERROR, t1, "between/3");
return FALSE;
}
if (IsVarTerm(t2)) {
Yap_Error(INSTANTIATION_ERROR, t1, "between/3");
return FALSE;
}
if (!IsIntegerTerm(t1) &&
!IsBigIntTerm(t1)) {
Yap_Error(TYPE_ERROR_INTEGER, t1, "between/3");
return FALSE;
}
if (!IsIntegerTerm(t2) &&
!IsBigIntTerm(t2) &&
t2 != MkAtomTerm(AtomInf) &&
t2 != MkAtomTerm(AtomInfinity)) {
Yap_Error(TYPE_ERROR_INTEGER, t2, "between/3");
return FALSE;
}
if (IsIntegerTerm(t1) && IsIntegerTerm(t2)) {
Int i1 = IntegerOfTerm(t1);
Int i2 = IntegerOfTerm(t2);
Term t3;
t3 = Deref(ARG3);
if (!IsVarTerm(t3)) {
if (!IsIntegerTerm(t3)) {
if (!IsBigIntTerm(t3)) {
Yap_Error(TYPE_ERROR_INTEGER, t3, "between/3");
return FALSE;
}
cut_fail();
} else {
Int i3 = IntegerOfTerm(t3);
if (i3 >= i1 && i3 <= i2)
cut_succeed();
cut_fail();
}
}
if (i1 > i2) cut_fail();
if (i1 == i2) {
Yap_unify(ARG3, t1);
cut_succeed();
}
} else if (IsIntegerTerm(t1) && IsAtomTerm(t2)) {
Int i1 = IntegerOfTerm(t1);
Term t3;
t3 = Deref(ARG3);
if (!IsVarTerm(t3)) {
if (!IsIntegerTerm(t3)) {
if (!IsBigIntTerm(t3)) {
Yap_Error(TYPE_ERROR_INTEGER, t3, "between/3");
return FALSE;
}
cut_fail();
} else {
Int i3 = IntegerOfTerm(t3);
if (i3 >= i1)
cut_succeed();
cut_fail();
}
}
} else {
Term t3 = Deref(ARG3);
Int cmp;
if (!IsVarTerm(t3)) {
if (!IsIntegerTerm(t3) && !IsBigIntTerm(t3)) {
Yap_Error(TYPE_ERROR_INTEGER, t3, "between/3");
return FALSE;
}
if (Yap_acmp(t3, t1) >= 0 && Yap_acmp(t2,t3) >= 0 && P != FAILCODE)
cut_succeed();
cut_fail();
}
cmp = Yap_acmp(t1, t2);
if (cmp > 0) cut_fail();
if (cmp == 0) {
Yap_unify(ARG3, t1);
cut_succeed();
}
}
EXTRA_CBACK_ARG(3,1) = t1;
EXTRA_CBACK_ARG(3,2) = t2;
return cont_between( PASS_REGS1 );
}
void void
Yap_InitEval(void) Yap_InitEval(void)
{ {
@ -231,5 +360,6 @@ Yap_InitEval(void)
Yap_InitUnaryExps(); Yap_InitUnaryExps();
Yap_InitBinaryExps(); Yap_InitBinaryExps();
Yap_InitCPred("is", 2, p_is, 0L); Yap_InitCPred("is", 2, p_is, 0L);
Yap_InitCPredBack("between", 3, 2, init_between, cont_between, 0);
} }

View File

@ -28,11 +28,11 @@ static char SccsId[] = "@(#)cdmgr.c 1.1 05/02/98";
#include "myddas.h" #include "myddas.h"
#endif #endif
STATIC_PROTO(Int CallPredicate, (PredEntry *, choiceptr, yamop * CACHE_TYPE)); static Int CallPredicate(PredEntry *, choiceptr, yamop * CACHE_TYPE);
STATIC_PROTO(Int EnterCreepMode, (Term, Term CACHE_TYPE)); static Int EnterCreepMode(Term, Term CACHE_TYPE);
STATIC_PROTO(Int p_save_cp, ( USES_REGS1 )); static Int p_save_cp( USES_REGS1 );
STATIC_PROTO(Int p_execute, ( USES_REGS1 )); static Int p_execute( USES_REGS1 );
STATIC_PROTO(Int p_execute0, ( USES_REGS1 )); static Int p_execute0( USES_REGS1 );
static int execute_pred(PredEntry *ppe, CELL *pt USES_REGS); static int execute_pred(PredEntry *ppe, CELL *pt USES_REGS);
static Term static Term
@ -1173,6 +1173,7 @@ Yap_PrepGoal(UInt arity, CELL *pt, choiceptr saved_b USES_REGS)
B->cp_depth = DEPTH; B->cp_depth = DEPTH;
#endif /* DEPTH_LIMIT */ #endif /* DEPTH_LIMIT */
YENV = ASP = (CELL *)B; YENV = ASP = (CELL *)B;
YENV[E_CB] = (CELL)B;
HB = H; HB = H;
CP = YESCODE; CP = YESCODE;
} }

28
C/exo.c
View File

@ -222,7 +222,7 @@ add_index(struct index_t **ip, UInt bmap, PredEntry *ap, UInt count)
UInt ncls = ap->cs.p_code.NOfClauses, j; UInt ncls = ap->cs.p_code.NOfClauses, j;
CELL *base = NULL; CELL *base = NULL;
struct index_t *i; struct index_t *i;
size_t sz; size_t sz, dsz;
yamop *ptr; yamop *ptr;
UInt *bnds = LOCAL_ibnds; UInt *bnds = LOCAL_ibnds;
@ -244,21 +244,22 @@ add_index(struct index_t **ip, UInt bmap, PredEntry *ap, UInt count)
i->bmap = bmap; i->bmap = bmap;
i->is_key = FALSE; i->is_key = FALSE;
i->hsize = 2*ncls; i->hsize = 2*ncls;
dsz = sizeof(BITS32)*(ncls+i->hsize);
if (count) { if (count) {
if (!(base = (CELL *)Yap_AllocCodeSpace(sizeof(BITS32)*(ncls+i->hsize)))) { if (!(base = (CELL *)Yap_AllocCodeSpace(dsz))) {
CACHE_REGS CACHE_REGS
save_machine_regs(); save_machine_regs();
LOCAL_Error_Size = sizeof(CELL)*(ncls+i->hsize); LOCAL_Error_Size = dsz;
LOCAL_ErrorMessage = "not enough space to generate indices"; LOCAL_ErrorMessage = "not enough space to generate indices";
Yap_FreeCodeSpace((void *)i); Yap_FreeCodeSpace((void *)i);
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
return NULL; return NULL;
} }
bzero(base, sizeof(CELL)*(ncls+i->hsize)); bzero(base, dsz);
} }
i->size = sizeof(CELL)*(ncls+i->hsize)+sz+sizeof(struct index_t); i->size = sz+dsz+sizeof(struct index_t);
i->key = (CELL *)base; i->key = (BITS32 *)base;
i->links = (CELL *)(base+i->hsize); i->links = (BITS32 *)(base+i->hsize);
i->ncollisions = i->nentries = i->ntrys = 0; i->ncollisions = i->nentries = i->ntrys = 0;
i->cls = (CELL *)((ADDR)ap->cs.p_code.FirstClause+2*sizeof(struct index_t *)); i->cls = (CELL *)((ADDR)ap->cs.p_code.FirstClause+2*sizeof(struct index_t *));
*ip = i; *ip = i;
@ -271,7 +272,7 @@ add_index(struct index_t **ip, UInt bmap, PredEntry *ap, UInt count)
} else { } else {
sz = (ncls+i->hsize)*sizeof(BITS32); sz = (ncls+i->hsize)*sizeof(BITS32);
} }
if (base != realloc(base, sz)) if (base != (CELL *)Yap_ReallocCodeSpace((char *)base, sz))
return FALSE; return FALSE;
bzero(base, sz); bzero(base, sz);
i->key = (CELL *)base; i->key = (CELL *)base;
@ -284,7 +285,7 @@ add_index(struct index_t **ip, UInt bmap, PredEntry *ap, UInt count)
#endif #endif
if (!i->ntrys && !i->is_key) { if (!i->ntrys && !i->is_key) {
i->is_key = TRUE; i->is_key = TRUE;
if (base != realloc(base, i->hsize*sizeof(BITS32))) if (base != (CELL *)Yap_ReallocCodeSpace((char *)base, i->hsize*sizeof(BITS32)))
return FALSE; return FALSE;
} }
/* our hash table is just too large */ /* our hash table is just too large */
@ -296,7 +297,7 @@ add_index(struct index_t **ip, UInt bmap, PredEntry *ap, UInt count)
} else { } else {
sz = (ncls+i->hsize)*sizeof(BITS32); sz = (ncls+i->hsize)*sizeof(BITS32);
} }
if (base != realloc(base, sz)) if (base != (CELL *)Yap_ReallocCodeSpace((char *)base, sz))
return FALSE; return FALSE;
bzero(base, sz); bzero(base, sz);
i->key = (CELL *)base; i->key = (CELL *)base;
@ -381,11 +382,16 @@ Yap_ExoLookup(PredEntry *ap USES_REGS)
} }
if (count) { if (count) {
yamop *code = LOOKUP(i, arity, j0, LOCAL_ibnds); yamop *code = LOOKUP(i, arity, j0, LOCAL_ibnds);
if (code == FAILCODE)
return code;
if (i->is_udi) if (i->is_udi)
return ((CEnterExoIndex)i->udi_first)(i PASS_REGS); return ((CEnterExoIndex)i->udi_first)(i PASS_REGS);
else return code; else return code;
} else } else if(i->is_udi) {
return ((CEnterExoIndex)i->udi_first)(i PASS_REGS);
} else {
return i->code; return i->code;
}
} }
CELL CELL

View File

@ -51,216 +51,205 @@ static int
compare(const BITS32 *ip, Int j USES_REGS) { compare(const BITS32 *ip, Int j USES_REGS) {
BITS32 *bs = LOCAL_exo_base; BITS32 *bs = LOCAL_exo_base;
Int i = bs[LOCAL_exo_arity*(*ip)+LOCAL_exo_arg]; Int i = bs[LOCAL_exo_arity*(*ip)+LOCAL_exo_arg];
/* fprintf(stderr, "%ld-%ld\n", IntOfTerm(i), j); */ //fprintf(stderr, "%ld-%ld\n", IntOfTerm(i), j);
return IntOfTerm(i)-j; return IntOfTerm(i)-j;
} }
static void static void
IntervalUDIRefitIndex(struct index_t **ip, UInt b[] USES_REGS) IntervalUDIRefitIndex(struct index_t **ip, UInt b[] USES_REGS)
{ {
size_t sz; size_t sz;
struct index_t *it = *ip; struct index_t *it = *ip;
BITS32 *sorted0, *sorted; UInt arity = it->arity;
UInt arity = it->arity; yamop *code;
yamop *code;
/* hard-wired implementation for the Interval case */ /* hard-wired implementation for the Interval case */
Int i = it->udi_arg; Int i = it->udi_arg;
/* it is bound, use hash */ /* it is bound, use hash */
if (it->bmap & b[i]) return; if (it->bmap & b[i]) return;
/* no constraints, nothing to gain */ /* no constraints, nothing to gain */
if (!IsAttVar(VarOfTerm(XREGS[i+1]))) return; if (!IsAttVar(VarOfTerm(XREGS[i+1]))) return;
/* be conservative */ LOCAL_exo_base = it->cls;
sz = sizeof(BITS32)*(it->ntrys+it->nentries*2); LOCAL_exo_arity = it->arity;
/* allocate space */ LOCAL_exo_arg = i;
if (!(it->udi_data = malloc(sz))) if (!it->key) {
return; UInt ncls = it->ap->cs.p_code.NOfClauses, i;
sorted0 = sorted = (BITS32 *)it->udi_data; BITS32 *sorted;
sorted++; /* leave an initial hole */ /* handle ll variables */
LOCAL_exo_base = it->cls; sz = sizeof(BITS32)*(ncls);
LOCAL_exo_arity = it->arity; /* allocate space */
LOCAL_exo_arg = i; if (!(it->udi_data = (BITS32*)Yap_AllocCodeSpace(sz)))
for (i=0; i < it->hsize; i++) { return;
if (it->key[i]) { sorted = (BITS32*)it->udi_data;
BITS32 *s0 = sorted; for (i=0; i< ncls; i++)
BITS32 offset = it->key[i]/arity, offset0 = offset; sorted[i] = i;
qsort(sorted, (size_t)ncls, sizeof(BITS32), compar);
*sorted++ = 0; it->links = NULL;
do { } else {
*sorted++ = offset; BITS32 *sorted0, *sorted;
offset = it->links[offset];
} while (offset);
// S = it->cls+it->arity*offset0; Yap_DebugPlWrite(S[1]);
// fprintf(stderr, " key[i]=%d offset=%d %d\n", it->key[i], offset0, (sorted-s0)-1);
if (sorted-s0 == 2) {
it->links[offset0] = 0;
sorted = s0;
} else {
/* number of elements comes first */
*s0 = sorted - (s0+1);
qsort(s0+1, (size_t)*s0, sizeof(BITS32), compar);
it->links[offset0] = s0-sorted0;
}
}
}
it->is_udi = i+1;
code = it->code;
code->opc = Yap_opcode(_try_exo_udi);
code = NEXTOP(code, lp);
code->opc = Yap_opcode(_retry_exo_udi);
}
static yamop * /* be conservative */
Min(struct index_t *it, BITS32 off USES_REGS) sz = sizeof(BITS32)*(2*it->ntrys+it->nentries);
{ /* allocate space */
if (it->links[off]) { if (!(it->udi_data = (BITS32*)Yap_AllocCodeSpace(sz)))
BITS32 *c = (BITS32 *)it->udi_data; return;
BITS32 f = c[it->links[off]+1]; sorted0 = sorted = (BITS32 *)it->udi_data;
S = it->cls+it->arity*f; sorted++; /* leave an initial hole */
} for (i=0; i < it->hsize; i++) {
return NEXTOP(NEXTOP(it->code,lp),lp); if (it->key[i]) {
} BITS32 *s0 = sorted;
BITS32 offset = it->key[i]/arity, offset0 = offset;
static yamop * *sorted++ = 0;
Max(struct index_t *it, BITS32 off USES_REGS) do {
{ *sorted++ = offset;
if (it->links[off]) { offset = it->links[offset];
BITS32 *c = (BITS32 *)it->udi_data; } while (offset);
BITS32 n = c[it->links[off]]; // S = it->cls+it->arity*offset0; Yap_DebugPlWrite(S[1]);
BITS32 f = c[it->links[off]+n]; // fprintf(stderr, " key[i]=%d offset=%d %d\n", it->key[i], offset0, (sorted-s0)-1);
S = it->cls+it->arity*f; if (sorted-s0 == 2) {
} it->links[offset0] = 0;
return NEXTOP(NEXTOP(it->code,lp),lp); sorted = s0;
} } else {
/* number of elements comes first */
*s0 = sorted - (s0+1);
qsort(s0+1, (size_t)*s0, sizeof(BITS32), compar);
it->links[offset0] = s0-sorted0;
}
}
}
sz = sizeof(BITS32)*(sorted-sorted0);
it->udi_data = (BITS32 *)Yap_ReallocCodeSpace((char *)it->udi_data, sz);
}
it->is_udi = i+1;
code = it->code;
code->opc = Yap_opcode(_try_exo_udi);
code = NEXTOP(code, lp);
code->opc = Yap_opcode(_retry_exo_udi);
}
static yamop * static BITS32 *
Gt(struct index_t *it, Int x, BITS32 off USES_REGS) binary_search(BITS32 *start, BITS32 *end, Int x USES_REGS)
{ {
if (it->links[off]) { BITS32 *mid;
BITS32 *c = (BITS32 *)it->udi_data; while (start < end) {
BITS32 n = c[it->links[off]]; int cmp;
mid = start + (end-start)/2;
cmp = compare(mid, x PASS_REGS);
if (!cmp)
return mid;
if (cmp > 0) {
end = mid-1;
} else
start = mid+1;
}
return start;
}
LOCAL_exo_base = it->cls; static yamop *
LOCAL_exo_arity = it->arity; Interval(struct index_t *it, Term min, Term max, Term op, BITS32 off USES_REGS)
LOCAL_exo_arg = it->udi_arg; {
BITS32 *pt = c+(it->links[off]+1); BITS32 *c;
BITS32 *end = c+(it->links[off]+(n+2)); BITS32 n;
if (n > 8 && FALSE) { BITS32 *pt;
// start = binary_search(start,end, x, it); BITS32 *end;
} else { Atom at;
while ( pt < end && compare(pt, x PASS_REGS) <= 0 ) {
pt++;
}
}
if (pt == end)
return FAILCODE;
S = it->cls+it->arity*pt[0];
end --;
if (pt < end ) {
YENV[-2] = (CELL)( pt+1 );
YENV[-1] = (CELL)( end );
YENV -= 2;
return it->code;
}
}
return NEXTOP(NEXTOP(it->code,lp),lp);
}
static yamop * LOCAL_exo_base = it->cls;
Lt(struct index_t *it, Int x, BITS32 off USES_REGS) LOCAL_exo_arity = it->arity;
{ LOCAL_exo_arg = it->udi_arg;
if (it->links[off]) { if (!it->links) {
BITS32 *c = (BITS32 *)it->udi_data; c = (BITS32 *)it->udi_data;
BITS32 n = c[it->links[off]]; n = it->nels;
pt = c;
end = c+(n-1);
} else if (it->links[off]) {
c = (BITS32 *)it->udi_data;
n = c[it->links[off]];
pt = c+(it->links[off]+1);
end = c+(it->links[off]+n);
} else {
return NEXTOP(NEXTOP(it->code,lp),lp);
}
LOCAL_exo_base = it->cls; if (!IsVarTerm(min)) {
LOCAL_exo_arity = it->arity; Int x;
LOCAL_exo_arg = it->udi_arg; if (!IsIntegerTerm(min)) {
BITS32 *start = c+(it->links[off]+1), *pt = start+1; min = Yap_Eval(min);
BITS32 *end = c+(it->links[off]+(n+2)); if (!IsIntegerTerm(min)) {
if (n > 8 && FALSE) { Yap_Error(TYPE_ERROR_INTEGER, min, "data-base constraint");
// start = binary_search(start,end, x, it);
} else {
if (compare(start, x PASS_REGS) >= 0)
return FAILCODE; return FAILCODE;
while ( pt < end && compare(pt, x PASS_REGS) < 0 ) {
pt++;
} }
} }
S = it->cls+it->arity*start[0]; x = IntegerOfTerm(min);
pt --; if (n > 8) {
if ( pt > start ) { int cmp;
YENV[-2] = (CELL)( start+1 ); pt = binary_search(pt, end, x PASS_REGS);
YENV[-1] = (CELL)( pt ); while ( pt < end+1 && (cmp = compare(pt, x PASS_REGS)) <= 0 ) {
YENV -= 2; if (cmp > 0) break;
return it->code; pt++;
} }
} } else {
return NEXTOP(NEXTOP(it->code,lp),lp); while ( pt < end+1 && compare(pt, x PASS_REGS) <= 0 ) {
} pt++;
}
}
if (pt > end)
return FAILCODE;
}
if (!IsVarTerm(max)) {
Int x;
BITS32 *pt1;
Int n = end-pt;
static yamop * if (!IsIntegerTerm(max)) {
Eq(struct index_t *it, Int x, BITS32 off USES_REGS) max = Yap_Eval(max);
{ if (!IsIntegerTerm(max)) {
if (it->links[off]) { Yap_Error(TYPE_ERROR_INTEGER, max, "data-base constraint");
BITS32 *c = (BITS32 *)it->udi_data;
BITS32 n = c[it->links[off]];
LOCAL_exo_base = it->cls;
LOCAL_exo_arity = it->arity;
LOCAL_exo_arg = it->udi_arg;
BITS32 *end = c+(it->links[off]+(n+2));
BITS32 *start, *pt = c+(it->links[off]+1);
if (n > 8 && FALSE) {
// start = binary_search(start,end, x, it);
} else {
Int c = 0;
while ( pt < end && (c = compare(pt, x PASS_REGS)) < 0 ) {
pt++;
}
if (pt == end || c)
return FAILCODE; return FAILCODE;
start = pt;
pt ++;
while ( pt < end && (c = compare(pt, x PASS_REGS)) == 0 ) {
pt++;
} }
} }
S = it->cls+it->arity*start[0]; x = IntegerOfTerm(max);
pt --; if (n > 8) {
if ( pt > start ) { int cmp;
YENV[-2] = (CELL)( start+1 ); pt1 = binary_search(pt, end, x PASS_REGS);
YENV[-1] = (CELL)( pt ); while ( pt1 >= pt && (cmp = compare(pt1, x PASS_REGS)) >= 0 ) {
YENV -= 2; if (cmp < 0) break;
return it->code; pt1--;
} }
} } else {
return NEXTOP(NEXTOP(it->code,lp),lp); pt1 = end;
} while ( pt1 >= pt && compare(pt1, x PASS_REGS) >= 0 ) {
pt1--;
static yamop * }
All(struct index_t *it, BITS32 off USES_REGS) }
{ if (pt1 < pt)
if (it->links[off]) { return FAILCODE;
BITS32 *c = (BITS32 *)it->udi_data; end = pt1;
BITS32 n = c[it->links[off]]; }
if (IsVarTerm(op)) {
LOCAL_exo_base = it->cls; S = it->cls+it->arity*pt[0];
LOCAL_exo_arity = it->arity; if (pt < end ) {
LOCAL_exo_arg = it->udi_arg; YENV[-2] = (CELL)( pt+1 );
BITS32 *start = c+(it->links[off]+1); YENV[-1] = (CELL)( end );
BITS32 *end = c+(it->links[off]+(n+1)); YENV -= 2;
S = it->cls+it->arity*start[0]; return it->code;
if ( end > start ) { }
YENV[-2] = (CELL)( start+1 ); return NEXTOP(NEXTOP(it->code,lp),lp);
YENV[-1] = (CELL)( end ); }
YENV -= 2; at = AtomOfTerm(op);
return it->code; if (at == AtomAny || at == AtomMin) {
} S = it->cls+it->arity*pt[0];
} } else if (at == AtomMax) {
return NEXTOP(NEXTOP(it->code,lp),lp); S = it->cls+it->arity*end[0];
} } else if (at == AtomUnique) {
if (end-2 > pt)
return FAILCODE;
S = it->cls+it->arity*pt[0];
}
return NEXTOP(NEXTOP(it->code,lp),lp);
}
static yamop * static yamop *
IntervalEnterUDIIndex(struct index_t *it USES_REGS) IntervalEnterUDIIndex(struct index_t *it USES_REGS)
@ -270,57 +259,24 @@ IntervalEnterUDIIndex(struct index_t *it USES_REGS)
BITS32 off = EXO_ADDRESS_TO_OFFSET(it, S)/it->arity; BITS32 off = EXO_ADDRESS_TO_OFFSET(it, S)/it->arity;
// printf("off=%d it=%p %p---%p\n", off, it, it->cls, S); // printf("off=%d it=%p %p---%p\n", off, it, it->cls, S);
attvar_record *attv; attvar_record *attv;
Atom at;
t = Deref(t); t = Deref(t);
if (!IsVarTerm(t)) if (!IsVarTerm(t))
return FALSE; return FALSE;
if(!IsAttVar(VarOfTerm(t))) if(!IsAttVar(VarOfTerm(t)))
return FALSE; return Interval(it, MkVarTerm(), MkVarTerm(), MkVarTerm(), off PASS_REGS);
attv = RepAttVar(VarOfTerm(t)); attv = RepAttVar(VarOfTerm(t));
t = attv->Atts; t = attv->Atts;
a1 = ArgOfTerm(2,t); a1 = ArgOfTerm(2,t);
if (IsAtomTerm(a1)) { if (IsVarTerm(a1)) {
at = AtomOfTerm(a1); Yap_Error(INSTANTIATION_ERROR, t, "executing exo_interval constraints");
return FAILCODE;
} else if (!IsApplTerm(a1)) {
Yap_Error(TYPE_ERROR_COMPOUND, a1, "executing exo_interval constraints");
return FAILCODE;
} else { } else {
Functor f = FunctorOfTerm(a1); return Interval(it, ArgOfTerm(1,a1), ArgOfTerm(2,a1), ArgOfTerm(3,a1), off PASS_REGS);
at = NameOfFunctor(f);
} }
if (at == AtomMax) {
return Max(it, off PASS_REGS);
} else if (at == AtomMin) {
return Min(it, off PASS_REGS);
} else if (at == AtomGT) {
Term arg = ArgOfTerm(1, a1);
if (IsVarTerm(arg))
return All(it, off PASS_REGS);
else if (!IsIntTerm(arg)) {
Yap_Error(TYPE_ERROR_INTEGER, arg, "data-base constraint");
return FAILCODE;
}
return Gt(it, IntOfTerm(arg), off PASS_REGS);
} else if (at == AtomLT) {
Term arg = ArgOfTerm(1, a1);
if (IsVarTerm(arg))
return All(it, off PASS_REGS);
else if (!IsIntTerm(arg)) {
Yap_Error(TYPE_ERROR_INTEGER, t, "data-base constraint");
return FAILCODE;
}
return Lt(it, IntOfTerm(arg), off PASS_REGS);
} else if (at == AtomEQ) {
Term arg = ArgOfTerm(1, a1);
if (IsVarTerm(arg))
return All(it, off PASS_REGS);
else if (!IsIntTerm(arg)) {
Yap_Error(TYPE_ERROR_INTEGER, t, "data-base constraint");
return FAILCODE;
}
return Eq(it, IntOfTerm(arg), off PASS_REGS);
}
return FAILCODE;
} }
static int static int
@ -328,7 +284,7 @@ IntervalRetryUDIIndex(struct index_t *it USES_REGS)
{ {
CELL *w = (CELL*)(B+1); CELL *w = (CELL*)(B+1);
BITS32 *end = (BITS32 *) w[it->arity+2], BITS32 *end = (BITS32 *) w[it->arity+2],
*pt = (BITS32 *) w[it->arity+1]; *pt = (BITS32 *) w[it->arity+1];
BITS32 f = *pt; BITS32 f = *pt;
S = it->cls+it->arity*f; S = it->cls+it->arity*f;
@ -375,12 +331,12 @@ static int IntervalUdiDestroy(void *control)
void Yap_udi_Interval_init(void) { void Yap_udi_Interval_init(void) {
UdiControlBlock cb = &IntervalCB; UdiControlBlock cb = &IntervalCB;
Atom name = Yap_LookupAtom("exo_interval");
memset((void *) cb,0, sizeof(*cb)); memset((void *) cb,0, sizeof(*cb));
/*TODO: ask vitor why this gives a warning*/ /*TODO: ask vitor why this gives a warning*/
cb->decl=Yap_LookupAtom("exo_interval"); cb->decl= name;
Yap_MkEmptyWakeUp(name);
cb->init= IntervalUdiInit; cb->init= IntervalUdiInit;
cb->insert=IntervalUdiInsert; cb->insert=IntervalUdiInsert;
cb->search=NULL; cb->search=NULL;

View File

@ -44,30 +44,30 @@ typedef enum {
STATIC_PROTO(Int p_growheap, ( USES_REGS1 )); static Int p_growheap( USES_REGS1 );
STATIC_PROTO(Int p_growstack, ( USES_REGS1 )); static Int p_growstack( USES_REGS1 );
STATIC_PROTO(Int p_inform_trail_overflows, ( USES_REGS1 )); static Int p_inform_trail_overflows( USES_REGS1 );
STATIC_PROTO(Int p_inform_heap_overflows, ( USES_REGS1 )); static Int p_inform_heap_overflows( USES_REGS1 );
STATIC_PROTO(Int p_inform_stack_overflows, ( USES_REGS1 )); static Int p_inform_stack_overflows( USES_REGS1 );
/* #define undf7 */ /* #define undf7 */
/* #define undf5 */ /* #define undf5 */
STATIC_PROTO(int growstack, (long CACHE_TYPE)); static int growstack(size_t CACHE_TYPE);
STATIC_PROTO(void MoveGlobal, ( CACHE_TYPE1 )); static void MoveGlobal( CACHE_TYPE1 );
STATIC_PROTO(void MoveLocalAndTrail, ( CACHE_TYPE1 )); static void MoveLocalAndTrail( CACHE_TYPE1 );
STATIC_PROTO(void SetHeapRegs, (int CACHE_TYPE)); static void SetHeapRegs(int CACHE_TYPE);
STATIC_PROTO(void AdjustTrail, (int, int CACHE_TYPE)); static void AdjustTrail(int, int CACHE_TYPE);
STATIC_PROTO(void AdjustLocal, (int CACHE_TYPE)); static void AdjustLocal(int CACHE_TYPE);
STATIC_PROTO(void AdjustGlobal, (long, int CACHE_TYPE)); static void AdjustGlobal(long, int CACHE_TYPE);
STATIC_PROTO(void AdjustGrowStack, ( CACHE_TYPE1 )); static void AdjustGrowStack( CACHE_TYPE1 );
STATIC_PROTO(int static_growheap, (long,int,struct intermediates *,tr_fr_ptr *, TokEntry **, VarEntry ** CACHE_TYPE)); static int static_growheap(long,int,struct intermediates *,tr_fr_ptr *, TokEntry **, VarEntry ** CACHE_TYPE);
STATIC_PROTO(void cpcellsd, (CELL *, CELL *, CELL)); static void cpcellsd(CELL *, CELL *, CELL);
STATIC_PROTO(CELL AdjustAppl, (CELL CACHE_TYPE)); static CELL AdjustAppl(CELL CACHE_TYPE);
STATIC_PROTO(CELL AdjustPair, (CELL CACHE_TYPE)); static CELL AdjustPair(CELL CACHE_TYPE);
STATIC_PROTO(void AdjustStacksAndTrail, (long, int CACHE_TYPE)); static void AdjustStacksAndTrail(long, int CACHE_TYPE);
STATIC_PROTO(void AdjustRegs, (int CACHE_TYPE)); static void AdjustRegs(int CACHE_TYPE);
STATIC_PROTO(Term AdjustGlobTerm, (Term CACHE_TYPE)); static Term AdjustGlobTerm(Term CACHE_TYPE);
static void static void
LeaveGrowMode(prolog_exec_mode grow_mode) LeaveGrowMode(prolog_exec_mode grow_mode)
@ -1500,7 +1500,7 @@ Yap_InsertInGlobal(CELL *where, UInt howmuch)
int int
Yap_growstack(long size) Yap_growstack(size_t size)
{ {
CACHE_REGS CACHE_REGS
int res; int res;
@ -1616,7 +1616,7 @@ execute_growstack(long size0, int from_trail, int in_parser, tr_fr_ptr *old_trp,
/* Used by do_goal() when we're short of stack space */ /* Used by do_goal() when we're short of stack space */
static int static int
growstack(long size USES_REGS) growstack(size_t size USES_REGS)
{ {
UInt start_growth_time, growth_time; UInt start_growth_time, growth_time;
int gc_verbose; int gc_verbose;

View File

@ -35,28 +35,28 @@ static char SccsId[] = "%W% %G%";
/* global variables for garbage collection */ /* global variables for garbage collection */
STATIC_PROTO(Int p_inform_gc, ( CACHE_TYPE1 )); static Int p_inform_gc( CACHE_TYPE1 );
STATIC_PROTO(Int p_gc, ( CACHE_TYPE1 )); static Int p_gc( CACHE_TYPE1 );
STATIC_PROTO(void marking_phase, (tr_fr_ptr, CELL *, yamop * CACHE_TYPE)); static void marking_phase(tr_fr_ptr, CELL *, yamop * CACHE_TYPE);
STATIC_PROTO(void compaction_phase, (tr_fr_ptr, CELL *, yamop * CACHE_TYPE)); static void compaction_phase(tr_fr_ptr, CELL *, yamop * CACHE_TYPE);
STATIC_PROTO(void init_dbtable, (tr_fr_ptr CACHE_TYPE)); static void init_dbtable(tr_fr_ptr CACHE_TYPE);
STATIC_PROTO(void mark_external_reference, (CELL * CACHE_TYPE)); static void mark_external_reference(CELL * CACHE_TYPE);
STATIC_PROTO(void mark_db_fixed, (CELL * CACHE_TYPE)); static void mark_db_fixed(CELL * CACHE_TYPE);
STATIC_PROTO(void mark_regs, (tr_fr_ptr CACHE_TYPE)); static void mark_regs(tr_fr_ptr CACHE_TYPE);
STATIC_PROTO(void mark_trail, (tr_fr_ptr, tr_fr_ptr, CELL *, choiceptr CACHE_TYPE)); static void mark_trail(tr_fr_ptr, tr_fr_ptr, CELL *, choiceptr CACHE_TYPE);
STATIC_PROTO(void mark_environments, (CELL *, OPREG, CELL * CACHE_TYPE)); static void mark_environments(CELL *, OPREG, CELL * CACHE_TYPE);
STATIC_PROTO(void mark_choicepoints, (choiceptr, tr_fr_ptr, int CACHE_TYPE)); static void mark_choicepoints(choiceptr, tr_fr_ptr, int CACHE_TYPE);
STATIC_PROTO(void into_relocation_chain, (CELL *, CELL * CACHE_TYPE)); static void into_relocation_chain(CELL *, CELL * CACHE_TYPE);
STATIC_PROTO(void sweep_trail, (choiceptr, tr_fr_ptr CACHE_TYPE)); static void sweep_trail(choiceptr, tr_fr_ptr CACHE_TYPE);
STATIC_PROTO(void sweep_environments, (CELL *, OPREG, CELL * CACHE_TYPE)); static void sweep_environments(CELL *, OPREG, CELL * CACHE_TYPE);
STATIC_PROTO(void sweep_choicepoints, (choiceptr CACHE_TYPE)); static void sweep_choicepoints(choiceptr CACHE_TYPE);
STATIC_PROTO(void compact_heap, ( CACHE_TYPE1 )); static void compact_heap( CACHE_TYPE1 );
STATIC_PROTO(void update_relocation_chain, (CELL *, CELL * CACHE_TYPE)); static void update_relocation_chain(CELL *, CELL * CACHE_TYPE);
STATIC_PROTO(int is_gc_verbose, (void)); static int is_gc_verbose(void);
STATIC_PROTO(int is_gc_very_verbose, (void)); static int is_gc_very_verbose(void);
STATIC_PROTO(void LeaveGCMode, ( CACHE_TYPE1 )); static void LeaveGCMode( CACHE_TYPE1 );
#ifdef EASY_SHUNTING #ifdef EASY_SHUNTING
STATIC_PROTO(void set_conditionals, (tr_fr_ptr CACHE_TYPE)); static void set_conditionals(tr_fr_ptr CACHE_TYPE);
#endif /* EASY_SHUNTING */ #endif /* EASY_SHUNTING */
#include "heapgc.h" #include "heapgc.h"
@ -1064,7 +1064,7 @@ inc_var(CELL *current, CELL *next)
} }
#endif /* INSTRUMENT_GC */ #endif /* INSTRUMENT_GC */
int STD_PROTO(vsc_stop,(void)); int vsc_stop(void);
int int
vsc_stop(void) { vsc_stop(void) {
@ -2308,9 +2308,13 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose
nargs = rtp->u.OtILl.d->ClPred->ArityOfPE+1; nargs = rtp->u.OtILl.d->ClPred->ArityOfPE+1;
break; break;
case _retry_exo: case _retry_exo:
case _retry_exo_udi:
case _retry_all_exo: case _retry_all_exo:
nargs = rtp->u.lp.p->ArityOfPE; nargs = rtp->u.lp.p->ArityOfPE;
break; break;
case _retry_udi:
nargs = rtp->u.p.p->ArityOfPE;
break;
#ifdef DEBUG #ifdef DEBUG
case _retry_me: case _retry_me:
case _trust_me: case _trust_me:
@ -3227,7 +3231,11 @@ sweep_choicepoints(choiceptr gc_B USES_REGS)
case _retry4: case _retry4:
sweep_b(gc_B, 4 PASS_REGS); sweep_b(gc_B, 4 PASS_REGS);
break; break;
case _retry_udi:
sweep_b(gc_B, rtp->u.p.p->ArityOfPE PASS_REGS);
break;
case _retry_exo: case _retry_exo:
case _retry_exo_udi:
case _retry_all_exo: case _retry_all_exo:
sweep_b(gc_B, rtp->u.lp.p->ArityOfPE PASS_REGS); sweep_b(gc_B, rtp->u.lp.p->ArityOfPE PASS_REGS);
break; break;

View File

@ -502,10 +502,10 @@ static char SccsId[] = "%W% %G%";
#define SET_JLBL(X) #define SET_JLBL(X)
#endif #endif
UInt STATIC_PROTO(do_index, (ClauseDef *,ClauseDef *,struct intermediates *,UInt,UInt,int,int,CELL *)); static UInt do_index(ClauseDef *,ClauseDef *,struct intermediates *,UInt,UInt,int,int,CELL *);
UInt STATIC_PROTO(do_compound_index, (ClauseDef *,ClauseDef *,Term *t,struct intermediates *,UInt,UInt,UInt,UInt,int,int,int,CELL *,int)); static UInt do_compound_index(ClauseDef *,ClauseDef *,Term *t,struct intermediates *,UInt,UInt,UInt,UInt,int,int,int,CELL *,int);
UInt STATIC_PROTO(do_dbref_index, (ClauseDef *,ClauseDef *,Term,struct intermediates *,UInt,UInt,int,int,CELL *)); static UInt do_dbref_index(ClauseDef *,ClauseDef *,Term,struct intermediates *,UInt,UInt,int,int,CELL *);
UInt STATIC_PROTO(do_blob_index, (ClauseDef *,ClauseDef *,Term,struct intermediates *,UInt,UInt,int,int,CELL *,int)); static UInt do_blob_index(ClauseDef *,ClauseDef *,Term,struct intermediates *,UInt,UInt,int,int,CELL *,int);
static UInt static UInt
cleanup_sw_on_clauses(CELL larg, UInt sz, OPCODE ecls) cleanup_sw_on_clauses(CELL larg, UInt sz, OPCODE ecls)

View File

@ -62,22 +62,22 @@ static char SccsId[] = "%W% %G%";
int Yap_output_msg = FALSE; int Yap_output_msg = FALSE;
#ifdef MACC #ifdef MACC
STATIC_PROTO(void InTTYLine, (char *)); static void InTTYLine(char *);
#endif #endif
#endif #endif
STATIC_PROTO(void SetOp, (int, int, char *, Term)); static void SetOp(int, int, char *, Term);
STATIC_PROTO(void InitOps, (void)); static void InitOps(void);
STATIC_PROTO(void InitDebug, (void)); static void InitDebug(void);
#ifdef CUT_C #ifdef CUT_C
STATIC_PROTO(void CleanBack, (PredEntry *, CPredicate, CPredicate, CPredicate)); static void CleanBack(PredEntry *, CPredicate, CPredicate, CPredicate);
#else #else
STATIC_PROTO(void CleanBack, (PredEntry *, CPredicate, CPredicate)); static void CleanBack(PredEntry *, CPredicate, CPredicate);
#endif #endif
STATIC_PROTO(void InitStdPreds,(void)); static void InitStdPreds(void);
STATIC_PROTO(void InitFlags, (void)); static void InitFlags(void);
STATIC_PROTO(void InitCodes, (void)); static void InitCodes(void);
STATIC_PROTO(void InitVersion, (void)); static void InitVersion(void);
STD_PROTO(void exit, (int)); void exit(int);
static void InitWorker(int wid); static void InitWorker(int wid);
@ -1022,6 +1022,11 @@ InitSWIAtoms(void)
ATOM_ = PL_new_atom(""); ATOM_ = PL_new_atom("");
} }
static void
InitEmptyWakeups(void)
{
}
static void static void
InitAtoms(void) InitAtoms(void)
{ {

View File

@ -23,21 +23,21 @@
#include "cut_c.h" #include "cut_c.h"
#endif #endif
STATIC_PROTO(Int p_atom, ( USES_REGS1 )); static Int p_atom( USES_REGS1 );
STATIC_PROTO(Int p_atomic, ( USES_REGS1 )); static Int p_atomic( USES_REGS1 );
STATIC_PROTO(Int p_integer, ( USES_REGS1 )); static Int p_integer( USES_REGS1 );
STATIC_PROTO(Int p_nonvar, ( USES_REGS1 )); static Int p_nonvar( USES_REGS1 );
STATIC_PROTO(Int p_number, ( USES_REGS1 )); static Int p_number( USES_REGS1 );
STATIC_PROTO(Int p_var, ( USES_REGS1 )); static Int p_var( USES_REGS1 );
STATIC_PROTO(Int p_db_ref, ( USES_REGS1 )); static Int p_db_ref( USES_REGS1 );
STATIC_PROTO(Int p_primitive, ( USES_REGS1 )); static Int p_primitive( USES_REGS1 );
STATIC_PROTO(Int p_compound, ( USES_REGS1 )); static Int p_compound( USES_REGS1 );
STATIC_PROTO(Int p_float, ( USES_REGS1 )); static Int p_float( USES_REGS1 );
STATIC_PROTO(Int p_equal, ( USES_REGS1 )); static Int p_equal( USES_REGS1 );
STATIC_PROTO(Int p_dif, ( USES_REGS1 )); static Int p_dif( USES_REGS1 );
STATIC_PROTO(Int p_eq, ( USES_REGS1 )); static Int p_eq( USES_REGS1 );
STATIC_PROTO(Int p_arg, ( USES_REGS1 )); static Int p_arg( USES_REGS1 );
STATIC_PROTO(Int p_functor, ( USES_REGS1 )); static Int p_functor( USES_REGS1 );
static Int static Int

View File

@ -84,12 +84,12 @@ static char SccsId[] = "%W% %G%";
#endif #endif
#include "iopreds.h" #include "iopreds.h"
STATIC_PROTO (Int p_set_read_error_handler, ( USES_REGS1 )); static Int p_set_read_error_handler( USES_REGS1 );
STATIC_PROTO (Int p_get_read_error_handler, ( USES_REGS1 )); static Int p_get_read_error_handler( USES_REGS1 );
STATIC_PROTO (Int p_read, ( USES_REGS1 )); static Int p_read( USES_REGS1 );
STATIC_PROTO (Int p_startline, ( USES_REGS1 )); static Int p_startline( USES_REGS1 );
STATIC_PROTO (Int p_change_type_of_char, ( USES_REGS1 )); static Int p_change_type_of_char( USES_REGS1 );
STATIC_PROTO (Int p_type_of_char, ( USES_REGS1 )); static Int p_type_of_char( USES_REGS1 );
extern Atom Yap_FileName(IOSTREAM *s); extern Atom Yap_FileName(IOSTREAM *s);

View File

@ -34,7 +34,7 @@ static char SccsId[] = "%W% %G%.2";
#endif #endif
#endif #endif
STD_PROTO(Int p_load_foreign, ( USES_REGS1 )); Int p_load_foreign( USES_REGS1 );
Int Int
p_load_foreign( USES_REGS1 ) p_load_foreign( USES_REGS1 )

View File

@ -167,7 +167,7 @@ Yap_ReLoadForeign(StringList ofiles, StringList libs,
/* /*
dunno what this one is supposed to do, no load_* defines it dunno what this one is supposed to do, no load_* defines it
void STD_PROTO(ReOpenLoadForeign,(void)); void ReOpenLoadForeign(void);
*/ */
#endif #endif

View File

@ -23,11 +23,11 @@
#include "YapHeap.h" #include "YapHeap.h"
#include "eval.h" #include "eval.h"
STD_PROTO(static Int p_setarg, ( USES_REGS1 )); static Int p_setarg( USES_REGS1 );
STD_PROTO(static Int p_create_mutable, ( USES_REGS1 )); static Int p_create_mutable( USES_REGS1 );
STD_PROTO(static Int p_get_mutable, ( USES_REGS1 )); static Int p_get_mutable( USES_REGS1 );
STD_PROTO(static Int p_update_mutable, ( USES_REGS1 )); static Int p_update_mutable( USES_REGS1 );
STD_PROTO(static Int p_is_mutable, ( USES_REGS1 )); static Int p_is_mutable( USES_REGS1 );
static Int static Int
p_setarg( USES_REGS1 ) p_setarg( USES_REGS1 )

View File

@ -22,8 +22,8 @@ static char SccsId[] = "%W% %G%";
#include "Yatom.h" #include "Yatom.h"
#include "YapHeap.h" #include "YapHeap.h"
STATIC_PROTO(Int p_current_module, ( USES_REGS1 )); static Int p_current_module( USES_REGS1 );
STATIC_PROTO(Int p_current_module1, ( USES_REGS1 )); static Int p_current_module1( USES_REGS1 );
inline static ModEntry * inline static ModEntry *

View File

@ -68,11 +68,11 @@ typedef struct jmp_buff_struct {
sigjmp_buf JmpBuff; sigjmp_buf JmpBuff;
} JMPBUFF; } JMPBUFF;
STATIC_PROTO(void GNextToken, ( CACHE_TYPE1 )); static void GNextToken( CACHE_TYPE1 );
STATIC_PROTO(void checkfor, (Term, JMPBUFF * CACHE_TYPE)); static void checkfor(Term, JMPBUFF * CACHE_TYPE);
STATIC_PROTO(Term ParseArgs, (Atom, JMPBUFF * CACHE_TYPE)); static Term ParseArgs(Atom, JMPBUFF * CACHE_TYPE);
STATIC_PROTO(Term ParseList, (JMPBUFF * CACHE_TYPE)); static Term ParseList(JMPBUFF * CACHE_TYPE);
STATIC_PROTO(Term ParseTerm, (int, JMPBUFF * CACHE_TYPE)); static Term ParseTerm(int, JMPBUFF * CACHE_TYPE);
#define TRY(S,P) \ #define TRY(S,P) \

View File

@ -1212,7 +1212,7 @@ Yap_StreamPosition(IOSTREAM *st)
return StreamPosition(st); return StreamPosition(st);
} }
IOSTREAM *STD_PROTO(Yap_Scurin, (void)); IOSTREAM *Yap_Scurin(void);
IOSTREAM * IOSTREAM *
Yap_Scurin(void) Yap_Scurin(void)

View File

@ -29,8 +29,8 @@
#include "qly.h" #include "qly.h"
STATIC_PROTO(void RestoreEntries, (PropEntry *, int USES_REGS)); static void RestoreEntries(PropEntry *, int USES_REGS);
STATIC_PROTO(void CleanCode, (PredEntry * USES_REGS)); static void CleanCode(PredEntry * USES_REGS);
typedef enum { typedef enum {
OUT_OF_TEMP_SPACE = 0, OUT_OF_TEMP_SPACE = 0,

View File

@ -29,8 +29,8 @@
#include "qly.h" #include "qly.h"
STATIC_PROTO(void RestoreEntries, (PropEntry *, int USES_REGS)); static void RestoreEntries(PropEntry *, int USES_REGS);
STATIC_PROTO(void CleanCode, (PredEntry * USES_REGS)); static void CleanCode(PredEntry * USES_REGS);
static void static void
GrowAtomTable(void) { GrowAtomTable(void) {

View File

@ -85,55 +85,55 @@ void initIO(void);
#endif #endif
STATIC_PROTO(int myread, (int, char *, Int)); static int myread(int, char *, Int);
STATIC_PROTO(Int mywrite, (int, char *, Int)); static Int mywrite(int, char *, Int);
STATIC_PROTO(int open_file, (char *, int)); static int open_file(char *, int);
STATIC_PROTO(int close_file, (void)); static int close_file(void);
STATIC_PROTO(Int putout, (CELL)); static Int putout(CELL);
STATIC_PROTO(Int putcellptr, (CELL *)); static Int putcellptr(CELL *);
STATIC_PROTO(CELL get_cell, (void)); static CELL get_cell(void);
STATIC_PROTO(CELL *get_cellptr, ( /* CELL * */ void)); static CELL *get_cellptr( /* CELL * */ void);
STATIC_PROTO(int put_info, (int, int CACHE_TYPE)); static int put_info(int, int CACHE_TYPE);
STATIC_PROTO(int save_regs, (int CACHE_TYPE)); static int save_regs(int CACHE_TYPE);
STATIC_PROTO(int save_code_info, (void)); static int save_code_info(void);
STATIC_PROTO(int save_heap, (void)); static int save_heap(void);
STATIC_PROTO(int save_stacks, (int CACHE_TYPE)); static int save_stacks(int CACHE_TYPE);
STATIC_PROTO(int save_crc, (void)); static int save_crc(void);
STATIC_PROTO(Int do_save, (int CACHE_TYPE)); static Int do_save(int CACHE_TYPE);
STATIC_PROTO(Int p_save2, ( CACHE_TYPE1 )); static Int p_save2( CACHE_TYPE1 );
STATIC_PROTO(Int p_save_program, ( CACHE_TYPE1 )); static Int p_save_program( CACHE_TYPE1 );
STATIC_PROTO(int check_header, (CELL *, CELL *, CELL *, CELL * CACHE_TYPE)); static int check_header(CELL *, CELL *, CELL *, CELL * CACHE_TYPE);
STATIC_PROTO(int get_heap_info, (CACHE_TYPE1)); static int get_heap_info(CACHE_TYPE1);
STATIC_PROTO(int get_regs, (int CACHE_TYPE)); static int get_regs(int CACHE_TYPE);
STATIC_PROTO(int get_insts, (OPCODE [])); static int get_insts(OPCODE []);
STATIC_PROTO(int get_hash, (void)); static int get_hash(void);
STATIC_PROTO(int CopyCode, ( CACHE_TYPE1 )); static int CopyCode( CACHE_TYPE1 );
STATIC_PROTO(int CopyStacks, ( CACHE_TYPE1 )); static int CopyStacks( CACHE_TYPE1 );
STATIC_PROTO(int get_coded, (int, OPCODE [] CACHE_TYPE)); static int get_coded(int, OPCODE [] CACHE_TYPE);
STATIC_PROTO(void restore_codes, (void)); static void restore_codes(void);
STATIC_PROTO(void RestoreDB, (DBEntry * CACHE_TYPE)); static void RestoreDB(DBEntry * CACHE_TYPE);
STATIC_PROTO(void RestoreDBTerm, (DBTerm *, int CACHE_TYPE)); static void RestoreDBTerm(DBTerm *, int CACHE_TYPE);
STATIC_PROTO(void CleanClauses, (yamop *, yamop *,PredEntry * CACHE_TYPE)); static void CleanClauses(yamop *, yamop *,PredEntry * CACHE_TYPE);
STATIC_PROTO(void rehash, (CELL *, int, int CACHE_TYPE)); static void rehash(CELL *, int, int CACHE_TYPE);
STATIC_PROTO(void CleanCode, (PredEntry * CACHE_TYPE)); static void CleanCode(PredEntry * CACHE_TYPE);
STATIC_PROTO(void RestoreEntries, (PropEntry *, int CACHE_TYPE)); static void RestoreEntries(PropEntry *, int CACHE_TYPE);
STATIC_PROTO(void RestoreFreeSpace, ( CACHE_TYPE1 )); static void RestoreFreeSpace( CACHE_TYPE1 );
STATIC_PROTO(void restore_heap, (void)); static void restore_heap(void);
#ifdef DEBUG_RESTORE3 #ifdef DEBUG_RESTORE3
STATIC_PROTO(void ShowAtoms, (void)); static void ShowAtoms(void);
STATIC_PROTO(void ShowEntries, (PropEntry *)); static void ShowEntries(PropEntry *);
#endif #endif
STATIC_PROTO(int OpenRestore, (char *, char *, CELL *, CELL *, CELL *, CELL *, IOSTREAM **)); static int OpenRestore(char *, char *, CELL *, CELL *, CELL *, CELL *, IOSTREAM **);
STATIC_PROTO(void CloseRestore, (void)); static void CloseRestore(void);
#ifndef _WIN32 #ifndef _WIN32
STATIC_PROTO(int check_opcodes, (OPCODE [])); static int check_opcodes(OPCODE []);
#endif #endif
STATIC_PROTO(void RestoreHeap, (OPCODE [] CACHE_TYPE)); static void RestoreHeap(OPCODE [] CACHE_TYPE);
STATIC_PROTO(Int p_restore, ( CACHE_TYPE1 )); static Int p_restore( CACHE_TYPE1 );
STATIC_PROTO(void restore_heap_regs, ( CACHE_TYPE1 )); static void restore_heap_regs( CACHE_TYPE1 );
STATIC_PROTO(void restore_regs, (int CACHE_TYPE)); static void restore_regs(int CACHE_TYPE);
#ifdef MACYAP #ifdef MACYAP
STATIC_PROTO(void NewFileInfo, (long, long)); static void NewFileInfo(long, long);
extern int DefVol; extern int DefVol;
#endif #endif

View File

@ -59,8 +59,8 @@
#define my_isupper(C) ( C >= 'A' && C <= 'Z' ) #define my_isupper(C) ( C >= 'A' && C <= 'Z' )
#define my_islower(C) ( C >= 'a' && C <= 'z' ) #define my_islower(C) ( C >= 'a' && C <= 'z' )
STATIC_PROTO(Term float_send, (char *, int)); static Term float_send(char *, int);
STATIC_PROTO(Term get_num, (int *, int *, IOSTREAM *,char *,UInt,int)); static Term get_num(int *, int *, IOSTREAM *,char *,UInt,int);
/* token table with some help from Richard O'Keefe's PD scanner */ /* token table with some help from Richard O'Keefe's PD scanner */
static char chtype0[NUMBER_OF_CHARS+1] = static char chtype0[NUMBER_OF_CHARS+1] =

View File

@ -28,14 +28,14 @@
#define M_EVEN 0 #define M_EVEN 0
#define M_ODD 1 #define M_ODD 1
STATIC_PROTO(Int build_new_list, (CELL *, Term CACHE_TYPE)); static Int build_new_list(CELL *, Term CACHE_TYPE);
STATIC_PROTO(void simple_mergesort, (CELL *, Int, int)); static void simple_mergesort(CELL *, Int, int);
STATIC_PROTO(Int compact_mergesort, (CELL *, Int, int)); static Int compact_mergesort(CELL *, Int, int);
STATIC_PROTO(int key_mergesort, (CELL *, Int, int, Functor)); static int key_mergesort(CELL *, Int, int, Functor);
STATIC_PROTO(void adjust_vector, (CELL *, Int)); static void adjust_vector(CELL *, Int);
STATIC_PROTO(Int p_sort, ( USES_REGS1 )); static Int p_sort( USES_REGS1 );
STATIC_PROTO(Int p_msort, ( USES_REGS1 )); static Int p_msort( USES_REGS1 );
STATIC_PROTO(Int p_ksort, ( USES_REGS1 )); static Int p_ksort( USES_REGS1 );
/* copy to a new list of terms */ /* copy to a new list of terms */
static Int static Int

View File

@ -285,75 +285,72 @@ static char SccsId[] = "%W% %G%";
#endif #endif
#include <wchar.h> #include <wchar.h>
STD_PROTO(static Int p_setval, ( USES_REGS1 )); static Int p_setval( USES_REGS1 );
STD_PROTO(static Int p_value, ( USES_REGS1 )); static Int p_value( USES_REGS1 );
STD_PROTO(static Int p_values, ( USES_REGS1 )); static Int p_values( USES_REGS1 );
#ifdef undefined #ifdef undefined
STD_PROTO(static CODEADDR *FindAtom, (CODEADDR, int *)); static CODEADDR *FindAtom(CODEADDR, int *);
#endif /* undefined */ #endif /* undefined */
STD_PROTO(static Int p_opdec, ( USES_REGS1 )); static Int p_opdec( USES_REGS1 );
STD_PROTO(static Term get_num, (char * USES_REGS)); static Term get_num(char * USES_REGS);
STD_PROTO(static Int p_name, ( USES_REGS1 )); static Int p_name( USES_REGS1 );
STD_PROTO(static Int p_atom_chars, ( USES_REGS1 )); static Int p_atom_chars( USES_REGS1 );
STD_PROTO(static Int p_atom_codes, ( USES_REGS1 )); static Int p_atom_codes( USES_REGS1 );
STD_PROTO(static Int p_atom_length, ( USES_REGS1 )); static Int p_atom_length( USES_REGS1 );
STD_PROTO(static Int p_atom_split, ( USES_REGS1 )); static Int p_atom_split( USES_REGS1 );
STD_PROTO(static Int p_number_chars, ( USES_REGS1 )); static Int p_number_chars( USES_REGS1 );
STD_PROTO(static Int p_number_codes, ( USES_REGS1 )); static Int p_number_codes( USES_REGS1 );
STD_PROTO(static Int p_univ, ( USES_REGS1 )); static Int p_univ( USES_REGS1 );
STD_PROTO(static Int p_abort, ( USES_REGS1 )); static Int p_abort( USES_REGS1 );
#ifdef BEAM #ifdef BEAM
STD_PROTO(Int p_halt, ( USES_REGS1 )); Int p_halt( USES_REGS1 );
#else #else
STD_PROTO(static Int p_halt, ( USES_REGS1 )); static Int p_halt( USES_REGS1 );
#endif #endif
STD_PROTO(static Int init_current_atom, ( USES_REGS1 )); static Int init_current_atom( USES_REGS1 );
STD_PROTO(static Int cont_current_atom, ( USES_REGS1 )); static Int cont_current_atom( USES_REGS1 );
STD_PROTO(static Int init_current_predicate, ( USES_REGS1 )); static Int init_current_predicate( USES_REGS1 );
STD_PROTO(static Int cont_current_predicate, ( USES_REGS1 )); static Int cont_current_predicate( USES_REGS1 );
STD_PROTO(static Int init_current_predicate_for_atom, ( USES_REGS1 )); static Int init_current_predicate_for_atom( USES_REGS1 );
STD_PROTO(static Int cont_current_predicate_for_atom, ( USES_REGS1 )); static Int cont_current_predicate_for_atom( USES_REGS1 );
STD_PROTO(static OpEntry *NextOp, (OpEntry * CACHE_TYPE)); static OpEntry *NextOp(OpEntry * CACHE_TYPE);
STD_PROTO(static Int init_current_op, ( USES_REGS1 )); static Int init_current_op( USES_REGS1 );
STD_PROTO(static Int cont_current_op, ( USES_REGS1 )); static Int cont_current_op( USES_REGS1 );
STD_PROTO(static Int init_current_atom_op, ( USES_REGS1 )); static Int init_current_atom_op( USES_REGS1 );
STD_PROTO(static Int cont_current_atom_op, ( USES_REGS1 )); static Int cont_current_atom_op( USES_REGS1 );
#ifdef DEBUG static Int p_flags( USES_REGS1 );
STD_PROTO(static Int p_debug, ( USES_REGS1 )); static int AlreadyHidden(char *);
#endif static Int p_hide( USES_REGS1 );
STD_PROTO(static Int p_flags, ( USES_REGS1 )); static Int p_hidden( USES_REGS1 );
STD_PROTO(static int AlreadyHidden, (char *)); static Int p_unhide( USES_REGS1 );
STD_PROTO(static Int p_hide, ( USES_REGS1 )); static Int TrailMax(void);
STD_PROTO(static Int p_hidden, ( USES_REGS1 )); static Int GlobalMax(void);
STD_PROTO(static Int p_unhide, ( USES_REGS1 )); static Int LocalMax(void);
STD_PROTO(static Int TrailMax, (void)); static Int p_statistics_heap_max( USES_REGS1 );
STD_PROTO(static Int GlobalMax, (void)); static Int p_statistics_global_max( USES_REGS1 );
STD_PROTO(static Int LocalMax, (void)); static Int p_statistics_local_max( USES_REGS1 );
STD_PROTO(static Int p_statistics_heap_max, ( USES_REGS1 )); static Int p_statistics_heap_info( USES_REGS1 );
STD_PROTO(static Int p_statistics_global_max, ( USES_REGS1 )); static Int p_statistics_stacks_info( USES_REGS1 );
STD_PROTO(static Int p_statistics_local_max, ( USES_REGS1 )); static Int p_statistics_trail_info( USES_REGS1 );
STD_PROTO(static Int p_statistics_heap_info, ( USES_REGS1 )); static Term mk_argc_list( USES_REGS1 );
STD_PROTO(static Int p_statistics_stacks_info, ( USES_REGS1 )); static Int p_argv( USES_REGS1 );
STD_PROTO(static Int p_statistics_trail_info, ( USES_REGS1 )); static Int p_cputime( USES_REGS1 );
STD_PROTO(static Term mk_argc_list, ( USES_REGS1 )); static Int p_systime( USES_REGS1 );
STD_PROTO(static Int p_argv, ( USES_REGS1 )); static Int p_runtime( USES_REGS1 );
STD_PROTO(static Int p_cputime, ( USES_REGS1 )); static Int p_walltime( USES_REGS1 );
STD_PROTO(static Int p_systime, ( USES_REGS1 )); static Int p_access_yap_flags( USES_REGS1 );
STD_PROTO(static Int p_runtime, ( USES_REGS1 )); static Int p_set_yap_flags( USES_REGS1 );
STD_PROTO(static Int p_walltime, ( USES_REGS1 ));
STD_PROTO(static Int p_access_yap_flags, ( USES_REGS1 ));
STD_PROTO(static Int p_set_yap_flags, ( USES_REGS1 ));
#ifdef BEAM #ifdef BEAM
STD_PROTO(Int use_eam, ( USES_REGS1 )); Int use_eam( USES_REGS1 );
STD_PROTO(Int eager_split, ( USES_REGS1 )); Int eager_split( USES_REGS1 );
STD_PROTO(Int force_wait, ( USES_REGS1 )); Int force_wait( USES_REGS1 );
STD_PROTO(Int commit, ( USES_REGS1 )); Int commit( USES_REGS1 );
STD_PROTO(Int skip_while_var, ( USES_REGS1 )); Int skip_while_var( USES_REGS1 );
STD_PROTO(Int wait_while_var, ( USES_REGS1 )); Int wait_while_var( USES_REGS1 );
STD_PROTO(Int show_time, ( USES_REGS1 )); Int show_time( USES_REGS1 );
STD_PROTO(Int start_eam, ( USES_REGS1 )); Int start_eam( USES_REGS1 );
STD_PROTO(Int cont_eam, ( USES_REGS1 )); Int cont_eam( USES_REGS1 );
extern int EAM; extern int EAM;
extern int eam_am(PredEntry*); extern int eam_am(PredEntry*);
@ -4285,8 +4282,7 @@ Yap_InitCPreds(void)
Yap_InitMYDDAS_TopLevelPreds(); Yap_InitMYDDAS_TopLevelPreds();
#endif #endif
Yap_udi_init(); Yap_udi_init();
Yap_udi_range_init(); Yap_udi_Interval_init();
Yap_InitSignalCPreds(); Yap_InitSignalCPreds();
Yap_InitUserCPreds(); Yap_InitUserCPreds();
Yap_InitUtilCPreds(); Yap_InitUtilCPreds();

View File

@ -90,26 +90,26 @@ static char SccsId[] = "%W% %G%";
#endif #endif
STATIC_PROTO (void InitTime, (int)); static void InitTime(int);
STATIC_PROTO (void InitWTime, (void)); static void InitWTime(void);
STATIC_PROTO (Int p_sh, ( USES_REGS1 )); static Int p_sh( USES_REGS1 );
STATIC_PROTO (Int p_shell, ( USES_REGS1 )); static Int p_shell( USES_REGS1 );
STATIC_PROTO (Int p_system, ( USES_REGS1 )); static Int p_system( USES_REGS1 );
STATIC_PROTO (Int p_mv, ( USES_REGS1 )); static Int p_mv( USES_REGS1 );
STATIC_PROTO (Int p_dir_sp, ( USES_REGS1 )); static Int p_dir_sp( USES_REGS1 );
STATIC_PROTO (void InitRandom, (void)); static void InitRandom(void);
STATIC_PROTO (Int p_srandom, ( USES_REGS1 )); static Int p_srandom( USES_REGS1 );
STATIC_PROTO (Int p_alarm, ( USES_REGS1 )); static Int p_alarm( USES_REGS1 );
STATIC_PROTO (Int p_getenv, ( USES_REGS1 )); static Int p_getenv( USES_REGS1 );
STATIC_PROTO (Int p_putenv, ( USES_REGS1 )); static Int p_putenv( USES_REGS1 );
STATIC_PROTO (void set_fpu_exceptions, (int)); static void set_fpu_exceptions(int);
#ifdef MACYAP #ifdef MACYAP
STATIC_PROTO (int chdir, (char *)); static int chdir(char *);
/* #define signal skel_signal */ /* #define signal skel_signal */
#endif /* MACYAP */ #endif /* MACYAP */
STD_PROTO (void exit, (int)); void exit(int);
#ifdef _WIN32 #ifdef _WIN32
void void
@ -1037,7 +1037,7 @@ InitRandom (void)
#endif #endif
} }
STD_PROTO (extern int rand, (void)); extern int rand(void);
double double
@ -1094,7 +1094,7 @@ p_srandom ( USES_REGS1 )
#endif #endif
STATIC_PROTO (void InitSignals, (void)); static void InitSignals(void);
#define PLSIG_PREPARED 0x01 /* signal is prepared */ #define PLSIG_PREPARED 0x01 /* signal is prepared */
#define PLSIG_THROW 0x02 /* throw signal(num, name) */ #define PLSIG_THROW 0x02 /* throw signal(num, name) */
@ -1239,10 +1239,10 @@ Yap_signal_index(const char *name)
#include <sys/ucontext.h> #include <sys/ucontext.h>
#endif #endif
STATIC_PROTO (void HandleSIGSEGV, (int, siginfo_t *, ucontext_t *)); static void HandleSIGSEGV(int, siginfo_t *, ucontext_t *);
STATIC_PROTO (void HandleMatherr, (int, siginfo_t *, ucontext_t *)); static void HandleMatherr, (int, siginfo_t *, ucontext_t *);
STATIC_PROTO (void my_signal_info, (int, void (*)(int, siginfo_t *, ucontext_t *))); static void my_signal_info(int, void (*)(int, siginfo_t *, ucontext_t *));
STATIC_PROTO (void my_signal, (int, void (*)(int, siginfo_t *, ucontext_t *))); static void my_signal(int, void (*)(int, siginfo_t *, ucontext_t *));
/* This routine believes there is a continuous space starting from the /* This routine believes there is a continuous space starting from the
HeapBase and ending on TrailTop */ HeapBase and ending on TrailTop */
@ -1328,12 +1328,12 @@ my_signal(int sig, void (*handler)(int, siginfo_t *, ucontext_t *))
#elif defined(__linux__) #elif defined(__linux__)
STATIC_PROTO (RETSIGTYPE HandleMatherr, (int)); static RETSIGTYPE HandleMatherr(int);
#if HAVE_SIGSEGV && !defined(THREADS) #if HAVE_SIGSEGV && !defined(THREADS)
STATIC_PROTO (RETSIGTYPE HandleSIGSEGV, (int,siginfo_t *,void *)); static RETSIGTYPE HandleSIGSEGV(int,siginfo_t *,void *);
STATIC_PROTO (void my_signal_info, (int, void (*)(int,siginfo_t *,void *))); static void my_signal_info(int, void (*)(int,siginfo_t *,void *));
#endif #endif
STATIC_PROTO (void my_signal, (int, void (*)(int))); static void my_signal(int, void (*)(int));
/******** Handling floating point errors *******************/ /******** Handling floating point errors *******************/
@ -1457,10 +1457,10 @@ my_signal(int sig, void (*handler)(int))
#else /* if not (defined(__svr4__) || defined(__SVR4)) */ #else /* if not (defined(__svr4__) || defined(__SVR4)) */
STATIC_PROTO (RETSIGTYPE HandleMatherr, (int)); static RETSIGTYPE HandleMatherr(int);
STATIC_PROTO (RETSIGTYPE HandleSIGSEGV, (int)); static RETSIGTYPE HandleSIGSEGV(int);
STATIC_PROTO (void my_signal_info, (int, void (*)(int))); static void my_signal_info(int, void (*)(int));
STATIC_PROTO (void my_signal, (int, void (*)(int))); static void my_signal(int, void (*)(int));
/******** Handling floating point errors *******************/ /******** Handling floating point errors *******************/
@ -3163,7 +3163,7 @@ VaxFixFrame (dummy)
#include <windows.h> #include <windows.h>
int WINAPI STD_PROTO(win_yap, (HANDLE, DWORD, LPVOID)); int WINAPI win_yap(HANDLE, DWORD, LPVOID);
int WINAPI win_yap(HANDLE hinst, DWORD reason, LPVOID reserved) int WINAPI win_yap(HANDLE hinst, DWORD reason, LPVOID reserved)
{ {
@ -3184,7 +3184,7 @@ int WINAPI win_yap(HANDLE hinst, DWORD reason, LPVOID reserved)
#if (defined(YAPOR) || defined(THREADS)) && !defined(USE_PTHREAD_LOCKING) #if (defined(YAPOR) || defined(THREADS)) && !defined(USE_PTHREAD_LOCKING)
#ifdef sparc #ifdef sparc
void STD_PROTO(rw_lock_voodoo,(void)); void rw_lock_voodoo(void);
void void
rw_lock_voodoo(void) { rw_lock_voodoo(void) {

View File

@ -26,7 +26,7 @@
#include "clause.h" #include "clause.h"
#include "tracer.h" #include "tracer.h"
STATIC_PROTO(void send_tracer_message, (char *, char *, Int, char *, CELL *)); static void send_tracer_message(char *, char *, Int, char *, CELL *);
static void static void
send_tracer_message(char *start, char *name, Int arity, char *mname, CELL *args) send_tracer_message(char *start, char *name, Int arity, char *mname, CELL *args)

View File

@ -20,14 +20,14 @@
#include "absmi.h" #include "absmi.h"
STD_PROTO(int Yap_rational_tree_loop, (CELL *, CELL *, CELL **, CELL **)); int Yap_rational_tree_loop(CELL *, CELL *, CELL **, CELL **);
STATIC_PROTO(int OCUnify_complex, (CELL *, CELL *, CELL *)); static int OCUnify_complex(CELL *, CELL *, CELL *);
STATIC_PROTO(int OCUnify, (register CELL, register CELL)); static int OCUnify(register CELL, register CELL);
STATIC_PROTO(Int p_ocunify, ( USES_REGS1 )); static Int p_ocunify( USES_REGS1 );
#ifdef THREADED_CODE #ifdef THREADED_CODE
STATIC_PROTO(int rtable_hash_op, (OPCODE)); static int rtable_hash_op(OPCODE);
STATIC_PROTO(void InitReverseLookupOpcode, (void)); static void InitReverseLookupOpcode(void);
#endif #endif
/* support for rational trees and unification with occur checking */ /* support for rational trees and unification with occur checking */

View File

@ -51,26 +51,26 @@ static char SccsId[] = "%W% %G%";
/* You should include here the prototypes for all static functions */ /* You should include here the prototypes for all static functions */
#ifdef EUROTRA #ifdef EUROTRA
STATIC_PROTO(int p_clean, (void)); static int p_clean(void);
STATIC_PROTO(int p_namelength, (void)); static int p_namelength(void);
STATIC_PROTO(int p_getpid, (void)); static int p_getpid(void);
STATIC_PROTO(int p_exit, (void)); static int p_exit(void);
STATIC_PROTO(int p_incrcounter, (void)); static int p_incrcounter(void);
STATIC_PROTO(int p_setcounter, (void)); static int p_setcounter(void);
STATIC_PROTO(int p_trapsignal, (void)); static int p_trapsignal(void);
STATIC_PROTO(int subsumes, (Term, Term)); static int subsumes(Term, Term);
STATIC_PROTO(int p_subsumes, (void)); static int p_subsumes(void);
STATIC_PROTO(int p_grab_tokens, (void)); static int p_grab_tokens(void);
#endif #endif
#ifdef MACYAP #ifdef MACYAP
STATIC_PROTO(typedef int, (*SignalProc) ()); static typedef int(*SignalProc) ();
STATIC_PROTO(SignalProc skel_signal, (int, SignalProc)); static SignalProc skel_signal(int, SignalProc);
STATIC_PROTO(int chdir, (char *)); static int chdir(char *);
#endif #endif
#ifdef SFUNC #ifdef SFUNC
STATIC_PROTO(int p_softfunctor, (void)); static int p_softfunctor(void);
#endif /* SFUNC */ #endif /* SFUNC */

View File

@ -32,18 +32,18 @@ typedef struct {
} *vcell; } *vcell;
STATIC_PROTO(int copy_complex_term, (CELL *, CELL *, int, int, CELL *, CELL * CACHE_TYPE)); static int copy_complex_term(CELL *, CELL *, int, int, CELL *, CELL * CACHE_TYPE);
STATIC_PROTO(CELL vars_in_complex_term, (CELL *, CELL *, Term CACHE_TYPE)); static CELL vars_in_complex_term(CELL *, CELL *, Term CACHE_TYPE);
STATIC_PROTO(Int p_non_singletons_in_term, ( USES_REGS1)); static Int p_non_singletons_in_term( USES_REGS1);
STATIC_PROTO(CELL non_singletons_in_complex_term, (CELL *, CELL * CACHE_TYPE)); static CELL non_singletons_in_complex_term(CELL *, CELL * CACHE_TYPE);
STATIC_PROTO(Int p_variables_in_term, ( USES_REGS1 )); static Int p_variables_in_term( USES_REGS1 );
STATIC_PROTO(Int ground_complex_term, (CELL *, CELL * CACHE_TYPE)); static Int ground_complex_term(CELL *, CELL * CACHE_TYPE);
STATIC_PROTO(Int p_ground, ( USES_REGS1 )); static Int p_ground( USES_REGS1 );
STATIC_PROTO(Int p_copy_term, ( USES_REGS1 )); static Int p_copy_term( USES_REGS1 );
STATIC_PROTO(Int var_in_complex_term, (CELL *, CELL *, Term CACHE_TYPE)); static Int var_in_complex_term(CELL *, CELL *, Term CACHE_TYPE);
#ifdef DEBUG #ifdef DEBUG
STATIC_PROTO(Int p_force_trail_expansion, ( USES_REGS1 )); static Int p_force_trail_expansion( USES_REGS1 );
#endif /* DEBUG */ #endif /* DEBUG */
static inline void static inline void

View File

@ -78,15 +78,15 @@ typedef struct write_globs {
#define lastw wglb->lw #define lastw wglb->lw
#define last_minus wglb->last_atom_minus #define last_minus wglb->last_atom_minus
STATIC_PROTO(void wrputn, (Int, struct write_globs *)); static void wrputn(Int, struct write_globs *);
STATIC_PROTO(void wrputf, (Float, struct write_globs *)); static void wrputf(Float, struct write_globs *);
STATIC_PROTO(void wrputref, (CODEADDR, int, struct write_globs *)); static void wrputref(CODEADDR, int, struct write_globs *);
STATIC_PROTO(int legalAtom, (unsigned char *)); static int legalAtom(unsigned char *);
/*STATIC_PROTO(int LeftOpToProtect, (Atom, int)); /*static int LeftOpToProtect(Atom, int);
STATIC_PROTO(int RightOpToProtect, (Atom, int));*/ static int RightOpToProtect(Atom, int);*/
STATIC_PROTO(wtype AtomIsSymbols, (unsigned char *)); static wtype AtomIsSymbols(unsigned char *);
STATIC_PROTO(void putAtom, (Atom, int, struct write_globs *)); static void putAtom(Atom, int, struct write_globs *);
STATIC_PROTO(void writeTerm, (Term, int, int, int, struct write_globs *, struct rewind_term *)); static void writeTerm(Term, int, int, int, struct write_globs *, struct rewind_term *);
#define wrputc(X,WF) Sputcode(X,WF) /* writes a character */ #define wrputc(X,WF) Sputcode(X,WF) /* writes a character */

View File

@ -100,18 +100,13 @@ typedef struct ForeignLoadItem {
typedef void (*YapInitProc)(void); typedef void (*YapInitProc)(void);
void *Yap_LoadForeignFile(char *, int);
#ifndef STD_PROTO int Yap_CallForeignFile(void *, char *);
#define STD_PROTO(F,A) F A int Yap_CloseForeignFile(void *);
#endif Int Yap_LoadForeign(StringList, StringList, char *, YapInitProc *);
Int Yap_ReLoadForeign(StringList, StringList, char *, YapInitProc *);
void *STD_PROTO(Yap_LoadForeignFile,(char *, int)); void Yap_ReOpenLoadForeign(void);
int STD_PROTO(Yap_CallForeignFile,(void *, char *)); void Yap_ShutdownLoadForeign(void);
int STD_PROTO(Yap_CloseForeignFile,(void *));
Int STD_PROTO(Yap_LoadForeign,(StringList, StringList, char *, YapInitProc *));
Int STD_PROTO(Yap_ReLoadForeign,(StringList, StringList, char *, YapInitProc *));
void STD_PROTO(Yap_ReOpenLoadForeign,(void));
void STD_PROTO(Yap_ShutdownLoadForeign,(void));
#define EAGER_LOADING 1 #define EAGER_LOADING 1
#define GLOBAL_LOADING 2 #define GLOBAL_LOADING 2

View File

@ -371,11 +371,11 @@ IsBigIntTerm (Term t)
#ifdef USE_GMP #ifdef USE_GMP
Term STD_PROTO (Yap_MkBigIntTerm, (MP_INT *)); Term Yap_MkBigIntTerm(MP_INT *);
MP_INT *STD_PROTO (Yap_BigIntOfTerm, (Term)); MP_INT *Yap_BigIntOfTerm(Term);
Term STD_PROTO (Yap_MkBigRatTerm, (MP_RAT *)); Term Yap_MkBigRatTerm(MP_RAT *);
MP_RAT *STD_PROTO (Yap_BigRatOfTerm, (Term)); MP_RAT *Yap_BigRatOfTerm(Term);
INLINE_ONLY inline EXTERN void MPZ_SET (mpz_t, MP_INT *); INLINE_ONLY inline EXTERN void MPZ_SET (mpz_t, MP_INT *);
@ -636,11 +636,11 @@ INLINE_ONLY inline EXTERN void *Yap_BlobInfo(Term t)
#ifdef YAP_H #ifdef YAP_H
INLINE_ONLY inline EXTERN int STD_PROTO (unify_extension, (Functor, CELL, CELL *, CELL)); INLINE_ONLY inline EXTERN int unify_extension(Functor, CELL, CELL *, CELL);
EXTERN int STD_PROTO (unify_extension, (Functor, CELL, CELL *, CELL)); EXTERN int unify_extension(Functor, CELL, CELL *, CELL);
int STD_PROTO(Yap_gmp_tcmp_big_big,(Term, Term)); int Yap_gmp_tcmp_big_big(Term, Term);
INLINE_ONLY inline EXTERN int INLINE_ONLY inline EXTERN int
unify_extension (Functor f, CELL d0, CELL * pt0, CELL d1) unify_extension (Functor f, CELL d0, CELL * pt0, CELL d1)

View File

@ -542,6 +542,8 @@ typedef enum
GPROF_NEW_EXPAND_BLOCK GPROF_NEW_EXPAND_BLOCK
} gprof_info; } gprof_info;
#define MAX_EMPTY_WAKEUPS 16
/************************************************************************************************* /*************************************************************************************************
prototypes prototypes

View File

@ -90,7 +90,7 @@ typedef struct halt_hook {
struct halt_hook *next; struct halt_hook *next;
} halt_hook_entry; } halt_hook_entry;
int STD_PROTO(Yap_HaltRegisterHook,(HaltHookFunc, void *)); int Yap_HaltRegisterHook(HaltHookFunc, void *);
typedef struct atom_hash_entry { typedef struct atom_hash_entry {
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
@ -215,12 +215,12 @@ extern struct various_codes *Yap_heap_regs;
#if (defined(USE_SYSTEM_MALLOC) && HAVE_MALLINFO)||USE_DL_MALLOC #if (defined(USE_SYSTEM_MALLOC) && HAVE_MALLINFO)||USE_DL_MALLOC
UInt STD_PROTO(Yap_givemallinfo, (void)); UInt Yap_givemallinfo(void);
#endif #endif
ADDR STD_PROTO(Yap_ExpandPreAllocCodeSpace, (UInt, void *, int)); ADDR Yap_ExpandPreAllocCodeSpace(UInt, void *, int);
#define Yap_ReleasePreAllocCodeSpace(x) #define Yap_ReleasePreAllocCodeSpace(x)
ADDR STD_PROTO(Yap_InitPreAllocCodeSpace, (int)); ADDR Yap_InitPreAllocCodeSpace(int);
#include "inline-only.h" #include "inline-only.h"
INLINE_ONLY EXTERN inline ADDR INLINE_ONLY EXTERN inline ADDR

View File

@ -15,259 +15,257 @@
/* prototype file for Yap */ /* prototype file for Yap */
#define STD_PROTO(F,A) F A
#define STATIC_PROTO(F,A) static F A
/* absmi.c */ /* absmi.c */
Int STD_PROTO(Yap_absmi,(int)); Int Yap_absmi(int);
int STD_PROTO(Yap_absmiEND,(void)); int Yap_absmiEND(void);
/* adtdefs.c */ /* adtdefs.c */
Term STD_PROTO(Yap_ArrayToList,(Term *,int)); Term Yap_ArrayToList(Term *,int);
int STD_PROTO(Yap_GetName,(char *,UInt,Term)); int Yap_GetName(char *,UInt,Term);
Term STD_PROTO(Yap_GetValue,(Atom)); Term Yap_GetValue(Atom);
int STD_PROTO(Yap_HasOp,(Atom)); int Yap_HasOp(Atom);
struct operator_entry *STD_PROTO(Yap_GetOpPropForAModuleHavingALock,(AtomEntry *, Term)); struct operator_entry *Yap_GetOpPropForAModuleHavingALock(AtomEntry *, Term);
Atom STD_PROTO(Yap_LookupAtom,(char *)); Atom Yap_LookupAtom(char *);
Atom STD_PROTO(Yap_LookupMaybeWideAtom,(wchar_t *)); Atom Yap_LookupMaybeWideAtom(wchar_t *);
Atom STD_PROTO(Yap_LookupMaybeWideAtomWithLength,(wchar_t *, size_t)); Atom Yap_LookupMaybeWideAtomWithLength(wchar_t *, size_t);
Atom STD_PROTO(Yap_FullLookupAtom,(char *)); Atom Yap_FullLookupAtom(char *);
void STD_PROTO(Yap_LookupAtomWithAddress,(char *,AtomEntry *)); void Yap_LookupAtomWithAddress(char *,AtomEntry *);
Prop STD_PROTO(Yap_NewPredPropByFunctor,(struct FunctorEntryStruct *, Term)); Prop Yap_NewPredPropByFunctor(struct FunctorEntryStruct *, Term);
Prop STD_PROTO(Yap_NewPredPropByAtom,(struct AtomEntryStruct *, Term)); Prop Yap_NewPredPropByAtom(struct AtomEntryStruct *, Term);
Prop STD_PROTO(Yap_PredPropByFunctorNonThreadLocal,(struct FunctorEntryStruct *, Term)); Prop Yap_PredPropByFunctorNonThreadLocal(struct FunctorEntryStruct *, Term);
Prop STD_PROTO(Yap_PredPropByAtomNonThreadLocal,(struct AtomEntryStruct *, Term)); Prop Yap_PredPropByAtomNonThreadLocal(struct AtomEntryStruct *, Term);
Functor STD_PROTO(Yap_UnlockedMkFunctor,(AtomEntry *,unsigned int)); Functor Yap_UnlockedMkFunctor(AtomEntry *,unsigned int);
Functor STD_PROTO(Yap_MkFunctor,(Atom,unsigned int)); Functor Yap_MkFunctor(Atom,unsigned int);
void STD_PROTO(Yap_MkFunctorWithAddress,(Atom,unsigned int,FunctorEntry *)); void Yap_MkFunctorWithAddress(Atom,unsigned int,FunctorEntry *);
void STD_PROTO(Yap_PutValue,(Atom,Term)); void Yap_PutValue(Atom,Term);
void STD_PROTO(Yap_ReleaseAtom,(Atom)); void Yap_ReleaseAtom(Atom);
Term STD_PROTO(Yap_StringToList,(char *)); Term Yap_StringToList(char *);
Term STD_PROTO(Yap_NStringToList,(char *, size_t)); Term Yap_NStringToList(char *, size_t);
Term STD_PROTO(Yap_WideStringToList,(wchar_t *)); Term Yap_WideStringToList(wchar_t *);
Term STD_PROTO(Yap_NWideStringToList,(wchar_t *, size_t)); Term Yap_NWideStringToList(wchar_t *, size_t);
Term STD_PROTO(Yap_StringToDiffList,(char *,Term CACHE_TYPE)); Term Yap_StringToDiffList(char *,Term CACHE_TYPE);
Term STD_PROTO(Yap_NStringToDiffList,(char *,Term, size_t)); Term Yap_NStringToDiffList(char *,Term, size_t);
Term STD_PROTO(Yap_WideStringToDiffList,(wchar_t *,Term)); Term Yap_WideStringToDiffList(wchar_t *,Term);
Term STD_PROTO(Yap_NWideStringToDiffList,(wchar_t *,Term, size_t)); Term Yap_NWideStringToDiffList(wchar_t *,Term, size_t);
Term STD_PROTO(Yap_StringToListOfAtoms,(char *)); Term Yap_StringToListOfAtoms(char *);
Term STD_PROTO(Yap_NStringToListOfAtoms,(char *, size_t)); Term Yap_NStringToListOfAtoms(char *, size_t);
Term STD_PROTO(Yap_WideStringToListOfAtoms,(wchar_t *)); Term Yap_WideStringToListOfAtoms(wchar_t *);
Term STD_PROTO(Yap_NWideStringToListOfAtoms,(wchar_t *, size_t)); Term Yap_NWideStringToListOfAtoms(wchar_t *, size_t);
Term STD_PROTO(Yap_NWideStringToDiffListOfAtoms,(wchar_t *, Term, size_t)); Term Yap_NWideStringToDiffListOfAtoms(wchar_t *, Term, size_t);
int STD_PROTO(Yap_AtomIncreaseHold,(Atom)); int Yap_AtomIncreaseHold(Atom);
int STD_PROTO(Yap_AtomDecreaseHold,(Atom)); int Yap_AtomDecreaseHold(Atom);
struct operator_entry *STD_PROTO(Yap_OpPropForModule,(Atom, Term)); struct operator_entry *Yap_OpPropForModule(Atom, Term);
Int STD_PROTO(Yap_InitSlot,(Term CACHE_TYPE)); Int Yap_InitSlot(Term CACHE_TYPE);
Int STD_PROTO(Yap_NewSlots,(int CACHE_TYPE)); Int Yap_NewSlots(int CACHE_TYPE);
int STD_PROTO(Yap_RecoverSlots,(int CACHE_TYPE)); int Yap_RecoverSlots(int CACHE_TYPE);
#ifdef SFUNC #ifdef SFUNC
Term STD_PROTO(MkSFTerm,(Functor,int,Term *,Term)); Term MkSFTerm(Functor,int,Term *,Term);
CELL STD_PROTO(*ArgsOfSFTerm,(Term)); CELL *ArgsOfSFTerm(Term);
#endif #endif
Prop STD_PROTO(Yap_GetPredPropByAtom,(Atom, Term)); Prop Yap_GetPredPropByAtom(Atom, Term);
Prop STD_PROTO(Yap_GetPredPropByFunc,(Functor, Term)); Prop Yap_GetPredPropByFunc(Functor, Term);
Prop STD_PROTO(Yap_GetPredPropByAtomInThisModule,(Atom, Term)); Prop Yap_GetPredPropByAtomInThisModule(Atom, Term);
Prop STD_PROTO(Yap_GetPredPropByFuncInThisModule,(Functor, Term)); Prop Yap_GetPredPropByFuncInThisModule(Functor, Term);
Prop STD_PROTO(Yap_GetPredPropHavingLock,(Atom,unsigned int, Term)); Prop Yap_GetPredPropHavingLock(Atom,unsigned int, Term);
Prop STD_PROTO(Yap_GetExpProp,(Atom,unsigned int)); Prop Yap_GetExpProp(Atom,unsigned int);
Prop STD_PROTO(Yap_GetExpPropHavingLock,(AtomEntry *,unsigned int)); Prop Yap_GetExpPropHavingLock(AtomEntry *,unsigned int);
/* agc.c */ /* agc.c */
void STD_PROTO(Yap_atom_gc, (CACHE_TYPE1)); void Yap_atom_gc( CACHE_TYPE1 );
void STD_PROTO(Yap_init_agc, (void)); void Yap_init_agc( void );
/* alloc.c */ /* alloc.c */
void STD_PROTO(Yap_FreeCodeSpace,(char *)); void Yap_FreeCodeSpace(char *);
char *STD_PROTO(Yap_AllocAtomSpace,(size_t)); char *Yap_AllocAtomSpace(size_t);
char *STD_PROTO(Yap_AllocCodeSpace,(size_t)); char *Yap_AllocCodeSpace(size_t);
char *STD_PROTO(Yap_ReallocCodeSpace,(char *,size_t)); char *Yap_ReallocCodeSpace(char *,size_t);
ADDR STD_PROTO(Yap_AllocFromForeignArea,(Int)); ADDR Yap_AllocFromForeignArea(Int);
int STD_PROTO(Yap_ExtendWorkSpace,(Int)); int Yap_ExtendWorkSpace(Int);
void STD_PROTO(Yap_FreeAtomSpace,(char *)); void Yap_FreeAtomSpace(char *);
int STD_PROTO(Yap_FreeWorkSpace, (void)); int Yap_FreeWorkSpace(void);
void STD_PROTO(Yap_InitMemory,(UInt,UInt,UInt)); void Yap_InitMemory(UInt,UInt,UInt);
void STD_PROTO(Yap_InitExStacks,(int,int,int)); void Yap_InitExStacks(int,int,int);
/* amasm.c */ /* amasm.c */
OPCODE STD_PROTO(Yap_opcode,(op_numbers)); OPCODE Yap_opcode(op_numbers);
/* analyst.c */ /* analyst.c */
#ifdef ANALYST #ifdef ANALYST
void STD_PROTO(Yap_InitAnalystPreds,(void)); void Yap_InitAnalystPreds(void);
#endif /* ANALYST */ #endif /* ANALYST */
/* arrays.c */ /* arrays.c */
void STD_PROTO(Yap_InitArrayPreds,(void)); void Yap_InitArrayPreds(void);
/* attvar.c */ /* attvar.c */
void STD_PROTO(Yap_InitAttVarPreds,(void)); void Yap_InitAttVarPreds(void);
void Yap_MkEmptyWakeUp(Atom mod);
/* bb.c */ /* bb.c */
void STD_PROTO(Yap_InitBBPreds,(void)); void Yap_InitBBPreds(void);
/* bignum.c */ /* bignum.c */
Term STD_PROTO(Yap_MkULLIntTerm, (YAP_ULONG_LONG)); Term Yap_MkULLIntTerm(YAP_ULONG_LONG);
int STD_PROTO(Yap_IsStringTerm, (Term)); int Yap_IsStringTerm(Term);
int STD_PROTO(Yap_IsWideStringTerm, (Term)); int Yap_IsWideStringTerm(Term);
Term STD_PROTO(Yap_RatTermToApplTerm, (Term)); Term Yap_RatTermToApplTerm(Term);
void STD_PROTO(Yap_InitBigNums, (void)); void Yap_InitBigNums(void);
Term STD_PROTO(Yap_AllocExternalDataInStack, (CELL, size_t)); Term Yap_AllocExternalDataInStack(CELL, size_t);
int STD_PROTO(Yap_CleanOpaqueVariable, (CELL *)); int Yap_CleanOpaqueVariable(CELL *);
/* c_interface.c */ /* c_interface.c */
Int STD_PROTO(YAP_Execute,(struct pred_entry *, CPredicate)); Int YAP_Execute(struct pred_entry *, CPredicate);
Int STD_PROTO(YAP_ExecuteFirst,(struct pred_entry *, CPredicate)); Int YAP_ExecuteFirst(struct pred_entry *, CPredicate);
Int STD_PROTO(YAP_ExecuteNext,(struct pred_entry *, CPredicate)); Int YAP_ExecuteNext(struct pred_entry *, CPredicate);
Int STD_PROTO(YAP_ExecuteOnCut,(struct pred_entry *, CPredicate, struct cut_c_str *)); Int YAP_ExecuteOnCut(struct pred_entry *, CPredicate, struct cut_c_str *);
/* cdmgr.c */ /* cdmgr.c */
Term STD_PROTO(Yap_all_calls,(void)); Term Yap_all_calls(void);
Atom STD_PROTO(Yap_ConsultingFile,(void)); Atom Yap_ConsultingFile(void);
struct pred_entry *STD_PROTO(Yap_PredForChoicePt,(choiceptr)); struct pred_entry *Yap_PredForChoicePt(choiceptr);
void STD_PROTO(Yap_InitCdMgr,(void)); void Yap_InitCdMgr(void);
void STD_PROTO(Yap_init_consult,(int, char *)); void Yap_init_consult(int, char *);
void STD_PROTO(Yap_end_consult,(void)); void Yap_end_consult(void);
void STD_PROTO(Yap_Abolish,(struct pred_entry *)); void Yap_Abolish(struct pred_entry *);
void STD_PROTO(Yap_BuildMegaClause,(struct pred_entry *)); void Yap_BuildMegaClause(struct pred_entry *);
void STD_PROTO(Yap_EraseMegaClause,(yamop *,struct pred_entry *)); void Yap_EraseMegaClause(yamop *,struct pred_entry *);
void STD_PROTO(Yap_ResetConsultStack,(void)); void Yap_ResetConsultStack(void);
void STD_PROTO(Yap_AssertzClause,(struct pred_entry *, yamop *)); void Yap_AssertzClause(struct pred_entry *, yamop *);
void Yap_HidePred(struct pred_entry *pe); void Yap_HidePred(struct pred_entry *pe);
/* cmppreds.c */ /* cmppreds.c */
Int STD_PROTO(Yap_compare_terms,(Term,Term)); Int Yap_compare_terms(Term,Term);
void STD_PROTO(Yap_InitCmpPreds,(void)); Int Yap_acmp(Term, Term USES_REGS);
void Yap_InitCmpPreds(void);
/* compiler.c */ /* compiler.c */
yamop *STD_PROTO(Yap_cclause,(Term, Int, Term, Term)); yamop *Yap_cclause(Term, Int, Term, Term);
/* computils.c */ /* computils.c */
/* corout.c */ /* corout.c */
void STD_PROTO(Yap_InitCoroutPreds,(void)); void Yap_InitCoroutPreds(void);
#ifdef COROUTINING #ifdef COROUTINING
Term STD_PROTO(Yap_ListOfWokenGoals,(void)); Term Yap_ListOfWokenGoals(void);
void STD_PROTO(Yap_WakeUp,(CELL *)); void Yap_WakeUp(CELL *);
#endif #endif
/* dbase.c */ /* dbase.c */
struct pred_entry *STD_PROTO(Yap_FindLUIntKey,(Int)); struct pred_entry *Yap_FindLUIntKey(Int);
int STD_PROTO(Yap_DBTrailOverflow,(void)); int Yap_DBTrailOverflow(void);
CELL STD_PROTO(Yap_EvalMasks,(Term,CELL *)); CELL Yap_EvalMasks(Term,CELL *);
void STD_PROTO(Yap_InitBackDB,(void)); void Yap_InitBackDB(void);
void STD_PROTO(Yap_InitDBPreds,(void)); void Yap_InitDBPreds(void);
/* errors.c */ /* errors.c */
void STD_PROTO(Yap_RestartYap,(int)); void Yap_RestartYap(int);
void STD_PROTO(Yap_exit,(int)); void Yap_exit(int);
yamop *STD_PROTO(Yap_Error,(yap_error_number,Term,char *msg, ...)); yamop *Yap_Error(yap_error_number,Term,char *msg, ...);
yamop *STD_PROTO(Yap_NilError,(yap_error_number,char *msg, ...)); yamop *Yap_NilError(yap_error_number,char *msg, ...);
/* eval.c */ /* eval.c */
void STD_PROTO(Yap_InitEval,(void)); void Yap_InitEval(void);
/* exec.c */ /* exec.c */
Term STD_PROTO(Yap_ExecuteCallMetaCall,(Term)); Term Yap_ExecuteCallMetaCall(Term);
void STD_PROTO(Yap_InitExecFs,(void)); void Yap_InitExecFs(void);
Int STD_PROTO(Yap_JumpToEnv,(Term)); Int Yap_JumpToEnv(Term);
Term STD_PROTO(Yap_RunTopGoal,(Term)); Term Yap_RunTopGoal(Term);
void STD_PROTO(Yap_ResetExceptionTerm,(int)); void Yap_ResetExceptionTerm(int);
Int STD_PROTO(Yap_execute_goal,(Term, int, Term)); Int Yap_execute_goal(Term, int, Term);
Int STD_PROTO(Yap_exec_absmi,(int)); Int Yap_exec_absmi(int);
void STD_PROTO(Yap_trust_last,(void)); void Yap_trust_last(void);
Term STD_PROTO(Yap_GetException,(void)); Term Yap_GetException(void);
void STD_PROTO(Yap_PrepGoal,(UInt, CELL *, choiceptr USES_REGS)); void Yap_PrepGoal(UInt, CELL *, choiceptr USES_REGS);
/* exo.c */ /* exo.c */
void STD_PROTO(Yap_InitExoPreds,(void)); void Yap_InitExoPreds(void);
void Yap_udi_range_init(void); void Yap_udi_Interval_init(void);
/* foreign.c */ /* foreign.c */
char *STD_PROTO(Yap_FindExecutable,(void)); char *Yap_FindExecutable(void);
/* gprof.c */ /* gprof.c */
void STD_PROTO(Yap_InitLowProf,(void)); void Yap_InitLowProf(void);
#if LOW_PROF #if LOW_PROF
void STD_PROTO(Yap_inform_profiler_of_clause__,(void *,void *,struct pred_entry *, gprof_info)); void Yap_inform_profiler_of_clause__(void *,void *,struct pred_entry *, gprof_info);
#define Yap_inform_profiler_of_clause(CODE0,CODEF,AP,MODE) {if (GLOBAL_FPreds) Yap_inform_profiler_of_clause__(CODE0,CODEF,AP,MODE);} #define Yap_inform_profiler_of_clause(CODE0,CODEF,AP,MODE) {if (GLOBAL_FPreds) Yap_inform_profiler_of_clause__(CODE0,CODEF,AP,MODE);}
#else #else
#define Yap_inform_profiler_of_clause(CODE0,CODEF,AP,MODE) #define Yap_inform_profiler_of_clause(CODE0,CODEF,AP,MODE)
#endif #endif
void STD_PROTO(Yap_tell_gprof,(yamop *)); void Yap_tell_gprof(yamop *);
/* globals.c */ /* globals.c */
Term STD_PROTO(Yap_NewArena,(UInt,CELL *)); Term Yap_NewArena(UInt,CELL *);
CELL *STD_PROTO(Yap_GetFromArena,(Term *,UInt,UInt)); CELL *Yap_GetFromArena(Term *,UInt,UInt);
void STD_PROTO(Yap_InitGlobals,(void)); void Yap_InitGlobals(void);
Term STD_PROTO(Yap_SaveTerm, (Term)); Term Yap_SaveTerm(Term);
Term STD_PROTO(Yap_SetGlobalVal, (Atom, Term)); Term Yap_SetGlobalVal(Atom, Term);
Int STD_PROTO(Yap_DeleteGlobal, (Atom)); Int Yap_DeleteGlobal(Atom);
void STD_PROTO(Yap_AllocateDefaultArena, (Int, Int, int)); void Yap_AllocateDefaultArena(Int, Int, int);
/* grow.c */ /* grow.c */
Int STD_PROTO(Yap_total_stack_shift_time,(void)); Int Yap_total_stack_shift_time(void);
void STD_PROTO(Yap_InitGrowPreds, (void)); void Yap_InitGrowPreds(void);
UInt STD_PROTO(Yap_InsertInGlobal, (CELL *, UInt)); UInt Yap_InsertInGlobal(CELL *, UInt);
int STD_PROTO(Yap_growheap, (int, size_t, void *)); int Yap_growheap(int, size_t, void *);
int STD_PROTO(Yap_growstack, (long)); int Yap_growstack( size_t );
int STD_PROTO(Yap_growtrail, (long, int)); int Yap_growtrail(long, int);
int STD_PROTO(Yap_growglobal, (CELL **)); int Yap_growglobal(CELL **);
CELL **STD_PROTO(Yap_shift_visit, (CELL **, CELL ***, CELL ***)); CELL **Yap_shift_visit(CELL **, CELL ***, CELL ***);
#ifdef THREADS #ifdef THREADS
void STD_PROTO(Yap_CopyThreadStacks, (int, int, int)); void Yap_CopyThreadStacks(int, int, int);
#endif #endif
/* heapgc.c */ /* heapgc.c */
Int STD_PROTO(Yap_total_gc_time,(void)); Int Yap_total_gc_time(void);
void STD_PROTO(Yap_init_gc,(void)); void Yap_init_gc(void);
int STD_PROTO(Yap_is_gc_verbose, (void)); int Yap_is_gc_verbose(void);
int STD_PROTO(Yap_gc, (Int, CELL *, yamop *)); int Yap_gc(Int, CELL *, yamop *);
int STD_PROTO(Yap_gcl, (UInt, Int, CELL *, yamop *)); int Yap_gcl(UInt, Int, CELL *, yamop *);
/* init.c */ /* init.c */
#ifdef DEBUG #ifdef DEBUG
int STD_PROTO(Yap_DebugPutc,(int,wchar_t)); int Yap_DebugPutc(int,wchar_t);
void STD_PROTO(Yap_DebugSetIFile,(char *)); void Yap_DebugSetIFile(char *);
void STD_PROTO(Yap_DebugEndline,(void)); void Yap_DebugEndline(void);
int STD_PROTO(Yap_DebugGetc,(void)); int Yap_DebugGetc(void);
#endif #endif
int STD_PROTO(Yap_IsOpType,(char *)); int Yap_IsOpType(char *);
void STD_PROTO(Yap_InitCPred,(char *, unsigned long int, CPredicate, UInt)); void Yap_InitCPred(char *, unsigned long int, CPredicate, UInt);
void STD_PROTO(Yap_InitAsmPred,(char *, unsigned long int, int, CPredicate, UInt)); void Yap_InitAsmPred(char *, unsigned long int, int, CPredicate, UInt);
void STD_PROTO(Yap_InitCmpPred,(char *, unsigned long int, CmpPredicate, UInt)); void Yap_InitCmpPred(char *, unsigned long int, CmpPredicate, UInt);
void STD_PROTO(Yap_InitCPredBack,(char *, unsigned long int, unsigned int, CPredicate,CPredicate,UInt)); void Yap_InitCPredBack(char *, unsigned long int, unsigned int, CPredicate,CPredicate,UInt);
void STD_PROTO(Yap_InitCPredBackCut,(char *, unsigned long int, unsigned int, CPredicate,CPredicate,CPredicate,UInt)); void Yap_InitCPredBackCut(char *, unsigned long int, unsigned int, CPredicate,CPredicate,CPredicate,UInt);
#ifdef CUT_C #ifdef CUT_C
void STD_PROTO(Yap_InitCPredBack_,(char *, unsigned long int, unsigned int, CPredicate,CPredicate,CPredicate,UInt)); void Yap_InitCPredBack_(char *, unsigned long int, unsigned int, CPredicate,CPredicate,CPredicate,UInt);
#endif #endif
void STD_PROTO(Yap_InitWorkspace,(UInt,UInt,UInt,UInt,UInt,int,int,int)); void Yap_InitWorkspace(UInt,UInt,UInt,UInt,UInt,int,int,int);
#ifdef YAPOR #ifdef YAPOR
void STD_PROTO(Yap_init_yapor_workers, (void)); void Yap_init_yapor_workers(void);
#endif /* YAPOR */ #endif /* YAPOR */
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
void STD_PROTO(Yap_KillStacks,(int)); void Yap_KillStacks(int);
#else #else
void STD_PROTO(Yap_KillStacks,(int)); void Yap_KillStacks(int);
#endif #endif
void STD_PROTO(Yap_InitYaamRegs,(int)); void Yap_InitYaamRegs(int);
void STD_PROTO(Yap_ReInitWallTime, (void)); void Yap_ReInitWallTime(void);
int STD_PROTO(Yap_OpDec,(int,char *,Atom,Term)); int Yap_OpDec(int,char *,Atom,Term);
void STD_PROTO(Yap_CloseScratchPad,(void)); void Yap_CloseScratchPad(void);
/* inlines.c */ /* inlines.c */
void STD_PROTO(Yap_InitInlines,(void)); void Yap_InitInlines(void);
int STD_PROTO(Yap_eq,(Term, Term)); int Yap_eq(Term, Term);
/* iopreds.c */ /* iopreds.c */
void STD_PROTO(Yap_InitBackIO,(void)); void Yap_InitBackIO(void);
void STD_PROTO(Yap_InitIOPreds,(void)); void Yap_InitIOPreds(void);
void *Yap_GetStreamHandle(Atom at); void *Yap_GetStreamHandle(Atom at);
void *Yap_GetInputStream(Atom at); void *Yap_GetInputStream(Atom at);
void *Yap_GetOutputStream(Atom at); void *Yap_GetOutputStream(Atom at);
@ -275,159 +273,159 @@ void *Yap_GetOutputStream(Atom at);
extern void Yap_DebugPlWrite (Term t); extern void Yap_DebugPlWrite (Term t);
extern void Yap_DebugErrorPutc (int n); extern void Yap_DebugErrorPutc (int n);
#endif #endif
int STD_PROTO(Yap_readTerm, (void *, Term *, Term *, Term *, Term *)); int Yap_readTerm(void *, Term *, Term *, Term *, Term *);
void STD_PROTO(Yap_PlWriteToStream, (Term, int, int)); void Yap_PlWriteToStream(Term, int, int);
/* depth_lim.c */ /* depth_lim.c */
void STD_PROTO(Yap_InitItDeepenPreds,(void)); void Yap_InitItDeepenPreds(void);
/* load_foreign.c */ /* load_foreign.c */
void STD_PROTO(Yap_InitLoadForeign,(void)); void Yap_InitLoadForeign(void);
/* mavar.c */ /* mavar.c */
void STD_PROTO(Yap_InitMaVarCPreds,(void)); void Yap_InitMaVarCPreds(void);
Term STD_PROTO(Yap_NewTimedVar,(Term)); Term Yap_NewTimedVar(Term);
Term STD_PROTO(Yap_NewEmptyTimedVar,(void)); Term Yap_NewEmptyTimedVar(void);
Term STD_PROTO(Yap_ReadTimedVar,(Term)); Term Yap_ReadTimedVar(Term);
Term STD_PROTO(Yap_UpdateTimedVar,(Term, Term)); Term Yap_UpdateTimedVar(Term, Term);
/* modules.c */ /* modules.c */
Term STD_PROTO(Yap_Module, (Term)); Term Yap_Module(Term);
Term STD_PROTO(Yap_Module_Name, (struct pred_entry *)); Term Yap_Module_Name(struct pred_entry *);
struct pred_entry *STD_PROTO(Yap_ModulePred, (Term)); struct pred_entry *Yap_ModulePred(Term);
void STD_PROTO(Yap_NewModulePred, (Term, struct pred_entry *)); void Yap_NewModulePred(Term, struct pred_entry *);
Term STD_PROTO(Yap_StripModule, (Term, Term *)); Term Yap_StripModule(Term, Term *);
void STD_PROTO(Yap_InitModules, (void)); void Yap_InitModules(void);
void STD_PROTO(Yap_InitModulesC, (void)); void Yap_InitModulesC(void);
#if HAVE_MPI #if HAVE_MPI
/* mpi.c */ /* mpi.c */
void STD_PROTO(Yap_InitMPI,(void)); void Yap_InitMPI(void);
#endif #endif
#if HAVE_MPE #if HAVE_MPE
/* mpe.c */ /* mpe.c */
void STD_PROTO(Yap_InitMPE,(void)); void Yap_InitMPE(void);
#endif #endif
/* other.c */ /* other.c */
Term STD_PROTO(Yap_MkApplTerm,(Functor,unsigned int,Term *)); Term Yap_MkApplTerm(Functor,unsigned int,Term *);
Term STD_PROTO(Yap_MkNewApplTerm,(Functor,unsigned int)); Term Yap_MkNewApplTerm(Functor,unsigned int);
Term STD_PROTO(Yap_MkNewPairTerm,(void)); Term Yap_MkNewPairTerm(void);
Term STD_PROTO(Yap_Globalise,(Term)); Term Yap_Globalise(Term);
/* parser.c */ /* parser.c */
Term STD_PROTO(Yap_Parse,(void)); Term Yap_Parse(void);
/* readutil.c */ /* readutil.c */
void STD_PROTO(Yap_InitReadUtil,(void)); void Yap_InitReadUtil(void);
/* qly.c */ /* qly.c */
void STD_PROTO(Yap_InitQLY,(void)); void Yap_InitQLY(void);
int STD_PROTO(Yap_Restore,(char *, char *)); int Yap_Restore(char *, char *);
void STD_PROTO(Yap_InitQLYR,(void)); void Yap_InitQLYR(void);
/* range.c */ /* range.c */
void Yap_InitRange(void); void Yap_InitRange(void);
/* save.c */ /* save.c */
int STD_PROTO(Yap_SavedInfo,(char *,char *,CELL *,CELL *,CELL *)); int Yap_SavedInfo(char *,char *,CELL *,CELL *,CELL *);
int STD_PROTO(Yap_SavedStateRestore,(char *, char *)); int Yap_SavedStateRestore(char *, char *);
struct io_stream *STD_PROTO(Yap_OpenRestore,(char *, char *)); struct io_stream *Yap_OpenRestore(char *, char *);
void STD_PROTO(Yap_InitSavePreds,(void)); void Yap_InitSavePreds(void);
/* scanner.c */ /* scanner.c */
/* signals.c */ /* signals.c */
void STD_PROTO(Yap_signal,(yap_signals)); void Yap_signal(yap_signals);
void STD_PROTO(Yap_undo_signal,(yap_signals)); void Yap_undo_signal(yap_signals);
void STD_PROTO(Yap_InitSignalCPreds,(void)); void Yap_InitSignalCPreds(void);
/* sort.c */ /* sort.c */
void STD_PROTO(Yap_InitSortPreds,(void)); void Yap_InitSortPreds(void);
/* stdpreds.c */ /* stdpreds.c */
void STD_PROTO(Yap_InitBackCPreds,(void)); void Yap_InitBackCPreds(void);
void STD_PROTO(Yap_InitCPreds,(void)); void Yap_InitCPreds(void);
void STD_PROTO(Yap_show_statistics,(void)); void Yap_show_statistics(void);
int STD_PROTO(Yap_IsOpMaxPrio,(Atom)); int Yap_IsOpMaxPrio(Atom);
/* sysbits.c */ /* sysbits.c */
void STD_PROTO(Yap_InitPageSize, (void)); void Yap_InitPageSize(void);
void STD_PROTO(Yap_set_fpu_exceptions,(int)); void Yap_set_fpu_exceptions(int);
UInt STD_PROTO(Yap_cputime,(void)); UInt Yap_cputime(void);
Int STD_PROTO(Yap_walltime,(void)); Int Yap_walltime(void);
int STD_PROTO(Yap_dir_separator,(int)); int Yap_dir_separator(int);
int STD_PROTO(Yap_volume_header,(char *)); int Yap_volume_header(char *);
void STD_PROTO(Yap_InitSysPath,(void)); void Yap_InitSysPath(void);
int STD_PROTO(Yap_signal_index,(const char *)); int Yap_signal_index(const char *);
#ifdef MAC #ifdef MAC
void STD_PROTO(Yap_SetTextFile,(char *)); void Yap_SetTextFile(char *);
#endif #endif
int STD_PROTO(Yap_getcwd,(const char *, int)); int Yap_getcwd(const char *, int);
void STD_PROTO(Yap_cputime_interval,(Int *,Int *)); void Yap_cputime_interval(Int *,Int *);
void STD_PROTO(Yap_systime_interval,(Int *,Int *)); void Yap_systime_interval(Int *,Int *);
void STD_PROTO(Yap_walltime_interval,(Int *,Int *)); void Yap_walltime_interval(Int *,Int *);
void STD_PROTO(Yap_InitSysbits,(void)); void Yap_InitSysbits(void);
void STD_PROTO(Yap_InitSysPreds,(void)); void Yap_InitSysPreds(void);
void STD_PROTO(Yap_InitTime,(int)); void Yap_InitTime(int);
int STD_PROTO(Yap_TrueFileName, (char *, char *, int)); int Yap_TrueFileName(char *, char *, int);
double STD_PROTO(Yap_random, (void)); double Yap_random(void);
#ifdef _WIN32 #ifdef _WIN32
char *STD_PROTO(Yap_RegistryGetString,(char *)); char *Yap_RegistryGetString(char *);
void STD_PROTO(Yap_WinError,(char *)); void Yap_WinError(char *);
#endif #endif
/* threads.c */ /* threads.c */
void STD_PROTO(Yap_InitThreadPreds,(void)); void Yap_InitThreadPreds(void);
#if THREADS #if THREADS
int STD_PROTO(Yap_InitThread,(int)); int Yap_InitThread(int);
#endif #endif
/* tracer.c */ /* tracer.c */
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
void STD_PROTO(Yap_InitLowLevelTrace,(void)); void Yap_InitLowLevelTrace(void);
#endif #endif
/* udi.c */ /* udi.c */
void STD_PROTO(Yap_udi_init,(void)); void Yap_udi_init(void);
void STD_PROTO(Yap_udi_abolish,(struct pred_entry *)); void Yap_udi_abolish(struct pred_entry *);
/* unify.c */ /* unify.c */
int STD_PROTO(Yap_rational_tree_loop, (CELL *, CELL *, CELL **, CELL **)); int Yap_rational_tree_loop(CELL *, CELL *, CELL **, CELL **);
void STD_PROTO(Yap_InitAbsmi,(void)); void Yap_InitAbsmi(void);
void STD_PROTO(Yap_InitUnify,(void)); void Yap_InitUnify(void);
void STD_PROTO(Yap_TrimTrail,(void)); void Yap_TrimTrail(void);
int STD_PROTO(Yap_Unifiable,(Term d0, Term d1)); int Yap_Unifiable(Term d0, Term d1);
int STD_PROTO(Yap_IUnify,(register CELL d0,register CELL d1)); int Yap_IUnify(register CELL d0,register CELL d1);
/* userpreds.c */ /* userpreds.c */
void STD_PROTO(Yap_InitUserCPreds,(void)); void Yap_InitUserCPreds(void);
void STD_PROTO(Yap_InitUserBacks,(void)); void Yap_InitUserBacks(void);
/* utilpreds.c */ /* utilpreds.c */
Term STD_PROTO(Yap_CopyTerm,(Term)); Term Yap_CopyTerm(Term);
int STD_PROTO(Yap_Variant,(Term, Term)); int Yap_Variant(Term, Term);
size_t STD_PROTO(Yap_ExportTerm,(Term, char *, size_t, UInt)); size_t Yap_ExportTerm(Term, char *, size_t, UInt);
size_t STD_PROTO(Yap_SizeOfExportedTerm,(char *)); size_t Yap_SizeOfExportedTerm(char *);
Term STD_PROTO(Yap_ImportTerm,(char *)); Term Yap_ImportTerm(char *);
int STD_PROTO(Yap_IsListTerm,(Term)); int Yap_IsListTerm(Term);
int STD_PROTO(Yap_IsListOrPartialListTerm,(Term)); int Yap_IsListOrPartialListTerm(Term);
Term STD_PROTO(Yap_CopyTermNoShare,(Term)); Term Yap_CopyTermNoShare(Term);
int STD_PROTO(Yap_SizeGroundTerm,(Term, int)); int Yap_SizeGroundTerm(Term, int);
int STD_PROTO(Yap_IsGroundTerm,(Term)); int Yap_IsGroundTerm(Term);
int STD_PROTO(Yap_IsAcyclicTerm,(Term)); int Yap_IsAcyclicTerm(Term);
void STD_PROTO(Yap_InitUtilCPreds,(void)); void Yap_InitUtilCPreds(void);
Int STD_PROTO(Yap_TermHash,(Term, Int, Int, int)); Int Yap_TermHash(Term, Int, Int, int);
Int STD_PROTO(Yap_NumberVars,(Term, Int, int)); Int Yap_NumberVars(Term, Int, int);
Term STD_PROTO(Yap_UnNumberTerm,(Term, int)); Term Yap_UnNumberTerm(Term, int);
Int STD_PROTO(Yap_SkipList,(Term *, Term **)); Int Yap_SkipList(Term *, Term **);
/* yap.c */ /* yap.c */
/* write.c */ /* write.c */
void STD_PROTO(Yap_plwrite,(Term, void *, int, int, int)); void Yap_plwrite(Term, void *, int, int, int);
/* MYDDAS */ /* MYDDAS */
@ -435,44 +433,44 @@ void STD_PROTO(Yap_plwrite,(Term, void *, int, int, int));
#if defined MYDDAS_MYSQL || defined MYDDAS_ODBC #if defined MYDDAS_MYSQL || defined MYDDAS_ODBC
/* myddas_initialization.c */ /* myddas_initialization.c */
MYDDAS_GLOBAL STD_PROTO(myddas_init_initialize_myddas,(void)); MYDDAS_GLOBAL myddas_init_initialize_myddas(void);
MYDDAS_UTIL_CONNECTION STD_PROTO(myddas_init_initialize_connection,(void *,void *,MYDDAS_UTIL_CONNECTION)); MYDDAS_UTIL_CONNECTION myddas_init_initialize_connection(void *,void *,MYDDAS_UTIL_CONNECTION);
MYDDAS_UTIL_PREDICATE STD_PROTO(myddas_init_initialize_predicate,(char *, int, char *,MYDDAS_UTIL_PREDICATE)); MYDDAS_UTIL_PREDICATE myddas_init_initialize_predicate(char *, int, char *,MYDDAS_UTIL_PREDICATE);
#ifdef MYDDAS_STATS #ifdef MYDDAS_STATS
/* myddas_statistics.c */ /* myddas_statistics.c */
MYDDAS_GLOBAL STD_PROTO(myddas_stats_initialize_global_stats,(MYDDAS_GLOBAL)); MYDDAS_GLOBAL myddas_stats_initialize_global_stats(MYDDAS_GLOBAL);
MYDDAS_STATS_STRUCT STD_PROTO(myddas_stats_initialize_connection_stats,(void)); MYDDAS_STATS_STRUCT myddas_stats_initialize_connection_stats(void);
void STD_PROTO(myddas_stats_delete_stats_list,(MYDDAS_STATS_STRUCT)); void myddas_stats_delete_stats_list(MYDDAS_STATS_STRUCT);
#endif /* MYDDAS_STATS */ #endif /* MYDDAS_STATS */
#ifdef MYDDAS_MYSQL #ifdef MYDDAS_MYSQL
/* myddas_util.c */ /* myddas_util.c */
void STD_PROTO(myddas_util_table_write,(MYSQL_RES *)); void myddas_util_table_write(MYSQL_RES *);
#endif #endif
Short STD_PROTO(myddas_util_connection_type,(void *)); Short myddas_util_connection_type(void *);
MYDDAS_UTIL_CONNECTION STD_PROTO(myddas_util_add_connection,(void *,void *)); MYDDAS_UTIL_CONNECTION myddas_util_add_connection(void *,void *);
MYDDAS_UTIL_CONNECTION STD_PROTO(myddas_util_search_connection,(void *)); MYDDAS_UTIL_CONNECTION myddas_util_search_connection(void *);
void STD_PROTO(myddas_util_delete_connection,(void *)); void myddas_util_delete_connection(void *);
MYDDAS_UTIL_CONNECTION STD_PROTO(myddas_util_add_predicate,(char * ,Int , char *,void *)); MYDDAS_UTIL_CONNECTION myddas_util_add_predicate(char * ,Int , char *,void *);
MYDDAS_UTIL_PREDICATE STD_PROTO(myddas_util_search_predicate,(char * ,Int , char *)); MYDDAS_UTIL_PREDICATE myddas_util_search_predicate(char * ,Int , char *);
void STD_PROTO(myddas_util_delete_predicate,(MYDDAS_UTIL_PREDICATE)); void myddas_util_delete_predicate(MYDDAS_UTIL_PREDICATE);
/* Get's the number of queries to save */ /* Get's the number of queries to save */
UInt STD_PROTO(myddas_util_get_total_multi_queries_number,(MYDDAS_UTIL_CONNECTION)); UInt myddas_util_get_total_multi_queries_number(MYDDAS_UTIL_CONNECTION);
void STD_PROTO(myddas_util_set_total_multi_queries_number,(MYDDAS_UTIL_CONNECTION,UInt)); void myddas_util_set_total_multi_queries_number(MYDDAS_UTIL_CONNECTION,UInt);
#ifdef MYDDAS_ODBC #ifdef MYDDAS_ODBC
/* Return enviromment identifier*/ /* Return enviromment identifier*/
SQLHENV STD_PROTO(myddas_util_get_odbc_enviromment,(SQLHDBC)); SQLHENV myddas_util_get_odbc_enviromment(SQLHDBC);
#endif #endif
void * STD_PROTO(myddas_util_get_list_pred,(MYDDAS_UTIL_CONNECTION)); void * myddas_util_get_list_pred(MYDDAS_UTIL_CONNECTION);
void * STD_PROTO(myddas_util_get_pred_next,(void *)); void * myddas_util_get_pred_next(void *);
char * STD_PROTO(myddas_util_get_pred_module,(void *)); char * myddas_util_get_pred_module(void *);
char * STD_PROTO(myddas_util_get_pred_name,(void *)); char * myddas_util_get_pred_name(void *);
MyddasInt STD_PROTO(myddas_util_get_pred_arity,(void *)); MyddasInt myddas_util_get_pred_arity(void *);
//DELETE THIS WHEN DB_STATS IS COMPLETED //DELETE THIS WHEN DB_STATS IS COMPLETED
MyddasInt STD_PROTO(get_myddas_top,(void)); MyddasInt get_myddas_top(void);
#ifdef DEBUG #ifdef DEBUG
void check_int(void); void check_int(void);
@ -482,36 +480,36 @@ void check_int(void);
/* myddas_mysql.c */ /* myddas_mysql.c */
#if defined MYDDAS_MYSQL #if defined MYDDAS_MYSQL
void STD_PROTO(Yap_InitMYDDAS_MySQLPreds,(void)); void Yap_InitMYDDAS_MySQLPreds(void);
void STD_PROTO(Yap_InitBackMYDDAS_MySQLPreds,(void)); void Yap_InitBackMYDDAS_MySQLPreds(void);
#endif #endif
/* myddas_odbc.c */ /* myddas_odbc.c */
#if defined MYDDAS_ODBC #if defined MYDDAS_ODBC
void STD_PROTO(Yap_InitMYDDAS_ODBCPreds,(void)); void Yap_InitMYDDAS_ODBCPreds(void);
void STD_PROTO(Yap_InitBackMYDDAS_ODBCPreds,(void)); void Yap_InitBackMYDDAS_ODBCPreds(void);
#endif #endif
/* myddas_shared.c */ /* myddas_shared.c */
#if defined MYDDAS_ODBC || defined MYDDAS_MYSQL #if defined MYDDAS_ODBC || defined MYDDAS_MYSQL
void STD_PROTO(Yap_MYDDAS_delete_all_myddas_structs,(void)); void Yap_MYDDAS_delete_all_myddas_structs(void);
void STD_PROTO(Yap_InitMYDDAS_SharedPreds,(void)); void Yap_InitMYDDAS_SharedPreds(void);
void STD_PROTO(Yap_InitBackMYDDAS_SharedPreds,(void)); void Yap_InitBackMYDDAS_SharedPreds(void);
#endif #endif
/* myddas_top_level.c */ /* myddas_top_level.c */
#if defined MYDDAS_TOP_LEVEL && defined MYDDAS_MYSQL //&& defined HAVE_LIBREADLINE #if defined MYDDAS_TOP_LEVEL && defined MYDDAS_MYSQL //&& defined HAVE_LIBREADLINE
void STD_PROTO(Yap_InitMYDDAS_TopLevelPreds,(void)); void Yap_InitMYDDAS_TopLevelPreds(void);
#endif #endif
/* yap2swi.c */ /* yap2swi.c */
void STD_PROTO(Yap_swi_install,(void)); void Yap_swi_install(void);
void STD_PROTO(Yap_InitSWIHash,(void)); void Yap_InitSWIHash(void);
int STD_PROTO(Yap_get_stream_handle,(Term, int, int, void *)); int Yap_get_stream_handle(Term, int, int, void *);
Term STD_PROTO(Yap_get_stream_position,(void *)); Term Yap_get_stream_position(void *);
/* opt.preds.c */ /* opt.preds.c */
void STD_PROTO(Yap_init_optyap_preds,(void)); void Yap_init_optyap_preds(void);
/* pl-file.c */ /* pl-file.c */
struct PL_local_data *Yap_InitThreadIO(int wid); struct PL_local_data *Yap_InitThreadIO(int wid);

View File

@ -37,7 +37,7 @@ INLINE_ONLY inline EXTERN AtomEntry *RepAtom (Atom a);
INLINE_ONLY inline EXTERN AtomEntry * INLINE_ONLY inline EXTERN AtomEntry *
RepAtom (Atom a) RepAtom (Atom a)
{ {
return (AtomEntry *) (AtomBase + Unsigned (a)); return (AtomEntry *) (AtomBase + Unsigned (a);
} }
@ -487,12 +487,12 @@ typedef enum
} op_type; } op_type;
OpEntry *STD_PROTO(Yap_GetOpProp,(Atom, op_type CACHE_TYPE)); OpEntry *Yap_GetOpProp(Atom, op_type CACHE_TYPE);
int STD_PROTO(Yap_IsPrefixOp,(Atom,int *,int *)); int Yap_IsPrefixOp(Atom,int *,int *);
int STD_PROTO(Yap_IsOp,(Atom)); int Yap_IsOp(Atom);
int STD_PROTO(Yap_IsInfixOp,(Atom,int *,int *,int *)); int Yap_IsInfixOp(Atom,int *,int *,int *);
int STD_PROTO(Yap_IsPosfixOp,(Atom,int *,int *)); int Yap_IsPosfixOp(Atom,int *,int *);
/* defines related to operator specifications */ /* defines related to operator specifications */
#define MaskPrio 0x0fff #define MaskPrio 0x0fff
@ -1440,23 +1440,23 @@ IsBlob (Atom at)
/* Proto types */ /* Proto types */
/* cdmgr.c */ /* cdmgr.c */
int STD_PROTO (Yap_RemoveIndexation, (PredEntry *)); int Yap_RemoveIndexation(PredEntry *);
void STD_PROTO (Yap_UpdateTimestamps, (PredEntry *)); void Yap_UpdateTimestamps(PredEntry *);
/* dbase.c */ /* dbase.c */
void STD_PROTO (Yap_ErDBE, (DBRef)); void Yap_ErDBE(DBRef);
DBTerm *STD_PROTO (Yap_StoreTermInDB, (Term, int)); DBTerm *Yap_StoreTermInDB(Term, int);
DBTerm *STD_PROTO (Yap_StoreTermInDBPlusExtraSpace, (Term, UInt, UInt *)); DBTerm *Yap_StoreTermInDBPlusExtraSpace(Term, UInt, UInt *);
Term STD_PROTO (Yap_FetchTermFromDB, (DBTerm *)); Term Yap_FetchTermFromDB(DBTerm *);
Term STD_PROTO (Yap_PopTermFromDB, (DBTerm *)); Term Yap_PopTermFromDB(DBTerm *);
void STD_PROTO (Yap_ReleaseTermFromDB, (DBTerm *)); void Yap_ReleaseTermFromDB(DBTerm *);
/* init.c */ /* init.c */
Atom STD_PROTO (Yap_GetOp, (OpEntry *, int *, int)); Atom Yap_GetOp(OpEntry *, int *, int);
/* vsc: redefined to GetAProp to avoid conflicts with Windows header files */ /* vsc: redefined to GetAProp to avoid conflicts with Windows header files */
Prop STD_PROTO (Yap_GetAProp, (Atom, PropFlags)); Prop Yap_GetAProp(Atom, PropFlags);
Prop STD_PROTO (Yap_GetAPropHavingLock, (AtomEntry *, PropFlags)); Prop Yap_GetAPropHavingLock(AtomEntry *, PropFlags);
typedef enum typedef enum
{ {
@ -1473,7 +1473,7 @@ typedef enum
#define PredHashInitialSize ((UInt)1039) #define PredHashInitialSize ((UInt)1039)
#define PredHashIncrement ((UInt)7919) #define PredHashIncrement ((UInt)7919)
INLINE_ONLY EXTERN inline UInt STD_PROTO(PRED_HASH, (FunctorEntry *, Term, UInt)); INLINE_ONLY EXTERN inline UInt PRED_HASH(FunctorEntry *, Term, UInt);
INLINE_ONLY EXTERN inline UInt INLINE_ONLY EXTERN inline UInt
PRED_HASH(FunctorEntry *fe, Term cur_mod, UInt size) PRED_HASH(FunctorEntry *fe, Term cur_mod, UInt size)
@ -1481,16 +1481,16 @@ PRED_HASH(FunctorEntry *fe, Term cur_mod, UInt size)
return (((CELL)fe+cur_mod)>>2) % size; return (((CELL)fe+cur_mod)>>2) % size;
} }
INLINE_ONLY EXTERN inline Prop STD_PROTO(GetPredPropByFuncAndModHavingLock, (FunctorEntry *, Term)); INLINE_ONLY EXTERN inline Prop GetPredPropByFuncAndModHavingLock(FunctorEntry *, Term);
INLINE_ONLY EXTERN inline Prop STD_PROTO(PredPropByFuncAndMod, (FunctorEntry *, Term)); INLINE_ONLY EXTERN inline Prop PredPropByFuncAndMod(FunctorEntry *, Term);
INLINE_ONLY EXTERN inline Prop STD_PROTO(PredPropByAtomAndMod, (Atom, Term)); INLINE_ONLY EXTERN inline Prop PredPropByAtomAndMod(Atom, Term);
INLINE_ONLY EXTERN inline Prop STD_PROTO(GetPredPropByFuncHavingLock, (FunctorEntry *, Term)); INLINE_ONLY EXTERN inline Prop GetPredPropByFuncHavingLock(FunctorEntry *, Term);
#ifdef THREADS #ifdef THREADS
Prop STD_PROTO(Yap_NewThreadPred, (struct pred_entry * CACHE_TYPE)); Prop Yap_NewThreadPred(struct pred_entry * CACHE_TYPE);
Prop STD_PROTO(Yap_NewPredPropByFunctor, (Functor, Term)); Prop Yap_NewPredPropByFunctor(Functor, Term);
INLINE_ONLY EXTERN inline struct pred_entry *STD_PROTO(Yap_GetThreadPred, (struct pred_entry * CACHE_TYPE)); INLINE_ONLY EXTERN inline struct pred_entry *Yap_GetThreadPred(struct pred_entry * CACHE_TYPE);
INLINE_ONLY EXTERN inline struct pred_entry * INLINE_ONLY EXTERN inline struct pred_entry *
Yap_GetThreadPred(struct pred_entry *ap USES_REGS) Yap_GetThreadPred(struct pred_entry *ap USES_REGS)
@ -1698,7 +1698,7 @@ PredPropByAtomAndMod (Atom at, Term cur_mod)
#define UNLOCKPE(I,Z) UNLOCK((Z)->PELock) #define UNLOCKPE(I,Z) UNLOCK((Z)->PELock)
#endif #endif
INLINE_ONLY EXTERN inline void STD_PROTO(AddPropToAtom, (AtomEntry *, PropEntry *p)); INLINE_ONLY EXTERN inline void AddPropToAtom(AtomEntry *, PropEntry *p);
INLINE_ONLY EXTERN inline void INLINE_ONLY EXTERN inline void
AddPropToAtom(AtomEntry *ae, PropEntry *p) AddPropToAtom(AtomEntry *ae, PropEntry *p)

View File

@ -96,9 +96,9 @@ typedef struct FREEB {
/* Operating system and architecture dependent page size */ /* Operating system and architecture dependent page size */
extern int Yap_page_size; extern int Yap_page_size;
void STD_PROTO(Yap_InitHeap, (void *)); void Yap_InitHeap(void *);
UInt STD_PROTO(Yap_ExtendWorkSpaceThroughHole, (UInt)); UInt Yap_ExtendWorkSpaceThroughHole(UInt);
void STD_PROTO(Yap_AllocHole, (UInt, UInt)); void Yap_AllocHole(UInt, UInt);
#if USE_MMAP && ! defined(__CYGWIN__) #if USE_MMAP && ! defined(__CYGWIN__)

View File

@ -285,7 +285,7 @@ Unification Routines
*************************************************************/ *************************************************************/
INLINE_ONLY inline EXTERN void STD_PROTO(reset_trail,(tr_fr_ptr)); INLINE_ONLY inline EXTERN void reset_trail(tr_fr_ptr TR0);
INLINE_ONLY inline EXTERN void INLINE_ONLY inline EXTERN void
reset_trail(tr_fr_ptr TR0) { reset_trail(tr_fr_ptr TR0) {
@ -371,7 +371,7 @@ Int Yap_unify(Term t0, Term t1)
} }
} }
EXTERN Int STD_PROTO(Yap_unify_constant,(Term,Term)); EXTERN Int Yap_unify_constant(Term a, Term cons);
EXTERN inline Int EXTERN inline Int
Yap_unify_constant(register Term a, register Term cons) Yap_unify_constant(register Term a, register Term cons)

View File

@ -19,31 +19,6 @@
* *
*/ */
inline static int
add_overflow(Int x, Int i, Int j)
{
return ((i & j & ~x) | (~i & ~j & x)) < 0;
}
inline static Term
add_int(Int i, Int j USES_REGS)
{
Int x = i+j;
#if USE_GMP
/* Integer overflow, we need to use big integers */
Int overflow = (i & j & ~x) | (~i & ~j & x);
if (overflow < 0) {
return(Yap_gmp_add_ints(i, j));
}
#endif
#ifdef BEAM
RINT(x);
return( MkIntegerTerm (x));
#else
RINT(x);
#endif
}
inline static int inline static int
sub_overflow(Int x, Int i, Int j) sub_overflow(Int x, Int i, Int j)
{ {

View File

@ -176,7 +176,8 @@ typedef struct index_t {
BITS32 *links; BITS32 *links;
size_t size; size_t size;
yamop *code; yamop *code;
void *udi_data, *udi_first, *udi_next; BITS32 *udi_data;
void *udi_first, *udi_next;
UInt udi_arg; UInt udi_arg;
} Index_t; } Index_t;
@ -256,36 +257,36 @@ typedef struct dbterm_list {
#endif #endif
/* amasm.c */ /* amasm.c */
wamreg STD_PROTO(Yap_emit_x,(CELL)); wamreg Yap_emit_x(CELL);
COUNT STD_PROTO(Yap_compile_cmp_flags,(PredEntry *)); COUNT Yap_compile_cmp_flags(PredEntry *);
void STD_PROTO(Yap_InitComma,(void)); void Yap_InitComma(void);
/* cdmgr.c */ /* cdmgr.c */
void STD_PROTO(Yap_IPred,(PredEntry *, UInt, yamop *)); void Yap_IPred(PredEntry *, UInt, yamop *);
int STD_PROTO(Yap_addclause,(Term,yamop *,int,Term,Term*)); int Yap_addclause(Term,yamop *,int,Term,Term*);
void STD_PROTO(Yap_add_logupd_clause,(PredEntry *,LogUpdClause *,int)); void Yap_add_logupd_clause(PredEntry *,LogUpdClause *,int);
void STD_PROTO(Yap_kill_iblock,(ClauseUnion *,ClauseUnion *,PredEntry *)); void Yap_kill_iblock(ClauseUnion *,ClauseUnion *,PredEntry *);
void STD_PROTO(Yap_EraseStaticClause,(StaticClause *, Term)); void Yap_EraseStaticClause(StaticClause *, Term);
ClauseUnion *STD_PROTO(Yap_find_owner_index,(yamop *, PredEntry *)); ClauseUnion *Yap_find_owner_index(yamop *, PredEntry *);
/* dbase.c */ /* dbase.c */
void STD_PROTO(Yap_ErCl,(DynamicClause *)); void Yap_ErCl(DynamicClause *);
void STD_PROTO(Yap_ErLogUpdCl,(LogUpdClause *)); void Yap_ErLogUpdCl(LogUpdClause *);
void STD_PROTO(Yap_ErLogUpdIndex,(LogUpdIndex *)); void Yap_ErLogUpdIndex(LogUpdIndex *);
Int STD_PROTO(Yap_Recordz,(Atom, Term)); Int Yap_Recordz(Atom, Term);
/* exec.c */ /* exec.c */
Term STD_PROTO(Yap_cp_as_integer,(choiceptr)); Term Yap_cp_as_integer(choiceptr);
/* index.c */ /* index.c */
yamop *STD_PROTO(Yap_PredIsIndexable,(PredEntry *, UInt, yamop *)); yamop *Yap_PredIsIndexable(PredEntry *, UInt, yamop *);
yamop *STD_PROTO(Yap_ExpandIndex,(PredEntry *, UInt)); yamop *Yap_ExpandIndex(PredEntry *, UInt);
void STD_PROTO(Yap_CleanUpIndex,(struct logic_upd_index *)); void Yap_CleanUpIndex(struct logic_upd_index *);
void STD_PROTO(Yap_CleanKids,(struct logic_upd_index *)); void Yap_CleanKids(struct logic_upd_index *);
void STD_PROTO(Yap_AddClauseToIndex,(PredEntry *,yamop *,int)); void Yap_AddClauseToIndex(PredEntry *,yamop *,int);
void STD_PROTO(Yap_RemoveClauseFromIndex,(PredEntry *,yamop *)); void Yap_RemoveClauseFromIndex(PredEntry *,yamop *);
LogUpdClause *STD_PROTO(Yap_NthClause,(PredEntry *,Int)); LogUpdClause *Yap_NthClause(PredEntry *,Int);
LogUpdClause *STD_PROTO(Yap_FollowIndexingCode,(PredEntry *,yamop *, Term *, yamop *,yamop *)); LogUpdClause *Yap_FollowIndexingCode(PredEntry *,yamop *, Term *, yamop *,yamop *);
/* exo.c */ /* exo.c */
yamop *Yap_ExoLookup(PredEntry *ap USES_REGS); yamop *Yap_ExoLookup(PredEntry *ap USES_REGS);
@ -392,24 +393,24 @@ typedef enum {
FIND_PRED_FROM_ENV FIND_PRED_FROM_ENV
} find_pred_type; } find_pred_type;
Int STD_PROTO(Yap_PredForCode,(yamop *, find_pred_type, Atom *, UInt *, Term *)); Int Yap_PredForCode(yamop *, find_pred_type, Atom *, UInt *, Term *);
PredEntry *STD_PROTO(Yap_PredEntryForCode,(yamop *, find_pred_type, CODEADDR *, CODEADDR *)); PredEntry *Yap_PredEntryForCode(yamop *, find_pred_type, CODEADDR *, CODEADDR *);
LogUpdClause *STD_PROTO(Yap_new_ludbe,(Term, PredEntry *, UInt)); LogUpdClause *Yap_new_ludbe(Term, PredEntry *, UInt);
Term STD_PROTO(Yap_LUInstance,(LogUpdClause *, UInt)); Term Yap_LUInstance(LogUpdClause *, UInt);
/* udi.c */ /* udi.c */
void STD_PROTO(Yap_udi_init,(void)); void Yap_udi_init(void);
int STD_PROTO(Yap_new_udi_clause,(PredEntry *, yamop *, Term)); int Yap_new_udi_clause(PredEntry *, yamop *, Term);
yamop *STD_PROTO(Yap_udi_search,(PredEntry *)); yamop *Yap_udi_search(PredEntry *);
void STD_PROTO(Yap_udi_abolish,(PredEntry *p)); void Yap_udi_abolish(PredEntry *p);
#ifdef DEBUG #ifdef DEBUG
void STD_PROTO(Yap_bug_location,(yamop *)); void Yap_bug_location(yamop *);
#endif #endif
#if LOW_PROF #if LOW_PROF
void STD_PROTO(Yap_InformOfRemoval,(void *)); void Yap_InformOfRemoval(void *);
void STD_PROTO(Yap_dump_code_area_for_profiler,(void)); void Yap_dump_code_area_for_profiler(void);
#else #else
#define Yap_InformOfRemoval(X) #define Yap_InformOfRemoval(X)
#endif #endif

View File

@ -325,17 +325,17 @@ typedef enum special_label_op_enum {
#define Two 2 #define Two 2
yamop *STD_PROTO(Yap_assemble,(int,Term,struct pred_entry *,int, struct intermediates *, UInt)); yamop *Yap_assemble(int,Term,struct pred_entry *,int, struct intermediates *, UInt);
void STD_PROTO(Yap_emit,(compiler_vm_op,Int,CELL, struct intermediates *)); void Yap_emit(compiler_vm_op,Int,CELL, struct intermediates *);
void STD_PROTO(Yap_emit_3ops,(compiler_vm_op,CELL,CELL,CELL, struct intermediates *)); void Yap_emit_3ops(compiler_vm_op,CELL,CELL,CELL, struct intermediates *);
void STD_PROTO(Yap_emit_4ops,(compiler_vm_op,CELL,CELL,CELL,CELL, struct intermediates *)); void Yap_emit_4ops(compiler_vm_op,CELL,CELL,CELL,CELL, struct intermediates *);
CELL *STD_PROTO(Yap_emit_extra_size,(compiler_vm_op,CELL,int, struct intermediates *)); CELL *Yap_emit_extra_size(compiler_vm_op,CELL,int, struct intermediates *);
char *STD_PROTO(Yap_AllocCMem,(UInt, struct intermediates *)); char *Yap_AllocCMem(UInt, struct intermediates *);
void STD_PROTO(Yap_ReleaseCMem, (struct intermediates *)); void Yap_ReleaseCMem(struct intermediates *);
int STD_PROTO(Yap_is_a_test_pred,(Term, Term)); int Yap_is_a_test_pred(Term, Term);
void STD_PROTO(Yap_bip_name,(Int, char *)); void Yap_bip_name(Int, char *);
#ifdef DEBUG #ifdef DEBUG
void STD_PROTO(Yap_ShowCode,(struct intermediates *)); void Yap_ShowCode(struct intermediates *);
#endif /* DEBUG */ #endif /* DEBUG */

View File

@ -298,6 +298,8 @@
#define SWI_Atoms Yap_heap_regs->swi_atoms #define SWI_Atoms Yap_heap_regs->swi_atoms
#define SWI_Functors Yap_heap_regs->swi_functors #define SWI_Functors Yap_heap_regs->swi_functors
#define SWI_ReverseHash Yap_heap_regs->swi_reverse_hash #define SWI_ReverseHash Yap_heap_regs->swi_reverse_hash
#define EmptyWakeups Yap_heap_regs->empty_wakeups
#define MaxEmptyWakeups Yap_heap_regs->max_empty_wakeups
#define SWI_BlobTypes Yap_heap_regs->swi_blob_types #define SWI_BlobTypes Yap_heap_regs->swi_blob_types
#define SWI_Blobs Yap_heap_regs->swi_blobs #define SWI_Blobs Yap_heap_regs->swi_blobs

View File

@ -7,8 +7,8 @@
/* YAP only stuff */ /* YAP only stuff */
void STD_PROTO(Yap_initdlmalloc,(void)); void Yap_initdlmalloc(void);
void STD_PROTO(Yap_RestoreDLMalloc,(void)); void Yap_RestoreDLMalloc(void);
/* Synopsis of compile-time options: /* Synopsis of compile-time options:

203
H/eval.h
View File

@ -128,7 +128,7 @@ typedef enum {
op_rdiv op_rdiv
} arith2_op; } arith2_op;
Functor STD_PROTO(EvalArg,(Term)); Functor EvalArg(Term);
/* Needed to handle numbers: /* Needed to handle numbers:
these two macros are fundamental in the integer/float conversions */ these two macros are fundamental in the integer/float conversions */
@ -161,20 +161,20 @@ Functor STD_PROTO(EvalArg,(Term));
#define FL(X) ((double)(X)) #define FL(X) ((double)(X))
#endif #endif
void STD_PROTO(Yap_InitConstExps,(void)); void Yap_InitConstExps(void);
void STD_PROTO(Yap_InitUnaryExps,(void)); void Yap_InitUnaryExps(void);
void STD_PROTO(Yap_InitBinaryExps,(void)); void Yap_InitBinaryExps(void);
int STD_PROTO(Yap_ReInitConstExps,(void)); int Yap_ReInitConstExps(void);
int STD_PROTO(Yap_ReInitUnaryExps,(void)); int Yap_ReInitUnaryExps(void);
int STD_PROTO(Yap_ReInitBinaryExps,(void)); int Yap_ReInitBinaryExps(void);
Term STD_PROTO(Yap_eval_atom,(Int)); Term Yap_eval_atom(Int);
Term STD_PROTO(Yap_eval_unary,(Int,Term)); Term Yap_eval_unary(Int,Term);
Term STD_PROTO(Yap_eval_binary,(Int,Term,Term)); Term Yap_eval_binary(Int,Term,Term);
Term STD_PROTO(Yap_InnerEval,(Term)); Term Yap_InnerEval(Term);
Int STD_PROTO(Yap_ArithError,(yap_error_number,Term,char *msg, ...)); Int Yap_ArithError(yap_error_number,Term,char *msg, ...);
#include "inline-only.h" #include "inline-only.h"
INLINE_ONLY inline EXTERN Term INLINE_ONLY inline EXTERN Term
@ -225,95 +225,95 @@ ETypeOfTerm(Term t)
} }
#if USE_GMP #if USE_GMP
Term STD_PROTO(Yap_gmq_rdiv_int_int,(Int, Int)); Term Yap_gmq_rdiv_int_int(Int, Int);
Term STD_PROTO(Yap_gmq_rdiv_int_big,(Int, Term)); Term Yap_gmq_rdiv_int_big(Int, Term);
Term STD_PROTO(Yap_gmq_rdiv_big_int,(Term, Int)); Term Yap_gmq_rdiv_big_int(Term, Int);
Term STD_PROTO(Yap_gmq_rdiv_big_big,(Term, Term)); Term Yap_gmq_rdiv_big_big(Term, Term);
Term STD_PROTO(Yap_gmp_add_ints,(Int, Int)); Term Yap_gmp_add_ints(Int, Int);
Term STD_PROTO(Yap_gmp_sub_ints,(Int, Int)); Term Yap_gmp_sub_ints(Int, Int);
Term STD_PROTO(Yap_gmp_mul_ints,(Int, Int)); Term Yap_gmp_mul_ints(Int, Int);
Term STD_PROTO(Yap_gmp_sll_ints,(Int, Int)); Term Yap_gmp_sll_ints(Int, Int);
Term STD_PROTO(Yap_gmp_add_int_big,(Int, Term)); Term Yap_gmp_add_int_big(Int, Term);
Term STD_PROTO(Yap_gmp_sub_int_big,(Int, Term)); Term Yap_gmp_sub_int_big(Int, Term);
Term STD_PROTO(Yap_gmp_sub_big_int,(Term, Int)); Term Yap_gmp_sub_big_int(Term, Int);
Term STD_PROTO(Yap_gmp_mul_int_big,(Int, Term)); Term Yap_gmp_mul_int_big(Int, Term);
Term STD_PROTO(Yap_gmp_div_int_big,(Int, Term)); Term Yap_gmp_div_int_big(Int, Term);
Term STD_PROTO(Yap_gmp_div_big_int,(Term, Int)); Term Yap_gmp_div_big_int(Term, Int);
Term STD_PROTO(Yap_gmp_div2_big_int,(Term, Int)); Term Yap_gmp_div2_big_int(Term, Int);
Term STD_PROTO(Yap_gmp_fdiv_int_big,(Int, Term)); Term Yap_gmp_fdiv_int_big(Int, Term);
Term STD_PROTO(Yap_gmp_fdiv_big_int,(Term, Int)); Term Yap_gmp_fdiv_big_int(Term, Int);
Term STD_PROTO(Yap_gmp_and_int_big,(Int, Term)); Term Yap_gmp_and_int_big(Int, Term);
Term STD_PROTO(Yap_gmp_ior_int_big,(Int, Term)); Term Yap_gmp_ior_int_big(Int, Term);
Term STD_PROTO(Yap_gmp_xor_int_big,(Int, Term)); Term Yap_gmp_xor_int_big(Int, Term);
Term STD_PROTO(Yap_gmp_sll_big_int,(Term, Int)); Term Yap_gmp_sll_big_int(Term, Int);
Term STD_PROTO(Yap_gmp_add_big_big,(Term, Term)); Term Yap_gmp_add_big_big(Term, Term);
Term STD_PROTO(Yap_gmp_sub_big_big,(Term, Term)); Term Yap_gmp_sub_big_big(Term, Term);
Term STD_PROTO(Yap_gmp_mul_big_big,(Term, Term)); Term Yap_gmp_mul_big_big(Term, Term);
Term STD_PROTO(Yap_gmp_div_big_big,(Term, Term)); Term Yap_gmp_div_big_big(Term, Term);
Term STD_PROTO(Yap_gmp_div2_big_big,(Term, Term)); Term Yap_gmp_div2_big_big(Term, Term);
Term STD_PROTO(Yap_gmp_fdiv_big_big,(Term, Term)); Term Yap_gmp_fdiv_big_big(Term, Term);
Term STD_PROTO(Yap_gmp_and_big_big,(Term, Term)); Term Yap_gmp_and_big_big(Term, Term);
Term STD_PROTO(Yap_gmp_ior_big_big,(Term, Term)); Term Yap_gmp_ior_big_big(Term, Term);
Term STD_PROTO(Yap_gmp_xor_big_big,(Term, Term)); Term Yap_gmp_xor_big_big(Term, Term);
Term STD_PROTO(Yap_gmp_mod_big_big,(Term, Term)); Term Yap_gmp_mod_big_big(Term, Term);
Term STD_PROTO(Yap_gmp_mod_big_int,(Term, Int)); Term Yap_gmp_mod_big_int(Term, Int);
Term STD_PROTO(Yap_gmp_mod_int_big,(Int, Term)); Term Yap_gmp_mod_int_big(Int, Term);
Term STD_PROTO(Yap_gmp_rem_big_big,(Term, Term)); Term Yap_gmp_rem_big_big(Term, Term);
Term STD_PROTO(Yap_gmp_rem_big_int,(Term, Int)); Term Yap_gmp_rem_big_int(Term, Int);
Term STD_PROTO(Yap_gmp_rem_int_big,(Int, Term)); Term Yap_gmp_rem_int_big(Int, Term);
Term STD_PROTO(Yap_gmp_exp_int_int,(Int,Int)); Term Yap_gmp_exp_int_int(Int,Int);
Term STD_PROTO(Yap_gmp_exp_int_big,(Int,Term)); Term Yap_gmp_exp_int_big(Int,Term);
Term STD_PROTO(Yap_gmp_exp_big_int,(Term,Int)); Term Yap_gmp_exp_big_int(Term,Int);
Term STD_PROTO(Yap_gmp_exp_big_big,(Term,Term)); Term Yap_gmp_exp_big_big(Term,Term);
Term STD_PROTO(Yap_gmp_gcd_int_big,(Int,Term)); Term Yap_gmp_gcd_int_big(Int,Term);
Term STD_PROTO(Yap_gmp_gcd_big_big,(Term,Term)); Term Yap_gmp_gcd_big_big(Term,Term);
Term STD_PROTO(Yap_gmp_big_from_64bits,(YAP_LONG_LONG)); Term Yap_gmp_big_from_64bits(YAP_LONG_LONG);
Term STD_PROTO(Yap_gmp_float_to_big,(Float)); Term Yap_gmp_float_to_big(Float);
Term STD_PROTO(Yap_gmp_float_to_rational,(Float)); Term Yap_gmp_float_to_rational(Float);
Term STD_PROTO(Yap_gmp_float_rationalize,(Float)); Term Yap_gmp_float_rationalize(Float);
Float STD_PROTO(Yap_gmp_to_float,(Term)); Float Yap_gmp_to_float(Term);
Term STD_PROTO(Yap_gmp_add_float_big,(Float, Term)); Term Yap_gmp_add_float_big(Float, Term);
Term STD_PROTO(Yap_gmp_sub_float_big,(Float, Term)); Term Yap_gmp_sub_float_big(Float, Term);
Term STD_PROTO(Yap_gmp_sub_big_float,(Term, Float)); Term Yap_gmp_sub_big_float(Term, Float);
Term STD_PROTO(Yap_gmp_mul_float_big,(Float, Term)); Term Yap_gmp_mul_float_big(Float, Term);
Term STD_PROTO(Yap_gmp_fdiv_float_big,(Float, Term)); Term Yap_gmp_fdiv_float_big(Float, Term);
Term STD_PROTO(Yap_gmp_fdiv_big_float,(Term, Float)); Term Yap_gmp_fdiv_big_float(Term, Float);
int STD_PROTO(Yap_gmp_cmp_big_int,(Term, Int)); int Yap_gmp_cmp_big_int(Term, Int);
#define Yap_gmp_cmp_int_big(I, T) (-Yap_gmp_cmp_big_int(T, I)) #define Yap_gmp_cmp_int_big(I, T) (-Yap_gmp_cmp_big_int(T, I))
int STD_PROTO(Yap_gmp_cmp_big_float,(Term, Float)); int Yap_gmp_cmp_big_float(Term, Float);
#define Yap_gmp_cmp_float_big(D, T) (-Yap_gmp_cmp_big_float(T, D)) #define Yap_gmp_cmp_float_big(D, T) (-Yap_gmp_cmp_big_float(T, D))
int STD_PROTO(Yap_gmp_cmp_big_big,(Term, Term)); int Yap_gmp_cmp_big_big(Term, Term);
int STD_PROTO(Yap_gmp_tcmp_big_int,(Term, Int)); int Yap_gmp_tcmp_big_int(Term, Int);
#define Yap_gmp_tcmp_int_big(I, T) (-Yap_gmp_tcmp_big_int(T, I)) #define Yap_gmp_tcmp_int_big(I, T) (-Yap_gmp_tcmp_big_int(T, I))
int STD_PROTO(Yap_gmp_tcmp_big_float,(Term, Float)); int Yap_gmp_tcmp_big_float(Term, Float);
#define Yap_gmp_tcmp_float_big(D, T) (-Yap_gmp_tcmp_big_float(T, D)) #define Yap_gmp_tcmp_float_big(D, T) (-Yap_gmp_tcmp_big_float(T, D))
int STD_PROTO(Yap_gmp_tcmp_big_big,(Term, Term)); int Yap_gmp_tcmp_big_big(Term, Term);
Term STD_PROTO(Yap_gmp_neg_int,(Int)); Term Yap_gmp_neg_int(Int);
Term STD_PROTO(Yap_gmp_abs_big,(Term)); Term Yap_gmp_abs_big(Term);
Term STD_PROTO(Yap_gmp_neg_big,(Term)); Term Yap_gmp_neg_big(Term);
Term STD_PROTO(Yap_gmp_unot_big,(Term)); Term Yap_gmp_unot_big(Term);
Term STD_PROTO(Yap_gmp_floor,(Term)); Term Yap_gmp_floor(Term);
Term STD_PROTO(Yap_gmp_ceiling,(Term)); Term Yap_gmp_ceiling(Term);
Term STD_PROTO(Yap_gmp_round,(Term)); Term Yap_gmp_round(Term);
Term STD_PROTO(Yap_gmp_trunc,(Term)); Term Yap_gmp_trunc(Term);
Term STD_PROTO(Yap_gmp_float_fractional_part,(Term)); Term Yap_gmp_float_fractional_part(Term);
Term STD_PROTO(Yap_gmp_float_integer_part,(Term)); Term Yap_gmp_float_integer_part(Term);
Term STD_PROTO(Yap_gmp_sign,(Term)); Term Yap_gmp_sign(Term);
Term STD_PROTO(Yap_gmp_lsb,(Term)); Term Yap_gmp_lsb(Term);
Term STD_PROTO(Yap_gmp_msb,(Term)); Term Yap_gmp_msb(Term);
Term STD_PROTO(Yap_gmp_popcount,(Term)); Term Yap_gmp_popcount(Term);
char * STD_PROTO(Yap_gmp_to_string,(Term, char *, size_t, int)); char * Yap_gmp_to_string(Term, char *, size_t, int);
size_t STD_PROTO(Yap_gmp_to_size,(Term, int)); size_t Yap_gmp_to_size(Term, int);
int STD_PROTO(Yap_term_to_existing_big,(Term, MP_INT *)); int Yap_term_to_existing_big(Term, MP_INT *);
int STD_PROTO(Yap_term_to_existing_rat,(Term, MP_RAT *)); int Yap_term_to_existing_rat(Term, MP_RAT *);
void Yap_gmp_set_bit(Int i, Term t); void Yap_gmp_set_bit(Int i, Term t);
#endif #endif
@ -337,3 +337,28 @@ __Yap_Mk64IntegerTerm(YAP_LONG_LONG i USES_REGS)
} }
inline static int
add_overflow(Int x, Int i, Int j)
{
return ((i & j & ~x) | (~i & ~j & x)) < 0;
}
inline static Term
add_int(Int i, Int j USES_REGS)
{
Int x = i+j;
#if USE_GMP
/* Integer overflow, we need to use big integers */
Int overflow = (i & j & ~x) | (~i & ~j & x);
if (overflow < 0) {
return(Yap_gmp_add_ints(i, j));
}
#endif
#ifdef BEAM
RINT(x);
return( MkIntegerTerm (x));
#else
RINT(x);
#endif
}

View File

@ -166,9 +166,9 @@ typedef CELL *CELL_PTR;
#define ENVSIZE(E) EnvSize(((CELL *)E)[E_CP]) #define ENVSIZE(E) EnvSize(((CELL *)E)[E_CP])
void STD_PROTO(Yap_mark_variable, (CELL *)); void Yap_mark_variable(CELL *);
void STD_PROTO(Yap_mark_external_reference, (CELL *)); void Yap_mark_external_reference(CELL *);
void STD_PROTO(Yap_inc_mark_variable, (void)); void Yap_inc_mark_variable(void);

View File

@ -298,6 +298,8 @@
Atom swi_atoms[N_SWI_ATOMS]; Atom swi_atoms[N_SWI_ATOMS];
Functor swi_functors[N_SWI_FUNCTORS]; Functor swi_functors[N_SWI_FUNCTORS];
struct swi_reverse_hash swi_reverse_hash[N_SWI_HASH]; struct swi_reverse_hash swi_reverse_hash[N_SWI_HASH];
Atom empty_wakeups[MAX_EMPTY_WAKEUPS];
int max_empty_wakeups;
struct PL_blob_t *swi_blob_types; struct PL_blob_t *swi_blob_types;
struct AtomEntryStruct *swi_blobs; struct AtomEntryStruct *swi_blobs;

View File

@ -11,6 +11,7 @@
AtomAlarm = Yap_FullLookupAtom("$alarm"); AtomAlarm = Yap_FullLookupAtom("$alarm");
AtomAlias = Yap_LookupAtom("alias"); AtomAlias = Yap_LookupAtom("alias");
AtomAltNot = Yap_LookupAtom("not"); AtomAltNot = Yap_LookupAtom("not");
AtomAny = Yap_LookupAtom("any");
AtomAppend = Yap_LookupAtom("append"); AtomAppend = Yap_LookupAtom("append");
AtomArg = Yap_LookupAtom("arg"); AtomArg = Yap_LookupAtom("arg");
AtomArray = Yap_FullLookupAtom("$array"); AtomArray = Yap_FullLookupAtom("$array");
@ -137,6 +138,7 @@
AtomIOMode = Yap_LookupAtom("io_mode"); AtomIOMode = Yap_LookupAtom("io_mode");
AtomId = Yap_LookupAtom("id"); AtomId = Yap_LookupAtom("id");
AtomInf = Yap_LookupAtom("inf"); AtomInf = Yap_LookupAtom("inf");
AtomInfinity = Yap_LookupAtom("infinity");
AtomInitGoal = Yap_FullLookupAtom("$init_goal"); AtomInitGoal = Yap_FullLookupAtom("$init_goal");
AtomInitProlog = Yap_FullLookupAtom("$init_prolog"); AtomInitProlog = Yap_FullLookupAtom("$init_prolog");
AtomInStackExpansion = Yap_LookupAtom("in stack expansion"); AtomInStackExpansion = Yap_LookupAtom("in stack expansion");
@ -311,6 +313,7 @@
AtomUndefp = Yap_FullLookupAtom("$undefp"); AtomUndefp = Yap_FullLookupAtom("$undefp");
AtomUnderflow = Yap_LookupAtom("underflow"); AtomUnderflow = Yap_LookupAtom("underflow");
AtomUnificationStack = Yap_LookupAtom("unification_stack"); AtomUnificationStack = Yap_LookupAtom("unification_stack");
AtomUnique = Yap_LookupAtom("unique");
AtomUnsignedByte = Yap_LookupAtom("unsigned_byte"); AtomUnsignedByte = Yap_LookupAtom("unsigned_byte");
AtomUnsignedChar = Yap_LookupAtom("unsigned_char"); AtomUnsignedChar = Yap_LookupAtom("unsigned_char");
AtomUser = Yap_LookupAtom("user"); AtomUser = Yap_LookupAtom("user");

View File

@ -298,6 +298,8 @@
InitSWIAtoms(); InitSWIAtoms();
InitEmptyWakeups();
MaxEmptyWakeups = 0;
SWI_BlobTypes = NULL; SWI_BlobTypes = NULL;
SWI_Blobs = NULL; SWI_Blobs = NULL;

View File

@ -112,7 +112,7 @@ StreamDesc;
#define ALIASES_BLOCK_SIZE 8 #define ALIASES_BLOCK_SIZE 8
void STD_PROTO (Yap_InitStdStreams, (void)); void Yap_InitStdStreams(void);
Term STD_PROTO (Yap_StreamPosition, (struct io_stream *)); Term Yap_StreamPosition(struct io_stream *);
void STD_PROTO (Yap_InitPlIO, (void)); void Yap_InitPlIO(void);

View File

@ -11,6 +11,7 @@
AtomAlarm = AtomAdjust(AtomAlarm); AtomAlarm = AtomAdjust(AtomAlarm);
AtomAlias = AtomAdjust(AtomAlias); AtomAlias = AtomAdjust(AtomAlias);
AtomAltNot = AtomAdjust(AtomAltNot); AtomAltNot = AtomAdjust(AtomAltNot);
AtomAny = AtomAdjust(AtomAny);
AtomAppend = AtomAdjust(AtomAppend); AtomAppend = AtomAdjust(AtomAppend);
AtomArg = AtomAdjust(AtomArg); AtomArg = AtomAdjust(AtomArg);
AtomArray = AtomAdjust(AtomArray); AtomArray = AtomAdjust(AtomArray);
@ -137,6 +138,7 @@
AtomIOMode = AtomAdjust(AtomIOMode); AtomIOMode = AtomAdjust(AtomIOMode);
AtomId = AtomAdjust(AtomId); AtomId = AtomAdjust(AtomId);
AtomInf = AtomAdjust(AtomInf); AtomInf = AtomAdjust(AtomInf);
AtomInfinity = AtomAdjust(AtomInfinity);
AtomInitGoal = AtomAdjust(AtomInitGoal); AtomInitGoal = AtomAdjust(AtomInitGoal);
AtomInitProlog = AtomAdjust(AtomInitProlog); AtomInitProlog = AtomAdjust(AtomInitProlog);
AtomInStackExpansion = AtomAdjust(AtomInStackExpansion); AtomInStackExpansion = AtomAdjust(AtomInStackExpansion);
@ -311,6 +313,7 @@
AtomUndefp = AtomAdjust(AtomUndefp); AtomUndefp = AtomAdjust(AtomUndefp);
AtomUnderflow = AtomAdjust(AtomUnderflow); AtomUnderflow = AtomAdjust(AtomUnderflow);
AtomUnificationStack = AtomAdjust(AtomUnificationStack); AtomUnificationStack = AtomAdjust(AtomUnificationStack);
AtomUnique = AtomAdjust(AtomUnique);
AtomUnsignedByte = AtomAdjust(AtomUnsignedByte); AtomUnsignedByte = AtomAdjust(AtomUnsignedByte);
AtomUnsignedChar = AtomAdjust(AtomUnsignedChar); AtomUnsignedChar = AtomAdjust(AtomUnsignedChar);
AtomUser = AtomAdjust(AtomUser); AtomUser = AtomAdjust(AtomUser);

View File

@ -412,9 +412,9 @@ AdjustSwitchTable__(op_numbers op, yamop *table, COUNT i USES_REGS)
} }
} }
STATIC_PROTO(void RestoreAtomList, (Atom CACHE_TYPE)); static void RestoreAtomList(Atom CACHE_TYPE);
STATIC_PROTO(void RestoreAtom, (AtomEntry * CACHE_TYPE)); static void RestoreAtom(AtomEntry * CACHE_TYPE);
STATIC_PROTO(void RestoreHashPreds, ( CACHE_TYPE1 )); static void RestoreHashPreds( CACHE_TYPE1 );
static void static void
RestoreAtoms__( USES_REGS1 ) RestoreAtoms__( USES_REGS1 )
@ -547,6 +547,15 @@ RestoreDBTerm(DBTerm *dbr, int attachments USES_REGS)
/* Restoring the heap */ /* Restoring the heap */
static void
RestoreEmptyWakeups(void)
{
int i;
for (i=0; i < MaxEmptyWakeups; i++) {
EmptyWakeups[i] = AtomAdjust(EmptyWakeups[i]);
}
}
/* Restores a prolog clause, in its compiled form */ /* Restores a prolog clause, in its compiled form */
static void static void
RestoreStaticClause(StaticClause *cl USES_REGS) RestoreStaticClause(StaticClause *cl USES_REGS)

View File

@ -298,6 +298,8 @@
RestoreSWIAtoms(); RestoreSWIAtoms();
RestoreEmptyWakeups();
RestoreSWIBlobTypes(); RestoreSWIBlobTypes();
RestoreSWIBlobs(); RestoreSWIBlobs();

View File

@ -1120,6 +1120,6 @@ IsGlobal__ (CELL reg USES_REGS)
} }
void STD_PROTO (Yap_AdjustStacksAndTrail, (void)); void Yap_AdjustStacksAndTrail(void);
void STD_PROTO (Yap_AdjustRegs, (int)); void Yap_AdjustRegs(int);

View File

@ -20,6 +20,8 @@
#define AtomAlias Yap_heap_regs->AtomAlias_ #define AtomAlias Yap_heap_regs->AtomAlias_
Atom AtomAltNot_; Atom AtomAltNot_;
#define AtomAltNot Yap_heap_regs->AtomAltNot_ #define AtomAltNot Yap_heap_regs->AtomAltNot_
Atom AtomAny_;
#define AtomAny Yap_heap_regs->AtomAny_
Atom AtomAppend_; Atom AtomAppend_;
#define AtomAppend Yap_heap_regs->AtomAppend_ #define AtomAppend Yap_heap_regs->AtomAppend_
Atom AtomArg_; Atom AtomArg_;
@ -272,6 +274,8 @@
#define AtomId Yap_heap_regs->AtomId_ #define AtomId Yap_heap_regs->AtomId_
Atom AtomInf_; Atom AtomInf_;
#define AtomInf Yap_heap_regs->AtomInf_ #define AtomInf Yap_heap_regs->AtomInf_
Atom AtomInfinity_;
#define AtomInfinity Yap_heap_regs->AtomInfinity_
Atom AtomInitGoal_; Atom AtomInitGoal_;
#define AtomInitGoal Yap_heap_regs->AtomInitGoal_ #define AtomInitGoal Yap_heap_regs->AtomInitGoal_
Atom AtomInitProlog_; Atom AtomInitProlog_;
@ -620,6 +624,8 @@
#define AtomUnderflow Yap_heap_regs->AtomUnderflow_ #define AtomUnderflow Yap_heap_regs->AtomUnderflow_
Atom AtomUnificationStack_; Atom AtomUnificationStack_;
#define AtomUnificationStack Yap_heap_regs->AtomUnificationStack_ #define AtomUnificationStack Yap_heap_regs->AtomUnificationStack_
Atom AtomUnique_;
#define AtomUnique Yap_heap_regs->AtomUnique_
Atom AtomUnsignedByte_; Atom AtomUnsignedByte_;
#define AtomUnsignedByte Yap_heap_regs->AtomUnsignedByte_ #define AtomUnsignedByte Yap_heap_regs->AtomUnsignedByte_
Atom AtomUnsignedChar_; Atom AtomUnsignedChar_;

View File

@ -13,13 +13,13 @@ typedef struct thread_attr_struct {
#ifdef THREADS #ifdef THREADS
Int STD_PROTO(Yap_thread_self,(void)); Int Yap_thread_self(void);
int STD_PROTO(Yap_get_thread_ref_count,(int)); int Yap_get_thread_ref_count(int);
void STD_PROTO(Yap_set_thread_ref_count,(int,int)); void Yap_set_thread_ref_count(int,int);
CELL STD_PROTO(Yap_thread_create_engine,(thread_attr *)); CELL Yap_thread_create_engine(thread_attr *);
Int STD_PROTO(Yap_thread_attach_engine,(int)); Int Yap_thread_attach_engine(int);
Int STD_PROTO(Yap_thread_detach_engine,(int)); Int Yap_thread_detach_engine(int);
Int STD_PROTO(Yap_thread_destroy_engine,(int)); Int Yap_thread_destroy_engine(int);
#endif #endif

View File

@ -27,9 +27,9 @@ typedef enum {
retry_table_loader retry_table_loader
} yap_low_level_port; } yap_low_level_port;
void STD_PROTO(low_level_trace,(yap_low_level_port, PredEntry *, CELL *)); void low_level_trace(yap_low_level_port, PredEntry *, CELL *);
void STD_PROTO(Yap_InitLowLevelTrace,(void)); void Yap_InitLowLevelTrace(void);
void STD_PROTO(toggle_low_level_trace,(void)); void toggle_low_level_trace(void);
#endif #endif

View File

@ -66,7 +66,7 @@
#define YP_FILE FILE #define YP_FILE FILE
int STD_PROTO(YP_putc,(int, int)); int YP_putc(int, int);
#else #else
@ -231,8 +231,8 @@ typedef struct AliasDescS {
extern char *Yap_chtype; extern char *Yap_chtype;
#include "inline-only.h" #include "inline-only.h"
INLINE_ONLY EXTERN inline int STD_PROTO(chtype,(Int)); INLINE_ONLY EXTERN inline int chtype(Int);
int STD_PROTO(Yap_wide_chtype,(Int)); int Yap_wide_chtype(Int);
INLINE_ONLY EXTERN inline int INLINE_ONLY EXTERN inline int
chtype(Int ch) chtype(Int ch)
@ -247,44 +247,44 @@ chtype(Int ch)
#define ParserAuxSp LOCAL_ScannerStack #define ParserAuxSp LOCAL_ScannerStack
/* routines in parser.c */ /* routines in parser.c */
VarEntry STD_PROTO(*Yap_LookupVar,(char *)); VarEntry *Yap_LookupVar(char *);
Term STD_PROTO(Yap_VarNames,(VarEntry *,Term)); Term Yap_VarNames(VarEntry *,Term);
/* routines in scanner.c */ /* routines in scanner.c */
TokEntry STD_PROTO(*Yap_tokenizer,(struct io_stream *, int, Term *)); TokEntry *Yap_tokenizer(struct io_stream *, int, Term *);
void STD_PROTO(Yap_clean_tokenizer,(TokEntry *, VarEntry *, VarEntry *,Term)); void Yap_clean_tokenizer(TokEntry *, VarEntry *, VarEntry *,Term);
Term STD_PROTO(Yap_scan_num,(struct io_stream *)); Term Yap_scan_num(struct io_stream *);
char STD_PROTO(*Yap_AllocScannerMemory,(unsigned int)); char *Yap_AllocScannerMemory(unsigned int);
/* routines in iopreds.c */ /* routines in iopreds.c */
FILE *STD_PROTO(Yap_FileDescriptorFromStream,(Term)); FILE *Yap_FileDescriptorFromStream(Term);
Int STD_PROTO(Yap_FirstLineInParse,(void)); Int Yap_FirstLineInParse(void);
int STD_PROTO(Yap_CheckIOStream,(Term, char *)); int Yap_CheckIOStream(Term, char *);
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
void STD_PROTO(Yap_LockStream,(struct io_stream *)); void Yap_LockStream(struct io_stream *);
void STD_PROTO(Yap_UnLockStream,(struct io_stream *)); void Yap_UnLockStream(struct io_stream *);
#else #else
#define Yap_LockStream(X) #define Yap_LockStream(X)
#define Yap_UnLockStream(X) #define Yap_UnLockStream(X)
#endif #endif
Int STD_PROTO(Yap_GetStreamFd,(int)); Int Yap_GetStreamFd(int);
void STD_PROTO(Yap_CloseStreams,(int)); void Yap_CloseStreams(int);
void STD_PROTO(Yap_FlushStreams,(void)); void Yap_FlushStreams(void);
void STD_PROTO(Yap_CloseStream,(int)); void Yap_CloseStream(int);
int STD_PROTO(Yap_PlGetchar,(void)); int Yap_PlGetchar(void);
int STD_PROTO(Yap_PlGetWchar,(void)); int Yap_PlGetWchar(void);
int STD_PROTO(Yap_PlFGetchar,(void)); int Yap_PlFGetchar(void);
int STD_PROTO(Yap_GetCharForSIGINT,(void)); int Yap_GetCharForSIGINT(void);
Int STD_PROTO(Yap_StreamToFileNo,(Term)); Int Yap_StreamToFileNo(Term);
Term STD_PROTO(Yap_OpenStream,(FILE *,char *,Term,int)); Term Yap_OpenStream(FILE *,char *,Term,int);
Term STD_PROTO(Yap_StringToTerm,(char *,Term *)); Term Yap_StringToTerm(char *,Term *);
char *Yap_TermToString(Term t, char *s, size_t sz, size_t *length, int *encoding, int flags); char *Yap_TermToString(Term t, char *s, size_t sz, size_t *length, int *encoding, int flags);
int Yap_GetFreeStreamD(void); int Yap_GetFreeStreamD(void);
int Yap_GetFreeStreamDForReading(void); int Yap_GetFreeStreamDForReading(void);
Term Yap_WStringToList(wchar_t *); Term Yap_WStringToList(wchar_t *);
Term STD_PROTO(Yap_WStringToListOfAtoms,(wchar_t *)); Term Yap_WStringToListOfAtoms(wchar_t *);
Atom STD_PROTO(Yap_LookupWideAtom,(wchar_t *)); Atom Yap_LookupWideAtom( wchar_t * );
#define YAP_INPUT_STREAM 0x01 #define YAP_INPUT_STREAM 0x01
#define YAP_OUTPUT_STREAM 0x02 #define YAP_OUTPUT_STREAM 0x02
@ -312,9 +312,9 @@ Atom STD_PROTO(Yap_LookupWideAtom,(wchar_t *));
/* grow.c */ /* grow.c */
int STD_PROTO(Yap_growheap_in_parser, (tr_fr_ptr *, TokEntry **, VarEntry **)); int Yap_growheap_in_parser(tr_fr_ptr *, TokEntry **, VarEntry **);
int STD_PROTO(Yap_growstack_in_parser, (tr_fr_ptr *, TokEntry **, VarEntry **)); int Yap_growstack_in_parser(tr_fr_ptr *, TokEntry **, VarEntry **);
int STD_PROTO(Yap_growtrail_in_parser, (tr_fr_ptr *, TokEntry **, VarEntry **)); int Yap_growtrail_in_parser(tr_fr_ptr *, TokEntry **, VarEntry **);
@ -324,8 +324,8 @@ int STD_PROTO(Yap_growtrail_in_parser, (tr_fr_ptr *, TokEntry **, VarEntry **)
extern int errno; extern int errno;
#endif #endif
INLINE_ONLY EXTERN inline UInt STD_PROTO(HashFunction, (unsigned char *)); INLINE_ONLY EXTERN UInt inline HashFunction(unsigned char *);
INLINE_ONLY EXTERN inline UInt STD_PROTO(WideHashFunction, (wchar_t *)); INLINE_ONLY EXTERN UInt inline WideHashFunction(wchar_t *);
INLINE_ONLY EXTERN inline UInt INLINE_ONLY EXTERN inline UInt
HashFunction(unsigned char *CHP) HashFunction(unsigned char *CHP)
@ -346,7 +346,7 @@ HashFunction(unsigned char *CHP)
*/ */
} }
INLINE_ONLY EXTERN inline UInt INLINE_ONLY EXTERN UInt inline
WideHashFunction(wchar_t *CHP) WideHashFunction(wchar_t *CHP)
{ {
UInt hash = 5381; UInt hash = 5381;

View File

@ -45,18 +45,18 @@
static Int null_id = 0; static Int null_id = 0;
STATIC_PROTO(Int c_db_my_connect,( USES_REGS1 )); static Int c_db_my_connect( USES_REGS1 );
STATIC_PROTO(Int c_db_my_disconnect,( USES_REGS1 )); static Int c_db_my_disconnect( USES_REGS1 );
STATIC_PROTO(Int c_db_my_number_of_fields,( USES_REGS1 )); static Int c_db_my_number_of_fields( USES_REGS1 );
STATIC_PROTO(Int c_db_my_get_attributes_types,( USES_REGS1 )); static Int c_db_my_get_attributes_types( USES_REGS1 );
STATIC_PROTO(Int c_db_my_query,( USES_REGS1 )); static Int c_db_my_query( USES_REGS1 );
STATIC_PROTO(Int c_db_my_table_write,( USES_REGS1 )); static Int c_db_my_table_write( USES_REGS1 );
STATIC_PROTO(Int c_db_my_row,( USES_REGS1 )); static Int c_db_my_row( USES_REGS1 );
STATIC_PROTO(Int c_db_my_row_cut,( USES_REGS1 )); static Int c_db_my_row_cut( USES_REGS1 );
STATIC_PROTO(Int c_db_my_get_fields_properties,( USES_REGS1 )); static Int c_db_my_get_fields_properties( USES_REGS1 );
STATIC_PROTO(Int c_db_my_get_next_result_set,( USES_REGS1 )); static Int c_db_my_get_next_result_set( USES_REGS1 );
STATIC_PROTO(Int c_db_my_get_database,( USES_REGS1 )); static Int c_db_my_get_database( USES_REGS1 );
STATIC_PROTO(Int c_db_my_change_database,( USES_REGS1 )); static Int c_db_my_change_database( USES_REGS1 );
void Yap_InitMYDDAS_MySQLPreds(void) void Yap_InitMYDDAS_MySQLPreds(void)
{ {

View File

@ -29,15 +29,15 @@
static Int null_id = 0; static Int null_id = 0;
STATIC_PROTO(Int c_db_odbc_connect,( USES_REGS1 )); static Int c_db_odbc_connect( USES_REGS1 );
STATIC_PROTO(Int c_db_odbc_disconnect,( USES_REGS1 )); static Int c_db_odbc_disconnect( USES_REGS1 );
STATIC_PROTO(Int c_db_odbc_number_of_fields,( USES_REGS1 )); static Int c_db_odbc_number_of_fields( USES_REGS1 );
STATIC_PROTO(Int c_db_odbc_get_attributes_types,( USES_REGS1 )); static Int c_db_odbc_get_attributes_types( USES_REGS1 );
STATIC_PROTO(Int c_db_odbc_query,( USES_REGS1 )); static Int c_db_odbc_query( USES_REGS1 );
STATIC_PROTO(Int c_db_odbc_row,( USES_REGS1 )); static Int c_db_odbc_row( USES_REGS1 );
STATIC_PROTO(Int c_db_odbc_row_cut,( USES_REGS1 )); static Int c_db_odbc_row_cut( USES_REGS1 );
STATIC_PROTO(Int c_db_odbc_get_fields_properties,( USES_REGS1 )); static Int c_db_odbc_get_fields_properties( USES_REGS1 );
STATIC_PROTO(Int c_db_odbc_number_of_fields_in_query,( USES_REGS1 )); static Int c_db_odbc_number_of_fields_in_query( USES_REGS1 );
static int static int
odbc_error(SQLSMALLINT type, SQLHANDLE hdbc, char *msg, char *print) odbc_error(SQLSMALLINT type, SQLHANDLE hdbc, char *msg, char *print)

View File

@ -27,24 +27,24 @@
#include "myddas_statistics.h" #include "myddas_statistics.h"
#endif #endif
STATIC_PROTO(Int c_db_initialize_myddas,( USES_REGS1 )); static Int c_db_initialize_myddas( USES_REGS1 );
STATIC_PROTO(Int c_db_connection_type,( USES_REGS1 )); static Int c_db_connection_type( USES_REGS1 );
STATIC_PROTO(Int c_db_add_preds,( USES_REGS1 )); static Int c_db_add_preds( USES_REGS1 );
STATIC_PROTO(Int c_db_preds_conn_start ,( USES_REGS1 )); static Int c_db_preds_conn_start ( USES_REGS1 );
STATIC_PROTO(Int c_db_preds_conn_continue ,( USES_REGS1 )); static Int c_db_preds_conn_continue ( USES_REGS1 );
STATIC_PROTO(Int c_db_connection_start ,( USES_REGS1 )); static Int c_db_connection_start ( USES_REGS1 );
STATIC_PROTO(Int c_db_connection_continue ,( USES_REGS1 )); static Int c_db_connection_continue ( USES_REGS1 );
STATIC_PROTO(Int c_db_check_if_exists_pred,( USES_REGS1 )); static Int c_db_check_if_exists_pred( USES_REGS1 );
STATIC_PROTO(Int c_db_delete_predicate,( USES_REGS1 )); static Int c_db_delete_predicate( USES_REGS1 );
STATIC_PROTO(Int c_db_multi_queries_number,( USES_REGS1 )); static Int c_db_multi_queries_number( USES_REGS1 );
#ifdef MYDDAS_STATS #ifdef MYDDAS_STATS
STATIC_PROTO(Int c_db_stats,( USES_REGS1 )); static Int c_db_stats( USES_REGS1 );
STATIC_PROTO(Int c_db_stats_walltime,( USES_REGS1 )); static Int c_db_stats_walltime( USES_REGS1 );
STATIC_PROTO(Int c_db_stats_translate,( USES_REGS1 )); static Int c_db_stats_translate( USES_REGS1 );
STATIC_PROTO(Int c_db_stats_time,( USES_REGS1 )); static Int c_db_stats_time( USES_REGS1 );
#endif #endif
#ifdef DEBUG #ifdef DEBUG
STATIC_PROTO(Int c_db_check,( USES_REGS1 )); static Int c_db_check( USES_REGS1 );
#endif #endif
void Yap_InitMYDDAS_SharedPreds(void) void Yap_InitMYDDAS_SharedPreds(void)

View File

@ -34,7 +34,7 @@
#include <sys/times.h> #include <sys/times.h>
STATIC_PROTO(Int c_db_tl_readline,(void)); static Int c_db_tl_readline(void);
void Yap_InitMYDDAS_TopLevelPreds(void) void Yap_InitMYDDAS_TopLevelPreds(void)

View File

@ -39,7 +39,7 @@ static void share_private_nodes(int worker_q);
** Local inlines ** ** Local inlines **
** ----------------------- */ ** ----------------------- */
STD_PROTO(static inline void PUT_BUSY, (int)); static inline void PUT_BUSY(int);
static inline static inline
void PUT_BUSY(int worker_num) { void PUT_BUSY(int worker_num) {

View File

@ -18,36 +18,36 @@
/* get a def for NULL */ /* get a def for NULL */
#include <stdlib.h> #include <stdlib.h>
STD_PROTO(static inline void PUT_IN_EXECUTING, (int)); static inline void PUT_IN_EXECUTING(int);
STD_PROTO(static inline void PUT_OUT_EXECUTING, (int)); static inline void PUT_OUT_EXECUTING(int);
STD_PROTO(static inline void PUT_IN_FINISHED, (int)); static inline void PUT_IN_FINISHED(int);
#ifdef TABLING_INNER_CUTS #ifdef TABLING_INNER_CUTS
STD_PROTO(static inline void PUT_IN_PRUNING, (int)); static inline void PUT_IN_PRUNING(int);
STD_PROTO(static inline void PUT_OUT_PRUNING, (int)); static inline void PUT_OUT_PRUNING(int);
#endif /* TABLING_INNER_CUTS */ #endif /* TABLING_INNER_CUTS */
STD_PROTO(static inline void PUT_IN_REQUESTABLE, (int)); static inline void PUT_IN_REQUESTABLE(int);
STD_PROTO(static inline void PUT_OUT_REQUESTABLE, (int)); static inline void PUT_OUT_REQUESTABLE(int);
STD_PROTO(static inline void SCH_update_local_or_tops, (void)); static inline void SCH_update_local_or_tops(void);
STD_PROTO(static inline void SCH_refuse_share_request_if_any, (void)); static inline void SCH_refuse_share_request_if_any(void);
STD_PROTO(static inline void SCH_set_load, (choiceptr)); static inline void SCH_set_load(choiceptr);
STD_PROTO(static inline void SCH_new_alternative, (yamop *,yamop *)); static inline void SCH_new_alternative(yamop *,yamop *);
STD_PROTO(static inline void CUT_send_prune_request, (int, choiceptr)); static inline void CUT_send_prune_request(int, choiceptr);
STD_PROTO(static inline void CUT_reset_prune_request, (void)); static inline void CUT_reset_prune_request(void);
STD_PROTO(static inline int CUT_last_worker_left_pending_prune, (or_fr_ptr)); static inline int CUT_last_worker_left_pending_prune(or_fr_ptr);
STD_PROTO(static inline or_fr_ptr CUT_leftmost_or_frame, (void)); static inline or_fr_ptr CUT_leftmost_or_frame(void);
#ifdef TABLING_INNER_CUTS #ifdef TABLING_INNER_CUTS
STD_PROTO(static inline or_fr_ptr CUT_leftmost_until, (or_fr_ptr, int)); static inline or_fr_ptr CUT_leftmost_until(or_fr_ptr, int);
#endif /* TABLING_INNER_CUTS */ #endif /* TABLING_INNER_CUTS */
STD_PROTO(static inline void CUT_store_answer, (or_fr_ptr, qg_ans_fr_ptr)); static inline void CUT_store_answer(or_fr_ptr, qg_ans_fr_ptr);
STD_PROTO(static inline void CUT_store_answers, (or_fr_ptr, qg_sol_fr_ptr)); static inline void CUT_store_answers(or_fr_ptr, qg_sol_fr_ptr);
STD_PROTO(static inline void CUT_join_answers_in_an_unique_frame, (qg_sol_fr_ptr)); static inline void CUT_join_answers_in_an_unique_frame(qg_sol_fr_ptr);
STD_PROTO(static inline void CUT_free_solution_frame, (qg_sol_fr_ptr)); static inline void CUT_free_solution_frame(qg_sol_fr_ptr);
STD_PROTO(static inline void CUT_free_solution_frames, (qg_sol_fr_ptr)); static inline void CUT_free_solution_frames(qg_sol_fr_ptr);
STD_PROTO(static inline qg_sol_fr_ptr CUT_prune_solution_frames, (qg_sol_fr_ptr, int)); static inline qg_sol_fr_ptr CUT_prune_solution_frames(qg_sol_fr_ptr, int);

View File

@ -42,12 +42,12 @@ static int search_for_hidden_shared_work(bitmap stable_busy);
** Local inlines ** ** Local inlines **
** ----------------------- */ ** ----------------------- */
STD_PROTO(static inline void PUT_NO_WORK_IN_UPPER_NODES, (void)); static inline void PUT_NO_WORK_IN_UPPER_NODES(void);
STD_PROTO(static inline void PUT_IDLE, (int)); static inline void PUT_IDLE(int);
STD_PROTO(static inline void PUT_BUSY, (int)); static inline void PUT_BUSY(int);
STD_PROTO(static inline void PUT_IN_ROOT_NODE, (int)); static inline void PUT_IN_ROOT_NODE(int);
STD_PROTO(static inline void PUT_OUT_ROOT_NODE, (int)); static inline void PUT_OUT_ROOT_NODE(int);
STD_PROTO(static inline void move_up_to_prune_request, (void)); static inline void move_up_to_prune_request(void);
static inline static inline

View File

@ -9095,11 +9095,11 @@ This package assumes you use UDI exo-indexing, that is:
@end example @end example
It is designed to optimise the following type of queries: It is designed to optimise the following type of queries:
@example @example
?- max(X, diagnoses(X, 9, Y)). ?- max(X, diagnoses(X, 9, Y), X).
?- min(X, diagnoses(X, 9, 36211117)). ?- min(X, diagnoses(X, 9, 36211117), X).
?- X #< Y, min(X, diagnoses(9, X, 36211117)), diagnoses(Y, 9, _). ?- X #< Y, min(X, diagnoses(X, 9, 36211117), X ), diagnoses(Y, 9, _).
@end example @end example
The first argument gives the time, the second the patient, and the The first argument gives the time, the second the patient, and the
third the condition code. The first query should find the last time third the condition code. The first query should find the last time

View File

@ -9,48 +9,98 @@
:- module(exo_interval, :- module(exo_interval,
[max/2, [max/2,
min/2, min/2,
any/2,
max/3,
min/3,
any/3,
(#<)/2, (#<)/2,
(#>)/2, (#>)/2,
(#=<)/2,
(#>=)/2,
(#=)/2, (#=)/2,
op(700, xfx, (#>)), op(700, xfx, (#>)),
op(700, xfx, (#<)), op(700, xfx, (#<)),
op(700, xfx, (#>=)),
op(700, xfx, (#=<)),
op(700, xfx, (#=))]). op(700, xfx, (#=))]).
:- meta_predicate :- meta_predicate max(?,0,?), min(?,0,?), any(?,0,?).
max(?,0),
min(?,0).
max(X, G) :- max(X, G, X) :-
attvar(X), insert_atts(X, i(_,_,max)),
get_attr(X, exo_interval, Atts), !,
throw(error('cannot handle combination of attributes ')).
max(X, G) :-
var(X),
put_attr(X, exo_interval, max),
call(G). call(G).
min(X, G) :- min(X, G, X) :-
attvar(X), insert_atts(X, i(_,_,min)),
get_attr(X, exo_interval, Atts), !, call(G).
throw(error('cannot handle combination of attributes ')).
min(X, G) :- max(X, X) :-
var(X), insert_atts(X, i(_,_,max)).
put_attr(X, exo_interval, min),
call(G). min(X, X) :-
insert_atts(X, i(_,_,min)).
X #> Y :- X #> Y :-
( var(X) -> put_attr(X, exo_interval, '>'(Y) ) ; true ), ( var(X) -> insert_atts(X, i(Y,_,_))
( var(Y) -> put_attr(X, exo_interval, '<'(X) ) ; true ), ;
when((nonvar(X), nonvar(Y)), X > Y). ( var(Y) -> insert_atts(Y, i(_,X,_) ) ;
true
)
;
var(Y) -> insert_atts(Y, i(_,X,_))
;
X > Y
).
X #>= Y :-
( var(X) -> insert_atts(X, i(Y-1,_,_))
;
( var(Y) -> insert_atts(Y, i(X+1,_,_) ) ;
true
)
;
var(Y) -> insert_atts(Y, i(_,X+1,_))
;
X >= Y
).
X #< Y :- X #< Y :-
( var(X) -> put_attr(X, exo_interval, '<'(Y) ) ; true ), ( var(X) -> insert_atts(X, i(_,Y,_))
( var(Y) -> put_attr(X, exo_interval, '>'(X) ) ; true ), ;
when((nonvar(X), nonvar(Y)), X < Y). ( var(Y) -> insert_atts(Y, i(X,_,_) ) ;
true
)
;
var(Y) -> insert_atts(Y, i(X,_,_))
;
X < Y
).
X #=< Y :-
( var(X) -> insert_atts(X, i(Y+1,_,_))
;
( var(Y) -> insert_atts(Y, i(X-1,_,_) ) ;
true
)
;
var(Y) -> insert_atts(Y, i(X-1,_,_))
;
X =< Y
).
X #= Y :- X #= Y :-
X = Y, ( var(X) -> insert_atts(X, i(Y-1,Y+1,_))
( var(X) -> put_attr(X, exo_interval, '='(Y) ) ; true ). ;
( var(Y) -> insert_atts(Y, i(X-1,X+1,_) ) ;
true
)
;
var(Y) -> insert_atts(Y, i(X-1,X+Y,_))
;
X =:= Y
).
attribute_goals(X) --> attribute_goals(X) -->
{ get_attr(X, exo_interval, Op) }, { get_attr(X, exo_interval, Op) },
@ -58,6 +108,70 @@ attribute_goals(X) -->
{ Op = min } -> [min(X)] ; { Op = min } -> [min(X)] ;
{ Op = '>'(Y) } -> [X #> Y] ; { Op = '>'(Y) } -> [X #> Y] ;
{ Op = '<'(Y) } -> [X #< Y] ; { Op = '<'(Y) } -> [X #< Y] ;
{ Op = '='(Y) } -> [X #= Y] ). { Op = range(A,B,C) } ->
range_min(A,X),
range_max(B,X),
range_op(C, X)
).
range_min(Y, _X) -->
{ var(Y) }, !,
[].
range_min(Y, X) -->
[X #> Y].
range_max(Y, _X) -->
{ var(Y) }, !,
[].
range_max(Y, X) -->
[X #< Y].
range_op(Y, _X) -->
{ var(Y) }, !,
[].
range_op(Y, X) -->
{ Op =.. [Y, X] },
[Op].
insert_atts(V, Att) :-
( nonvar(V) ->
throw( error(uninstantion_error(V), exo_interval) )
; attvar(V) ->
get_attr(V, exo_interval, Att0),
expand_atts(Att, Att0, NAtt)
;
NAtt = Att
),
put_attr(V, exo_interval, NAtt).
expand_atts(i(A1, B1, C1), i(A2, B2, C2), i(A3,B3,C3)) :-
expand_min(A1, A2, A3),
expand_max(B1, B2, B3),
expand_op(C1, C2, C3).
expand_min(A1, A2, A3) :-
(var(A1) -> A3 = A2;
var(A2) -> A3 = A1;
ground(A1), ground(A2) -> A3 is max(A1,A2) ;
A3 = max(A1,A2)
).
expand_max(A1, A2, A3) :-
(var(A1) -> A3 = A2;
var(A2) -> A3 = A1;
ground(A1), ground(A2) -> A3 is min(A1,A2) ;
A3 = min(A1,A2)
).
expand_op(A1, A2, A3) :-
(var(A1) -> A3 = A2;
var(A2) -> A3 = A1;
A1 == A2 -> A3 = A1;
A1 == unique -> A3 = unique;
A2 == unique -> A3 = unique;
A2 == min, A1 = max -> A3 = unique;
A1 == min, A2 = max -> A3 = unique;
A1 == min -> A3 = min; A2 == min -> A3 = min;
A1 == max -> A3 = max; A2 == max -> A3 = max;
A3 = single
).

View File

@ -34,6 +34,8 @@ Comments: This file provides a set of functions to convert a prolog term to a C
#include <malloc.h> #include <malloc.h>
#endif #endif
#if HAVE_MPI_H
#ifdef COMPRESS #ifdef COMPRESS
#include "minilzo.h" #include "minilzo.h"
#endif #endif
@ -211,3 +213,4 @@ string2term(char *const ptr,const size_t *size) {
} }
return t; return t;
} }
#endif /* HAVE_MPI_H */

View File

@ -16,6 +16,7 @@ A AfUnix N "AF_UNIX"
A Alarm F "$alarm" A Alarm F "$alarm"
A Alias N "alias" A Alias N "alias"
A AltNot N "not" A AltNot N "not"
A Any N "any"
A Append N "append" A Append N "append"
A Arg N "arg" A Arg N "arg"
A Array F "$array" A Array F "$array"
@ -142,6 +143,7 @@ A IDB N "idb"
A IOMode N "io_mode" A IOMode N "io_mode"
A Id N "id" A Id N "id"
A Inf N "inf" A Inf N "inf"
A Infinity N "infinity"
A InitGoal F "$init_goal" A InitGoal F "$init_goal"
A InitProlog F "$init_prolog" A InitProlog F "$init_prolog"
A InStackExpansion N "in stack expansion" A InStackExpansion N "in stack expansion"
@ -316,6 +318,7 @@ A Undefined N "undefined"
A Undefp F "$undefp" A Undefp F "$undefp"
A Underflow N "underflow" A Underflow N "underflow"
A UnificationStack N "unification_stack" A UnificationStack N "unification_stack"
A Unique N "unique"
A UnsignedByte N "unsigned_byte" A UnsignedByte N "unsigned_byte"
A UnsignedChar N "unsigned_char" A UnsignedChar N "unsigned_char"
A User N "user" A User N "user"

View File

@ -340,6 +340,9 @@ Atom swi_atoms[N_SWI_ATOMS] SWI_Atoms InitSWIAtoms() RestoreSWIAtoms()
Functor swi_functors[N_SWI_FUNCTORS] SWI_Functors void void Functor swi_functors[N_SWI_FUNCTORS] SWI_Functors void void
struct swi_reverse_hash swi_reverse_hash[N_SWI_HASH] SWI_ReverseHash void void struct swi_reverse_hash swi_reverse_hash[N_SWI_HASH] SWI_ReverseHash void void
Atom empty_wakeups[MAX_EMPTY_WAKEUPS] EmptyWakeups InitEmptyWakeups() RestoreEmptyWakeups()
int max_empty_wakeups MaxEmptyWakeups =0
/* SWI blobs */ /* SWI blobs */
struct PL_blob_t *swi_blob_types SWI_BlobTypes =NULL RestoreSWIBlobTypes() struct PL_blob_t *swi_blob_types SWI_BlobTypes =NULL RestoreSWIBlobTypes()
struct AtomEntryStruct *swi_blobs SWI_Blobs =NULL RestoreSWIBlobs() struct AtomEntryStruct *swi_blobs SWI_Blobs =NULL RestoreSWIBlobs()

View File

@ -280,74 +280,6 @@ do_not_compile_expressions :- set_value('$c_arith',[]).
/* Arithmetics */ /* Arithmetics */
between(I,M,J) :-
(
var(I)
->
'$do_error'(instantiation_error,between(I,M,J))
;
integer(I)
->
(
var(M)
->
'$do_error'(instantiation_error,between(I,M,J))
;
integer(M)
->
(
var(J)
->
I =< M, '$between'(I,M,J)
;
integer(J)
->
J >= I, J =< M
;
'$do_error'(type_error(integer, J),between(I,M,J))
)
;
M == inf ->
(
var(J)
->
'$between_inf'(I,J)
;
integer(J)
->
J >= I
;
'$do_error'(type_error(integer, J),between(I,M,J))
)
;
M == infinity ->
(
var(J)
->
'$between_inf'(I,J)
;
integer(J)
->
J >= I
;
'$do_error'(type_error(integer, J),between(I,M,J))
)
;
'$do_error'(type_error(integer, M),between(I,M,J))
)
;
'$do_error'(type_error(integer, I),between(I,M,J))
).
'$between'(I,M,I) :- (I == M -> ! ; true ).
'$between'(I0,I,J) :- I0 < I,
'$plus'(I0, 1, I1),
'$between'(I1,I,J).
'$between_inf'(I,I).
'$between_inf'(I,J) :-
'$plus'(I, 1, I1),
'$between_inf'(I1,J).
% M and N nonnegative integers, N is the successor of M % M and N nonnegative integers, N is the successor of M
@ -404,6 +336,8 @@ succ(M,N) :-
N < 0, N < 0,
'$do_error'(domain_error(not_less_than_zero, N),succ(M,N)). '$do_error'(domain_error(not_less_than_zero, N),succ(M,N)).
plus(X, Y, Z) :- plus(X, Y, Z) :-
( (
var(X) var(X)

View File

@ -21,8 +21,9 @@
:- dynamic dbloading/6, dbprocess/2. :- dynamic dbloading/6, dbprocess/2.
dbload_from_stream(R, M0, Type) :- dbload_from_stream(R, M0, Type) :-
repeat,
read(R,T), read(R,T),
( T = end_of_file -> !, close_dbload(R, Type); ( T == end_of_file -> !, close_dbload(R, Type);
dbload_count(T, M0), dbload_count(T, M0),
fail fail
). ).
@ -166,8 +167,13 @@ load_exofacts.
exodb_add_facts(R, M) :- exodb_add_facts(R, M) :-
repeat, repeat,
catch(read(R,T), _, fail), catch(protected_exodb_add_fact(R, M), _, fail),
( T = end_of_file -> !; !.
protected_exodb_add_fact(R, M) :-
repeat,
read(R,T),
( T == end_of_file -> !;
exodb_add_fact(T, M), exodb_add_fact(T, M),
fail fail
). ).