<> <> <<>> DIRECTORY Atom USING [ MakeAtom ], Booting USING [ RegisterProcs, CheckpointProc ], Intervoice USING [ Handle, Open, Play ], Process USING [ Detach, MsecToTicks, Pause ], Rope USING [ ROPE ], UserProfile USING [ Token ] ; PlayNoiseImpl: CEDAR PROGRAM IMPORTS Atom, Booting, Intervoice, Process, UserProfile = { reallyBoot: BOOL_TRUE; didOurBest: BOOL; maxTime: CARDINAL _ 4000; PlayTheRollbackButton: Booting.CheckpointProc = TRUSTED { PlayAButton["Rollback"]; IF ~reallyBoot THEN rejection _ "Just pretending"; }; PlayAButton: PROC[name: Rope.ROPE] = TRUSTED { didOurBest _ FALSE; Process.Detach[FORK ReallyPlayAButton[name]]; FOR i: NAT IN [0..100) DO Process.Pause[Process.MsecToTicks[maxTime/100]]; IF didOurBest THEN EXIT; ENDLOOP; }; ReallyPlayAButton: PROC[name: Rope.ROPE] = { C: PROC[complaint: Rope.ROPE] = {NULL}; -- Don't bother complaining. handle: Intervoice.Handle = Intervoice.Open[Complain: C]; Intervoice.Play[handle: handle, refID: name, refIDType: "SysNoises", wait: TRUE]; didOurBest _ TRUE; }; IF Atom.MakeAtom[UserProfile.Token["Finch.NoisyBoot", "FALSE"]] = $TRUE THEN Booting.RegisterProcs[c: PlayTheRollbackButton, r: NIL, b: PlayTheRollbackButton]; }.