CheckCell:
PROC [item:
REF
ANY]
RETURNS [stop:
BOOL] = {
cell: Cell ← NARROW[item];
IF cell.substantiality # (SELECT cell.expansion FROM Leaf => Real, Expand => Shadow, ENDCASE => ERROR) THEN ERROR;
IF (cell.substantiality=Real) # (cell.realCellStuff # NIL) THEN ERROR;
IF (cell.firstInternalNode#NIL) AND (cell.substantiality=Real) THEN ERROR;
IF (cell.leftChild#NIL) AND (cell.substantiality=Real) THEN ERROR;
FOR pi: PortIndex
IN [0 .. cell.type.ports.length)
DO
IF NOT Conforming[cell.interfaceNodes[pi].type, cell.type.ports[pi].type] THEN ERROR;
ENDLOOP;
cell.components.EnumerateIncreasing[CheckCell];
stop ← FALSE;
};
}.