DIRECTORY Core, CoreBlock, CoreInstCell, CoreOps, CoreClasses, CoreName, CoreProperties, IO, PWCore; CoreInstCellImpl: CEDAR PROGRAM IMPORTS CoreBlock, CoreClasses, CoreOps, CoreName, CoreProperties, IO, PWCore EXPORTS CoreInstCell = BEGIN specificGenericCellClass: PUBLIC Core.CellClass _ CoreOps.SetClassPrintProc[ class: NEW[ Core.CellClassRec _ [name: "SpecificGeneric", recast: Recast]], proc: ClassPrintProc]; ClassPrintProc: CoreOps.PrintClassProc = { cell: Core.CellType _ NARROW [data]; out.PutF["\nSpecificGeneric Instance of: %g", IO.rope[CoreName.CellNm[cell].n]]}; Recast: PUBLIC Core.RecastProc = { internal: Core.Wire _ CoreOps.CopyWire[me.public]; cell: Core.CellType _ NARROW [me.data]; -- ERROR -> Why recast an Identity? public: Core.Wire _ CoreOps.CreateWires[cell.public.size]; actual: Core.Wire _ CoreOps.CreateWires[cell.public.size]; IF cell.public.size#internal.size THEN Signal[]; FOR index: INT IN [0..internal.size) DO actual[index] _ internal[index] ENDLOOP; FOR index: INT IN [0..internal.size) DO public[index] _ internal[index] ENDLOOP; new _ CoreClasses.CreateRecordCell[ public: public, internal: internal, instances: LIST [CoreClasses.CreateInstance[actual: actual, type: cell]]]; CoreBlock.PutCellSide [new, all]; CoreBlock.MergeSides [new]; PWCore.SetAbutX [new]}; SpecificGeneric: PUBLIC PROC[generic: Core.CellType, proc: CoreInstCell.RenameProc] RETURNS [specific: Core.CellType] = { ctx: CoreName.Context _ CoreName.NewContext[]; internal: Core.Wire _ CoreOps.CreateWires[generic.public.size]; FOR index: INT IN [0..internal.size) DO aName: Core.ROPE _ CoreName.WireNm[generic.public[index] ].n; aName _ proc[aName]; internal[index] _ IF aName#NIL THEN CoreName.CtxWire [ctx, aName] ELSE CoreOps.CreateWires[0]; ENDLOOP; IF generic.class # CoreClasses.recordCellClass AND generic.class # CoreClasses.identityCellClass THEN Signal[]; specific _ NEW[Core.CellTypeRec _ [ class: specificGenericCellClass, public: internal, data: generic, properties: NIL ]]; ctx _ CoreName.KillContext[ctx]}; Signal: SIGNAL = CODE; CoreProperties.PutCellClassProp[specificGenericCellClass, PWCore.layoutAtomProp, $Recast]; END. øCoreInstCellImpl.mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Created by Don Curry, February 1, 1986 2:43:22 pm PST Edited by Don Curry, May 14, 1986 12:49:57 pm PDT ELSE CoreOps.CreateWire[name: CoreName.ID["DeadEnd"]]; Ên˜šœ™Jšœ<™