ArbiterSchematicImpl.mesa
Copyright c 1986 by Xerox Corporation. All rights reserved.
McCreight May 13, 1987 3:37:08 pm PDT
DIRECTORY Arbiter, Atom, CD, CedarProcess, Commander, CommandTool, Core, CoreCreate, CoreIO, IO, FS, PW, Rope, Sisyph, TerminalIO;
ArbiterSchematicImpl: CEDAR MONITOR
IMPORTS Atom, CedarProcess, Commander, CommandTool, CoreIO, IO, FS, PW, Rope, Sisyph, TerminalIO
EXPORTS Arbiter
= BEGIN OPEN Arbiter;
sctProp: ATOM = $SchematicCT;
SchematicCT: PUBLIC PROC [ cellName, designName: CoreCreate.ROPE ] RETURNS [ ct: CoreCreate.CellType ] = {
atom: ATOM = Atom.MakeAtom[cellName];
ref: REF ANY ← Atom.GetProp[atom, sctProp];
ct ← NIL;
IF ref = NIL THEN {
MakeCellType: ENTRY PROC = {
ENABLE UNWIND => NULL;
act: CoreCreate.CellType ← NIL;
act ← CoreIO.RestoreCellType[cellName ! FS.Error => { act ← NIL; CONTINUE } ];
IF act = NIL THEN {
design: CD.Design ← PW.OpenDesign[designName];
cx: Sisyph.Context ← Sisyph.Create[design];
badProps: LIST OF ATOMNIL;
badClasses: LIST OF Core.CellClass ← NIL;
act ← Sisyph.ExtractSchematicByName[name: Rope.Cat[cellName, ".sch"], cx: cx];
[props: badProps, classes: badClasses] ← CoreIO.ReportSaveCellType[act, Rope.Cat[cellName, ".core"]];
IF badProps # NIL THEN TerminalIO.PutF["\nWarning: Couldn't write the following Core properties in the saved core file: \n%g\n", IO.refAny[badProps]];
IF badClasses # NIL THEN TerminalIO.PutF["\nWarning: Couldn't write the following Core classes in the saved core file: \n%g\n", IO.refAny[badClasses]];
};
ref ← act;
Atom.PutProp[atom, sctProp, ref];
};
CedarProcess.DoWithPriority[background, MakeCellType];
};
ct ← NARROW[ref];
};
ResetSchematicCT: PUBLIC PROC [ cellName: CoreCreate.ROPE ] = {
Atom.PutProp[Atom.MakeAtom[cellName], sctProp, NIL];
DO
FS.Delete[Rope.Cat[cellName, ".core!L"] ! FS.Error => GOTO NoMoreVersions ];
REPEAT
NoMoreVersions => NULL;
ENDLOOP;
};
ResetSchematic: PROC [cmd: Commander.Handle] RETURNS [result: REFNIL, msg: Rope.ROPENIL] -- Commander.CommandProc -- = {
argv: CommandTool.ArgumentVector = CommandTool.Parse[cmd];
IF argv.argc >= 1 THEN ResetSchematicCT[argv[1]];
};
ExtractSchematic: PROC [cmd: Commander.Handle] RETURNS [result: REFNIL, msg: Rope.ROPENIL] -- Commander.CommandProc -- = {
argv: CommandTool.ArgumentVector = CommandTool.Parse[cmd];
IF argv.argc >= 2 THEN [] ← SchematicCT[argv[1], argv[2]];
};
Commander.Register["ResetSchematic", ResetSchematic, "Destroys the current Core cell type for the named cell."];
Commander.Register["ExtractSchematic", ExtractSchematic, "Finds or builds a Core cell type for the named cell in the named design file."];
END.