DIRECTORY ColorizeViewPoint, ColorizeViewPointBackdoor, IO, IPScan, Rope; ColorizeViewPointRoundEndsImpl: CEDAR PROGRAM IMPORTS ColorizeViewPoint, ColorizeViewPointBackdoor, IO, IPScan, Rope ~ BEGIN ROPE: TYPE ~ Rope.ROPE; ColorizeRoundEnds: ColorizeViewPointBackdoor.Colorization = { prefixes: LIST OF ROPE ~ ColorizeViewPointBackdoor.SubpaletteSearchList[prefixesIn: NIL, profile: palette]; tokens: LIST OF ROPE; levelsExceeded: BOOL; [tokens, levelsExceeded] _ ColorizeViewPointBackdoor.GetRecursiveValue[key: "RoundEnds", palette: palette, subpaletteList: prefixes, mapData: mapData]; SELECT TRUE FROM tokens=NIL => RETURN [ip]; --Don't colorize! levelsExceeded => { SIGNAL ColorizeViewPoint.Warning[class: $MalformedPaletteEntry, explanation: IO.PutFR[format: "RoundEnds color is part of a recursive color definition beyond allowable levels; ignoring it."]]; RETURN; }; ENDCASE => NULL; WITH ColorizeViewPointBackdoor.IPFragmentForColorSetting[def: tokens, palette: palette] SELECT FROM replacement: ROPE => { ScanForISET: IPScan.ScanProc = { IF ~punt AND max-min=searchLen AND ip.Substr[min, searchLen].Equal[search] THEN { newIP _ Rope.Cat[r1: newIP, r2: ip.Substr[flushedTo, min-flushedTo], r3: replacement]; flushedTo _ max; }; }; search: ROPE ~ "\017\242\017\260\223"; --2 16 ISET = round strokeEnd ISET searchLen: INT ~ search.Size; flushedTo: INT _ 0; newIP _ NIL; IPScan.ScanRope[ip: ip, ops: LIST[iset], action: ScanForISET]; newIP _ newIP.Concat[ip.Substr[flushedTo]]; }; ENDCASE => ERROR ColorizeViewPoint.Error[$MalformedPaletteEntry, "Round ends can only be colorized to constant colors"]; }; ColorizeViewPointBackdoor.InstallNewColorization[colorization: ColorizeRoundEnds, setting: [key: "ColorizeRoundEnds", description: "Lines with two round ends will be colorized according to the palette entry \"RoundEnds\". THIS FEATURE IS EXPERIMENTAL, and may conflict with the use of points.", default: TRUE]]; --but won't colorize if it finds no color defined ColorizeViewPointBackdoor.RegisterKeywords[keywordsList: LIST["RoundEnds"]]; --each Colorization reserves its colorizing keywords. END. ¶ ColorizeViewPointRoundEndsImpl.mesa Copyright Ó 1989 by Xerox Corporation. All rights reserved. Eric Nickell, May 18, 1989 11:40:21 am PDT Bob Coleman, August 30, 1990 5:02:59 pm PDT [ip: ROPE, palette: Profiles.Profile, checkSystemSetting: ColorizeViewPoint.CheckSystemSettingProc, mapData: MapData] RETURNS [newIP: ROPE] [min: INT, max: INT, op: IPMaster.Op _ nil, seq: IPScan.Seq _ nil, num: INTEGER _ 0, punt: BOOL _ FALSE] ÊÒ™™#Icode™œ˜kKšœœœœ˜Kšœœ˜Kšœ˜˜˜šœœ˜KšœœœœÏc˜-šœÏt˜KšœGœq˜ÀKš˜Kšœ˜—Kšœœ˜—–[def: LIST OF ROPE]šœTœ˜cšœ œ˜šŸ œ˜ Kš h™hšœœœ)œ˜QK–Z[r1: ROPE _ NIL, r2: ROPE _ NIL, r3: ROPE _ NIL, r4: ROPE _ NIL, r5: ROPE _ NIL]˜VK˜Kšœ˜—K˜—K–l -- [min: INT, max: INT, op: IPMaster.Op _ nil, seq: IPScan.Seq _ nil, num: INTEGER _ 0, punt: BOOL _ FALSE]š œœÏzœ¡Ðcs¡¤˜IKšœ œ˜Kšœ œ˜Kšœœ˜ Kšœœ˜>K˜+Kšœ˜—Kšœœh˜x—K˜—˜K˜—Kšœ±œ¡1˜êK˜Kšœ9œ¡7˜…K˜—Kšœ˜—…—L Ô