synch interface with implementation.
This commit is contained in:
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);
|
||||
|
Reference in New Issue
Block a user