-- File: MagicERCControl.mesa
-- Written by Martin Newell April 1981
-- Last edited: April 15, 1981 3:16 PM

DIRECTORY


IODefs: FROM "IODefs" USING [
WriteString, WriteLine, GetOutputStream],
JaMFnsDefs: FROM "JaMFnsDefs" USING [Register, PopString, GetReal],
StaticDefs: FROM "StaticDefs" USING [RunStatic],
StreamDefs: FROM "StreamDefs" USING [StreamHandle,
NewByteStream, Read,
Write, Append],
StringDefs: FROM "StringDefs" USING [AppendString];

MagicERCControl: PROGRAM
IMPORTS IODefs, JaMFnsDefs, StaticDefs, StreamDefs, StringDefs =
BEGIN
OPEN IODefs, JaMFnsDefs, StaticDefs, StreamDefs, StringDefs;

--Initialization

CallStatic: PROCEDURE =
BEGIN --expects <filename,lowLimit,highLimit>
lowLimit,highLimit: REAL;
filename: STRING ← [40];
lineIn: STRING ← [40];
lineOut2: STRING ← [40];
in,out2: StreamHandle;

highLimit ← GetReal[];
lowLimit ← GetReal[];
PopString[filename];

AppendString[lineIn, filename];
AppendString[lineOut2, filename];
AppendString[lineIn, ".sim"];
in ← NewByteStream[lineIn, StreamDefs.Read];
AppendString[lineOut2, ".erclog"];
out2 ← NewByteStream[lineOut2,Write+Append];
RunStatic[in,GetOutputStream[],out2,lowLimit,highLimit];
in.destroy[in];
out2.destroy[out2];
WriteString["ERC errors on "];
WriteString[lineOut2];
WriteLine[" in ’show’ format"];
END;


--*** START Code ***

Register["static",
CallStatic];

END.