IndexProps.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Rick Beach, April 6, 1985 9:01:27 pm PST
=
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;
invariant: the phrases list always has an even number of ropes
each phrase is a pair of ropes: its contents and formatting
EntryToRope:
PROCEDURE [ix: IndexEntry]
RETURNS [rope:
ROPE];
convert an index entry into a rope for storing the property
RopeToEntry:
PROCEDURE [rope:
ROPE]
RETURNS [ix: IndexEntry];
parse a (presumed) index entry into the internal data structure representation
Compare:
PROC [ix1, ix2: IndexEntry]
RETURNS [result: Basics.Comparison, unmatched: Phrases];
compare two index entries, field by field,
but substituting sortAsPhrases for corresponding phrases
AddEntryToList:
PROCEDURE [ix: IndexEntry, ixList: IndexEntryList]
RETURNS [IndexEntryList];
eliminate duplicates and maintain list in sorted order
IndexEntryProc:
TYPE ~
PROC [ix: IndexEntry];
MapIndexEntryList:
PROCEDURE [ixList: IndexEntryList, action: IndexEntryProc];
for each index entry on the list, perform the map action
MalformedPropRope: ERROR;
KeywordExpectedButMissing: ERROR;
UnrecognizedKeyword: ERROR;
SuperfluousStuff: ERROR;
MalformedIndexPhrases: ERROR;