<> <> DIRECTORY Asserting, AssertingIO, FS, IO, Rope, RoseCreate, RoseTranslateTypes, RoseTranslateInsides, RoseTypes; RopePorts: CEDAR PROGRAM IMPORTS AssertingIO, FS, IO, RoseTranslateInsides EXPORTS RoseCreate = BEGIN OPEN RoseTypes, RoseTranslateTypes, RoseTranslateInsides; PortsFromROPE: PUBLIC PROC [asRope: ROPE] RETURNS [ports: Ports] = {ports _ PortsFromStream[IO.RIS[asRope]]}; PortsFromFile: PUBLIC PROC [fileName: ROPE] RETURNS [ports: Ports] = {ports _ PortsFromStream[FS.StreamOpen[fileName]]}; PortsFromStream: PUBLIC PROC [stream: STREAM] RETURNS [ports: Ports] = BEGIN length: CARDINAL _ stream.GetCard[]; ports _ NEW [PortsRep[length]]; FOR portIndex: CARDINAL IN [0 .. length) DO job: Job _ NEW [JobRep _ [ exec: NIL, rootName: NIL, from: NIL, log: viewerLog, type: Other]]; any: REF ANY; bits: [0 .. 16); typeAsRope: ROPE; ports[portIndex].firstWord _ stream.GetCard[]; ports[portIndex].wordCount _ stream.GetCard[]; ports[portIndex].name _ stream.GetRopeLiteral[]; typeAsRope _ stream.GetRopeLiteral[]; job.from _ IO.RIS[typeAsRope]; any _ ParseExpression[job]; WITH any SELECT FROM sti: SignalTypeInvocation => ports[portIndex].type _ sti.st; id: ID => {sti: SignalTypeInvocation _ InstantiateSignalType[job, id.rope, NIL]; ports[portIndex].type _ sti.st}; ENDCASE => ERROR; bits _ stream.GetCard[]; ports[portIndex].input _ (bits MOD 2) >= 1; ports[portIndex].output _ (bits MOD 4) >= 2; ports[portIndex].XPhobic _ (bits MOD 8) >= 4; ports[portIndex].special _ (bits MOD 16) >= 8; ports[portIndex].other _ AssertingIO.Read[stream]; ENDLOOP; [] _ stream.SkipWhitespace[flushComments: FALSE]; IF NOT stream.EndOf[] THEN ERROR; END; END.