DIRECTORY CDDirectory, Core, CoreCreate, CoreOps, FSAExtras, Rope, Sisyph; FSAExtrasImpl: CEDAR PROGRAM IMPORTS CDDirectory, CoreCreate, CoreOps, Rope, Sisyph EXPORTS FSAExtras = BEGIN OPEN FSAExtras; fsaExtension: ROPE _ ".fsa"; machineClass: Core.CellClass _ NEW [Core.CellClassRec _ [name: "MealyMachine", recast: RecastMealyMachine, layersProps: FALSE]]; stateClass: Core.CellClass _ NEW [Core.CellClassRec _ [name: "MealyState", layersProps: FALSE]]; transitionClass: Core.CellClass _ NEW [Core.CellClassRec _ [name: "MealyTransition", layersProps: FALSE]]; transitionCellType: Core.CellType _ CoreOps.CreateCellType [ class: transitionClass, public: CoreCreate.Wires["Target", "Expression", "Source"]]; MealyMachine: PUBLIC PROC [cx: Sisyph.Context, s: ROPE _ NIL] RETURNS [ct: CellType] = { fsaCell: CellType _ NIL; fsaName: ROPE _ NIL; IF s=NIL THEN { objectName: ROPE _ CDDirectory.Name[Sisyph.GetCDObj[cx]]; index: INT _ Rope.Find[s1: objectName, s2: ".icon"]; length: INT _ Rope.Length[objectName]; IF index<0 OR index#length-5 THEN ERROR; -- .icon not in string or not at end of string s _ Rope.Substr[objectName, 0, length-5]; }; fsaCell _ Sisyph.ExtractSchematicByName[Rope.Cat[s, fsaExtension], cx]; fsaName _ CoreOps.GetCellTypeName[fsaCell]; fsaName _ Rope.Substr[fsaName, 0, Rope.Index[fsaName, 0, fsaExtension]]; [] _ CoreOps.SetCellTypeName[fsaCell, fsaName]; ct _ CoreOps.CreateCellType [ class: machineClass, public: CoreCreate.Union[CoreOps.CopyWire[fsaCell.public], CoreCreate.Wires["Vdd", "Gnd", "Clock", "Reset"]], data: fsaCell, name: fsaName]; }; MealyState: PUBLIC PROC [o: NAT] RETURNS [ct: CellType] = { ct _ CoreOps.CreateCellType [ class: stateClass, public: CoreCreate.Wires["Target", "Source", CoreCreate.Seq["Output", o]]]; }; MealyTransition: PUBLIC PROC RETURNS [ct: CellType] = { ct _ transitionCellType; }; RecastMealyMachine: Core.RecastProc = { ERROR; }; END. „FSAExtrasImpl.mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Barth, November 19, 1986 6:30:03 pm PST Κ2˜codešœ™Kšœ Οmœ1™