-- File DBStorageTID.mesa -- Last edited by -- MBrown on 1-Mar-81 11:21:34 -- Cattell on January 14, 1983 2:09 pm DIRECTORY Basics, DBCommon, DBEnvironment USING[InternalError], PrincOpsUtils; DBStorageTID: DEFINITIONS IMPORTS DBEnvironment, PrincOpsUtils = BEGIN -- This interface contains definitions that relate to tuple IDs (TIDs). TID: TYPE = LONG CARDINAL; -- "Pointer" to a tuple in the database. Structure is given by the procedures --below: DecomposeTID: PROCEDURE[tid: TID] RETURNS[--p-- DBCommon.DBPage, --slotIndex-- CARDINAL] = INLINE BEGIN -- Breaks a TID into the DBPage where the tuple's slot is, and the number of --the slot on that page. slotIndex: CARDINAL _ PrincOpsUtils.BITAND[LOOPHOLE[tid, num Basics.LongNumber].lowbits, TIDSlotMask]; LOOPHOLE[tid, num Basics.LongNumber].lowbits _ PrincOpsUtils.BITAND[LOOPHOLE[tid, num Basics.LongNumber].lowbits, TIDLowPageMask]; RETURN[tid, slotIndex]; END;--DecomposeTID ConsTID: PROCEDURE[p: DBCommon.DBPage, slotIndex: CARDINAL] RETURNS[--tid-- TID] = INLINE BEGIN -- Makes a TID from the DBPage where the tuple's slot is, and the number of --the slot on that page. IF slotIndex > TIDSlotMask THEN ERROR DBEnvironment.InternalError; -- BadSlotIndex RETURN[p + slotIndex]; END;--ConsTID NullTID: TID = 0; -- Masks that define the maximum number of slots allowed per page. --Must agree with DBSegmentPrivate.BitsUnused. DBPageIncrement: CARDINAL = 100B; TIDSlotMask: CARDINAL = DBPageIncrement - 1; --000077B TIDLowPageMask: CARDINAL = LAST[CARDINAL] - TIDSlotMask; --177700B END.--DBStorageTID -- Module History Created by MBrown on June 10, 1980 3:56 PM -- Moved TID-related stuff here from DBStoragePrivateA. Changed by MBrown on September 26, 1980 11:13 AM -- Defined error code BadSlotIndex. Changed by MBrown on December 8, 1980 1:48 PM -- Defined DBPageIncrement, for use in Segment block allocator. Changed by MBrown on 1-Mar-81 11:22:17 -- InlineDefs -> Inline. Changed by Cattell on November 10, 1983 2:14 am -- Inline is gone. J^