PlayNoiseImpl.mesa
Last Edited by: Swinehart, January 30, 1986 4:04:41 pm PST
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: BOOLTRUE;
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];
}.