-- File: FileCommon.mesa -- Last edited by Gobbel: 5-Jan-82 20:10:37 -- Last edited by Levin: 3-Feb-81 9:55:11 DIRECTORY FileDefs USING [bytesPerPage, Comparison, Position], Inline USING [LongNumber], Mopcodes USING [zUDCMP, zINC]; FileCommon: PROGRAM EXPORTS FileDefs = BEGIN OPEN FileDefs; -- This module exports the portions of the FileDefs interface that are not -- specific to any particular file system. -- Procedures and Signals -- ComparePositions: PUBLIC PROCEDURE [pos1, pos2: Position] RETURNS [Comparison] = BEGIN DoCompare: PROCEDURE [lc1, lc2: Inline.LongNumber] RETURNS [Comparison] = MACHINE CODE {Mopcodes.zUDCMP; Mopcodes.zINC}; RETURN[DoCompare[[num[pos1.byte, pos1.page]], [num[pos2.byte, pos2.page]]]] END; IncrementPosition: PUBLIC PROCEDURE [pos: Position, bytes: CARDINAL] RETURNS [Position] = -- performs the logical operation pos ¬ pos + bytes. BEGIN lastBytes: CARDINAL; WHILE bytes >= bytesPerPage DO pos.page ¬ pos.page + 1; bytes ¬ bytes - bytesPerPage; ENDLOOP; IF (lastBytes ¬ pos.byte + bytes) >= bytesPerPage THEN { pos.page ¬ pos.page + 1; pos.byte ¬ lastBytes - bytesPerPage} ELSE pos.byte ¬ lastBytes; RETURN[pos] END; END.