<> <> <> <> <> <> GSort: DEFINITIONS = { GetProcType: TYPE = PROC [p: LONG POINTER] RETURNS [CARDINAL]; PutProcType: TYPE = PROC [p: LONG POINTER, len: CARDINAL]; CompareProcType: TYPE = PROC [p1: LONG POINTER, p2: LONG POINTER] RETURNS [INTEGER]; Sort: PROC [ get: GetProcType, put: PutProcType, compare: CompareProcType, expectedItemSize: CARDINAL _ 30, maxItemSize: CARDINAL _ 1000, pagesInHeap: CARDINAL _ 100]; RecordTooLong: ERROR; <> <> <<>> <> <> <> <> <> <<... other params as in call to Sort];>> <<... construct a sort record in buffer>> <> <<... keep doing that until there are no more data>> <> <<... at this point, the put proc gets called with the sorted records>> Port: TYPE = MACHINE DEPENDENT RECORD [in, out: UNSPECIFIED]; SortItemPort: TYPE = PORT [len: CARDINAL] RETURNS [p: LONG POINTER]; SortStarter: TYPE = PORT [ nextItem: POINTER TO SortItemPort, put: PutProcType, compare: CompareProcType, expectedItemSize: CARDINAL _ 30, maxItemSize: CARDINAL _ 1000, pagesInHeap: CARDINAL _ 100] RETURNS [p: LONG POINTER]; SortStopper: TYPE = PORT [len: CARDINAL _ 0]; }.