<> <> <> <> <> <> <> DIRECTORY AlpineEnvironment, Basics, AlpineLog, RuntimeError; LogInline: DEFINITIONS IMPORTS Basics, RuntimeError = BEGIN Comparison: TYPE = Basics.Comparison; RecordID: TYPE = AlpineLog.RecordID; PageNumber: TYPE = AlpineEnvironment.PageNumber; WordNumber: TYPE = INT; wordsPerPage: CARDINAL = AlpineEnvironment.wordsPerPage; logWordsPerPage: CARDINAL = AlpineEnvironment.logWordsPerPage; RecordID1: TYPE = MACHINE DEPENDENT RECORD [ page0 (0: 0..7): [0..256), offsetInPage (0: 8..15): [0..AlpineEnvironment.wordsPerPage), page1 (1: 0..31): LONG CARDINAL]; <> <> RecordID2: TYPE = MACHINE DEPENDENT RECORD [ lowbits: CARDINAL, highbits: LONG CARDINAL ]; <> Compare: PROC [a, b: RecordID] RETURNS [Comparison] = INLINE { IF a.highBits = b.highBits THEN RETURN [Basics.CompareCard[a.lowBits, b.lowBits]] ELSE RETURN [Basics.CompareCard[a.highBits, b.highBits]]; }; Min: PROC [a, b: RecordID] RETURNS [RecordID] = INLINE { RETURN [IF Compare[a, b] = greater THEN b ELSE a]; }; Max: PROC [a, b: RecordID] RETURNS [RecordID] = INLINE { RETURN [IF Compare[a, b] = less THEN b ELSE a]; }; WordsFromSubtract: PROC [larger, smaller: RecordID] RETURNS [result: INT] = INLINE { result _ LOOPHOLE[larger.lowBits-smaller.lowBits, INT]; SELECT TRUE FROM result < 0 => GO TO boundsFault; larger.lowBits < smaller.lowBits => <> IF larger.highBits # smaller.highBits+1 THEN GO TO boundsFault; larger.highBits # smaller.highBits => GO TO boundsFault; ENDCASE; RETURN [result]; EXITS boundsFault => ERROR RuntimeError.BoundsFault; }; AddC: PROC [r: RecordID, words: CARDINAL] RETURNS [RecordID] = INLINE { <> low: Basics.LongNumber[num] = LOOPHOLE[LONG[words] + LONG[LOOPHOLE[r, RecordID2].lowbits]]; high: LONG CARDINAL = LONG[low.highbits] + LOOPHOLE[r, RecordID2].highbits; RETURN [LOOPHOLE[RecordID2[highbits: high, lowbits: low.lowbits]]]; }; AddLC: PROC [r: RecordID, words: LONG CARDINAL] RETURNS [RecordID] = INLINE { <> low: Basics.LongNumber[num] = LOOPHOLE[ LONG[LOOPHOLE[words, Basics.LongNumber[num]].lowbits] + LONG[LOOPHOLE[r, RecordID2].lowbits] ]; high: LONG CARDINAL = LONG[low.highbits] + LONG[LOOPHOLE[words, Basics.LongNumber[num]].highbits] + LOOPHOLE[r, RecordID2].highbits; RETURN [LOOPHOLE[RecordID2[highbits: high, lowbits: low.lowbits]]]; }; RecordIDFromWordNumber: PROC [w: WordNumber] RETURNS [RecordID] = INLINE { RETURN [[lowBits: LOOPHOLE[w], highBits: 0]] }; WordInPageFromRecordID: PROC [r: RecordID] RETURNS [CARDINAL] = INLINE { RETURN [LOOPHOLE[r, RecordID1].offsetInPage] }; END. CHANGE LOG Created by MBrown on September 21, 1982 2:45 pm Changed by MBrown on September 25, 1982 3:50 pm <> Changed by MBrown on October 4, 1982 10:19 pm <> Changed by MBrown on October 25, 1982 10:45 pm <> Changed by MBrown on November 9, 1982 3:01 pm < word stuff to AlpineInline.>> Changed by MBrown on January 30, 1984 10:11:20 am PST <> <> <> <> <> <<>>