synch interface with implementation.
This commit is contained in:
parent
ba40cc3b39
commit
0ebea4ec26
307
C/c_interface.c
307
C/c_interface.c
@ -325,6 +325,11 @@
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
/**
|
||||
@file c_interface.c
|
||||
*/
|
||||
|
||||
|
||||
#define Bool int
|
||||
#define flt double
|
||||
#define C_INTERFACE
|
||||
@ -351,7 +356,7 @@
|
||||
#include "iopreds.h"
|
||||
// we cannot consult YapInterface.h, that conflicts with what we declare, though
|
||||
// it shouldn't
|
||||
#include "yap_structs.h"
|
||||
#include "YapInterface.h"
|
||||
#define _yap_c_interface_h 1
|
||||
#include "pl-shared.h"
|
||||
#include "YapText.h"
|
||||
@ -379,122 +384,6 @@
|
||||
#define X_API __declspec(dllexport)
|
||||
#endif
|
||||
|
||||
X_API Term YAP_A(int);
|
||||
X_API Term YAP_Deref(Term);
|
||||
X_API Term YAP_MkVarTerm(void);
|
||||
X_API Bool YAP_IsVarTerm(Term);
|
||||
X_API Bool YAP_IsNonVarTerm(Term);
|
||||
X_API Bool YAP_IsIntTerm(Term);
|
||||
X_API Bool YAP_IsLongIntTerm(Term);
|
||||
X_API Bool YAP_IsBigNumTerm(Term);
|
||||
X_API Bool YAP_IsNumberTerm(Term);
|
||||
X_API Bool YAP_IsRationalTerm(Term);
|
||||
X_API Bool YAP_IsFloatTerm(Term);
|
||||
X_API Bool YAP_IsDbRefTerm(Term);
|
||||
X_API Bool YAP_IsAtomTerm(Term);
|
||||
X_API Bool YAP_IsPairTerm(Term);
|
||||
X_API Bool YAP_IsApplTerm(Term);
|
||||
X_API Bool YAP_IsCompoundTerm(Term);
|
||||
X_API Bool YAP_IsExternalDataInStackTerm(Term);
|
||||
X_API Bool YAP_IsOpaqueObjectTerm(Term, int);
|
||||
X_API Term YAP_MkIntTerm(Int);
|
||||
X_API Term YAP_MkBigNumTerm(void *);
|
||||
X_API Term YAP_MkRationalTerm(void *);
|
||||
X_API Int YAP_IntOfTerm(Term);
|
||||
X_API void YAP_BigNumOfTerm(Term, void *);
|
||||
X_API void YAP_RationalOfTerm(Term, void *);
|
||||
X_API Term YAP_MkFloatTerm(flt);
|
||||
X_API flt YAP_FloatOfTerm(Term);
|
||||
X_API Term YAP_MkAtomTerm(Atom);
|
||||
X_API Atom YAP_AtomOfTerm(Term);
|
||||
X_API Atom YAP_LookupAtom(char *);
|
||||
X_API Atom YAP_LookupWideAtom(wchar_t *);
|
||||
X_API size_t YAP_AtomNameLength(Atom);
|
||||
X_API Atom YAP_FullLookupAtom(char *);
|
||||
X_API int YAP_IsWideAtom(Atom);
|
||||
X_API char *YAP_AtomName(Atom);
|
||||
X_API wchar_t *YAP_WideAtomName(Atom);
|
||||
X_API Term YAP_MkPairTerm(Term,Term);
|
||||
X_API Term YAP_MkListFromTerms(Term *,Int);
|
||||
X_API Term YAP_MkNewPairTerm(void);
|
||||
X_API Term YAP_HeadOfTerm(Term);
|
||||
X_API Term YAP_TailOfTerm(Term);
|
||||
X_API Int YAP_SkipList(Term *, Term **);
|
||||
X_API Term YAP_MkApplTerm(Functor,UInt,Term *);
|
||||
X_API Term YAP_MkNewApplTerm(Functor,UInt);
|
||||
X_API Functor YAP_FunctorOfTerm(Term);
|
||||
X_API Term YAP_ArgOfTerm(Int,Term);
|
||||
X_API Term *YAP_ArgsOfTerm(Term);
|
||||
X_API Functor YAP_MkFunctor(Atom,Int);
|
||||
X_API Atom YAP_NameOfFunctor(Functor);
|
||||
X_API Int YAP_ArityOfFunctor(Functor);
|
||||
X_API void *YAP_ExtraSpace(void);
|
||||
X_API void YAP_cut_up(void);
|
||||
X_API Int YAP_Unify(Term,Term);
|
||||
X_API int YAP_Unifiable(Term,Term);
|
||||
X_API int YAP_Reset(void);
|
||||
X_API Int YAP_ListLength(Term);
|
||||
X_API Int YAP_Init(YAP_init_args *);
|
||||
X_API Int YAP_FastInit(char *);
|
||||
X_API PredEntry *YAP_FunctorToPred(Functor);
|
||||
X_API PredEntry *YAP_AtomToPred(Atom);
|
||||
X_API PredEntry *YAP_FunctorToPredInModule(Functor, Term);
|
||||
X_API PredEntry *YAP_AtomToPredInModule(Atom, Term);
|
||||
X_API Int YAP_CallProlog(Term);
|
||||
X_API void *YAP_AllocSpaceFromYap(size_t);
|
||||
X_API void *YAP_ReallocSpaceFromYap(void*,size_t);
|
||||
X_API void YAP_FreeSpaceFromYap(void *);
|
||||
X_API int YAP_StringToBuffer(Term, char *, unsigned int);
|
||||
X_API Term YAP_ReadBuffer(char *,Term *);
|
||||
X_API Term YAP_FloatsToList(double *, size_t);
|
||||
X_API Int YAP_ListToFloats(Term, double *, size_t);
|
||||
X_API Term YAP_IntsToList(Int *, size_t);
|
||||
X_API Int YAP_ListToInts(Term, Int *, size_t);
|
||||
X_API Term YAP_BufferToString(char *);
|
||||
X_API Term YAP_NBufferToString(char *, size_t);
|
||||
X_API Term YAP_WideBufferToString(wchar_t *);
|
||||
X_API Term YAP_NWideBufferToString(wchar_t *, size_t);
|
||||
X_API Term YAP_BufferToAtomList(char *);
|
||||
X_API Term YAP_NBufferToAtomList(char *,size_t);
|
||||
X_API Term YAP_WideBufferToAtomList(wchar_t *);
|
||||
X_API Term YAP_NWideBufferToAtomList(wchar_t *, size_t);
|
||||
X_API Term YAP_NWideBufferToAtomDiffList(wchar_t *, Term, size_t);
|
||||
X_API Term YAP_BufferToDiffList(char *, Term);
|
||||
X_API Term YAP_NBufferToDiffList(char *, Term, size_t);
|
||||
X_API Term YAP_WideBufferToDiffList(wchar_t *, Term);
|
||||
X_API Term YAP_NWideBufferToDiffList(wchar_t *, Term, size_t);
|
||||
X_API void YAP_Error(int, Term, char *, ...);
|
||||
X_API Int YAP_RunPredicate(PredEntry *, Term *);
|
||||
X_API Int YAP_RunGoal(Term);
|
||||
X_API Int YAP_RunGoalOnce(Term);
|
||||
X_API int YAP_RestartGoal(void);
|
||||
X_API int YAP_ShutdownGoal(int);
|
||||
X_API int YAP_EnterGoal(PredEntry *, Term *, YAP_dogoalinfo *);
|
||||
X_API int YAP_RetryGoal(YAP_dogoalinfo *);
|
||||
X_API int YAP_LeaveGoal(int, YAP_dogoalinfo *);
|
||||
X_API int YAP_GoalHasException(Term *);
|
||||
X_API void YAP_ClearExceptions(void);
|
||||
X_API int YAP_ContinueGoal(void);
|
||||
X_API void YAP_PruneGoal(YAP_dogoalinfo *);
|
||||
X_API IOSTREAM *YAP_TermToStream(Term);
|
||||
X_API IOSTREAM *YAP_InitConsult(int, char *);
|
||||
X_API void YAP_EndConsult(IOSTREAM *);
|
||||
X_API Term YAP_Read(IOSTREAM *);
|
||||
X_API void YAP_Write(Term, IOSTREAM *, int);
|
||||
X_API Term YAP_CopyTerm(Term);
|
||||
X_API int YAP_WriteBuffer(Term, char *, size_t, int);
|
||||
X_API char *YAP_WriteDynamicBuffer(Term, char *, size_t, size_t *, int *, int);
|
||||
X_API char *YAP_CompileClause(Term);
|
||||
X_API void YAP_PutValue(Atom,Term);
|
||||
X_API Term YAP_GetValue(Atom);
|
||||
X_API int YAP_CompareTerms(Term,Term);
|
||||
X_API void YAP_Exit(int);
|
||||
X_API void YAP_InitSocks(char *, long);
|
||||
X_API void YAP_SetOutputMessage(void);
|
||||
X_API int YAP_StreamToFileNo(Term);
|
||||
X_API void YAP_CloseAllOpenStreams(void);
|
||||
X_API void YAP_FlushAllStreams(void);
|
||||
|
||||
/**
|
||||
@group slotInterface Term Handles or Slots
|
||||
@{
|
||||
@ -569,73 +458,6 @@ X_API void YAP_SlotsToArgs(int HowMany, YAP_Int slot);
|
||||
|
||||
/// @}
|
||||
|
||||
X_API void YAP_Throw(Term);
|
||||
X_API void YAP_AsyncThrow(Term);
|
||||
X_API void YAP_Halt(int);
|
||||
X_API Term *YAP_TopOfLocalStack(void);
|
||||
X_API void *YAP_Predicate(Atom,UInt,Term);
|
||||
X_API void YAP_PredicateInfo(void *,Atom *,UInt *,Term *);
|
||||
X_API void YAP_UserCPredicate(char *,CPredicate,UInt);
|
||||
X_API void YAP_UserBackCPredicate(char *,CPredicate,CPredicate,UInt,unsigned int);
|
||||
X_API void YAP_UserCPredicateWithArgs(char *,CPredicate,UInt,Term);
|
||||
X_API void YAP_UserBackCutCPredicate(char *,CPredicate,CPredicate,CPredicate,UInt,unsigned int);
|
||||
X_API void *YAP_ExtraSpaceCut(void);
|
||||
X_API Term YAP_SetCurrentModule(Term);
|
||||
X_API Term YAP_CurrentModule(void);
|
||||
X_API Term YAP_CreateModule(Atom);
|
||||
X_API Term YAP_StripModule(Term, Term *);
|
||||
X_API int YAP_ThreadSelf(void);
|
||||
X_API int YAP_ThreadCreateEngine(struct thread_attr_struct *);
|
||||
X_API int YAP_ThreadAttachEngine(int);
|
||||
X_API int YAP_ThreadDetachEngine(int);
|
||||
X_API int YAP_ThreadDestroyEngine(int);
|
||||
X_API Term YAP_MkBlobTerm(unsigned int);
|
||||
X_API void *YAP_BlobOfTerm(Term);
|
||||
X_API Term YAP_TermNil(void);
|
||||
X_API int YAP_IsTermNil(Term);
|
||||
X_API int YAP_AtomGetHold(Atom);
|
||||
X_API int YAP_AtomReleaseHold(Atom);
|
||||
X_API Agc_hook YAP_AGCRegisterHook(Agc_hook);
|
||||
X_API int YAP_HaltRegisterHook(HaltHookFunc, void *);
|
||||
X_API char *YAP_cwd(void);
|
||||
X_API Term YAP_OpenList(int);
|
||||
X_API Term YAP_ExtendList(Term, Term);
|
||||
X_API int YAP_CloseList(Term, Term);
|
||||
X_API int YAP_IsAttVar(Term);
|
||||
X_API Term YAP_AttsOfVar(Term);
|
||||
X_API int YAP_FileNoFromStream(Term);
|
||||
X_API void *YAP_FileDescriptorFromStream(Term);
|
||||
X_API void *YAP_Record(Term);
|
||||
X_API Term YAP_Recorded(void *);
|
||||
X_API int YAP_Erase(void *);
|
||||
X_API int YAP_Variant(Term, Term);
|
||||
X_API Int YAP_NumberVars(Term, Int);
|
||||
X_API Term YAP_UnNumberVars(Term);
|
||||
X_API int YAP_IsNumberedVariable(Term);
|
||||
X_API int YAP_ExactlyEqual(Term, Term);
|
||||
X_API Int YAP_TermHash(Term, Int, Int, int);
|
||||
X_API void YAP_signal(int);
|
||||
X_API int YAP_SetYAPFlag(yap_flag_t, int);
|
||||
X_API Int YAP_VarSlotToNumber(Int);
|
||||
X_API Term YAP_ModuleUser(void);
|
||||
X_API Int YAP_NumberOfClausesForPredicate(PredEntry *);
|
||||
X_API int YAP_MaxOpPriority(Atom, Term);
|
||||
X_API int YAP_OpInfo(Atom, Term, int, int *, int *);
|
||||
X_API Term YAP_AllocExternalDataInStack(size_t);
|
||||
X_API void *YAP_ExternalDataInStackFromTerm(Term);
|
||||
X_API int YAP_NewOpaqueType(void *);
|
||||
X_API Term YAP_NewOpaqueObject(int, size_t);
|
||||
X_API void *YAP_OpaqueObjectFromTerm(Term);
|
||||
X_API CELL *YAP_HeapStoreOpaqueTerm(Term t);
|
||||
X_API int YAP_Argv(char *** argvp);
|
||||
X_API YAP_tag_t YAP_TagOfTerm(Term);
|
||||
X_API size_t YAP_ExportTerm(Term, char *, size_t);
|
||||
X_API size_t YAP_SizeOfExportedTerm(char *);
|
||||
X_API Term YAP_ImportTerm(char *);
|
||||
X_API int YAP_RequiresExtraStack(size_t);
|
||||
X_API Int YAP_AtomToInt(Atom At);
|
||||
X_API Atom YAP_IntToAtom(Int i);
|
||||
|
||||
static UInt
|
||||
current_arity(void)
|
||||
{
|
||||
@ -671,12 +493,6 @@ YAP_A(int i)
|
||||
return(Deref(XREGS[i]));
|
||||
}
|
||||
|
||||
X_API Term
|
||||
YAP_Deref(Term t)
|
||||
{
|
||||
return(Deref(t));
|
||||
}
|
||||
|
||||
X_API Bool
|
||||
YAP_IsIntTerm(Term t)
|
||||
{
|
||||
@ -813,16 +629,19 @@ YAP_MkBigNumTerm(void *big)
|
||||
#endif /* USE_GMP */
|
||||
}
|
||||
|
||||
X_API void
|
||||
X_API int
|
||||
YAP_BigNumOfTerm(Term t, void *b)
|
||||
{
|
||||
#if USE_GMP
|
||||
MP_INT *bz = (MP_INT *)b;
|
||||
if (IsVarTerm(t))
|
||||
return;
|
||||
return FALSE;
|
||||
if (!IsBigIntTerm(t))
|
||||
return;
|
||||
return FALSE;
|
||||
mpz_set(bz,Yap_BigIntOfTerm(t));
|
||||
return TRUE;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif /* USE_GMP */
|
||||
}
|
||||
|
||||
@ -840,16 +659,19 @@ YAP_MkRationalTerm(void *big)
|
||||
#endif /* USE_GMP */
|
||||
}
|
||||
|
||||
X_API void
|
||||
X_API int
|
||||
YAP_RationalOfTerm(Term t, void *b)
|
||||
{
|
||||
#if USE_GMP
|
||||
MP_RAT *br = (MP_RAT *)b;
|
||||
if (IsVarTerm(t))
|
||||
return;
|
||||
return FALSE;
|
||||
if (!IsBigIntTerm(t))
|
||||
return;
|
||||
return FALSE;
|
||||
mpq_set(br,Yap_BigRatOfTerm(t));
|
||||
return TRUE;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif /* USE_GMP */
|
||||
}
|
||||
|
||||
@ -935,29 +757,29 @@ YAP_IsWideAtom(Atom a)
|
||||
return IsWideAtom(a);
|
||||
}
|
||||
|
||||
X_API char *
|
||||
X_API const char *
|
||||
YAP_AtomName(Atom a)
|
||||
{
|
||||
char *o;
|
||||
const char *o;
|
||||
|
||||
o = AtomName(a);
|
||||
return(o);
|
||||
}
|
||||
|
||||
X_API wchar_t *
|
||||
X_API const wchar_t *
|
||||
YAP_WideAtomName(Atom a)
|
||||
{
|
||||
return RepAtom(a)->WStrOfAE;
|
||||
}
|
||||
|
||||
X_API Atom
|
||||
YAP_LookupAtom(char *c)
|
||||
YAP_LookupAtom(const char *c)
|
||||
{
|
||||
CACHE_REGS
|
||||
Atom a;
|
||||
|
||||
while (TRUE) {
|
||||
a = Yap_LookupAtom(c);
|
||||
a = Yap_LookupAtom((char *)c);
|
||||
LOCK(LOCAL_SignalLock);
|
||||
if (a == NIL || Yap_has_signal(YAP_CDOVF_SIGNAL)) {
|
||||
if (!Yap_locked_growheap(FALSE, 0, NULL)) {
|
||||
@ -969,16 +791,17 @@ YAP_LookupAtom(char *c)
|
||||
return a;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
X_API Atom
|
||||
YAP_LookupWideAtom(wchar_t *c)
|
||||
YAP_LookupWideAtom(const wchar_t *c)
|
||||
{
|
||||
CACHE_REGS
|
||||
Atom a;
|
||||
|
||||
while (TRUE) {
|
||||
a = Yap_LookupWideAtom(c);
|
||||
a = Yap_LookupWideAtom((wchar_t *)c);
|
||||
LOCK(LOCAL_SignalLock);
|
||||
if (a == NIL || Yap_has_signal(YAP_CDOVF_SIGNAL)) {
|
||||
if (!Yap_locked_growheap(FALSE, 0, NULL)) {
|
||||
@ -990,16 +813,17 @@ YAP_LookupWideAtom(wchar_t *c)
|
||||
return a;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
X_API Atom
|
||||
YAP_FullLookupAtom(char *c)
|
||||
YAP_FullLookupAtom(const char *c)
|
||||
{
|
||||
CACHE_REGS
|
||||
Atom at;
|
||||
|
||||
while (TRUE) {
|
||||
at = Yap_FullLookupAtom(c);
|
||||
at = Yap_FullLookupAtom((char *)c);
|
||||
LOCK(LOCAL_SignalLock);
|
||||
if (at == NIL || Yap_has_signal(YAP_CDOVF_SIGNAL)) {
|
||||
if (!Yap_locked_growheap(FALSE, 0, NULL)) {
|
||||
@ -1011,6 +835,7 @@ YAP_FullLookupAtom(char *c)
|
||||
return at;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
X_API size_t
|
||||
@ -1164,7 +989,7 @@ YAP_SkipList(Term *l, Term **tailp)
|
||||
}
|
||||
|
||||
X_API Term
|
||||
YAP_MkApplTerm(Functor f,UInt arity, Term args[])
|
||||
YAP_MkApplTerm(Functor f, UInt arity, Term args[])
|
||||
{
|
||||
CACHE_REGS
|
||||
Term t;
|
||||
@ -1180,7 +1005,7 @@ YAP_MkApplTerm(Functor f,UInt arity, Term args[])
|
||||
}
|
||||
|
||||
X_API Term
|
||||
YAP_MkNewApplTerm(Functor f,UInt arity)
|
||||
YAP_MkNewApplTerm(Functor f, UInt arity)
|
||||
{
|
||||
CACHE_REGS
|
||||
Term t;
|
||||
@ -1203,7 +1028,7 @@ YAP_FunctorOfTerm(Term t)
|
||||
|
||||
|
||||
X_API Term
|
||||
YAP_ArgOfTerm(Int n, Term t)
|
||||
YAP_ArgOfTerm(UInt n, Term t)
|
||||
{
|
||||
return (ArgOfTerm(n, t));
|
||||
}
|
||||
@ -1219,7 +1044,7 @@ YAP_ArgsOfTerm(Term t)
|
||||
}
|
||||
|
||||
X_API Functor
|
||||
YAP_MkFunctor(Atom a, Int n)
|
||||
YAP_MkFunctor(Atom a, UInt n)
|
||||
{
|
||||
return (Yap_MkFunctor(a, n));
|
||||
}
|
||||
@ -1230,7 +1055,7 @@ YAP_NameOfFunctor(Functor f)
|
||||
return (NameOfFunctor(f));
|
||||
}
|
||||
|
||||
X_API Int
|
||||
X_API UInt
|
||||
YAP_ArityOfFunctor(Functor f)
|
||||
{
|
||||
return (ArityOfFunctor(f));
|
||||
@ -1309,7 +1134,7 @@ YAP_cut_up(void)
|
||||
RECOVER_B();
|
||||
}
|
||||
|
||||
X_API Int
|
||||
X_API int
|
||||
YAP_Unify(Term t1, Term t2)
|
||||
{
|
||||
Int out;
|
||||
@ -1395,10 +1220,10 @@ YAP_InitSlot(Term t)
|
||||
}
|
||||
|
||||
X_API int
|
||||
YAP_RecoverSlots(int n, Int sl)
|
||||
YAP_RecoverSlots(int n, Int top_slot)
|
||||
{
|
||||
CACHE_REGS
|
||||
return Yap_RecoverSlots(n, sl PASS_REGS);
|
||||
return Yap_RecoverSlots(n, top_slot PASS_REGS);
|
||||
}
|
||||
|
||||
X_API Term
|
||||
@ -2067,7 +1892,7 @@ YAP_StringToBuffer(Term t, char *buf, unsigned int bufsize)
|
||||
|
||||
/* copy a string to a buffer */
|
||||
X_API Term
|
||||
YAP_BufferToString(char *s)
|
||||
YAP_BufferToString(const char *s)
|
||||
{
|
||||
Term t;
|
||||
BACKUP_H();
|
||||
@ -2087,7 +1912,7 @@ YAP_BufferToString(char *s)
|
||||
|
||||
/* copy a string to a buffer */
|
||||
X_API Term
|
||||
YAP_NBufferToString(char *s, size_t len)
|
||||
YAP_NBufferToString(const char *s, size_t len)
|
||||
{
|
||||
Term t;
|
||||
BACKUP_H();
|
||||
@ -2109,7 +1934,7 @@ YAP_NBufferToString(char *s, size_t len)
|
||||
|
||||
/* copy a string to a buffer */
|
||||
X_API Term
|
||||
YAP_WideBufferToString(wchar_t *s)
|
||||
YAP_WideBufferToString(const wchar_t *s)
|
||||
{
|
||||
Term t;
|
||||
BACKUP_H();
|
||||
@ -2129,7 +1954,7 @@ YAP_WideBufferToString(wchar_t *s)
|
||||
|
||||
/* copy a string to a buffer */
|
||||
X_API Term
|
||||
YAP_NWideBufferToString(wchar_t *s, size_t len)
|
||||
YAP_NWideBufferToString(const wchar_t *s, size_t len)
|
||||
{
|
||||
Term t;
|
||||
BACKUP_H();
|
||||
@ -2151,7 +1976,7 @@ YAP_NWideBufferToString(wchar_t *s, size_t len)
|
||||
|
||||
/* copy a string to a buffer */
|
||||
X_API Term
|
||||
YAP_ReadBuffer(char *s, Term *tp)
|
||||
YAP_ReadBuffer(const char *s, Term *tp)
|
||||
{
|
||||
CACHE_REGS
|
||||
Int sl;
|
||||
@ -2199,8 +2024,8 @@ YAP_ReadBuffer(char *s, Term *tp)
|
||||
}
|
||||
|
||||
/* copy a string to a buffer */
|
||||
X_API Term
|
||||
YAP_BufferToAtomList(char *s)
|
||||
X_API YAP_Term
|
||||
YAP_BufferToAtomList(const char *s)
|
||||
{
|
||||
Term t;
|
||||
BACKUP_H();
|
||||
@ -2220,7 +2045,7 @@ YAP_BufferToAtomList(char *s)
|
||||
|
||||
/* copy a string of size len to a buffer */
|
||||
X_API Term
|
||||
YAP_NBufferToAtomList(char *s, size_t len)
|
||||
YAP_NBufferToAtomList(const char *s, size_t len)
|
||||
{
|
||||
Term t;
|
||||
BACKUP_H();
|
||||
@ -2242,7 +2067,7 @@ YAP_NBufferToAtomList(char *s, size_t len)
|
||||
|
||||
/* copy a string to a buffer */
|
||||
X_API Term
|
||||
YAP_WideBufferToAtomList(wchar_t *s)
|
||||
YAP_WideBufferToAtomList(const wchar_t *s)
|
||||
{
|
||||
Term t;
|
||||
BACKUP_H();
|
||||
@ -2262,7 +2087,7 @@ YAP_WideBufferToAtomList(wchar_t *s)
|
||||
|
||||
/* copy a string of size len to a buffer */
|
||||
X_API Term
|
||||
YAP_NWideBufferToAtomList(wchar_t *s, size_t len)
|
||||
YAP_NWideBufferToAtomList(const wchar_t *s, size_t len)
|
||||
{
|
||||
Term t;
|
||||
BACKUP_H();
|
||||
@ -2284,7 +2109,7 @@ YAP_NWideBufferToAtomList(wchar_t *s, size_t len)
|
||||
|
||||
/* copy a string of size len to a buffer */
|
||||
X_API Term
|
||||
YAP_NWideBufferToAtomDiffList(wchar_t *s, Term t0, size_t len)
|
||||
YAP_NWideBufferToAtomDiffList(const wchar_t *s, Term t0, size_t len)
|
||||
{
|
||||
Term t;
|
||||
BACKUP_H();
|
||||
@ -2307,7 +2132,7 @@ YAP_NWideBufferToAtomDiffList(wchar_t *s, Term t0, size_t len)
|
||||
|
||||
/* copy a string to a buffer */
|
||||
X_API Term
|
||||
YAP_BufferToDiffList(char *s, Term t0)
|
||||
YAP_BufferToDiffList(const char *s, Term t0)
|
||||
{
|
||||
Term t;
|
||||
BACKUP_H();
|
||||
@ -2328,7 +2153,7 @@ YAP_BufferToDiffList(char *s, Term t0)
|
||||
|
||||
/* copy a string of size len to a buffer */
|
||||
X_API Term
|
||||
YAP_NBufferToDiffList(char *s, Term t0, size_t len)
|
||||
YAP_NBufferToDiffList(const char *s, Term t0, size_t len)
|
||||
{
|
||||
Term t;
|
||||
BACKUP_H();
|
||||
@ -2351,7 +2176,7 @@ YAP_NBufferToDiffList(char *s, Term t0, size_t len)
|
||||
|
||||
/* copy a string to a buffer */
|
||||
X_API Term
|
||||
YAP_WideBufferToDiffList(wchar_t *s, Term t0)
|
||||
YAP_WideBufferToDiffList(const wchar_t *s, Term t0)
|
||||
{
|
||||
Term t;
|
||||
BACKUP_H();
|
||||
@ -2372,7 +2197,7 @@ YAP_WideBufferToDiffList(wchar_t *s, Term t0)
|
||||
|
||||
/* copy a string of size len to a buffer */
|
||||
X_API Term
|
||||
YAP_NWideBufferToDiffList(wchar_t *s, Term t0, size_t len)
|
||||
YAP_NWideBufferToDiffList(const wchar_t *s, Term t0, size_t len)
|
||||
{
|
||||
Term t;
|
||||
BACKUP_H();
|
||||
@ -2395,7 +2220,7 @@ YAP_NWideBufferToDiffList(wchar_t *s, Term t0, size_t len)
|
||||
|
||||
|
||||
X_API void
|
||||
YAP_Error(int myerrno, Term t, char *buf,...)
|
||||
YAP_Error(int myerrno, Term t, const char *buf,...)
|
||||
{
|
||||
#define YAP_BUF_SIZE 512
|
||||
va_list ap;
|
||||
@ -2624,7 +2449,8 @@ YAP_ExternalDataInStackFromTerm(Term t)
|
||||
return ExternalBlobFromTerm (t);
|
||||
}
|
||||
|
||||
int YAP_NewOpaqueType(void *f)
|
||||
X_API YAP_opaque_tag_t
|
||||
YAP_NewOpaqueType(struct YAP_opaque_handler_struct *f)
|
||||
{
|
||||
int i;
|
||||
if (!GLOBAL_OpaqueHandlers) {
|
||||
@ -2642,7 +2468,7 @@ int YAP_NewOpaqueType(void *f)
|
||||
return i+USER_BLOB_START;
|
||||
}
|
||||
|
||||
Term YAP_NewOpaqueObject(int tag, size_t bytes)
|
||||
Term YAP_NewOpaqueObject(YAP_opaque_tag_t tag, size_t bytes)
|
||||
{
|
||||
Term t = Yap_AllocExternalDataInStack((CELL)tag, bytes);
|
||||
if (t == TermNil)
|
||||
@ -2651,7 +2477,7 @@ Term YAP_NewOpaqueObject(int tag, size_t bytes)
|
||||
}
|
||||
|
||||
X_API Bool
|
||||
YAP_IsOpaqueObjectTerm(Term t, int tag)
|
||||
YAP_IsOpaqueObjectTerm(Term t, YAP_opaque_tag_t tag)
|
||||
{
|
||||
return IsExternalBlobTerm(t, (CELL)tag);
|
||||
}
|
||||
@ -2875,7 +2701,7 @@ YAP_ClearExceptions(void)
|
||||
}
|
||||
|
||||
X_API IOSTREAM *
|
||||
YAP_InitConsult(int mode, char *filename)
|
||||
YAP_InitConsult(int mode, const char *filename)
|
||||
{
|
||||
IOSTREAM *st;
|
||||
BACKUP_MACHINE_REGS();
|
||||
@ -3475,9 +3301,10 @@ YAP_Exit(int retval)
|
||||
Yap_exit(retval);
|
||||
}
|
||||
|
||||
X_API void
|
||||
YAP_InitSocks(char *host, long port)
|
||||
X_API int
|
||||
YAP_InitSocks(const char *host, long port)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
X_API void
|
||||
@ -3575,13 +3402,13 @@ YAP_PredicateInfo(void *p, Atom* a, UInt* arity, Term* m)
|
||||
}
|
||||
|
||||
X_API void
|
||||
YAP_UserCPredicate(char *name, CPredicate def, UInt arity)
|
||||
YAP_UserCPredicate(const char *name, CPredicate def, UInt arity)
|
||||
{
|
||||
Yap_InitCPred(name, arity, def, UserCPredFlag);
|
||||
}
|
||||
|
||||
X_API void
|
||||
YAP_UserBackCPredicate(char *name, CPredicate init, CPredicate cont,
|
||||
YAP_UserBackCPredicate(const char *name, CPredicate init, CPredicate cont,
|
||||
UInt arity, unsigned int extra)
|
||||
{
|
||||
Yap_InitCPredBackCut(name, arity, extra, init, cont, NULL ,UserCPredFlag);
|
||||
@ -3589,14 +3416,14 @@ YAP_UserBackCPredicate(char *name, CPredicate init, CPredicate cont,
|
||||
}
|
||||
|
||||
X_API void
|
||||
YAP_UserBackCutCPredicate(char *name, CPredicate init, CPredicate cont, CPredicate cut,
|
||||
YAP_UserBackCutCPredicate(const char *name, CPredicate init, CPredicate cont, CPredicate cut,
|
||||
UInt arity, unsigned int extra)
|
||||
{
|
||||
Yap_InitCPredBackCut(name, arity, extra, init, cont, cut, UserCPredFlag);
|
||||
}
|
||||
|
||||
X_API void
|
||||
YAP_UserCPredicateWithArgs(char *a, CPredicate f, UInt arity, Term mod)
|
||||
YAP_UserCPredicateWithArgs(const char *a, CPredicate f, UInt arity, Term mod)
|
||||
{
|
||||
CACHE_REGS
|
||||
PredEntry *pe;
|
||||
@ -3658,7 +3485,7 @@ YAP_ThreadSelf(void)
|
||||
}
|
||||
|
||||
X_API int
|
||||
YAP_ThreadCreateEngine(struct thread_attr_struct * attr)
|
||||
YAP_ThreadCreateEngine(struct YAP_thread_attr_struct * attr)
|
||||
{
|
||||
#if THREADS
|
||||
return Yap_thread_create_engine(attr);
|
||||
|
@ -13,44 +13,42 @@
|
||||
* comments: Data structures and defines used in the Interface *
|
||||
* *
|
||||
*************************************************************************/
|
||||
#ifndef _YAPDEFS_H
|
||||
|
||||
#if defined(__STDC__) || defined(_MSC_VER)
|
||||
#ifdef PROTO
|
||||
#undef PROTO
|
||||
#endif
|
||||
#define PROTO(X,ARGS) X ARGS
|
||||
#define CONST const
|
||||
#define _YAPDEFS_H 1
|
||||
|
||||
#else
|
||||
|
||||
#define PROTO(X,ARGS) X()
|
||||
#define CONST /* empty */
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef YAP_H
|
||||
|
||||
/* if Yap.h is available, just reexport */
|
||||
|
||||
typedef CELL YAP_CELL;
|
||||
#define YAP_CELL CELL
|
||||
|
||||
typedef Term YAP_Term;
|
||||
#define YAP_Term Term
|
||||
|
||||
typedef CELL YAP_Arity;
|
||||
typedef UInt YAP_Arity;
|
||||
|
||||
typedef Term YAP_Module;
|
||||
|
||||
typedef Functor YAP_Functor;
|
||||
#define YAP_Functor Functor
|
||||
|
||||
typedef Atom YAP_Atom;
|
||||
#define YAP_Atom Atom
|
||||
|
||||
typedef Int YAP_Int;
|
||||
#define YAP_Int Int
|
||||
|
||||
typedef UInt YAP_UInt;
|
||||
#define YAP_UInt UInt
|
||||
|
||||
typedef Float YAP_Float;
|
||||
#define YAP_Float Float
|
||||
|
||||
typedef int YAP_Bool;
|
||||
|
||||
#define YAP_PredEntryPtr struct pred_entry *
|
||||
|
||||
#define YAP_UserCPred CPredicate
|
||||
|
||||
#define YAP_agc_hook Agc_hook
|
||||
|
||||
#else
|
||||
|
||||
/* Type definitions */
|
||||
@ -93,10 +91,26 @@ typedef double YAP_Float;
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
typedef struct YAP_pred_entry *YAP_PredEntryPtr;
|
||||
|
||||
typedef YAP_Bool (* YAP_UserCPred)(void);
|
||||
|
||||
typedef int (*YAP_agc_hook)(void *_Atom);
|
||||
|
||||
#include "YapError.h"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct YAP_thread_attr_struct {
|
||||
size_t ssize;
|
||||
size_t tsize;
|
||||
size_t sysize;
|
||||
int (*cancel)(int thread);
|
||||
YAP_Term egoal, alias;
|
||||
} YAP_thread_attr;
|
||||
|
||||
|
||||
typedef enum {
|
||||
YAP_TAG_ATT = 0x1,
|
||||
YAP_TAG_UNBOUND = 0x2,
|
||||
@ -221,16 +235,6 @@ typedef struct yap_boot_params {
|
||||
Int Yap_InitDefaults( YAP_init_args *init_args, char saved_state[] );
|
||||
#endif
|
||||
|
||||
/* from thread.h */
|
||||
typedef struct {
|
||||
unsigned long int ssize;
|
||||
unsigned long int tsize;
|
||||
YAP_Term alias;
|
||||
int (*cancel)(int);
|
||||
} YAP_thread_attr;
|
||||
|
||||
typedef struct YAP_pred_entry *YAP_PredEntryPtr;
|
||||
|
||||
/* this should be opaque to the user */
|
||||
typedef struct {
|
||||
unsigned long b;
|
||||
@ -238,7 +242,6 @@ typedef struct {
|
||||
struct yami *p, *cp;
|
||||
} YAP_dogoalinfo;
|
||||
|
||||
typedef int (*YAP_agc_hook)(void *_Atom);
|
||||
|
||||
typedef void (*YAP_halt_hook)(int exit_code, void *closure);
|
||||
|
||||
@ -290,3 +293,4 @@ typedef enum
|
||||
YAPC_ENABLE_AGC /* enable or disable atom garbage collection */
|
||||
} yap_flag_t;
|
||||
|
||||
#endif /* _YAPDEFS_H */
|
@ -32,7 +32,7 @@
|
||||
#define YAPVERSION 60000
|
||||
#endif
|
||||
|
||||
#include "yap_structs.h"
|
||||
#include "YapDefs.h"
|
||||
|
||||
#if HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
@ -140,10 +140,10 @@ extern X_API YAP_Term YAP_MkRationalTerm(void *);
|
||||
extern X_API YAP_Int YAP_IntOfTerm(YAP_Term);
|
||||
|
||||
/* void * BigNumOfTerm(Term) */
|
||||
extern X_API void *YAP_BigNumOfTerm(YAP_Term, void *);
|
||||
extern X_API YAP_Bool YAP_BigNumOfTerm(YAP_Term t, void *b);
|
||||
|
||||
/* void * RationalOfTerm(Term) */
|
||||
extern X_API void *YAP_RationalOfTerm(YAP_Term, void *);
|
||||
extern X_API YAP_Bool YAP_RationalOfTerm(YAP_Term, void *);
|
||||
|
||||
/* Term MkFloatTerm(YAP_Float) */
|
||||
extern X_API YAP_Term YAP_MkFloatTerm(YAP_Float);
|
||||
@ -157,26 +157,20 @@ extern X_API YAP_Term YAP_MkAtomTerm(YAP_Atom);
|
||||
/* YAP_Atom AtomOfTerm(Term) */
|
||||
extern X_API YAP_Atom YAP_AtomOfTerm(YAP_Term);
|
||||
|
||||
/* YAP_Atom LookupAtom(const char *) */
|
||||
extern X_API YAP_Atom YAP_LookupAtom(const char *);
|
||||
extern X_API YAP_Atom YAP_LookupAtom(const char *c);
|
||||
|
||||
/* YAP_Atom LookupWideAtom(const wchar_t *) */
|
||||
extern X_API YAP_Atom YAP_LookupWideAtom(const wchar_t *);
|
||||
extern X_API YAP_Atom YAP_LookupWideAtom(const wchar_t *c);
|
||||
|
||||
/* YAP_Atom FullLookupAtom(const char *) */
|
||||
extern X_API YAP_Atom YAP_FullLookupAtom(const char *);
|
||||
extern X_API YAP_Atom YAP_FullLookupAtom(const char *c);
|
||||
|
||||
/* int AtomNameLength(Atom) */
|
||||
extern X_API size_t YAP_AtomNameLength(YAP_Atom);
|
||||
|
||||
/* const char* IsWideAtom(YAP_Atom) */
|
||||
extern X_API int *YAP_IsWideAtom(YAP_Atom);
|
||||
extern X_API YAP_Bool YAP_IsWideAtom(YAP_Atom a);
|
||||
|
||||
/* const char* AtomName(YAP_Atom) */
|
||||
extern X_API const char *YAP_AtomName(YAP_Atom);
|
||||
extern X_API const char *YAP_AtomName(YAP_Atom a);
|
||||
|
||||
/* const wchar_t* AtomWideName(YAP_Atom) */
|
||||
extern X_API const wchar_t *YAP_WideAtomName(YAP_Atom);
|
||||
extern X_API const wchar_t *YAP_WideAtomName(YAP_Atom a);
|
||||
|
||||
/* YAP_Term MkPairTerm(YAP_Term Head, YAP_Term Tail) */
|
||||
extern X_API YAP_Term YAP_MkPairTerm(YAP_Term,YAP_Term);
|
||||
@ -200,29 +194,21 @@ extern X_API YAP_Term YAP_TermNil(void);
|
||||
|
||||
extern X_API int YAP_IsTermNil(YAP_Term);
|
||||
|
||||
/* YAP_Term MkApplTerm(YAP_Functor f, unsigned int n, YAP_Term[] args) */
|
||||
extern X_API YAP_Term YAP_MkApplTerm(YAP_Functor,unsigned int,YAP_Term *);
|
||||
extern X_API YAP_Term YAP_MkApplTerm(YAP_Functor functor, YAP_UInt arity,YAP_Term args[]);
|
||||
|
||||
/* YAP_Term MkNewApplTerm(YAP_Functor f, unsigned int n) */
|
||||
extern X_API YAP_Term YAP_MkNewApplTerm(YAP_Functor,unsigned int);
|
||||
extern X_API YAP_Term YAP_MkNewApplTerm( YAP_Functor f, YAP_UInt arity);
|
||||
|
||||
/* YAP_Functor YAP_FunctorOfTerm(Term) */
|
||||
extern X_API YAP_Functor YAP_FunctorOfTerm(YAP_Term);
|
||||
extern X_API YAP_Functor YAP_FunctorOfTerm(YAP_Term t);
|
||||
|
||||
/* YAP_Term ArgOfTerm(unsigned int argno,YAP_Term t) */
|
||||
extern X_API YAP_Term YAP_ArgOfTerm(unsigned int,YAP_Term);
|
||||
extern X_API YAP_Term YAP_ArgOfTerm(YAP_UInt n, YAP_Term t);
|
||||
|
||||
/* YAP_Term *ArgsOfTerm(YAP_Term t) */
|
||||
extern X_API YAP_Term *YAP_ArgsOfTerm(YAP_Term);
|
||||
extern X_API YAP_Term *YAP_ArgsOfTerm(YAP_Term t);
|
||||
|
||||
/* YAP_Functor MkFunctor(YAP_Atom a,int arity) */
|
||||
extern X_API YAP_Functor YAP_MkFunctor(YAP_Atom,unsigned int);
|
||||
extern X_API YAP_Functor YAP_MkFunctor(YAP_Atom a, YAP_UInt n);
|
||||
|
||||
/* YAP_Atom NameOfFunctor(Functor) */
|
||||
extern X_API YAP_Atom YAP_NameOfFunctor(YAP_Functor);
|
||||
extern X_API YAP_Atom YAP_NameOfFunctor(YAP_Functor g);
|
||||
|
||||
/* unsigned unsigned int YAP_ArityOfFunctor(Functor) */
|
||||
extern X_API unsigned int YAP_ArityOfFunctor(YAP_Functor);
|
||||
extern X_API YAP_UInt YAP_ArityOfFunctor(YAP_Functor f);
|
||||
|
||||
/* void ExtraSpace(void) */
|
||||
extern X_API void *YAP_ExtraSpace(void);
|
||||
@ -232,28 +218,27 @@ extern X_API void *YAP_ExtraSpaceCut(void);
|
||||
#define YAP_PRESERVED_DATA(ptr, type) (ptr = (type *)YAP_ExtraSpace())
|
||||
#define YAP_PRESERVED_DATA_CUT(ptr,type) (ptr = (type *)YAP_ExtraSpaceCut())
|
||||
|
||||
/* YAP_Bool unify(YAP_Term a, YAP_Term b) */
|
||||
extern X_API YAP_Bool YAP_Unify(YAP_Term, YAP_Term);
|
||||
extern X_API YAP_Bool YAP_Unify(YAP_Term t1, YAP_Term t2);
|
||||
|
||||
/* void UserCPredicate(const char *name, int *fn(), int arity) */
|
||||
extern X_API void YAP_UserCPredicate(const char *, YAP_Bool (*)(void), unsigned int);
|
||||
extern X_API void YAP_UserCPredicate(const char *, YAP_UserCPred, YAP_Arity arity);
|
||||
|
||||
/* void UserCPredicateWithArgs(const char *name, int *fn(), unsigned int arity) */
|
||||
extern X_API void YAP_UserCPredicateWithArgs(const char *, YAP_Bool (*)(void), YAP_Arity, YAP_Term);
|
||||
extern X_API void YAP_UserCPredicateWithArgs(const char *, YAP_UserCPred, YAP_Arity, YAP_Term);
|
||||
|
||||
/* void UserBackCPredicate(const char *name, int *init(), int *cont(), int
|
||||
arity, int extra) */
|
||||
extern X_API void YAP_UserBackCPredicate(const char *, YAP_Bool (*)(void), YAP_Bool (*)(void), YAP_Arity, unsigned int);
|
||||
extern X_API void YAP_UserBackCPredicate(const char *, YAP_UserCPred, YAP_UserCPred, YAP_Arity, unsigned int);
|
||||
|
||||
/* YAP_Int YAP_ListLength(YAP_Term t) */
|
||||
extern X_API YAP_Int YAP_ListLength(YAP_Term);
|
||||
|
||||
/* void UserBackCPredicate(char *name, int *init(), int *cont(), int *cut(), int
|
||||
arity, int extra) */
|
||||
extern X_API void YAP_UserBackCutCPredicate(const char *, YAP_Bool (*)(void), YAP_Bool (*)(void), YAP_Bool (*)(void), YAP_Arity, unsigned int);
|
||||
extern X_API void YAP_UserBackCutCPredicate(const char *, YAP_UserCPred, YAP_UserCPred, YAP_UserCPred, YAP_Arity, unsigned int);
|
||||
|
||||
/* void CallProlog(YAP_Term t) */
|
||||
extern X_API YAP_Bool YAP_CallProlog(YAP_Term t);
|
||||
extern X_API YAP_Int YAP_CallProlog(YAP_Term t);
|
||||
|
||||
/* void cut_fail(void) */
|
||||
extern X_API void YAP_cut_up(void);
|
||||
@ -318,24 +303,13 @@ extern X_API YAP_Bool YAP_GoalHasException(YAP_Term *);
|
||||
/* void YAP_ClearExceptions(void) */
|
||||
extern X_API void YAP_ClearExceptions(void);
|
||||
|
||||
/* int YAP_Reset(void) */
|
||||
extern X_API void YAP_Reset(void);
|
||||
extern X_API int YAP_Reset(void);
|
||||
|
||||
/* void YAP_Error(int, YAP_Term, const char *,...) */
|
||||
extern X_API void YAP_Error(int, YAP_Term, const char *, ...);
|
||||
extern X_API void YAP_Error(int myerrno, YAP_Term t, const char *buf, ...);
|
||||
|
||||
/* YAP_Term YAP_Read(void *) */
|
||||
extern X_API YAP_Term YAP_Read(void *);
|
||||
|
||||
/* void YAP_Write(YAP_Term,void (*)(int),int) */
|
||||
extern X_API void YAP_Write(YAP_Term,void *,int);
|
||||
|
||||
/* void YAP_WriteBufffer(YAP_Term,char *,unsgined int,int) */
|
||||
extern X_API int YAP_WriteBuffer(YAP_Term,char *,size_t,int);
|
||||
|
||||
/* char* YAP_WriteDynamicBufffer(YAP_Term,char *,unsigned int,unsigned int
|
||||
*,int *,int) */
|
||||
extern X_API char* YAP_WriteDynamicBuffer(YAP_Term,char *,size_t *, int *, int);
|
||||
extern X_API char* YAP_WriteDynamicBuffer(YAP_Term t,char *buf,size_t sze, size_t *lengthp, int *encp, int flags);
|
||||
|
||||
/* void YAP_Term(YAP_Term) */
|
||||
extern X_API YAP_Term YAP_CopyTerm(YAP_Term);
|
||||
@ -344,21 +318,32 @@ extern X_API YAP_Term YAP_CopyTerm(YAP_Term);
|
||||
extern X_API char *YAP_CompileClause(YAP_Term);
|
||||
|
||||
/* int YAP_Init(YAP_init_args *) */
|
||||
extern X_API int YAP_Init(YAP_init_args *);
|
||||
extern X_API YAP_Int YAP_Init(YAP_init_args *);
|
||||
|
||||
/* int YAP_FastInit(const char *) */
|
||||
extern X_API int YAP_FastInit(const char *);
|
||||
extern X_API YAP_Int YAP_FastInit(char saved_state[]);
|
||||
|
||||
/* void * YAP_TermToStream(YAP_Term) */
|
||||
extern X_API void * YAP_TermToStream(YAP_Term);
|
||||
#ifndef _PL_STREAM_H
|
||||
// if we don't know what a stream is, just don't assume nothing about the pointer
|
||||
#define IOSTREAM void
|
||||
#endif /* FPL_STREAM_H */
|
||||
|
||||
/* void * YAP_InitConsult(int, const char *) */
|
||||
extern X_API void * YAP_InitConsult(int, const char *);
|
||||
extern X_API YAP_Term YAP_Read(IOSTREAM *s);
|
||||
|
||||
extern X_API void YAP_Write(YAP_Term t,IOSTREAM *s,int);
|
||||
|
||||
extern X_API IOSTREAM * YAP_TermToStream(YAP_Term t);
|
||||
|
||||
extern X_API IOSTREAM * YAP_InitConsult(int mode, const char *filename);
|
||||
|
||||
extern X_API void YAP_EndConsult(IOSTREAM *s);
|
||||
|
||||
#ifndef _PL_STREAM_H
|
||||
// if we don't know what a stream is, just don't assume nothing about the pointer
|
||||
#undef IOSTREAM
|
||||
#endif /* FPL_STREAM_H */
|
||||
|
||||
/* int YAP_EndConsult(void) */
|
||||
extern X_API int YAP_EndConsult(void *);
|
||||
|
||||
/* void YAP_Exit(int) */
|
||||
extern X_API void YAP_Exit(int);
|
||||
|
||||
/* void YAP_PutValue(YAP_Atom, YAP_Term) */
|
||||
@ -376,50 +361,36 @@ extern X_API YAP_Int YAP_ListToInts(YAP_Term, YAP_Int *, size_t);
|
||||
/* int StringToBuffer(YAP_Term,char *,unsigned int) */
|
||||
extern X_API int YAP_StringToBuffer(YAP_Term,char *,unsigned int);
|
||||
|
||||
/* int BufferToString(const char *) */
|
||||
extern X_API YAP_Term YAP_BufferToString(const char *);
|
||||
extern X_API YAP_Term YAP_BufferToString(const char *s);
|
||||
|
||||
/* int BufferToString(const char *) */
|
||||
extern X_API YAP_Term YAP_NBufferToString(const char *, size_t len);
|
||||
extern X_API YAP_Term YAP_NBufferToString(const char *s, size_t len);
|
||||
|
||||
/* int BufferToString(const char *) */
|
||||
extern X_API YAP_Term YAP_WideBufferToString(const wchar_t *);
|
||||
|
||||
/* int BufferToString(const char *) */
|
||||
extern X_API YAP_Term YAP_NWideBufferToString(const wchar_t *, size_t len);
|
||||
extern X_API YAP_Term YAP_NWideBufferToString(const wchar_t *s, size_t len);
|
||||
|
||||
/* int BufferToAtomList(const char *) */
|
||||
extern X_API YAP_Term YAP_BufferToAtomList(const char *);
|
||||
extern X_API YAP_Term YAP_BufferToAtomList(const char *s);
|
||||
|
||||
/* int BufferToAtomList(const char *) */
|
||||
extern X_API YAP_Term YAP_NBufferToAtomList(const char *, size_t len);
|
||||
extern X_API YAP_Term YAP_NBufferToAtomList(const char *s, size_t len);
|
||||
|
||||
/* int BufferToAtomList(const char *) */
|
||||
extern X_API YAP_Term YAP_WideBufferToAtomList(const wchar_t *);
|
||||
extern X_API YAP_Term YAP_WideBufferToAtomList(const wchar_t *s);
|
||||
|
||||
/* int BufferToAtomList(const char *) */
|
||||
extern X_API YAP_Term YAP_NWideBufferToAtomList(const wchar_t *, size_t len);
|
||||
extern X_API YAP_Term YAP_NWideBufferToAtomList(const wchar_t *s, size_t len);
|
||||
|
||||
/* int BufferToDiffList(const char *) */
|
||||
extern X_API YAP_Term YAP_NWideBufferToAtomDiffList(const wchar_t *, YAP_Term, size_t len);
|
||||
extern X_API YAP_Term YAP_NWideBufferToAtomDiffList(const wchar_t *s, YAP_Term t0, size_t len);
|
||||
|
||||
/* int BufferToDiffList(const char *) */
|
||||
extern X_API YAP_Term YAP_BufferToDiffList(const char *);
|
||||
extern X_API YAP_Term YAP_BufferToDiffList(const char *s, YAP_Term t0);
|
||||
|
||||
/* int BufferToDiffList(const char *) */
|
||||
extern X_API YAP_Term YAP_NBufferToDiffList(const char *, size_t len);
|
||||
extern X_API YAP_Term YAP_NBufferToDiffList(const char *s, YAP_Term t0, size_t len);
|
||||
|
||||
/* int BufferToDiffList(const char *) */
|
||||
extern X_API YAP_Term YAP_WideBufferToDiffList(const wchar_t *);
|
||||
extern X_API YAP_Term YAP_WideBufferToDiffList(const wchar_t *s, YAP_Term t0);
|
||||
|
||||
/* int BufferToDiffList(const char *) */
|
||||
extern X_API YAP_Term YAP_NWideBufferToDiffList(const wchar_t *, YAP_Term, size_t len);
|
||||
extern X_API YAP_Term YAP_NWideBufferToDiffList(const wchar_t *s, YAP_Term t0, size_t len);
|
||||
|
||||
/* YAP_Term BufferToTerm(const char *) */
|
||||
extern X_API YAP_Term YAP_ReadBuffer(const char *,YAP_Term *);
|
||||
extern X_API YAP_Term YAP_ReadBuffer(const char *s,YAP_Term *tp);
|
||||
|
||||
/* void YAP_InitSocks(const char *,long) */
|
||||
extern X_API int YAP_InitSocks(const char *,long);
|
||||
extern X_API int YAP_InitSocks(const char *host,long port);
|
||||
|
||||
#ifdef SFUNC
|
||||
|
||||
@ -469,13 +440,10 @@ extern X_API YAP_Term *YAP_AddressOfTermInSlot(YAP_Int);
|
||||
/* YAP_Term YAP_PutInSlots(t) */
|
||||
extern X_API void YAP_PutInSlot(YAP_Int, YAP_Term);
|
||||
|
||||
/* void YAP_RecoverSlots() */
|
||||
extern X_API int YAP_RecoverSlots(int);
|
||||
extern X_API int YAP_RecoverSlots(int n, YAP_Int top_slot);
|
||||
|
||||
/* void YAP_RecoverSlots() */
|
||||
extern X_API YAP_Int YAP_ArgsToSlots(int);
|
||||
|
||||
/* void YAP_RecoverSlots() */
|
||||
extern X_API void YAP_SlotsToArgs(int, YAP_Int);
|
||||
|
||||
/* void YAP_Throw() */
|
||||
@ -490,7 +458,7 @@ extern X_API void YAP_AsyncThrow(YAP_Term);
|
||||
#define YAP_ModuleName(mod) (mod)
|
||||
|
||||
/* int YAP_Halt() */
|
||||
extern X_API int YAP_Halt(int);
|
||||
extern X_API void YAP_Halt(int);
|
||||
|
||||
/* int YAP_TopOfLocalStack() */
|
||||
extern X_API YAP_Term *YAP_TopOfLocalStack(void);
|
||||
@ -520,7 +488,7 @@ extern X_API int YAP_AtomGetHold(YAP_Atom);
|
||||
extern X_API int YAP_AtomReleaseHold(YAP_Atom);
|
||||
|
||||
/* void YAP_AtomReleaseHold(YAP_Atom) */
|
||||
extern X_API YAP_agc_hook YAP_AGCRegisterHook(YAP_agc_hook);
|
||||
extern X_API YAP_agc_hook YAP_AGCRegisterHook(YAP_agc_hook hook);
|
||||
|
||||
/* void YAP_AtomReleaseHold(YAP_Atom) */
|
||||
extern X_API int YAP_HaltRegisterHook(YAP_halt_hook, void *);
|
||||
@ -530,7 +498,7 @@ extern X_API char * YAP_cwd(void);
|
||||
|
||||
/* thread stuff */
|
||||
extern X_API int YAP_ThreadSelf(void);
|
||||
extern X_API int YAP_ThreadCreateEngine(YAP_thread_attr *);
|
||||
extern X_API int YAP_ThreadCreateEngine(YAP_thread_attr *attr);
|
||||
extern X_API int YAP_ThreadAttachEngine(int);
|
||||
extern X_API int YAP_ThreadDetachEngine(int);
|
||||
extern X_API int YAP_ThreadDestroyEngine(int);
|
||||
@ -589,16 +557,23 @@ extern X_API int YAP_MaxOpPriority(YAP_Atom, YAP_Term);
|
||||
/* int YAP_OpInfo(Atom, Term, int, int *, int *) */
|
||||
extern X_API int YAP_OpInfo(YAP_Atom, YAP_Term, int, int *, int *);
|
||||
|
||||
/* YAP_Bool YAP_IsExternalDataInStackTerm(YAP_Term) */
|
||||
extern X_API YAP_Bool YAP_IsExternalDataInStackTerm(YAP_Term);
|
||||
|
||||
extern X_API YAP_opaque_tag_t YAP_NewOpaqueType(struct YAP_opaque_handler_struct *);
|
||||
extern X_API YAP_Term YAP_AllocExternalDataInStack(size_t bytes);
|
||||
|
||||
extern X_API YAP_Bool YAP_IsOpaqueObjectTerm(YAP_Term, YAP_opaque_tag_t);
|
||||
extern X_API void *YAP_ExternalDataInStackFromTerm(YAP_Term t);
|
||||
|
||||
extern X_API YAP_Term YAP_NewOpaqueObject(YAP_opaque_tag_t, size_t);
|
||||
extern X_API YAP_Bool YAP_IsExternalDataInStackTerm(YAP_Term t);
|
||||
|
||||
extern X_API void *YAP_OpaqueObjectFromTerm(YAP_Term);
|
||||
extern X_API YAP_opaque_tag_t YAP_NewOpaqueType(struct YAP_opaque_handler_struct *f);
|
||||
|
||||
extern X_API YAP_Bool YAP_IsOpaqueObjectTerm(YAP_Term t, YAP_opaque_tag_t tag);
|
||||
|
||||
extern X_API YAP_Term YAP_NewOpaqueObject(YAP_opaque_tag_t tag, size_t bytes);
|
||||
|
||||
extern X_API void *YAP_OpaqueObjectFromTerm(YAP_Term t);
|
||||
|
||||
extern X_API YAP_CELL *YAP_HeapStoreOpaqueTerm(YAP_Term t);
|
||||
|
||||
extern X_API int YAP_Argv(char ***);
|
||||
|
||||
@ -624,4 +599,3 @@ extern X_API YAP_Atom YAP_IntToAtom(YAP_Int i);
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef _c_interface_h
|
||||
#if !defined(_c_interface_h) && !defined(_YAP_NOT_INSTALLED_)
|
||||
|
||||
#define _c_interface_h 1
|
||||
|
||||
|
Reference in New Issue
Block a user