<> <> <> <> <> DIRECTORY CD, CDCommandOps, CDProperties, CDSequencer, SX, SXAccess, SXAtoms, SXAccessInternal, TerminalIO; SXAccessImpl: CEDAR PROGRAM IMPORTS CDCommandOps, CDProperties, SXAtoms, SXAccessInternal, TerminalIO EXPORTS SXAccess = BEGIN <<--variables only valid inside an analysis invocation>> design: PUBLIC CD.Design _ NIL; formatKey: PUBLIC REF _ NIL; invocation: PUBLIC REF _ NIL; stopFlag: PUBLIC REF BOOL _ NIL; sxTech: PUBLIC REF SX.TechHandle _ NIL; CallingRec: TYPE = RECORD [ design: CD.Design, hierarchyRoots: CD.InstanceList, formatKey: REF, stopFlag: REF BOOL ]; Analyze: PUBLIC PROC [design: CD.Design, hierarchyRoots: CD.InstanceList, formatKey: REF, stopFlag: REF BOOL_NIL] RETURNS [skipped: BOOL_FALSE] = <<--if stopFlag^ gets true, analysis might be aborted>> BEGIN ik: REF CallingRec; comm: CDSequencer.Command; IF stopFlag=NIL THEN stopFlag _ NEW[BOOL_FALSE]; ik _ NEW[CallingRec_[ design: design, hierarchyRoots: hierarchyRoots, formatKey: formatKey, stopFlag: stopFlag ]]; comm _ NEW[CDSequencer.CommandRec _[ a: $SX, design: design, ref: ik ]]; skipped _ CDCommandOps.CallWithResource[PseudoCommand, comm, $SX, stopFlag]; IF skipped THEN TerminalIO.WriteRope["**analyze skipped\n"] END; PseudoCommand: PROC [comm: CDSequencer.Command] = BEGIN GetSXTech: PROC [technology: CD.Technology] RETURNS [th: REF SX.TechHandle] = BEGIN WITH CDProperties.GetProp[technology, SXAtoms.spinifex] SELECT FROM x: REF SX.TechHandle => th _ x; ENDCASE => th _ NIL; IF th=NIL THEN TerminalIO.WriteRope["technology not implemented for Spinifex\n"]; END; callParameters: REF CallingRec = NARROW[comm.ref]; design _ callParameters.design; formatKey _ callParameters.formatKey; invocation _ callParameters; stopFlag _ callParameters.stopFlag; stopFlag^ _ FALSE; sxTech _ GetSXTech[design.technology]; IF sxTech#NIL THEN ProtectedAnalyze[callParameters.hierarchyRoots]; design _ NIL; invocation _ NIL; formatKey _ NIL; sxTech _ NIL; END; ProtectedAnalyze: PROC [hierarchyRoots: CD.InstanceList] = BEGIN SXAccessInternal.Analyze[hierarchyRoots]; <<--OldSpinifexAccess.Analyze[design, hierarchyRoots, formatKey, stopFlag];->> END; END. <<>>