<> <> <> <> <> <<>> <> <<>> <> DIRECTORY Basics USING [Comparison], ParticularList USING [Item, nullItem, Compare]; ListSort: CEDAR DEFINITIONS IMPORTS ParticularList = BEGIN Item: TYPE = ParticularList.Item; nullItem: Item = ParticularList.nullItem; Compare: PRIVATE PROC [l1, l2: LIST OF Item] RETURNS [Basics.Comparison] = INLINE { RETURN [ParticularList.Compare[l1, l2]] }; Sort: PROC [l: LIST OF Item] RETURNS [LIST OF Item]; <> END. <> <> <> <<(1) create a ParticularList definitions module, which must define Item, nullItem, and Compare as follows:>> <; nullItem: Item = ; Compare: PROC [l1, l2: LIST OF Item] RETURNS [Basics.Comparison] ... ; Compares the two Items contained in l1.first and l2.first (l1, l2 are never NIL) Result = less means l1.first < l2.first, etc. May be defined inline. END.>> <<(2) Compile the ParticularList module created in step 1.>> <<(3) Compile ListSort (this module).>> <<(4) Compile OnlineMergeSortImpl (the implementation of this module).>> <<(5) Clients of the package use the ListSort.bcd created in step 3, and the application binds in the OnlineMergeSortImpl.bcd created in step 4.>> < file name correspondence is not one-to-one, compiler command-line parameterization controls the different versions, as in:>> <<(3') xxxListSort _ ListSort[ParticularList: xxxParticularList]>> <<(4') xxxOnlineMergeSortImpl _ OnlineMergeSortImpl[ListSort: xxxListSort]>> <> <> <> <> <> <> <> <> <> <> <> <> <> <<>>