Syntax10.Scn.Fnt Syntax10i.Scn.Fnt StampElems Alloc 10 Mar 94 Syntax10b.Scn.Fnt MODULE Automatic; (* Michael Franz, 3.11.90; << SHML (* A simple macro facility for executing several commands at once. Each command has to be terminated with "~". Example: Automatic.Do System.Directory D*.Mod ~ System.DeleteFiles a.Bak b.Bak ~ Browser.ShowDef TextFrames ~ IMPORT Display, Texts, Viewers, Oberon; VAR W: Texts.Writer; PROCEDURE NextLine(text: Texts.Text; pos: LONGINT): LONGINT; VAR R: Texts.Reader; ch: CHAR; BEGIN IF pos < text.len THEN Texts.OpenReader(R, text, pos); Texts.Read(R, ch); WHILE ~R.eot & (ch # "~"(*<<0DX*)) DO Texts.Read(R, ch) END; IF R.eot THEN RETURN -1 ELSE RETURN Texts.Pos(R) END ELSE RETURN -1 END END NextLine; PROCEDURE Do*; VAR S: Texts.Scanner; text: Texts.Text; vwr: Viewers.Viewer; frame: Display.Frame; pos: LONGINT; par: Oberon.ParList; res: INTEGER; BEGIN Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(S); NEW(par); vwr := Oberon.Par.vwr; frame := Oberon.Par.frame; text := Oberon.Par.text; WHILE S.class = Texts.Name DO par.vwr := vwr; par.frame := frame; par.text := text; par.pos := Texts.Pos(S)-1; pos := NextLine(text, par.pos); Texts.WriteString(W, "Auto> "); Texts.WriteString(W, S.s); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf); Oberon.Call(S.s, par, FALSE, res); IF pos > 0 THEN Texts.OpenScanner(S, text, pos); Texts.Scan(S) ELSE S.class := Texts.Inval END END END Do; BEGIN Texts.OpenWriter(W) END Automatic.