<> <> <> DIRECTORY TextFind, TiogaLooks, TiogaNode, LooksReader, Rope, RopeReader, RunReader; TextFindPrivate: CEDAR DEFINITIONS = BEGIN OPEN TextFind; <<***** Declarations *****>> EightBit: CHAR = 200C; CharMask: CHAR = 177C; LegalCharacters: TYPE = CHAR[0C .. 177C]; anyStringPattern: CHAR = EightBit; oneCharPattern: CHAR = EightBit + 1; oneBlankPattern: CHAR = EightBit + 2; oneNonBlankPattern: CHAR = EightBit + 3; anyBlankPattern: CHAR = EightBit + 4; anyNonBlankPattern: CHAR = EightBit + 5; oneAlphaPattern: CHAR = EightBit + 6; oneNonAlphaPattern: CHAR = EightBit + 7; anyAlphaPattern: CHAR = EightBit + 8; anyNonAlphaPattern: CHAR = EightBit + 9; leftBracketPattern: CHAR = EightBit + 10; rightBracketPattern: CHAR = EightBit + 11; leftBoundaryPattern: CHAR = EightBit + 12; rightBoundaryPattern: CHAR = EightBit + 13; maxStringPattern: CHAR = EightBit + 14; maxBlankPattern: CHAR = EightBit + 15; maxNonBlankPattern: CHAR = EightBit + 16; maxAlphaPattern: CHAR = EightBit + 17; maxNonAlphaPattern: CHAR = EightBit + 18; nopPattern: CHAR = EightBit+19; MaxPatternLength: NAT = 1024; TextStackArray: TYPE = RECORD[stack: SEQUENCE length: NAT OF Offset]; PatternStackArray: TYPE = RECORD[stack: SEQUENCE length: NAT OF NAT]; LooksArray: TYPE = RECORD[looks: SEQUENCE length: NAT OF TiogaLooks.Looks]; NameArray: TYPE = RECORD [array: SEQUENCE length: NAT OF NameRec]; NameRec: TYPE = RECORD [name: ROPE, at, atEnd: Offset, looks: TiogaLooks.Looks]; PatternArray: TYPE = RECORD [pat: SEQUENCE length: NAT OF PatRec]; PatRec: TYPE = RECORD [SELECT tag:* FROM pattern => [char: CHAR], not => [char: CHAR], startname => [index: NAT], endname => [index: NAT], ENDCASE]; anyStringPat: pattern PatRec = [pattern[anyStringPattern]]; anyAlphaPat: pattern PatRec = [pattern[anyAlphaPattern]]; anyNonAlphaPat: pattern PatRec = [pattern[anyNonAlphaPattern]]; anyBlankPat: pattern PatRec = [pattern[anyBlankPattern]]; anyNonBlankPat: pattern PatRec = [pattern[anyNonBlankPattern]]; leftBoundaryPat: pattern PatRec = [pattern[leftBoundaryPattern]]; rightBoundaryPat: pattern PatRec = [pattern[rightBoundaryPattern]]; nonPat: pattern PatRec = [pattern[0C]]; IsWord: PROC [rope: ROPE, at, atEnd: TiogaNode.Offset] RETURNS [BOOLEAN]; Boundary: PROC [char: CHAR] RETURNS [BOOLEAN] = INLINE { RETURN [char = leftBoundaryPattern OR char = rightBoundaryPattern] }; Pat: PROC [p:PatRec] RETURNS [pp: pattern PatRec] = INLINE { WITH p:p SELECT FROM pattern => pp _ p; ENDCASE => pp _ nonPat; }; Finder: TYPE = REF FinderRec; FinderRecord: TYPE = RECORD [ stackSize: NAT _ 0, patternPosStack: REF PatternStackArray, textPosStack: REF TextStackArray, textLenStack: REF TextStackArray, patternArray: REF PatternArray, length: NAT _ 0, patternLooks: REF LooksArray, nameArray: REF NameArray, firstPatChar1, firstPatChar2, lastPatChar1, lastPatChar2: CHAR _ 377C, ropeReader: RopeReader.Ref, lksReader: LooksReader.Ref, runReader: RunReader.Ref, looks: TiogaLooks.Looks, looksOnly: BOOLEAN _ FALSE, wordSearch: BOOLEAN _ FALSE, leftBracketSeen, rightBracketSeen: BOOLEAN _ FALSE, firstPatternCharIsNormal, lastPatternCharIsNormal: BOOLEAN _ FALSE ]; END.