--File SIFControl.mesa
--Device independent Output module for CIF 2.0 Parser
-- Written by Martin Newell, August 1980.
--Last updated: June 5, 1981 10:15 AM
DIRECTORY
CIFOutputDefs: FROM "CIFOutputDefs" USING [OutputSymbolName,
OutputNamedPoint],
IcarusInputDefs: FROM "IcarusInputDefs",
IntDefs: FROM "IntDefs" USING [IDefineStart, IDefineEnd, IComment, ILayer,
IBox, ICallSymbol, IEnd],
ParserErrorDefs: FROM "ParserErrorDefs" USING [Report],
ParserTypeDefs: FROM "ParserTypeDefs" USING [TList, AllocateTList, AppendTList, FreeTList],
SifGutsDefs: FROM "SifGutsDefs" USING [Point, IcToCif],
SifOutputDefs: FROM "SifOutputDefs";
SIFControl: PROGRAM
IMPORTS CIFOutputDefs, IntDefs, ParserErrorDefs, ParserTypeDefs, SifGutsDefs
EXPORTS IcarusInputDefs, SifOutputDefs =
BEGIN OPEN CIFOutputDefs, IntDefs, ParserErrorDefs, ParserTypeDefs, SifGutsDefs;
ParseIcarus: PUBLIC PROCEDURE [fileName: STRING, mul,div: LONG INTEGER, StartDefNumber: INTEGER] RETURNS [ok: BOOLEAN, nDefs: INTEGER] =
BEGIN
error: BOOLEAN;
[error,nDefs] ← IcToCif[fileName, mul, div, StartDefNumber];
RETURN[~error, nDefs];
END;
PutDefStart: PUBLIC PROCEDURE [num: INTEGER, xScale,yScale:LONG INTEGER, name: STRING] =
BEGIN
IDefineStart[num, xScale,yScale];
OutputSymbolName[name];
END;
PutDefFinish: PUBLIC PROCEDURE =
BEGIN
IDefineEnd[];
END;
PutComment: PUBLIC PROCEDURE[s: STRING] =
BEGIN
IComment[s];
END;
PutLayer: PUBLIC PROCEDURE[l: STRING] =
BEGIN
ILayer[l];
END;
PutBox: PUBLIC PROCEDURE [len,wid: LONG INTEGER, center: Point, angle: Point] =
BEGIN
IBox[len, wid, [center.x,center.y], angle.x, angle.y];
END;
PutCall: PUBLIC PROCEDURE [def: INTEGER, mirx,miry: BOOLEAN, rot:Point, trans:Point] =
BEGIN
list: ParserTypeDefs.TList ← AllocateTList[];
IF mirx THEN AppendTList[list, [Mirror[X]]];
IF miry THEN AppendTList[list, [Mirror[Y]]];
IF rot.x<0 OR rot.y#0 THEN AppendTList[list, [Rotate[rot.x,rot.y]]];
IF trans.x#0 OR trans.y#0 THEN AppendTList[list, [Translate[trans.x,trans.y]]];
ICallSymbol[def, list];
FreeTList[list];
END;
PutName: PUBLIC PROCEDURE [x,y: LONG INTEGER, s: STRING] =
BEGIN
OutputNamedPoint[s, x,y];
END;
PutEnd: PUBLIC PROCEDURE =
BEGIN
IEnd[];
END;
PutError: PUBLIC PROCEDURE[msg: STRING] =
BEGIN
Report[msg, Advisory];
END;
END.