DIRECTORY FS, IO, OrderedSymbolTableRef, Rope, RoseTranslateTypes, RoseTranslateInsides, TextNode, TiogaFileOps, TiogaOps, ViewerClasses, ViewerOps; RoseTranslateSymbols: CEDAR PROGRAM IMPORTS FS, IO, OSTR: OrderedSymbolTableRef, Rope, RoseTranslateInsides EXPORTS RoseTranslateInsides = BEGIN OPEN RoseTranslateTypes, RoseTranslateInsides; AddSymbols: PUBLIC PROC [job: Job, rootName: ROPE] = BEGIN error: BOOLEAN _ FALSE; IF job.libbed.Lookup[rootName] # NIL THEN RETURN; job.libbed.Insert[rootName]; IF NOT error THEN [] _ DigestSymbols[job, rootName]; END; DigestSymbols: PROC [parent: Job, rootName: ROPE] RETURNS [error: BOOLEAN] = BEGIN job: Job _ NEW [JobRep _ [ log: parent.log, exec: parent.exec, rootName: rootName, things: parent.things, type: TranslateJob]]; job.from _ FS.StreamOpen[rootName.Concat[".RoseSymbols"] !FS.Error => BEGIN Whimper[parent, "Unable to open %g.RoseSymbols", IO.rope[rootName]]; job.from _ NIL; CONTINUE; END]; IF job.from = NIL THEN RETURN [TRUE]; job.log.PutF["Reading symbols from %g.RoseSymbols...\n", IO.rope[rootName]]; [] _ job.from.SkipWhitespace[flushComments: FALSE]; WHILE NOT job.from.EndOf[] DO className: ROPE _ job.from.GetTokenRope[MyBreak].token; definer: ROPE _ job.from.GetTokenRope[MyBreak].token; bits: CARDINAL _ job.from.GetInt[]; defaultInitExpr: ROPE _ NARROW[job.from.GetRefAny[]]; asAny: REF ANY; stoppedOn: ROPE; cce: ccEntry _ NEW [SymbolTableEntryRep[cellClass] _ [name: className, value: cellClass[definedIn: rootName, cd: NEW [CellDefRep _ [defaultInitExprGiven: (bits MOD 2) > 0, initializerGiven: (bits MOD 4) > 1, initDataGiven: (bits MOD 8) > 3, defaultInitExpr: defaultInitExpr]] ]]]; iel: InterfaceEltList; [asAny, stoppedOn] _ ParseExpression[job, TRUE]; IF NOT stoppedOn.Equal["!!"] THEN BEGIN [] _ Complain[job, "Not terminated properly"]; job.log.PutRope["Done reading symbols\n"]; RETURN [TRUE]; END; IF asAny = NIL THEN iel _ NIL ELSE WITH asAny SELECT FROM sb: SquareBracketed => iel _ sb.iel; ENDCASE => BEGIN [] _ Complain[job, "Bad interface: %g", IO.refAny[asAny]]; job.log.PutRope["Done reading symbols\n"]; RETURN [TRUE]; END; IF (cce.cd.interface _ DigestInterface[job, iel]) = NIL THEN BEGIN job.log.PutRope["Done reading symbols\n"]; RETURN [TRUE]; END; AddCellClass[job, cce]; [] _ job.from.SkipWhitespace[flushComments: FALSE]; ENDLOOP; job.log.PutRope["Done reading symbols\n"]; END; AddCellClass: PUBLIC PROC [job: Job, cce: ccEntry] = BEGIN ste: SymbolTableEntry _ NARROW[job.things.Lookup[cce.name]]; complain: BOOLEAN _ ste # NIL; IF complain THEN WITH ste SELECT FROM oldCCE: ccEntry => IF oldCCE.definedIn = NIL AND cce.definedIn # NIL THEN BEGIN oldCCE.definedIn _ cce.definedIn; oldCCE.cd _ cce.cd; RETURN; END; ENDCASE; IF complain THEN BEGIN Whimper[job, "Multiple definition of cell class %g", IO.rope[cce.name]]; END ELSE job.things.Insert[cce]; END; DigestInterface: PUBLIC PROC [context: REF ANY, iel: InterfaceEltList] RETURNS [di: DigestedInterface] = BEGIN di _ NEW [DigestedInterfaceRep _ [ asTable: OSTR.CreateTable[CompareInterfaceElts], asList: iel]]; FOR iel _ iel, iel.rest WHILE iel # NIL DO IF di.asTable.Lookup[iel.first.name] # NIL THEN BEGIN [] _ Complain[context, "Multiple def of %g in interface %g", IO.rope[iel.first.name], IO.refAny[di]]; RETURN [NIL]; END; di.asTable.Insert[iel.first]; IF NOT iel.first.sti.st.simple THEN di.hasSwitchElt _ TRUE; ENDLOOP; END; CompareInterfaceElts: OSTR.CompareProc = BEGIN s1, s2: ROPE; s1 _ WITH r1 SELECT FROM r: ROPE => r, ie: InterfaceElt => ie.name, ENDCASE => ERROR; s2 _ WITH r2 SELECT FROM r: ROPE => r, ie: InterfaceElt => ie.name, ENDCASE => ERROR; RETURN [s1.Compare[s2, FALSE]]; END; END. ZRoseTranslateSymbols.Mesa Last Edited by: Spreitzer, March 11, 1984 6:33:53 pm PST Κ*˜J™J™8J˜codešΟk œœœ„˜”K˜—šΠbxœœ˜#Kšœœœœ3˜GKšœ˜—K˜Kšœœ*˜4K˜šΟn œœœœ˜4Kš˜Kšœœœ˜K˜Kšœœœœ˜1K˜K˜Kšœœœ#˜4Kšœ˜—K˜š Ÿ œœœœ œ˜LKš˜šœ œ ˜Kšœ˜K˜K˜K˜K˜—šœ œ-œ ˜EKš˜Kšœ1œ˜DKšœ œ˜Kšœ˜ Kšœ˜—Kš œ œœœœ˜%Kšœ9œ˜LKšœ,œ˜3šœœ˜Kšœ œ(˜7Kšœ œ(˜5Kšœœ˜#Kšœœœ˜5Kšœœœ˜Kšœ œ˜Kš œœ_œ,œ!œœ0˜˜K˜Kšœ*œ˜0šœœ˜!Kš˜K˜.K˜*Kšœœ˜Kšœ˜—Kšœ œœ˜šœœœ˜K˜$šœ˜Kšœ(œ˜:K˜*Kšœœ˜Kšœ˜——šœ2œ˜