DIRECTORY Rope USING [Concat, Equal, Fetch, ROPE, Size, Substr], TEditInputOps USING [LoadAbbreviations, ReloadStyleName], NodeStyleExtra USING [SetDefaultStyle, SetExtensionStyles], TEditProfile, UserProfile USING [Boolean, Line, ListOfTokens, Number, Token]; TEditProfileImpl: CEDAR PROGRAM IMPORTS Rope, UserProfile, TEditInputOps, NodeStyleExtra EXPORTS TEditProfile = BEGIN OPEN UserProfile, TEditProfile; menu1, menu2, menu3: PUBLIC DefaultMenuChoice _ none; openFirstLevelOnly: PUBLIC BOOL; wordPunctuation: PUBLIC BOOL; editTypeScripts: PUBLIC BOOL; scrollTopOffset: PUBLIC INTEGER ; scrollBottomOffset: PUBLIC INTEGER ; ySelectFudge: PUBLIC INTEGER ; showUnsavedDocumentsList: PUBLIC BOOL; unsavedDocumentCacheSize: PUBLIC INTEGER ; selectionCaret: PUBLIC SelectionCaret; userCategory: PUBLIC CategoryOfUser; sourceExtensions, implExtensions: PUBLIC LIST OF Rope.ROPE; -- the extensions all start with "." ReadProfile: PUBLIC PROC = BEGIN wordPunctuation _ Boolean["SelectDelimitingSpaces", FALSE]; editTypeScripts _ Boolean["EditTypeScripts", TRUE]; openFirstLevelOnly _ Boolean["OpenFirstLevelOnly", FALSE]; scrollTopOffset _ Number["ScrollTopOffset", 2]; scrollBottomOffset _ Number["ScrollBottomOffset", 2]; ySelectFudge _ Number["YSelectFudge", 2]; showUnsavedDocumentsList _ Boolean["ShowUnsavedDocumentsList", TRUE]; unsavedDocumentCacheSize _ Number["UnsavedDocumentsCacheSize", 4]; SetUserCategory[Token["UserCategory", "Intermediate"]]; SetSelectionCaret[Token["SelectionCaret", "balance"]]; ReadExtensions[]; ReadMenuDefaults[]; NodeStyleExtra.SetDefaultStyle[Token["DefaultStyle", "Cedar"]]; NodeStyleExtra.SetExtensionStyles[ListOfTokens["ExtensionStyles"]]; END; ReadMenuDefaults: PROC = BEGIN num: INTEGER _ 1; DefaultMenu: PROC [rope: Rope.ROPE] = { which: DefaultMenuChoice _ SELECT TRUE FROM Rope.Equal[rope,"Places",FALSE] => places, Rope.Equal[rope,"Levels",FALSE] => levels, ENDCASE => none; IF which=none THEN RETURN; SELECT num FROM 1 => menu1 _ which; 2 => menu2 _ which; 3 => menu3 _ which; ENDCASE => RETURN; num _ num+1 }; menu1 _ menu2 _ menu3 _ none; DoList["DefaultTiogaMenus", DefaultMenu, "places"]; END; ReadExtensions: PROC = BEGIN AddExt: PROC [ext: Rope.ROPE] = { IF Rope.Fetch[ext, 0] # '. THEN ext _ Rope.Concat[".", ext]; IF sourceExtensions=NIL THEN sourceExtensions _ LIST[ext] ELSE FOR lst: LIST OF Rope.ROPE _ sourceExtensions, lst.rest DO IF lst.rest = NIL THEN { lst.rest _ LIST[ext]; RETURN }; ENDLOOP }; AddImplExt: PROC [ext: Rope.ROPE] = { IF Rope.Fetch[ext, 0] # '. THEN ext _ Rope.Concat[".", ext]; IF implExtensions=NIL THEN implExtensions _ LIST[ext] ELSE FOR lst: LIST OF Rope.ROPE _ implExtensions, lst.rest DO IF lst.rest = NIL THEN { lst.rest _ LIST[ext]; RETURN }; ENDLOOP }; sourceExtensions _ implExtensions _ NIL; DoList["SourceFileExtensions", AddExt, "mesa tioga df cm config style"]; DoList["ImplFileExtensions", AddImplExt, "mesa"]; sourceExtensions _ CONS[".", sourceExtensions]; END; SetSelectionCaret: PROC [rope: Rope.ROPE] = { selectionCaret _ SELECT TRUE FROM Rope.Equal[rope,"before",FALSE] => before, Rope.Equal[rope,"after",FALSE] => after, ENDCASE => balance }; SetUserCategory: PROC [rope: Rope.ROPE] = { userCategory _ SELECT TRUE FROM Rope.Equal[rope,"Expert",FALSE] => expert, Rope.Equal[rope,"Advanced",FALSE] => advanced, Rope.Equal[rope,"Intermediate",FALSE] => intermediate, Rope.Equal[rope,"Beginner",FALSE] => beginner, ENDCASE => intermediate }; PreloadStyles: PROC = BEGIN DoList["Styles", TEditInputOps.ReloadStyleName]; END; PreloadAbbreviations: PROC = BEGIN DoList["Abbreviations", TEditInputOps.LoadAbbreviations]; END; GetToken: PUBLIC PROC [rope: Rope.ROPE, offset: INT _ 0, thruEnd: BOOL _ FALSE] RETURNS [token: Rope.ROPE, newOffset: INT] = BEGIN size: INT = Rope.Size[rope]; start: INT; Sep: PROC [c: CHARACTER] RETURNS [BOOL] = INLINE BEGIN RETURN[SELECT c FROM ' , ',, 11C, 15C, 0C => TRUE, ENDCASE => FALSE]; END; IF offset>=size THEN RETURN["", offset]; WHILE offset=size THEN EXIT; IF Sep[Rope.Fetch[rope, offset]] THEN EXIT; offset _ offset+1; ENDLOOP; RETURN[Rope.Substr[rope, start, IF thruEnd THEN size ELSE offset-start], offset]; END; DoList: PUBLIC PROC [key: Rope.ROPE, proc: PROC [Rope.ROPE], defaultKey: Rope.ROPE _ NIL] = BEGIN names: Rope.ROPE _ Line[key, defaultKey]; name: Rope.ROPE; offset: INT _ 0; DO [name, offset] _ GetToken[names, offset]; IF Rope.Size[name]=0 THEN EXIT; proc[name]; ENDLOOP; END; ReadProfile[]; PreloadStyles[]; PreloadAbbreviations[]; END. È-- TEditProfileImpl.mesa; Edited by Paxton on January 11, 1983 10:15 am Edited by McGregor on October 27, 1982 4:42 pm Always add the null extension since "Foo" is a different file than "Foo." ÊO˜JšÏcG™GJš.™.J˜šÏk ˜ Jšœžœžœ˜6Jšœžœ&˜9Jšœžœ'˜;J˜ Jšœ žœ.˜?J˜—Jšœž ˜J˜Jšžœ1˜8Jšžœ˜J˜Jšžœžœ˜%J˜Jšœžœ˜5Jšœžœžœ˜ Jšœžœžœ˜Jšœžœžœ˜Jšœžœžœ˜!Jšœžœžœ˜$Jšœžœžœ˜Jšœžœžœ˜&Jšœžœžœ˜*Jšœžœ˜&Jšœžœ˜$Jš œ"žœžœžœžœ$˜`J˜šÏn œžœžœž˜ Jšœ4žœ˜;Jšœ-žœ˜3Jšœ3žœ˜:J˜/J˜5Jšœ)˜)Jšœ?žœ˜EJšœB˜BJšœ7˜7Jšœ6˜6J˜J˜J˜?J˜CJšžœ˜J˜—šŸœžœž˜Jšœžœ˜šŸ œžœ žœ˜'šœžœžœž˜+Jšœžœ ˜*Jšœžœ ˜*Jšžœ ˜—Jšžœ žœžœ˜šžœž˜Jšœ˜Jšœ˜Jšœ˜Jšžœžœ˜—Jšœ˜—Jšœ˜Jšœ3˜3Jšžœ˜J˜—šŸœžœž˜šŸœžœ žœ˜!Jšžœžœ˜=Jšžœžœžœžœ˜9š žœžœžœžœžœž˜?Jš žœ žœžœžœžœ˜8Jšžœ˜ ——šŸ œžœ žœ˜%Jšžœžœ˜=Jšžœžœžœžœ˜5š žœžœžœžœžœž˜=Jš žœ žœžœžœžœ˜8Jšžœ˜ ——Jšœ$žœ˜(JšœH˜HJ˜1šœžœ˜/J™I—Jšžœ˜J˜—šŸœžœ žœ˜-šœžœžœž˜!Jšœžœ ˜*Jšœžœ ˜(Jšžœ˜J˜——šŸœžœ žœ˜+šœžœžœž˜Jšœžœ ˜*Jšœžœ˜.Jšœžœ˜6Jšœžœ˜.Jšžœ˜J˜——šŸ œžœž˜J˜0Jšžœ˜J˜—šŸœžœž˜"J˜9Jšžœ˜J˜—šŸœžœžœ žœ žœžœžœ˜Ošžœžœ žœž˜2Jšœžœ˜Jšœžœ˜ J˜š Ÿœžœž œžœžœžœž˜6šžœžœž˜Jšœžœ˜Jšžœžœ˜—Jšžœ˜J˜—Jšžœžœžœ ˜(šžœ žœž˜6J˜Jšžœ˜—J˜šžœžœžœžœ˜Jšžœžœžœ˜+J˜Jšžœ˜—šžœžœ žœ˜4Jšžœ˜—Jšžœ˜J˜——šŸœžœžœ žœžœžœžœžœž˜aJšœ žœ˜)Jšœ žœ˜Jšœžœ˜šž˜J˜)Jšžœžœžœ˜J˜ Jšžœ˜—Jšžœ˜J˜—J˜J˜J˜J˜Jšžœ˜J˜—…—