<> <> <> DIRECTORY Basics, IntDefs, IO, IODefs, ParserErrorDefs, IntStorageDefs, IntTransDefs, IntUtilityDefs, OutputDefs; IntPhase2: CEDAR PROGRAM IMPORTS IO, IODefs, OutputDefs, ParserErrorDefs, IntTransDefs, IntStorageDefs EXPORTS IntDefs = BEGIN OPEN IntUtilityDefs, IntStorageDefs; Instantiate: PUBLIC PROCEDURE [] = BEGIN <> cs: IntTransDefs.ContextStack _ IntTransDefs.FreezeContext[]; objectCount: INT _ 0; pending: LIST OF Object _ LIST[rootSymbol.guts]; IntTransDefs.Push[]; WHILE pending # NIL DO WHILE pending.first # NIL DO WITH pending.first.first SELECT FROM call: Call => BEGIN SELECT TRUE FROM call.callee.defined AND ~call.callee.expanded => BEGIN IntTransDefs.Push[]; IntTransDefs.ApplyLocal[call.t]; pending.first _ CONS[call.callee, pending.first]; call.callee.expanded _ TRUE; pending _ CONS[call.callee.guts, pending]; LOOP; END; call.callee.expanded => ParserErrorDefs.Report[IO.PutFR["Cell %g calls itself, inner call ignored.", IO.int[call.callee.symNumber]], Advisory]; ~call.callee.defined => ParserErrorDefs.Report[IO.PutFR["Cell %g is undefined, call ignored.", IO.int[call.callee.symNumber]], Advisory]; ENDCASE => ERROR; END; symbol: STEntry => BEGIN symbol.expanded _ FALSE; -- returning from symbol call pending.first _ pending.first.rest; -- remove called symbol and call END; box: Box => OutputDefs.OutputBox[yes,box.layer,box.length,box.width, box.center,box.xRot,box.yRot]; box: MBox => OutputDefs.OutputBox[yes,box.layer, (box.bb.right-box.bb.left),(box.bb.top-box.bb.bottom), [(box.bb.left+box.bb.right)/2,(box.bb.bottom+box.bb.top)/2], 1,0]; flash: Flash => OutputDefs.OutputFlash[yes,flash.layer,flash.diameter,flash.center]; poly: Polygon => OutputDefs.OutputPolygon[yes,poly.layer,poly.p]; wire: Wire => OutputDefs.OutputWire[yes,wire.layer,wire.width,wire.p]; userOb: UserOb => OutputDefs.OutputUserObject[yes,userOb.layer,userOb.data]; userCmd: UserCmd => OutputDefs.OutputUserCommand[userCmd.command, NARROW[userCmd.data]]; ENDCASE => ERROR; pending.first _ pending.first.rest; objectCount _ objectCount+1; IF objectCount MOD 1000 = 0 THEN IODefs.PostIt[IO.PutFR["Objects generated to partition files: %g", IO.int[objectCount]]]; ENDLOOP; IntTransDefs.Pop[]; pending _ pending.rest; ENDLOOP; IntTransDefs.SwapContext[cs]; -- recover frozen context END; END.