handle_t type name causes conflict with WIN32, replace by yhandle_t
This commit is contained in:
parent
f00a6d5a40
commit
8da6fb70e1
@ -407,18 +407,18 @@ For implementation details and more information, please check term_t_slots in th
|
|||||||
/// @brief report the current position of the slots, assuming that they occupy the top of the stack.
|
/// @brief report the current position of the slots, assuming that they occupy the top of the stack.
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
X_API handle_t YAP_CurrentSlot(void);
|
X_API yhandle_t YAP_CurrentSlot(void);
|
||||||
|
|
||||||
/// @brief allocate n empty new slots
|
/// @brief allocate n empty new slots
|
||||||
///
|
///
|
||||||
/// Return a handle to the system's default slot.
|
/// Return a handle to the system's default slot.
|
||||||
X_API handle_t YAP_NewSlots(int NumberOfSlots);
|
X_API yhandle_t YAP_NewSlots(int NumberOfSlots);
|
||||||
|
|
||||||
/// @brief allocate n empty new slots
|
/// @brief allocate n empty new slots
|
||||||
///
|
///
|
||||||
/// Allocate _NumberOfSlots_ from the stack and return an handle to the
|
/// Allocate _NumberOfSlots_ from the stack and return an handle to the
|
||||||
/// last one. The other handle can be obtained by decrementing the handle.
|
/// last one. The other handle can be obtained by decrementing the handle.
|
||||||
X_API handle_t YAP_InitSlot(YAP_Term t);
|
X_API yhandle_t YAP_InitSlot(YAP_Term t);
|
||||||
|
|
||||||
/// @brief read from a slot.
|
/// @brief read from a slot.
|
||||||
///
|
///
|
||||||
@ -3892,11 +3892,11 @@ YAP_Erase(void *handle)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
X_API handle_t
|
X_API yhandle_t
|
||||||
YAP_ArgsToSlots(int n)
|
YAP_ArgsToSlots(int n)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
handle_t slot = Yap_NewSlots(n PASS_REGS);
|
yhandle_t slot = Yap_NewSlots(n PASS_REGS);
|
||||||
CELL *ptr0 = LCL0+slot, *ptr1=&ARG1;
|
CELL *ptr0 = LCL0+slot, *ptr1=&ARG1;
|
||||||
while (n--) {
|
while (n--) {
|
||||||
*ptr0++ = *ptr1++;
|
*ptr0++ = *ptr1++;
|
||||||
@ -3905,7 +3905,7 @@ YAP_ArgsToSlots(int n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
X_API void
|
X_API void
|
||||||
YAP_SlotsToArgs(int n, handle_t slot)
|
YAP_SlotsToArgs(int n, yhandle_t slot)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
CELL *ptr0 = LCL0+slot, *ptr1=&ARG1;
|
CELL *ptr0 = LCL0+slot, *ptr1=&ARG1;
|
||||||
@ -3947,8 +3947,8 @@ YAP_SetYAPFlag(yap_flag_t flag, int val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* handle_t YAP_VarSlotToNumber(handle_t) */
|
/* yhandle_t YAP_VarSlotToNumber(yhandle_t) */
|
||||||
handle_t YAP_VarSlotToNumber(handle_t s) {
|
yhandle_t YAP_VarSlotToNumber(yhandle_t s) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Term *t = (CELL *)Deref(Yap_GetFromSlot(s PASS_REGS));
|
Term *t = (CELL *)Deref(Yap_GetFromSlot(s PASS_REGS));
|
||||||
if (t < HR)
|
if (t < HR)
|
||||||
@ -3962,7 +3962,7 @@ Term YAP_ModuleUser(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* int YAP_PredicateHasClauses() */
|
/* int YAP_PredicateHasClauses() */
|
||||||
handle_t YAP_NumberOfClausesForPredicate(PredEntry *pe) {
|
yhandle_t YAP_NumberOfClausesForPredicate(PredEntry *pe) {
|
||||||
return pe->cs.p_code.NOfClauses;
|
return pe->cs.p_code.NOfClauses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class YAPTerm {
|
|||||||
friend class YAPPairTerm;
|
friend class YAPPairTerm;
|
||||||
friend class YAPListTerm;
|
friend class YAPListTerm;
|
||||||
protected:
|
protected:
|
||||||
handle_t t;
|
yhandle_t t;
|
||||||
void mk(Term t0);
|
void mk(Term t0);
|
||||||
Term gt();
|
Term gt();
|
||||||
YAPTerm(Term tn) { mk( tn ); }
|
YAPTerm(Term tn) { mk( tn ); }
|
||||||
@ -336,7 +336,7 @@ private:
|
|||||||
///
|
///
|
||||||
/// It also communicates the array of arguments t[] abd the array of variables
|
/// It also communicates the array of arguments t[] abd the array of variables
|
||||||
/// back to yapquery
|
/// back to yapquery
|
||||||
YAPPredicate(const char *s, Term **outp, handle_t& vnames );
|
YAPPredicate(const char *s, Term **outp, yhandle_t& vnames );
|
||||||
|
|
||||||
/// Term constructor for predicates
|
/// Term constructor for predicates
|
||||||
///
|
///
|
||||||
@ -456,7 +456,7 @@ class YAPQuery: public YAPPredicate {
|
|||||||
int q_flags;
|
int q_flags;
|
||||||
YAP_dogoalinfo q_h;
|
YAP_dogoalinfo q_h;
|
||||||
YAPQuery *oq;
|
YAPQuery *oq;
|
||||||
handle_t vnames;
|
yhandle_t vnames;
|
||||||
void initQuery( Term ts[] );
|
void initQuery( Term ts[] );
|
||||||
void initQuery( YAPTerm t[], arity_t arity );
|
void initQuery( YAPTerm t[], arity_t arity );
|
||||||
public:
|
public:
|
||||||
|
@ -49,9 +49,9 @@ This section lists the main internal functions for slot management. These functi
|
|||||||
*************************************************************************************************/
|
*************************************************************************************************/
|
||||||
|
|
||||||
/// @brief start a new set of slots, linking them to the last active slots (who may, or not, be active).
|
/// @brief start a new set of slots, linking them to the last active slots (who may, or not, be active).
|
||||||
static inline handle_t
|
static inline yhandle_t
|
||||||
Yap_StartSlots( USES_REGS1 ) {
|
Yap_StartSlots( USES_REGS1 ) {
|
||||||
handle_t CurSlot = LOCAL_CurSlot;
|
yhandle_t CurSlot = LOCAL_CurSlot;
|
||||||
// if (CurSlot == LCL0-(ASP+(IntOfTerm(ASP[0])+2)))
|
// if (CurSlot == LCL0-(ASP+(IntOfTerm(ASP[0])+2)))
|
||||||
// return CurSlot;
|
// return CurSlot;
|
||||||
/* new slot */
|
/* new slot */
|
||||||
@ -65,56 +65,56 @@ Yap_StartSlots( USES_REGS1 ) {
|
|||||||
|
|
||||||
/// @brief reset slots to a well-known position in the stack
|
/// @brief reset slots to a well-known position in the stack
|
||||||
static inline void
|
static inline void
|
||||||
Yap_CloseSlots( handle_t slot USES_REGS ) {
|
Yap_CloseSlots( yhandle_t slot USES_REGS ) {
|
||||||
LOCAL_CurSlot = slot;
|
LOCAL_CurSlot = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief report the current position of the slots, assuming that they occupy the top of the stack.
|
/// @brief report the current position of the slots, assuming that they occupy the top of the stack.
|
||||||
static inline handle_t
|
static inline yhandle_t
|
||||||
Yap_CurrentSlot( USES_REGS1 ) {
|
Yap_CurrentSlot( USES_REGS1 ) {
|
||||||
return IntOfTerm(ASP[0]);
|
return IntOfTerm(ASP[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief read from a slot.
|
/// @brief read from a slot.
|
||||||
static inline Term
|
static inline Term
|
||||||
Yap_GetFromSlot(handle_t slot USES_REGS)
|
Yap_GetFromSlot(yhandle_t slot USES_REGS)
|
||||||
{
|
{
|
||||||
return(Deref(LCL0[slot]));
|
return(Deref(LCL0[slot]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief read from a slot. but does not try to dereference the slot.
|
/// @brief read from a slot. but does not try to dereference the slot.
|
||||||
static inline Term
|
static inline Term
|
||||||
Yap_GetDerefedFromSlot(handle_t slot USES_REGS)
|
Yap_GetDerefedFromSlot(yhandle_t slot USES_REGS)
|
||||||
{
|
{
|
||||||
return LCL0[slot];
|
return LCL0[slot];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief read the object in a slot. but do not try to dereference the slot.
|
/// @brief read the object in a slot. but do not try to dereference the slot.
|
||||||
static inline Term
|
static inline Term
|
||||||
Yap_GetPtrFromSlot(handle_t slot USES_REGS)
|
Yap_GetPtrFromSlot(yhandle_t slot USES_REGS)
|
||||||
{
|
{
|
||||||
return(LCL0[slot]);
|
return(LCL0[slot]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief get the memory address of a slot
|
/// @brief get the memory address of a slot
|
||||||
static inline Term *
|
static inline Term *
|
||||||
Yap_AddressFromSlot(handle_t slot USES_REGS)
|
Yap_AddressFromSlot(yhandle_t slot USES_REGS)
|
||||||
{
|
{
|
||||||
return(LCL0+slot);
|
return(LCL0+slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief store term in a slot
|
/// @brief store term in a slot
|
||||||
static inline void
|
static inline void
|
||||||
Yap_PutInSlot(handle_t slot, Term t USES_REGS)
|
Yap_PutInSlot(yhandle_t slot, Term t USES_REGS)
|
||||||
{
|
{
|
||||||
LCL0[slot] = t;
|
LCL0[slot] = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief allocate n empty new slots
|
/// @brief allocate n empty new slots
|
||||||
static inline handle_t
|
static inline yhandle_t
|
||||||
Yap_NewSlots(int n USES_REGS)
|
Yap_NewSlots(int n USES_REGS)
|
||||||
{
|
{
|
||||||
handle_t old_slots = IntOfTerm(ASP[0]), oldn = n;
|
yhandle_t old_slots = IntOfTerm(ASP[0]), oldn = n;
|
||||||
while (n > 0) {
|
while (n > 0) {
|
||||||
RESET_VARIABLE(ASP);
|
RESET_VARIABLE(ASP);
|
||||||
ASP--;
|
ASP--;
|
||||||
@ -128,7 +128,7 @@ Yap_NewSlots(int n USES_REGS)
|
|||||||
static inline Int
|
static inline Int
|
||||||
Yap_InitSlot(Term t USES_REGS)
|
Yap_InitSlot(Term t USES_REGS)
|
||||||
{
|
{
|
||||||
handle_t old_slots = IntOfTerm(ASP[0]);
|
yhandle_t old_slots = IntOfTerm(ASP[0]);
|
||||||
*ASP = t;
|
*ASP = t;
|
||||||
ASP--;
|
ASP--;
|
||||||
ASP[old_slots+2] = ASP[0] = MkIntTerm(old_slots+1);
|
ASP[old_slots+2] = ASP[0] = MkIntTerm(old_slots+1);
|
||||||
@ -137,9 +137,9 @@ Yap_InitSlot(Term t USES_REGS)
|
|||||||
|
|
||||||
/// @brief Succeeds if it is to recover the space allocated for $n$ contiguos slots starting at topSlot.
|
/// @brief Succeeds if it is to recover the space allocated for $n$ contiguos slots starting at topSlot.
|
||||||
static inline int
|
static inline int
|
||||||
Yap_RecoverSlots(int n, handle_t topSlot USES_REGS)
|
Yap_RecoverSlots(int n, yhandle_t topSlot USES_REGS)
|
||||||
{
|
{
|
||||||
handle_t old_slots = IntOfTerm(ASP[0]);
|
yhandle_t old_slots = IntOfTerm(ASP[0]);
|
||||||
if (old_slots < n) {
|
if (old_slots < n) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ typedef UInt BITS32;
|
|||||||
|
|
||||||
typedef CELL Term;
|
typedef CELL Term;
|
||||||
|
|
||||||
typedef Int handle_t;
|
typedef Int yhandle_t;
|
||||||
|
|
||||||
/* */ typedef double Float;
|
/* */ typedef double Float;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ typedef Term YAP_Module;
|
|||||||
|
|
||||||
typedef int YAP_Bool;
|
typedef int YAP_Bool;
|
||||||
|
|
||||||
typedef handle_t YAP_handle_t;
|
typedef yhandle_t YAP_handle_t;
|
||||||
|
|
||||||
#define YAP_PredEntryPtr struct pred_entry *
|
#define YAP_PredEntryPtr struct pred_entry *
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user