DIRECTORY Basics USING [Comparison], Rope USING [ROPE], Rosary USING [ROSARY]; IndexProps: CEDAR DEFINITIONS = BEGIN ROPE: TYPE ~ Rope.ROPE; IndexEntryList: TYPE ~ Rosary.ROSARY; -- immutable list of index entries IndexEntry: TYPE = REF IndexEntryRec; IndexEntryRec: TYPE = RECORD [ kindOfIndex: ATOM, -- for example: $Index, $AuthorIndex, $InterfaceIndex, $CommandIndex kindOfEntry: ATOM, -- for example: $Ordinary, $See, $SeeAlso, $Definition, $Example phrases: Phrases, seePhrases: Phrases _ NIL, sortAsPhrases: Phrases _ NIL ]; Phrases: TYPE = LIST OF ROPE; EntryToRope: PROCEDURE [ix: IndexEntry] RETURNS [rope: ROPE]; RopeToEntry: PROCEDURE [rope: ROPE] RETURNS [ix: IndexEntry]; Compare: PROC [ix1, ix2: IndexEntry] RETURNS [result: Basics.Comparison, unmatched: Phrases]; AddEntryToList: PROCEDURE [ix: IndexEntry, ixList: IndexEntryList] RETURNS [IndexEntryList]; IndexEntryProc: TYPE ~ PROC [ix: IndexEntry]; MapIndexEntryList: PROCEDURE [ixList: IndexEntryList, action: IndexEntryProc]; MalformedPropRope: ERROR; KeywordExpectedButMissing: ERROR; UnrecognizedKeyword: ERROR; SuperfluousStuff: ERROR; MalformedIndexPhrases: ERROR; END. ZIndexProps.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Rick Beach, April 6, 1985 9:01:27 pm PST invariant: the phrases list always has an even number of ropes each phrase is a pair of ropes: its contents and formatting convert an index entry into a rope for storing the property parse a (presumed) index entry into the internal data structure representation compare two index entries, field by field, but substituting sortAsPhrases for corresponding phrases eliminate duplicates and maintain list in sorted order for each index entry on the list, perform the map action Κ,˜code™Kšœ Οmœ1™™>K™;—K˜šΟn œž œžœžœ˜=K™;K˜—•StartOfExpansion[]š‘ œž œžœžœ˜=K™NK™—š‘œžœžœ1˜]K™cK™—–[]š‘œž œ*žœ˜\K™6K˜—–[]šœžœžœ˜-K™—–[]š‘œž œ2˜NK™8K˜—Kšœžœ˜Kšœžœ˜!Kšœžœ˜Kšœžœ˜Kšœžœ˜—K˜Kšžœ˜K˜K˜—…—Œ