DIRECTORY Atom USING [GetProp, RemProp], Booting USING [RegisterProcs, RollbackProc], FS USING [OpenFile, Open, FileInfo, Error], InputFocus USING [EnableInput], MessageWindow USING [Append], Process USING [Detach], Rope USING [Cat, Fetch, ROPE, Size, Substr, Find], RuntimeError USING [UNCAUGHT], Loader USING [Instantiate, Start], UserProfile USING [Boolean, Line], ViewerClasses USING [Viewer], ViewerOps USING [CreateViewer]; End: CEDAR PROGRAM IMPORTS Atom, Booting, FS, InputFocus, Loader, MessageWindow, Process, Rope, RuntimeError, UserProfile, ViewerOps SHARES InputFocus = BEGIN makeCheck: BOOL _ UserProfile.Boolean["AutoCheckpoint", FALSE]; checkButton: BOOL _ UserProfile.Boolean["ClientCheckpoint", TRUE]; CheckForFile: PROC [file: Rope.ROPE] RETURNS [found: BOOL _ TRUE] = TRUSTED BEGIN [] _ FS.FileInfo[name: file ! FS.Error => {found _ FALSE; CONTINUE}]; 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; Preload: PROC = BEGIN files: Rope.ROPE _ UserProfile.Line["PreLoad"]; file: Rope.ROPE; offset: LONG INTEGER _ 0; DO [file, offset] _ GetToken[files, offset]; IF Rope.Size[file]=0 THEN EXIT; IF CheckForFile[file] THEN [] _ ViewerOps.CreateViewer[$Text, [name: file, file: file]]; ENDLOOP; END; PreRun: PROC = { Run["PreRun"] } ; PostRun: Booting.RollbackProc = TRUSTED { Process.Detach[FORK Run["PostRun"]] }; Run: PROC [key: Rope.ROPE] = BEGIN TryToRun: PROC[file: Rope.ROPE] = TRUSTED { fcap: FS.OpenFile _ FS.Open[file ! FS.Error => GOTO NotFound]; Loader.Start[Loader.Instantiate[fcap ! RuntimeError.UNCAUGHT => CONTINUE].cm ! RuntimeError.UNCAUGHT => CONTINUE]; RETURN; EXITS NotFound => NULL; }; files: Rope.ROPE _ UserProfile.Line[key]; file: Rope.ROPE; offset: LONG INTEGER _ 0; DO [file, offset] _ GetToken[files, offset]; IF Rope.Size[file]=0 THEN EXIT; IF Rope.Find[file, "."] = -1 THEN file _ Rope.Cat[file,".bcd"]; TryToRun[file]; ENDLOOP; END; ProcessRegistry: PROC = BEGIN registerList: LIST OF REF PROC _ NARROW[Atom.GetProp[$EndOps, $Registry]]; FOR l: LIST OF REF PROC _ NARROW[Atom.GetProp[$EndOps, $Registry]], l.rest UNTIL l=NIL DO l.first^[! ANY => CONTINUE]; ENDLOOP; Atom.RemProp[$EndOps, $Registry]; -- flush registry now that we're done with it END; Booting.RegisterProcs[r: PostRun]; PreRun[]; Preload[]; ProcessRegistry[]; InputFocus.EnableInput[]; -- start up the input machinery MessageWindow.Append["Ready."]; END. &End.mesa; written by S. McGregor edited by McGregor, March 2, 1983 8:21 am edited by Maxwell, January 31, 1983 12:19 pm edited by Paul Rovner, June 16, 1983 9:07 am edited by Doug Wyatt, December 8, 1983 5:14 pm see EndOps.mesa for adding something to the registry IF makeCheck OR checkButton THEN [] _ Buttons.Create[info: [name: "RollBack"], proc: ViewersSnapshot.MRollBack, fork: TRUE, guarded: TRUE, documentation: "Restore state to previous checkpoint"]; IF checkButton THEN [] _ Buttons.Create[info: [name: "Checkpoint"], proc: ViewersSnapshot.MCheckpoint, fork: TRUE, guarded: TRUE, documentation: "Make a new checkpoint"]; TRUSTED {TerminalMultiplex.PermitSwaps[]}; permit use of the second logical terminal IF makeCheck THEN [] _ ViewersSnapshot.Checkpoint[] ELSE Runtime.SelfDestruct[]; Κ6– "Mesa" style˜JšΟc!™!Jšœ™)Jšœ&™,Jšœ&™,Jšœ(™.J˜šΟk ˜ Jšœžœ˜Jšœžœ˜,Jšžœžœ#˜+Jšœ žœ˜Jšœžœ ˜Jšœžœ ˜Jšœžœžœ˜2Jšœ žœžœ˜Jšœžœ˜"Jšœ žœ˜"Jšœžœ ˜Jšœ žœ˜J˜—Jšœžœž˜J˜JšžœžœX˜qJšžœ ˜J˜Jšž˜J˜Jšœ žœ)žœ˜?Jšœ žœ+žœ˜BJ˜š Οn œžœ žœžœ ž œžœž˜QJšœ3žœžœ˜EJšžœ˜J˜—šŸœžœžœ žœ žœžœžœ˜Ošžœžœ žœž˜2Jšœžœ˜Jšœžœ˜ J˜š Ÿœžœž œžœžœžœž˜6šžœžœž˜Jšœžœ˜Jšžœžœ˜—Jšžœ˜J˜—Jšžœžœžœ ˜(šžœ žœž˜6J˜Jšžœ˜—J˜šžœžœžœžœ˜Jšžœžœžœ˜+J˜Jšžœ˜—šžœžœ žœ˜4Jšžœ˜—Jšžœ˜J˜——šŸœžœž˜Jšœ žœ˜/Jšœ žœ˜Jšœžœžœ˜šž˜J˜)Jšžœžœžœ˜Jšžœžœ>˜XJšžœ˜—Jšžœ˜J˜—JšŸœžœ˜"J˜JšŸœžœžœ˜PJ˜šŸœžœ žœž˜"šŸœžœ žœžœ˜+Jš œžœ žœ žœ žœ ˜>šœ3ž œžœ˜LJšœž œžœ˜%—Jšžœ˜Jšžœ žœ˜J˜—Jšœ žœ˜)Jšœ žœ˜Jšœžœžœ˜šž˜J˜)Jšžœžœžœ˜Jšžœžœ˜?Jšœ˜Jšžœ˜—Jšžœ˜J˜—šŸœžœž˜Jš4™4Jš œžœžœžœžœžœ#˜Jšžœžœžœžœžœžœ+žœžœž˜YJšœ žœžœ˜Jšžœ˜—Jšœ"-˜OJšžœ˜—J˜šœ ™ šœZ™ZJšœF™F——šœ™šœ^™^Jšœ7™7——J˜Jšœ"˜"J˜J˜ J˜ J˜J˜JšœU™UJšœ˜9J˜Jšœ8™8Jšœ˜J˜Jšœ™J˜Jšžœ˜J˜J˜J˜—…— ’ώ