DIRECTORY Rope USING [Concat, Equal, Fetch, ROPE, Size, SkipTo, Substr], TEditInputOps USING [LoadAbbreviations, ReloadStyleName], NodeStyleOps USING [SetDefaultStyle, SetExtensionStyles], TEditProfile USING [CategoryOfUser, DefaultMenuChoice, SelectionCaret], UserProfile USING [Boolean, Line, ListOfTokens, Number, Token]; TEditProfileImpl: CEDAR PROGRAM IMPORTS Rope, UserProfile, TEditInputOps, NodeStyleOps EXPORTS TEditProfile = { ROPE: TYPE = Rope.ROPE; CategoryOfUser: TYPE = TEditProfile.CategoryOfUser; DefaultMenuChoice: TYPE = TEditProfile.DefaultMenuChoice; SelectionCaret: TYPE = TEditProfile.SelectionCaret; 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; -- without leading "." tryVersionMap: PUBLIC BOOL; ReadProfile: PUBLIC PROC = { wordPunctuation _ UserProfile.Boolean["Tioga.SelectDelimitingSpaces", FALSE]; editTypeScripts _ UserProfile.Boolean["Tioga.EditTypeScripts", TRUE]; openFirstLevelOnly _ UserProfile.Boolean["Tioga.OpenFirstLevelOnly", FALSE]; scrollTopOffset _ UserProfile.Number["Tioga.ScrollTopOffset", 2]; scrollBottomOffset _ UserProfile.Number["Tioga.ScrollBottomOffset", 2]; ySelectFudge _ UserProfile.Number["Tioga.YSelectFudge", 2]; showUnsavedDocumentsList _ UserProfile.Boolean["Tioga.ShowUnsavedDocumentsList", TRUE]; unsavedDocumentCacheSize _ UserProfile.Number["Tioga.UnsavedDocumentsCacheSize", 4]; SetUserCategory[UserProfile.Token["Tioga.UserCategory", "Advanced"]]; SetSelectionCaret[UserProfile.Token["Tioga.SelectionCaret", "balance"]]; ReadExtensions[]; ReadMenuDefaults[]; NodeStyleOps.SetDefaultStyle[UserProfile.Token["Tioga.DefaultStyle", "Cedar"]]; NodeStyleOps.SetExtensionStyles[UserProfile.ListOfTokens["Tioga.ExtensionStyles"]]; tryVersionMap _ UserProfile.Boolean["Tioga.TryVersionMap", TRUE]; }; ReadMenuDefaults: PROC = { num: INTEGER _ 1; DefaultMenu: PROC [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["Tioga.DefaultTiogaMenus", DefaultMenu, "places"]; }; ReadExtensions: PROC = { RemoveLeadingDot: PROC[ext: ROPE] RETURNS[ROPE] = { RETURN[IF ext.Size[]>0 AND ext.Fetch[0]='. THEN ext.Substr[start: 1] ELSE ext]; }; AddExt: PROC [ext: ROPE] = { ext _ RemoveLeadingDot[ext]; IF sourceExtensions=NIL THEN sourceExtensions _ LIST[ext] ELSE FOR lst: LIST OF ROPE _ sourceExtensions, lst.rest DO IF lst.rest = NIL THEN { lst.rest _ LIST[ext]; RETURN }; ENDLOOP; }; AddImplExt: PROC [ext: ROPE] = { ext _ RemoveLeadingDot[ext]; IF implExtensions=NIL THEN implExtensions _ LIST[ext] ELSE FOR lst: LIST OF ROPE _ implExtensions, lst.rest DO IF lst.rest = NIL THEN { lst.rest _ LIST[ext]; RETURN }; ENDLOOP; }; sourceExtensions _ implExtensions _ NIL; DoList["Tioga.SourceFileExtensions", AddExt, "mesa tioga df cm config style"]; DoList["Tioga.ImplFileExtensions", AddImplExt, "mesa"]; AddExt[""]; }; SetSelectionCaret: PROC [rope: ROPE] = { selectionCaret _ SELECT TRUE FROM Rope.Equal[rope,"before",FALSE] => before, Rope.Equal[rope,"after",FALSE] => after, ENDCASE => balance; }; SetUserCategory: PROC [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 = { DoList["Tioga.Styles", TEditInputOps.ReloadStyleName]; }; PreloadAbbreviations: PROC = { DoList["Tioga.Abbreviations", TEditInputOps.LoadAbbreviations]; }; GetToken: PUBLIC PROC [rope: ROPE, offset: INT _ 0, thruEnd: BOOL _ FALSE] RETURNS [token: ROPE, newOffset: INT] = { size: INT = Rope.Size[rope]; start: INT; Sep: PROC [c: CHAR] RETURNS [BOOL] = { RETURN[SELECT c FROM ' , ',, 11C, 15C, 0C => TRUE, ENDCASE => FALSE]; }; IF offset>=size THEN RETURN["", offset]; WHILE offsetKšœžœ&˜9Kšœ žœ'˜9Kšœ žœ5˜GKšœ žœ.˜?K˜——šœž ˜Kšžœ/˜6Kšžœ ˜Kšœ˜—˜Kšžœžœžœ˜Kšœžœ˜3Kšœžœ"˜9Kšœžœ˜3K˜Kšœžœ˜5Kšœžœžœ˜ Kšœžœžœ˜Kšœžœžœ˜Kšœžœžœ˜!Kšœžœžœ˜$Kšœžœžœ˜Kšœžœžœ˜&Kšœžœžœ˜*Kšœžœ˜&Kšœžœ˜$Kš œ"žœžœžœžœΟc˜MKšœžœžœ˜K˜—šΟn œžœžœ˜KšœFžœ˜MKšœ?žœ˜EKšœEžœ˜LKšœA˜AKšœG˜GKšœ;˜;KšœQžœ˜WKšœT˜TKšœE˜EKšœH˜HK˜K˜KšœO˜OKšœS˜SKšœ;žœ˜AKšœ˜K˜—š œžœ˜Kšœžœ˜š  œžœžœ˜"šœžœžœž˜+Kšœžœ ˜*Kšœžœ ˜*Kšžœ ˜—Kšžœ žœžœ˜šžœž˜Kšœ˜Kšœ˜Kšœ˜Kšžœžœ˜—Kšœ˜—Kšœ˜Kšœ9˜9Kšœ˜K˜—š œžœ˜š  œžœžœžœžœ˜3Kš žœžœžœžœžœ˜OK˜—š œžœžœ˜Kšœ˜Kšžœžœžœžœ˜9š žœžœžœžœžœž˜:Kš žœ žœžœžœžœ˜8Kšžœ˜—Kšœ˜—š  œžœžœ˜ Kšœ˜Kšžœžœžœžœ˜5š žœžœžœžœžœž˜8Kš žœ žœžœžœžœ˜8Kšžœ˜—Kšœ˜—Kšœ$žœ˜(KšœN˜NK˜7˜ K™I—Kšœ˜K˜—š œžœžœ˜(šœžœžœž˜!Kšœžœ ˜*Kšœžœ ˜(Kšžœ ˜—šœ˜K˜——š œžœžœ˜&šœžœžœž˜Kšœžœ ˜*Kšœžœ˜.Kšœžœ˜6Kšœžœ˜.Kšžœ˜—šœ˜K˜——š  œžœ˜K˜6Kšœ˜K˜—š œžœ˜K˜?Kšœ˜K˜—š œžœžœžœ žœžœžœžœ žœ žœ˜tKšœžœ˜Kšœžœ˜ K˜š  œžœžœžœžœ˜&šžœžœž˜Kšœžœ˜Kšžœžœ˜—Kšœ˜K˜—Kšžœžœžœ ˜(šžœ žœž˜6K˜Kšžœ˜—K˜šžœž˜Kšžœžœžœ˜+K˜Kšžœ˜—Kšžœžœ žœžœ˜QKšœ˜K˜—š œžœžœžœžœžœžœžœ˜NKšœžœ˜Kšœžœ˜Kšœžœ˜šžœ žœ˜Kšžœ!žœ"˜IKšœ*˜*K˜—šž˜Kšœžœ˜ K˜)Kšžœžœžœ˜!K˜ Kšžœ˜—Kšœ˜K˜—K˜K˜K˜K˜Kšœ˜K˜—…—Hr