-- File: ListSortRef.mesa -- Last edited By Mitchell on December 20, 1982 3:27 pm DIRECTORY Environment USING [Comparison]; ListSortRef: CEDAR DEFINITIONS = --(note 2.1) BEGIN Comparison: TYPE = Environment.Comparison; CompareProc: TYPE = PROC[r1, r2: REF ANY] RETURNS [Comparison]; -- Returns less if r1^ < r2^, equal if r1^ = r2^, greater if r1^ > r2^. CompareError: ERROR[reason: Reason]; Reason: TYPE = {typeMismatch, invalidType}; -- errors from a CompareProc Sort: PROC[list: LIST OF REF ANY, compareProc: CompareProc] --(note 2.2) RETURNS[LIST OF REF ANY]; -- Destructive sort; copy list first if nondestructive sort is needed. -- Returns a list containing the same REFs as list, arranged in ascending order --according to compareProc. Order of equal items is not preserved. Compare: CompareProc; -- ! SafeStorage.NarrowRefFault -- (if both parameters do not NARROW to one of ROPE or REF INT.) -- Compares ROPE : ROPE (case significant) and REF INT : REF INT END.--ListSortRef CHANGE LOG Created by MBrown on 21-Apr-81 13:55:09 Changed by MBrown on 10-Dec-81 9:50:15 -- Change comment in Compare (now compares ROPE instead of REF TEXT.) Changed by MBrown on July 5, 1982 4:59 pm -- CEDAR definitions, eliminate type Item. <> <> <> <> <<>>