/************************************************************************* * * * YAP Prolog %W% %G% * * Yap Prolog was developed at NCCUP - Universidade do Porto * * * * Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * * * ************************************************************************** * * * File: Tags_32bits.h.m4 * * Last rev: December 90 * * mods: * * comments: Original Tag Scheme for machines with 32 bits adresses * * version: $Id: Tags_32bits.h,v 1.1 2005-05-27 22:27:06 rslopes Exp $ * *************************************************************************/ /* Original version for 32 bit addresses machines, Each term is represented internally as an unsigned 32 bit integer as follows: tag value ints 1m1....00 numeric value atoms 1m0....00 offset of atom entry pairs 1mr....01 ptr to pair aplied functor 1mr....10 ptr to functor followed by args ref 0mr....00 address of cell undefined 0mr....00 address of cell pointing to itself functors are represented as ptrs to the functor entry in the atom property list */ #if FALSE #define SHIFT_HIGH_TAG 29 #define MKTAG(HI,LO) ((((UInt) (HI))<= 0); } INLINE_ONLY inline EXTERN int IsNonVarTerm (Term); INLINE_ONLY inline EXTERN int IsNonVarTerm (Term t) { return (int) (Signed (t) < 0); } INLINE_ONLY inline EXTERN Term *RepPair (Term); INLINE_ONLY inline EXTERN Term * RepPair (Term t) { return (Term *) (NonTagPart (t)); } INLINE_ONLY inline EXTERN Term AbsPair (Term *); INLINE_ONLY inline EXTERN Term AbsPair (Term * p) { return (Term) (TAGGEDA (PairTag, (p))); } INLINE_ONLY inline EXTERN Int IsPairTerm (Term); INLINE_ONLY inline EXTERN Int IsPairTerm (Term t) { return (Int) (BitOn (PairBit, (t))); } INLINE_ONLY inline EXTERN Term *RepAppl (Term); INLINE_ONLY inline EXTERN Term * RepAppl (Term t) { return (Term *) (NonTagPart (t)); } INLINE_ONLY inline EXTERN Term AbsAppl (Term *); INLINE_ONLY inline EXTERN Term AbsAppl (Term * p) { return (Term) (TAGGEDA (ApplTag, (p))); } INLINE_ONLY inline EXTERN Int IsApplTerm (Term); INLINE_ONLY inline EXTERN Int IsApplTerm (Term t) { return (Int) (BitOn (ApplBit, (t))); } INLINE_ONLY inline EXTERN int IsAtomOrIntTerm (Term); INLINE_ONLY inline EXTERN int IsAtomOrIntTerm (Term t) { return (int) (((Unsigned (t) & LowTagBits) == 0)); } INLINE_ONLY inline EXTERN Term AdjustPtr (Term t, Term off); INLINE_ONLY inline EXTERN Term AdjustPtr (Term t, Term off) { return (Term) ((t) + off); } INLINE_ONLY inline EXTERN Term AdjustIDBPtr (Term t, Term off); INLINE_ONLY inline EXTERN Term AdjustIDBPtr (Term t, Term off) { return (Term) ((t) + off); } INLINE_ONLY inline EXTERN Int IntOfTerm (Term); INLINE_ONLY inline EXTERN Int IntOfTerm (Term t) { return (Int) (((Int) (t << 3)) >> (3 + 2)); } #endif /* NOT IN USE */