LichenHacks.Mesa
Last tweaked by Mike Spreitzer on August 5, 1988 2:21:00 pm PDT
DIRECTORY AMBridge, Interpreter, InterpreterOps, InterpreterPrivate, LichenDataStructure, List, ProcessProps, Rope, SymTab;
LichenHacks:
CEDAR
PROGRAM
IMPORTS AMBridge, InterpreterOps, InterpreterPrivate, LichenDataStructure, List, ProcessProps, SymTab
=
BEGIN OPEN LichenDataStructure;
SymbolsList: TYPE ~ Interpreter.SymbolsList;
OpenDesign:
PROC [d: Design] ~ {
syms: SymbolsList ~ GetSyms[];
[] ← syms.first.Store[" design ", TVForRef[d]];
RETURN};
Names:
PROC [e:
REF
ANY]
RETURNS [Set] ~ {
d: Design ~ NARROW[GetVal[" design "]];
RETURN d.ENames[e]};
LookupCellType:
PROC [name:
REF
ANY]
RETURNS [CellType] ~ {
d: Design ~ NARROW[GetVal[" design "]];
RETURN [NARROW[Lookup[d, name, NIL]]]};
EasyLookup:
PROC [name:
REF
ANY, type:
REF
ANY ←
NIL]
RETURNS [
REF
ANY] ~ {
ct: CellType ~ NARROW[GetVal[" cell type "]];
RETURN Lookup[ct, name, type]};
ContextdLookup:
PROC [context, name:
REF
ANY, type:
REF
ANY ←
NIL]
RETURNS [
REF
ANY] ~ {
RETURN Lookup[context, name, type]};
ContextdLookupI:
PROC [context, name:
REF
ANY]
RETURNS [CellInstance] ~ {
RETURN [NARROW[Lookup[context, name, $i]]]};
ContextdLookupW:
PROC [context, name:
REF
ANY]
RETURNS [Wire] ~ {
RETURN [NARROW[Lookup[context, name, $w]]]};
ContextdLookupP:
PROC [context, name:
REF
ANY]
RETURNS [Port] ~ {
RETURN [NARROW[Lookup[context, name, $p]]]};
SetCellContext:
PROC [ct: CellType] ~ {
syms: SymbolsList ~ GetSyms[];
[] ← syms.first.Store[" cell type ", TVForRef[ct]];
RETURN};
GetSyms:
PROC
RETURNS [SymbolsList] ~ {
eh: InterpreterOps.EvalHead ~ NARROW[List.Assoc[$EvalHead, ProcessProps.GetPropList[]]];
RETURN [eh.specials]};
GetVal:
PROC [name:
ROPE]
RETURNS [
REF
ANY] ~
TRUSTED {
syms: SymbolsList ~ GetSyms[];
tv: AMBridge.TV ~ InterpreterOps.SearchSymbolsList[syms, name].val;
rr: REF REF ANY ~ NARROW[AMBridge.RefFromTV[tv]];
RETURN [rr^]};
TVForRef:
PROC [ref:
REF
ANY]
RETURNS [AMBridge.
TV] ~
TRUSTED {
RETURN AMBridge.TVForReferent[NEW [REF ANY ← ref], mutable]};
Start:
PROC ~ {
globs: SymbolsList ~ InterpreterPrivate.GetGlobalSymbolsList[];
Reg:
PROC [name:
ROPE, proc:
PROC
ANY
RETURNS
ANY, doc:
ROPE] ~
TRUSTED {
InterpreterOps.RegisterTV[name, AMBridge.TVForProc[proc], doc, globs];
RETURN};
Reg["&od", OpenDesign, "lichen open design"];
Reg["&ln", Names, "lichen names"];
Reg["&lut", LookupCellType, "lichen lookup cell type"];
Reg["&elu", EasyLookup, "lichen easy lookup"];
Reg["&clu", ContextdLookup, "lichen contextd lookup"];
Reg["&clui", ContextdLookupI, "lichen contextd lookup inst"];
Reg["&cluw", ContextdLookupW, "lichen contextd lookup inst"];
Reg["&clup", ContextdLookupP, "lichen contextd lookup inst"];
Reg["&sct", SetCellContext, "lichen set cell type context"];
RETURN};
Start[];
END.