(* Copyright (C) 1989, Digital Equipment Corporation *) (* All rights reserved. *) (* See the file COPYRIGHT for a full description. *) (* File: Delay.m3 *) (* Last Modified On Tue Aug 1 14:37:33 1989 By kalsow *) MODULE Delay; IMPORT Scanner; CONST MAXDELAYS = 100; TYPE Job = RECORD closure : Closure; offset : INTEGER; END; VAR stack : ARRAY [0..MAXDELAYS] OF Job; top : INTEGER; PROCEDURE Push (c: Closure) = BEGIN pending := TRUE; stack[top].closure := c; stack[top].offset := Scanner.offset; INC (top); END Push; PROCEDURE FinishUp () = VAR save: INTEGER; BEGIN save := Scanner.offset; WHILE (top > 0) DO DEC (top); WITH z = stack[top] DO Scanner.offset := z.offset; z.closure.apply (); END; END; Scanner.offset := save; pending := FALSE; END FinishUp; PROCEDURE Initialize () = BEGIN pending := FALSE; top := 0; END Initialize; BEGIN END Delay.