CDSomeCoreGeneratorsImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, August 14, 1985 2:35:33 pm PDT
Last Edited by Christian Jacobi, September 1, 1985 2:36:35 pm PDT
DIRECTORY
CD,
CDCore,
CDExtras,
CDGenerate,
CDRemote,
CDGenerateImports,
Core,
CoreProperties,
Rope;
CDSomeCoreGeneratorsImpl:
CEDAR
MONITOR
IMPORTS CDCore, CDExtras, CDGenerate, CDRemote, CDGenerateImports, CoreProperties, Rope =
BEGIN
getTableFromCore: ATOM ← $CDTable;
getTableFromCD: ATOM ← $CDCoreTable;
directoryTable: CDGenerate.Table ← CDGenerate.AssertTable["DIRECTORY"];
GetTab:
PROC [coreDesign: Core.Design, cdDesign:
CD.Design]
RETURNS [table: CDGenerate.Table←
NIL] =
BEGIN
WITH CoreProperties.GetProp[coreDesign.properties, getTableFromCore]
SELECT
FROM
r: Rope.ROPE => RETURN [CDRemote.GetTable[r]];
t: CDGenerate.Table => RETURN [t];
d: CD.Design => RETURN [CDRemote.GetTable[d.name]];
ENDCASE => NULL;
--do we want to specify this in the ChipNDale design?
WITH CDProperties.GetPropFromDesign[cdDesign, getTableFromCD] SELECT FROM
t: CDGenerate.Table => RETURN [t];
d: CD.Design => RETURN [CDRemote.GetTable[d.name]];
r: Rope.ROPE => RETURN [CDRemote.GetTable[r]];
ENDCASE => NULL;
table ← directoryTable;
END;
CDGenerateGenerator: CDCore.CreateProc =
--first parameter is table; second parameter is entry
--default entry is name of coreCellType
--(there also is a default table)
BEGIN
table: CDGenerate.Table;
keyName: Rope.ROPE ← NIL;
IF param=NIL THEN table ← GetTab[coreDesign, cdDesign]
ELSE {
table ← CDGenerate.AssertTable[CDExtras.ToRope[param.first]];
param ← param.rest;
};
IF param#NIL THEN keyName ← CDExtras.ToRope[param.first];
IF ~Rope.IsEmpty[keyName] THEN keyName ← coreCellType.name;
ob ← CDGenerate.FetchNCall[table: table, design: cdDesign, key: keyName];
END;
CDGetGenerator: CDCore.CreateProc =
--parameter is entry
--default entry is name of coreCellType
--(uses default table)
BEGIN
table: CDGenerate.Table ← GetTab[coreDesign, cdDesign];
keyName: Rope.ROPE ← NIL;
IF param#NIL THEN keyName ← CDExtras.ToRope[param.first];
IF ~Rope.IsEmpty[keyName] THEN keyName ← coreCellType.name;
ob ← CDGenerate.FetchNCall[table: table, design: cdDesign, key: keyName];
END;
CDFetchGenerator: CDCore.CreateProc =
--first parameter is design name; second parameter is object name
BEGIN
table: CDGenerate.Table;
keyName: Rope.ROPE ← NIL;
IF param=NIL THEN table ← GetTab[coreDesign, cdDesign]
ELSE {
table ← CDRemote.GetTable[CDExtras.ToRope[param.first]];
param ← param.rest;
};
IF param#NIL THEN keyName ← CDExtras.ToRope[param.first];
IF ~Rope.IsEmpty[keyName] THEN keyName ← coreCellType.name;
ob ← CDGenerate.FetchNCall[table: table, design: cdDesign, key: keyName];
END;
CDImportGenerator: CDCore.CreateProc =
--first parameter is design name; second parameter is object name
--this procedure does not default into checking the ChipNDale design
BEGIN
table: CDGenerate.Table;
keyName: Rope.ROPE ← NIL;
IF param=
NIL
THEN {
WITH CoreProperties.GetProp[coreDesign.properties, getTableFromCore]
SELECT
FROM
r: Rope.ROPE => table ← CDGenerateImports.GetImportTable[r];
d: CD.Design => table ← CDGenerateImports.GetImportTable[d.name];
ENDCASE => ERROR CDCore.Problem[generatorParameterError, "no design to import from"];
}
ELSE {
table ← CDGenerateImports.GetImportTable[CDExtras.ToRope[param.first]];
param ← param.rest;
};
IF param#NIL THEN keyName ← CDExtras.ToRope[param.first];
IF ~Rope.IsEmpty[keyName] THEN keyName ← coreCellType.name;
ob ← CDGenerate.FetchNCall[table: table, design: cdDesign, key: keyName];
END;
CDCore.RegisterGenerator[CDGenerateGenerator, $CDGenerate];
CDCore.RegisterGenerator[CDGetGenerator, $CDGet];
CDCore.RegisterGenerator[CDFetchGenerator, $CDFetch];
CDCore.RegisterGenerator[CDImportGenerator, $CDImport];
END.