DIRECTORY FS USING [StreamOpen], IO USING [Backup, BreakProc, EndOf, GetChar, GetInt, GetLineRope, GetTokenRope, RIS, STREAM], Rope USING [Equal, ROPE], ExpertPinRead, SymTab USING [Create, Fetch, Ref, Store]; ExpertPinReadImpl: CEDAR PROGRAM IMPORTS FS, IO, Rope, SymTab EXPORTS ExpertPinRead ~ BEGIN ROPE: TYPE = Rope.ROPE; PinTable: TYPE = ExpertPinRead.PinTable; PinInfoList: TYPE = ExpertPinRead.PinInfoList; PinInfo: TYPE = ExpertPinRead.PinInfo; TokenProc1: IO.BreakProc ~ { -- Takes any character different from SP for the name IF char = ' THEN RETURN [sepr]; RETURN [other]; }; ProcessEachLine: PROC [pinTable: PinTable, line: ROPE] ~ { c: CHAR; pinInfoList: PinInfoList; pinInfo: PinInfo; in: IO.STREAM _ IO.RIS[line]; key: ROPE _ IO.GetTokenRope[in, TokenProc1].token; [] _ IO.GetTokenRope[in, TokenProc1]; --Skips two token [] _ IO.GetTokenRope[in, TokenProc1]; pinInfo.refDes _ IO.GetTokenRope[in, TokenProc1].token; IF Rope.Equal[pinInfo.refDes, "?"] THEN { -- Symbol not yet placed pinInfo.refDes _ NIL; [] _ IO.GetTokenRope[in, TokenProc1]; pinInfo.pinNumber _ 0; } ELSE { pinInfo.pinNumber _ IO.GetInt[in]; }; [] _ IO.GetChar[in]; -- Skips one character c _ IO.GetChar[in]; IO.Backup[in, c]; IF c = ' THEN { -- Tests the presence of a symbol pin mame pinInfo.symbolPinName _ NIL } ELSE { pinInfo.symbolPinName _ IO.GetTokenRope[in, TokenProc1].token; }; [] _ IO.GetTokenRope[in, TokenProc1]; pinInfo.pageNumber _ IO.GetInt[in]; pinInfoList _ NIL; IF SymTab.Fetch[pinTable, key].found THEN { pinInfoList _ NARROW[SymTab.Fetch[pinTable, key].val]; }; pinInfoList _ CONS[pinInfo, pinInfoList]; [] _ SymTab.Store[pinTable, key, pinInfoList]; }; ReadPinFile: PUBLIC PROC [file: ROPE] RETURNS [pinTable: PinTable] ~ { line, spareLine: ROPE; exit: BOOLEAN _ FALSE; in: IO.STREAM _ FS.StreamOpen[file]; pinTable _ SymTab.Create[]; WHILE NOT Rope.Equal[IO.GetTokenRope[in].token, "wattage"] DO ENDLOOP; WHILE IO.GetLineRope[in] # NIL DO ENDLOOP; line _ IO.GetLineRope[in]; WHILE NOT IO.EndOf[in] AND line # NIL DO spareLine _ IO.GetLineRope[in]; ProcessEachLine[pinTable, line]; line _ spareLine; ENDLOOP; }; END. ~ExpertPinReadImpl.mesa Copyright Σ 1988 by Xerox Corporation. All rights reserved. Christophe Cuenod, May 25, 1989 12:54:37 pm PDT Reads an Expert .pinlist file and retrieve the pin info Private procedures Possible to land here if the pin name has a wrong character (ie a space) ... Public Procedures Skip the begining of the file and position at the first pin line Κ₯˜code•Mark outsideHeaderšœ™Kšœ<™K˜—Kšœœ˜%šœœ ˜#KšœL™L—Kšœœ˜šœ#œ˜+Kšœœ"˜6K˜—Kšœœ˜)Kšœ.˜.K˜——™š ž œœœœœ˜FKšœœ˜Kšœœœ˜Kšœœœœ˜$Jšœ˜J™Bšœœ œ$˜>Kšœ˜—šœœœ˜!Kšœ˜—Jšœœ˜š œœœ œœ˜(Jšœ œ˜Jšœ ˜ Jšœ˜Kšœ˜—J˜K™——K˜Kšœ˜—…—T w